summaryrefslogtreecommitdiffstats
path: root/setup.py
blob: 4a365d53f0d620244176114fdca2a2d5aff6e8e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
# Autodetecting setup.py script for building the Python extensions
#

__version__ = "$Revision$"

import sys, os, getopt, imp
from distutils import sysconfig
from distutils import text_file
from distutils.errors import *
from distutils.core import Extension, setup
from distutils.command.build_ext import build_ext
from distutils.command.install import install

# This global variable is used to hold the list of modules to be disabled.
disabled_module_list = []

def add_dir_to_list(dirlist, dir):
    """Add the directory 'dir' to the list 'dirlist' (at the front) if
    1) 'dir' is not already in 'dirlist'
    2) 'dir' actually exists, and is a directory."""
    if dir is not None and os.path.isdir(dir) and dir not in dirlist:
        dirlist.insert(0, dir)

def find_file(filename, std_dirs, paths):
    """Searches for the directory where a given file is located,
    and returns a possibly-empty list of additional directories, or None
    if the file couldn't be found at all.

    'filename' is the name of a file, such as readline.h or libcrypto.a.
    'std_dirs' is the list of standard system directories; if the
        file is found in one of them, no additional directives are needed.
    'paths' is a list of additional locations to check; if the file is
        found in one of them, the resulting list will contain the directory.
    """

    # Check the standard locations
    for dir in std_dirs:
        f = os.path.join(dir, filename)
        if os.path.exists(f): return []

    # Check the additional directories
    for dir in paths:
        f = os.path.join(dir, filename)
        if os.path.exists(f):
            return [dir]

    # Not found anywhere
    return None

def find_library_file(compiler, libname, std_dirs, paths):
    filename = compiler.library_filename(libname, lib_type='shared')
    result = find_file(filename, std_dirs, paths)
    if result is not None: return result

    filename = compiler.library_filename(libname, lib_type='static')
    result = find_file(filename, std_dirs, paths)
    return result

def module_enabled(extlist, modname):
    """Returns whether the module 'modname' is present in the list
    of extensions 'extlist'."""
    extlist = [ext for ext in extlist if ext.name == modname]
    return len(extlist)

def find_module_file(module, dirlist):
    """Find a module in a set of possible folders. If it is not found
    return the unadorned filename"""
    list = find_file(module, [], dirlist)
    if not list:
        return module
    if len(list) > 1:
        self.announce("WARNING: multiple copies of %s found"%module)
    return os.path.join(list[0], module)

class PyBuildExt(build_ext):

    def build_extensions(self):

        # Detect which modules should be compiled
        self.detect_modules()

        # Remove modules that are present on the disabled list
        self.extensions = [ext for ext in self.extensions
                           if ext.name not in disabled_module_list]

        # Fix up the autodetected modules, prefixing all the source files
        # with Modules/ and adding Python's include directory to the path.
        (srcdir,) = sysconfig.get_config_vars('srcdir')

        # Figure out the location of the source code for extension modules
        moddir = os.path.join(os.getcwd(), srcdir, 'Modules')
        moddir = os.path.normpath(moddir)
        srcdir, tail = os.path.split(moddir)
        srcdir = os.path.normpath(srcdir)
        moddir = os.path.normpath(moddir)

        moddirlist = [moddir]
        incdirlist = ['./Include']

        # Platform-dependent module source and include directories
        platform = self.get_platform()
        if platform in ('darwin', 'mac'):
            # Mac OS X also includes some mac-specific modules
            macmoddir = os.path.join(os.getcwd(), srcdir, 'Mac/Modules')
            moddirlist.append(macmoddir)
            incdirlist.append('./Mac/Include')

        alldirlist = moddirlist + incdirlist

        # Fix up the paths for scripts, too
        self.distribution.scripts = [os.path.join(srcdir, filename)
                                     for filename in self.distribution.scripts]

        for ext in self.extensions[:]:
            ext.sources = [ find_module_file(filename, moddirlist)
                            for filename in ext.sources ]
            if ext.depends is not None:
                ext.depends = [find_module_file(filename, alldirlist)
                               for filename in ext.depends]
            ext.include_dirs.append( '.' ) # to get config.h
            for incdir in incdirlist:
                ext.include_dirs.append( os.path.join(srcdir, incdir) )

            # If a module has already been built statically,
            # don't build it here
            if ext.name in sys.builtin_module_names:
                self.extensions.remove(ext)

        if platform != 'mac':
            # Parse Modules/Setup to figure out which modules are turned
            # on in the file.
            input = text_file.TextFile('Modules/Setup', join_lines=1)
            remove_modules = []
            while 1:
                line = input.readline()
                if not line: break
                line = line.split()
                remove_modules.append( line[0] )
            input.close()
    
            for ext in self.extensions[:]:
                if ext.name in remove_modules:
                    self.extensions.remove(ext)

        # When you run "make CC=altcc" or something similar, you really want
        # those environment variables passed into the setup.py phase.  Here's
        # a small set of useful ones.
        compiler = os.environ.get('CC')
        linker_so = os.environ.get('LDSHARED')
        args = {}
        # unfortunately, distutils doesn't let us provide separate C and C++
        # compilers
        if compiler is not None:
            (ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT')
            args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared
        if linker_so is not None:
            args['linker_so'] = linker_so
        self.compiler.set_executables(**args)

        build_ext.build_extensions(self)

    def build_extension(self, ext):

        try:
            build_ext.build_extension(self, ext)
        except (CCompilerError, DistutilsError), why:
            self.announce('WARNING: building of extension "%s" failed: %s' %
                          (ext.name, sys.exc_info()[1]))
            return
        # Workaround for Mac OS X: The Carbon-based modules cannot be
        # reliably imported into a command-line Python
        if 'Carbon' in ext.extra_link_args:
            self.announce(
                'WARNING: skipping import check for Carbon-based "%s"' %
                ext.name)
            return
        # Workaround for Cygwin: Cygwin currently has fork issues when many
        # modules have been imported
        if self.get_platform() == 'cygwin':
            self.announce('WARNING: skipping import check for Cygwin-based "%s"'
                % ext.name)
            return
        ext_filename = os.path.join(
            self.build_lib,
            self.get_ext_filename(self.get_ext_fullname(ext.name)))
        try:
            imp.load_dynamic(ext.name, ext_filename)
        except ImportError, why:

            if 1:
                self.announce('*** WARNING: renaming "%s" since importing it'
                              ' failed: %s' % (ext.name, why))
                assert not self.inplace
                basename, tail = os.path.splitext(ext_filename)
                newname = basename + "_failed" + tail
                if os.path.exists(newname): os.remove(newname)
                os.rename(ext_filename, newname)

                # XXX -- This relies on a Vile HACK in
                # distutils.command.build_ext.build_extension().  The
                # _built_objects attribute is stored there strictly for
                # use here.
                # If there is a failure, _built_objects may not be there,
                # so catch the AttributeError and move on.
                try:
                    for filename in self._built_objects:
                        os.remove(filename)
                except AttributeError:
                    self.announce('unable to remove files (ignored)')
            else:
                self.announce('*** WARNING: importing extension "%s" '
                              'failed: %s' % (ext.name, why))

    def get_platform (self):
        # Get value of sys.platform
        platform = sys.platform
        if platform[:6] =='cygwin':
            platform = 'cygwin'
        elif platform[:4] =='beos':
            platform = 'beos'
        elif platform[:6] == 'darwin':
            platform = 'darwin'
        elif platform[:6] == 'atheos':
            platform = 'atheos'

        return platform

    def detect_modules(self):
        # Ensure that /usr/local is always used
        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')

        add_dir_to_list(self.compiler.library_dirs,
                        sysconfig.get_config_var("LIBDIR"))
        add_dir_to_list(self.compiler.include_dirs,
                        sysconfig.get_config_var("INCLUDEDIR"))

        try:
            have_unicode = unicode
        except NameError:
            have_unicode = 0

        # lib_dirs and inc_dirs are used to search for files;
        # if a file is found in one of those directories, it can
        # be assumed that no additional -I,-L directives are needed.
        lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib']
        inc_dirs = self.compiler.include_dirs + ['/usr/include']
        exts = []

        platform = self.get_platform()
        (srcdir,) = sysconfig.get_config_vars('srcdir')

        # Check for AtheOS which has libraries in non-standard locations
        if platform == 'atheos':
            lib_dirs += ['/system/libs', '/atheos/autolnk/lib']
            lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
            inc_dirs += ['/system/include', '/atheos/autolnk/include']
            inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)

        # Check for MacOS X, which doesn't need libm.a at all
        math_libs = ['m']
        if platform in ['darwin', 'beos', 'mac']:
            math_libs = []

        # XXX Omitted modules: gl, pure, dl, SGI-specific modules

        #
        # The following modules are all pretty straightforward, and compile
        # on pretty much any POSIXish platform.
        #

        # Some modules that are normally always on:
        exts.append( Extension('regex', ['regexmodule.c', 'regexpr.c']) )
        exts.append( Extension('pcre', ['pcremodule.c', 'pypcre.c']) )

        exts.append( Extension('_hotshot', ['_hotshot.c']) )
        exts.append( Extension('_weakref', ['_weakref.c']) )
        exts.append( Extension('xreadlines', ['xreadlinesmodule.c']) )

        # array objects
        exts.append( Extension('array', ['arraymodule.c']) )
        # complex math library functions
        exts.append( Extension('cmath', ['cmathmodule.c'],
                               libraries=math_libs) )

        # math library functions, e.g. sin()
        exts.append( Extension('math',  ['mathmodule.c'],
                               libraries=math_libs) )
        # fast string operations implemented in C
        exts.append( Extension('strop', ['stropmodule.c']) )
        # time operations and variables
        exts.append( Extension('time', ['timemodule.c'],
                               libraries=math_libs) )
        # operator.add() and similar goodies
        exts.append( Extension('operator', ['operator.c']) )
        # access to the builtin codecs and codec registry
        exts.append( Extension('_codecs', ['_codecsmodule.c']) )
        # Python C API test module
        exts.append( Extension('_testcapi', ['_testcapimodule.c']) )
        # static Unicode character database
        if have_unicode:
            exts.append( Extension('unicodedata', ['unicodedata.c']) )
        # access to ISO C locale support
        exts.append( Extension('_locale', ['_localemodule.c']) )

        # Modules with some UNIX dependencies -- on by default:
        # (If you have a really backward UNIX, select and socket may not be
        # supported...)

        # fcntl(2) and ioctl(2)
        exts.append( Extension('fcntl', ['fcntlmodule.c']) )
        if platform not in ['mac']:
                # pwd(3)
                exts.append( Extension('pwd', ['pwdmodule.c']) )
                # grp(3)
                exts.append( Extension('grp', ['grpmodule.c']) )
        # posix (UNIX) errno values
        exts.append( Extension('errno', ['errnomodule.c']) )
        # select(2); not on ancient System V
        exts.append( Extension('select', ['selectmodule.c']) )

        # The md5 module implements the RSA Data Security, Inc. MD5
        # Message-Digest Algorithm, described in RFC 1321.  The
        # necessary files md5c.c and md5.h are included here.
        exts.append( Extension('md5', ['md5module.c', 'md5c.c']) )

        # The sha module implements the SHA checksum algorithm.
        # (NIST's Secure Hash Algorithm.)
        exts.append( Extension('sha', ['shamodule.c']) )

        # Helper module for various ascii-encoders
        exts.append( Extension('binascii', ['binascii.c']) )

        # Fred Drake's interface to the Python parser
        exts.append( Extension('parser', ['parsermodule.c']) )

        # cStringIO and cPickle
        exts.append( Extension('cStringIO', ['cStringIO.c']) )
        exts.append( Extension('cPickle', ['cPickle.c']) )

        # Memory-mapped files (also works on Win32).
        if platform not in ['atheos', 'mac']:
            exts.append( Extension('mmap', ['mmapmodule.c']) )

        # Lance Ellinghaus's modules:
        # enigma-inspired encryption
        exts.append( Extension('rotor', ['rotormodule.c']) )
        if platform not in ['mac']:
                # syslog daemon interface
                exts.append( Extension('syslog', ['syslogmodule.c']) )

        # George Neville-Neil's timing module:
        exts.append( Extension('timing', ['timingmodule.c']) )

        #
        # Here ends the simple stuff.  From here on, modules need certain
        # libraries, are platform-specific, or present other surprises.
        #

        # Multimedia modules
        # These don't work for 64-bit platforms!!!
        # These represent audio samples or images as strings:

        # Disabled on 64-bit platforms
        if sys.maxint != 9223372036854775807L:
            # Operations on audio samples
            exts.append( Extension('audioop', ['audioop.c']) )
            # Operations on images
            exts.append( Extension('imageop', ['imageop.c']) )
            # Read SGI RGB image files (but coded portably)
            exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )

        # readline
        if self.compiler.find_library_file(lib_dirs, 'readline'):
            readline_libs = ['readline']
            if self.compiler.find_library_file(lib_dirs,
                                                 'ncurses'):
                readline_libs.append('ncurses')
            elif self.compiler.find_library_file(lib_dirs +
                                               ['/usr/lib/termcap'],
                                               'termcap'):
                readline_libs.append('termcap')
            exts.append( Extension('readline', ['readline.c'],
                                   library_dirs=['/usr/lib/termcap'],
                                   libraries=readline_libs) )
        if platform not in ['mac']:
                # crypt module.
        
                if self.compiler.find_library_file(lib_dirs, 'crypt'):
                    libs = ['crypt']
                else:
                    libs = []
                exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) )

        # socket(2)
        exts.append( Extension('_socket', ['socketmodule.c'],
                               depends = ['socketmodule.h']) )
        # Detect SSL support for the socket module (via _ssl)
        ssl_incs = find_file('openssl/ssl.h', inc_dirs,
                             ['/usr/local/ssl/include',
                              '/usr/contrib/ssl/include/'
                             ]
                             )
        ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
                                     ['/usr/local/ssl/lib',
                                      '/usr/contrib/ssl/lib/'
                                     ] )

        if (ssl_incs is not None and
            ssl_libs is not None):
            exts.append( Extension('_ssl', ['_ssl.c'],
                                   include_dirs = ssl_incs,
                                   library_dirs = ssl_libs,
                                   libraries = ['ssl', 'crypto'],
                                   depends = ['socketmodule.h']), )

        # Modules that provide persistent dictionary-like semantics.  You will
        # probably want to arrange for at least one of them to be available on
        # your machine, though none are defined by default because of library
        # dependencies.  The Python module anydbm.py provides an
        # implementation independent wrapper for these; dumbdbm.py provides
        # similar functionality (but slower of course) implemented in Python.

        # Berkeley DB interface.
        #
        # This requires the Berkeley DB code, see
        # ftp://ftp.cs.berkeley.edu/pub/4bsd/db.1.85.tar.gz
        #
        # (See http://pybsddb.sourceforge.net/ for an interface to
        # Berkeley DB 3.x.)

        # when sorted in reverse order, keys for this dict must appear in the
        # order you wish to search - e.g., search for db3 before db2, db2
        # before db1
        db_try_this = {
            'db4': {'libs': ('db-4.3', 'db-4.2', 'db-4.1', 'db-4.0'),
                    'libdirs': ('/usr/local/BerkeleyDB.4.3/lib',
                                '/usr/local/BerkeleyDB.4.2/lib',
                                '/usr/local/BerkeleyDB.4.1/lib',
                                '/usr/local/BerkeleyDB.4.0/lib',
                                '/usr/lib',
                                '/opt/sfw',
                                '/sw/lib',
                                '/lib',
                                ),
                    'incdirs': ('/usr/local/BerkeleyDB.4.3/include',
                                '/usr/local/BerkeleyDB.4.2/include',
                                '/usr/local/BerkeleyDB.4.1/include',
                                '/usr/local/BerkeleyDB.4.0/include',
                                '/usr/include/db3',
                                '/opt/sfw/include/db3',
                                '/sw/include/db3',
                                '/usr/local/include/db3',
                                ),
                    'incs': ('db_185.h',)},
            'db3': {'libs': ('db-3.3', 'db-3.2', 'db-3.1', 'db-3.0'),
                    'libdirs': ('/usr/local/BerkeleyDB.3.3/lib',
                                '/usr/local/BerkeleyDB.3.2/lib',
                                '/usr/local/BerkeleyDB.3.1/lib',
                                '/usr/local/BerkeleyDB.3.0/lib',
                                '/usr/lib',
                                '/opt/sfw',
                                '/sw/lib',
                                '/lib',
                                ),
                    'incdirs': ('/usr/local/BerkeleyDB.3.3/include',
                                '/usr/local/BerkeleyDB.3.2/include',
                                '/usr/local/BerkeleyDB.3.1/include',
                                '/usr/local/BerkeleyDB.3.0/include',
                                '/usr/include/db3',
                                '/opt/sfw/include/db3',
                                '/sw/include/db3',
                                '/usr/local/include/db3',
                                ),
                    'incs': ('db_185.h',)},
            'db2': {'libs': ('db2',),
                    'libdirs': ('/usr/lib', '/sw/lib', '/lib'),
                    'incdirs': ('/usr/include/db2',
                                '/usr/local/include/db2', '/sw/include/db2'),
                    'incs': ('db_185.h',)},
            # if you are willing to risk hash db file corruption you can
            # uncomment the lines below for db1.  Note that this will affect
            # not only the bsddb module, but the dbhash and anydbm modules
            # as well.  you have been warned!!!
            ##'db1': {'libs': ('db1', 'db'),
            ##        'libdirs': ('/usr/lib', '/sw/lib', '/lib'),
            ##        'incdirs': ('/usr/include/db1', '/usr/local/include/db1',
            ##                    '/usr/include', '/usr/local/include'),
            ##        'incs': ('db.h',)},
            }

        # override this list to affect the library version search order
        # for example, if you want to force version 2 to be used:
        #   db_search_order = ["db2"]
        db_search_order = db_try_this.keys()
        db_search_order.sort()
        db_search_order.reverse()
        
        find_lib_file = self.compiler.find_library_file
        class found(Exception): pass
        try:
            for dbkey in db_search_order:
                dbd = db_try_this[dbkey]
                for dblib in dbd['libs']:
                    for dbinc in dbd['incs']:
                        db_incs = find_file(dbinc, [], dbd['incdirs'])
                        dblib_dir = find_lib_file(dbd['libdirs'], dblib)
                        if db_incs and dblib_dir:
                            dblib_dir = os.path.dirname(dblib_dir)
                            dblibs = [dblib]
                            raise found
        except found:
            dblibs = [dblib]
            # A default source build puts Berkeley DB in something like
            # /usr/local/Berkeley.3.3 and the lib dir under that isn't
            # normally on ld.so's search path, unless the sysadmin has hacked
            # /etc/ld.so.conf.  We add the directory to runtime_library_dirs
            # so the proper -R/--rpath flags get passed to the linker.  This
            # is usually correct and most trouble free, but may cause problems
            # in some unusual system configurations (e.g. the directory is on
            # an NFS server that goes away).
            if dbinc == 'db_185.h':
                exts.append(Extension('bsddb', ['bsddbmodule.c'],
                                      library_dirs=[dblib_dir],
                                      runtime_library_dirs=[dblib_dir],
                                      include_dirs=db_incs,
                                      define_macros=[('HAVE_DB_185_H',1)],
                                      libraries=dblibs))
            else:
                exts.append(Extension('bsddb', ['bsddbmodule.c'],
                                      library_dirs=[dblib_dir],
                                      runtime_library_dirs=[dblib_dir],
                                      include_dirs=db_incs,
                                      libraries=dblibs))
        else:
            db_incs = None
            dblibs = []
            dblib_dir = None

        # The standard Unix dbm module:
        if platform not in ['cygwin']:
            if (self.compiler.find_library_file(lib_dirs, 'ndbm')
                and find_file("ndbm.h", inc_dirs, []) is not None):
                exts.append( Extension('dbm', ['dbmmodule.c'],
                                       define_macros=[('HAVE_NDBM_H',None)],
                                       libraries = ['ndbm'] ) )
            elif (platform in ['darwin']
                and find_file("ndbm.h", inc_dirs, []) is not None):
                # Darwin has ndbm in libc
                exts.append( Extension('dbm', ['dbmmodule.c'],
                                       define_macros=[('HAVE_NDBM_H',None)]) )
            elif (self.compiler.find_library_file(lib_dirs, 'gdbm')
                  and find_file("gdbm/ndbm.h", inc_dirs, []) is not None):
                exts.append( Extension('dbm', ['dbmmodule.c'],
                                       define_macros=[('HAVE_GDBM_NDBM_H',None)],
                                       libraries = ['gdbm'] ) )
            elif db_incs is not None:
                exts.append( Extension('dbm', ['dbmmodule.c'],
                                       library_dirs=[dblib_dir],
                                       include_dirs=db_incs,
                                       define_macros=[('HAVE_BERKDB_H',None),
                                                      ('DB_DBM_HSEARCH',None)],
                                       libraries=dblibs))

        # Anthony Baxter's gdbm module.  GNU dbm(3) will require -lgdbm:
        if (self.compiler.find_library_file(lib_dirs, 'gdbm')):
            exts.append( Extension('gdbm', ['gdbmmodule.c'],
                                   libraries = ['gdbm'] ) )

        # The mpz module interfaces to the GNU Multiple Precision library.
        # You need to ftp the GNU MP library.
        # This was originally written and tested against GMP 1.2 and 1.3.2.
        # It has been modified by Rob Hooft to work with 2.0.2 as well, but I
        # haven't tested it recently, and it definitely doesn't work with
        # GMP 4.0.  For more complete modules, refer to
        # http://gmpy.sourceforge.net and
        # http://www.egenix.com/files/python/mxNumber.html

        # A compatible MP library unencumbered by the GPL also exists.  It was
        # posted to comp.sources.misc in volume 40 and is widely available from
        # FTP archive sites. One URL for it is:
        # ftp://gatekeeper.dec.com/.b/usenet/comp.sources.misc/volume40/fgmp/part01.Z

        if (self.compiler.find_library_file(lib_dirs, 'gmp')):
            exts.append( Extension('mpz', ['mpzmodule.c'],
                                   libraries = ['gmp'] ) )


        # Unix-only modules
        if platform not in ['mac', 'win32']:
            # Steen Lumholt's termios module
            exts.append( Extension('termios', ['termios.c']) )
            # Jeremy Hylton's rlimit interface
	    if platform not in ['atheos']:
                exts.append( Extension('resource', ['resource.c']) )

            # Sun yellow pages. Some systems have the functions in libc.
            if platform not in ['cygwin', 'atheos']:
                if (self.compiler.find_library_file(lib_dirs, 'nsl')):
                    libs = ['nsl']
                else:
                    libs = []
                exts.append( Extension('nis', ['nismodule.c'],
                                       libraries = libs) )

        # Curses support, requring the System V version of curses, often
        # provided by the ncurses library.
        if platform == 'sunos4':
            inc_dirs += ['/usr/5include']
            lib_dirs += ['/usr/5lib']

        if (self.compiler.find_library_file(lib_dirs, 'ncurses')):
            curses_libs = ['ncurses']
            exts.append( Extension('_curses', ['_cursesmodule.c'],
                                   libraries = curses_libs) )
        elif (self.compiler.find_library_file(lib_dirs, 'curses')
              and platform != 'darwin'):
                # OSX has an old Berkeley curses, not good enough for
                # the _curses module.
            if (self.compiler.find_library_file(lib_dirs, 'terminfo')):
                curses_libs = ['curses', 'terminfo']
            else:
                curses_libs = ['curses', 'termcap']

            exts.append( Extension('_curses', ['_cursesmodule.c'],
                                   libraries = curses_libs) )

        # If the curses module is enabled, check for the panel module
        if (module_enabled(exts, '_curses') and
            self.compiler.find_library_file(lib_dirs, 'panel')):
            exts.append( Extension('_curses_panel', ['_curses_panel.c'],
                                   libraries = ['panel'] + curses_libs) )



        # Lee Busby's SIGFPE modules.
        # The library to link fpectl with is platform specific.
        # Choose *one* of the options below for fpectl:

        if platform == 'irix5':
            # For SGI IRIX (tested on 5.3):
            exts.append( Extension('fpectl', ['fpectlmodule.c'],
                                   libraries=['fpe']) )
        elif 0: # XXX how to detect SunPro?
            # For Solaris with SunPro compiler (tested on Solaris 2.5
            # with SunPro C 4.2): (Without the compiler you don't have
            # -lsunmath.)
            #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm
            pass
        else:
            # For other systems: see instructions in fpectlmodule.c.
            #fpectl fpectlmodule.c ...
            exts.append( Extension('fpectl', ['fpectlmodule.c']) )


        # Andrew Kuchling's zlib module.
        # This require zlib 1.1.3 (or later).
        # See http://www.cdrom.com/pub/infozip/zlib/
        zlib_inc = find_file('zlib.h', [], inc_dirs)
        if zlib_inc is not None:
            zlib_h = zlib_inc[0] + '/zlib.h'
            version = '"0.0.0"'
            version_req = '"1.1.3"'
            fp = open(zlib_h)
            while 1:
                line = fp.readline()
                if not line:
                    break
                if line.find('#define ZLIB_VERSION', 0) == 0:
                    version = line.split()[2]
                    break
            if version >= version_req:
                if (self.compiler.find_library_file(lib_dirs, 'z')):
                    exts.append( Extension('zlib', ['zlibmodule.c'],
                                           libraries = ['z']) )

        # Interface to the Expat XML parser
        #
        # Expat was written by James Clark and is now maintained by a
        # group of developers on SourceForge; see www.libexpat.org for
        # more information.  The pyexpat module was written by Paul
        # Prescod after a prototype by Jack Jansen.  Source of Expat
        # 1.95.2 is included in Modules/expat/.  Usage of a system
        # shared libexpat.so/expat.dll is not advised.
        #
        # More information on Expat can be found at www.libexpat.org.
        #
        if sys.byteorder == "little":
            xmlbo = "12"
        else:
            xmlbo = "21"
        expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
        exts.append(Extension('pyexpat',
                              sources = [
            'pyexpat.c',
            'expat/xmlparse.c',
            'expat/xmlrole.c',
            'expat/xmltok.c',
            ],
                              define_macros = [
            ('HAVE_EXPAT_H',None),
            ('XML_NS', '1'),
            ('XML_DTD', '1'),
            ('XML_BYTE_ORDER', xmlbo),
            ('XML_CONTEXT_BYTES','1024'),
            ],
                              include_dirs = [expatinc]
                               ))                        

        # Dynamic loading module
        dl_inc = find_file('dlfcn.h', [], inc_dirs)
        if (dl_inc is not None) and (platform not in ['atheos']):
            exts.append( Extension('dl', ['dlmodule.c']) )

        # Platform-specific libraries
        if platform == 'linux2':
            # Linux-specific modules
            exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) )

        if platform == 'sunos5':
            # SunOS specific modules
            exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) )

        if platform == 'darwin':
            # Mac OS X specific modules. Modules linked against the Carbon
            # framework are only built for framework-enabled Pythons. As
            # of MacOSX 10.1 importing the Carbon framework from a non-windowing
            # application (MacOSX server, not logged in on the console) may
            # result in Python crashing.
            #
            # I would like to trigger on WITH_NEXT_FRAMEWORK but that isn't
            # available here. This Makefile variable is also what the install
            # procedure triggers on.
            exts.append( Extension('_CF', ['cf/_CFmodule.c', 'cf/pycfbridge.c'],
                        extra_link_args=['-framework', 'CoreFoundation']) )

            framework = sysconfig.get_config_var('PYTHONFRAMEWORK')
            if framework:
                exts.append( Extension('gestalt', ['gestaltmodule.c'],
                            extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('MacOS', ['macosmodule.c'],
                            extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('icglue', ['icgluemodule.c'],
                            extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('macfs',
                                       ['macfsmodule.c',
                                        '../Python/getapplbycreator.c'],
                            extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Res', ['res/_Resmodule.c'],
                            extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Snd', ['snd/_Sndmodule.c'],
                            extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('Nav', ['Nav.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_AE', ['ae/_AEmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_App', ['app/_Appmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_CarbonEvt', ['carbonevt/_CarbonEvtmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_CG', ['cg/_CGmodule.c'],
                        extra_link_args=['-framework', 'ApplicationServices',
                                         '-framework', 'Carbon']) )
                exts.append( Extension('_Cm', ['cm/_Cmmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Ctl', ['ctl/_Ctlmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Dlg', ['dlg/_Dlgmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Drag', ['drag/_Dragmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Evt', ['evt/_Evtmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Fm', ['fm/_Fmmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Icn', ['icn/_Icnmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_List', ['list/_Listmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Menu', ['menu/_Menumodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Qd', ['qd/_Qdmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_Qt', ['qt/_Qtmodule.c'],
                        extra_link_args=['-framework', 'QuickTime',
                                         '-framework', 'Carbon']) )
                exts.append( Extension('_Scrap', ['scrap/_Scrapmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                exts.append( Extension('_TE', ['te/_TEmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )
                # As there is no standardized place (yet) to put
                # user-installed Mac libraries on OSX, we search for "waste"
                # in parent directories of the Python source tree. You
                # should put a symlink to your Waste installation in the
                # same folder as your python source tree.  Or modify the
                # next few lines:-)
                waste_incs = find_file("WASTE.h", [], 
                        ['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)])
                waste_libs = find_library_file(self.compiler, "WASTE", [],
            [           "../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)])
                if waste_incs != None and waste_libs != None:
                    (srcdir,) = sysconfig.get_config_vars('srcdir')
                    exts.append( Extension('waste',
                                   ['waste/wastemodule.c'] + [
                                    os.path.join(srcdir, d) for d in 
                                    'Mac/Wastemods/WEObjectHandlers.c',
                                    'Mac/Wastemods/WETabHooks.c',
                                    'Mac/Wastemods/WETabs.c'
                                   ],
                                   include_dirs = waste_incs + [os.path.join(srcdir, 'Mac/Wastemods')],
                                   library_dirs = waste_libs,
                                   libraries = ['WASTE'],
                                   extra_link_args = ['-framework', 'Carbon'],
                    ) )
                exts.append( Extension('_Win', ['win/_Winmodule.c'],
                        extra_link_args=['-framework', 'Carbon']) )

        self.extensions.extend(exts)

        # Call the method for detecting whether _tkinter can be compiled
        self.detect_tkinter(inc_dirs, lib_dirs)

    def detect_tkinter_darwin(self, inc_dirs, lib_dirs):
        # The _tkinter module, using frameworks. Since frameworks are quite
        # different the UNIX search logic is not sharable.
        from os.path import join, exists
        framework_dirs = [
            '/System/Library/Frameworks/', 
            '/Library/Frameworks', 
            join(os.getenv('HOME'), '/Library/Frameworks')
        ]

        # Find the directory that contains the Tcl.framwork and Tk.framework
        # bundles.
        # XXX distutils should support -F!
        for F in framework_dirs:
            # both Tcl.framework and Tk.framework should be present 
            for fw in 'Tcl', 'Tk':
            	if not exists(join(F, fw + '.framework')):
                    break
            else:
                # ok, F is now directory with both frameworks. Continure
                # building
                break
        else:
            # Tk and Tcl frameworks not found. Normal "unix" tkinter search
            # will now resume.
            return 0
                
        # For 8.4a2, we must add -I options that point inside the Tcl and Tk
        # frameworks. In later release we should hopefully be able to pass
        # the -F option to gcc, which specifies a framework lookup path. 
        #
        include_dirs = [
            join(F, fw + '.framework', H) 
            for fw in 'Tcl', 'Tk'
            for H in 'Headers', 'Versions/Current/PrivateHeaders'
        ]

        # For 8.4a2, the X11 headers are not included. Rather than include a 
        # complicated search, this is a hard-coded path. It could bail out
        # if X11 libs are not found...
        include_dirs.append('/usr/X11R6/include')
        frameworks = ['-framework', 'Tcl', '-framework', 'Tk']

        ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
                        define_macros=[('WITH_APPINIT', 1)],
                        include_dirs = include_dirs,
                        libraries = [],
                        extra_compile_args = frameworks,
                        extra_link_args = frameworks,
                        )
        self.extensions.append(ext)
        return 1

         
    def detect_tkinter(self, inc_dirs, lib_dirs):
        # The _tkinter module.

        # Rather than complicate the code below, detecting and building
        # AquaTk is a separate method. Only one Tkinter will be built on
        # Darwin - either AquaTk, if it is found, or X11 based Tk.
        platform = self.get_platform()
        if platform == 'darwin' and \
           self.detect_tkinter_darwin(inc_dirs, lib_dirs):
          return

        # Assume we haven't found any of the libraries or include files
        # The versions with dots are used on Unix, and the versions without
        # dots on Windows, for detection by cygwin.
        tcllib = tklib = tcl_includes = tk_includes = None
        for version in ['8.4', '84', '8.3', '83', '8.2',
                        '82', '8.1', '81', '8.0', '80']:
            tklib = self.compiler.find_library_file(lib_dirs,
                                                    'tk' + version )
            tcllib = self.compiler.find_library_file(lib_dirs,
                                                     'tcl' + version )
            if tklib and tcllib:
                # Exit the loop when we've found the Tcl/Tk libraries
                break

        # Now check for the header files
        if tklib and tcllib:
            # Check for the include files on Debian, where
            # they're put in /usr/include/{tcl,tk}X.Y
            debian_tcl_include = [ '/usr/include/tcl' + version ]
            debian_tk_include =  [ '/usr/include/tk'  + version ] + \
                                 debian_tcl_include
            tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include)
            tk_includes = find_file('tk.h', inc_dirs, debian_tk_include)

        if (tcllib is None or tklib is None and
            tcl_includes is None or tk_includes is None):
            # Something's missing, so give up
            return

        # OK... everything seems to be present for Tcl/Tk.

        include_dirs = [] ; libs = [] ; defs = [] ; added_lib_dirs = []
        for dir in tcl_includes + tk_includes:
            if dir not in include_dirs:
                include_dirs.append(dir)

        # Check for various platform-specific directories
        if platform == 'sunos5':
            include_dirs.append('/usr/openwin/include')
            added_lib_dirs.append('/usr/openwin/lib')
        elif os.path.exists('/usr/X11R6/include'):
            include_dirs.append('/usr/X11R6/include')
            added_lib_dirs.append('/usr/X11R6/lib')
        elif os.path.exists('/usr/X11R5/include'):
            include_dirs.append('/usr/X11R5/include')
            added_lib_dirs.append('/usr/X11R5/lib')
        else:
            # Assume default location for X11
            include_dirs.append('/usr/X11/include')
            added_lib_dirs.append('/usr/X11/lib')

        # If Cygwin, then verify that X is installed before proceeding
        if platform == 'cygwin':
            x11_inc = find_file('X11/Xlib.h', [], inc_dirs)
            if x11_inc is None:
                # X header files missing, so give up
                return

        # Check for BLT extension
        if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
                                           'BLT8.0'):
            defs.append( ('WITH_BLT', 1) )
            libs.append('BLT8.0')

        # Add the Tcl/Tk libraries
        libs.append('tk'+version)
        libs.append('tcl'+version)

        if platform in ['aix3', 'aix4']:
            libs.append('ld')

        # Finally, link with the X11 libraries (not appropriate on cygwin)
        if platform != "cygwin":
            libs.append('X11')

        ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
                        define_macros=[('WITH_APPINIT', 1)] + defs,
                        include_dirs = include_dirs,
                        libraries = libs,
                        library_dirs = added_lib_dirs,
                        )
        self.extensions.append(ext)

        # XXX handle these, but how to detect?
        # *** Uncomment and edit for PIL (TkImaging) extension only:
        #       -DWITH_PIL -I../Extensions/Imaging/libImaging  tkImaging.c \
        # *** Uncomment and edit for TOGL extension only:
        #       -DWITH_TOGL togl.c \
        # *** Uncomment these for TOGL extension only:
        #       -lGL -lGLU -lXext -lXmu \

class PyBuildInstall(install):
    # Suppress the warning about installation into the lib_dynload
    # directory, which is not in sys.path when running Python during
    # installation:
    def initialize_options (self):
        install.initialize_options(self)
        self.warn_dir=0

def main():
    # turn off warnings when deprecated modules are imported
    import warnings
    warnings.filterwarnings("ignore",category=DeprecationWarning)
    setup(name = 'Python standard library',
          version = '%d.%d' % sys.version_info[:2],
          cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall},
          # The struct module is defined here, because build_ext won't be
          # called unless there's at least one extension module defined.
          ext_modules=[Extension('struct', ['structmodule.c'])],

          # Scripts to install
          scripts = ['Tools/scripts/pydoc']
        )

# --install-platlib
if __name__ == '__main__':
    main()
'add' style='width: 0.1%;'/> -rw-r--r--src/3rdparty/webkit/WebCore/css/CSSRule.idl1
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSSelector.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSSelector.h3
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp48
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h7
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSValue.idl1
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in4
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaList.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQuery.h3
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h3
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQueryExp.h6
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleSheet.idl1
-rw-r--r--src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.h2
-rw-r--r--src/3rdparty/webkit/WebCore/css/html.css (renamed from src/3rdparty/webkit/WebCore/css/html4.css)4
-rw-r--r--src/3rdparty/webkit/WebCore/css/mediaControls.css13
-rw-r--r--src/3rdparty/webkit/WebCore/css/mediaControlsQT.css115
-rw-r--r--src/3rdparty/webkit/WebCore/css/themeWin.css2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Comment.h3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Document.cpp24
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Document.h8
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Document.idl2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DocumentFragment.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DocumentFragment.h3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp13
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DynamicNodeList.h9
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EditingText.h3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Element.cpp32
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Element.h2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Event.idl1
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EventTarget.cpp7
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EventTarget.h6
-rw-r--r--src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp17
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Node.cpp28
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Node.idl2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeRareData.h21
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Notation.h3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Range.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SelectElement.cpp13
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SelectElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/StyledElement.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp17
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp7
-rw-r--r--src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp21
-rw-r--r--src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/editing/DeleteSelectionCommand.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/editing/Editor.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h3
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SelectionController.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SmartReplaceICU.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/editing/TextIterator.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/editing/gtk/SelectionControllerGtk.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/ArrayPrototype.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp877
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSGrammar.h109
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c547
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.h426
-rw-r--r--src/3rdparty/webkit/WebCore/generated/DatePrototype.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/Grammar.cpp1002
-rw-r--r--src/3rdparty/webkit/WebCore/generated/Grammar.h109
-rw-r--r--src/3rdparty/webkit/WebCore/generated/HTMLElementFactory.cpp28
-rw-r--r--src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp20
-rw-r--r--src/3rdparty/webkit/WebCore/generated/HTMLNames.h4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSAttr.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCDATASection.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSCharsetRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSFontFaceRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSImportRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSMediaRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSPageRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSPrimitiveValue.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSStyleRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSStyleSheet.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSValueList.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSVariablesRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext2D.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCharacterData.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSComment.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSConsole.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCounter.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h7
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.h4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.h4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDocument.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDocumentFragment.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDocumentType.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEntity.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEntityReference.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEventException.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSFile.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSFileList.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAnchorElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAppletElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAreaElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAudioElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBRElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBaseElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBaseFontElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBlockquoteElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.cpp18
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.h1
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLCanvasElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDListElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.h4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.h4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.h4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.h4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDirectoryElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDivElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDocument.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLElementWrapperFactory.cpp24
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLEmbedElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.cpp18
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.h1
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFontElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFormElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFrameElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHRElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHeadElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHeadingElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHtmlElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLIFrameElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLImageElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.cpp18
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.h1
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLIsIndexElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLIElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLabelElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLegendElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLinkElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMapElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMarqueeElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMediaElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMenuElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMetaElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLModElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOListElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLObjectElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOptGroupElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOptionElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOptionsCollection.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLParagraphElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLParamElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLPreElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLQuoteElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLScriptElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.cpp20
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.h1
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLSourceElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLStyleElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableCaptionElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableCellElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableColElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableRowElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableSectionElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp20
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h1
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTitleElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLUListElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLVideoElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHistory.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSImageData.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSInspectorController.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSKeyboardEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSLocation.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMessageEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMouseEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMutationEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNode.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNotation.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSONObject.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSOverflowEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSProcessingInstruction.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSProgressEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRGBColor.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRange.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRect.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAltGlyphElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimateColorElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimateElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimateTransformElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimationElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGCircleElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGClipPathElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGColor.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGComponentTransferFunctionElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGCursorElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDefinitionSrcElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDefsElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDescElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDocument.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGEllipseElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEBlendElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEColorMatrixElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEComponentTransferElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFECompositeElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEDiffuseLightingElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEDisplacementMapElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEDistantLightElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFloodElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncAElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncBElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncGElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncRElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEGaussianBlurElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEImageElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeNodeElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEOffsetElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEPointLightElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFESpecularLightingElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFESpotLightElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFETileElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFETurbulenceElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFilterElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceFormatElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceNameElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceSrcElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceUriElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGForeignObjectElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGGElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGGlyphElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGGradientElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGHKernElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGImageElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLineElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLinearGradientElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMarkerElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMaskElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMetadataElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMissingGlyphElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPaint.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcAbs.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcRel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegClosePath.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicAbs.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicRel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothAbs.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothRel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticAbs.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticRel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothRel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoAbs.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalAbs.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalRel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoRel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalAbs.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalRel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoAbs.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoRel.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPatternElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPolygonElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPolylineElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRadialGradientElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRectElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSVGElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGScriptElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSetElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGStopElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGStyleElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSwitchElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSymbolElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTRefElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTSpanElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextContentElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextPathElement.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextPositioningElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTitleElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGUseElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGViewElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGZoomEvent.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSScreen.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStorage.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStorageEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSText.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTextEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSUIEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp172
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSValidityState.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitAnimationEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframeRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframesRule.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSTransformValue.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitTransitionEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWheelEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorker.cpp20
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp35
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h3
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestProgressEvent.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/generated/Lexer.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/MathObject.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/NumberConstructor.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/RegExpConstructor.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/RegExpObject.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/StringPrototype.lut.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheets.h4
-rw-r--r--src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheetsData.cpp243
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp418
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XPathGrammar.h64
-rw-r--r--src/3rdparty/webkit/WebCore/history/HistoryItem.cpp24
-rw-r--r--src/3rdparty/webkit/WebCore/history/HistoryItem.h9
-rw-r--r--src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp44
-rw-r--r--src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h69
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumn.h47
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumn.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp40
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumnList.h21
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridDataSource.h7
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in1
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBRElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h4
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDListElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h4
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp75
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h23
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp32
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h10
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h4
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLElement.cpp9
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp27
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormElement.h2
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLImageElement.h2
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl5
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp37
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h11
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLModElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOListElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParamElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParser.cpp18
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParser.h2
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTagNames.in11
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp57
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h4
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLUListElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp16
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/html/ImageData.idl2
-rw-r--r--src/3rdparty/webkit/WebCore/html/TimeRanges.h3
-rw-r--r--src/3rdparty/webkit/WebCore/html/ValidityState.cpp43
-rw-r--r--src/3rdparty/webkit/WebCore/html/ValidityState.h59
-rw-r--r--src/3rdparty/webkit/WebCore/html/ValidityState.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h5
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp24
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorController.h4
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h1
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.cpp21
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.h3
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js57
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Console.js94
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/KeyboardShortcut.js108
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js4
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js2
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js61
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js5
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc2
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css8
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html1
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js1
-rw-r--r--src/3rdparty/webkit/WebCore/loader/DocLoader.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/loader/EmptyClients.h9
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FrameLoader.h8
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h4
-rw-r--r--src/3rdparty/webkit/WebCore/loader/TextDocument.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h4
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp21
-rw-r--r--src/3rdparty/webkit/WebCore/loader/loader.cpp43
-rw-r--r--src/3rdparty/webkit/WebCore/loader/loader.h9
-rw-r--r--src/3rdparty/webkit/WebCore/page/ChromeClient.h5
-rw-r--r--src/3rdparty/webkit/WebCore/page/Console.cpp39
-rw-r--r--src/3rdparty/webkit/WebCore/page/Console.h19
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMWindow.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMWindow.idl9
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventHandler.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventHandler.h4
-rw-r--r--src/3rdparty/webkit/WebCore/page/FocusController.cpp36
-rw-r--r--src/3rdparty/webkit/WebCore/page/FocusController.h4
-rw-r--r--src/3rdparty/webkit/WebCore/page/Frame.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameView.cpp223
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameView.h34
-rw-r--r--src/3rdparty/webkit/WebCore/page/MouseEventWithHitTestResults.h5
-rw-r--r--src/3rdparty/webkit/WebCore/page/Settings.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/page/Settings.h8
-rw-r--r--src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp135
-rw-r--r--src/3rdparty/webkit/WebCore/page/XSSAuditor.h24
-rw-r--r--src/3rdparty/webkit/WebCore/page/android/DragControllerAndroid.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp18
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.cpp147
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.h2
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/ImplicitAnimation.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/page/qt/DragControllerQt.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/page/win/DragControllerWin.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/page/win/FrameWin.h2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/CrossThreadCopier.h9
-rw-r--r--src/3rdparty/webkit/WebCore/platform/DragImage.h4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/FileSystem.h38
-rw-r--r--src/3rdparty/webkit/WebCore/platform/LocalizedStrings.h3
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollView.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollView.h16
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp31
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Scrollbar.h15
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollbarClient.h26
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Theme.h2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ThemeTypes.h7
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Widget.cpp106
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Widget.h26
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Color.h1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h9
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Image.h16
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/IntPoint.h1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp20
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h7
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm16
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm13
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h7
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm7
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm74
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.h2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.cpp123
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.h114
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorInternalICU.h4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/android/TextBreakIteratorInternalICU.cpp7
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm96
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginView.cpp22
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginView.h2
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginMessageThrottlerWin.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/AutoTableLayout.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineBox.cpp38
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineBox.h39
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.h12
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineTextBox.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp308
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h97
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderApplet.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderArena.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBlock.h21
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBlockLineLayout.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/bidi.cpp)57
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBoxModelObject.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.cpp136
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.h22
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFieldset.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFlexibleBox.cpp26
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.h3
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderImage.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderInline.h5
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp152
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayer.h28
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp19
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h3
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp180
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.h30
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp70
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderListBox.h4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMarquee.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp209
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMedia.h25
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMenuList.cpp7
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp35
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderObject.h8
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderPart.cpp16
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderPart.h4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderReplaced.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGImage.cpp14
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.h2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGInlineText.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSlider.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSlider.h3
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTable.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTableCol.h3
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp31
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextControlSingleLine.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTheme.cpp23
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTheme.h10
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm30
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp23
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.h2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeMac.h7
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.h2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderView.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp31
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderWidget.h7
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RootInlineBox.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.h3
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGInlineFlowBox.h2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGInlineTextBox.h2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGRootInlineBox.h2
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.h4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/bidi.h65
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.cpp7
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h9
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h5
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h4
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleInheritedData.h2
-rw-r--r--src/3rdparty/webkit/WebCore/storage/Database.cpp24
-rw-r--r--src/3rdparty/webkit/WebCore/storage/Database.h3
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseTask.h15
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp27
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseThread.h8
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/storage/OriginUsageRecord.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageArea.cpp221
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageArea.h44
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.cpp266
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.h80
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageAreaSync.h3
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageNamespace.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageNamespace.h26
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.cpp129
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.h66
-rw-r--r--src/3rdparty/webkit/WebCore/svg/GradientAttributes.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/PatternAttributes.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPathData.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPoints.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDocumentExtensions.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElementInstance.idl2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEColorMatrixElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEComponentTransferElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDiffuseLightingElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDisplacementMapElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDistantLightElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncAElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncBElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncGElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncRElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEOffsetElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEPointLightElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFESpecularLightingElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFESpotLightElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFETileElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGList.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGListTraits.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMetadataElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGParserUtilities.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegClosePath.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSetElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h6
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformDistance.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformList.cpp18
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformList.h1
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformable.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/svg/animation/SMILTime.cpp9
-rw-r--r--src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGResource.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLErrorHandling.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp336
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h23
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp125
-rw-r--r--src/3rdparty/webkit/WebCore/workers/AbstractWorker.h86
-rw-r--r--src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl52
-rw-r--r--src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h70
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorker.h61
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorker.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/workers/Worker.cpp17
-rw-r--r--src/3rdparty/webkit/WebCore/workers/Worker.h5
-rw-r--r--src/3rdparty/webkit/WebCore/workers/Worker.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp32
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContext.h9
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContext.idl8
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h5
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h2
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h8
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h7
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp36
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h1
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathPath.h3
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp2
-rw-r--r--src/3rdparty/webkit/WebKit.pri6
-rw-r--r--src/3rdparty/webkit/WebKit/ChangeLog39
-rw-r--r--src/3rdparty/webkit/WebKit/StringsNotToBeLocalized.txt9
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/headers.pri4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp35
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp197
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h9
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h10
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp73
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h3
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp15
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp29
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog338
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp7
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp75
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp60
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html7
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp50
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc3
-rw-r--r--src/activeqt/container/qaxbase.cpp58
-rw-r--r--src/activeqt/container/qaxdump.cpp4
-rw-r--r--src/activeqt/container/qaxobject.cpp12
-rw-r--r--src/activeqt/container/qaxscript.cpp22
-rw-r--r--src/activeqt/container/qaxselect.cpp34
-rw-r--r--src/activeqt/container/qaxwidget.cpp64
-rw-r--r--src/activeqt/control/qaxfactory.cpp12
-rw-r--r--src/activeqt/control/qaxserver.cpp18
-rw-r--r--src/activeqt/control/qaxserverbase.cpp173
-rw-r--r--src/activeqt/control/qaxserverdll.cpp4
-rw-r--r--src/activeqt/control/qaxservermain.cpp15
-rw-r--r--src/activeqt/shared/qaxtypes.cpp13
-rw-r--r--src/corelib/animation/qabstractanimation.cpp54
-rw-r--r--src/corelib/animation/qabstractanimation_p.h7
-rw-r--r--src/corelib/animation/qanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp18
-rw-r--r--src/corelib/animation/qpropertyanimation_p.h6
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h3
-rw-r--r--src/corelib/animation/qvariantanimation.h2
-rw-r--r--src/corelib/animation/qvariantanimation_p.h4
-rw-r--r--src/corelib/arch/qatomic_powerpc.h2
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp6
-rw-r--r--src/corelib/codecs/qtextcodec.cpp51
-rw-r--r--src/corelib/codecs/qtextcodec_p.h27
-rw-r--r--src/corelib/codecs/qutfcodec.cpp349
-rw-r--r--src/corelib/codecs/qutfcodec_p.h53
-rw-r--r--src/corelib/concurrent/qfuture.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentiteratekernel.cpp8
-rw-r--r--src/corelib/concurrent/qtconcurrentmap.cpp3
-rw-r--r--src/corelib/global/qglobal.cpp101
-rw-r--r--src/corelib/global/qglobal.h61
-rw-r--r--src/corelib/global/qnamespace.h32
-rw-r--r--src/corelib/global/qt_windows.h37
-rw-r--r--src/corelib/io/qabstractfileengine.cpp22
-rw-r--r--src/corelib/io/qdiriterator.cpp230
-rw-r--r--src/corelib/io/qfileinfo.cpp6
-rw-r--r--src/corelib/io/qfilesystemwatcher_dnotify.cpp20
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp40
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue.cpp5
-rw-r--r--src/corelib/io/qfilesystemwatcher_p.h7
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp435
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h53
-rw-r--r--src/corelib/io/qfsfileengine.cpp6
-rw-r--r--src/corelib/io/qfsfileengine_iterator_win.cpp32
-rw-r--r--src/corelib/io/qfsfileengine_p.h4
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp20
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp939
-rw-r--r--src/corelib/io/qprocess_unix.cpp281
-rw-r--r--src/corelib/io/qprocess_win.cpp231
-rw-r--r--src/corelib/io/qresource.cpp4
-rw-r--r--src/corelib/io/qresource_iterator.cpp8
-rw-r--r--src/corelib/io/qresource_iterator_p.h4
-rw-r--r--src/corelib/io/qsettings.cpp37
-rw-r--r--src/corelib/io/qsettings_win.cpp209
-rw-r--r--src/corelib/io/qtemporaryfile.cpp17
-rw-r--r--src/corelib/io/qurl.cpp318
-rw-r--r--src/corelib/kernel/kernel.pri36
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp25
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp2
-rw-r--r--src/corelib/kernel/qcore_unix.cpp194
-rw-r--r--src/corelib/kernel/qcore_unix_p.h275
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp71
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp106
-rw-r--r--src/corelib/kernel/qcorecmdlineargs_p.h9
-rw-r--r--src/corelib/kernel/qcoreevent.cpp5
-rw-r--r--src/corelib/kernel/qcoreevent.h3
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp104
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix_p.h48
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp89
-rw-r--r--src/corelib/kernel/qfunctions_wince.cpp12
-rw-r--r--src/corelib/kernel/qfunctions_wince.h6
-rw-r--r--src/corelib/kernel/qmath.h4
-rw-r--r--src/corelib/kernel/qmetaobject.cpp25
-rw-r--r--src/corelib/kernel/qmetatype.cpp27
-rw-r--r--src/corelib/kernel/qmetatype.h14
-rw-r--r--src/corelib/kernel/qmimedata.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp32
-rw-r--r--src/corelib/kernel/qsharedmemory_unix.cpp8
-rw-r--r--src/corelib/kernel/qsharedmemory_win.cpp19
-rw-r--r--src/corelib/kernel/qsystemsemaphore_win.cpp6
-rw-r--r--src/corelib/kernel/qtimer.cpp5
-rw-r--r--src/corelib/kernel/qtranslator.cpp3
-rw-r--r--src/corelib/kernel/qvariant.cpp11
-rw-r--r--src/corelib/kernel/qvariant.h7
-rw-r--r--src/corelib/plugin/qlibrary.cpp8
-rw-r--r--src/corelib/plugin/qlibrary_win.cpp34
-rw-r--r--src/corelib/plugin/qplugin.h19
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp15
-rw-r--r--src/corelib/statemachine/qstate.cpp28
-rw-r--r--src/corelib/statemachine/qstate.h2
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp272
-rw-r--r--src/corelib/statemachine/qstatemachine.h22
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h19
-rw-r--r--src/corelib/thread/qmutex_win.cpp16
-rw-r--r--src/corelib/thread/qreadwritelock.h3
-rw-r--r--src/corelib/thread/qthread.cpp11
-rw-r--r--src/corelib/thread/qthread_win.cpp40
-rw-r--r--src/corelib/thread/qwaitcondition_win.cpp6
-rw-r--r--src/corelib/tools/qbytedata_p.h203
-rw-r--r--src/corelib/tools/qchar.cpp38
-rw-r--r--src/corelib/tools/qcontiguouscache.cpp18
-rw-r--r--src/corelib/tools/qcontiguouscache.h22
-rw-r--r--src/corelib/tools/qdatetime.cpp15
-rw-r--r--src/corelib/tools/qeasingcurve.cpp176
-rw-r--r--src/corelib/tools/qlocale.cpp143
-rw-r--r--src/corelib/tools/qpoint.cpp2
-rw-r--r--src/corelib/tools/qregexp.cpp340
-rw-r--r--src/corelib/tools/qregexp.h2
-rw-r--r--src/corelib/tools/qringbuffer_p.h50
-rw-r--r--src/corelib/tools/qsharedpointer.cpp59
-rw-r--r--src/corelib/tools/qsharedpointer.h3
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h53
-rw-r--r--src/corelib/tools/qstring.cpp168
-rw-r--r--src/corelib/tools/qstring.h2
-rw-r--r--src/corelib/tools/qstringbuilder.h14
-rw-r--r--src/corelib/tools/qstringlist.cpp1
-rw-r--r--src/corelib/tools/qstringlist.h1
-rw-r--r--src/corelib/tools/qstringmatcher.h11
-rw-r--r--src/corelib/tools/qtimeline.cpp2
-rw-r--r--src/corelib/tools/qvector.h4
-rw-r--r--src/corelib/tools/tools.pri1
-rw-r--r--src/corelib/xml/qxmlstream.cpp2
-rw-r--r--src/dbus/qdbusabstractinterface.cpp252
-rw-r--r--src/dbus/qdbusabstractinterface.h18
-rw-r--r--src/dbus/qdbusabstractinterface_p.h8
-rw-r--r--src/dbus/qdbusargument_p.h3
-rw-r--r--src/dbus/qdbusconnection_p.h5
-rw-r--r--src/dbus/qdbuserror.cpp21
-rw-r--r--src/dbus/qdbuserror.h6
-rw-r--r--src/dbus/qdbusintegrator.cpp100
-rw-r--r--src/dbus/qdbusinterface.cpp146
-rw-r--r--src/dbus/qdbusinternalfilters.cpp167
-rw-r--r--src/dbus/qdbusmarshaller.cpp48
-rw-r--r--src/dbus/qdbusmessage.cpp78
-rw-r--r--src/dbus/qdbusmessage.h6
-rw-r--r--src/dbus/qdbusmessage_p.h11
-rw-r--r--src/dbus/qdbusmisc.cpp47
-rw-r--r--src/dbus/qdbuspendingcall.cpp38
-rw-r--r--src/dbus/qdbuspendingcall.h3
-rw-r--r--src/dbus/qdbuspendingcall_p.h3
-rw-r--r--src/dbus/qdbusutil_p.h68
-rw-r--r--src/dbus/qdbusxmlgenerator.cpp37
-rw-r--r--src/gui/accessible/qaccessible.h1
-rw-r--r--src/gui/accessible/qaccessible_win.cpp34
-rw-r--r--src/gui/dialogs/qdialog.cpp3
-rw-r--r--src/gui/dialogs/qfiledialog.cpp62
-rw-r--r--src/gui/dialogs/qfiledialog_p.h4
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp667
-rw-r--r--src/gui/dialogs/qfilesystemmodel.cpp22
-rw-r--r--src/gui/dialogs/qmessagebox.cpp6
-rw-r--r--src/gui/dialogs/qpagesetupdialog_win.cpp7
-rw-r--r--src/gui/dialogs/qprintdialog_win.cpp115
-rw-r--r--src/gui/dialogs/qsidebar.cpp13
-rw-r--r--src/gui/dialogs/qwizard.cpp18
-rw-r--r--src/gui/dialogs/qwizard_win.cpp4
-rw-r--r--src/gui/dialogs/qwizard_win_p.h2
-rw-r--r--src/gui/embedded/embedded.pri40
-rw-r--r--src/gui/embedded/qkbd_qws.cpp8
-rw-r--r--src/gui/embedded/qkbddriverfactory_qws.cpp24
-rw-r--r--src/gui/embedded/qkbdlinuxinput_qws.cpp14
-rw-r--r--src/gui/embedded/qkbdsl5000_qws.cpp365
-rw-r--r--src/gui/embedded/qkbdtty_qws.cpp18
-rw-r--r--src/gui/embedded/qkbdvfb_qws.cpp9
-rw-r--r--src/gui/embedded/qkbdvr41xx_qws.cpp185
-rw-r--r--src/gui/embedded/qkbdyopy_qws.cpp209
-rw-r--r--src/gui/embedded/qlock.cpp6
-rw-r--r--src/gui/embedded/qmousebus_qws.cpp238
-rw-r--r--src/gui/embedded/qmousedriverfactory_qws.cpp34
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.cpp205
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.h (renamed from src/gui/embedded/qmousebus_qws.h)30
-rw-r--r--src/gui/embedded/qmouselinuxtp_qws.cpp7
-rw-r--r--src/gui/embedded/qmousepc_qws.cpp39
-rw-r--r--src/gui/embedded/qmousevfb_qws.cpp9
-rw-r--r--src/gui/embedded/qmousevr41xx_qws.cpp250
-rw-r--r--src/gui/embedded/qmouseyopy_qws.cpp184
-rw-r--r--src/gui/embedded/qscreenlinuxfb_qws.cpp20
-rw-r--r--src/gui/embedded/qscreenproxy_qws.cpp8
-rw-r--r--src/gui/embedded/qsoundqss_qws.cpp9
-rw-r--r--src/gui/embedded/qtransportauth_qws.cpp7
-rw-r--r--src/gui/embedded/qunixsocket.cpp18
-rw-r--r--src/gui/graphicsview/graphicsview.pri51
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp531
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h67
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h109
-rw-r--r--src/gui/graphicsview/qgraphicslayoutitem.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget.cpp36
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp2160
-rw-r--r--src/gui/graphicsview/qgraphicsscene.h46
-rw-r--r--src/gui/graphicsview/qgraphicsscene_bsp.cpp56
-rw-r--r--src/gui/graphicsview/qgraphicsscene_bsp_p.h9
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h140
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp785
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h208
-rw-r--r--src/gui/graphicsview/qgraphicssceneevent.cpp245
-rw-r--r--src/gui/graphicsview/qgraphicssceneevent.h43
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex.cpp648
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex_p.h182
-rw-r--r--src/gui/graphicsview/qgraphicsscenelinearindex.cpp (renamed from src/gui/embedded/qkbdsl5000_qws.h)77
-rw-r--r--src/gui/graphicsview/qgraphicsscenelinearindex_p.h (renamed from examples/animation/stickman/editor/animationdialog.h)89
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp262
-rw-r--r--src/gui/graphicsview/qgraphicsview_p.h21
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp16
-rw-r--r--src/gui/image/qimage.cpp11
-rw-r--r--src/gui/image/qpicture.cpp2
-rw-r--r--src/gui/image/qpixmap.cpp77
-rw-r--r--src/gui/image/qpixmap_mac.cpp19
-rw-r--r--src/gui/image/qpixmap_win.cpp12
-rw-r--r--src/gui/image/qpixmapcache.cpp75
-rw-r--r--src/gui/image/qpixmapfilter.cpp10
-rw-r--r--src/gui/inputmethod/qwininputcontext_win.cpp116
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp135
-rw-r--r--src/gui/itemviews/qabstractitemview.h1
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h30
-rw-r--r--src/gui/itemviews/qcolumnview.cpp82
-rw-r--r--src/gui/itemviews/qcolumnview.h8
-rw-r--r--src/gui/itemviews/qcolumnview_p.h9
-rw-r--r--src/gui/itemviews/qdirmodel.cpp5
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp61
-rw-r--r--src/gui/itemviews/qheaderview.cpp26
-rw-r--r--src/gui/itemviews/qheaderview.h3
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp17
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp35
-rw-r--r--src/gui/itemviews/qlistview.cpp155
-rw-r--r--src/gui/itemviews/qlistview_p.h24
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp42
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.cpp11
-rw-r--r--src/gui/itemviews/qtableview.cpp8
-rw-r--r--src/gui/itemviews/qtreeview.cpp210
-rw-r--r--src/gui/itemviews/qtreeview.h12
-rw-r--r--src/gui/itemviews/qtreeview_p.h38
-rw-r--r--src/gui/kernel/kernel.pri13
-rw-r--r--src/gui/kernel/qaction.cpp48
-rw-r--r--src/gui/kernel/qaction.h8
-rw-r--r--src/gui/kernel/qaction_p.h1
-rw-r--r--src/gui/kernel/qapplication.cpp120
-rw-r--r--src/gui/kernel/qapplication.h9
-rw-r--r--src/gui/kernel/qapplication_mac.mm41
-rw-r--r--src/gui/kernel/qapplication_p.h99
-rw-r--r--src/gui/kernel/qapplication_qws.cpp8
-rw-r--r--src/gui/kernel/qapplication_win.cpp621
-rw-r--r--src/gui/kernel/qapplication_x11.cpp64
-rw-r--r--src/gui/kernel/qclipboard_mac.cpp14
-rw-r--r--src/gui/kernel/qclipboard_win.cpp10
-rw-r--r--src/gui/kernel/qcocoapanel_mac.mm6
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm19
-rw-r--r--src/gui/kernel/qcocoawindow_mac.mm6
-rw-r--r--src/gui/kernel/qcursor_win.cpp48
-rw-r--r--src/gui/kernel/qdesktopwidget.h8
-rw-r--r--src/gui/kernel/qdesktopwidget_mac.mm64
-rw-r--r--src/gui/kernel/qdesktopwidget_mac_p.h3
-rw-r--r--src/gui/kernel/qdesktopwidget_win.cpp139
-rw-r--r--src/gui/kernel/qdesktopwidget_x11.cpp25
-rw-r--r--src/gui/kernel/qdirectionrecognizer.cpp182
-rw-r--r--src/gui/kernel/qdirectionsimplificator_p.h172
-rw-r--r--src/gui/kernel/qdnd_mac.mm4
-rw-r--r--src/gui/kernel/qdnd_p.h2
-rw-r--r--src/gui/kernel/qdnd_win.cpp75
-rw-r--r--src/gui/kernel/qevent.cpp279
-rw-r--r--src/gui/kernel/qevent.h35
-rw-r--r--src/gui/kernel/qevent_p.h16
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm12
-rw-r--r--src/gui/kernel/qgesture.cpp297
-rw-r--r--src/gui/kernel/qgesture.h94
-rw-r--r--src/gui/kernel/qgesture_p.h35
-rw-r--r--src/gui/kernel/qgesturemanager.cpp644
-rw-r--r--src/gui/kernel/qgesturemanager_p.h126
-rw-r--r--src/gui/kernel/qgesturerecognizer.cpp159
-rw-r--r--src/gui/kernel/qgesturerecognizer.h87
-rw-r--r--src/gui/kernel/qgesturestandardrecognizers.cpp306
-rw-r--r--src/gui/kernel/qguifunctions_wince.cpp24
-rw-r--r--src/gui/kernel/qguifunctions_wince.h8
-rw-r--r--src/gui/kernel/qguivariant.cpp161
-rw-r--r--src/gui/kernel/qkeymapper_mac.cpp4
-rw-r--r--src/gui/kernel/qkeymapper_win.cpp130
-rw-r--r--src/gui/kernel/qlayout.cpp5
-rw-r--r--src/gui/kernel/qmime_win.cpp148
-rw-r--r--src/gui/kernel/qmultitouch_mac.mm6
-rw-r--r--src/gui/kernel/qmultitouch_mac_p.h4
-rw-r--r--src/gui/kernel/qsound_win.cpp40
-rw-r--r--src/gui/kernel/qstandardgestures.cpp254
-rw-r--r--src/gui/kernel/qstandardgestures.h (renamed from src/gui/embedded/qmousevr41xx_qws.h)53
-rw-r--r--src/gui/kernel/qstandardgestures_p.h (renamed from src/gui/kernel/qgesturerecognizer_p.h)35
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm92
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h10
-rw-r--r--src/gui/kernel/qwhatsthis.cpp9
-rw-r--r--src/gui/kernel/qwidget.cpp243
-rw-r--r--src/gui/kernel/qwidget.h7
-rw-r--r--src/gui/kernel/qwidget_mac.mm61
-rw-r--r--src/gui/kernel/qwidget_p.h7
-rw-r--r--src/gui/kernel/qwidget_win.cpp129
-rw-r--r--src/gui/kernel/qwidget_wince.cpp46
-rw-r--r--src/gui/kernel/qx11embed_x11.cpp6
-rw-r--r--src/gui/math3d/qgenericmatrix.h4
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp58
-rw-r--r--src/gui/math3d/qmatrix4x4.h9
-rw-r--r--src/gui/math3d/qquaternion.cpp53
-rw-r--r--src/gui/math3d/qquaternion.h9
-rw-r--r--src/gui/math3d/qvector2d.cpp46
-rw-r--r--src/gui/math3d/qvector2d.h9
-rw-r--r--src/gui/math3d/qvector3d.cpp49
-rw-r--r--src/gui/math3d/qvector3d.h9
-rw-r--r--src/gui/math3d/qvector4d.cpp51
-rw-r--r--src/gui/math3d/qvector4d.h9
-rw-r--r--src/gui/painting/qdrawutil.cpp3
-rw-r--r--src/gui/painting/qdrawutil.h7
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp102
-rw-r--r--src/gui/painting/qpdf.cpp31
-rw-r--r--src/gui/painting/qprintengine_pdf.cpp2
-rw-r--r--src/gui/painting/qprintengine_win.cpp646
-rw-r--r--src/gui/painting/qprintengine_win_p.h16
-rw-r--r--src/gui/painting/qprinter.cpp3
-rw-r--r--src/gui/painting/qprinterinfo_win.cpp100
-rw-r--r--src/gui/painting/qregion.cpp4
-rw-r--r--src/gui/painting/qregion_win.cpp2
-rw-r--r--src/gui/painting/qwindowsurface_qws.cpp3
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp24
-rw-r--r--src/gui/painting/qwindowsurface_raster_p.h13
-rw-r--r--src/gui/styles/gtksymbols.cpp46
-rw-r--r--src/gui/styles/gtksymbols_p.h2
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp13
-rw-r--r--src/gui/styles/qcommonstyle.cpp166
-rw-r--r--src/gui/styles/qcommonstyle_p.h1
-rw-r--r--src/gui/styles/qgtkstyle.cpp36
-rw-r--r--src/gui/styles/qmacstyle_mac.mm144
-rw-r--r--src/gui/styles/qplastiquestyle.cpp31
-rw-r--r--src/gui/styles/qstyle.cpp7
-rw-r--r--src/gui/styles/qstyle.h2
-rw-r--r--src/gui/styles/qstyle_p.h3
-rw-r--r--src/gui/styles/qstylehelper.cpp7
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp2
-rw-r--r--src/gui/styles/qwindowsstyle.cpp122
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp151
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp32
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp1
-rw-r--r--src/gui/text/qcssparser.cpp10
-rw-r--r--src/gui/text/qcssparser_p.h2
-rw-r--r--src/gui/text/qfont_win.cpp8
-rw-r--r--src/gui/text/qfontdatabase_qws.cpp5
-rw-r--r--src/gui/text/qfontdatabase_win.cpp261
-rw-r--r--src/gui/text/qfontengine_qpf.cpp15
-rw-r--r--src/gui/text/qfontengine_qws.cpp5
-rw-r--r--src/gui/text/qfontengine_win.cpp450
-rw-r--r--src/gui/text/qfontengine_win_p.h18
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp42
-rw-r--r--src/gui/text/qsyntaxhighlighter.h1
-rw-r--r--src/gui/text/qtextcontrol.cpp3
-rw-r--r--src/gui/text/qtextcursor.cpp2
-rw-r--r--src/gui/text/qtextdocument.cpp7
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp6
-rw-r--r--src/gui/text/qtextformat.cpp2
-rw-r--r--src/gui/text/qtextformat.h2
-rw-r--r--src/gui/text/qtexthtmlparser.cpp6
-rw-r--r--src/gui/text/qtextlist.cpp49
-rw-r--r--src/gui/text/qtextodfwriter.cpp8
-rw-r--r--src/gui/text/qzip.cpp20
-rw-r--r--src/gui/util/qcompleter.cpp38
-rw-r--r--src/gui/util/qcompleter.h4
-rw-r--r--src/gui/util/qcompleter_p.h1
-rw-r--r--src/gui/util/qdesktopservices_win.cpp34
-rw-r--r--src/gui/util/qsystemtrayicon_win.cpp338
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp37
-rw-r--r--src/gui/widgets/qabstractscrollarea_p.h9
-rw-r--r--src/gui/widgets/qabstractspinbox.cpp11
-rw-r--r--src/gui/widgets/qcocoatoolbardelegate_mac.mm10
-rw-r--r--src/gui/widgets/qcombobox.cpp6
-rw-r--r--src/gui/widgets/qdatetimeedit.cpp4
-rw-r--r--src/gui/widgets/qdockarealayout.cpp14
-rw-r--r--src/gui/widgets/qeffects.cpp96
-rw-r--r--src/gui/widgets/qfontcombobox.cpp2
-rw-r--r--src/gui/widgets/qframe.cpp2
-rw-r--r--src/gui/widgets/qgroupbox.cpp11
-rw-r--r--src/gui/widgets/qlineedit.cpp3
-rw-r--r--src/gui/widgets/qmainwindow.cpp13
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp276
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm31
-rw-r--r--src/gui/widgets/qmainwindowlayout_p.h25
-rw-r--r--src/gui/widgets/qmdisubwindow.cpp37
-rw-r--r--src/gui/widgets/qmenu.cpp108
-rw-r--r--src/gui/widgets/qmenu_mac.mm8
-rw-r--r--src/gui/widgets/qmenu_p.h8
-rw-r--r--src/gui/widgets/qmenubar.cpp20
-rw-r--r--src/gui/widgets/qplaintextedit.cpp37
-rw-r--r--src/gui/widgets/qplaintextedit.h1
-rw-r--r--src/gui/widgets/qplaintextedit_p.h5
-rw-r--r--src/gui/widgets/qprogressbar.cpp8
-rw-r--r--src/gui/widgets/qsizegrip.cpp3
-rw-r--r--src/gui/widgets/qspinbox.cpp11
-rw-r--r--src/gui/widgets/qtabbar.cpp66
-rw-r--r--src/gui/widgets/qtabbar.h2
-rw-r--r--src/gui/widgets/qtabbar_p.h68
-rw-r--r--src/gui/widgets/qtextedit.cpp26
-rw-r--r--src/gui/widgets/qtextedit.h1
-rw-r--r--src/gui/widgets/qtextedit_p.h5
-rw-r--r--src/gui/widgets/qtoolbar.cpp71
-rw-r--r--src/gui/widgets/qtoolbar.h1
-rw-r--r--src/gui/widgets/qtoolbar_p.h8
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp18
-rw-r--r--src/gui/widgets/qtoolbutton.cpp15
-rw-r--r--src/gui/widgets/qwidgetanimator.cpp164
-rw-r--r--src/gui/widgets/qwidgetanimator_p.h34
-rw-r--r--src/gui/widgets/qworkspace.cpp26
-rw-r--r--src/network/access/qabstractnetworkcache.cpp4
-rw-r--r--src/network/access/qftp.cpp3
-rw-r--r--src/network/access/qhttp.cpp7
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp97
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h14
-rw-r--r--src/network/access/qhttpnetworkreply.cpp89
-rw-r--r--src/network/access/qhttpnetworkreply_p.h15
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp10
-rw-r--r--src/network/access/qnetworkaccessbackend_p.h3
-rw-r--r--src/network/access/qnetworkaccesscachebackend.cpp14
-rw-r--r--src/network/access/qnetworkaccessdatabackend.cpp6
-rw-r--r--src/network/access/qnetworkaccessdebugpipebackend.cpp8
-rw-r--r--src/network/access/qnetworkaccessfilebackend.cpp6
-rw-r--r--src/network/access/qnetworkaccessftpbackend.cpp6
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp37
-rw-r--r--src/network/access/qnetworkaccesshttpbackend_p.h4
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp65
-rw-r--r--src/network/access/qnetworkreply.cpp59
-rw-r--r--src/network/access/qnetworkreply.h3
-rw-r--r--src/network/access/qnetworkreply_p.h2
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp68
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h8
-rw-r--r--src/network/access/qnetworkrequest.cpp4
-rw-r--r--src/network/kernel/qhostinfo_unix.cpp5
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp19
-rw-r--r--src/network/kernel/qnetworkinterface_win.cpp15
-rw-r--r--src/network/kernel/qnetworkinterface_win_p.h2
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp17
-rw-r--r--src/network/socket/qabstractsocket.cpp66
-rw-r--r--src/network/socket/qabstractsocket.h8
-rw-r--r--src/network/socket/qabstractsocketengine_p.h4
-rw-r--r--src/network/socket/qhttpsocketengine.cpp22
-rw-r--r--src/network/socket/qlocalserver.cpp2
-rw-r--r--src/network/socket/qlocalserver_unix.cpp9
-rw-r--r--src/network/socket/qlocalserver_win.cpp19
-rw-r--r--src/network/socket/qlocalsocket.cpp29
-rw-r--r--src/network/socket/qlocalsocket.h1
-rw-r--r--src/network/socket/qlocalsocket_p.h53
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp5
-rw-r--r--src/network/socket/qlocalsocket_win.cpp285
-rw-r--r--src/network/socket/qnativesocketengine_p.h34
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp137
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp153
-rw-r--r--src/network/socket/qnet_unix_p.h182
-rw-r--r--src/network/socket/qsocks5socketengine.cpp20
-rw-r--r--src/network/socket/qtcpsocket.h1
-rw-r--r--src/network/socket/qudpsocket.cpp3
-rw-r--r--src/network/socket/socket.pri3
-rw-r--r--src/network/ssl/qsslsocket.cpp36
-rw-r--r--src/network/ssl/qsslsocket.h1
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp22
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h2
-rw-r--r--src/network/ssl/qsslsocket_p.h3
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp62
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h29
-rw-r--r--src/opengl/gl2paintengineex/qglgradientcache.cpp29
-rw-r--r--src/opengl/gl2paintengineex/qglgradientcache_p.h27
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp163
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h25
-rw-r--r--src/opengl/qgl.cpp479
-rw-r--r--src/opengl/qgl.h1
-rw-r--r--src/opengl/qgl_p.h169
-rw-r--r--src/opengl/qgl_win.cpp16
-rw-r--r--src/opengl/qgl_x11.cpp140
-rw-r--r--src/opengl/qgl_x11egl.cpp11
-rw-r--r--src/opengl/qglextensions_p.h2
-rw-r--r--src/opengl/qglframebufferobject.cpp27
-rw-r--r--src/opengl/qglpixelbuffer.cpp2
-rw-r--r--src/opengl/qglpixmapfilter.cpp2
-rw-r--r--src/opengl/qpaintengine_opengl.cpp2
-rw-r--r--src/opengl/qpixmapdata_gl.cpp49
-rw-r--r--src/opengl/qpixmapdata_gl_p.h6
-rw-r--r--src/opengl/qwindowsurface_gl.cpp2
-rw-r--r--src/openvg/qpaintengine_vg.cpp192
-rw-r--r--src/openvg/qpaintengine_vg_p.h1
-rw-r--r--src/plugins/accessible/compat/q3complexwidgets.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp24
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h18
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp822
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h55
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp7
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp73
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h19
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp12
-rw-r--r--src/plugins/graphicssystems/openvg/openvg.pro8
-rw-r--r--src/plugins/graphicssystems/shivavg/shivavg.pro4
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp12
-rw-r--r--src/plugins/kbddrivers/kbddrivers.pro3
-rw-r--r--src/plugins/kbddrivers/sl5000/sl5000.pro16
-rw-r--r--src/plugins/kbddrivers/vr41xx/vr41xx.pro14
-rw-r--r--src/plugins/kbddrivers/yopy/yopy.pro14
-rw-r--r--src/plugins/mousedrivers/bus/bus.pro14
-rw-r--r--src/plugins/mousedrivers/linuxis/linuxis.pro10
-rw-r--r--src/plugins/mousedrivers/linuxis/linuxismousedriverplugin.h58
-rw-r--r--src/plugins/mousedrivers/linuxis/linuxismousehandler.cpp180
-rw-r--r--src/plugins/mousedrivers/linuxis/linuxismousehandler.h72
-rw-r--r--src/plugins/mousedrivers/mousedrivers.pro5
-rw-r--r--src/plugins/mousedrivers/vr41xx/vr41xx.pro14
-rw-r--r--src/plugins/mousedrivers/yopy/yopy.pro14
-rw-r--r--src/qt3support/canvas/q3canvas.cpp2
-rw-r--r--src/qt3support/dialogs/q3filedialog.cpp206
-rw-r--r--src/qt3support/dialogs/q3filedialog_win.cpp430
-rw-r--r--src/qt3support/dialogs/q3tabdialog.cpp2
-rw-r--r--src/qt3support/itemviews/q3table.cpp2
-rw-r--r--src/qt3support/network/q3dns.cpp70
-rw-r--r--src/qt3support/network/q3http.cpp4
-rw-r--r--src/qt3support/network/q3socketdevice_win.cpp7
-rw-r--r--src/qt3support/other/q3dragobject.cpp7
-rw-r--r--src/qt3support/other/q3process_win.cpp152
-rw-r--r--src/qt3support/sql/q3datatable.cpp2
-rw-r--r--src/qt3support/tools/q3cstring.cpp32
-rw-r--r--src/qt3support/widgets/q3datetimeedit.cpp75
-rw-r--r--src/qt3support/widgets/q3dockarea.cpp29
-rw-r--r--src/qt3support/widgets/q3scrollview.cpp4
-rw-r--r--src/qt3support/widgets/q3titlebar.cpp33
-rw-r--r--src/script/qscriptvalue.cpp16
-rw-r--r--src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp18
-rw-r--r--src/scripttools/debugging/qscriptenginedebuggerfrontend.cpp2
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp32
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp27
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp41
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.cpp4
-rw-r--r--src/sql/kernel/qsqldatabase.cpp28
-rw-r--r--src/sql/kernel/qsqldriver.cpp26
-rw-r--r--src/sql/models/qsqltablemodel.cpp3
-rw-r--r--src/svg/qsvghandler.cpp336
-rw-r--r--src/svg/qsvgnode.cpp2
-rw-r--r--src/svg/qsvgstyle.cpp56
-rw-r--r--src/svg/qsvgstyle_p.h41
-rw-r--r--src/testlib/qplaintestlogger.cpp2
-rw-r--r--src/testlib/qtestcase.cpp200
-rw-r--r--src/testlib/qtestfilelogger.cpp25
-rw-r--r--src/tools/bootstrap/bootstrap.pri20
-rw-r--r--src/tools/idc/main.cpp69
-rw-r--r--src/tools/moc/moc.cpp20
-rw-r--r--src/tools/uic/uic.cpp4
-rw-r--r--src/tools/uic3/main.cpp6
-rw-r--r--src/tools/uic3/uic.cpp4
-rw-r--r--src/winmain/qtmain_win.cpp20
-rw-r--r--src/xml/sax/qxml.cpp52
-rw-r--r--src/xmlpatterns/Doxyfile2
-rw-r--r--src/xmlpatterns/acceltree/qacceltree.cpp43
-rw-r--r--src/xmlpatterns/acceltree/qacceltree_p.h17
-rw-r--r--src/xmlpatterns/acceltree/qacceltreebuilder.cpp31
-rw-r--r--src/xmlpatterns/acceltree/qacceltreebuilder_p.h19
-rw-r--r--src/xmlpatterns/acceltree/qacceltreeresourceloader.cpp60
-rw-r--r--src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h27
-rw-r--r--src/xmlpatterns/api/api.pri11
-rw-r--r--src/xmlpatterns/api/qabstractxmlforwarditerator_p.h15
-rw-r--r--src/xmlpatterns/api/qabstractxmlnodemodel.cpp16
-rw-r--r--src/xmlpatterns/api/qabstractxmlnodemodel.h5
-rw-r--r--src/xmlpatterns/api/qabstractxmlnodemodel_p.h10
-rw-r--r--src/xmlpatterns/api/qabstractxmlpullprovider.cpp177
-rw-r--r--src/xmlpatterns/api/qabstractxmlpullprovider_p.h (renamed from src/gui/kernel/qgesturestandardrecognizers_p.h)132
-rw-r--r--src/xmlpatterns/api/qpullbridge.cpp232
-rw-r--r--src/xmlpatterns/api/qpullbridge_p.h103
-rw-r--r--src/xmlpatterns/api/qresourcedelegator.cpp8
-rw-r--r--src/xmlpatterns/api/qxmlnamepool.cpp4
-rw-r--r--src/xmlpatterns/api/qxmlnamepool.h7
-rw-r--r--src/xmlpatterns/api/qxmlquery.cpp18
-rw-r--r--src/xmlpatterns/api/qxmlquery.h11
-rw-r--r--src/xmlpatterns/api/qxmlquery_p.h37
-rw-r--r--src/xmlpatterns/api/qxmlschema.cpp299
-rw-r--r--src/xmlpatterns/api/qxmlschema.h (renamed from src/gui/embedded/qmouseyopy_qws.h)65
-rw-r--r--src/xmlpatterns/api/qxmlschema_p.cpp203
-rw-r--r--src/xmlpatterns/api/qxmlschema_p.h109
-rw-r--r--src/xmlpatterns/api/qxmlschemavalidator.cpp344
-rw-r--r--src/xmlpatterns/api/qxmlschemavalidator.h97
-rw-r--r--src/xmlpatterns/api/qxmlschemavalidator_p.h131
-rw-r--r--src/xmlpatterns/common.pri1
-rw-r--r--src/xmlpatterns/data/data.pri20
-rw-r--r--src/xmlpatterns/data/qboolean.cpp2
-rw-r--r--src/xmlpatterns/data/qcomparisonfactory.cpp154
-rw-r--r--src/xmlpatterns/data/qcomparisonfactory_p.h121
-rw-r--r--src/xmlpatterns/data/qitem_p.h5
-rw-r--r--src/xmlpatterns/data/qresourceloader_p.h2
-rw-r--r--src/xmlpatterns/data/qvaluefactory.cpp106
-rw-r--r--src/xmlpatterns/data/qvaluefactory_p.h98
-rw-r--r--src/xmlpatterns/environment/createReportContext.xsl5
-rw-r--r--src/xmlpatterns/environment/qreportcontext.cpp1
-rw-r--r--src/xmlpatterns/environment/qreportcontext_p.h4
-rw-r--r--src/xmlpatterns/expr/qcastingplatform.cpp22
-rw-r--r--src/xmlpatterns/expr/qcastingplatform_p.h23
-rw-r--r--src/xmlpatterns/expr/qexpressionfactory.cpp27
-rw-r--r--src/xmlpatterns/functions/qpatternplatform.cpp21
-rw-r--r--src/xmlpatterns/functions/qpatternplatform_p.h18
-rw-r--r--src/xmlpatterns/functions/qsequencegeneratingfns.cpp13
-rw-r--r--src/xmlpatterns/parser/qmaintainingreader.cpp4
-rw-r--r--src/xmlpatterns/parser/qmaintainingreader_p.h1
-rw-r--r--src/xmlpatterns/parser/qquerytransformparser.cpp944
-rw-r--r--src/xmlpatterns/parser/qquerytransformparser_p.h70
-rw-r--r--src/xmlpatterns/parser/querytransformparser.ypp176
-rw-r--r--src/xmlpatterns/schema/.gitignore1
-rw-r--r--src/xmlpatterns/schema/builtinschemas.qrc5
-rw-r--r--src/xmlpatterns/schema/doc/All_diagram.dot13
-rw-r--r--src/xmlpatterns/schema/doc/Alternative_diagram.dot11
-rw-r--r--src/xmlpatterns/schema/doc/Annotation_diagram.dot9
-rw-r--r--src/xmlpatterns/schema/doc/AnyAttribute_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/Any_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/Assert_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/Choice_diagram.dot22
-rw-r--r--src/xmlpatterns/schema/doc/ComplexContentExtension_diagram.dot47
-rw-r--r--src/xmlpatterns/schema/doc/ComplexContentRestriction_diagram.dot47
-rw-r--r--src/xmlpatterns/schema/doc/ComplexContent_diagram.dot11
-rw-r--r--src/xmlpatterns/schema/doc/DefaultOpenContent_diagram.dot9
-rw-r--r--src/xmlpatterns/schema/doc/EnumerationFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/Field_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/FractionDigitsFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/GlobalAttribute_diagram.dot9
-rw-r--r--src/xmlpatterns/schema/doc/GlobalComplexType_diagram.dot52
-rw-r--r--src/xmlpatterns/schema/doc/GlobalElement_diagram.dot32
-rw-r--r--src/xmlpatterns/schema/doc/GlobalSimpleType_diagram.dot13
-rw-r--r--src/xmlpatterns/schema/doc/Import_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/Include_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/KeyRef_diagram.dot12
-rw-r--r--src/xmlpatterns/schema/doc/Key_diagram.dot12
-rw-r--r--src/xmlpatterns/schema/doc/LengthFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/List_diagram.dot9
-rw-r--r--src/xmlpatterns/schema/doc/LocalAll_diagram.dot13
-rw-r--r--src/xmlpatterns/schema/doc/LocalAttribute_diagram.dot9
-rw-r--r--src/xmlpatterns/schema/doc/LocalChoice_diagram.dot22
-rw-r--r--src/xmlpatterns/schema/doc/LocalComplexType_diagram.dot52
-rw-r--r--src/xmlpatterns/schema/doc/LocalElement_diagram.dot32
-rw-r--r--src/xmlpatterns/schema/doc/LocalSequence_diagram.dot22
-rw-r--r--src/xmlpatterns/schema/doc/LocalSimpleType_diagram.dot13
-rw-r--r--src/xmlpatterns/schema/doc/MaxExclusiveFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/MaxInclusiveFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/MaxLengthFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/MinExclusiveFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/MinInclusiveFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/MinLengthFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/NamedAttributeGroup_diagram.dot17
-rw-r--r--src/xmlpatterns/schema/doc/NamedGroup_diagram.dot13
-rw-r--r--src/xmlpatterns/schema/doc/Notation_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/Override_diagram.dot21
-rw-r--r--src/xmlpatterns/schema/doc/PatternFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/Redefine_diagram.dot15
-rw-r--r--src/xmlpatterns/schema/doc/ReferredAttributeGroup_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/ReferredGroup_diagram.dot13
-rw-r--r--src/xmlpatterns/schema/doc/Schema_diagram.dot66
-rw-r--r--src/xmlpatterns/schema/doc/Selector_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/Sequence_diagram.dot22
-rw-r--r--src/xmlpatterns/schema/doc/SimpleContentExtension_diagram.dot23
-rw-r--r--src/xmlpatterns/schema/doc/SimpleContentRestriction_diagram.dot87
-rw-r--r--src/xmlpatterns/schema/doc/SimpleContent_diagram.dot11
-rw-r--r--src/xmlpatterns/schema/doc/SimpleRestriction_diagram.dot62
-rw-r--r--src/xmlpatterns/schema/doc/TotalDigitsFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/Union_diagram.dot10
-rw-r--r--src/xmlpatterns/schema/doc/Unique_diagram.dot12
-rw-r--r--src/xmlpatterns/schema/doc/WhiteSpaceFacet_diagram.dot6
-rw-r--r--src/xmlpatterns/schema/doc/legend.dot7
-rw-r--r--src/xmlpatterns/schema/qnamespacesupport.cpp160
-rw-r--r--src/xmlpatterns/schema/qnamespacesupport_p.h173
-rw-r--r--src/xmlpatterns/schema/qxsdalternative.cpp68
-rw-r--r--src/xmlpatterns/schema/qxsdalternative_p.h (renamed from examples/gestures/browser/browserapplication.h)133
-rw-r--r--src/xmlpatterns/schema/qxsdannotated.cpp63
-rw-r--r--src/xmlpatterns/schema/qxsdannotated_p.h96
-rw-r--r--src/xmlpatterns/schema/qxsdannotation.cpp (renamed from src/plugins/mousedrivers/bus/main.cpp)44
-rw-r--r--src/xmlpatterns/schema/qxsdannotation_p.h127
-rw-r--r--src/xmlpatterns/schema/qxsdapplicationinformation.cpp68
-rw-r--r--src/xmlpatterns/schema/qxsdapplicationinformation_p.h115
-rw-r--r--src/xmlpatterns/schema/qxsdassertion.cpp58
-rw-r--r--src/xmlpatterns/schema/qxsdassertion_p.h101
-rw-r--r--src/xmlpatterns/schema/qxsdattribute.cpp130
-rw-r--r--src/xmlpatterns/schema/qxsdattribute_p.h246
-rw-r--r--src/xmlpatterns/schema/qxsdattributegroup.cpp73
-rw-r--r--src/xmlpatterns/schema/qxsdattributegroup_p.h122
-rw-r--r--src/xmlpatterns/schema/qxsdattributereference.cpp (renamed from src/plugins/kbddrivers/vr41xx/main.cpp)55
-rw-r--r--src/xmlpatterns/schema/qxsdattributereference_p.h147
-rw-r--r--src/xmlpatterns/schema/qxsdattributeterm.cpp58
-rw-r--r--src/xmlpatterns/schema/qxsdattributeterm_p.h96
-rw-r--r--src/xmlpatterns/schema/qxsdattributeuse.cpp136
-rw-r--r--src/xmlpatterns/schema/qxsdattributeuse_p.h224
-rw-r--r--src/xmlpatterns/schema/qxsdcomplextype.cpp231
-rw-r--r--src/xmlpatterns/schema/qxsdcomplextype_p.h404
-rw-r--r--src/xmlpatterns/schema/qxsddocumentation.cpp86
-rw-r--r--src/xmlpatterns/schema/qxsddocumentation_p.h137
-rw-r--r--src/xmlpatterns/schema/qxsdelement.cpp244
-rw-r--r--src/xmlpatterns/schema/qxsdelement_p.h403
-rw-r--r--src/xmlpatterns/schema/qxsdfacet.cpp124
-rw-r--r--src/xmlpatterns/schema/qxsdfacet_p.h213
-rw-r--r--src/xmlpatterns/schema/qxsdidcache.cpp66
-rw-r--r--src/xmlpatterns/schema/qxsdidcache_p.h (renamed from src/gui/kernel/qdirectionrecognizer_p.h)82
-rw-r--r--src/xmlpatterns/schema/qxsdidchelper.cpp137
-rw-r--r--src/xmlpatterns/schema/qxsdidchelper_p.h186
-rw-r--r--src/xmlpatterns/schema/qxsdidentityconstraint.cpp93
-rw-r--r--src/xmlpatterns/schema/qxsdidentityconstraint_p.h173
-rw-r--r--src/xmlpatterns/schema/qxsdinstancereader.cpp196
-rw-r--r--src/xmlpatterns/schema/qxsdinstancereader_p.h189
-rw-r--r--src/xmlpatterns/schema/qxsdmodelgroup.cpp78
-rw-r--r--src/xmlpatterns/schema/qxsdmodelgroup_p.h139
-rw-r--r--src/xmlpatterns/schema/qxsdnotation.cpp68
-rw-r--r--src/xmlpatterns/schema/qxsdnotation_p.h119
-rw-r--r--src/xmlpatterns/schema/qxsdparticle.cpp95
-rw-r--r--src/xmlpatterns/schema/qxsdparticle_p.h154
-rw-r--r--src/xmlpatterns/schema/qxsdparticlechecker.cpp540
-rw-r--r--src/xmlpatterns/schema/qxsdparticlechecker_p.h99
-rw-r--r--src/xmlpatterns/schema/qxsdreference.cpp (renamed from examples/gestures/browser/toolbarsearch.h)67
-rw-r--r--src/xmlpatterns/schema/qxsdreference_p.h145
-rw-r--r--src/xmlpatterns/schema/qxsdschema.cpp272
-rw-r--r--src/xmlpatterns/schema/qxsdschema_p.h301
-rw-r--r--src/xmlpatterns/schema/qxsdschemachecker.cpp2061
-rw-r--r--src/xmlpatterns/schema/qxsdschemachecker_helper.cpp306
-rw-r--r--src/xmlpatterns/schema/qxsdschemachecker_p.h284
-rw-r--r--src/xmlpatterns/schema/qxsdschemachecker_setup.cpp327
-rw-r--r--src/xmlpatterns/schema/qxsdschemacontext.cpp528
-rw-r--r--src/xmlpatterns/schema/qxsdschemacontext_p.h187
-rw-r--r--src/xmlpatterns/schema/qxsdschemadebugger.cpp226
-rw-r--r--src/xmlpatterns/schema/qxsdschemadebugger_p.h127
-rw-r--r--src/xmlpatterns/schema/qxsdschemahelper.cpp821
-rw-r--r--src/xmlpatterns/schema/qxsdschemahelper_p.h217
-rw-r--r--src/xmlpatterns/schema/qxsdschemamerger.cpp157
-rw-r--r--src/xmlpatterns/schema/qxsdschemamerger_p.h99
-rw-r--r--src/xmlpatterns/schema/qxsdschemaparser.cpp6078
-rw-r--r--src/xmlpatterns/schema/qxsdschemaparser_p.h721
-rw-r--r--src/xmlpatterns/schema/qxsdschemaparser_setup.cpp1110
-rw-r--r--src/xmlpatterns/schema/qxsdschemaparsercontext.cpp603
-rw-r--r--src/xmlpatterns/schema/qxsdschemaparsercontext_p.h231
-rw-r--r--src/xmlpatterns/schema/qxsdschemaresolver.cpp1736
-rw-r--r--src/xmlpatterns/schema/qxsdschemaresolver_p.h578
-rw-r--r--src/xmlpatterns/schema/qxsdschematoken.cpp2981
-rw-r--r--src/xmlpatterns/schema/qxsdschematoken_p.h209
-rw-r--r--src/xmlpatterns/schema/qxsdschematypesfactory.cpp126
-rw-r--r--src/xmlpatterns/schema/qxsdschematypesfactory_p.h109
-rw-r--r--src/xmlpatterns/schema/qxsdsimpletype.cpp148
-rw-r--r--src/xmlpatterns/schema/qxsdsimpletype_p.h219
-rw-r--r--src/xmlpatterns/schema/qxsdstatemachine.cpp477
-rw-r--r--src/xmlpatterns/schema/qxsdstatemachine_p.h245
-rw-r--r--src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp260
-rw-r--r--src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h141
-rw-r--r--src/xmlpatterns/schema/qxsdterm.cpp68
-rw-r--r--src/xmlpatterns/schema/qxsdterm_p.h114
-rw-r--r--src/xmlpatterns/schema/qxsdtypechecker.cpp1338
-rw-r--r--src/xmlpatterns/schema/qxsdtypechecker_p.h189
-rw-r--r--src/xmlpatterns/schema/qxsduserschematype.cpp (renamed from src/plugins/mousedrivers/vr41xx/main.cpp)51
-rw-r--r--src/xmlpatterns/schema/qxsduserschematype_p.h124
-rw-r--r--src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp215
-rw-r--r--src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h179
-rw-r--r--src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp1276
-rw-r--r--src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h296
-rw-r--r--src/xmlpatterns/schema/qxsdwildcard.cpp (renamed from src/plugins/kbddrivers/sl5000/main.cpp)82
-rw-r--r--src/xmlpatterns/schema/qxsdwildcard_p.h199
-rw-r--r--src/xmlpatterns/schema/qxsdxpathexpression.cpp (renamed from src/plugins/kbddrivers/yopy/main.cpp)55
-rw-r--r--src/xmlpatterns/schema/qxsdxpathexpression_p.h143
-rw-r--r--src/xmlpatterns/schema/schema.pri93
-rw-r--r--src/xmlpatterns/schema/schemas/xml.xsd145
-rw-r--r--src/xmlpatterns/schema/schemas/xml.xsd-LICENSE40
-rw-r--r--src/xmlpatterns/schema/tokens.xml155
-rw-r--r--src/xmlpatterns/type/qanysimpletype.cpp10
-rw-r--r--src/xmlpatterns/type/qanysimpletype_p.h12
-rw-r--r--src/xmlpatterns/type/qanytype.cpp12
-rw-r--r--src/xmlpatterns/type/qanytype_p.h10
-rw-r--r--src/xmlpatterns/type/qnamedschemacomponent.cpp (renamed from src/gui/embedded/qkbdvr41xx_qws.h)46
-rw-r--r--src/xmlpatterns/type/qnamedschemacomponent_p.h127
-rw-r--r--src/xmlpatterns/type/qprimitives_p.h15
-rw-r--r--src/xmlpatterns/type/qschematype.cpp5
-rw-r--r--src/xmlpatterns/type/qschematype_p.h30
-rw-r--r--src/xmlpatterns/type/type.pri2
-rw-r--r--src/xmlpatterns/utils/qpatternistlocale_p.h13
-rw-r--r--src/xmlpatterns/utils/qxpathhelper.cpp12
-rw-r--r--src/xmlpatterns/utils/qxpathhelper_p.h5
-rw-r--r--src/xmlpatterns/xmlpatterns.pro2
-rw-r--r--tests/auto/auto.pro10
-rw-r--r--tests/auto/bic/tst_bic.cpp10
-rw-r--r--tests/auto/compilerwarnings/tst_compilerwarnings.cpp12
-rw-r--r--tests/auto/gestures/tst_gestures.cpp29
-rwxr-xr-xtests/auto/linguist/lconvert/data/makeplurals.pl42
-rwxr-xr-xtests/auto/linguist/lconvert/data/makeplurals.sh43
-rw-r--r--tests/auto/linguist/lconvert/data/test-broken-utf8.po.out2
-rw-r--r--tests/auto/linguist/lconvert/tst_lconvert.cpp11
-rw-r--r--tests/auto/linguist/lrelease/tst_lrelease.cpp29
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt8
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp31
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result39
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt7
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp24
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp28
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp42
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro12
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro10
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result31
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui2
-rw-r--r--tests/auto/linguist/lupdate/testlupdate.cpp5
-rw-r--r--tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp35
-rw-r--r--tests/auto/math3d/qquaternion/tst_qquaternion.cpp4
-rw-r--r--tests/auto/math3d/qvectornd/tst_qvectornd.cpp4
-rw-r--r--tests/auto/moc/tst_moc.cpp42
-rw-r--r--tests/auto/patternistheaders/tst_patternistheaders.cpp8
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp12
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp102
-rw-r--r--tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp35
-rw-r--r--tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp8
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp13
-rw-r--r--tests/auto/qaction/tst_qaction.cpp4
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp76
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp2
-rw-r--r--tests/auto/qchar/tst_qchar.cpp3
-rw-r--r--tests/auto/qclipboard/tst_qclipboard.cpp2
-rw-r--r--tests/auto/qcolumnview/tst_qcolumnview.cpp42
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp6
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp113
-rw-r--r--tests/auto/qcopchannel/tst_qcopchannel.cpp2
-rw-r--r--tests/auto/qcssparser/qcssparser.pro2
-rw-r--r--tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp2
-rw-r--r--tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp21
-rw-r--r--tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml30
-rw-r--r--tests/auto/qdbusabstractinterface/interface.cpp (renamed from examples/gestures/browser/main.cpp)13
-rw-r--r--tests/auto/qdbusabstractinterface/interface.h113
-rw-r--r--tests/auto/qdbusabstractinterface/pinger.cpp (renamed from src/plugins/mousedrivers/yopy/main.cpp)45
-rw-r--r--tests/auto/qdbusabstractinterface/pinger.h145
-rw-r--r--tests/auto/qdbusabstractinterface/qdbusabstractinterface.pro15
-rw-r--r--tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp576
-rw-r--r--tests/auto/qdbusinterface/tst_qdbusinterface.cpp194
-rw-r--r--tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp121
-rw-r--r--tests/auto/qdir/tst_qdir.cpp17
-rw-r--r--tests/auto/qdirectpainter/tst_qdirectpainter.cpp4
-rw-r--r--tests/auto/qdiriterator/tst_qdiriterator.cpp31
-rw-r--r--tests/auto/qfile/tst_qfile.cpp127
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp39
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp49
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp2
-rw-r--r--tests/auto/qflags/tst_qflags.cpp24
-rw-r--r--tests/auto/qfontcombobox/tst_qfontcombobox.cpp6
-rw-r--r--tests/auto/qfontdialog/tst_qfontdialog.cpp10
-rw-r--r--tests/auto/qgl/qgl.pro3
-rw-r--r--tests/auto/qgl/tst_qgl.cpp23
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp419
-rw-r--r--tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp1
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp85
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp152
-rw-r--r--tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro3
-rw-r--r--tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp305
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp272
-rw-r--r--tests/auto/qgroupbox/tst_qgroupbox.cpp11
-rw-r--r--tests/auto/qhelpgenerator/data/test.qhp7
-rw-r--r--tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro2
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp15
-rw-r--r--tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro2
-rw-r--r--tests/auto/qicoimageformat/icons/valid/Qt.icobin0 -> 31371 bytes-rw-r--r--tests/auto/qicoimageformat/tst_qticoimageformat.cpp33
-rw-r--r--tests/auto/qitemview/tst_qitemview.cpp2
-rw-r--r--tests/auto/qkeysequence/tst_qkeysequence.cpp2
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp6
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp67
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp31
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp50
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp6
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp3
-rw-r--r--tests/auto/qnativesocketengine/qnativesocketengine.pro2
-rw-r--r--tests/auto/qnetworkreply/qnetworkreply.pro2
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp226
-rw-r--r--tests/auto/qobject/tst_qobject.cpp5
-rw-r--r--tests/auto/qpathclipper/qpathclipper.pro2
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp7
-rw-r--r--tests/auto/qplaintextedit/tst_qplaintextedit.cpp2
-rw-r--r--tests/auto/qprocess/tst_qprocess.cpp38
-rw-r--r--tests/auto/qprogressbar/tst_qprogressbar.cpp32
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp57
-rw-r--r--tests/auto/qregion/tst_qregion.cpp6
-rw-r--r--tests/auto/qscriptengine/script/com/__init__.js4
-rw-r--r--tests/auto/qscriptengine/script/com/trolltech/__init__.js4
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp7
-rw-r--r--tests/auto/qscriptqobject/tst_qscriptqobject.cpp33
-rw-r--r--tests/auto/qsettings/tst_qsettings.cpp36
-rw-r--r--tests/auto/qsharedmemory/src/qsystemlock_win.cpp26
-rw-r--r--tests/auto/qsharedpointer/externaltests.cpp20
-rw-r--r--tests/auto/qsharedpointer/externaltests.h4
-rw-r--r--tests/auto/qsharedpointer/externaltests.pri1
-rw-r--r--tests/auto/qsharedpointer/forwarddeclaration.cpp (renamed from examples/gestures/browser/edittreeview.h)25
-rw-r--r--tests/auto/qsharedpointer/forwarddeclared.cpp53
-rw-r--r--tests/auto/qsharedpointer/forwarddeclared.h (renamed from examples/animation/stickman/editor/mainwindow.h)22
-rw-r--r--tests/auto/qsharedpointer/qsharedpointer.pro10
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp165
-rw-r--r--tests/auto/qsocketnotifier/qsocketnotifier.pro2
-rw-r--r--tests/auto/qsocks5socketengine/qsocks5socketengine.pro1
-rw-r--r--tests/auto/qsqldatabase/qsqldatabase.pro5
-rw-r--r--tests/auto/qsqldatabase/tst_databases.h84
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp36
-rw-r--r--tests/auto/qsqldriver/qsqldriver.pro3
-rw-r--r--tests/auto/qsqldriver/tst_qsqldriver.cpp4
-rw-r--r--tests/auto/qsqlquery/qsqlquery.pro3
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp42
-rw-r--r--tests/auto/qsqlquerymodel/qsqlquerymodel.pro3
-rw-r--r--tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro3
-rw-r--r--tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp26
-rw-r--r--tests/auto/qsqltablemodel/qsqltablemodel.pro3
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp62
-rw-r--r--tests/auto/qsqlthread/qsqlthread.pro3
-rw-r--r--tests/auto/qsslsocket/certs/qt-test-server-cacert.pem35
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp88
-rw-r--r--tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp4
-rw-r--r--tests/auto/qstate/tst_qstate.cpp12
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp524
-rw-r--r--tests/auto/qstring/tst_qstring.cpp8
-rw-r--r--tests/auto/qstringbuilder/tst_qstringbuilder.cpp17
-rw-r--r--tests/auto/qstyle/tst_qstyle.cpp2
-rw-r--r--tests/auto/qstylesheetstyle/qstylesheetstyle.pro1
-rw-r--r--tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp280
-rw-r--r--tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp29
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp56
-rw-r--r--tests/auto/qtcpserver/tst_qtcpserver.cpp120
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp4
-rw-r--r--tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp10
-rw-r--r--tests/auto/qtextedit/tst_qtextedit.cpp4
-rw-r--r--tests/auto/qtextlist/tst_qtextlist.cpp76
-rw-r--r--tests/auto/qtextpiecetable/qtextpiecetable.pro5
-rw-r--r--tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp32
-rw-r--r--tests/auto/qtimer/tst_qtimer.cpp2
-rw-r--r--tests/auto/qtoolbar/tst_qtoolbar.cpp4
-rw-r--r--tests/auto/qtoolbutton/tst_qtoolbutton.cpp27
-rw-r--r--tests/auto/qurl/tst_qurl.cpp104
-rw-r--r--tests/auto/qvector/qvector.pro1
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp58
-rw-r--r--tests/auto/qwineventnotifier/tst_qwineventnotifier.cpp7
-rw-r--r--tests/auto/qxmlquery/tst_qxmlquery.cpp176
-rw-r--r--tests/auto/qxmlschema/.gitignore1
-rw-r--r--tests/auto/qxmlschema/qxmlschema.pro4
-rw-r--r--tests/auto/qxmlschema/tst_qxmlschema.cpp372
-rw-r--r--tests/auto/qxmlschemavalidator/.gitignore1
-rw-r--r--tests/auto/qxmlschemavalidator/qxmlschemavalidator.pro4
-rw-r--r--tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp445
-rwxr-xr-xtests/auto/runQtXmlPatternsTests.sh2
-rw-r--r--tests/auto/selftests/exceptionthrow/exceptionthrow.pro (renamed from tests/auto/selftests/exception/exception.pro)4
-rw-r--r--tests/auto/selftests/exceptionthrow/tst_exceptionthrow.cpp (renamed from tests/auto/selftests/exception/tst_exception.cpp)2
-rw-r--r--tests/auto/selftests/expected_crashes_3.txt8
-rw-r--r--tests/auto/selftests/expected_exceptionthrow.txt (renamed from tests/auto/selftests/expected_exception.txt)0
-rw-r--r--tests/auto/selftests/expected_maxwarnings.txt4
-rw-r--r--tests/auto/selftests/selftests.pro2
-rw-r--r--tests/auto/selftests/selftests.qrc3
-rw-r--r--tests/auto/selftests/tst_selftests.cpp12
-rw-r--r--tests/auto/selftests/xunit/xunit.pro11
-rwxr-xr-xtests/auto/test.pl2
-rw-r--r--tests/auto/uiloader/baseline/css_scrollarea_base.ui197
-rw-r--r--tests/auto/windowsmobile/test/tst_windowsmobile.cpp2
-rw-r--r--tests/auto/xmlpatterns.pri14
-rw-r--r--tests/auto/xmlpatternsdiagnosticsts/test/tst_xmlpatternsdiagnosticsts.cpp2
-rw-r--r--tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro1
-rw-r--r--tests/auto/xmlpatternsschema/.gitignore1
-rw-r--r--tests/auto/xmlpatternsschema/tst_xmlpatternsschema.cpp988
-rw-r--r--tests/auto/xmlpatternsschema/xmlpatternsschema.pro6
-rw-r--r--tests/auto/xmlpatternsschemats/.gitignore4
-rw-r--r--tests/auto/xmlpatternsschemats/Baseline.xml2
-rw-r--r--tests/auto/xmlpatternsschemats/TESTSUITE/.gitignore3
-rw-r--r--tests/auto/xmlpatternsschemats/TESTSUITE/unifyCatalog.xsl21
-rwxr-xr-xtests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh20
-rw-r--r--tests/auto/xmlpatternsschemats/tst_xmlpatternsschemats.cpp44
-rw-r--r--tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro23
-rw-r--r--tests/auto/xmlpatternsvalidator/files/instance.xml3
-rw-r--r--tests/auto/xmlpatternsvalidator/files/invalid_schema.xsd12
-rw-r--r--tests/auto/xmlpatternsvalidator/files/other_valid_schema.xsd12
-rw-r--r--tests/auto/xmlpatternsvalidator/files/sa_invalid_instance.xml3
-rw-r--r--tests/auto/xmlpatternsvalidator/files/sa_valid_instance.xml3
-rw-r--r--tests/auto/xmlpatternsvalidator/files/valid_schema.xsd12
-rw-r--r--tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp174
-rw-r--r--tests/auto/xmlpatternsvalidator/xmlpatternsvalidator.pro5
-rw-r--r--tests/auto/xmlpatternsview/view/MainWindow.cpp32
-rw-r--r--tests/auto/xmlpatternsview/view/MainWindow.h6
-rw-r--r--tests/auto/xmlpatternsview/view/ui_MainWindow.ui9
-rw-r--r--tests/auto/xmlpatternsview/xmlpatternsview.pro1
-rw-r--r--tests/auto/xmlpatternsxqts/lib/TestBaseLine.cpp7
-rw-r--r--tests/auto/xmlpatternsxqts/lib/TestBaseLine.h9
-rw-r--r--tests/auto/xmlpatternsxqts/lib/TestGroup.cpp6
-rw-r--r--tests/auto/xmlpatternsxqts/lib/TestSuite.cpp26
-rw-r--r--tests/auto/xmlpatternsxqts/lib/TestSuite.h14
-rw-r--r--tests/auto/xmlpatternsxqts/lib/TreeModel.cpp9
-rw-r--r--tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.cpp346
-rw-r--r--tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h130
-rw-r--r--tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.cpp881
-rw-r--r--tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.h90
-rw-r--r--tests/auto/xmlpatternsxqts/lib/lib.pro4
-rw-r--r--tests/auto/xmlpatternsxqts/test/tst_suitetest.cpp15
-rw-r--r--tests/auto/xmlpatternsxqts/test/tst_suitetest.h14
-rw-r--r--tests/auto/xmlpatternsxqts/test/tst_xmlpatternsxqts.cpp2
-rw-r--r--tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro3
-rw-r--r--tests/auto/xmlpatternsxslts/tst_xmlpatternsxslts.cpp2
-rw-r--r--tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro1
-rw-r--r--tests/benchmarks/benchmarks.pro4
-rw-r--r--tests/benchmarks/qdir/tst_qdir.cpp35
-rw-r--r--tests/benchmarks/qdiriterator/main.cpp2
-rw-r--r--tests/benchmarks/qdiriterator/qfilesystemiterator.cpp19
-rw-r--r--tests/benchmarks/qfile/main.cpp12
-rw-r--r--tests/benchmarks/qnetworkreply/main.cpp (renamed from examples/gestures/browser/networkaccessmanager.h)48
-rw-r--r--tests/benchmarks/qnetworkreply/qnetworkreply.pro13
-rw-r--r--tests/benchmarks/qquaternion/qquaternion.pro6
-rw-r--r--tests/benchmarks/qquaternion/tst_qquaternion.cpp (renamed from examples/gestures/browser/urllineedit.h)129
-rw-r--r--tests/benchmarks/qstring/main.cpp18
-rw-r--r--tests/benchmarks/qstring/qstring.pro8
-rw-r--r--tests/benchmarks/qstring/utf-8.txt72
-rw-r--r--tests/manual/qdesktopwidget/main.cpp188
-rw-r--r--tests/manual/qdesktopwidget/qdesktopwidget.pro2
-rw-r--r--tools/activeqt/dumpcpp/main.cpp6
-rw-r--r--tools/assistant/lib/qhelpprojectdata.cpp22
-rw-r--r--tools/assistant/tools/assistant/assistant.rc31
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp11
-rw-r--r--tools/checksdk/cesdkhandler.cpp7
-rw-r--r--tools/checksdk/cesdkhandler.h4
-rw-r--r--tools/checksdk/checksdk.pro39
-rw-r--r--tools/checksdk/main.cpp42
-rw-r--r--tools/configure/configure.pro4
-rw-r--r--tools/configure/configureapp.cpp107
-rw-r--r--tools/configure/configureapp.h4
-rw-r--r--tools/configure/environment.cpp218
-rw-r--r--tools/configure/main.cpp2
-rw-r--r--tools/configure/tools.cpp4
-rw-r--r--tools/designer/data/generate_shared.xsl4
-rw-r--r--tools/designer/src/components/formeditor/qdesigner_resource.cpp6
-rw-r--r--tools/designer/src/components/propertyeditor/designerpropertymanager.cpp7
-rw-r--r--tools/designer/src/components/signalsloteditor/connectdialog.ui8
-rw-r--r--tools/designer/src/designer/Info_mac.plist2
-rw-r--r--tools/designer/src/designer/designer.pro3
-rw-r--r--tools/designer/src/designer/designer.rc30
-rw-r--r--tools/designer/src/designer/mainwindow.cpp2
-rw-r--r--tools/designer/src/designer/qdesigner_workbench.cpp13
-rw-r--r--tools/designer/src/designer/uifile.icnsbin0 -> 123696 bytes-rw-r--r--tools/designer/src/lib/sdk/abstractformwindow.cpp14
-rw-r--r--tools/designer/src/lib/sdk/script.cpp6
-rw-r--r--tools/designer/src/lib/shared/widgetfactory.cpp6
-rw-r--r--tools/designer/src/lib/uilib/abstractformbuilder.cpp14
-rw-r--r--tools/designer/src/lib/uilib/formbuilder.cpp4
-rw-r--r--tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp2
-rw-r--r--tools/designer/src/uitools/quiloader.cpp8
-rw-r--r--tools/linguist/lconvert/main.cpp23
-rw-r--r--tools/linguist/linguist/linguist.rc31
-rw-r--r--tools/linguist/linguist/mainwindow.cpp22
-rw-r--r--tools/linguist/linguist/mainwindow.h6
-rw-r--r--tools/linguist/linguist/mainwindow.ui2
-rw-r--r--tools/linguist/linguist/messagemodel.cpp2
-rw-r--r--tools/linguist/lrelease/lrelease.112
-rw-r--r--tools/linguist/lrelease/main.cpp32
-rw-r--r--tools/linguist/lupdate/cpp.cpp120
-rw-r--r--tools/linguist/lupdate/lupdate.114
-rw-r--r--tools/linguist/lupdate/main.cpp19
-rw-r--r--tools/linguist/phrasebooks/french.qph227
-rw-r--r--tools/linguist/shared/abstractproitemvisitor.h24
-rw-r--r--tools/linguist/shared/po.cpp5
-rw-r--r--tools/linguist/shared/profileevaluator.cpp1119
-rw-r--r--tools/linguist/shared/profileevaluator.h13
-rw-r--r--tools/linguist/shared/proitems.cpp84
-rw-r--r--tools/linguist/shared/proitems.h33
-rw-r--r--tools/linguist/shared/proparser.pri2
-rw-r--r--tools/linguist/shared/proreader.cpp131
-rw-r--r--tools/linguist/shared/proreader.h57
-rw-r--r--tools/linguist/shared/qm.cpp57
-rw-r--r--tools/linguist/shared/translator.cpp42
-rw-r--r--tools/linguist/shared/translator.h9
-rw-r--r--tools/linguist/shared/ts.cpp4
-rw-r--r--tools/linguist/shared/ts.dtd8
-rw-r--r--tools/linguist/shared/xliff.cpp14
-rw-r--r--tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp11
-rw-r--r--tools/qdoc3/cppcodeparser.cpp25
-rw-r--r--tools/qdoc3/doc.cpp3
-rw-r--r--tools/qdoc3/generator.cpp212
-rw-r--r--tools/qdoc3/generator.h8
-rw-r--r--tools/qdoc3/htmlgenerator.cpp83
-rw-r--r--tools/qdoc3/htmlgenerator.h3
-rw-r--r--tools/qdoc3/javadocgenerator.cpp3
-rw-r--r--tools/qdoc3/javadocgenerator.h2
-rw-r--r--tools/qdoc3/main.cpp2
-rw-r--r--tools/qdoc3/node.cpp12
-rw-r--r--tools/qdoc3/node.h4
-rw-r--r--tools/qdoc3/qdoc3.pro3
-rw-r--r--tools/qdoc3/separator.cpp36
-rw-r--r--tools/qdoc3/separator.h1
-rw-r--r--tools/qdoc3/test/assistant.qdocconf4
-rw-r--r--tools/qdoc3/test/classic.css2
-rw-r--r--tools/qdoc3/test/designer.qdocconf4
-rw-r--r--tools/qdoc3/test/linguist.qdocconf4
-rw-r--r--tools/qdoc3/test/macros.qdocconf5
-rw-r--r--tools/qdoc3/test/qmake.qdocconf4
-rw-r--r--tools/qdoc3/test/qt-build-docs.qdocconf4
-rw-r--r--tools/qdoc3/test/qt-cpp-ignore.qdocconf3
-rw-r--r--tools/qdoc3/test/qt-inc.qdocconf5
-rw-r--r--tools/qdoc3/test/qt.qdocconf4
-rw-r--r--tools/qtconfig/paletteeditoradvanced.cpp2
-rw-r--r--tools/qtestlib/wince/cetest/activesyncconnection.cpp42
-rw-r--r--tools/qtestlib/wince/cetest/bootstrapped.pri3
-rw-r--r--tools/qtestlib/wince/cetest/deployment.cpp34
-rw-r--r--tools/qtestlib/wince/cetest/main.cpp1
-rw-r--r--tools/qtestlib/wince/cetest/remoteconnection.cpp32
-rw-r--r--tools/qtestlib/wince/cetest/remoteconnection.h2
-rw-r--r--tools/qtestlib/wince/remotelib/commands.cpp10
-rw-r--r--tools/qtestlib/wince/remotelib/commands.h2
-rw-r--r--tools/tools.pro2
-rw-r--r--tools/xmlpatterns/main.cpp2
-rw-r--r--tools/xmlpatterns/qcoloringmessagehandler.cpp12
-rw-r--r--tools/xmlpatternsvalidator/main.cpp133
-rw-r--r--tools/xmlpatternsvalidator/main.h76
-rw-r--r--tools/xmlpatternsvalidator/xmlpatternsvalidator.pro19
-rw-r--r--translations/assistant_de.ts100
-rw-r--r--translations/linguist_de.ts194
-rw-r--r--translations/qt_de.ts14
-rwxr-xr-xutil/webkit/mkdist-webkit6
2313 files changed, 93038 insertions, 42657 deletions
diff --git a/config.tests/x11/xsync/xsync.cpp b/config.tests/x11/xsync/xsync.cpp
new file mode 100644
index 0000000..a23fb08
--- /dev/null
+++ b/config.tests/x11/xsync/xsync.cpp
@@ -0,0 +1,11 @@
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/sync.h>
+
+int main(int, char **)
+{
+ XSyncValue value;
+ (void*)&XSyncIntToValue;
+ (void*)&XSyncCreateCounter;
+ return 0;
+}
diff --git a/config.tests/x11/xsync/xsync.pro b/config.tests/x11/xsync/xsync.pro
new file mode 100644
index 0000000..58b8238
--- /dev/null
+++ b/config.tests/x11/xsync/xsync.pro
@@ -0,0 +1,3 @@
+CONFIG += x11
+CONFIG -= qt
+SOURCES = xsync.cpp
diff --git a/configure b/configure
index f9b3030..4b75a75 100755
--- a/configure
+++ b/configure
@@ -570,6 +570,7 @@ CFG_DEBUG_RELEASE=no
CFG_SHARED=yes
CFG_SM=auto
CFG_XSHAPE=auto
+CFG_XSYNC=auto
CFG_XINERAMA=runtime
CFG_XFIXES=runtime
CFG_ZLIB=auto
@@ -613,9 +614,9 @@ CFG_GFX_ON="linuxfb multiscreen"
CFG_GFX_PLUGIN_AVAILABLE=
CFG_GFX_PLUGIN=
CFG_GFX_OFF=
-CFG_KBD_AVAILABLE="tty linuxinput sl5000 yopy vr41xx qvfb"
+CFG_KBD_AVAILABLE="tty linuxinput qvfb"
CFG_KBD_ON="tty" #default, see QMakeVar above
-CFG_MOUSE_AVAILABLE="pc bus linuxtp yopy vr41xx tslib qvfb"
+CFG_MOUSE_AVAILABLE="pc linuxtp linuxinput tslib qvfb"
CFG_MOUSE_ON="pc linuxtp" #default, see QMakeVar above
CFG_ARCH=
@@ -838,7 +839,7 @@ while [ "$#" -gt 0 ]; do
VAL=no
;;
#Qt style yes options
- -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-svg|-webkit|-scripttools|-rpath|-force-pkg-config)
+ -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-svg|-webkit|-scripttools|-rpath|-force-pkg-config)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
@@ -1165,6 +1166,8 @@ while [ "$#" -gt 0 ]; do
else
if [ "$VAL" = "opengl" ]; then
CFG_GRAPHICS_SYSTEM="opengl"
+ elif [ "$VAL" = "openvg" ]; then
+ CFG_GRAPHICS_SYSTEM="openvg"
elif [ "$VAL" = "raster" ]; then
CFG_GRAPHICS_SYSTEM="raster"
else
@@ -1444,6 +1447,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
+ xsync)
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+ CFG_XSYNC="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
xinput)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
CFG_XINPUT="$VAL"
@@ -3517,6 +3527,10 @@ Qt/X11 only:
$SHY -xshape ............ Compile XShape support.
Requires X11/extensions/shape.h.
+ $SHN -no-xsync .......... Do not compile XSync support.
+ $SHY -xsync ............. Compile XSync support.
+ Requires X11/extensions/sync.h.
+
$XAN -no-xinerama ....... Do not compile Xinerama (multihead) support.
$XAY -xinerama .......... Compile Xinerama support.
Requires X11/extensions/Xinerama.h and libXinerama.
@@ -3757,7 +3771,7 @@ elif [ "$Edition" = "OpenSource" ]; then
read acceptance
fi
echo
- if [ "$acceptance" = "yes" ]; then
+ if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
break
elif [ "$acceptance" = "no" ]; then
echo "You are not licensed to use this software."
@@ -5064,6 +5078,23 @@ if [ "$PLATFORM_X11" = "yes" ]; then
fi
fi
+ # auto-detect XSync support
+ if [ "$CFG_XSYNC" != "no" ]; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xsync "XSync" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
+ CFG_XSYNC=yes
+ else
+ if [ "$CFG_XSYNC" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+ echo "XSync support cannot be enabled due to functionality tests!"
+ echo " Turn on verbose messaging (-v) to $0 to see the final report."
+ echo " If you believe this message is in error you may use the continue"
+ echo " switch (-continue) to $0 to continue."
+ exit 101
+ else
+ CFG_XSYNC=no
+ fi
+ fi
+ fi
+
# auto-detect Xinerama support
if [ "$CFG_XINERAMA" != "no" ]; then
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinerama "Xinerama" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
@@ -5583,6 +5614,12 @@ if [ "$CFG_OPENVG" != "no" ]; then
fi
fi
+# if openvg is disabled and the user specified graphicssystem vg, disable it...
+if [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && [ "$CFG_OPENVG" = "no" ]; then
+ echo "OpenVG Graphics System is disabled due to missing OpenVG support..."
+ CFG_GRAPHICS_SYSTEM=default
+fi
+
if [ "$CFG_PTMALLOC" != "no" ]; then
# build ptmalloc, copy .a file to lib/
echo "Building ptmalloc. Please wait..."
@@ -5924,6 +5961,9 @@ if [ "$PLATFORM_X11" = "yes" ]; then
if [ "$CFG_XSHAPE" = "yes" ]; then
QT_CONFIG="$QT_CONFIG xshape"
fi
+ if [ "$CFG_XSYNC" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG xsync"
+ fi
if [ "$CFG_XINERAMA" = "yes" ]; then
QT_CONFIG="$QT_CONFIG xinerama"
QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
@@ -6025,6 +6065,7 @@ fi
#
canBuildQtXmlPatterns="yes"
canBuildWebKit="$HAVE_STL"
+canBuildQtConcurrent="yes"
# WebKit requires stdint.h
"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stdint "Stdint" $L_FLAGS $I_FLAGS $l_FLAGS
@@ -6056,9 +6097,9 @@ case "$XPLATFORM" in
case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
4*|3.4*)
;;
- 3.3*)
- canBuildWebKit="no"
- ;;
+ 3.3*)
+ canBuildWebKit="no"
+ ;;
*)
canBuildWebKit="no"
canBuildQtXmlPatterns="no"
@@ -6066,30 +6107,72 @@ case "$XPLATFORM" in
esac
;;
solaris-cc*)
- # Check the compiler version
- case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
- *)
- canBuildWebKit="no"
- canBuildQtXmlPatterns="no"
- ;;
- esac
- ;;
+ # Check the compiler version
+ case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
+ 5.[012345678])
+ canBuildWebKit="no"
+ canBuildQtXmlPatterns="no"
+ canBuildQtConcurrent="no"
+ ;;
+ 5.9)
+ canBuildWebKit="no"
+ ;;
+ esac
+ ;;
hpux-acc*)
canBuildWebKit="no"
canBuildQtXmlPatterns="no"
+ canBuildQtConcurrent="no"
;;
hpuxi-acc*)
canBuildWebKit="no"
;;
aix-xlc*)
- canBuildWebKit="no"
- canBuildQtXmlPatterns="no"
- ;;
+ # Get the xlC version
+ cat > xlcver.c <<EOF
+#include <stdio.h>
+int main()
+{
+ printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
+ return 0;
+}
+EOF
+ xlcver=
+ if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
+ xlcver=`./xlcver 2>/dev/null`
+ rm -f ./xlcver
+ fi
+ if [ "$OPT_VERBOSE" = "yes" ]; then
+ if [ -n "$xlcver" ]; then
+ echo Found IBM xlC version: $xlcver.
+ else
+ echo Could not determine IBM xlC version, assuming oldest supported.
+ fi
+ fi
+
+ case "$xlcver" in
+ [123456].*)
+ canBuildWebKit="no"
+ canBuildQtXmlPatterns="no"
+ canBuildQtConcurrent="no"
+ ;;
+ *)
+ canBuildWebKit="no"
+ ;;
+ esac
+ ;;
irix-cc*)
canBuildWebKit="no"
+ canBuildQtConcurrent="no"
;;
esac
+CFG_CONCURRENT="yes"
+if [ "$canBuildQtConcurrent" = "no" ]; then
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
+ CFG_CONCURRENT="no"
+fi
+
if [ "$CFG_XMLPATTERNS" = "yes" -a "$CFG_EXCEPTIONS" = "no" ]; then
echo "QtXmlPatterns was requested, but it can't be built due to exceptions being disabled."
exit 1
@@ -6256,7 +6339,6 @@ esac
# debug release
# dll staticlib
#
-# internal
# nocrosscompiler
# GNUmake
# largefile
@@ -6607,6 +6689,7 @@ QMakeVar set sql-plugins "$SQL_PLUGINS"
if [ "$PLATFORM_QWS" != "yes" ]; then
[ "$CFG_GRAPHICS_SYSTEM" = "raster" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_RASTER"
[ "$CFG_GRAPHICS_SYSTEM" = "opengl" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENGL"
+ [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENVG"
fi
# X11/Unix/Mac only configs
@@ -6636,6 +6719,7 @@ fi
[ "$CFG_XRENDER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
[ "$CFG_MITSHM" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
[ "$CFG_XSHAPE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
+[ "$CFG_XSYNC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
[ "$CFG_XINPUT" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
[ "$CFG_XCURSOR" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
@@ -6736,6 +6820,9 @@ fi
if [ "$PLATFORM_MAC" = "yes" ]; then
QT_CONFIG="$QT_CONFIG $CFG_MAC_ARCHS"
fi
+if [ "$CFG_DEV" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG private_tests"
+fi
# Make the application arch follow the Qt arch for single arch builds.
# (for multiple-arch builds, set CONFIG manually in the application .pro file)
@@ -6995,6 +7082,7 @@ echo "Qt 3 compatibility .. $CFG_QT3SUPPORT"
[ "$CFG_DBUS" = "no" ] && echo "QtDBus module ....... no"
[ "$CFG_DBUS" = "yes" ] && echo "QtDBus module ....... yes (run-time)"
[ "$CFG_DBUS" = "linked" ] && echo "QtDBus module ....... yes (linked)"
+echo "QtConcurrent code.... $CFG_CONCURRENT"
echo "QtScriptTools module $CFG_SCRIPTTOOLS"
echo "QtXmlPatterns module $CFG_XMLPATTERNS"
echo "Phonon module ....... $CFG_PHONON"
@@ -7094,6 +7182,7 @@ fi
if [ "$PLATFORM_X11" = "yes" ]; then
echo "NAS sound support ... $CFG_NAS"
echo "XShape support ...... $CFG_XSHAPE"
+ echo "XSync support ....... $CFG_XSYNC"
echo "Xinerama support .... $CFG_XINERAMA"
echo "Xcursor support ..... $CFG_XCURSOR"
echo "Xfixes support ...... $CFG_XFIXES"
diff --git a/demos/browser/browserapplication.cpp b/demos/browser/browserapplication.cpp
index 5ef3ce6..b27b5c1 100644
--- a/demos/browser/browserapplication.cpp
+++ b/demos/browser/browserapplication.cpp
@@ -205,6 +205,7 @@ void BrowserApplication::postLaunch()
if (directory.isEmpty())
directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName();
QWebSettings::setIconDatabasePath(directory);
+ QWebSettings::setOfflineStoragePath(directory);
setWindowIcon(QIcon(QLatin1String(":browser.svg")));
diff --git a/demos/browser/browsermainwindow.cpp b/demos/browser/browsermainwindow.cpp
index c386991..8dd59d5 100644
--- a/demos/browser/browsermainwindow.cpp
+++ b/demos/browser/browsermainwindow.cpp
@@ -81,6 +81,7 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags)
, m_stop(0)
, m_reload(0)
{
+ setToolButtonStyle(Qt::ToolButtonFollowStyle);
setAttribute(Qt::WA_DeleteOnClose, true);
statusBar()->setSizeGripEnabled(true);
setupMenu();
diff --git a/demos/qtdemo/qtdemo.rc b/demos/qtdemo/qtdemo.rc
index 4cf2a63..882b355 100644
--- a/demos/qtdemo/qtdemo.rc
+++ b/demos/qtdemo/qtdemo.rc
@@ -1,2 +1,32 @@
+#include "winver.h"
+
IDI_ICON1 ICON DISCARDABLE "qtdemo.ico"
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGS 0x0L
+ FILEFLAGSMASK 0x3fL
+ FILEOS 0x00040004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "CompanyName", "Nokia Corporation and/or its subsidiary(-ies)"
+ VALUE "FileDescription", "Qt Examples and Demos"
+ VALUE "FileVersion", "1.0.0.0"
+ VALUE "LegalCopyright", "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)."
+ VALUE "InternalName", "qtdemo"
+ VALUE "OriginalFilename", "qtdemo.exe"
+ VALUE "ProductName", "Qt Examples and Demos"
+ VALUE "ProductVersion", "1.0.0.0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp
index 7f4e032..be740be 100644
--- a/demos/textedit/textedit.cpp
+++ b/demos/textedit/textedit.cpp
@@ -75,6 +75,7 @@ const QString rsrcPath = ":/images/win";
TextEdit::TextEdit(QWidget *parent)
: QMainWindow(parent)
{
+ setToolButtonStyle(Qt::ToolButtonFollowStyle);
setupFileActions();
setupEditActions();
setupTextActions();
@@ -160,6 +161,7 @@ void TextEdit::setupFileActions()
QAction *a;
a = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("&New"), this);
+ a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::New);
connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
tb->addAction(a);
@@ -181,6 +183,7 @@ void TextEdit::setupFileActions()
menu->addAction(a);
a = new QAction(tr("Save &As..."), this);
+ a->setPriority(QAction::LowPriority);
connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
menu->addAction(a);
menu->addSeparator();
@@ -197,6 +200,7 @@ void TextEdit::setupFileActions()
menu->addAction(a);
a = new QAction(QIcon(rsrcPath + "/exportpdf.png"), tr("&Export PDF..."), this);
+ a->setPriority(QAction::LowPriority);
a->setShortcut(Qt::CTRL + Qt::Key_D);
connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
tb->addAction(a);
@@ -226,19 +230,23 @@ void TextEdit::setupEditActions()
tb->addAction(a);
menu->addAction(a);
a = actionRedo = new QAction(QIcon(rsrcPath + "/editredo.png"), tr("&Redo"), this);
+ a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::Redo);
tb->addAction(a);
menu->addAction(a);
menu->addSeparator();
a = actionCut = new QAction(QIcon(rsrcPath + "/editcut.png"), tr("Cu&t"), this);
+ a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::Cut);
tb->addAction(a);
menu->addAction(a);
a = actionCopy = new QAction(QIcon(rsrcPath + "/editcopy.png"), tr("&Copy"), this);
+ a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::Copy);
tb->addAction(a);
menu->addAction(a);
a = actionPaste = new QAction(QIcon(rsrcPath + "/editpaste.png"), tr("&Paste"), this);
+ a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::Paste);
tb->addAction(a);
menu->addAction(a);
@@ -257,6 +265,7 @@ void TextEdit::setupTextActions()
menuBar()->addMenu(menu);
actionTextBold = new QAction(QIcon(rsrcPath + "/textbold.png"), tr("&Bold"), this);
+ actionTextBold->setPriority(QAction::LowPriority);
actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
QFont bold;
bold.setBold(true);
@@ -267,6 +276,7 @@ void TextEdit::setupTextActions()
actionTextBold->setCheckable(true);
actionTextItalic = new QAction(QIcon(rsrcPath + "/textitalic.png"), tr("&Italic"), this);
+ actionTextItalic->setPriority(QAction::LowPriority);
actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
QFont italic;
italic.setItalic(true);
@@ -277,6 +287,7 @@ void TextEdit::setupTextActions()
actionTextItalic->setCheckable(true);
actionTextUnderline = new QAction(QIcon(rsrcPath + "/textunder.png"), tr("&Underline"), this);
+ actionTextUnderline->setPriority(QAction::LowPriority);
actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
QFont underline;
underline.setUnderline(true);
@@ -305,12 +316,16 @@ void TextEdit::setupTextActions()
actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
actionAlignLeft->setCheckable(true);
+ actionAlignLeft->setPriority(QAction::LowPriority);
actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
actionAlignCenter->setCheckable(true);
+ actionAlignCenter->setPriority(QAction::LowPriority);
actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
actionAlignRight->setCheckable(true);
+ actionAlignRight->setPriority(QAction::LowPriority);
actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
actionAlignJustify->setCheckable(true);
+ actionAlignJustify->setPriority(QAction::LowPriority);
tb->addActions(grp->actions());
menu->addActions(grp->actions());
@@ -340,6 +355,8 @@ void TextEdit::setupTextActions()
comboStyle->addItem("Ordered List (Decimal)");
comboStyle->addItem("Ordered List (Alpha lower)");
comboStyle->addItem("Ordered List (Alpha upper)");
+ comboStyle->addItem("Ordered List (Roman lower)");
+ comboStyle->addItem("Ordered List (Roman upper)");
connect(comboStyle, SIGNAL(activated(int)),
this, SLOT(textStyle(int)));
@@ -577,6 +594,12 @@ void TextEdit::textStyle(int styleIndex)
case 6:
style = QTextListFormat::ListUpperAlpha;
break;
+ case 7:
+ style = QTextListFormat::ListLowerRoman;
+ break;
+ case 8:
+ style = QTextListFormat::ListUpperRoman;
+ break;
}
cursor.beginEditBlock();
diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0
index 4c7bf52..6c7e450 100644
--- a/dist/changes-4.6.0
+++ b/dist/changes-4.6.0
@@ -31,6 +31,8 @@ information about a particular change.
* Platform Specific Changes *
****************************************************************************
+ - Significant external contribution from Milan Burda for planned removal
+ of (non-unicode) Windows 9x/ME support.
****************************************************************************
@@ -68,3 +70,20 @@ information about a particular change.
to the item's position and transformation, you can set the flag
QGraphicsItem::ItemSendsGeometryChanges (which is enabled by default by
QGraphicsWidget and QGraphicsProxyWidget).
+
+- QDesktopWidget on X11 no longer emits the resized(int) signal when screens
+ are added or removed. This was not done on other platforms. Use the
+ screenCountChanged signal instead
+
+- QUrl's parser is more strict when for hostnames in URLs. QUrl now
+ enforces STD 3 rules:
+
+ * each individual hostname section (between dots) must be at most
+ 63 ASCII characters in length;
+
+ * only letters, digits, and the hyphen character are allowed in the
+ ASCII range; letters outside the ASCII range follow the normal
+ IDN rules
+
+ That means QUrl no longer accepts some URLs that were invalid
+ before, but weren't interpreted as such.
diff --git a/doc/doc.pri b/doc/doc.pri
index a4c77fe..13d481f 100644
--- a/doc/doc.pri
+++ b/doc/doc.pri
@@ -2,13 +2,6 @@
# Qt documentation build
#####################################################################
-win32 {
- QT_WINCONFIG = release/
- !CONFIG(release, debug|release) {
- QT_WINCONFIG = debug/
- }
-}
-
DOCS_GENERATION_DEFINES = -Dopensourceedition
GENERATOR = $$QT_BUILD_TREE/bin/qhelpgenerator
@@ -21,9 +14,9 @@ win32:!win32-g++ {
}
$$unixstyle {
- QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && QT_BUILD_TREE=$$QT_BUILD_TREE QT_SOURCE_TREE=$$QT_SOURCE_TREE $$QT_BUILD_TREE/tools/qdoc3/$${QT_WINCONFIG}qdoc3 $$DOCS_GENERATION_DEFINES
+ QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && QT_BUILD_TREE=$$QT_BUILD_TREE QT_SOURCE_TREE=$$QT_SOURCE_TREE $$QT_BUILD_TREE/tools/qdoc3/qdoc3 $$DOCS_GENERATION_DEFINES
} else {
- QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QT_BUILD_TREE/tools/qdoc3/$${QT_WINCONFIG}qdoc3.exe $$DOCS_GENERATION_DEFINES
+ QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QT_BUILD_TREE/tools/qdoc3/qdoc3.exe $$DOCS_GENERATION_DEFINES
QDOC = $$replace(QDOC, "/", "\\")
}
macx {
diff --git a/doc/src/bughowto.qdoc b/doc/src/bughowto.qdoc
index 927cb04..fae1180 100644
--- a/doc/src/bughowto.qdoc
+++ b/doc/src/bughowto.qdoc
@@ -52,7 +52,9 @@
Notes}, and the \l{Task Tracker} on the Qt website to see
if the issue is already known.
- Always include the following information in your bug report:
+ If you have found a new bug, please submit a bug report using
+ the \l{Bug Report Form}. Always include the following information
+ in your bug report:
\list 1
\o The name and version number of your compiler
@@ -66,6 +68,6 @@
such a program can be created with some minor changes to one
of the many example programs in Qt's \c examples directory.
- Please submit the bug report using the \l{Task Tracker} on the Qt
- website.
+ If you have implemented a bug fix and want to contribute your fix
+ directly, then you can do so through the \l{Public Qt Repository}.
*/
diff --git a/doc/src/classes.qdoc b/doc/src/classes.qdoc
index dddc96f..9a5d3ec 100644
--- a/doc/src/classes.qdoc
+++ b/doc/src/classes.qdoc
@@ -44,13 +44,15 @@
\title Qt's Classes
\ingroup classlists
- This is a list of all Qt classes excluding the \l{Qt 3
- compatibility classes}. For a shorter list that only includes the
- most frequently used classes, see \l{Qt's Main Classes}.
+ This is a list of all Qt classes. For a shorter list of the most
+ frequently used Qt classes, see \l{Qt's Main Classes}. For a list
+ of the classes provided for compatibility with Qt3, see \l{Qt 3
+ compatibility classes}. For classes that have been deprecated, see
+ the \l{Obsolete Classes} list.
\generatelist classes
- \sa {Qt 3 Compatibility Classes}, {Qt's Modules}
+ \sa {Qt 3 Compatibility Classes}, {Qt's Modules}, {Obsolete Classes}
*/
/*!
diff --git a/doc/src/credits.qdoc b/doc/src/credits.qdoc
index 81ded04..15bf1e2 100644
--- a/doc/src/credits.qdoc
+++ b/doc/src/credits.qdoc
@@ -247,6 +247,7 @@
Mike Perik <mikep at crt.com>\br
Mike Sharkey <msharkey at softarc.com>\br
Mikko Ala-Fossi <mikko.ala-fossi at vaisala.com>\br
+ Milan Burda <milan.burda at gmail.com>\br
Miroslav Flidr <flidr at kky.zcu.cz>\br
Miyata Shigeru <miyata at kusm.kyoto-u.ac.jp>\br
Myron Uecker <muecker at csd.net>\br
diff --git a/doc/src/deployment.qdoc b/doc/src/deployment.qdoc
index 0866930..1da2c06 100644
--- a/doc/src/deployment.qdoc
+++ b/doc/src/deployment.qdoc
@@ -715,17 +715,19 @@
\table 100%
\header
- \o \o VC++ 6.0 \o VC++ 7.1 (2003) \o VC++ 8.0 (2005)
+ \o \o VC++ 6.0 \o VC++ 7.1 (2003) \o VC++ 8.0 (2005) \o VC++ 9.0 (2008)
\row
\o The C run-time
\o \c msvcrt.dll
\o \c msvcr71.dll
\o \c msvcr80.dll
+ \o \c msvcr90.dll
\row
\o The C++ run-time
\o \c msvcp60.dll
\o \c msvcp71.dll
\o \c msvcp80.dll
+ \o \c msvcp90.dll
\endtable
To verify that the application now can be successfully deployed,
@@ -893,7 +895,7 @@
\o \l{qt-conf.html}{Using \c qt.conf}. This approach is the recommended
if you have executables in different places sharing the same plugins.
-
+
\o Using QApplication::addLibraryPath() or
QApplication::setLibraryPaths(). This approach is recommended if you only
have one executable that will use the plugin.
@@ -902,10 +904,10 @@
hard-coded paths in the QtCore library.
\endlist
-
+
If you add a custom path using QApplication::addLibraryPath it could
look like this:
-
+
\snippet doc/src/snippets/code/doc_src_deployment.qdoc 54
Then qApp->libraryPaths() would return something like this:
diff --git a/doc/src/designer-manual.qdoc b/doc/src/designer-manual.qdoc
index 67114b9..c67865d 100644
--- a/doc/src/designer-manual.qdoc
+++ b/doc/src/designer-manual.qdoc
@@ -86,7 +86,7 @@
\o \l{Creating Main Windows in Qt Designer}
\o \l{Editing Resources with Qt Designer}
\o \l{Using Stylesheets with Qt Designer}
- \o \l{Using a Designer .ui File in Your Application}
+ \o \l{Using a Designer UI File in Your Application}
\endlist
For advanced usage of \QD, you can refer to these links:
@@ -158,7 +158,7 @@
has been introduced to aid translators in the case of two source
texts being the same but used for different purposes. For example,
a dialog could have two \gui{Add} buttons for two different
- reasons. \note To maintain compatibility, comments in \c{.ui} files
+ reasons. \note To maintain compatibility, comments in UI files
created prior to Qt 4.5 will be listed in the \gui{Disambiguation}
field.
\endlist
@@ -620,7 +620,7 @@
\key{Ctrl+O}.
At any point, you can save your form by selecting the \gui{Save From As...}
- option from the \gui File menu. The \c{.ui} files saved by \QD contain
+ option from the \gui File menu. The UI files saved by \QD contain
information about the objects used, and any details of signal and slot
connections between them.
@@ -953,7 +953,7 @@
\image designer-form-layout.png
- The \c{.ui} file above results in the previews shown below.
+ The UI file above results in the previews shown below.
\table
\header
@@ -1226,7 +1226,7 @@
The whole connection can be selected by clicking on any of its path
segments. Once selected, a connection can be deleted with the
- \key Delete key, ensuring that it will not be set up in the \c{.ui}
+ \key Delete key, ensuring that it will not be set up in the UI
file.
\endtable
*/
@@ -1360,7 +1360,7 @@
inside. Both widgets and spacers can be used inside containers.
Stacked widgets, tab widgets, and toolboxes are handled specially in \QD.
- Norwally, when adding pages (tabs, pages, compartments) to these containers
+ Normally, when adding pages (tabs, pages, compartments) to these containers
in your own code, you need to supply existing widgets, either as
placeholders or containing child widgets. In \QD, these are automatically
created for you, so you can add child objects to each page straight away.
@@ -1795,7 +1795,7 @@ pixmap property in the property editor.
\page designer-stylesheet.html
\contentspage {Qt Designer Manual}{Contents}
\previouspage Editing Resources with Qt Designer
- \nextpage Using a Designer .ui File in Your Application
+ \nextpage Using a Designer UI File in Your Application
\title Using Stylesheets with Qt Designer
@@ -1824,7 +1824,7 @@ pixmap property in the property editor.
\contentspage {Qt Designer Manual}{Contents}
\nextpage Using Custom Widgets with Qt Designer
- \title Using a Designer .ui File in Your Application
+ \title Using a Designer UI File in Your Application
With Qt's integrated build tools, \l{qmake Manual}{qmake} and \l uic, the
code for user interface components created with \QD is automatically
@@ -1855,11 +1855,11 @@ pixmap property in the property editor.
\section2 The Direct Approach
- To demonstrate how to use user interface (\c{.ui}) files straight from
+ To demonstrate how to use user interface (UI) files straight from
\QD, we create a simple Calculator Form application. This is based on the
original \l{Calculator Form Example}{Calculator Form} example.
- The application consists of one source file, \c main.cpp and a \c{.ui}
+ The application consists of one source file, \c main.cpp and a UI
file.
The \c{calculatorform.ui} file designed with \QD is shown below:
@@ -1882,7 +1882,7 @@ pixmap property in the property editor.
\snippet doc/src/snippets/uitools/calculatorform/main.cpp 0
This include is an additional check to ensure that we do not generate code
- for \c .ui files that are not used.
+ for UI files that are not used.
The \c main function creates the calculator widget by constructing a
standard QWidget that we use to host the user interface described by the
@@ -2003,7 +2003,7 @@ pixmap property in the property editor.
\section2 The UiTools Approach
- A resource file containing a \c{.ui} file is required to process forms at
+ A resource file containing a UI file is required to process forms at
run time. Also, the application needs to be configured to use the QtUiTools
module. This is done by including the following declaration in a \c qmake
project file, ensuring that the application is compiled and linked
@@ -2034,7 +2034,7 @@ pixmap property in the property editor.
\snippet examples/uitools/textfinder/textfinder.cpp 1
Processing forms at run-time gives the developer the freedom to change a
- program's user interface, just by changing the \c{.ui} file. This is useful
+ program's user interface, just by changing the UI file. This is useful
when customizing programs to suit various user needs, such as extra large
icons or a different colour scheme for accessibility support.
@@ -2130,12 +2130,12 @@ pixmap property in the property editor.
\image designer-form-settings.png
- When saving a form in \QD, it is stored as an \c .ui file. Several form
+ When saving a form in \QD, it is stored as a UI file. Several form
settings, for example the grid settings or the margin and spacing for the
default layout, are stored along with the form's components. These settings
are used when the \l uic generates the form's C++ code. For more
information on how to use forms in your application, see the
- \l{Using a Designer .ui File in Your Application} section.
+ \l{Using a Designer UI File in Your Application} section.
\section1 Modifying the Form Settings
@@ -2168,7 +2168,7 @@ pixmap property in the property editor.
You can also specify the form's \gui{Include Hints}; i.e., provide a list
of the header files which will then be included in the form window's
- associated \c .ui file. Header files may be local, i.e., relative to the
+ associated UI file. Header files may be local, i.e., relative to the
project's directory, \c "mywidget.h", or global, i.e. part of Qt or the
compilers standard libraries: \c <QtGui/QWidget>.
@@ -2331,7 +2331,7 @@ pixmap property in the property editor.
\row
\o \c includeFile()
\o The header file that must be included in applications that use
- this widget. This information is stored in .ui files and will
+ this widget. This information is stored in UI files and will
be used by \c uic to create a suitable \c{#includes} statement
in the code it generates for the form containing the custom
widget.
@@ -2379,12 +2379,12 @@ pixmap property in the property editor.
\section2 Notes on the \c{domXml()} Function
- The \c{domXml()} function returns a \c{.ui} file snippet that is used by
+ The \c{domXml()} function returns a UI file snippet that is used by
\QD's widget factory to create a custom widget and its applicable
properties.
- Since Qt 4.4, \QD's widget box allows for a complete \c{.ui} file to
- describe \bold one custom widget. The \c{.ui} file can be loaded using the
+ Since Qt 4.4, \QD's widget box allows for a complete UI file to
+ describe \bold one custom widget. The UI file can be loaded using the
\c{<ui>} tag. Specifying the <ui> tag allows for adding the <customwidget>
element that contains additional information for custom widgets. The
\c{<widget>} tag is sufficient if no additional information is required
@@ -2800,7 +2800,7 @@ pixmap property in the property editor.
\title Qt Designer's UI File Format
- The \c .ui file format used by \QD is described by the
+ The \c UI file format used by \QD is described by the
\l{http://www.w3.org/XML/Schema}{XML schema} presented below,
which we include for your convenience. Be aware that the format
may change in future Qt releases.
diff --git a/doc/src/diagrams/programs/easingcurve/main.cpp b/doc/src/diagrams/programs/easingcurve/main.cpp
index 8a2d53b..f249dbc 100644
--- a/doc/src/diagrams/programs/easingcurve/main.cpp
+++ b/doc/src/diagrams/programs/easingcurve/main.cpp
@@ -85,32 +85,37 @@ void createCurveIcons()
qreal curveScale = iconSize.height()/2;
- painter.drawLine(yAxis - 2, xAxis - curveScale, yAxis + 2, xAxis - curveScale); // hor
+ painter.drawLine(yAxis - 2, xAxis - curveScale, yAxis + 2, xAxis - curveScale); // hor
painter.drawLine(yAxis + curveScale, xAxis + 2, yAxis + curveScale, xAxis - 2); // ver
painter.drawText(yAxis + curveScale - 8, xAxis - curveScale - 4, QLatin1String("(1,1)"));
-
+
painter.drawText(yAxis + 42, xAxis + 10, QLatin1String("progress"));
- painter.drawText(15, xAxis - curveScale - 10, QLatin1String("ease"));
-
- painter.setPen(QPen(Qt::red, 1, Qt::DotLine));
+ painter.drawText(15, xAxis - curveScale - 10, QLatin1String("value"));
+
+ painter.setPen(QPen(Qt::red, 1, Qt::DotLine));
painter.drawLine(yAxis, xAxis - curveScale, yAxis + curveScale, xAxis - curveScale); // hor
painter.drawLine(yAxis + curveScale, xAxis, yAxis + curveScale, xAxis - curveScale); // ver
-
- QPoint currentPos(yAxis, xAxis);
-
+
+ QPoint start(yAxis, xAxis - curveScale * curve.valueForProgress(0));
+
painter.setPen(Qt::black);
QFont font = oldFont;
font.setPixelSize(oldFont.pixelSize() + 15);
painter.setFont(font);
painter.drawText(0, iconSize.height() - 20, iconSize.width(), 20, Qt::AlignHCenter, name);
-
- for (qreal t = 0; t < 1.0; t+=1.0/curveScale) {
+
+ QPainterPath curvePath;
+ curvePath.moveTo(start);
+ for (qreal t = 0; t <= 1.0; t+=1.0/curveScale) {
QPoint to;
to.setX(yAxis + curveScale * t);
to.setY(xAxis - curveScale * curve.valueForProgress(t));
- painter.drawLine(currentPos, to);
- currentPos = to;
+ curvePath.lineTo(to);
}
+ painter.setRenderHint(QPainter::Antialiasing, true);
+ painter.strokePath(curvePath, QColor(32, 32, 32));
+ painter.setRenderHint(QPainter::Antialiasing, false);
+
QString fileName(QString::fromAscii("qeasingcurve-%1.png").arg(name.toLower()));
printf("%s\n", qPrintable(fileName));
pix.save(QString::fromAscii("%1/%2").arg(output).arg(fileName), "PNG");
diff --git a/doc/src/dnd.qdoc b/doc/src/dnd.qdoc
index 8d3d79d..5ede20c 100644
--- a/doc/src/dnd.qdoc
+++ b/doc/src/dnd.qdoc
@@ -141,15 +141,17 @@
types of data that the widget accepts.
You must reimplement this function if you want to receive either
QDragMoveEvent or QDropEvent in your reimplementations of
- \l{QWidget::dragMoveEvent()}{dragMoveEvent()} and dropEvent().
+ \l{QWidget::dragMoveEvent()}{dragMoveEvent()} and
+ \l{QWidget::dropEvent()}{dropEvent()}.
- The following code shows how dragEnterEvent() can be reimplemented to
+ The following code shows how \l{QWidget::dragEnterEvent()}{dragEnterEvent()}
+ can be reimplemented to
tell the drag and drop system that we can only handle plain text:
\snippet doc/src/snippets/dropevents/window.cpp 3
- The dropEvent() is used to unpack dropped data and handle it in way that
- is suitable for your application.
+ The \l{QWidget::dropEvent()}{dropEvent()} is used to unpack dropped data
+ and handle it in way that is suitable for your application.
In the following code, the text supplied in the event is passed to a
QTextBrowser and a QComboBox is filled with the list of MIME types that
@@ -159,7 +161,8 @@
In this case, we accept the proposed action without checking what it is.
In a real world application, it may be necessary to return from the
- dropEvent() function without accepting the proposed action or handling
+ \l{QWidget::dropEvent()}{dropEvent()} function without accepting the
+ proposed action or handling
the data if the action is not relevant. For example, we may choose to
ignore Qt::LinkAction actions if we do not support
links to external sources in our application.
@@ -435,7 +438,7 @@
\title Porting to Qt 4 - Drag and Drop
\contentspage {Porting Guides}{Contents}
\previouspage Porting to Qt 4 - Virtual Functions
- \nextpage Porting .ui Files to Qt 4
+ \nextpage Porting UI Files to Qt 4
\ingroup porting
\brief An overview of the porting process for applications that use drag and drop.
diff --git a/doc/src/emb-charinput.qdoc b/doc/src/emb-charinput.qdoc
index c9c768c..565d953 100644
--- a/doc/src/emb-charinput.qdoc
+++ b/doc/src/emb-charinput.qdoc
@@ -82,13 +82,13 @@
\section1 Available Keyboard Drivers
- \l {Qt for Embedded Linux} provides ready-made drivers for the SL5000, Yopy,
- Vr41XX, console (TTY) and USB protocols. Run the \c configure
- script to list the available drivers:
+ \l {Qt for Embedded Linux} provides ready-made drivers for the console
+ (TTY) and the standard Linux Input Subsystem (USB, PS/2, ...). Run the
+ \c configure script to list the available drivers:
\snippet doc/src/snippets/code/doc_src_emb-charinput.qdoc 0
- Note that the console keyboard driver also handles console
+ Note that only the console (TTY) keyboard driver handles console
switching (\bold{Ctrl+Alt+F1}, ..., \bold{Ctrl+Alt+F10}) and
termination (\bold{Ctrl+Alt+Backspace}).
@@ -105,6 +105,17 @@
detect the plugin, loading the driver into the server application
at run-time.
+ \section1 Keymaps
+
+ Starting with 4.6, \l {Qt for Embedded Linux} has gained support for
+ user defined keymaps. Keymap handling is supported by the builtin
+ keyboard drivers \c TTY and \c LinuxInput. Custom keyboard drivers can
+ use the existing keymap handling code via
+ QWSKeyboardHandler::processKeycode().
+
+ By default Qt will use an internal, compiled-in US keymap.
+ See the options below for how to load a different keymap.
+
\section1 Specifying a Keyboard Driver
To specify which driver to use, set the QWS_KEYBOARD environment
@@ -113,14 +124,41 @@
\snippet doc/src/snippets/code/doc_src_emb-charinput.qdoc 2
- The \c <driver> argument are \c SL5000, \c Yopy, \c VR41xx, \c
- TTY, \c USB and \l {QKbdDriverPlugin::keys()}{keys} identifying
- custom drivers, and the driver specific options are typically a
- device, e.g., \c /dev/tty0.
+ The \c <driver> argument are \c TTY, \c LinuxInput and \l
+ {QKbdDriverPlugin::keys()}{keys} identifying custom drivers, and the
+ driver specific options are typically a device, e.g., \c /dev/tty0.
Multiple keyboard drivers can be specified in one go:
\snippet doc/src/snippets/code/doc_src_emb-charinput.qdoc 3
Input will be read from all specified drivers.
+
+ Currently the following options are supported by both the \c TTY and \c
+ LinuxInput driver:
+
+ \table
+ \header \o Option \o Description
+ \row \o \c /dev/xxx \o
+ Open the specified device, instead of the driver's default device.
+ \row \o \c repeat-delay=<d> \o
+ Time in milliseconds until auto-repeat kicks in.
+ \row \o \c repeat-rate=<r> \o
+ Time in milliseconds specifying interval between auto-repeats.
+ \row \o \c keymap=xx.qmap \o
+ File name of a keymap file in Qt's \c qmap format. See \l {kmap2qmap}
+ for instructions on how to create thoes files.\br Please note that the
+ file name can of course also be the name of a QResource.
+ \row \o \c disable-zap \o
+ Disable the QWS server "Zap" shortcut \bold{Ctrl+Alt+Backspace}
+ \row \o \c enable-compose \o
+ Activate Latin-1 composing features in the builtin US keymap. You can
+ use the right \c AltGr or right \c Alt is used as a dead key modifier,
+ while \c AltGr+. is the compose key. For example:
+ \list
+ \o \c AltGr + \c " + \c u = \uuml (u with diaeresis / umlaut u)
+ \o \c AltGr + \c . + \c / + \c o = \oslash (slashed o)
+ \endlist
+ \endtable
+
*/
diff --git a/doc/src/emb-kmap2qmap.qdoc b/doc/src/emb-kmap2qmap.qdoc
new file mode 100644
index 0000000..2b3f687
--- /dev/null
+++ b/doc/src/emb-kmap2qmap.qdoc
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qt-embedded-kmap2qmap.html
+ \title kmap2qmap
+ \ingroup qt-embedded-linux
+
+ \c kmap2qmap is a tool to generate keymaps for use on Embedded Linux.
+ The source files have to be in standard Linux \c kmap format that is
+ e.g. understood by the kernel's \c loadkeys command. This means you
+ can use the following sources to generate \c qmap files:
+
+ \list
+ \o The \l {http://lct.sourceforge.net/}{Linux Console Tools (LCT)} project.
+ \o \l {http://www.x.org/}{Xorg} X11 keymaps can be converted to the \c
+ kmap format with the \c ckbcomp utility.
+ \o Since \c kmap files are plain text files, they can also be hand crafted.
+ \endlist
+
+ The generated \c qmap files are size optimized binary files.
+
+ \c kmap2qmap is a command line program, that needs at least 2 files as
+ parameters. The last one will be the generated \c .qmap file, while all
+ the others will be parsed as input \c .kmap files. For example:
+
+ \code
+ kmap2qmap i386/qwertz/de-latin1-nodeadkeys.kmap include/compose.latin1.inc de-latin1-nodeadkeys.qmap
+ \endcode
+
+ \c kmap2qmap doesn't support all the (pseudo) symbols that the Linux
+ kernel supports. If you are converting a standard keymap you will get a
+ lot of warnings for things like \c Show_Registers, \c Hex_A, etc.: you
+ can safely ignore those.
+
+ It also doesn't support numeric symbols (e.g. \c{keycode 1 = 4242},
+ instead of \c{keycode 1 = colon}), since these are deprecated and can
+ change from one kernel version to the other.
+
+ On the other hand, \c kmap2qmap supports one additional, Qt specific,
+ symbol: \c QtZap. The built-in US keymap has that symbol mapped tp
+ \c{Ctrl+Alt+Backspace} and it serves as a shortcut to kill your QWS
+ server (similiar to the X11 server).
+
+ See also \l {Qt for Embedded Linux Character Input}
+*/
diff --git a/doc/src/emb-pointer.qdoc b/doc/src/emb-pointer.qdoc
index b13dec0..49504fe 100644
--- a/doc/src/emb-pointer.qdoc
+++ b/doc/src/emb-pointer.qdoc
@@ -64,9 +64,10 @@
\section1 Available Drivers
\l{Qt for Embedded Linux} provides ready-made drivers for the MouseMan,
- IntelliMouse, Microsoft, NEC Vr41XX, Linux Touch Panel and Yopy
- protocols as well as the universal touch screen library,
- tslib. Run the \c configure script to list the available drivers:
+ IntelliMouse, Microsoft and Linux Touch Panel protocols, for the
+ standard Linux Input Subsystem as well as the universal touch screen
+ library, tslib. Run the \c configure script to list the available
+ drivers:
\if defined(QTOPIA_PHONE)
@@ -125,7 +126,7 @@
\snippet doc/src/snippets/code/doc_src_emb-pointer.qdoc 4
The valid values for the \c <driver> argument are \c MouseMan, \c
- IntelliMouse, \c Microsoft, \c VR41xx, \c LinuxTP, \c Yopy, \c
+ IntelliMouse, \c Microsoft, \c LinuxTP, \c LinuxInput, \c
Tslib and \l {QMouseDriverPlugin::keys()}{keys} identifying custom
drivers, and the driver specific options are typically a device,
e.g., \c /dev/mouse for mouse devices and \c /dev/ts for touch
@@ -137,14 +138,6 @@
Input will be read from all specified drivers.
- Note that the \c Vr41xx driver also accepts two optional
- arguments: \c press=<value> defining a mouse click (the default
- value is 750) and \c filter=<value> specifying the length of the
- filter used to eliminate noise (the default length is 3). For
- example:
-
- \snippet doc/src/snippets/code/doc_src_emb-pointer.qdoc 6
-
\table
\header \o The Tslib Mouse Driver
\row
diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc
index 4ac4fb3..7cb4430 100644
--- a/doc/src/examples.qdoc
+++ b/doc/src/examples.qdoc
@@ -418,6 +418,7 @@
\o \l{xmlpatterns/qobjectxmlmodel}{QObject XML Model Example}
\o \l{xmlpatterns/xquery/globalVariables}{C++ Source Code Analyzer Example}
\o \l{xmlpatterns/trafficinfo}{Traffic Info}\raisedaster
+ \o \l{xmlpatterns/schema}{XML Schema Validation}\raisedaster
\endlist
\section1 Inter-Process Communication
diff --git a/doc/src/examples/arrowpad.qdoc b/doc/src/examples/arrowpad.qdoc
index 9e9268c..fa19fbb 100644
--- a/doc/src/examples/arrowpad.qdoc
+++ b/doc/src/examples/arrowpad.qdoc
@@ -140,10 +140,10 @@
QLocale::system() can be influenced by setting the \c LANG
environment variable, for example. Notice that the use of a naming
convention that incorporates the locale for \c .qm message files,
- (and \c .ts files), makes it easy to implement choosing the
+ (and TS files), makes it easy to implement choosing the
translation file according to locale.
- If there is no \c .qm message file for the locale chosen the original
+ If there is no QM message file for the locale chosen the original
source text will be used and no error raised.
\section1 Translating to French and Dutch
@@ -194,9 +194,9 @@
\endlist
We have to convert the \c tt1_fr.ts and \c tt1_nl.ts translation source
- files into \c .qm files. We could use \e {Qt Linguist} as we've done
+ files into QM files. We could use \e {Qt Linguist} as we've done
before; however using the command line tool \c lrelease ensures that
- \e all the \c .qm files for the application are created without us
+ \e all the QM files for the application are created without us
having to remember to load and \gui File|Release each one
individually from \e {Qt Linguist}.
diff --git a/doc/src/examples/calculatorform.qdoc b/doc/src/examples/calculatorform.qdoc
index 7cbf2ac..90eef3b 100644
--- a/doc/src/examples/calculatorform.qdoc
+++ b/doc/src/examples/calculatorform.qdoc
@@ -45,8 +45,8 @@
The Calculator Form Example shows how to use a form created with
\QD in an application by using the user interface information from
- a QWidget subclass. We use \l{Using a Designer .ui File in Your Application}
- {uic's auto-connection} feature to automatically connect signals
+ a QWidget subclass. We use \l{Using a Designer UI File in Your Application}
+ {uic's auto-connection} feature to automatically connect signals
from widgets on the form to slots in our code.
\image calculatorform-example.png Screenshot of the Calculator Form example
@@ -59,7 +59,7 @@
\section1 Preparation
The user interface for this example is designed completely using \QD. The
- result is a .ui file describing the form, the widgets used, any signal-slot
+ result is a UI file describing the form, the widgets used, any signal-slot
connections between them, and other standard user interface properties.
To ensure that the example can use this file, we need to include a \c FORMS
diff --git a/doc/src/examples/completer.qdoc b/doc/src/examples/completer.qdoc
index 9aaaf66..3805a7c 100644
--- a/doc/src/examples/completer.qdoc
+++ b/doc/src/examples/completer.qdoc
@@ -100,9 +100,9 @@
\section1 MainWindow Class Definition
- The \c MainWindow class is a subclass of QMainWindow and implements four
- private slots - \c about(), \c changeCase(), \c changeMode(), and
- \c changeModel().
+ The \c MainWindow class is a subclass of QMainWindow and implements five
+ private slots - \c about(), \c changeCase(), \c changeMode(), \c changeModel(),
+ and \c changeMaxVisible().
\snippet examples/tools/completer/mainwindow.h 0
@@ -126,6 +126,9 @@
\snippet examples/tools/completer/mainwindow.cpp 0
+ The \c maxVisibleSpinBox is created and determines the number of visible
+ item in the completer
+
The \c wrapCheckBox is then set up. This \c checkBox determines if the
\c{completer}'s \l{QCompleter::setWrapAround()}{setWrapAround()} property
is enabled or disabled.
@@ -242,10 +245,15 @@
\snippet examples/tools/completer/mainwindow.cpp 14
- The \c about() function provides a brief description about the example.
+ The \c changeMaxVisible() update the maximum number of visible items in
+ the completer.
\snippet examples/tools/completer/mainwindow.cpp 15
+ The \c about() function provides a brief description about the example.
+
+ \snippet examples/tools/completer/mainwindow.cpp 16
+
\section1 \c main() Function
The \c main() function instantiates QApplication and \c MainWindow and
diff --git a/doc/src/examples/helloscript.qdoc b/doc/src/examples/helloscript.qdoc
index a18e4ad..1b0f43c 100644
--- a/doc/src/examples/helloscript.qdoc
+++ b/doc/src/examples/helloscript.qdoc
@@ -121,7 +121,7 @@
window). Don't forget the exclamation mark!
Click the \gui Done checkbox and choose \gui File|Save from the
- menu bar. The \c .ts file will no longer contain
+ menu bar. The TS file will no longer contain
\snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 3
@@ -129,11 +129,11 @@
\snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 4
- To see the application running in Latin, we have to generate a \c .qm
- file from the \c .ts file. Generating a \c .qm file can be achieved
- either from within \e {Qt Linguist} (for a single \c .ts file), or
- by using the command line program \c lrelease which will produce one \c
- .qm file for each of the \c .ts files listed in the project file.
+ To see the application running in Latin, we have to generate a QM
+ file from the TS file. Generating a QM file can be achieved
+ either from within \e {Qt Linguist} (for a single TS file), or
+ by using the command line program \c lrelease which will produce one
+ QM file for each of the TS files listed in the project file.
Generate \c hellotr_la.qm from \c hellotr_la.ts by choosing
\gui File|Release from \e {Qt Linguist}'s menu bar and pressing
\gui Save in the file save dialog that pops up. Now run the \c helloscript
diff --git a/doc/src/examples/hellotr.qdoc b/doc/src/examples/hellotr.qdoc
index bb38737..18e0715 100644
--- a/doc/src/examples/hellotr.qdoc
+++ b/doc/src/examples/hellotr.qdoc
@@ -108,12 +108,12 @@
Note that the file extension is \c .ts, not \c .qm. The \c .ts
translation source format is designed for use during the
application's development. Programmers or release managers run
- the \c lupdate program to generate and update \c .ts files with
+ the \c lupdate program to generate and update TS files with
the source text that is extracted from the source code.
- Translators read and update the \c .ts files using \e {Qt
+ Translators read and update the TS files using \e {Qt
Linguist} adding and editing their translations.
- The \c .ts format is human-readable XML that can be emailed directly
+ The TS format is human-readable XML that can be emailed directly
and is easy to put under version control. If you edit this file
manually, be aware that the default encoding for XML is UTF-8, not
Latin1 (ISO 8859-1). One way to type in a Latin1 character such as
@@ -121,8 +121,8 @@
"\&#xf8;". This will work for any Unicode 4.0 character.
Once the translations are complete the \c lrelease program is used to
- convert the \c .ts files into the \c .qm Qt message file format. The
- \c .qm format is a compact binary format designed to deliver very
+ convert the TS files into the QM Qt message file format. The
+ QM format is a compact binary format designed to deliver very
fast lookup performance. Both \c lupdate and \c lrelease read all the
project's source and header files (as specified in the HEADERS and
SOURCES lines of the project file) and extract the strings that
@@ -131,7 +131,7 @@
\c lupdate is used to create and update the message files (\c hellotr_la.ts
in this case) to keep them in sync with the source code. It is safe to
run \c lupdate at any time, as \c lupdate does not remove any
- information. For example, you can put it in the makefile, so the \c .ts
+ information. For example, you can put it in the makefile, so the TS
files are updated whenever the source changes.
Try running \c lupdate right now, like this:
@@ -151,7 +151,7 @@
We will use \e {Qt Linguist} to provide the translation, although
you can use any XML or plain text editor to enter a translation into a
- \c .ts file.
+ TS file.
To start \e {Qt Linguist}, type
@@ -163,7 +163,7 @@
window). Don't forget the exclamation mark!
Click the \gui Done checkbox and choose \gui File|Save from the
- menu bar. The \c .ts file will no longer contain
+ menu bar. The TS file will no longer contain
\snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 3
@@ -173,11 +173,11 @@
\section1 Running the Application in Latin
- To see the application running in Latin, we have to generate a \c .qm
- file from the \c .ts file. Generating a \c .qm file can be achieved
- either from within \e {Qt Linguist} (for a single \c .ts file), or
- by using the command line program \c lrelease which will produce one \c
- .qm file for each of the \c .ts files listed in the project file.
+ To see the application running in Latin, we have to generate a QM
+ file from the TS file. Generating a QM file can be achieved
+ either from within \e {Qt Linguist} (for a single TS file), or
+ by using the command line program \c lrelease which will produce one
+ QM file for each of the TS files listed in the project file.
Generate \c hellotr_la.qm from \c hellotr_la.ts by choosing
\gui File|Release from \e {Qt Linguist}'s menu bar and pressing
\gui Save in the file save dialog that pops up. Now run the \c hellotr
diff --git a/doc/src/examples/moveblocks.qdoc b/doc/src/examples/moveblocks.qdoc
index 2bdcca5..7e42307 100644
--- a/doc/src/examples/moveblocks.qdoc
+++ b/doc/src/examples/moveblocks.qdoc
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/doc/src/examples/multipleinheritance.qdoc b/doc/src/examples/multipleinheritance.qdoc
index 5a77275..1622fb0 100644
--- a/doc/src/examples/multipleinheritance.qdoc
+++ b/doc/src/examples/multipleinheritance.qdoc
@@ -103,6 +103,6 @@
There are various approaches to include forms into applications. The
Multiple Inheritance approach is just one of them. See
- \l{Using a Designer .ui File in Your Application} for more information on
+ \l{Using a Designer UI File in Your Application} for more information on
the other approaches available.
*/
diff --git a/doc/src/examples/qtscripttetrix.qdoc b/doc/src/examples/qtscripttetrix.qdoc
index c94697a..fb2d537 100644
--- a/doc/src/examples/qtscripttetrix.qdoc
+++ b/doc/src/examples/qtscripttetrix.qdoc
@@ -57,7 +57,7 @@
\section1 Setting up the GUI
- The graphical user interface is defined in a \c{.ui} file, creating
+ The graphical user interface is defined in a UI file, created
using Qt Designer, and is set up in the example's C++ \c{main.cpp} file.
\snippet examples/script/qstetrix/main.cpp 0
diff --git a/doc/src/examples/schema.qdoc b/doc/src/examples/schema.qdoc
new file mode 100644
index 0000000..df42832
--- /dev/null
+++ b/doc/src/examples/schema.qdoc
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example xmlpatterns/schema
+ \title XML Schema Validation Example
+
+ This example shows how to use QtXmlPatterns to validate XML with
+ a W3C XML Schema.
+
+ \tableofcontents
+
+ \section1 Introduction
+
+ The example application shows different XML schema definitions and
+ for every definition two XML instance documents, one that is valid
+ according to the schema and one that is not.
+ The user can select the valid or invalid instance document, change
+ it and validate it again.
+
+ \section2 The User Interface
+
+ The UI for this example was created using \l{Qt Designer Manual} {Qt
+ Designer}:
+
+ \image schema-example.png
+
+ The UI consists of three parts, at the top the XML schema \l{QComboBox} {selection}
+ and the schema \l{QTextBrowser} {viewer}, below the XML instance \l{QComboBox} {selection}
+ and the instance \l{QTextEdit} {editor} and at the bottom the validation status \l{QLabel} {label}
+ next to the validation \l{QPushButton} {button}.
+
+ \section2 Validating XML Instance Documents
+
+ You can select one of the three predefined XML schemas and for each schema
+ an valid or invalid instance document. A click on the 'Validate' button will
+ validate the content of the XML instance editor against the schema from the
+ XML schema viewer. As you can modify the content of the instance editor, different
+ instances can be tested and validation error messages analysed.
+
+ \section1 Code Walk-Through
+
+ The example's main() function creates the standard instance of
+ QApplication. Then it creates an instance of the mainwindow class, shows it,
+ and starts the Qt event loop:
+
+ \snippet examples/xmlpatterns/schema/main.cpp 0
+
+ \section2 The UI Class: MainWindow
+
+ The example's UI is a conventional Qt GUI application inheriting
+ QMainWindow and the class generated by \l{Qt Designer Manual} {Qt
+ Designer}:
+
+ \snippet examples/xmlpatterns/schema/mainwindow.h 0
+
+ The constructor fills the schema and instance \l{QComboBox} selections with the predefined
+ schemas and instances and connects their \l{QComboBox::currentIndexChanged()} {currentIndexChanged()}
+ signals to the window's \c{schemaSelected()} resp. \c{instanceSelected()} slot.
+ Furthermore the signal-slot connections for the validation \l{QPushButton} {button}
+ and the instance \l{QTextEdit} {editor} are set up.
+
+ The call to \c{schemaSelected(0)} and \c{instanceSelected(0)} will trigger the validation
+ of the initial Contact Schema example.
+
+ \snippet examples/xmlpatterns/schema/mainwindow.cpp 0
+
+ In the \c{schemaSelected()} slot the content of the instance \l{QComboBox} {selection}
+ is adapted to the selected schema and the corresponding schema is loaded from the
+ \l{The Qt Resource System} {resource file} and displayed in the schema \l{QTextBrowser} {viewer}.
+ At the end of the method a revalidation is triggered.
+
+ \snippet examples/xmlpatterns/schema/mainwindow.cpp 1
+
+ In the \c{instanceSelected()} slot the selected instance is loaded from the
+ \l{The Qt Resource System} {resource file} and loaded into the instance \l{QTextEdit} {editor}
+ an the revalidation is triggered again.
+
+ \snippet examples/xmlpatterns/schema/mainwindow.cpp 2
+
+ The \c{validate()} slot does the actual work in this example.
+ At first it stores the content of the schema \l{QTextBrowser} {viewer} and the
+ \l{QTextEdit} {editor} into temporary \l{QByteArray} {variables}.
+ Then it instanciates a \c{MessageHandler} object which inherits from
+ \l{QAbstractMessageHandler} {QAbstractMessageHandler} and is a convenience
+ class to store error messages from the XmlPatterns system.
+
+ \snippet examples/xmlpatterns/schema/mainwindow.cpp 4
+
+ After the \l{QXmlSchema} {QXmlSchema} is instanciated and the message handler set
+ on it, the \l{QXmlSchema::load()} {load()} method is called with the schema data as argument.
+ If the schema is invalid or a parsing error has occured, \l{QXmlSchema::isValid()} {isValid()}
+ returns \c{false} and the error is flagged in \c{errorOccurred}.
+ If the loading was successful, a \l{QXmlSchemaValidator} {QXmlSchemaValidator} is
+ instanciated and the schema passed in the constructor.
+ A call to \l{QXmlSchemaValidator::validate()} {validate()} will validate the passed
+ XML instance data against the XML schema. The return value of that method signals
+ whether the validation was successful.
+ Depending on the success the status \l{QLabel} {label} is set to 'validation successful'
+ or the error message stored in the \c{MessageHandler}
+
+ The rest of the code does only some fancy coloring and eyecandy.
+
+ \snippet examples/xmlpatterns/schema/mainwindow.cpp 3
+*/
diff --git a/doc/src/examples/simpletextviewer.qdoc b/doc/src/examples/simpletextviewer.qdoc
index 87eae57..2531a86 100644
--- a/doc/src/examples/simpletextviewer.qdoc
+++ b/doc/src/examples/simpletextviewer.qdoc
@@ -198,12 +198,7 @@
<file>openfile.html</file>
<file>wildcardmatching.html</file>
<file>images/browse.png</file>
- <file>images/fadedfilemenu.png</file>
- <file>images/filedialog.png</file>
- <file>images/handbook.png</file>
- <file>images/mainwindow.png</file>
- <file>images/open.png</file>
- <file>images/wildcard.png</file>
+ <file>images/*.png</file>
</files>
</filterSection>
</QtHelpProject>
diff --git a/doc/src/examples/svggenerator.qdoc b/doc/src/examples/svggenerator.qdoc
index 09fe6e1..dd7459a 100644
--- a/doc/src/examples/svggenerator.qdoc
+++ b/doc/src/examples/svggenerator.qdoc
@@ -55,8 +55,8 @@
The example consists of two classes: \c Window and \c DisplayWidget.
The \c Window class contains the application logic and constructs the user
- interface from a Qt Designer \c{.ui} file as described in the
- \l{Using a Designer .ui File in Your Application#The Multiple Inheritance Approach}{Qt Designer manual}.
+ interface from a Qt Designer UI file as described in the
+ \l{Using a Designer UI File in Your Application#The Multiple Inheritance Approach}{Qt Designer manual}.
It also contains the code to write an SVG file.
The \c DisplayWidget class performs all the work of painting a picture on
diff --git a/doc/src/examples/tablet.qdoc b/doc/src/examples/tablet.qdoc
index e412815..61c140f 100644
--- a/doc/src/examples/tablet.qdoc
+++ b/doc/src/examples/tablet.qdoc
@@ -275,7 +275,10 @@
In this function we draw on the image based on the movement of the
device. If the device used on the tablet is a stylus we want to draw a
- line between the positions of the stylus recorded in \c polyLine.
+ line between the positions of the stylus recorded in \c polyLine. We
+ also assume that this is a reasonable handling of any unknown device,
+ but update the statusbar with a warning so that the user can see that
+ for his tablet he might have to implement special handling.
If it is an airbrush we want to draw a circle of points with a
point density based on the tangential pressure, which is the position
of the finger wheel on the airbrush. We use the Qt::BrushStyle to
diff --git a/doc/src/examples/textfinder.qdoc b/doc/src/examples/textfinder.qdoc
index adbbd0d..acfbd0f 100644
--- a/doc/src/examples/textfinder.qdoc
+++ b/doc/src/examples/textfinder.qdoc
@@ -45,7 +45,7 @@
The Text Finder example demonstrates how to dynamically process forms
using the QtUiTools module. Dynamic form processing enables a form to
- be processed at run-time only by changing the .ui file for the project.
+ be processed at run-time only by changing the UI file for the project.
The program allows the user to look up a particular word within the
contents of a text file. This text file is included in the project's
resource and is loaded into the display at startup.
@@ -95,7 +95,7 @@
\snippet examples/uitools/textfinder/textfinder.h 0
The slot \c{on_find_Button_clicked()} is a slot named according to the
- \l{Using a Designer .ui File in Your Application#Automatic Connections}
+ \l{Using a Designer UI File in Your Application#Automatic Connections}
{Automatic Connection} naming convention required
by \c uic.
diff --git a/doc/src/examples/worldtimeclockbuilder.qdoc b/doc/src/examples/worldtimeclockbuilder.qdoc
index 55246e9..f38062a 100644
--- a/doc/src/examples/worldtimeclockbuilder.qdoc
+++ b/doc/src/examples/worldtimeclockbuilder.qdoc
@@ -66,7 +66,7 @@
generate a dependency on the \c libQtUiTools library containing the QtUiTools
classes.
- Note that we do not inform \c qmake about any .ui files, and so none will
+ Note that we do not inform \c qmake about any UI files, and so none will
be processed and built into the application. The resource file contains
an entry for the particular form that we wish to use:
diff --git a/doc/src/graphicsview.qdoc b/doc/src/graphicsview.qdoc
index 4c408cd..f42c0d4 100644
--- a/doc/src/graphicsview.qdoc
+++ b/doc/src/graphicsview.qdoc
@@ -201,6 +201,9 @@
using an untransformed view, one unit on the scene is represented by
one pixel on the screen.
+ \note The inverted Y-axis coordinate system (where \c y grows upwards)
+ is unsupported as Graphics Views uses Qt's coordinate system.
+
There are three effective coordinate systems in play in Graphics View:
Item coordinates, scene coordinates, and view coordinates. To simplify
your implementation, Graphics View provides convenience functions that
diff --git a/doc/src/i18n.qdoc b/doc/src/i18n.qdoc
index 4109b62..5964926 100644
--- a/doc/src/i18n.qdoc
+++ b/doc/src/i18n.qdoc
@@ -266,19 +266,19 @@
\o Run \c lupdate to extract translatable text from the C++
source code of the Qt application, resulting in a message file
- for translators (a \c .ts file). The utility recognizes the tr()
+ for translators (a TS file). The utility recognizes the tr()
construct and the \c{QT_TR*_NOOP()} macros described above and
- produces \c .ts files (usually one per language).
+ produces TS files (usually one per language).
- \o Provide translations for the source texts in the \c .ts file, using
- \e{Qt Linguist}. Since \c .ts files are in XML format, you can also
+ \o Provide translations for the source texts in the TS file, using
+ \e{Qt Linguist}. Since TS files are in XML format, you can also
edit them by hand.
- \o Run \c lrelease to obtain a light-weight message file (a \c .qm
- file) from the \c .ts file, suitable only for end use. Think of the \c
- .ts files as "source files", and \c .qm files as "object files". The
- translator edits the \c .ts files, but the users of your application
- only need the \c .qm files. Both kinds of files are platform and
+ \o Run \c lrelease to obtain a light-weight message file (a QM
+ file) from the TS file, suitable only for end use. Think of the TS
+ files as "source files", and QM files as "object files". The
+ translator edits the TS files, but the users of your application
+ only need the QM files. Both kinds of files are platform and
locale independent.
\endlist
diff --git a/doc/src/images/qeasingcurve-cosinecurve.png b/doc/src/images/qeasingcurve-cosinecurve.png
index b27e763..8cee978 100644
--- a/doc/src/images/qeasingcurve-cosinecurve.png
+++ b/doc/src/images/qeasingcurve-cosinecurve.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inback.png b/doc/src/images/qeasingcurve-inback.png
index 8506c0f..0064cb3 100644
--- a/doc/src/images/qeasingcurve-inback.png
+++ b/doc/src/images/qeasingcurve-inback.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inbounce.png b/doc/src/images/qeasingcurve-inbounce.png
index 275b38c..eaa64f8 100644
--- a/doc/src/images/qeasingcurve-inbounce.png
+++ b/doc/src/images/qeasingcurve-inbounce.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-incirc.png b/doc/src/images/qeasingcurve-incirc.png
index b985e9c..7bd0f09 100644
--- a/doc/src/images/qeasingcurve-incirc.png
+++ b/doc/src/images/qeasingcurve-incirc.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-incubic.png b/doc/src/images/qeasingcurve-incubic.png
index e417ee1..1ac9eaf 100644
--- a/doc/src/images/qeasingcurve-incubic.png
+++ b/doc/src/images/qeasingcurve-incubic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-incurve.png b/doc/src/images/qeasingcurve-incurve.png
index d9a9340..578259e 100644
--- a/doc/src/images/qeasingcurve-incurve.png
+++ b/doc/src/images/qeasingcurve-incurve.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inelastic.png b/doc/src/images/qeasingcurve-inelastic.png
index b242fd3..f976b5a 100644
--- a/doc/src/images/qeasingcurve-inelastic.png
+++ b/doc/src/images/qeasingcurve-inelastic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inexpo.png b/doc/src/images/qeasingcurve-inexpo.png
index f06316c..1af3652 100644
--- a/doc/src/images/qeasingcurve-inexpo.png
+++ b/doc/src/images/qeasingcurve-inexpo.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutback.png b/doc/src/images/qeasingcurve-inoutback.png
index 9fd1446..480bc05 100644
--- a/doc/src/images/qeasingcurve-inoutback.png
+++ b/doc/src/images/qeasingcurve-inoutback.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutbounce.png b/doc/src/images/qeasingcurve-inoutbounce.png
index fb65f31..de62309 100644
--- a/doc/src/images/qeasingcurve-inoutbounce.png
+++ b/doc/src/images/qeasingcurve-inoutbounce.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutcirc.png b/doc/src/images/qeasingcurve-inoutcirc.png
index 123cc54..b4be8ac 100644
--- a/doc/src/images/qeasingcurve-inoutcirc.png
+++ b/doc/src/images/qeasingcurve-inoutcirc.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutcubic.png b/doc/src/images/qeasingcurve-inoutcubic.png
index b07695c..49dfbef 100644
--- a/doc/src/images/qeasingcurve-inoutcubic.png
+++ b/doc/src/images/qeasingcurve-inoutcubic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutelastic.png b/doc/src/images/qeasingcurve-inoutelastic.png
index 65851e1..5b0e54a 100644
--- a/doc/src/images/qeasingcurve-inoutelastic.png
+++ b/doc/src/images/qeasingcurve-inoutelastic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutexpo.png b/doc/src/images/qeasingcurve-inoutexpo.png
index 7cbfb13..776984a 100644
--- a/doc/src/images/qeasingcurve-inoutexpo.png
+++ b/doc/src/images/qeasingcurve-inoutexpo.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutquad.png b/doc/src/images/qeasingcurve-inoutquad.png
index c5eed06..2643330 100644
--- a/doc/src/images/qeasingcurve-inoutquad.png
+++ b/doc/src/images/qeasingcurve-inoutquad.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutquart.png b/doc/src/images/qeasingcurve-inoutquart.png
index 3b66c0d..31fc0c8 100644
--- a/doc/src/images/qeasingcurve-inoutquart.png
+++ b/doc/src/images/qeasingcurve-inoutquart.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutquint.png b/doc/src/images/qeasingcurve-inoutquint.png
index c74efe9..4d7a745 100644
--- a/doc/src/images/qeasingcurve-inoutquint.png
+++ b/doc/src/images/qeasingcurve-inoutquint.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutsine.png b/doc/src/images/qeasingcurve-inoutsine.png
index 5964f31..012ff75 100644
--- a/doc/src/images/qeasingcurve-inoutsine.png
+++ b/doc/src/images/qeasingcurve-inoutsine.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inquad.png b/doc/src/images/qeasingcurve-inquad.png
index 3373310..e697c20 100644
--- a/doc/src/images/qeasingcurve-inquad.png
+++ b/doc/src/images/qeasingcurve-inquad.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inquart.png b/doc/src/images/qeasingcurve-inquart.png
index 28086d8..6d65175 100644
--- a/doc/src/images/qeasingcurve-inquart.png
+++ b/doc/src/images/qeasingcurve-inquart.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inquint.png b/doc/src/images/qeasingcurve-inquint.png
index 330aa85..faaaea7 100644
--- a/doc/src/images/qeasingcurve-inquint.png
+++ b/doc/src/images/qeasingcurve-inquint.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-insine.png b/doc/src/images/qeasingcurve-insine.png
index 63d9238..0944903 100644
--- a/doc/src/images/qeasingcurve-insine.png
+++ b/doc/src/images/qeasingcurve-insine.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-linear.png b/doc/src/images/qeasingcurve-linear.png
index 2a05885..fb3aaf3 100644
--- a/doc/src/images/qeasingcurve-linear.png
+++ b/doc/src/images/qeasingcurve-linear.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outback.png b/doc/src/images/qeasingcurve-outback.png
index 7cb34c6..83b3fa2 100644
--- a/doc/src/images/qeasingcurve-outback.png
+++ b/doc/src/images/qeasingcurve-outback.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outbounce.png b/doc/src/images/qeasingcurve-outbounce.png
index 932fc16..27ac979 100644
--- a/doc/src/images/qeasingcurve-outbounce.png
+++ b/doc/src/images/qeasingcurve-outbounce.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outcirc.png b/doc/src/images/qeasingcurve-outcirc.png
index a1a6cb6..0019370 100644
--- a/doc/src/images/qeasingcurve-outcirc.png
+++ b/doc/src/images/qeasingcurve-outcirc.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outcubic.png b/doc/src/images/qeasingcurve-outcubic.png
index aa1d604..45477c0 100644
--- a/doc/src/images/qeasingcurve-outcubic.png
+++ b/doc/src/images/qeasingcurve-outcubic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outcurve.png b/doc/src/images/qeasingcurve-outcurve.png
index a949ae4..295b471 100644
--- a/doc/src/images/qeasingcurve-outcurve.png
+++ b/doc/src/images/qeasingcurve-outcurve.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outelastic.png b/doc/src/images/qeasingcurve-outelastic.png
index 2a9ba39..1d407ed 100644
--- a/doc/src/images/qeasingcurve-outelastic.png
+++ b/doc/src/images/qeasingcurve-outelastic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outexpo.png b/doc/src/images/qeasingcurve-outexpo.png
index e771c2e..5685155 100644
--- a/doc/src/images/qeasingcurve-outexpo.png
+++ b/doc/src/images/qeasingcurve-outexpo.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinback.png b/doc/src/images/qeasingcurve-outinback.png
index 7523727..4700ab0 100644
--- a/doc/src/images/qeasingcurve-outinback.png
+++ b/doc/src/images/qeasingcurve-outinback.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinbounce.png b/doc/src/images/qeasingcurve-outinbounce.png
index ab73d02..12cc1a8 100644
--- a/doc/src/images/qeasingcurve-outinbounce.png
+++ b/doc/src/images/qeasingcurve-outinbounce.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outincirc.png b/doc/src/images/qeasingcurve-outincirc.png
index ec4b8d3..c8a5c86 100644
--- a/doc/src/images/qeasingcurve-outincirc.png
+++ b/doc/src/images/qeasingcurve-outincirc.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outincubic.png b/doc/src/images/qeasingcurve-outincubic.png
index 8b8ae68..42af870 100644
--- a/doc/src/images/qeasingcurve-outincubic.png
+++ b/doc/src/images/qeasingcurve-outincubic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinelastic.png b/doc/src/images/qeasingcurve-outinelastic.png
index 89dde2c..308be57 100644
--- a/doc/src/images/qeasingcurve-outinelastic.png
+++ b/doc/src/images/qeasingcurve-outinelastic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinexpo.png b/doc/src/images/qeasingcurve-outinexpo.png
index 5909901..0692baa 100644
--- a/doc/src/images/qeasingcurve-outinexpo.png
+++ b/doc/src/images/qeasingcurve-outinexpo.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinquad.png b/doc/src/images/qeasingcurve-outinquad.png
index 7ddefee..9e3cd83 100644
--- a/doc/src/images/qeasingcurve-outinquad.png
+++ b/doc/src/images/qeasingcurve-outinquad.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinquart.png b/doc/src/images/qeasingcurve-outinquart.png
index 00ef597..9a3c16f 100644
--- a/doc/src/images/qeasingcurve-outinquart.png
+++ b/doc/src/images/qeasingcurve-outinquart.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinquint.png b/doc/src/images/qeasingcurve-outinquint.png
index 361bfaa4..add9feb 100644
--- a/doc/src/images/qeasingcurve-outinquint.png
+++ b/doc/src/images/qeasingcurve-outinquint.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinsine.png b/doc/src/images/qeasingcurve-outinsine.png
index 1737041..4bc2aaf 100644
--- a/doc/src/images/qeasingcurve-outinsine.png
+++ b/doc/src/images/qeasingcurve-outinsine.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outquad.png b/doc/src/images/qeasingcurve-outquad.png
index 6f27cbd..c505ff9 100644
--- a/doc/src/images/qeasingcurve-outquad.png
+++ b/doc/src/images/qeasingcurve-outquad.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outquart.png b/doc/src/images/qeasingcurve-outquart.png
index d45a0b8..6eac058 100644
--- a/doc/src/images/qeasingcurve-outquart.png
+++ b/doc/src/images/qeasingcurve-outquart.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outquint.png b/doc/src/images/qeasingcurve-outquint.png
index 6e7df0e..77a9ad4 100644
--- a/doc/src/images/qeasingcurve-outquint.png
+++ b/doc/src/images/qeasingcurve-outquint.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outsine.png b/doc/src/images/qeasingcurve-outsine.png
index 7546a0d..d135b2f 100644
--- a/doc/src/images/qeasingcurve-outsine.png
+++ b/doc/src/images/qeasingcurve-outsine.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-sinecurve.png b/doc/src/images/qeasingcurve-sinecurve.png
index ca67d44..6134a01 100644
--- a/doc/src/images/qeasingcurve-sinecurve.png
+++ b/doc/src/images/qeasingcurve-sinecurve.png
Binary files differ
diff --git a/doc/src/images/schema-example.png b/doc/src/images/schema-example.png
new file mode 100644
index 0000000..5e95bf5
--- /dev/null
+++ b/doc/src/images/schema-example.png
Binary files differ
diff --git a/doc/src/linguist-manual.qdoc b/doc/src/linguist-manual.qdoc
index ee59fdc..fd062bb 100644
--- a/doc/src/linguist-manual.qdoc
+++ b/doc/src/linguist-manual.qdoc
@@ -247,10 +247,10 @@
subsequent \l lupdate runs would probably take place during the
final beta phase.
- The \c .ts file format is a simple human-readable XML format that
+ The TS file format is a simple human-readable XML format that
can be used with version control systems if required. \c lupdate
can also process Localization Interchange File Format (XLIFF)
- format files; file in this format typically have file names that
+ format files; files in this format typically have file names that
end with the \c .xlf suffix.
Pass the \c -help option to \c lupdate to obtain the list of
@@ -266,19 +266,19 @@
Usage: \c {lrelease myproject.pro}
- \l lrelease is a command line tool that produces \c .qm files out
- of \c .ts files. The \c .qm file format is a compact binary format
+ \l lrelease is a command line tool that produces QM files out
+ of TS files. The QM file format is a compact binary format
that is used by the localized application. It provides extremely
- fast lookups for translations. The \c .ts files \l lrelease
+ fast lookups for translations. The TS files \l lrelease
processes can be specified at the command line, or given
indirectly by a Qt \c .pro project file.
This tool is run whenever a release of the application is to be
made, from initial test version through to final release
- version. If the \c .qm files are not created, e.g. because an
+ version. If the QM files are not created, e.g. because an
alpha release is required before any translation has been
undertaken, the application will run perfectly well using the text
- the programmers placed in the source files. Once the \c .qm files
+ the programmers placed in the source files. Once the QM files
are available the application will detect them and use them
automatically.
@@ -293,7 +293,7 @@
\section1 Missing Translations
- Both \l lupdate and \l lrelease may be used with \c .ts
+ Both \l lupdate and \l lrelease may be used with TS
translation source files which are incomplete. Missing
translations will be replaced with the native language phrases at
runtime.
@@ -317,8 +317,8 @@
from the taskbar menu, or by double clicking the desktop icon, or
by entering the command \c {linguist} at the command line. Once
\QL has started, choose \menu{File|Open} from the \l{menubar}
- {menu bar} and select a translation source (\c{.ts} file) to
- load. If you don't have a \c{.ts} file, see the \l {Qt Linguist
+ {menu bar} and select a translation source (TS file) to
+ load. If you do not have a TS file, see the \l {Qt Linguist
Manual: Release Manager} {release manager manual} to learn how to
generate one.
@@ -928,12 +928,12 @@
\image linguist-previewtool.png
- Forms created by \e{Qt Designer} are stored in special \c .ui files.
- \QL can make use of these \c .ui files to show the translations
- done so far on the form itself. This of course requires access to the \c .ui
+ Forms created by \e{Qt Designer} are stored in special UI files.
+ \QL can make use of these UI files to show the translations
+ done so far on the form itself. This of course requires access to the UI
files during the translation process. Activate
\menu{Tools|Open/Refresh Form Preview} to open the window shown above.
- The list of \c .ui files \QL has detected are displayed in the Forms
+ The list of UI files \QL has detected are displayed in the Forms
List on the left hand. If the path to the files has changed, you can load
the files manually via \menu{File|Open Form...}. Double-click on an entry
in the Forms List to display the Form File. Select \e{<No Translation>} from
@@ -947,15 +947,15 @@
\QL makes use of four kinds of files:
\list
- \o \c .ts \e {translation source files} \BR are human-readable XML
+ \o TS \e {translation source files} \BR are human-readable XML
files containing source phrases and their translations. These files are
usually created and updated by \l lupdate and are specific to an
application.
\o \c .xlf \e {XLIFF files} \BR are human-readable XML files that adhere
to the international XML Localization Interchange File Format. \QL
can be used to edit XLIFF files generated by other programs. For standard
- Qt projects, however, only the \c .ts file format is used.
- \o \c .qm \e {Qt message files} \BR are binary files that contain
+ Qt projects, however, only the TS file format is used.
+ \o QM \e {Qt message files} \BR are binary files that contain
translations used by an application at runtime. These files are
generated by \l lrelease, but can also be generated by \QL.
\o \c .qph \e {Qt phrase book files} \BR are human-readable XML
@@ -974,18 +974,18 @@
\list
\o \gui {Open... Ctrl+O} \BR pops up an open file dialog from which a
translation source \c .ts or \c .xlf file can be chosen.
- \o \gui {Recently opened files} \BR shows the \c .ts files that
+ \o \gui {Recently opened files} \BR shows the TS files that
have been opened recently, click one to open it.
\o \gui {Save Ctrl+S} \BR saves the current translation source file.
\o \gui {Save As...} \BR pops up a save as file dialog so that the
current translation source file may be saved with a different
name, format and/or put in a different location.
- \o \gui {Release} \BR create a Qt message \c .qm file with the same base
+ \o \gui {Release} \BR create a Qt message QM file with the same base
name as the current translation source file. The release manager's
command line tool \l lrelease performs the same function on
\e all of an application's translation source files.
\o \gui {Release As...} \BR pops up a save as file dialog. The
- filename entered will be a Qt message \c .qm file of the translation
+ filename entered will be a Qt message QM file of the translation
based on the current translation source file. The release manager's
command line tool \l lrelease performs the same function on
\e all of an application's translation source files.
@@ -1136,16 +1136,15 @@
\list
\o \inlineimage linguist-fileopen.png
\BR
- Pops up the open file dialog to open a new translation source \c .ts
- file.
+ Pops up the open file dialog to open a new translation source TS file.
\o \inlineimage linguist-filesave.png
\BR
- Saves the current translation source \c .ts file.
+ Saves the current translation source TS file.
\o \inlineimage linguist-fileprint.png
\BR
- Prints the current translation source \c .ts file.
+ Prints the current translation source TS file.
\o \inlineimage linguist-phrasebookopen.png
\BR
@@ -1263,10 +1262,10 @@
Translation files are created as follows:
\list 1
- \o Run \l lupdate initially to generate the first set of \c .ts
+ \o Run \l lupdate initially to generate the first set of TS
translation source files with all the user-visible text but no
translations.
- \o The \c .ts files are given to the translator who adds translations
+ \o The TS files are given to the translator who adds translations
using \QL. \QL takes care of any changed
or deleted source text.
\o Run \l lupdate to incorporate any new text added to the
@@ -1274,7 +1273,7 @@
application with the translations; it does not destroy any data.
\o Steps 2 and 3 are repeated as often as necessary.
\o When a release of the application is needed \l lrelease is run to
- read the \c .ts files and produce the \c .qm files used by the
+ read the TS files and produce the QM files used by the
application at runtime.
\endlist
@@ -1319,7 +1318,7 @@
In production applications a more flexible approach, for example,
loading translations according to locale, might be more appropriate. If
- the \c .ts files are all named according to a convention such as
+ the TS files are all named according to a convention such as
\e appname_locale, e.g. \c tt2_fr, \c tt2_de etc, then the
code above will load the current locale's translation at runtime.
@@ -1413,7 +1412,7 @@
To handle plural forms in the native language, you need to load a
translation file for this language, too. \l lupdate has the
\c -pluralonly command line option, which allows the creation of
- \c .ts files containing only entries with plural forms.
+ TS files containing only entries with plural forms.
See the \l{http://doc.trolltech.com/qq/}{Qt Quarterly} Article
\l{http://doc.trolltech.com/qq/qq19-plurals.html}{Plural Forms in Translations}
@@ -1503,7 +1502,7 @@
\contentspage {Qt Linguist Manual}{Contents}
\previouspage Qt Linguist Manual: Programmers
- The \c .ts file format used by \QL is described by the
+ The TS file format used by \QL is described by the
\l{http://www.w3.org/TR/1998/REC-xml-19980210}{DTD} presented below,
which we include for your convenience. Be aware that the format
may change in future Qt releases.
diff --git a/src/gui/embedded/qkbdyopy_qws.h b/doc/src/obsoleteclasses.qdoc
index b4e45bd..3658dfc 100644
--- a/src/gui/embedded/qkbdyopy_qws.h
+++ b/doc/src/obsoleteclasses.qdoc
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,35 +39,21 @@
**
****************************************************************************/
-#ifndef QKBDYOPY_QWS_H
-#define QKBDYOPY_QWS_H
+/*!
+ \page obsoleteclasses.html
+ \group obsolete
+ \title Obsolete Classes
+ \ingroup classlists
+ \ingroup groups
-#include <QtGui/qkbd_qws.h>
+ \brief Qt classes that are obsolete (deprecated).
-QT_BEGIN_HEADER
+ This is a list of Qt classes that are obsolete (deprecated). These
+ classes are provided to keep old source code working but they are
+ no longer maintained. We strongly advise against using these
+ classes in new code.
-QT_BEGIN_NAMESPACE
+ \generatelist obsoleteclasses
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KBD_YOPY
-
-class QWSYopyKbPrivate;
-
-class QWSYopyKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- explicit QWSYopyKeyboardHandler(const QString&);
- virtual ~QWSYopyKeyboardHandler();
-
-private:
- QWSYopyKbPrivate *d;
-};
-
-#endif // QT_NO_QWS_KBD_YOPY
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDYOPY_QWS_H
+ \sa {Qt's Classes}, {Qt's Modules}
+*/
diff --git a/doc/src/porting4-canvas.qdoc b/doc/src/porting4-canvas.qdoc
index fa0bc6b..d1221cf 100644
--- a/doc/src/porting4-canvas.qdoc
+++ b/doc/src/porting4-canvas.qdoc
@@ -43,7 +43,7 @@
\page graphicsview-porting.html
\title Porting to Graphics View
\contentspage {Porting Guides}{Contents}
- \previouspage Porting .ui Files to Qt 4
+ \previouspage Porting UI Files to Qt 4
\nextpage qt3to4 - The Qt 3 to 4 Porting Tool
\ingroup porting
\ingroup multimedia
diff --git a/doc/src/porting4-designer.qdoc b/doc/src/porting4-designer.qdoc
index 916894b..7de1d43 100644
--- a/doc/src/porting4-designer.qdoc
+++ b/doc/src/porting4-designer.qdoc
@@ -41,12 +41,12 @@
/*!
\page porting4-designer.html
- \title Porting .ui Files to Qt 4
+ \title Porting UI Files to Qt 4
\contentspage {Porting Guides}{Contents}
\previouspage Porting to Qt 4 - Drag and Drop
\nextpage Porting to Graphics View
\ingroup porting
- \brief Information about changes to the .ui file format in Qt 4.
+ \brief Information about changes to the UI file format in Qt 4.
Qt Designer has changed significantly in the Qt 4 release. We
have moved away from viewing Qt Designer as an IDE and
@@ -57,20 +57,20 @@
IDEs.
The most important changes in Qt Designer 4 which affect porting
- for \c .ui files are summarized below:
+ for UI files are summarized below:
\list
\o \bold{Removed project manager.}
- Qt Designer now only reads and edits \c .ui
- files. It has no notion of a project (\c .pro file).
+ Qt Designer now only reads and edits UI
+ files. It has no notion of a project file (\c .pro).
\o \bold{Removed code editor.}
Qt Designer can no longer be used to edit source files.
- \o \bold{Changed format of \c .ui files.}
+ \o \bold{Changed format of UI files.}
Qt Designer 4 cannot read files created by Qt Designer 3 and
vice versa. However, we provide the tool \c uic3 to generate Qt
- 4 code out of Qt 3 \c .ui files, and to convert old \c .ui files
+ 4 code out of Qt 3 UI files, and to convert old UI files
into a format readable by Qt Designer 4.
\o \bold{Changed structure of the code generated by \c uic.}
@@ -80,7 +80,7 @@
\c Ui::MyForm.
\o \bold{New resource file system.} Icon data is no longer
- stored in the \c .ui file. Instead, icons are put into resource
+ stored in the UI file. Instead, icons are put into resource
files (\c .qrc).
\endlist
@@ -146,9 +146,9 @@
therefore has an interface identical to that of a class generated
by \c uic in Qt 3.
- Creating POD classes from \c .ui files is more flexible and
+ Creating POD classes from UI files is more flexible and
generic than the old approach of creating widgets. Qt Designer
- doesn't need to know anything about the main container apart from
+ does not need to know anything about the main container apart from
the base widget class it inherits. Indeed, \c Ui::HelloWorld can
be used to populate any container that inherits QWidget.
Conversely, all non-GUI aspects of the main container may be
@@ -163,10 +163,10 @@
\list 1
\o To generate headers and source code for a widget to implement any
custom signals and slots added using Qt Designer 3.
- \o To generate a new \c .ui file that can be used with Qt Designer 4.
+ \o To generate a new UI file that can be used with Qt Designer 4.
\endlist
- You can use both these methods in combination to obtain \c{.ui}, header
+ You can use both these methods in combination to obtain UI, header
and source files that you can use as a starting point when porting
your user interface to Qt 4.
@@ -179,7 +179,7 @@
The resulting files \c myform.h and \c myform.cpp implement the
form in Qt 4 using a QWidget that will include custom signals,
- slots and connections specified in the \c .ui file. However,
+ slots and connections specified in the UI file. However,
see below for the \l{#Limitations of uic3}{limitations} of this
method.
@@ -190,7 +190,7 @@
The resulting file \c myform4.ui can be edited in Qt Designer 4. The
header file for the form is generated by Qt 4's \c uic. See the
- \l{Using a Designer .ui File in Your Application} chapter of the
+ \l{Using a Designer UI File in Your Application} chapter of the
\l{Qt Designer Manual} for information about the preferred ways to
use forms created with Qt Designer 4.
@@ -218,7 +218,7 @@
\section1 Limitations of uic3
- Converting Qt 3 \c .ui files to Qt 4 has some limitations. The
+ Converting Qt 3 UI files to Qt 4 has some limitations. The
most noticeable limitation is the fact that since \c uic no
longer generates a QObject, it's not possible to define custom
signals or slots for the form. Instead, the programmer must
@@ -231,9 +231,9 @@
A quick and dirty way to port forms containing custom signals and
slots is to generate the code using \c uic3, rather than \c uic. Since
\c uic3 does generate a QWidget, it will populate it with custom
- signals, slots and connections specified in the \c .ui file.
- However, \c uic3 can only generate code from Qt 3 \c .ui files, which
- implies that the \c .ui files never get translated and need to be
+ signals, slots and connections specified in the UI file.
+ However, \c uic3 can only generate code from Qt 3 UI files, which
+ implies that the UI files never get translated and need to be
edited using Qt Designer 3.
Note also that it is possible to create implicit connections
@@ -256,7 +256,7 @@
\section1 Icons
In Qt 3, the binary data for the icons used by a form was stored
- in the \c .ui file. In Qt 4 icons and any other external files
+ in the UI file. In Qt 4 icons and any other external files
can be compiled into the application by listing them in a \l{The
Qt Resource System}{resource file} (\c .qrc). This file is
translated into a C++ source file using Qt's resource compiler
@@ -306,7 +306,7 @@
the following steps:
\list 1
- \o Use \c{uic3 -convert} to obtain a \c .ui file understood by
+ \o Use \c{uic3 -convert} to obtain a UI file understood by
Qt Designer 4.
\o Create a \c .qrc file with a list of all the icon files.
diff --git a/doc/src/porting4-overview.qdoc b/doc/src/porting4-overview.qdoc
index d91729d..3494c6d 100644
--- a/doc/src/porting4-overview.qdoc
+++ b/doc/src/porting4-overview.qdoc
@@ -115,13 +115,13 @@
support these project-level features.
We recommend using one of the
- \l{Using a Designer .ui File in Your Application}{form subclassing approaches}
+ \l{Using a Designer UI File in Your Application}{form subclassing approaches}
with forms created using Qt Designer. This avoids the need
to use \c{.ui.h} files and special purpose code editors.
Existing Qt 3 forms created using Qt Designer can be gradually
ported to Qt 4 by following the advice in the
- \l{Porting .ui Files to Qt 4} guide. However, some extra effort
+ \l{Porting UI Files to Qt 4} guide. However, some extra effort
will be required to move application logic from \c{.ui.h} files
into the main body of a Qt 4 application.
diff --git a/doc/src/porting4.qdoc b/doc/src/porting4.qdoc
index 7ce2969..2414c4d 100644
--- a/doc/src/porting4.qdoc
+++ b/doc/src/porting4.qdoc
@@ -97,7 +97,7 @@
to developers porting from Qt 3 to Qt 4.
\o \l{Porting to Qt 4 - Drag and Drop} \mdash covers differences in the
way drag and drop is handled between Qt 3 and Qt 4.
- \o \l{Porting .ui Files to Qt 4} \mdash describes the new format used to
+ \o \l{Porting UI Files to Qt 4} \mdash describes the new format used to
describe forms created with \QD.
\o \l{Porting to Graphics View} \mdash provides a class-by-class overview
of the differences between Qt 3's canvas API and Qt 4's Graphics
@@ -135,7 +135,7 @@
\o Run the \l qt3to4 porting tool. The tool will go through your
source code and adapt it to Qt 4.
- \o Follow the instructions in the \l{Porting .ui Files to Qt 4}
+ \o Follow the instructions in the \l{Porting UI Files to Qt 4}
page to port Qt Designer files.
\o Recompile with Qt 4. For each error, search below for related
@@ -347,7 +347,7 @@
macro, removing the need for a \c Q_OVERRIDE() macro.
The table below lists the Qt properties that have been renamed in
- Qt 4. Occurrences of these in \e{Qt Designer} \c .ui files are
+ Qt 4. Occurrences of these in \e{Qt Designer} UI files are
automatically converted to the new name by \c uic.
\table
@@ -406,11 +406,11 @@
Some properties have been removed from Qt 4, but the associated
access functions are provided if \c QT3_SUPPORT is defined to help
- porting to Qt 4. When converting Qt 3 \c .ui files to Qt 4, \c uic
+ porting to Qt 4. When converting Qt 3 UI files to Qt 4, \c uic
generates calls to the Qt 3 compatibility functions. Note that
this only applies to the properties of the Qt3Support library,
i.e. \c QT3_SUPPORT properties of the other libraries must be
- ported manually when converting Qt 3 .ui files to Qt 4.
+ ported manually when converting Qt 3 UI files to Qt 4.
The table below lists these properties with the read and write
functions that you can use instead. The documentation for the
@@ -518,7 +518,7 @@
(Notice the \c & in the parameter declaration.)
\omit
- \section1 Qt Designer .ui Files
+ \section1 Qt Designer UI Files
###
\endomit
diff --git a/doc/src/qdesktopwidget.qdoc b/doc/src/qdesktopwidget.qdoc
index 1158904..56a882d 100644
--- a/doc/src/qdesktopwidget.qdoc
+++ b/doc/src/qdesktopwidget.qdoc
@@ -54,9 +54,9 @@
Systems with more than one graphics card and monitor can manage the
physical screen space available either as multiple desktops, or as a
large virtual desktop, which usually has the size of the bounding
- rectangle of all the screens (see isVirtualDesktop()). For an
+ rectangle of all the screens (see virtualDesktop). For an
application, one of the available screens is the primary screen, i.e.
- the screen where the main widget resides (see primaryScreen()). All
+ the screen where the main widget resides (see primaryScreen). All
windows opened in the context of the application should be
constrained to the boundaries of the primary screen; for example,
it would be inconvenient if a dialog box popped up on a different
@@ -64,16 +64,16 @@
The QDesktopWidget provides information about the geometry of the
available screens with screenGeometry(). The number of screens
- available is returned by numScreens(). The screen number that a
- particular point or widget is located in is returned by
- screenNumber().
+ available is returned by screenCount, and the screenCountChanged
+ signal is emitted when screens are added or removed during runtime.
+ The screen number that a particular point or widget is located in
+ is returned by screenNumber().
Widgets provided by Qt use this class, for example, to place
tooltips, menus and dialog boxes according to the parent or
- application widget.
-
- Applications can use this class to save window positions, or to place
- child widgets on one screen.
+ application widget. Applications can use this class to save window
+ positions, or to place child widgets and dialogs on one particular
+ screen.
\img qdesktopwidget.png Managing Multiple Screens
@@ -115,30 +115,15 @@
*/
/*!
- \fn bool QDesktopWidget::isVirtualDesktop() const
-
- Returns true if the system manages the available screens in a
- virtual desktop; otherwise returns false.
-
- For virtual desktops, screen() will always return the same widget.
- The size of the virtual desktop is the size of this desktop
- widget.
-*/
-
-/*!
- \fn int QDesktopWidget::primaryScreen() const
-
- Returns the index of the primary screen.
-
- \sa numScreens()
-*/
-
-/*!
\fn int QDesktopWidget::numScreens() const
-
+
Returns the number of available screens.
+
+ \obsolete
+
+ This function is deprecated. Use screenCount instead.
- \sa primaryScreen()
+ \sa primaryScreen
*/
/*!
@@ -146,13 +131,12 @@
Returns a widget that represents the screen with index \a screen
(a value of -1 means the default screen).
-
If the system uses a virtual desktop, the returned widget will
have the geometry of the entire virtual desktop; i.e., bounding
every \a screen.
- \sa primaryScreen(), numScreens(), isVirtualDesktop()
+ \sa primaryScreen, screenCount, virtualDesktop
*/
/*!
@@ -216,7 +200,7 @@
Returns the index of the screen that contains the largest
part of \a widget, or -1 if the widget not on a screen.
- \sa primaryScreen()
+ \sa primaryScreen
*/
/*!
@@ -226,7 +210,7 @@
Returns the index of the screen that contains the \a point, or the
screen which is the shortest distance from the \a point.
- \sa primaryScreen()
+ \sa primaryScreen
*/
/*!
@@ -245,3 +229,38 @@
This signal is emitted when the work area available on \a screen changes.
*/
+
+/*!
+ \property QDesktopWidget::screenCount
+ \brief the number of screens currently available on the system.
+
+ \since 4.6
+
+ \sa screenCountChanged()
+*/
+
+/*!
+ \property QDesktopWidget::primaryScreen
+ \brief the index of the screen that is configured to be the primary screen
+ on the system.
+*/
+
+/*!
+ \property QDesktopWidget::virtualDesktop
+
+ \brief if the system manages the available screens in a virtual desktop.
+
+ For virtual desktops, screen() will always return the same widget.
+ The size of the virtual desktop is the size of this desktop
+ widget.
+*/
+
+/*!
+ \fn void QDesktopWidget::screenCountChanged(int newCount)
+
+ \since 4.6
+
+ This signal is emitted when the number of screens changes to \a newCount.
+
+ \sa screenCount
+*/
diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc
index 68f1976..2985b89 100644
--- a/doc/src/qmake-manual.qdoc
+++ b/doc/src/qmake-manual.qdoc
@@ -235,7 +235,7 @@
\row \o CONFIG \o General project configuration options.
\row \o DESTDIR \o The directory in which the executable or binary file will
be placed.
- \row \o FORMS \o A list of .ui files to be processed by \c uic.
+ \row \o FORMS \o A list of UI files to be processed by \c uic.
\row \o HEADERS \o A list of filenames of header (.h) files used when
building the project.
\row \o QT \o Qt-specific configuration options.
@@ -701,8 +701,8 @@
If a directory is specified, it will be included in the \c DEPENDPATH
variable, and relevant code from there will be included in the generated
project file. If a file is given, it will be appended to the correct
- variable, depending on its extension; for example, .ui files are added
- to \c FORMS, and .cpp files are added to \c SOURCES.
+ variable, depending on its extension; for example, UI files are added
+ to \c FORMS, and C++ files are added to \c SOURCES.
You may also pass assignments on the command line in this mode. When doing
so, these assignments will be placed last in the generated project file.
@@ -829,6 +829,29 @@
Note that, if a project is later moved on the disk, \c qmake must be run
again to process the project file and create a new Xcode project file.
+ \section2 On supporting two build targets simultaneously
+
+ Implementing this is currently not feasible, because the XCode
+ concept of Active Build Configurations is conceptually different
+ from the qmake idea of build targets.
+
+ The XCode Active Build Configurations settings are for modifying
+ xcode configurations, compiler flags and similar build
+ options. Unlike Visual Studio, XCode does not allow for the
+ selection of specific library files based on whether debug or
+ release build configurations are selected. The qmake debug and
+ release settings control which library files are linked to the
+ executable.
+
+ It is currently not possible to set files in XCode configuration
+ settings from the qmake generated xcode project file. The way the
+ libraries are linked in the "Frameworks & Libraries" phase in the
+ XCode build system.
+
+ Furthermore, The selected "Active Build Configuration" is stored
+ in a .pbxuser file, which is generated by xcode on first load, not
+ created by qmake.
+
\section1 Windows
Features specific to this platform include support for creating Visual
@@ -1146,8 +1169,9 @@
(see \l{LibDepend}{Library Dependencies} for more info).
\endtable
- Please note that \c create_prl is required when \i {building} a static library,
- while \c link_prl is required when \i {using} a static library.
+ Please note that \c create_prl is required when \e {building} a
+ static library, while \c link_prl is required when \e {using} a
+ static library.
On Windows (or if Qt is configured with \c{-debug_and_release}, adding the
\c build_all option to the \c CONFIG variable makes this rule the default
@@ -1443,10 +1467,10 @@
\target FORMS
\section1 FORMS
- This variable specifies the .ui files (see \link
+ This variable specifies the UI files (see \link
designer-manual.html Qt Designer \endlink) to be processed through \c uic
before compiling. All dependencies, headers and source files required
- to build these .ui files will automatically be added to the project.
+ to build these UI files will automatically be added to the project.
For example:
@@ -1459,10 +1483,10 @@
\target FORMS3
\section1 FORMS3
- This variable specifies the old style .ui files to be processed
+ This variable specifies the old style UI files to be processed
through \c uic3 before compiling, when \c CONFIG contains uic3.
All dependencies, headers and source files required to build these
- .ui files will automatically be added to the project.
+ UI files will automatically be added to the project.
For example:
@@ -4507,7 +4531,7 @@
\list
\o HEADERS - A list of all the header files for the application.
\o SOURCES - A list of all the source files for the application.
- \o FORMS - A list of all the .ui files (created using \c{Qt Designer})
+ \o FORMS - A list of all the UI files (created using \c{Qt Designer})
for the application.
\o LEXSOURCES - A list of all the lex source files for the application.
\o YACCSOURCES - A list of all the yacc source files for the application.
@@ -4525,7 +4549,7 @@
\endlist
You only need to use the system variables that you have values for,
- for instance, if you don't have any extra INCLUDEPATHs then you don't
+ for instance, if you do not have any extra INCLUDEPATHs then you do not
need to specify any, \c qmake will add in the default ones needed.
For instance, an example project file might look like this:
diff --git a/doc/src/qmsdev.qdoc b/doc/src/qmsdev.qdoc
index b8d8f85..127b514 100644
--- a/doc/src/qmsdev.qdoc
+++ b/doc/src/qmsdev.qdoc
@@ -87,7 +87,7 @@
the existing project.
If you want to add an existing dialog to your project, then just select the
- relevant \c .ui file. This will then add it to your existing project and add
+ relevant UI file. This will then add it to your existing project and add
the relevant steps to create the generated code.
\section2 Using the 'Qt Designer' button
diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc
index eb7d626..afee5a2 100644
--- a/doc/src/qnamespace.qdoc
+++ b/doc/src/qnamespace.qdoc
@@ -41,6 +41,7 @@
/*!
\namespace Qt
+ \inmodule QtCore
\brief The Qt namespace contains miscellaneous identifiers
used throughout the Qt library.
@@ -1208,6 +1209,9 @@
handle touch events. Without this attribute set, events from a
touch device will be sent as mouse events.
+ \value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single
+ touch events to be sent to the widget.
+
\omitvalue WA_SetLayoutDirection
\omitvalue WA_InputMethodTransparent
\omitvalue WA_WState_CompressKeys
@@ -1243,8 +1247,9 @@
/*! \typedef Qt::HANDLE
Platform-specific handle type for system objects. This is
- equivalent to \c{void *} on Windows and Mac OS X, and embedded
- Linux, and to \c{unsigned long} on X11.
+ equivalent to \c{void *} on Mac OS X and embedded Linux,
+ and to \c{unsigned long} on X11. On Windows it is the
+ DWORD returned by the Win32 function getCurrentThreadId().
\warning Using this type is not portable.
*/
@@ -1692,6 +1697,7 @@
\value ToolButtonTextOnly Only display the text.
\value ToolButtonTextBesideIcon The text appears beside the icon.
\value ToolButtonTextUnderIcon The text appears under the icon.
+ \value ToolButtonFollowStyle Follow the \l{QStyle::SH_ToolButtonStyle}{style}.
*/
/*!
@@ -2729,20 +2735,6 @@
\internal
*/
-/*! \enum Qt::GestureType
- \since 4.6
-
- This enum lists standard gestures.
-
- \value UnknownGesture An unknown gesture. This enum value shouldn't be used.
- \value TapGesture A single tap gesture.
- \value DoubleTapGesture A double tap gesture.
- \value TrippleTapGesture A tripple tap gesture.
- \value TapAndHoldGesture A tap-and-hold (long tap) gesture.
- \value PanGesture A pan gesture.
- \value PinchGesture A pinch gesture.
-*/
-
/*!
\enum Qt::GestureState
\since 4.6
@@ -2751,30 +2743,8 @@
\omitvalue NoGesture
\value GestureStarted A continuous gesture has started.
- \value GestureUpdated A gesture continiues.
+ \value GestureUpdated A gesture continues.
\value GestureFinished A gesture has finished.
\sa QGesture
*/
-
-/*!
- \enum Qt::DirectionType
- \since 4.6
-
- This enum type describes directions. This could be used by the
- gesture recognizers.
-
- \value NoDirection Non-specific direction.
- \value LeftDownDirection
- \value DownLeftDirection
- \value DownDirection
- \value RightDownDirection
- \value DownRightDirection
- \value LeftDirection
- \value RightDirection
- \value LeftUpDirection
- \value UpLeftDirection
- \value UpDirection
- \value RightUpDirection
- \value UpRightDirection
-*/
diff --git a/doc/src/qsql.qdoc b/doc/src/qsql.qdoc
index 5315413..bb8f090 100644
--- a/doc/src/qsql.qdoc
+++ b/doc/src/qsql.qdoc
@@ -41,12 +41,13 @@
/*!
\namespace QSql
+ \inmodule QtSql
\brief The QSql namespace contains miscellaneous identifiers used throughout
the Qt SQL library.
+ \inheaderfile QtSql
\ingroup database
\mainclass
- \omit ### \module sql \endomit
\sa {QtSql Module}
*/
diff --git a/doc/src/qsqldatatype-table.qdoc b/doc/src/qsqldatatype-table.qdoc
index 5ab6413..2055e6a 100644
--- a/doc/src/qsqldatatype-table.qdoc
+++ b/doc/src/qsqldatatype-table.qdoc
@@ -34,36 +34,34 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
- \module QtSql
-
- \page qsqldatatype-table.html
-
- \title QtSql Module - Recommended use of data types
+ \page sql-types.html
+ \title QtSql Module - Recommended Use of Data Types
- \section1 Recommended use of types and widgets in Qt supported Databases
+ \section1 Recommended Use of Types in Qt Supported Databases
This table shows the recommended data types used when extracting data
from the databases supported in Qt. It is important to note that the
- types used in Qt not necessary are valid as input to the specific
- database. One example could be that a double would work perfect as
- input for floating point records in a database, but not necessary
- as output to the database since it would be stored with 64-bit in C++.
+ types used in Qt are not necessarily valid as input to the specific
+ database. One example could be that a double would work perfectly as
+ input for floating point records in a database, but not necessarily
+ as a storage format for output from the database since it would be stored
+ with 64-bit precision in C++.
\tableofcontents
- \section2 IBM DB2 data type
+ \section2 IBM DB2 Data Types
- \table
- \row
- \header IBM DB2 data type
- \header SQL Type Description
- \header Recommended input (C++ data type and Qt )
+ \table 90%
+ \header
+ \o IBM DB2 data type
+ \o SQL type description
+ \o Recommended input (C++ or Qt data type)
\row
\o SMALLINT
\o 16-bit signed integer
@@ -124,13 +122,13 @@
\o Mapped to QDateTime
\endtable
- \section2 Borland InterBase data type
+ \section2 Borland InterBase Data Types
- \table
- \row
- \header Borland InterBase data type
- \header SQL Type Description
- \header Recommended input (C++ data type/Qt Widget)
+ \table 90%
+ \header
+ \o Borland InterBase data type
+ \o SQL type description
+ \o Recommended input (C++ or Qt data type)
\row
\o BOOLEAN
\o Boolean
@@ -189,13 +187,13 @@
\o Mapped to QDateTime
\endtable
- \section2 MySQL data type
+ \section2 MySQL Data Types
- \table
- \row
- \header MySQL data type
- \header SQL Type Description
- \header Recommended input (C++ data type/Qt Widget)
+ \table 90%
+ \header
+ \o MySQL data type
+ \o SQL type description
+ \o Recommended input (C++ or Qt data type)
\row
\o TINYINT
\o 8 bit signed integer
@@ -290,13 +288,13 @@
\o Mapped to QString
\endtable
- \section2 Oracle Call Interface data type
+ \section2 Oracle Call Interface Data Types
- \table
- \row
- \header Oracle Call Interface data type
- \header SQL Type Description
- \header Recommended input (C++ data type/Qt Widget)
+ \table 90%
+ \header
+ \o Oracle Call Interface data type
+ \o SQL type description
+ \o Recommended input (C++ or Qt data type)
\row
\o NUMBER
\o FLOAT, DOUBLE, PRECISIONc REAL
@@ -338,13 +336,13 @@
\o Mapped to QDateTime
\endtable
- \section2 ODBC data type
+ \section2 ODBC Data Types
- \table
- \row
- \header ODBC data type
- \header SQL Type Description
- \header Recommended input (C++ data type/Qt Widget)
+ \table 90%
+ \header
+ \o ODBC data type
+ \o SQL type description
+ \o Recommended input (C++ or Qt data type)
\row
\o BIT
\o Boolean
@@ -407,13 +405,13 @@
\o Mapped to QDateTime
\endtable
- \section2 PostgreSQL data type
+ \section2 PostgreSQL Data Types
- \table
- \row
- \header PostgreSQL data type
- \header SQL Type Description
- \header Recommended input (C++ data type/Qt Widget)
+ \table 90%
+ \header
+ \o PostgreSQL data type
+ \o SQL type description
+ \o Recommended input (C++ or Qt data type)
\row
\o BOOLEAN
\o Boolean
@@ -484,13 +482,13 @@
\o Mapped to QDateTime
\endtable
- \section2 QSQLITE SQLite version 3 data type
+ \section2 QSQLITE SQLite version 3 Data Types
- \table
- \row
- \header QSQLITE SQLite version 3 data type
- \header SQL Type Description
- \header Recommended input (C++ data type/Qt Widget)
+ \table 90%
+ \header
+ \o QSQLITE SQLite version 3 data type
+ \o SQL type description
+ \o Recommended input (C++ or Qt data type)
\row
\o NULL
\o NULL value.
@@ -518,13 +516,13 @@
\o Mapped to QByteArray
\endtable
- \section2 Sybase Adaptive Server data type
+ \section2 Sybase Adaptive Server Data Types
- \table
- \row
- \header Sybase Adaptive Server data type
- \header SQL Type Description
- \header Recommended input (C++ data type/Qt Widget)
+ \table 90%
+ \header
+ \o Sybase Adaptive Server data type
+ \o SQL type description
+ \o Recommended input (C++ or Qt data type)
\row
\o BINARY
\o Describes a fixed-length binary value up to 255 bytes in size.
@@ -535,8 +533,7 @@
\o Mapped to QString
\row
\o DATETIME
- \o Date and time. Range: 1753-01-01 00:00:00 through
- 9999-12-31 23:59:59.
+ \o Date and time. Range: 1753-01-01 00:00:00 through 9999-12-31 23:59:59.
\o Mapped to QDateTime
\row
\o NCHAR
@@ -577,8 +574,8 @@
\endtable
\section2 SQLite Version 2
- SQLite V.2 is "typeless". This means that you can store any kind of
- data you want in any column of any table, regardless of the declared
- data type of that column. We recommend that you map the data to QString.
+ SQLite version 2 is "typeless". This means that you can store any kind of
+ data you want in any column of any table, regardless of the declared
+ data type of that column. We recommend that you map the data to QString.
*/
diff --git a/doc/src/qt3to4.qdoc b/doc/src/qt3to4.qdoc
index 9ffd52e..47e85b4 100644
--- a/doc/src/qt3to4.qdoc
+++ b/doc/src/qt3to4.qdoc
@@ -50,7 +50,7 @@
to Qt 4. It is designed to automate the most tedious part of the
porting effort.
- See \l{Porting to Qt 4} and \l{Porting .ui Files to Qt 4} for
+ See \l{Porting to Qt 4} and \l{Porting UI Files to Qt 4} for
more information about porting Qt 3 applications to Qt 4.
\section1 Usage
diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc
index 2fda7cf..6f59cae 100644
--- a/doc/src/qt4-intro.qdoc
+++ b/doc/src/qt4-intro.qdoc
@@ -235,7 +235,7 @@
for your project (using "DEFINES +=") on to moc, which has its own
built-in C++ preprocessor.
- To compile code that uses .ui files, you will also need this line in
+ To compile code that uses UI files, you will also need this line in
the .pro file:
\snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 2
diff --git a/doc/src/qtdesigner.qdoc b/doc/src/qtdesigner.qdoc
index 2117b27..d913b32 100644
--- a/doc/src/qtdesigner.qdoc
+++ b/doc/src/qtdesigner.qdoc
@@ -52,7 +52,7 @@
that enable you to access Qt Designer's components.
In addition, the QFormBuilder class provides the possibility of
- constructing user interfaces from \c .ui files at run-time.
+ constructing user interfaces from UI files at run-time.
To include the definitions of the module's classes, use the
following directive:
@@ -155,7 +155,7 @@
The \c QtDesigner module contains the QFormBuilder class that
provides a mechanism for dynamically creating user interfaces at
- run-time, based on \c .ui files created with \QD. This class is
+ run-time, based on UI files created with \QD. This class is
typically used by custom components and applications that embed
\QD. Standalone applications that need to dynamically generate
user interfaces at run-time use the QUiLoader class, found in
@@ -1427,7 +1427,7 @@
\fn bool QDesignerPropertySheetExtension::isAttribute(int index) const
Returns true if the property at the given \a index is an attribute,
- which will be \e excluded from the .ui file, otherwise false.
+ which will be \e excluded from the UI file, otherwise false.
\sa indexOf(), setAttribute()
*/
@@ -1436,7 +1436,7 @@
\fn void QDesignerPropertySheetExtension::setAttribute(int index, bool attribute)
If \a attribute is true, the property at the given \a index is
- made an attribute which will be \e excluded from the .ui file;
+ made an attribute which will be \e excluded from the UI file;
otherwise it will be included.
\sa indexOf(), isAttribute()
diff --git a/doc/src/qthelp.qdoc b/doc/src/qthelp.qdoc
index 7260b6e..92c9609 100644
--- a/doc/src/qthelp.qdoc
+++ b/doc/src/qthelp.qdoc
@@ -279,7 +279,7 @@
\section1 Qt Help Project File Format
- The file format is XML based. For a better understanding of
+ The file format is XML-based. For a better understanding of
the format we'll discuss the following example:
\snippet doc/src/snippets/code/doc_src_qthelp.qdoc 7
@@ -398,11 +398,13 @@
Finally, the actual documentation files have to be listed. Make sure
that all files neccessary to display the help are mentioned, i.e.
- stylesheets or similar files need to be there as well. The file, like all
+ stylesheets or similar files need to be there as well. The files, like all
file references in a Qt help project, are relative to the help project file
- itself. All listed files will be compressed and written to the Qt compressed
- help file. So, in the end, one single Qt help file contains all
- documentation files along with the contents and indices. \note The
- referenced files must be inside the same directory (or within a subdirectory)
- as the help project file. An absolute file path is not supported either.
+ itself. As the example shows, files (but not directories) can also be
+ specified as patterns using wildcards. All listed files will be compressed
+ and written to the Qt compressed help file. So, in the end, one single Qt
+ help file contains all documentation files along with the contents and
+ indices. \note The referenced files must be inside the same directory
+ (or within a subdirectory) as the help project file. An absolute file path
+ is not supported either.
*/
diff --git a/doc/src/qtscript.qdoc b/doc/src/qtscript.qdoc
index f2ac6c9..6b8f639 100644
--- a/doc/src/qtscript.qdoc
+++ b/doc/src/qtscript.qdoc
@@ -1782,20 +1782,20 @@
\list 1
\o Run \c lupdate to extract translatable text from the script source code
- of the Qt application, resulting in a message file for translators (a \c
- .ts file). The utility recognizes qsTr(), qsTranslate() and the
- \c{QT_TR*_NOOP()} functions described above and produces \c .ts files
+ of the Qt application, resulting in a message file for translators (a TS
+ file). The utility recognizes qsTr(), qsTranslate() and the
+ \c{QT_TR*_NOOP()} functions described above and produces TS files
(usually one per language).
- \o Provide translations for the source texts in the \c .ts file, using
- \e{Qt Linguist}. Since \c .ts files are in XML format, you can also
+ \o Provide translations for the source texts in the TS file, using
+ \e{Qt Linguist}. Since TS files are in XML format, you can also
edit them by hand.
- \o Run \c lrelease to obtain a light-weight message file (a \c .qm
- file) from the \c .ts file, suitable only for end use. Think of the \c
- .ts files as "source files", and \c .qm files as "object files". The
- translator edits the \c .ts files, but the users of your application
- only need the \c .qm files. Both kinds of files are platform and
+ \o Run \c lrelease to obtain a light-weight message file (a QM
+ file) from the TS file, suitable only for end use. Think of the TS
+ files as "source files", and QM files as "object files". The
+ translator edits the TS files, but the users of your application
+ only need the QM files. Both kinds of files are platform and
locale independent.
\endlist
@@ -1805,7 +1805,7 @@
translations from previous releases.
When running \c lupdate, you must specify the location of the script(s),
- and the name of the \c{.ts} file to produce. Examples:
+ and the name of the TS file to produce. Examples:
\snippet doc/src/snippets/code/doc_src_qtscript.qdoc 87
@@ -1823,7 +1823,7 @@
\snippet doc/src/snippets/code/doc_src_qtscript.qdoc 89
- When running \c lrelease, you must specify the name of the \c{.ts} input
+ When running \c lrelease, you must specify the name of the TS input
file; or, if you are using a qmake project file to manage script
translations, you specify the name of that file. \c lrelease will create
\c myscript_la.qm, the binary representation of the translation.
diff --git a/doc/src/qtuiloader.qdoc b/doc/src/qtuiloader.qdoc
index 137cfeb..0a23366 100644
--- a/doc/src/qtuiloader.qdoc
+++ b/doc/src/qtuiloader.qdoc
@@ -53,7 +53,7 @@
These forms are processed at run-time to produce dynamically-generated
user interfaces. In order to generate a form at run-time, a resource
- file containing a \c{.ui} file is needed. Applications that use the
+ file containing a UI file is needed. Applications that use the
form handling classes need to be configured to be built against the
QtUiTools module. This is done by including the following declaration
in a \c qmake project file to ensure that the application is compiled
diff --git a/doc/src/qtxmlpatterns.qdoc b/doc/src/qtxmlpatterns.qdoc
index 6b82c0d..9f8677b 100644
--- a/doc/src/qtxmlpatterns.qdoc
+++ b/doc/src/qtxmlpatterns.qdoc
@@ -839,6 +839,27 @@
with the \c fn:id() function. See
\l{http://www.w3.org/TR/xml-id/}{xml:id Version 1.0} for details.
+ \section2 XML Schema 1.0
+
+ The QtXmlPatterns implementation of XML Schema validation supports
+ the schema specification version 1.0 in large parts. Known problems
+ of the implementation and areas where conformancy may be questionable
+ are:
+
+ \list
+ \o Large \c minOccurs or \c maxOccurs values or deeply nested ones
+ require huge amount of memory which might cause the system to freeze.
+ Such a schema should be rewritten to use \c unbounded as value instead
+ of large numbers. This restriction will hopefully be fixed in a later release.
+ \o Comparison of really small or large floating point values might lead to
+ wrong results in some cases. However such numbers should not be relevant
+ for day-to-day usage.
+ \o Regular expression support is currently not conformant but follows
+ Qt's QRegExp standard syntax.
+ \o Identity constraint checks can not use the values of default or fixed
+ attribute definitions.
+ \endlist
+
\section2 Resource Loading
When QtXmlPatterns loads an XML resource, e.g., using the
@@ -884,6 +905,54 @@
URIs are first passed to QAbstractUriResolver. Check
QXmlQuery::setUriResolver() for possible rewrites.
+ \section1 License Information
+
+ The XML Schema implementation provided by this module contains the \c xml.xsd file
+ (located in \c{src/xmlpatterns/schema/schemas}) which is licensed under the terms
+ given below. This module is always built with XML Schema support enabled.
+
+ \legalese
+ W3C\copyright SOFTWARE NOTICE AND LICENSE
+
+ This license came from: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+ This work (and included software, documentation such as READMEs, or other
+ related items) is being provided by the copyright holders under the following
+ license. By obtaining, using and/or copying this work, you (the licensee)
+ agree that you have read, understood, and will comply with the following
+ terms and conditions.
+
+ Permission to copy, modify, and distribute this software and its
+ documentation, with or without modification, for any purpose and without
+ fee or royalty is hereby granted, provided that you include the following on
+ ALL copies of the software and documentation or portions thereof, including
+ modifications:
+
+ 1. The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.\br
+ 2. Any pre-existing intellectual property disclaimers, notices, or terms
+ and conditions. If none exist, the W3C Software Short Notice should be
+ included (hypertext is preferred, text is permitted)
+ within the body of any redistributed or derivative code.\br
+ 3. Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from
+ which the code is derived.)
+
+ THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
+ MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+ LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+ PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
+ ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+ COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
+ CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+ DOCUMENTATION.
+
+ The name and trademarks of copyright holders may NOT be used in
+ advertising or publicity pertaining to the software without specific, written
+ prior permission. Title to copyright in this software and any associated
+ documentation will at all times remain with copyright holders.
+ \endlegalese
*/
/*!
diff --git a/doc/src/richtext.qdoc b/doc/src/richtext.qdoc
index 1c76268..c43db0c 100644
--- a/doc/src/richtext.qdoc
+++ b/doc/src/richtext.qdoc
@@ -714,8 +714,8 @@ Ideas for other sections:
\previouspage Common Rich Text Editing Tasks
Qt's text widgets are able to display rich text, specified using a subset of \l{HTML 4}
- markup. Widgets that use QTextDocument, such as QLabel, QTextEdit, QTreeWidgetItem and
- the other item widgets, are able to display rich text specified in this way.
+ markup. Widgets that use QTextDocument, such as QLabel and QTextEdit, are able to display
+ rich text specified in this way.
\tableofcontents
diff --git a/doc/src/signalsandslots.qdoc b/doc/src/signalsandslots.qdoc
index 356db33..09eb0a6 100644
--- a/doc/src/signalsandslots.qdoc
+++ b/doc/src/signalsandslots.qdoc
@@ -190,7 +190,7 @@
know any information about each other. To enable this, the objects only
need to be connected together, and this can be achieved with some simple
QObject::connect() function calls, or with \c{uic}'s
- \l{Using a Designer .ui File in Your Application#Automatic Connections}
+ \l{Using a Designer UI File in Your Application#Automatic Connections}
{automatic connections} feature.
\section1 Building the Example
diff --git a/doc/src/snippets/code/doc_src_emb-charinput.qdoc b/doc/src/snippets/code/doc_src_emb-charinput.qdoc
index 2539e13..f6b33fe 100644
--- a/doc/src/snippets/code/doc_src_emb-charinput.qdoc
+++ b/doc/src/snippets/code/doc_src_emb-charinput.qdoc
@@ -4,7 +4,7 @@
//! [1]
-configure -qt-kbd-s15000
+configure -qt-kbd-linuxinput
//! [1]
diff --git a/doc/src/snippets/code/doc_src_linguist-manual.qdoc b/doc/src/snippets/code/doc_src_linguist-manual.qdoc
index ce3b997..5697300 100644
--- a/doc/src/snippets/code/doc_src_linguist-manual.qdoc
+++ b/doc/src/snippets/code/doc_src_linguist-manual.qdoc
@@ -42,7 +42,7 @@ Options:
-pluralonly
Only include plural form messages.
-silent
- Don't explain what is being done.
+ Do not explain what is being done.
-version
Display the version of lupdate and exit.
//! [4]
@@ -55,14 +55,14 @@ Usage:
Options:
-help Display this information and exit
-compress
- Compress the .qm files
+ Compress the QM files
-nounfinished
Do not include unfinished translations
-removeidentical
If the translated text is the same as
the source text, do not include the message
-silent
- Don't explain what is being done
+ Do not explain what is being done
-version
Display the version of lrelease and exit
//! [5]
diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc
index b93e151..753d560 100644
--- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc
+++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc
@@ -689,7 +689,7 @@ qmake -o Makefile hello.pro
//! [115]
-qmake -tp vc -o hello.dsp hello.pro
+qmake -tp vc hello.pro
//! [115]
diff --git a/doc/src/snippets/code/doc_src_qthelp.qdoc b/doc/src/snippets/code/doc_src_qthelp.qdoc
index 11d231f..949e2a5 100644
--- a/doc/src/snippets/code/doc_src_qthelp.qdoc
+++ b/doc/src/snippets/code/doc_src_qthelp.qdoc
@@ -92,8 +92,7 @@ if (links.count()) {
</keywords>
<files>
<file>classic.css</file>
- <file>index.html</file>
- <file>doc.html</file>
+ <file>*.html</file>
</files>
</filterSection>
</QtHelpProject>
@@ -154,8 +153,7 @@ if (links.count()) {
...
<files>
<file>classic.css</file>
- <file>index.html</file>
- <file>doc.html</file>
+ <file>*.html</file>
</files>
...
//! [13]
diff --git a/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
index 287181a..50052c3 100644
--- a/doc/src/snippets/code/src_corelib_global_qglobal.cpp
+++ b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
@@ -358,6 +358,30 @@ QString global_greeting(int type)
//! [36]
+//! [qttrid]
+ //% "%n fooish bar(s) found.\n"
+ //% "Do you want to continue?"
+ QString text = qtTrId("qtn_foo_bar", n);
+//! [qttrid]
+
+
+//! [qttrid_noop]
+static const char * const ids[] = {
+ //% "This is the first text."
+ QT_TRID_NOOP("qtn_1st_text"),
+ //% "This is the second text."
+ QT_TRID_NOOP("qtn_2nd_text"),
+ 0
+};
+
+void TheClass::addLabels()
+{
+ for (int i = 0; ids[i]; ++i)
+ new QLabel(qtTrId(ids[i]), this);
+}
+//! [qttrid_noop]
+
+
//! [37]
qWarning("%s: %s", qPrintable(key), qPrintable(value));
//! [37]
diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
index 5a7c5a7..5c0f80c 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
@@ -376,6 +376,15 @@ hostNameLabel->setText(tr("Name:"));
QString example = tr("Example");
//! [40]
+//! [meta data]
+//: This is a comment for the translator.
+//= qtn_foo_bar
+//~ loc-layout_id foo_dialog
+//~ loc-blank False
+//~ magic-stuff This might mean something magic.
+QString text = MyMagicClass::tr("Sim sala bim.");
+//! [meta data]
+
//! [explicit tr context]
QString text = QScrollBar::tr("Page up");
//! [explicit tr context]
diff --git a/doc/src/snippets/code/src_network_access_qnetworkreply.cpp b/doc/src/snippets/code/src_network_access_qnetworkreply.cpp
new file mode 100644
index 0000000..78b388b
--- /dev/null
+++ b/doc/src/snippets/code/src_network_access_qnetworkreply.cpp
@@ -0,0 +1,10 @@
+//! [0]
+QList<QSslCertificate> cert = QSslCertificate::fromPath(QLatin1String("server-certificate.pem"));
+QSslError error(QSslError::SelfSignedCertificate, cert.at(0));
+QList<QSslError> expectedSslErrors;
+expectedSslErrors.append(error);
+
+QNetworkReply *reply = manager.get(QNetworkRequest(QUrl("https://server.tld/index.html")));
+reply->ignoreSslErrors(expectedSslErrors);
+// here connect signals etc.
+//! [0]
diff --git a/doc/src/snippets/code/src_network_ssl_qsslsocket.cpp b/doc/src/snippets/code/src_network_ssl_qsslsocket.cpp
index afffbab..7845e9b 100644
--- a/doc/src/snippets/code/src_network_ssl_qsslsocket.cpp
+++ b/doc/src/snippets/code/src_network_ssl_qsslsocket.cpp
@@ -54,3 +54,14 @@ socket->connectToHostEncrypted("imap", 993);
if (socket->waitForEncrypted(1000))
qDebug("Encrypted!");
//! [5]
+
+//! [6]
+QList<QSslCertificate> cert = QSslCertificate::fromPath(QLatin1String("server-certificate.pem"));
+QSslError error(QSslError::SelfSignedCertificate, cert.at(0));
+QList<QSslError> expectedSslErrors;
+expectedSslErrors.append(error);
+
+QSslSocket socket;
+socket.ignoreSslErrors(expectedSslErrors);
+socket.connectToHostEncrypted("server.tld", 443);
+//! [6]
diff --git a/src/plugins/mousedrivers/linuxis/linuxismousedriverplugin.cpp b/doc/src/snippets/qxmlschema/main.cpp
index 4d530d9..e5989ee 100644
--- a/src/plugins/mousedrivers/linuxis/linuxismousedriverplugin.cpp
+++ b/doc/src/snippets/qxmlschema/main.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,45 +39,80 @@
**
****************************************************************************/
-#include "linuxismousedriverplugin.h"
-#include "linuxismousehandler.h"
+#include <QtCore>
+#include <QtXmlPatterns>
-#include <qdebug.h>
-#if 1
-#define qLog(x) qDebug()
-#else
-#define qLog(x) while (0) qDebug()
-#endif
-LinuxInputSubsystemMouseDriverPlugin::LinuxInputSubsystemMouseDriverPlugin( QObject *parent )
- : QMouseDriverPlugin( parent )
+class Schema
{
-}
+ public:
+ void loadFromUrl() const;
+ void loadFromFile() const;
+ void loadFromData() const;
+};
-LinuxInputSubsystemMouseDriverPlugin::~LinuxInputSubsystemMouseDriverPlugin()
+void Schema::loadFromUrl() const
{
+//! [0]
+ QUrl url("http://www.schema-example.org/myschema.xsd");
+
+ QXmlSchema schema;
+ if (schema.load(url) == true)
+ qDebug() << "schema is valid";
+ else
+ qDebug() << "schema is invalid";
+//! [0]
}
-QWSMouseHandler* LinuxInputSubsystemMouseDriverPlugin::create(const QString& driver, const QString& device)
+void Schema::loadFromFile() const
{
- if ( driver.toLower() == "linuxis" ) {
- qLog(Input) << "Before call LinuxInputSubsystemMouseHandler()";
- return new LinuxInputSubsystemMouseHandler(device);
- }
- return 0;
+//! [1]
+ QFile file("myschema.xsd");
+ file.open(QIODevice::ReadOnly);
+
+ QXmlSchema schema;
+ schema.load(&file, QUrl::fromLocalFile(file.fileName()));
+
+ if (schema.isValid())
+ qDebug() << "schema is valid";
+ else
+ qDebug() << "schema is invalid";
+//! [1]
}
-QWSMouseHandler* LinuxInputSubsystemMouseDriverPlugin::create(const QString& driver)
+void Schema::loadFromData() const
{
- if( driver.toLower() == "linuxis" ) {
- qLog(Input) << "Before call LinuxInputSubsystemMouseHandler()";
- return new LinuxInputSubsystemMouseHandler();
- }
- return 0;
+//! [2]
+ QByteArray data( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<xsd:schema"
+ " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
+ " xmlns=\"http://www.qtsoftware.com/xmlschematest\""
+ " targetNamespace=\"http://www.qtsoftware.com/xmlschematest\""
+ " version=\"1.0\""
+ " elementFormDefault=\"qualified\">"
+ "</xsd:schema>" );
+
+ QBuffer buffer(&data);
+ buffer.open(QIODevice::ReadOnly);
+
+ QXmlSchema schema;
+ schema.load(&buffer);
+
+ if (schema.isValid())
+ qDebug() << "schema is valid";
+ else
+ qDebug() << "schema is invalid";
+//! [2]
}
-QStringList LinuxInputSubsystemMouseDriverPlugin::keys() const
+int main(int argc, char **argv)
{
- return QStringList() << "linuxis";
-}
+ QCoreApplication app(argc, argv);
+
+ Schema schema;
-Q_EXPORT_PLUGIN2(qwslinuxismousehandler, LinuxInputSubsystemMouseDriverPlugin)
+ schema.loadFromUrl();
+ schema.loadFromFile();
+ schema.loadFromData();
+
+ return 0;
+}
diff --git a/doc/src/snippets/qxmlschema/qxmlschema.pro b/doc/src/snippets/qxmlschema/qxmlschema.pro
new file mode 100644
index 0000000..7e8782a
--- /dev/null
+++ b/doc/src/snippets/qxmlschema/qxmlschema.pro
@@ -0,0 +1,3 @@
+SOURCES += main.cpp
+
+QT += xmlpatterns
diff --git a/doc/src/snippets/qxmlschemavalidator/main.cpp b/doc/src/snippets/qxmlschemavalidator/main.cpp
new file mode 100644
index 0000000..581f40f
--- /dev/null
+++ b/doc/src/snippets/qxmlschemavalidator/main.cpp
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore>
+#include <QtXmlPatterns>
+
+class SchemaValidator
+{
+ public:
+ void validateFromUrl() const;
+ void validateFromFile() const;
+ void validateFromData() const;
+ void validateComplete() const;
+
+ private:
+ QXmlSchema getSchema() const;
+};
+
+void SchemaValidator::validateFromUrl() const
+{
+//! [0]
+ const QXmlSchema schema = getSchema();
+
+ const QUrl url("http://www.schema-example.org/test.xml");
+
+ QXmlSchemaValidator validator(schema);
+ if (validator.validate(url))
+ qDebug() << "instance document is valid";
+ else
+ qDebug() << "instance document is invalid";
+//! [0]
+}
+
+void SchemaValidator::validateFromFile() const
+{
+//! [1]
+ const QXmlSchema schema = getSchema();
+
+ QFile file("test.xml");
+ file.open(QIODevice::ReadOnly);
+
+ QXmlSchemaValidator validator(schema);
+ if (validator.validate(&file, QUrl::fromLocalFile(file.fileName())))
+ qDebug() << "instance document is valid";
+ else
+ qDebug() << "instance document is invalid";
+//! [1]
+}
+
+void SchemaValidator::validateFromData() const
+{
+//! [2]
+ const QXmlSchema schema = getSchema();
+
+ QByteArray data("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<test></test>");
+
+ QBuffer buffer(&data);
+ buffer.open(QIODevice::ReadOnly);
+
+ QXmlSchemaValidator validator(schema);
+ if (validator.validate(&buffer))
+ qDebug() << "instance document is valid";
+ else
+ qDebug() << "instance document is invalid";
+//! [2]
+}
+
+QXmlSchema SchemaValidator::getSchema() const
+{
+ QByteArray data("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<xsd:schema"
+ " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
+ " xmlns=\"http://www.qtsoftware.com/xmlschematest\""
+ " targetNamespace=\"http://www.qtsoftware.com/xmlschematest\""
+ " version=\"1.0\""
+ " elementFormDefault=\"qualified\">"
+ "</xsd:schema>");
+
+ QBuffer buffer(&data);
+ buffer.open(QIODevice::ReadOnly);
+
+ QXmlSchema schema;
+ schema.load(&buffer);
+
+ return schema;
+}
+
+void SchemaValidator::validateComplete() const
+{
+//! [3]
+ QUrl schemaUrl("file:///home/user/schema.xsd");
+
+ QXmlSchema schema;
+ schema.load(schemaUrl);
+
+ if (schema.isValid()) {
+ QFile file("test.xml");
+ file.open(QIODevice::ReadOnly);
+
+ QXmlSchemaValidator validator(schema);
+ if (validator.validate(&file, QUrl::fromLocalFile(file.fileName())))
+ qDebug() << "instance document is valid";
+ else
+ qDebug() << "instance document is invalid";
+ }
+//! [3]
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ SchemaValidator validator;
+
+ validator.validateFromUrl();
+ validator.validateFromFile();
+ validator.validateFromData();
+ validator.validateComplete();
+
+ return 0;
+}
diff --git a/doc/src/snippets/qxmlschemavalidator/qxmlschemavalidator.pro b/doc/src/snippets/qxmlschemavalidator/qxmlschemavalidator.pro
new file mode 100644
index 0000000..7e8782a
--- /dev/null
+++ b/doc/src/snippets/qxmlschemavalidator/qxmlschemavalidator.pro
@@ -0,0 +1,3 @@
+SOURCES += main.cpp
+
+QT += xmlpatterns
diff --git a/doc/src/snippets/snippets.pro b/doc/src/snippets/snippets.pro
index 50e33b3..e3e7eca 100644
--- a/doc/src/snippets/snippets.pro
+++ b/doc/src/snippets/snippets.pro
@@ -73,6 +73,8 @@ SUBDIRS = brush \
quiloader \
qx11embedcontainer \
qx11embedwidget \
+ qxmlschema \
+ qxmlschemavalidator \
reading-selections \
scribe-overview \
separations \
diff --git a/doc/src/snippets/statemachine/eventtest.cpp b/doc/src/snippets/statemachine/eventtest.cpp
new file mode 100644
index 0000000..e0f359a
--- /dev/null
+++ b/doc/src/snippets/statemachine/eventtest.cpp
@@ -0,0 +1,34 @@
+
+#include <QtGui>
+
+class MyTransition : public QAbstractTransition
+{
+ Q_OBJECT
+public:
+ MyTransition() {}
+
+protected:
+//![0]
+ bool eventTest(QEvent *event)
+ {
+ if (event->type() == QEvent::Wrapped) {
+ QEvent *wrappedEvent = static_cast<QWrappedEvent *>(event)->event();
+ if (wrappedEvent->type() == QEvent::KeyPress) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent);
+ // Do your event test
+ }
+ }
+ return false;
+ }
+//![0]
+
+ void onTransition(QEvent *event)
+ {
+
+ }
+};
+
+int main(int argv, char **args)
+{
+ return 0;
+}
diff --git a/doc/src/templates.qdoc b/doc/src/templates.qdoc
index 5a8acf7..8cfb851 100644
--- a/doc/src/templates.qdoc
+++ b/doc/src/templates.qdoc
@@ -162,7 +162,7 @@
without having to know the exact types of the objects we are connecting.
This is impossible with a template based solution. This kind of runtime
introspection opens up new possibilities, for example GUIs that are
- generated and connected from Qt Designer's XML \c{ui} files.
+ generated and connected from Qt Designer's XML UI files.
\section1 Calling Performance is Not Everything
diff --git a/doc/src/threads.qdoc b/doc/src/threads.qdoc
index c9d0904..8469f51 100644
--- a/doc/src/threads.qdoc
+++ b/doc/src/threads.qdoc
@@ -262,48 +262,41 @@
\keyword thread-safe
\section1 Reentrancy and Thread-Safety
- Throughout the Qt documentation, the terms \e reentrant and \e
- thread-safe are used to specify how a function can be used in
- multithreaded applications:
+ Throughout the documentation, the terms \e{reentrant} and
+ \e{thread-safe} are used to mark classes and functions to indicate
+ how they can be used in multithread applications:
\list
- \o A \e reentrant function can be called simultaneously by
- multiple threads provided that each invocation of the function
- references unique data.
- \o A \e thread-safe function can be called simultaneously by
- multiple threads when each invocation references shared data.
- All access to the shared data is serialized.
+ \o A \e thread-safe function can be called simultaneously from
+ multiple threads, even when the invocations use shared data,
+ because all references to the shared data are serialized.
+ \o A \e reentrant function can also be called simultaneously from
+ multiple threads, but only if each invocation uses its own data.
\endlist
- By extension, a class is said to be reentrant if each and every
- one of its functions can be called simultaneously by multiple
- threads on different instances of the class. Similarly, the class
- is said to be thread-safe if the functions can be called by
- different threads on the same instance.
+ Hence, a \e{thread-safe} function is always \e{reentrant}, but a
+ \e{reentrant} function is not always \e{thread-safe}.
- Classes in the documentation will be documented as thread-safe only
- if they are intended to be used by multiple threads.
+ By extension, a class is said to be \e{reentrant} if its member
+ functions can be called safely from multiple threads, as long as
+ each thread uses a \e{different} instance of the class. The class
+ is \e{thread-safe} if its member functions can be called safely
+ from multiple threads, even if all the threads use the \e{same}
+ instance of the class.
- Note that the terminology in this domain isn't entirely
- standardized. POSIX uses a somewhat different definition of
- reentrancy and thread-safety for its C APIs. When dealing with an
- object-oriented C++ class library such as Qt, the definitions
- must be adapted.
-
- Most C++ classes are inherently reentrant, since they typically
- only reference member data. Any thread can call such a member
- function on an instance of the class, as long as no other thread
- is calling a member function on the same instance. For example,
- the \c Counter class below is reentrant:
+ C++ classes are often reentrant, simply because they only access
+ their own member data. Any thread can call a member function on an
+ instance of a reentrant class, as long as no other thread can call
+ a member function on the \e{same} instance of the class at the
+ same time. For example, the \c Counter class below is reentrant:
\snippet doc/src/snippets/threads/threads.cpp 3
\snippet doc/src/snippets/threads/threads.cpp 4
The class isn't thread-safe, because if multiple threads try to
modify the data member \c n, the result is undefined. This is
- because C++'s \c ++ and \c -- operators aren't necessarily
- atomic. Indeed, they usually expand to three machine
- instructions:
+ because the \c ++ and \c -- operators aren't always atomic.
+ Indeed, they usually expand to three machine instructions:
\list 1
\o Load the variable's value in a register.
@@ -332,14 +325,27 @@
declared with the \c mutable qualifier because we need to lock
and unlock the mutex in \c value(), which is a const function.
- Most Qt classes are reentrant and not thread-safe, to avoid the
- overhead of repeatedly locking and unlocking a QMutex. For
- example, QString is reentrant, meaning that you can use it in
- different threads, but you can't access the same QString object
- from different threads simultaneously (unless you protect it with
- a mutex yourself). A few classes and functions are thread-safe;
- these are mainly thread-related classes such as QMutex, or
- fundamental functions such as QCoreApplication::postEvent().
+ Many Qt classes are \e{reentrant}, but they are not made
+ \e{thread-safe}, because making them thread-safe would incur the
+ extra overhead of repeatedly locking and unlocking a QMutex. For
+ example, QString is reentrant but not thread-safe. You can safely
+ access \e{different} instances of QString from multiple threads
+ simultaneously, but you can't safely access the \e{same} instance
+ of QString from multiple threads simultaneously (unless you
+ protect the accesses yourself with a QMutex).
+
+ Some Qt classes and functions are thread-safe. These are mainly
+ the thread-related classes (e.g. QMutex) and fundamental functions
+ (e.g. QCoreApplication::postEvent()).
+
+ \note Qt Classes are only documented as \e{thread-safe} if they
+ are intended to be used by multiple threads.
+
+ \note Terminology in the multithreading domain isn't entirely
+ standardized. POSIX uses definitions of reentrant and thread-safe
+ that are somewhat different for its C APIs. When using other
+ object-oriented C++ class libraries with Qt, be sure the
+ definitions are understood.
\section1 Threads and QObjects
@@ -428,20 +434,22 @@
an object and its children (the object cannot be moved if it has a
parent).
- Calling \c delete on a QObject from another thread than the
- thread where it is created (or accessing the object in other
- ways) is unsafe unless you can guarantee that the object isn't
- processing events at the same moment. Use QObject::deleteLater()
- instead; it will post a
- \l{QEvent::DeferredDelete}{DeferredDelete} event, which the
- event loop of the object's thread will eventually pick up.
+ Calling \c delete on a QObject from a thread other than the one
+ that \e owns the object (or accessing the object in other ways) is
+ unsafe, unless you guarantee that the object isn't processing
+ events at that moment. Use QObject::deleteLater() instead, and a
+ \l{QEvent::DeferredDelete}{DeferredDelete} event will be posted,
+ which the event loop of the object's thread will eventually pick
+ up. By default, the thread that \e owns a QObject is the thread
+ that \e creates the QObject, but not after QObject::moveToThread()
+ has been called.
If no event loop is running, events won't be delivered to the
- object. For example, if you create a QTimer object in a thread
- but never call \l{QThread::exec()}{exec()}, the QTimer will never emit its
- \l{QTimer::timeout()}{timeout()} signal. Calling
- \l{QObject::deleteLater()}{deleteLater()} won't work either. (These
- restrictions apply to the main thread as well.)
+ object. For example, if you create a QTimer object in a thread but
+ never call \l{QThread::exec()}{exec()}, the QTimer will never emit
+ its \l{QTimer::timeout()}{timeout()} signal. Calling
+ \l{QObject::deleteLater()}{deleteLater()} won't work
+ either. (These restrictions apply to the main thread as well.)
You can manually post events to any object in any thread at any
time using the thread-safe function
diff --git a/doc/src/trolltech-webpages.qdoc b/doc/src/trolltech-webpages.qdoc
index 7d48167..abbe4e0 100644
--- a/doc/src/trolltech-webpages.qdoc
+++ b/doc/src/trolltech-webpages.qdoc
@@ -165,11 +165,6 @@
*/
/*!
- \externalpage http://www.qtsoftware.com/developer/supported-platforms/supported-platforms/
- \title Qt 4 Supported Platforms
-*/
-
-/*!
\externalpage http://www.qtsoftware.com/products/qtopia/
\title Qt Extended
*/
@@ -243,3 +238,8 @@
\externalpage http://www.qtsoftware.com/developer/faqs/qt/installation
\title Installation FAQ
*/
+
+/*!
+ \externalpage http://qt.gitorious.org
+ \title Public Qt Repository
+*/
diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc
index 2f6cec2..95394eb 100644
--- a/doc/src/tutorials/addressbook.qdoc
+++ b/doc/src/tutorials/addressbook.qdoc
@@ -697,10 +697,11 @@
\snippet tutorials/addressbook/part5/finddialog.h FindDialog header
- We define a public function, \c getFindText() for use by classes that
- instantiate \c FindDialog, which allows them to obtain the text
- entered by the user. A public slot, \c findClicked(), is defined to
- handle the search string when the user clicks the \gui Find button.
+ We define a public function, \c getFindText(), to be used by classes that
+ instantiate \c FindDialog. This function allows these classes to obtain the
+ search string entered by the user. A public slot, \c findClicked(), is also
+ defined to handle the search string when the user clicks the \gui Find
+ button.
Lastly, we define the private variables, \c findButton, \c lineEdit
and \c findText, corresponding to the \gui Find button, the line edit
@@ -715,15 +716,15 @@
\snippet tutorials/addressbook/part5/finddialog.cpp constructor
- We set the layout and window title, as well as connect the signals
- to their respective slots. Notice that \c{findButton}'s
- \l{QPushButton::clicked()}{clicked()} signal is connected to to
- \c findClicked() and \l{QDialog::accept()}{accept()}. The
- \l{QDialog::accept()}{accept()} slot provided by QDialog hides
- the dialog and sets the result code to \l{QDialog::}{Accepted}.
- We use this function to help \c{AddressBook}'s \c findContact() function
- know when the \c FindDialog object has been closed. This will be
- further explained when discussing the \c findContact() function.
+ We set the layout and window title, as well as connect the signals to their
+ respective slots. Notice that \c{findButton}'s \l{QPushButton::clicked()}
+ {clicked()} signal is connected to to \c findClicked() and
+ \l{QDialog::accept()}{accept()}. The \l{QDialog::accept()}{accept()} slot
+ provided by QDialog hides the dialog and sets the result code to
+ \l{QDialog::}{Accepted}. We use this function to help \c{AddressBook}'s
+ \c findContact() function know when the \c FindDialog object has been
+ closed. We will explain this logic in further detail when discussing the
+ \c findContact() function.
\image addressbook-tutorial-part5-signals-and-slots.png
@@ -817,21 +818,23 @@
\image addressbook-tutorial-part6-screenshot.png
- Although browsing and searching for contacts are useful features, our address
- book is not really fully ready for use until we can saving existing contacts
- and load them again at a later time.
- Qt provides a number of classes for \l{Input/Output and Networking}{input and output},
- but we have chosen to use two which are simple to use in combination: QFile and
- QDataStream.
+ Although browsing and searching for contacts are useful features, our
+ address book is not ready for use until we can save existing contacts and
+ load them again at a later time.
- A QFile object represents a file on disk that can be read from and written to.
- QFile is a subclass of the more general QIODevice class which represents many
- different kinds of devices.
+ Qt provides a number of classes for \l{Input/Output and Networking}
+ {input and output}, but we have chosen to use two which are simple to use
+ in combination: QFile and QDataStream.
+
+ A QFile object represents a file on disk that can be read from and written
+ to. QFile is a subclass of the more general QIODevice class which
+ represents many different kinds of devices.
+
+ A QDataStream object is used to serialize binary data so that it can be
+ stored in a QIODevice and retrieved again later. Reading from a QIODevice
+ and writing to it is as simple as opening the stream - with the respective
+ device as a parameter - and reading from or writing to it.
- A QDataStream object is used to serialize binary data so that it can be stored
- in a QIODevice and retrieved again later. Reading from a QIODevice and writing
- to it is as simple as opening the stream - with the respective device as a
- parameter - and reading from or writing to it.
\section1 Defining the AddressBook Class
@@ -873,7 +876,7 @@
\image addressbook-tutorial-part6-save.png
- If \c fileName is not empty, we create a QFile object, \c file with
+ If \c fileName is not empty, we create a QFile object, \c file, with
\c fileName. QFile works with QDataStream as QFile is a QIODevice.
Next, we attempt to open the file in \l{QIODevice::}{WriteOnly} mode.
@@ -903,18 +906,18 @@
\image addressbook-tutorial-part6-load.png
If \c fileName is not empty, again, we use a QFile object, \c file, and
- attempt to open it in \l{QIODevice::}{ReadOnly} mode. In a similar way
- to our implementation of \c saveToFile(), if this attempt is unsuccessful,
- we display a QMessageBox to inform the user.
+ attempt to open it in \l{QIODevice::}{ReadOnly} mode. Similar to our
+ implementation of \c saveToFile(), if this attempt is unsuccessful, we
+ display a QMessageBox to inform the user.
\snippet tutorials/addressbook/part6/addressbook.cpp loadFromFile() function part2
Otherwise, we instantiate a QDataStream object, \c in, set its version as
above and read the serialized data into the \c contacts data structure.
- Note that we empty \c contacts before reading data into it to simplify the
- file reading process. A more advanced method would be to read the contacts
- into temporary QMap object, and copy only the contacts that do not already
- exist in \c contacts.
+ The \c contacts object is emptied before data is read into it to simplify
+ the file reading process. A more advanced method would be to read the
+ contacts into a temporary QMap object, and copy over non-duplicate contacts
+ into \c contacts.
\snippet tutorials/addressbook/part6/addressbook.cpp loadFromFile() function part3
diff --git a/examples/activeqt/dotnet/wrapper/lib/tools.cpp b/examples/activeqt/dotnet/wrapper/lib/tools.cpp
index 856b5c8..eac2d78 100644
--- a/examples/activeqt/dotnet/wrapper/lib/tools.cpp
+++ b/examples/activeqt/dotnet/wrapper/lib/tools.cpp
@@ -56,6 +56,6 @@ String *QStringToString(const QString &qstring)
QString StringToQString(String *string)
{
const wchar_t __pin *chars = PtrToStringChars(string);
- return QString::fromUtf16((const ushort *)chars);
+ return QString::fromWCharArray(chars);
}
//! [1]
diff --git a/examples/activeqt/webbrowser/main.cpp b/examples/activeqt/webbrowser/main.cpp
index ab14c0b..e83ef56 100644
--- a/examples/activeqt/webbrowser/main.cpp
+++ b/examples/activeqt/webbrowser/main.cpp
@@ -46,8 +46,8 @@
#include <QMainWindow>
#include <QAbstractEventDispatcher>
-#if defined(Q_OS_WINCE)
-#include "ui_wincemainwindow.h"
+#if defined(Q_WS_WINCE_WM)
+#include "ui_mainwindow_windowsmobile.h"
#include <windows.h>
#else
#include "ui_mainwindow.h"
diff --git a/examples/activeqt/webbrowser/wincemainwindow.ui b/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui
index 98a9ddb..98a9ddb 100644
--- a/examples/activeqt/webbrowser/wincemainwindow.ui
+++ b/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui
diff --git a/examples/activeqt/webbrowser/webbrowser.pro b/examples/activeqt/webbrowser/webbrowser.pro
index d6566cb6..c3e6e1e 100644
--- a/examples/activeqt/webbrowser/webbrowser.pro
+++ b/examples/activeqt/webbrowser/webbrowser.pro
@@ -7,7 +7,7 @@ QTDIR_build:REQUIRES = shared
HEADERS = webaxwidget.h
SOURCES = main.cpp
FORMS = mainwindow.ui
-wince*: FORMS = wincemainwindow.ui
+wincewm*: FORMS = mainwindow_windowsmobile.ui
# install
diff --git a/examples/animation/animatedtiles/main.cpp b/examples/animation/animatedtiles/main.cpp
index 9360d7c..c0d55f3 100644
--- a/examples/animation/animatedtiles/main.cpp
+++ b/examples/animation/animatedtiles/main.cpp
@@ -178,7 +178,7 @@ int main(int argc, char **argv)
QState *centeredState = new QState(rootState);
// Values
- for (int i = 0; i < 64; ++i) {
+ for (int i = 0; i < items.count(); ++i) {
Pixmap *item = items.at(i);
// Ellipse
ellipseState->assignProperty(item, "pos",
@@ -219,7 +219,7 @@ int main(int argc, char **argv)
rootState->setInitialState(centeredState);
QParallelAnimationGroup *group = new QParallelAnimationGroup;
- for (int i = 0; i < 64; ++i) {
+ for (int i = 0; i < items.count(); ++i) {
QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
anim->setDuration(750 + i * 25);
anim->setEasingCurve(QEasingCurve::InOutBack);
@@ -229,7 +229,7 @@ int main(int argc, char **argv)
trans->addAnimation(group);
group = new QParallelAnimationGroup;
- for (int i = 0; i < 64; ++i) {
+ for (int i = 0; i < items.count(); ++i) {
QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
anim->setDuration(750 + i * 25);
anim->setEasingCurve(QEasingCurve::InOutBack);
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
trans->addAnimation(group);
group = new QParallelAnimationGroup;
- for (int i = 0; i < 64; ++i) {
+ for (int i = 0; i < items.count(); ++i) {
QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
anim->setDuration(750 + i * 25);
anim->setEasingCurve(QEasingCurve::InOutBack);
@@ -249,7 +249,7 @@ int main(int argc, char **argv)
trans->addAnimation(group);
group = new QParallelAnimationGroup;
- for (int i = 0; i < 64; ++i) {
+ for (int i = 0; i < items.count(); ++i) {
QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
anim->setDuration(750 + i * 25);
anim->setEasingCurve(QEasingCurve::InOutBack);
@@ -259,7 +259,7 @@ int main(int argc, char **argv)
trans->addAnimation(group);
group = new QParallelAnimationGroup;
- for (int i = 0; i < 64; ++i) {
+ for (int i = 0; i < items.count(); ++i) {
QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
anim->setDuration(750 + i * 25);
anim->setEasingCurve(QEasingCurve::InOutBack);
diff --git a/examples/animation/appchooser/main.cpp b/examples/animation/appchooser/main.cpp
index fe4be1f..97751b2 100644
--- a/examples/animation/appchooser/main.cpp
+++ b/examples/animation/appchooser/main.cpp
@@ -134,7 +134,7 @@ int main(int argc, char **argv)
QStateMachine machine;
machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);
- QState *group = new QState(machine.rootState());
+ QState *group = new QState(&machine);
group->setObjectName("group");
QRect selectedRect(86, 86, 128, 128);
diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp
index c43e841..97d3f81 100644
--- a/examples/animation/moveblocks/main.cpp
+++ b/examples/animation/moveblocks/main.cpp
@@ -108,8 +108,7 @@ class StateSwitcher : public QState
Q_OBJECT
public:
StateSwitcher(QStateMachine *machine)
- : QState(machine->rootState()), m_machine(machine),
- m_stateCount(0), m_lastIndex(0)
+ : QState(machine), m_stateCount(0), m_lastIndex(0)
{ }
//![10]
@@ -120,7 +119,7 @@ public:
while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex)
{ }
m_lastIndex = n;
- m_machine->postEvent(new StateSwitchEvent(n));
+ machine()->postEvent(new StateSwitchEvent(n));
}
virtual void onExit(QEvent *) {}
//![11]
@@ -135,7 +134,6 @@ public:
//![12]
private:
- QStateMachine *m_machine;
int m_stateCount;
int m_lastIndex;
};
diff --git a/examples/animation/states/main.cpp b/examples/animation/states/main.cpp
index b3c28f2..99e04c3 100644
--- a/examples/animation/states/main.cpp
+++ b/examples/animation/states/main.cpp
@@ -124,10 +124,9 @@ int main(int argc, char *argv[])
scene.addItem(p6);
QStateMachine machine;
- QState *root = machine.rootState();
- QState *state1 = new QState(root);
- QState *state2 = new QState(root);
- QState *state3 = new QState(root);
+ QState *state1 = new QState(&machine);
+ QState *state2 = new QState(&machine);
+ QState *state3 = new QState(&machine);
machine.setInitialState(state1);
// State 1
diff --git a/examples/animation/stickman/editor/animationdialog.cpp b/examples/animation/stickman/editor/animationdialog.cpp
deleted file mode 100644
index 853046d..0000000
--- a/examples/animation/stickman/editor/animationdialog.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "animationdialog.h"
-#include "stickman.h"
-#include "animation.h"
-#include "node.h"
-
-#include <QHBoxLayout>
-#include <QStackedWidget>
-#include <QSpinBox>
-#include <QPushButton>
-#include <QLabel>
-#include <QLineEdit>
-#include <QMessageBox>
-#include <QFileDialog>
-
-AnimationDialog::AnimationDialog(StickMan *stickman, QWidget *parent)
- : QDialog(parent), m_animation(0), m_stickman(stickman)
-{
- initUi();
-}
-
-AnimationDialog::~AnimationDialog()
-{
- delete m_animation;
-}
-
-void AnimationDialog::initUi()
-{
- setWindowTitle("Animation");
- setEnabled(false);
-
- // Second page
- m_currentFrame = new QSpinBox();
- m_totalFrames = new QSpinBox();
- m_name = new QLineEdit();
-
- connect(m_currentFrame, SIGNAL(valueChanged(int)), this, SLOT(currentFrameChanged(int)));
- connect(m_totalFrames, SIGNAL(valueChanged(int)), this, SLOT(totalFramesChanged(int)));
- connect(m_name, SIGNAL(textChanged(QString)), this, SLOT(setCurrentAnimationName(QString)));
-
- QGridLayout *gridLayout = new QGridLayout(this);
- gridLayout->addWidget(new QLabel("Name:"), 0, 0, 1, 2);
- gridLayout->addWidget(m_name, 0, 2, 1, 2);
- gridLayout->addWidget(new QLabel("Frame:"), 1, 0);
- gridLayout->addWidget(m_currentFrame, 1, 1);
- gridLayout->addWidget(new QLabel("of total # of frames: "), 1, 2);
- gridLayout->addWidget(m_totalFrames, 1, 3);
-}
-
-void AnimationDialog::initFromAnimation()
-{
- m_currentFrame->setRange(0, m_animation->totalFrames()-1);
- m_currentFrame->setValue(m_animation->currentFrame());
-
- m_totalFrames->setRange(1, 1000);
- m_totalFrames->setValue(m_animation->totalFrames());
-
- m_name->setText(m_animation->name());
-}
-
-void AnimationDialog::saveAnimation()
-{
- saveCurrentFrame();
-
- QString fileName = QFileDialog::getSaveFileName(this, "Save animation");
-
- QFile file(fileName);
- if (file.open(QIODevice::WriteOnly))
- m_animation->save(&file);
-}
-
-void AnimationDialog::loadAnimation()
-{
- if (maybeSave() != QMessageBox::Cancel) {
- QString fileName = QFileDialog::getOpenFileName(this, "Open animation");
-
- QFile file(fileName);
- if (file.open(QIODevice::ReadOnly)) {
- if (m_animation == 0)
- newAnimation();
-
- m_animation->load(&file);
- stickManFromCurrentFrame();
- initFromAnimation();
- }
- }
-}
-
-QMessageBox::StandardButton AnimationDialog::maybeSave()
-{
- if (m_animation == 0)
- return QMessageBox::No;
-
- QMessageBox::StandardButton button = QMessageBox::question(this, "Save?", "Do you want to save your changes?",
- QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
- if (button == QMessageBox::Save)
- saveAnimation();
-
- return button;
-}
-
-void AnimationDialog::newAnimation()
-{
- if (maybeSave() != QMessageBox::Cancel) {
- setEnabled(true);
- delete m_animation;
- m_animation = new Animation();
- initFromAnimation();
- }
-}
-
-// Gets the data from the stickman and stores it in current frame
-void AnimationDialog::saveCurrentFrame()
-{
- int count = m_stickman->nodeCount();
- m_animation->setNodeCount(count);
- for (int i=0; i<count; ++i) {
- QGraphicsItem *node = m_stickman->node(i);
- m_animation->setNodePos(i, node->pos());
- }
-}
-
-// Gets the data from the current frame and sets the stickman
-void AnimationDialog::stickManFromCurrentFrame()
-{
- int count = m_animation->nodeCount();
- for (int i=0;i<count;++i) {
- QGraphicsItem *node = m_stickman->node(i);
- node->setPos(m_animation->nodePos(i));
- }
-}
-
-void AnimationDialog::currentFrameChanged(int currentFrame)
-{
- saveCurrentFrame();
- qDebug("currentFrame: %d", currentFrame);
- m_animation->setCurrentFrame(currentFrame);
- stickManFromCurrentFrame();
- initFromAnimation();
-}
-
-void AnimationDialog::totalFramesChanged(int totalFrames)
-{
- m_animation->setTotalFrames(totalFrames);
- stickManFromCurrentFrame();
- initFromAnimation();
-}
-
-void AnimationDialog::setCurrentAnimationName(const QString &name)
-{
- m_animation->setName(name);
-}
diff --git a/examples/animation/stickman/editor/editor.pri b/examples/animation/stickman/editor/editor.pri
deleted file mode 100644
index 7ad9edb..0000000
--- a/examples/animation/stickman/editor/editor.pri
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES += $$PWD/animationdialog.cpp $$PWD/mainwindow.cpp
-HEADERS += $$PWD/animationdialog.h $$PWD/mainwindow.h
diff --git a/examples/animation/stickman/editor/mainwindow.cpp b/examples/animation/stickman/editor/mainwindow.cpp
deleted file mode 100644
index e1d08cc..0000000
--- a/examples/animation/stickman/editor/mainwindow.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mainwindow.h"
-#include "animationdialog.h"
-#include "stickman.h"
-
-#include <QMenuBar>
-#include <QApplication>
-
-MainWindow::MainWindow(StickMan *stickMan)
-{
- initActions(stickMan);
-}
-
-MainWindow::~MainWindow()
-{
-}
-
-void MainWindow::initActions(StickMan *stickMan)
-{
- AnimationDialog *dialog = new AnimationDialog(stickMan, this);
- dialog->show();
-
- QMenu *fileMenu = menuBar()->addMenu("&File");
- QAction *loadAction = fileMenu->addAction("&Open");
- QAction *saveAction = fileMenu->addAction("&Save");
- QAction *exitAction = fileMenu->addAction("E&xit");
-
- QMenu *animationMenu = menuBar()->addMenu("&Animation");
- QAction *newAnimationAction = animationMenu->addAction("&New animation");
-
- connect(loadAction, SIGNAL(triggered()), dialog, SLOT(loadAnimation()));
- connect(saveAction, SIGNAL(triggered()), dialog, SLOT(saveAnimation()));
- connect(exitAction, SIGNAL(triggered()), QApplication::instance(), SLOT(quit()));
- connect(newAnimationAction, SIGNAL(triggered()), dialog, SLOT(newAnimation()));
-
-}
diff --git a/examples/animation/stickman/graphicsview.cpp b/examples/animation/stickman/graphicsview.cpp
index 760c31b..89f2430 100644
--- a/examples/animation/stickman/graphicsview.cpp
+++ b/examples/animation/stickman/graphicsview.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "graphicsview.h"
-#include "editor/mainwindow.h"
#include "stickman.h"
#include <QtGui/QKeyEvent>
@@ -53,28 +52,6 @@ void GraphicsView::keyPressEvent(QKeyEvent *e)
{
if (e->key() == Qt::Key_Escape)
close();
-
-#if 0
- if (e->key() == Qt::Key_F1) {
- if (m_editor == 0) {
- QGraphicsScene *scene = new QGraphicsScene;
- StickMan *stickMan = new StickMan;
- stickMan->setDrawSticks(true);
- scene->addItem(stickMan);
-
- QGraphicsView *view = new QGraphicsView;
- view->setBackgroundBrush(Qt::black);
- view->setRenderHints(QPainter::Antialiasing);
- view->setScene(scene);
-
- m_editor = new MainWindow(stickMan);
- m_editor->setCentralWidget(view);
- }
-
- m_editor->showMaximized();
- }
-#endif
-
emit keyPressed(Qt::Key(e->key()));
}
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp
index 2a54c82..c761d87 100644
--- a/examples/animation/stickman/lifecycle.cpp
+++ b/examples/animation/stickman/lifecycle.cpp
@@ -108,11 +108,11 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
m_machine->addDefaultAnimation(m_animationGroup);
//! [3]
- m_alive = new QState(m_machine->rootState());
+ m_alive = new QState(m_machine);
m_alive->setObjectName("alive");
// Make it blink when lightning strikes before entering dead animation
- QState *lightningBlink = new QState(m_machine->rootState());
+ QState *lightningBlink = new QState(m_machine);
lightningBlink->assignProperty(m_stickMan->scene(), "backgroundBrush", Qt::white);
lightningBlink->assignProperty(m_stickMan, "penColor", Qt::black);
lightningBlink->assignProperty(m_stickMan, "fillColor", Qt::white);
@@ -126,7 +126,7 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
QObject::connect(lightningBlink, SIGNAL(exited()), timer, SLOT(stop()));
//! [5]
- m_dead = new QState(m_machine->rootState());
+ m_dead = new QState(m_machine);
m_dead->assignProperty(m_stickMan->scene(), "backgroundBrush", Qt::black);
m_dead->assignProperty(m_stickMan, "penColor", Qt::white);
m_dead->assignProperty(m_stickMan, "fillColor", Qt::black);
diff --git a/examples/animation/stickman/stickman.pro b/examples/animation/stickman/stickman.pro
index 1dbbce9..7f8be33 100644
--- a/examples/animation/stickman/stickman.pro
+++ b/examples/animation/stickman/stickman.pro
@@ -12,8 +12,6 @@ SOURCES += main.cpp \
INCLUDEPATH += $$PWD
-include(editor/editor.pri)
-
# install
target.path = $$[QT_INSTALL_EXAMPLES]/animation/stickman
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS stickman.pro
diff --git a/examples/animation/sub-attaq/boat.cpp b/examples/animation/sub-attaq/boat.cpp
index d286be5..68e646e 100644
--- a/examples/animation/sub-attaq/boat.cpp
+++ b/examples/animation/sub-attaq/boat.cpp
@@ -142,14 +142,14 @@ Boat::Boat(QGraphicsItem * parent, Qt::WindowFlags wFlags)
//We setup the state machien of the boat
machine = new QStateMachine(this);
- QState *moving = new QState(machine->rootState());
+ QState *moving = new QState(machine);
StopState *stopState = new StopState(this, moving);
machine->setInitialState(moving);
moving->setInitialState(stopState);
MoveStateRight *moveStateRight = new MoveStateRight(this, moving);
MoveStateLeft *moveStateLeft = new MoveStateLeft(this, moving);
- LaunchStateRight *launchStateRight = new LaunchStateRight(this, machine->rootState());
- LaunchStateLeft *launchStateLeft = new LaunchStateLeft(this, machine->rootState());
+ LaunchStateRight *launchStateRight = new LaunchStateRight(this, machine);
+ LaunchStateLeft *launchStateLeft = new LaunchStateLeft(this, machine);
//then setup the transitions for the rightMove state
KeyStopTransition *leftStopRight = new KeyStopTransition(this, QEvent::KeyPress, Qt::Key_Left);
@@ -216,10 +216,10 @@ Boat::Boat(QGraphicsItem * parent, Qt::WindowFlags wFlags)
launchStateLeft->addTransition(historyState);
launchStateRight->addTransition(historyState);
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
//This state play the destroyed animation
- QAnimationState *destroyedState = new QAnimationState(machine->rootState());
+ QAnimationState *destroyedState = new QAnimationState(machine);
destroyedState->setAnimation(destroyAnimation);
//Play a nice animation when the boat is destroyed
diff --git a/examples/animation/sub-attaq/bomb.cpp b/examples/animation/sub-attaq/bomb.cpp
index 454970a..e92a723 100644
--- a/examples/animation/sub-attaq/bomb.cpp
+++ b/examples/animation/sub-attaq/bomb.cpp
@@ -85,11 +85,11 @@ void Bomb::launch(Bomb::Direction direction)
QStateMachine *machine = new QStateMachine(this);
//This state is when the launch animation is playing
- QAnimationState *launched = new QAnimationState(machine->rootState());
+ QAnimationState *launched = new QAnimationState(machine);
launched->setAnimation(launchAnimation);
//End
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
machine->setInitialState(launched);
diff --git a/examples/animation/sub-attaq/graphicsscene.cpp b/examples/animation/sub-attaq/graphicsscene.cpp
index bd37ce2..fcbc1b3 100644
--- a/examples/animation/sub-attaq/graphicsscene.cpp
+++ b/examples/animation/sub-attaq/graphicsscene.cpp
@@ -230,17 +230,17 @@ void GraphicsScene::setupScene(const QList<QAction *> &actions)
QStateMachine *machine = new QStateMachine(this);
//This state is when the player is playing
- PlayState *gameState = new PlayState(this,machine->rootState());
+ PlayState *gameState = new PlayState(this,machine);
//Final state
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
//Animation when the player enter in the game
- QAnimationState *lettersMovingState = new QAnimationState(machine->rootState());
+ QAnimationState *lettersMovingState = new QAnimationState(machine);
lettersMovingState->setAnimation(lettersGroupMoving);
//Animation when the welcome screen disappear
- QAnimationState *lettersFadingState = new QAnimationState(machine->rootState());
+ QAnimationState *lettersFadingState = new QAnimationState(machine);
lettersFadingState->setAnimation(lettersGroupFading);
//if new game then we fade out the welcome screen and start playing
diff --git a/examples/animation/sub-attaq/states.cpp b/examples/animation/sub-attaq/states.cpp
index 81fd2de..d63737f 100644
--- a/examples/animation/sub-attaq/states.cpp
+++ b/examples/animation/sub-attaq/states.cpp
@@ -83,7 +83,7 @@ void PlayState::onEntry(QEvent *)
machine = new QStateMachine(this);
//This state is when player is playing
- LevelState *levelState = new LevelState(scene, this, machine->rootState());
+ LevelState *levelState = new LevelState(scene, this, machine);
//This state is when the player is actually playing but the game is not paused
QState *playingState = new QState(levelState);
@@ -105,10 +105,10 @@ void PlayState::onEntry(QEvent *)
pauseState->addTransition(pressPpause);
//This state is when player have lost
- LostState *lostState = new LostState(scene, this, machine->rootState());
+ LostState *lostState = new LostState(scene, this, machine);
//This state is when player have won
- WinState *winState = new WinState(scene, this, machine->rootState());
+ WinState *winState = new WinState(scene, this, machine);
//The boat has been destroyed then the game is finished
levelState->addTransition(scene->boat, SIGNAL(boatExecutionFinished()),lostState);
@@ -136,7 +136,7 @@ void PlayState::onEntry(QEvent *)
machine->setInitialState(levelState);
//Final state
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
//This transition is triggered when the player press space after completing a level
CustomSpaceTransition *spaceTransition = new CustomSpaceTransition(scene->views().at(0), this, QEvent::KeyPress, Qt::Key_Space);
diff --git a/examples/animation/sub-attaq/submarine.cpp b/examples/animation/sub-attaq/submarine.cpp
index 04b7916..78a9539 100644
--- a/examples/animation/sub-attaq/submarine.cpp
+++ b/examples/animation/sub-attaq/submarine.cpp
@@ -115,7 +115,7 @@ SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem *
QStateMachine *machine = new QStateMachine(this);
//This state is when the boat is moving/rotating
- QState *moving = new QState(machine->rootState());
+ QState *moving = new QState(machine);
//This state is when the boat is moving from left to right
MovementState *movement = new MovementState(this, moving);
@@ -132,7 +132,7 @@ SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem *
machine->setInitialState(moving);
//End
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
//If the moving animation is finished we move to the return state
movement->addTransition(movement, SIGNAL(animationFinished()), rotation);
@@ -141,7 +141,7 @@ SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem *
rotation->addTransition(rotation, SIGNAL(animationFinished()), movement);
//This state play the destroyed animation
- QAnimationState *destroyedState = new QAnimationState(machine->rootState());
+ QAnimationState *destroyedState = new QAnimationState(machine);
destroyedState->setAnimation(setupDestroyAnimation(this));
//Play a nice animation when the submarine is destroyed
diff --git a/examples/animation/sub-attaq/torpedo.cpp b/examples/animation/sub-attaq/torpedo.cpp
index 5ef237a..fe79488 100644
--- a/examples/animation/sub-attaq/torpedo.cpp
+++ b/examples/animation/sub-attaq/torpedo.cpp
@@ -74,11 +74,11 @@ void Torpedo::launch()
QStateMachine *machine = new QStateMachine(this);
//This state is when the launch animation is playing
- QAnimationState *launched = new QAnimationState(machine->rootState());
+ QAnimationState *launched = new QAnimationState(machine);
launched->setAnimation(launchAnimation);
//End
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
machine->setInitialState(launched);
diff --git a/examples/examples.pro b/examples/examples.pro
index 218cf9b..27d6709 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -48,6 +48,7 @@ embedded:SUBDIRS += qws
contains(QT_BUILD_PARTS, tools):SUBDIRS += qtestlib
}
contains(QT_CONFIG, opengl): SUBDIRS += opengl
+contains(QT_CONFIG, openvg): SUBDIRS += openvg
contains(QT_CONFIG, dbus): SUBDIRS += dbus
win32: SUBDIRS += activeqt
contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns
diff --git a/examples/gestures/browser/Info_mac.plist b/examples/gestures/browser/Info_mac.plist
deleted file mode 100644
index 5648631..0000000
--- a/examples/gestures/browser/Info_mac.plist
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
-<plist version="0.9">
-<dict>
- <key>CFBundleIconFile</key>
- <string>@ICON@</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Qt/QMake</string>
- <key>CFBundleIdentifier</key>
- <string>com.trolltech.DemoBrowser</string>
- <key>CFBundleSignature</key>
- <string>ttxt</string>
- <key>CFBundleExecutable</key>
- <string>@EXECUTABLE@</string>
- <key>CFBundleDocumentTypes</key>
- <array>
- <dict>
- <key>CFBundleTypeExtensions</key>
- <array>
- <string>html</string>
- <string>htm</string>
- <string>shtml</string>
- <string>xht</string>
- <string>xhtml</string>
- </array>
- <key>CFBundleTypeIconFile</key>
- <string>@ICON@</string>
- <key>CFBundleTypeName</key>
- <string>HTML Document</string>
- <key>CFBundleTypeOSTypes</key>
- <array>
- <string>HTML</string>
- </array>
- <key>CFBundleTypeRole</key>
- <string>Viewer</string>
- </dict>
- </array>
- <key>NOTE</key>
- <string>DemoBrowser by Nokia Corporation and/or its subsidiary(-ies)</string>
-</dict>
-</plist>
diff --git a/examples/gestures/browser/addbookmarkdialog.ui b/examples/gestures/browser/addbookmarkdialog.ui
deleted file mode 100644
index 3460d7b..0000000
--- a/examples/gestures/browser/addbookmarkdialog.ui
+++ /dev/null
@@ -1,98 +0,0 @@
-<ui version="4.0" >
- <class>AddBookmarkDialog</class>
- <widget class="QDialog" name="AddBookmarkDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>240</width>
- <height>168</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Add Bookmark</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Type a name for the bookmark, and choose where to keep it.</string>
- </property>
- <property name="textFormat" >
- <enum>Qt::PlainText</enum>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="name" />
- </item>
- <item>
- <widget class="QComboBox" name="location" />
- </item>
- <item>
- <spacer name="verticalSpacer" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>2</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- <property name="centerButtons" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>AddBookmarkDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel" >
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>AddBookmarkDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel" >
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/gestures/browser/autosaver.cpp b/examples/gestures/browser/autosaver.cpp
deleted file mode 100644
index 77888ce..0000000
--- a/examples/gestures/browser/autosaver.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "autosaver.h"
-
-#include <QtCore/QDir>
-#include <QtCore/QCoreApplication>
-#include <QtCore/QMetaObject>
-#include <QtDebug>
-
-#define AUTOSAVE_IN 1000 * 3 // seconds
-#define MAXWAIT 1000 * 15 // seconds
-
-AutoSaver::AutoSaver(QObject *parent) : QObject(parent)
-{
- Q_ASSERT(parent);
-}
-
-AutoSaver::~AutoSaver()
-{
- if (m_timer.isActive())
- qWarning() << "AutoSaver: still active when destroyed, changes not saved.";
-}
-
-void AutoSaver::changeOccurred()
-{
- if (m_firstChange.isNull())
- m_firstChange.start();
-
- if (m_firstChange.elapsed() > MAXWAIT) {
- saveIfNeccessary();
- } else {
- m_timer.start(AUTOSAVE_IN, this);
- }
-}
-
-void AutoSaver::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() == m_timer.timerId()) {
- saveIfNeccessary();
- } else {
- QObject::timerEvent(event);
- }
-}
-
-void AutoSaver::saveIfNeccessary()
-{
- if (!m_timer.isActive())
- return;
- m_timer.stop();
- m_firstChange = QTime();
- if (!QMetaObject::invokeMethod(parent(), "save", Qt::DirectConnection)) {
- qWarning() << "AutoSaver: error invoking slot save() on parent";
- }
-}
-
diff --git a/examples/gestures/browser/autosaver.h b/examples/gestures/browser/autosaver.h
deleted file mode 100644
index e6b44ed..0000000
--- a/examples/gestures/browser/autosaver.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUTOSAVER_H
-#define AUTOSAVER_H
-
-#include <QtCore/QObject>
-#include <QtCore/QBasicTimer>
-#include <QtCore/QTime>
-
-/*
- This class will call the save() slot on the parent object when the parent changes.
- It will wait several seconds after changed() to combining multiple changes and
- prevent continuous writing to disk.
- */
-class AutoSaver : public QObject {
-
-Q_OBJECT
-
-public:
- AutoSaver(QObject *parent);
- ~AutoSaver();
- void saveIfNeccessary();
-
-public slots:
- void changeOccurred();
-
-protected:
- void timerEvent(QTimerEvent *event);
-
-private:
- QBasicTimer m_timer;
- QTime m_firstChange;
-
-};
-
-#endif // AUTOSAVER_H
-
diff --git a/examples/gestures/browser/bookmarks.cpp b/examples/gestures/browser/bookmarks.cpp
deleted file mode 100644
index 125bcbe..0000000
--- a/examples/gestures/browser/bookmarks.cpp
+++ /dev/null
@@ -1,987 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "bookmarks.h"
-
-#include "autosaver.h"
-#include "browserapplication.h"
-#include "history.h"
-#include "xbel.h"
-
-#include <QtCore/QBuffer>
-#include <QtCore/QFile>
-#include <QtCore/QMimeData>
-
-#include <QtGui/QDesktopServices>
-#include <QtGui/QDragEnterEvent>
-#include <QtGui/QFileDialog>
-#include <QtGui/QHeaderView>
-#include <QtGui/QIcon>
-#include <QtGui/QMessageBox>
-#include <QtGui/QToolButton>
-
-#include <QtWebKit/QWebSettings>
-
-#include <QtCore/QDebug>
-
-#define BOOKMARKBAR "Bookmarks Bar"
-#define BOOKMARKMENU "Bookmarks Menu"
-
-BookmarksManager::BookmarksManager(QObject *parent)
- : QObject(parent)
- , m_loaded(false)
- , m_saveTimer(new AutoSaver(this))
- , m_bookmarkRootNode(0)
- , m_bookmarkModel(0)
-{
- connect(this, SIGNAL(entryAdded(BookmarkNode *)),
- m_saveTimer, SLOT(changeOccurred()));
- connect(this, SIGNAL(entryRemoved(BookmarkNode *, int, BookmarkNode *)),
- m_saveTimer, SLOT(changeOccurred()));
- connect(this, SIGNAL(entryChanged(BookmarkNode *)),
- m_saveTimer, SLOT(changeOccurred()));
-}
-
-BookmarksManager::~BookmarksManager()
-{
- m_saveTimer->saveIfNeccessary();
-}
-
-void BookmarksManager::changeExpanded()
-{
- m_saveTimer->changeOccurred();
-}
-
-void BookmarksManager::load()
-{
- if (m_loaded)
- return;
- m_loaded = true;
-
- QString dir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
- QString bookmarkFile = dir + QLatin1String("/bookmarks.xbel");
- if (!QFile::exists(bookmarkFile))
- bookmarkFile = QLatin1String(":defaultbookmarks.xbel");
-
- XbelReader reader;
- m_bookmarkRootNode = reader.read(bookmarkFile);
- if (reader.error() != QXmlStreamReader::NoError) {
- QMessageBox::warning(0, QLatin1String("Loading Bookmark"),
- tr("Error when loading bookmarks on line %1, column %2:\n"
- "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString()));
- }
-
- BookmarkNode *toolbar = 0;
- BookmarkNode *menu = 0;
- QList<BookmarkNode*> others;
- for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) {
- BookmarkNode *node = m_bookmarkRootNode->children().at(i);
- if (node->type() == BookmarkNode::Folder) {
- // Automatically convert
- if (node->title == tr("Toolbar Bookmarks") && !toolbar) {
- node->title = tr(BOOKMARKBAR);
- }
- if (node->title == tr(BOOKMARKBAR) && !toolbar) {
- toolbar = node;
- }
-
- // Automatically convert
- if (node->title == tr("Menu") && !menu) {
- node->title = tr(BOOKMARKMENU);
- }
- if (node->title == tr(BOOKMARKMENU) && !menu) {
- menu = node;
- }
- } else {
- others.append(node);
- }
- m_bookmarkRootNode->remove(node);
- }
- Q_ASSERT(m_bookmarkRootNode->children().count() == 0);
- if (!toolbar) {
- toolbar = new BookmarkNode(BookmarkNode::Folder, m_bookmarkRootNode);
- toolbar->title = tr(BOOKMARKBAR);
- } else {
- m_bookmarkRootNode->add(toolbar);
- }
-
- if (!menu) {
- menu = new BookmarkNode(BookmarkNode::Folder, m_bookmarkRootNode);
- menu->title = tr(BOOKMARKMENU);
- } else {
- m_bookmarkRootNode->add(menu);
- }
-
- for (int i = 0; i < others.count(); ++i)
- menu->add(others.at(i));
-}
-
-void BookmarksManager::save() const
-{
- if (!m_loaded)
- return;
-
- XbelWriter writer;
- QString dir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
- QString bookmarkFile = dir + QLatin1String("/bookmarks.xbel");
- if (!writer.write(bookmarkFile, m_bookmarkRootNode))
- qWarning() << "BookmarkManager: error saving to" << bookmarkFile;
-}
-
-void BookmarksManager::addBookmark(BookmarkNode *parent, BookmarkNode *node, int row)
-{
- if (!m_loaded)
- return;
- Q_ASSERT(parent);
- InsertBookmarksCommand *command = new InsertBookmarksCommand(this, parent, node, row);
- m_commands.push(command);
-}
-
-void BookmarksManager::removeBookmark(BookmarkNode *node)
-{
- if (!m_loaded)
- return;
-
- Q_ASSERT(node);
- BookmarkNode *parent = node->parent();
- int row = parent->children().indexOf(node);
- RemoveBookmarksCommand *command = new RemoveBookmarksCommand(this, parent, row);
- m_commands.push(command);
-}
-
-void BookmarksManager::setTitle(BookmarkNode *node, const QString &newTitle)
-{
- if (!m_loaded)
- return;
-
- Q_ASSERT(node);
- ChangeBookmarkCommand *command = new ChangeBookmarkCommand(this, node, newTitle, true);
- m_commands.push(command);
-}
-
-void BookmarksManager::setUrl(BookmarkNode *node, const QString &newUrl)
-{
- if (!m_loaded)
- return;
-
- Q_ASSERT(node);
- ChangeBookmarkCommand *command = new ChangeBookmarkCommand(this, node, newUrl, false);
- m_commands.push(command);
-}
-
-BookmarkNode *BookmarksManager::bookmarks()
-{
- if (!m_loaded)
- load();
- return m_bookmarkRootNode;
-}
-
-BookmarkNode *BookmarksManager::menu()
-{
- if (!m_loaded)
- load();
-
- for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) {
- BookmarkNode *node = m_bookmarkRootNode->children().at(i);
- if (node->title == tr(BOOKMARKMENU))
- return node;
- }
- Q_ASSERT(false);
- return 0;
-}
-
-BookmarkNode *BookmarksManager::toolbar()
-{
- if (!m_loaded)
- load();
-
- for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) {
- BookmarkNode *node = m_bookmarkRootNode->children().at(i);
- if (node->title == tr(BOOKMARKBAR))
- return node;
- }
- Q_ASSERT(false);
- return 0;
-}
-
-BookmarksModel *BookmarksManager::bookmarksModel()
-{
- if (!m_bookmarkModel)
- m_bookmarkModel = new BookmarksModel(this, this);
- return m_bookmarkModel;
-}
-
-void BookmarksManager::importBookmarks()
-{
- QString fileName = QFileDialog::getOpenFileName(0, tr("Open File"),
- QString(),
- tr("XBEL (*.xbel *.xml)"));
- if (fileName.isEmpty())
- return;
-
- XbelReader reader;
- BookmarkNode *importRootNode = reader.read(fileName);
- if (reader.error() != QXmlStreamReader::NoError) {
- QMessageBox::warning(0, QLatin1String("Loading Bookmark"),
- tr("Error when loading bookmarks on line %1, column %2:\n"
- "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString()));
- }
-
- importRootNode->setType(BookmarkNode::Folder);
- importRootNode->title = (tr("Imported %1").arg(QDate::currentDate().toString(Qt::SystemLocaleShortDate)));
- addBookmark(menu(), importRootNode);
-}
-
-void BookmarksManager::exportBookmarks()
-{
- QString fileName = QFileDialog::getSaveFileName(0, tr("Save File"),
- tr("%1 Bookmarks.xbel").arg(QCoreApplication::applicationName()),
- tr("XBEL (*.xbel *.xml)"));
- if (fileName.isEmpty())
- return;
-
- XbelWriter writer;
- if (!writer.write(fileName, m_bookmarkRootNode))
- QMessageBox::critical(0, tr("Export error"), tr("error saving bookmarks"));
-}
-
-RemoveBookmarksCommand::RemoveBookmarksCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *parent, int row)
- : QUndoCommand(BookmarksManager::tr("Remove Bookmark"))
- , m_row(row)
- , m_bookmarkManagaer(m_bookmarkManagaer)
- , m_node(parent->children().value(row))
- , m_parent(parent)
- , m_done(false)
-{
-}
-
-RemoveBookmarksCommand::~RemoveBookmarksCommand()
-{
- if (m_done && !m_node->parent()) {
- delete m_node;
- }
-}
-
-void RemoveBookmarksCommand::undo()
-{
- m_parent->add(m_node, m_row);
- emit m_bookmarkManagaer->entryAdded(m_node);
- m_done = false;
-}
-
-void RemoveBookmarksCommand::redo()
-{
- m_parent->remove(m_node);
- emit m_bookmarkManagaer->entryRemoved(m_parent, m_row, m_node);
- m_done = true;
-}
-
-InsertBookmarksCommand::InsertBookmarksCommand(BookmarksManager *m_bookmarkManagaer,
- BookmarkNode *parent, BookmarkNode *node, int row)
- : RemoveBookmarksCommand(m_bookmarkManagaer, parent, row)
-{
- setText(BookmarksManager::tr("Insert Bookmark"));
- m_node = node;
-}
-
-ChangeBookmarkCommand::ChangeBookmarkCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *node,
- const QString &newValue, bool title)
- : QUndoCommand()
- , m_bookmarkManagaer(m_bookmarkManagaer)
- , m_title(title)
- , m_newValue(newValue)
- , m_node(node)
-{
- if (m_title) {
- m_oldValue = m_node->title;
- setText(BookmarksManager::tr("Name Change"));
- } else {
- m_oldValue = m_node->url;
- setText(BookmarksManager::tr("Address Change"));
- }
-}
-
-void ChangeBookmarkCommand::undo()
-{
- if (m_title)
- m_node->title = m_oldValue;
- else
- m_node->url = m_oldValue;
- emit m_bookmarkManagaer->entryChanged(m_node);
-}
-
-void ChangeBookmarkCommand::redo()
-{
- if (m_title)
- m_node->title = m_newValue;
- else
- m_node->url = m_newValue;
- emit m_bookmarkManagaer->entryChanged(m_node);
-}
-
-BookmarksModel::BookmarksModel(BookmarksManager *bookmarkManager, QObject *parent)
- : QAbstractItemModel(parent)
- , m_endMacro(false)
- , m_bookmarksManager(bookmarkManager)
-{
- connect(bookmarkManager, SIGNAL(entryAdded(BookmarkNode *)),
- this, SLOT(entryAdded(BookmarkNode *)));
- connect(bookmarkManager, SIGNAL(entryRemoved(BookmarkNode *, int, BookmarkNode *)),
- this, SLOT(entryRemoved(BookmarkNode *, int, BookmarkNode *)));
- connect(bookmarkManager, SIGNAL(entryChanged(BookmarkNode *)),
- this, SLOT(entryChanged(BookmarkNode *)));
-}
-
-QModelIndex BookmarksModel::index(BookmarkNode *node) const
-{
- BookmarkNode *parent = node->parent();
- if (!parent)
- return QModelIndex();
- return createIndex(parent->children().indexOf(node), 0, node);
-}
-
-void BookmarksModel::entryAdded(BookmarkNode *item)
-{
- Q_ASSERT(item && item->parent());
- int row = item->parent()->children().indexOf(item);
- BookmarkNode *parent = item->parent();
- // item was already added so remove beore beginInsertRows is called
- parent->remove(item);
- beginInsertRows(index(parent), row, row);
- parent->add(item, row);
- endInsertRows();
-}
-
-void BookmarksModel::entryRemoved(BookmarkNode *parent, int row, BookmarkNode *item)
-{
- // item was already removed, re-add so beginRemoveRows works
- parent->add(item, row);
- beginRemoveRows(index(parent), row, row);
- parent->remove(item);
- endRemoveRows();
-}
-
-void BookmarksModel::entryChanged(BookmarkNode *item)
-{
- QModelIndex idx = index(item);
- emit dataChanged(idx, idx);
-}
-
-bool BookmarksModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (row < 0 || count <= 0 || row + count > rowCount(parent))
- return false;
-
- BookmarkNode *bookmarkNode = node(parent);
- for (int i = row + count - 1; i >= row; --i) {
- BookmarkNode *node = bookmarkNode->children().at(i);
- if (node == m_bookmarksManager->menu()
- || node == m_bookmarksManager->toolbar())
- continue;
-
- m_bookmarksManager->removeBookmark(node);
- }
- if (m_endMacro) {
- m_bookmarksManager->undoRedoStack()->endMacro();
- m_endMacro = false;
- }
- return true;
-}
-
-QVariant BookmarksModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
- switch (section) {
- case 0: return tr("Title");
- case 1: return tr("Address");
- }
- }
- return QAbstractItemModel::headerData(section, orientation, role);
-}
-
-QVariant BookmarksModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid() || index.model() != this)
- return QVariant();
-
- const BookmarkNode *bookmarkNode = node(index);
- switch (role) {
- case Qt::EditRole:
- case Qt::DisplayRole:
- if (bookmarkNode->type() == BookmarkNode::Separator) {
- switch (index.column()) {
- case 0: return QString(50, 0xB7);
- case 1: return QString();
- }
- }
-
- switch (index.column()) {
- case 0: return bookmarkNode->title;
- case 1: return bookmarkNode->url;
- }
- break;
- case BookmarksModel::UrlRole:
- return QUrl(bookmarkNode->url);
- break;
- case BookmarksModel::UrlStringRole:
- return bookmarkNode->url;
- break;
- case BookmarksModel::TypeRole:
- return bookmarkNode->type();
- break;
- case BookmarksModel::SeparatorRole:
- return (bookmarkNode->type() == BookmarkNode::Separator);
- break;
- case Qt::DecorationRole:
- if (index.column() == 0) {
- if (bookmarkNode->type() == BookmarkNode::Folder)
- return QApplication::style()->standardIcon(QStyle::SP_DirIcon);
- return BrowserApplication::instance()->icon(bookmarkNode->url);
- }
- }
-
- return QVariant();
-}
-
-int BookmarksModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.column() > 0) ? 0 : 2;
-}
-
-int BookmarksModel::rowCount(const QModelIndex &parent) const
-{
- if (parent.column() > 0)
- return 0;
-
- if (!parent.isValid())
- return m_bookmarksManager->bookmarks()->children().count();
-
- const BookmarkNode *item = static_cast<BookmarkNode*>(parent.internalPointer());
- return item->children().count();
-}
-
-QModelIndex BookmarksModel::index(int row, int column, const QModelIndex &parent) const
-{
- if (row < 0 || column < 0 || row >= rowCount(parent) || column >= columnCount(parent))
- return QModelIndex();
-
- // get the parent node
- BookmarkNode *parentNode = node(parent);
- return createIndex(row, column, parentNode->children().at(row));
-}
-
-QModelIndex BookmarksModel::parent(const QModelIndex &index) const
-{
- if (!index.isValid())
- return QModelIndex();
-
- BookmarkNode *itemNode = node(index);
- BookmarkNode *parentNode = (itemNode ? itemNode->parent() : 0);
- if (!parentNode || parentNode == m_bookmarksManager->bookmarks())
- return QModelIndex();
-
- // get the parent's row
- BookmarkNode *grandParentNode = parentNode->parent();
- int parentRow = grandParentNode->children().indexOf(parentNode);
- Q_ASSERT(parentRow >= 0);
- return createIndex(parentRow, 0, parentNode);
-}
-
-bool BookmarksModel::hasChildren(const QModelIndex &parent) const
-{
- if (!parent.isValid())
- return true;
- const BookmarkNode *parentNode = node(parent);
- return (parentNode->type() == BookmarkNode::Folder);
-}
-
-Qt::ItemFlags BookmarksModel::flags(const QModelIndex &index) const
-{
- if (!index.isValid())
- return Qt::NoItemFlags;
-
- Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
-
- BookmarkNode *bookmarkNode = node(index);
-
- if (bookmarkNode != m_bookmarksManager->menu()
- && bookmarkNode != m_bookmarksManager->toolbar()) {
- flags |= Qt::ItemIsDragEnabled;
- if (bookmarkNode->type() != BookmarkNode::Separator)
- flags |= Qt::ItemIsEditable;
- }
- if (hasChildren(index))
- flags |= Qt::ItemIsDropEnabled;
- return flags;
-}
-
-Qt::DropActions BookmarksModel::supportedDropActions () const
-{
- return Qt::CopyAction | Qt::MoveAction;
-}
-
-#define MIMETYPE QLatin1String("application/bookmarks.xbel")
-
-QStringList BookmarksModel::mimeTypes() const
-{
- QStringList types;
- types << MIMETYPE;
- return types;
-}
-
-QMimeData *BookmarksModel::mimeData(const QModelIndexList &indexes) const
-{
- QMimeData *mimeData = new QMimeData();
- QByteArray data;
- QDataStream stream(&data, QIODevice::WriteOnly);
- foreach (QModelIndex index, indexes) {
- if (index.column() != 0 || !index.isValid())
- continue;
- QByteArray encodedData;
- QBuffer buffer(&encodedData);
- buffer.open(QBuffer::ReadWrite);
- XbelWriter writer;
- const BookmarkNode *parentNode = node(index);
- writer.write(&buffer, parentNode);
- stream << encodedData;
- }
- mimeData->setData(MIMETYPE, data);
- return mimeData;
-}
-
-bool BookmarksModel::dropMimeData(const QMimeData *data,
- Qt::DropAction action, int row, int column, const QModelIndex &parent)
-{
- if (action == Qt::IgnoreAction)
- return true;
-
- if (!data->hasFormat(MIMETYPE)
- || column > 0)
- return false;
-
- QByteArray ba = data->data(MIMETYPE);
- QDataStream stream(&ba, QIODevice::ReadOnly);
- if (stream.atEnd())
- return false;
-
- QUndoStack *undoStack = m_bookmarksManager->undoRedoStack();
- undoStack->beginMacro(QLatin1String("Move Bookmarks"));
-
- while (!stream.atEnd()) {
- QByteArray encodedData;
- stream >> encodedData;
- QBuffer buffer(&encodedData);
- buffer.open(QBuffer::ReadOnly);
-
- XbelReader reader;
- BookmarkNode *rootNode = reader.read(&buffer);
- QList<BookmarkNode*> children = rootNode->children();
- for (int i = 0; i < children.count(); ++i) {
- BookmarkNode *bookmarkNode = children.at(i);
- rootNode->remove(bookmarkNode);
- row = qMax(0, row);
- BookmarkNode *parentNode = node(parent);
- m_bookmarksManager->addBookmark(parentNode, bookmarkNode, row);
- m_endMacro = true;
- }
- delete rootNode;
- }
- return true;
-}
-
-bool BookmarksModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- if (!index.isValid() || (flags(index) & Qt::ItemIsEditable) == 0)
- return false;
-
- BookmarkNode *item = node(index);
-
- switch (role) {
- case Qt::EditRole:
- case Qt::DisplayRole:
- if (index.column() == 0) {
- m_bookmarksManager->setTitle(item, value.toString());
- break;
- }
- if (index.column() == 1) {
- m_bookmarksManager->setUrl(item, value.toString());
- break;
- }
- return false;
- case BookmarksModel::UrlRole:
- m_bookmarksManager->setUrl(item, value.toUrl().toString());
- break;
- case BookmarksModel::UrlStringRole:
- m_bookmarksManager->setUrl(item, value.toString());
- break;
- default:
- break;
- return false;
- }
-
- return true;
-}
-
-BookmarkNode *BookmarksModel::node(const QModelIndex &index) const
-{
- BookmarkNode *itemNode = static_cast<BookmarkNode*>(index.internalPointer());
- if (!itemNode)
- return m_bookmarksManager->bookmarks();
- return itemNode;
-}
-
-
-AddBookmarkProxyModel::AddBookmarkProxyModel(QObject *parent)
- : QSortFilterProxyModel(parent)
-{
-}
-
-int AddBookmarkProxyModel::columnCount(const QModelIndex &parent) const
-{
- return qMin(1, QSortFilterProxyModel::columnCount(parent));
-}
-
-bool AddBookmarkProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
-{
- QModelIndex idx = sourceModel()->index(source_row, 0, source_parent);
- return sourceModel()->hasChildren(idx);
-}
-
-AddBookmarkDialog::AddBookmarkDialog(const QString &url, const QString &title, QWidget *parent, BookmarksManager *bookmarkManager)
- : QDialog(parent)
- , m_url(url)
- , m_bookmarksManager(bookmarkManager)
-{
- setWindowFlags(Qt::Sheet);
- if (!m_bookmarksManager)
- m_bookmarksManager = BrowserApplication::bookmarksManager();
- setupUi(this);
- QTreeView *view = new QTreeView(this);
- m_proxyModel = new AddBookmarkProxyModel(this);
- BookmarksModel *model = m_bookmarksManager->bookmarksModel();
- m_proxyModel->setSourceModel(model);
- view->setModel(m_proxyModel);
- view->expandAll();
- view->header()->setStretchLastSection(true);
- view->header()->hide();
- view->setItemsExpandable(false);
- view->setRootIsDecorated(false);
- view->setIndentation(10);
- location->setModel(m_proxyModel);
- view->show();
- location->setView(view);
- BookmarkNode *menu = m_bookmarksManager->menu();
- QModelIndex idx = m_proxyModel->mapFromSource(model->index(menu));
- view->setCurrentIndex(idx);
- location->setCurrentIndex(idx.row());
- name->setText(title);
-}
-
-void AddBookmarkDialog::accept()
-{
- QModelIndex index = location->view()->currentIndex();
- index = m_proxyModel->mapToSource(index);
- if (!index.isValid())
- index = m_bookmarksManager->bookmarksModel()->index(0, 0);
- BookmarkNode *parent = m_bookmarksManager->bookmarksModel()->node(index);
- BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark);
- bookmark->url = m_url;
- bookmark->title = name->text();
- m_bookmarksManager->addBookmark(parent, bookmark);
- QDialog::accept();
-}
-
-BookmarksMenu::BookmarksMenu(QWidget *parent)
- : ModelMenu(parent)
- , m_bookmarksManager(0)
-{
- connect(this, SIGNAL(activated(const QModelIndex &)),
- this, SLOT(activated(const QModelIndex &)));
- setMaxRows(-1);
- setHoverRole(BookmarksModel::UrlStringRole);
- setSeparatorRole(BookmarksModel::SeparatorRole);
-}
-
-void BookmarksMenu::activated(const QModelIndex &index)
-{
- emit openUrl(index.data(BookmarksModel::UrlRole).toUrl());
-}
-
-bool BookmarksMenu::prePopulated()
-{
- m_bookmarksManager = BrowserApplication::bookmarksManager();
- setModel(m_bookmarksManager->bookmarksModel());
- setRootIndex(m_bookmarksManager->bookmarksModel()->index(1, 0));
- // initial actions
- for (int i = 0; i < m_initialActions.count(); ++i)
- addAction(m_initialActions.at(i));
- if (!m_initialActions.isEmpty())
- addSeparator();
- createMenu(model()->index(0, 0), 1, this);
- return true;
-}
-
-void BookmarksMenu::setInitialActions(QList<QAction*> actions)
-{
- m_initialActions = actions;
- for (int i = 0; i < m_initialActions.count(); ++i)
- addAction(m_initialActions.at(i));
-}
-
-BookmarksDialog::BookmarksDialog(QWidget *parent, BookmarksManager *manager)
- : QDialog(parent)
-{
- m_bookmarksManager = manager;
- if (!m_bookmarksManager)
- m_bookmarksManager = BrowserApplication::bookmarksManager();
- setupUi(this);
-
- tree->setUniformRowHeights(true);
- tree->setSelectionBehavior(QAbstractItemView::SelectRows);
- tree->setSelectionMode(QAbstractItemView::ContiguousSelection);
- tree->setTextElideMode(Qt::ElideMiddle);
- m_bookmarksModel = m_bookmarksManager->bookmarksModel();
- m_proxyModel = new TreeProxyModel(this);
- connect(search, SIGNAL(textChanged(QString)),
- m_proxyModel, SLOT(setFilterFixedString(QString)));
- connect(removeButton, SIGNAL(clicked()), tree, SLOT(removeOne()));
- m_proxyModel->setSourceModel(m_bookmarksModel);
- tree->setModel(m_proxyModel);
- tree->setDragDropMode(QAbstractItemView::InternalMove);
- tree->setExpanded(m_proxyModel->index(0, 0), true);
- tree->setAlternatingRowColors(true);
- QFontMetrics fm(font());
- int header = fm.width(QLatin1Char('m')) * 40;
- tree->header()->resizeSection(0, header);
- tree->header()->setStretchLastSection(true);
- connect(tree, SIGNAL(activated(const QModelIndex&)),
- this, SLOT(open()));
- tree->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(tree, SIGNAL(customContextMenuRequested(const QPoint &)),
- this, SLOT(customContextMenuRequested(const QPoint &)));
- connect(addFolderButton, SIGNAL(clicked()),
- this, SLOT(newFolder()));
- expandNodes(m_bookmarksManager->bookmarks());
- setAttribute(Qt::WA_DeleteOnClose);
-}
-
-BookmarksDialog::~BookmarksDialog()
-{
- if (saveExpandedNodes(tree->rootIndex()))
- m_bookmarksManager->changeExpanded();
-}
-
-bool BookmarksDialog::saveExpandedNodes(const QModelIndex &parent)
-{
- bool changed = false;
- for (int i = 0; i < m_proxyModel->rowCount(parent); ++i) {
- QModelIndex child = m_proxyModel->index(i, 0, parent);
- QModelIndex sourceIndex = m_proxyModel->mapToSource(child);
- BookmarkNode *childNode = m_bookmarksModel->node(sourceIndex);
- bool wasExpanded = childNode->expanded;
- if (tree->isExpanded(child)) {
- childNode->expanded = true;
- changed |= saveExpandedNodes(child);
- } else {
- childNode->expanded = false;
- }
- changed |= (wasExpanded != childNode->expanded);
- }
- return changed;
-}
-
-void BookmarksDialog::expandNodes(BookmarkNode *node)
-{
- for (int i = 0; i < node->children().count(); ++i) {
- BookmarkNode *childNode = node->children()[i];
- if (childNode->expanded) {
- QModelIndex idx = m_bookmarksModel->index(childNode);
- idx = m_proxyModel->mapFromSource(idx);
- tree->setExpanded(idx, true);
- expandNodes(childNode);
- }
- }
-}
-
-void BookmarksDialog::customContextMenuRequested(const QPoint &pos)
-{
- QMenu menu;
- QModelIndex index = tree->indexAt(pos);
- index = index.sibling(index.row(), 0);
- if (index.isValid() && !tree->model()->hasChildren(index)) {
- menu.addAction(tr("Open"), this, SLOT(open()));
- menu.addSeparator();
- }
- menu.addAction(tr("Delete"), tree, SLOT(removeOne()));
- menu.exec(QCursor::pos());
-}
-
-void BookmarksDialog::open()
-{
- QModelIndex index = tree->currentIndex();
- if (!index.parent().isValid())
- return;
- emit openUrl(index.sibling(index.row(), 1).data(BookmarksModel::UrlRole).toUrl());
-}
-
-void BookmarksDialog::newFolder()
-{
- QModelIndex currentIndex = tree->currentIndex();
- QModelIndex idx = currentIndex;
- if (idx.isValid() && !idx.model()->hasChildren(idx))
- idx = idx.parent();
- if (!idx.isValid())
- idx = tree->rootIndex();
- idx = m_proxyModel->mapToSource(idx);
- BookmarkNode *parent = m_bookmarksManager->bookmarksModel()->node(idx);
- BookmarkNode *node = new BookmarkNode(BookmarkNode::Folder);
- node->title = tr("New Folder");
- m_bookmarksManager->addBookmark(parent, node, currentIndex.row() + 1);
-}
-
-BookmarksToolBar::BookmarksToolBar(BookmarksModel *model, QWidget *parent)
- : QToolBar(tr("Bookmark"), parent)
- , m_bookmarksModel(model)
-{
- connect(this, SIGNAL(actionTriggered(QAction*)), this, SLOT(triggered(QAction*)));
- setRootIndex(model->index(0, 0));
- connect(m_bookmarksModel, SIGNAL(modelReset()), this, SLOT(build()));
- connect(m_bookmarksModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(build()));
- connect(m_bookmarksModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(build()));
- connect(m_bookmarksModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(build()));
- setAcceptDrops(true);
-}
-
-void BookmarksToolBar::dragEnterEvent(QDragEnterEvent *event)
-{
- const QMimeData *mimeData = event->mimeData();
- if (mimeData->hasUrls())
- event->acceptProposedAction();
- QToolBar::dragEnterEvent(event);
-}
-
-void BookmarksToolBar::dropEvent(QDropEvent *event)
-{
- const QMimeData *mimeData = event->mimeData();
- if (mimeData->hasUrls() && mimeData->hasText()) {
- QList<QUrl> urls = mimeData->urls();
- QAction *action = actionAt(event->pos());
- QString dropText;
- if (action)
- dropText = action->text();
- int row = -1;
- QModelIndex parentIndex = m_root;
- for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) {
- QModelIndex idx = m_bookmarksModel->index(i, 0, m_root);
- QString title = idx.data().toString();
- if (title == dropText) {
- row = i;
- if (m_bookmarksModel->hasChildren(idx)) {
- parentIndex = idx;
- row = -1;
- }
- break;
- }
- }
- BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark);
- bookmark->url = urls.at(0).toString();
- bookmark->title = mimeData->text();
-
- BookmarkNode *parent = m_bookmarksModel->node(parentIndex);
- BookmarksManager *bookmarksManager = m_bookmarksModel->bookmarksManager();
- bookmarksManager->addBookmark(parent, bookmark, row);
- event->acceptProposedAction();
- }
- QToolBar::dropEvent(event);
-}
-
-
-void BookmarksToolBar::setRootIndex(const QModelIndex &index)
-{
- m_root = index;
- build();
-}
-
-QModelIndex BookmarksToolBar::rootIndex() const
-{
- return m_root;
-}
-
-void BookmarksToolBar::build()
-{
- clear();
- for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) {
- QModelIndex idx = m_bookmarksModel->index(i, 0, m_root);
- if (m_bookmarksModel->hasChildren(idx)) {
- QToolButton *button = new QToolButton(this);
- button->setPopupMode(QToolButton::InstantPopup);
- button->setArrowType(Qt::DownArrow);
- button->setText(idx.data().toString());
- ModelMenu *menu = new ModelMenu(this);
- connect(menu, SIGNAL(activated(const QModelIndex &)),
- this, SLOT(activated(const QModelIndex &)));
- menu->setModel(m_bookmarksModel);
- menu->setRootIndex(idx);
- menu->addAction(new QAction(menu));
- button->setMenu(menu);
- button->setToolButtonStyle(Qt::ToolButtonTextOnly);
- QAction *a = addWidget(button);
- a->setText(idx.data().toString());
- } else {
- QAction *action = addAction(idx.data().toString());
- action->setData(idx.data(BookmarksModel::UrlRole));
- }
- }
-}
-
-void BookmarksToolBar::triggered(QAction *action)
-{
- QVariant v = action->data();
- if (v.canConvert<QUrl>()) {
- emit openUrl(v.toUrl());
- }
-}
-
-void BookmarksToolBar::activated(const QModelIndex &index)
-{
- emit openUrl(index.data(BookmarksModel::UrlRole).toUrl());
-}
-
diff --git a/examples/gestures/browser/bookmarks.h b/examples/gestures/browser/bookmarks.h
deleted file mode 100644
index 7fcdae1..0000000
--- a/examples/gestures/browser/bookmarks.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BOOKMARKS_H
-#define BOOKMARKS_H
-
-#include <QtCore/QObject>
-#include <QtCore/QAbstractItemModel>
-
-#include <QtGui/QUndoCommand>
-
-/*!
- Bookmark manager, owner of the bookmarks, loads, saves and basic tasks
- */
-class AutoSaver;
-class BookmarkNode;
-class BookmarksModel;
-class BookmarksManager : public QObject
-{
- Q_OBJECT
-
-signals:
- void entryAdded(BookmarkNode *item);
- void entryRemoved(BookmarkNode *parent, int row, BookmarkNode *item);
- void entryChanged(BookmarkNode *item);
-
-public:
- BookmarksManager(QObject *parent = 0);
- ~BookmarksManager();
-
- void addBookmark(BookmarkNode *parent, BookmarkNode *node, int row = -1);
- void removeBookmark(BookmarkNode *node);
- void setTitle(BookmarkNode *node, const QString &newTitle);
- void setUrl(BookmarkNode *node, const QString &newUrl);
- void changeExpanded();
-
- BookmarkNode *bookmarks();
- BookmarkNode *menu();
- BookmarkNode *toolbar();
-
- BookmarksModel *bookmarksModel();
- QUndoStack *undoRedoStack() { return &m_commands; };
-
-public slots:
- void importBookmarks();
- void exportBookmarks();
-
-private slots:
- void save() const;
-
-private:
- void load();
-
- bool m_loaded;
- AutoSaver *m_saveTimer;
- BookmarkNode *m_bookmarkRootNode;
- BookmarksModel *m_bookmarkModel;
- QUndoStack m_commands;
-
- friend class RemoveBookmarksCommand;
- friend class ChangeBookmarkCommand;
-};
-
-class RemoveBookmarksCommand : public QUndoCommand
-{
-
-public:
- RemoveBookmarksCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *parent, int row);
- ~RemoveBookmarksCommand();
- void undo();
- void redo();
-
-protected:
- int m_row;
- BookmarksManager *m_bookmarkManagaer;
- BookmarkNode *m_node;
- BookmarkNode *m_parent;
- bool m_done;
-};
-
-class InsertBookmarksCommand : public RemoveBookmarksCommand
-{
-
-public:
- InsertBookmarksCommand(BookmarksManager *m_bookmarkManagaer,
- BookmarkNode *parent, BookmarkNode *node, int row);
- void undo() { RemoveBookmarksCommand::redo(); }
- void redo() { RemoveBookmarksCommand::undo(); }
-
-};
-
-class ChangeBookmarkCommand : public QUndoCommand
-{
-
-public:
- ChangeBookmarkCommand(BookmarksManager *m_bookmarkManagaer,
- BookmarkNode *node, const QString &newValue, bool title);
- void undo();
- void redo();
-
-private:
- BookmarksManager *m_bookmarkManagaer;
- bool m_title;
- QString m_oldValue;
- QString m_newValue;
- BookmarkNode *m_node;
-};
-
-/*!
- BookmarksModel is a QAbstractItemModel wrapper around the BookmarkManager
- */
-#include <QtGui/QIcon>
-class BookmarksModel : public QAbstractItemModel
-{
- Q_OBJECT
-
-public slots:
- void entryAdded(BookmarkNode *item);
- void entryRemoved(BookmarkNode *parent, int row, BookmarkNode *item);
- void entryChanged(BookmarkNode *item);
-
-public:
- enum Roles {
- TypeRole = Qt::UserRole + 1,
- UrlRole = Qt::UserRole + 2,
- UrlStringRole = Qt::UserRole + 3,
- SeparatorRole = Qt::UserRole + 4
- };
-
- BookmarksModel(BookmarksManager *bookmarkManager, QObject *parent = 0);
- inline BookmarksManager *bookmarksManager() const { return m_bookmarksManager; }
-
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QModelIndex index(int, int, const QModelIndex& = QModelIndex()) const;
- QModelIndex parent(const QModelIndex& index= QModelIndex()) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
- Qt::DropActions supportedDropActions () const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
- QMimeData *mimeData(const QModelIndexList &indexes) const;
- QStringList mimeTypes() const;
- bool dropMimeData(const QMimeData *data,
- Qt::DropAction action, int row, int column, const QModelIndex &parent);
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
-
- BookmarkNode *node(const QModelIndex &index) const;
- QModelIndex index(BookmarkNode *node) const;
-
-private:
-
- bool m_endMacro;
- BookmarksManager *m_bookmarksManager;
-};
-
-// Menu that is dynamically populated from the bookmarks
-#include "modelmenu.h"
-class BookmarksMenu : public ModelMenu
-{
- Q_OBJECT
-
-signals:
- void openUrl(const QUrl &url);
-
-public:
- BookmarksMenu(QWidget *parent = 0);
- void setInitialActions(QList<QAction*> actions);
-
-protected:
- bool prePopulated();
-
-private slots:
- void activated(const QModelIndex &index);
-
-private:
- BookmarksManager *m_bookmarksManager;
- QList<QAction*> m_initialActions;
-};
-
-/*
- Proxy model that filters out the bookmarks so only the folders
- are left behind. Used in the add bookmark dialog combobox.
- */
-#include <QtGui/QSortFilterProxyModel>
-class AddBookmarkProxyModel : public QSortFilterProxyModel
-{
- Q_OBJECT
-public:
- AddBookmarkProxyModel(QObject * parent = 0);
- int columnCount(const QModelIndex & parent = QModelIndex()) const;
-
-protected:
- bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
-};
-
-/*!
- Add bookmark dialog
- */
-#include "ui_addbookmarkdialog.h"
-class AddBookmarkDialog : public QDialog, public Ui_AddBookmarkDialog
-{
- Q_OBJECT
-
-public:
- AddBookmarkDialog(const QString &url, const QString &title, QWidget *parent = 0, BookmarksManager *bookmarkManager = 0);
-
-private slots:
- void accept();
-
-private:
- QString m_url;
- BookmarksManager *m_bookmarksManager;
- AddBookmarkProxyModel *m_proxyModel;
-};
-
-#include "ui_bookmarks.h"
-class TreeProxyModel;
-class BookmarksDialog : public QDialog, public Ui_BookmarksDialog
-{
- Q_OBJECT
-
-signals:
- void openUrl(const QUrl &url);
-
-public:
- BookmarksDialog(QWidget *parent = 0, BookmarksManager *manager = 0);
- ~BookmarksDialog();
-
-private slots:
- void customContextMenuRequested(const QPoint &pos);
- void open();
- void newFolder();
-
-private:
- void expandNodes(BookmarkNode *node);
- bool saveExpandedNodes(const QModelIndex &parent);
-
- BookmarksManager *m_bookmarksManager;
- BookmarksModel *m_bookmarksModel;
- TreeProxyModel *m_proxyModel;
-};
-
-#include <QtGui/QToolBar>
-class BookmarksToolBar : public QToolBar
-{
- Q_OBJECT
-
-signals:
- void openUrl(const QUrl &url);
-
-public:
- BookmarksToolBar(BookmarksModel *model, QWidget *parent = 0);
- void setRootIndex(const QModelIndex &index);
- QModelIndex rootIndex() const;
-
-protected:
- void dragEnterEvent(QDragEnterEvent *event);
- void dropEvent(QDropEvent *event);
-
-private slots:
- void triggered(QAction *action);
- void activated(const QModelIndex &index);
- void build();
-
-private:
- BookmarksModel *m_bookmarksModel;
- QPersistentModelIndex m_root;
-};
-
-#endif // BOOKMARKS_H
diff --git a/examples/gestures/browser/bookmarks.ui b/examples/gestures/browser/bookmarks.ui
deleted file mode 100644
index c893e94..0000000
--- a/examples/gestures/browser/bookmarks.ui
+++ /dev/null
@@ -1,106 +0,0 @@
-<ui version="4.0" >
- <class>BookmarksDialog</class>
- <widget class="QDialog" name="BookmarksDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>758</width>
- <height>450</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Bookmarks</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>252</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1" >
- <widget class="SearchLineEdit" name="search" />
- </item>
- <item row="1" column="0" colspan="2" >
- <widget class="EditTreeView" name="tree" />
- </item>
- <item row="2" column="0" colspan="2" >
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QPushButton" name="removeButton" >
- <property name="text" >
- <string>&amp;Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="addFolderButton" >
- <property name="text" >
- <string>Add Folder</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="standardButtons" >
- <set>QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>SearchLineEdit</class>
- <extends>QLineEdit</extends>
- <header>searchlineedit.h</header>
- </customwidget>
- <customwidget>
- <class>EditTreeView</class>
- <extends>QTreeView</extends>
- <header>edittreeview.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>BookmarksDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>472</x>
- <y>329</y>
- </hint>
- <hint type="destinationlabel" >
- <x>461</x>
- <y>356</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/gestures/browser/browser.icns b/examples/gestures/browser/browser.icns
deleted file mode 100644
index f591ae4..0000000
--- a/examples/gestures/browser/browser.icns
+++ /dev/null
Binary files differ
diff --git a/examples/gestures/browser/browser.ico b/examples/gestures/browser/browser.ico
deleted file mode 100644
index 7f9be93..0000000
--- a/examples/gestures/browser/browser.ico
+++ /dev/null
Binary files differ
diff --git a/examples/gestures/browser/browser.pro b/examples/gestures/browser/browser.pro
deleted file mode 100644
index d970f99..0000000
--- a/examples/gestures/browser/browser.pro
+++ /dev/null
@@ -1,91 +0,0 @@
-TEMPLATE = app
-TARGET = browser
-QT += webkit network
-
-CONFIG += qt warn_on
-contains(QT_BUILD_PARTS, tools): CONFIG += uitools
-else: DEFINES += QT_NO_UITOOLS
-
-FORMS += \
- addbookmarkdialog.ui \
- bookmarks.ui \
- cookies.ui \
- cookiesexceptions.ui \
- downloaditem.ui \
- downloads.ui \
- history.ui \
- passworddialog.ui \
- proxy.ui \
- settings.ui
-
-HEADERS += \
- autosaver.h \
- bookmarks.h \
- browserapplication.h \
- browsermainwindow.h \
- chasewidget.h \
- cookiejar.h \
- downloadmanager.h \
- edittableview.h \
- edittreeview.h \
- history.h \
- modelmenu.h \
- networkaccessmanager.h \
- searchlineedit.h \
- settings.h \
- squeezelabel.h \
- tabwidget.h \
- toolbarsearch.h \
- urllineedit.h \
- webview.h \
- xbel.h
-
-SOURCES += \
- autosaver.cpp \
- bookmarks.cpp \
- browserapplication.cpp \
- browsermainwindow.cpp \
- chasewidget.cpp \
- cookiejar.cpp \
- downloadmanager.cpp \
- edittableview.cpp \
- edittreeview.cpp \
- history.cpp \
- modelmenu.cpp \
- networkaccessmanager.cpp \
- searchlineedit.cpp \
- settings.cpp \
- squeezelabel.cpp \
- tabwidget.cpp \
- toolbarsearch.cpp \
- urllineedit.cpp \
- webview.cpp \
- xbel.cpp \
- main.cpp
-
-RESOURCES += data/data.qrc htmls/htmls.qrc
-
-build_all:!build_pass {
- CONFIG -= build_all
- CONFIG += release
-}
-
-win32 {
- RC_FILE = browser.rc
-}
-
-mac {
- ICON = browser.icns
- QMAKE_INFO_PLIST = Info_mac.plist
- TARGET = Browser
-}
-
-wince*: {
- DEPLOYMENT_PLUGIN += qjpeg qgif
-}
-
-# install
-target.path = $$[QT_INSTALL_DEMOS]/browser
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.plist *.icns *.ico *.rc *.pro *.html *.doc images htmls
-sources.path = $$[QT_INSTALL_DEMOS]/browser
-INSTALLS += target sources
diff --git a/examples/gestures/browser/browser.rc b/examples/gestures/browser/browser.rc
deleted file mode 100644
index 89a237c..0000000
--- a/examples/gestures/browser/browser.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-IDI_ICON1 ICON DISCARDABLE "browser.ico"
-
diff --git a/examples/gestures/browser/browserapplication.cpp b/examples/gestures/browser/browserapplication.cpp
deleted file mode 100644
index 718a8ec..0000000
--- a/examples/gestures/browser/browserapplication.cpp
+++ /dev/null
@@ -1,447 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "browserapplication.h"
-
-#include "bookmarks.h"
-#include "browsermainwindow.h"
-#include "cookiejar.h"
-#include "downloadmanager.h"
-#include "history.h"
-#include "networkaccessmanager.h"
-#include "tabwidget.h"
-#include "webview.h"
-
-#include <QtCore/QBuffer>
-#include <QtCore/QDir>
-#include <QtCore/QLibraryInfo>
-#include <QtCore/QSettings>
-#include <QtCore/QTextStream>
-#include <QtCore/QTranslator>
-
-#include <QtGui/QDesktopServices>
-#include <QtGui/QFileOpenEvent>
-
-#include <QtNetwork/QLocalServer>
-#include <QtNetwork/QLocalSocket>
-#include <QtNetwork/QNetworkProxy>
-
-#include <QtWebKit/QWebSettings>
-
-#include <QtCore/QDebug>
-
-DownloadManager *BrowserApplication::s_downloadManager = 0;
-HistoryManager *BrowserApplication::s_historyManager = 0;
-NetworkAccessManager *BrowserApplication::s_networkAccessManager = 0;
-BookmarksManager *BrowserApplication::s_bookmarksManager = 0;
-
-BrowserApplication::BrowserApplication(int &argc, char **argv)
- : QApplication(argc, argv)
- , m_localServer(0)
-{
- QCoreApplication::setOrganizationName(QLatin1String("Trolltech"));
- QCoreApplication::setApplicationName(QLatin1String("demobrowser"));
- QCoreApplication::setApplicationVersion(QLatin1String("0.1"));
-#ifdef Q_WS_QWS
- // Use a different server name for QWS so we can run an X11
- // browser and a QWS browser in parallel on the same machine for
- // debugging
- QString serverName = QCoreApplication::applicationName() + QLatin1String("_qws");
-#else
- QString serverName = QCoreApplication::applicationName();
-#endif
- QLocalSocket socket;
- socket.connectToServer(serverName);
- if (socket.waitForConnected(500)) {
- QTextStream stream(&socket);
- QStringList args = QCoreApplication::arguments();
- if (args.count() > 1)
- stream << args.last();
- else
- stream << QString();
- stream.flush();
- socket.waitForBytesWritten();
- return;
- }
-
-#if defined(Q_WS_MAC)
- QApplication::setQuitOnLastWindowClosed(false);
-#else
- QApplication::setQuitOnLastWindowClosed(true);
-#endif
-
- m_localServer = new QLocalServer(this);
- connect(m_localServer, SIGNAL(newConnection()),
- this, SLOT(newLocalSocketConnection()));
- if (!m_localServer->listen(serverName)) {
- if (m_localServer->serverError() == QAbstractSocket::AddressInUseError
- && QFile::exists(m_localServer->serverName())) {
- QFile::remove(m_localServer->serverName());
- m_localServer->listen(serverName);
- }
- }
-
- QDesktopServices::setUrlHandler(QLatin1String("http"), this, "openUrl");
- QString localSysName = QLocale::system().name();
-
- installTranslator(QLatin1String("qt_") + localSysName);
-
- QSettings settings;
- settings.beginGroup(QLatin1String("sessions"));
- m_lastSession = settings.value(QLatin1String("lastSession")).toByteArray();
- settings.endGroup();
-
-#if defined(Q_WS_MAC)
- connect(this, SIGNAL(lastWindowClosed()),
- this, SLOT(lastWindowClosed()));
-#endif
-
- QTimer::singleShot(0, this, SLOT(postLaunch()));
-}
-
-BrowserApplication::~BrowserApplication()
-{
- delete s_downloadManager;
- for (int i = 0; i < m_mainWindows.size(); ++i) {
- BrowserMainWindow *window = m_mainWindows.at(i);
- delete window;
- }
- delete s_networkAccessManager;
- delete s_bookmarksManager;
-}
-
-#if defined(Q_WS_MAC)
-void BrowserApplication::lastWindowClosed()
-{
- clean();
- BrowserMainWindow *mw = new BrowserMainWindow;
- mw->slotHome();
- m_mainWindows.prepend(mw);
-}
-#endif
-
-BrowserApplication *BrowserApplication::instance()
-{
- return (static_cast<BrowserApplication *>(QCoreApplication::instance()));
-}
-
-#if defined(Q_WS_MAC)
-#include <QtGui/QMessageBox>
-void BrowserApplication::quitBrowser()
-{
- clean();
- int tabCount = 0;
- for (int i = 0; i < m_mainWindows.count(); ++i) {
- tabCount =+ m_mainWindows.at(i)->tabWidget()->count();
- }
-
- if (tabCount > 1) {
- int ret = QMessageBox::warning(mainWindow(), QString(),
- tr("There are %1 windows and %2 tabs open\n"
- "Do you want to quit anyway?").arg(m_mainWindows.count()).arg(tabCount),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::No);
- if (ret == QMessageBox::No)
- return;
- }
-
- exit(0);
-}
-#endif
-
-/*!
- Any actions that can be delayed until the window is visible
- */
-void BrowserApplication::postLaunch()
-{
- QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
- if (directory.isEmpty())
- directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName();
- QWebSettings::setIconDatabasePath(directory);
-
- setWindowIcon(QIcon(QLatin1String(":browser.svg")));
-
- loadSettings();
-
- // newMainWindow() needs to be called in main() for this to happen
- if (m_mainWindows.count() > 0) {
- QStringList args = QCoreApplication::arguments();
- if (args.count() > 1)
- mainWindow()->loadPage(args.last());
- else
- mainWindow()->slotHome();
- }
- BrowserApplication::historyManager();
-}
-
-void BrowserApplication::loadSettings()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("websettings"));
-
- QWebSettings *defaultSettings = QWebSettings::globalSettings();
- QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
- int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
- QFont standardFont = QFont(standardFontFamily, standardFontSize);
- standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
- defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family());
- defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize());
-
- QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
- int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
- QFont fixedFont = QFont(fixedFontFamily, fixedFontSize);
- fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
- defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family());
- defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize());
-
- defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool());
- defaultSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool());
-
- QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl();
- defaultSettings->setUserStyleSheetUrl(url);
-
- settings.endGroup();
-}
-
-QList<BrowserMainWindow*> BrowserApplication::mainWindows()
-{
- clean();
- QList<BrowserMainWindow*> list;
- for (int i = 0; i < m_mainWindows.count(); ++i)
- list.append(m_mainWindows.at(i));
- return list;
-}
-
-void BrowserApplication::clean()
-{
- // cleanup any deleted main windows first
- for (int i = m_mainWindows.count() - 1; i >= 0; --i)
- if (m_mainWindows.at(i).isNull())
- m_mainWindows.removeAt(i);
-}
-
-void BrowserApplication::saveSession()
-{
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- return;
-
- clean();
-
- QSettings settings;
- settings.beginGroup(QLatin1String("sessions"));
-
- QByteArray data;
- QBuffer buffer(&data);
- QDataStream stream(&buffer);
- buffer.open(QIODevice::ReadWrite);
-
- stream << m_mainWindows.count();
- for (int i = 0; i < m_mainWindows.count(); ++i)
- stream << m_mainWindows.at(i)->saveState();
- settings.setValue(QLatin1String("lastSession"), data);
- settings.endGroup();
-}
-
-bool BrowserApplication::canRestoreSession() const
-{
- return !m_lastSession.isEmpty();
-}
-
-void BrowserApplication::restoreLastSession()
-{
- QList<QByteArray> windows;
- QBuffer buffer(&m_lastSession);
- QDataStream stream(&buffer);
- buffer.open(QIODevice::ReadOnly);
- int windowCount;
- stream >> windowCount;
- for (int i = 0; i < windowCount; ++i) {
- QByteArray windowState;
- stream >> windowState;
- windows.append(windowState);
- }
- for (int i = 0; i < windows.count(); ++i) {
- BrowserMainWindow *newWindow = 0;
- if (m_mainWindows.count() == 1
- && mainWindow()->tabWidget()->count() == 1
- && mainWindow()->currentTab()->url() == QUrl()) {
- newWindow = mainWindow();
- } else {
- newWindow = newMainWindow();
- }
- newWindow->restoreState(windows.at(i));
- }
-}
-
-bool BrowserApplication::isTheOnlyBrowser() const
-{
- return (m_localServer != 0);
-}
-
-void BrowserApplication::installTranslator(const QString &name)
-{
- QTranslator *translator = new QTranslator(this);
- translator->load(name, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
- QApplication::installTranslator(translator);
-}
-
-#if defined(Q_WS_MAC)
-bool BrowserApplication::event(QEvent* event)
-{
- switch (event->type()) {
- case QEvent::ApplicationActivate: {
- clean();
- if (!m_mainWindows.isEmpty()) {
- BrowserMainWindow *mw = mainWindow();
- if (mw && !mw->isMinimized()) {
- mainWindow()->show();
- }
- return true;
- }
- }
- case QEvent::FileOpen:
- if (!m_mainWindows.isEmpty()) {
- mainWindow()->loadPage(static_cast<QFileOpenEvent *>(event)->file());
- return true;
- }
- default:
- break;
- }
- return QApplication::event(event);
-}
-#endif
-
-void BrowserApplication::openUrl(const QUrl &url)
-{
- mainWindow()->loadPage(url.toString());
-}
-
-BrowserMainWindow *BrowserApplication::newMainWindow()
-{
- BrowserMainWindow *browser = new BrowserMainWindow();
- m_mainWindows.prepend(browser);
- browser->show();
- return browser;
-}
-
-BrowserMainWindow *BrowserApplication::mainWindow()
-{
- clean();
- if (m_mainWindows.isEmpty())
- newMainWindow();
- return m_mainWindows[0];
-}
-
-void BrowserApplication::newLocalSocketConnection()
-{
- QLocalSocket *socket = m_localServer->nextPendingConnection();
- if (!socket)
- return;
- socket->waitForReadyRead(1000);
- QTextStream stream(socket);
- QString url;
- stream >> url;
- if (!url.isEmpty()) {
- QSettings settings;
- settings.beginGroup(QLatin1String("general"));
- int openLinksIn = settings.value(QLatin1String("openLinksIn"), 0).toInt();
- settings.endGroup();
- if (openLinksIn == 1)
- newMainWindow();
- else
- mainWindow()->tabWidget()->newTab();
- openUrl(url);
- }
- delete socket;
- mainWindow()->raise();
- mainWindow()->activateWindow();
-}
-
-CookieJar *BrowserApplication::cookieJar()
-{
- return (CookieJar*)networkAccessManager()->cookieJar();
-}
-
-DownloadManager *BrowserApplication::downloadManager()
-{
- if (!s_downloadManager) {
- s_downloadManager = new DownloadManager();
- }
- return s_downloadManager;
-}
-
-NetworkAccessManager *BrowserApplication::networkAccessManager()
-{
- if (!s_networkAccessManager) {
- s_networkAccessManager = new NetworkAccessManager();
- s_networkAccessManager->setCookieJar(new CookieJar);
- }
- return s_networkAccessManager;
-}
-
-HistoryManager *BrowserApplication::historyManager()
-{
- if (!s_historyManager) {
- s_historyManager = new HistoryManager();
- QWebHistoryInterface::setDefaultInterface(s_historyManager);
- }
- return s_historyManager;
-}
-
-BookmarksManager *BrowserApplication::bookmarksManager()
-{
- if (!s_bookmarksManager) {
- s_bookmarksManager = new BookmarksManager;
- }
- return s_bookmarksManager;
-}
-
-QIcon BrowserApplication::icon(const QUrl &url) const
-{
- QIcon icon = QWebSettings::iconForUrl(url);
- if (!icon.isNull())
- return icon.pixmap(16, 16);
- if (m_defaultIcon.isNull())
- m_defaultIcon = QIcon(QLatin1String(":defaulticon.png"));
- return m_defaultIcon.pixmap(16, 16);
-}
-
diff --git a/examples/gestures/browser/browsermainwindow.cpp b/examples/gestures/browser/browsermainwindow.cpp
deleted file mode 100644
index c6fe82d..0000000
--- a/examples/gestures/browser/browsermainwindow.cpp
+++ /dev/null
@@ -1,991 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "browsermainwindow.h"
-
-#include "autosaver.h"
-#include "bookmarks.h"
-#include "browserapplication.h"
-#include "chasewidget.h"
-#include "downloadmanager.h"
-#include "history.h"
-#include "settings.h"
-#include "tabwidget.h"
-#include "toolbarsearch.h"
-#include "ui_passworddialog.h"
-#include "webview.h"
-
-#include <QtCore/QSettings>
-
-#include <QtGui/QDesktopWidget>
-#include <QtGui/QFileDialog>
-#include <QtGui/QPlainTextEdit>
-#include <QtGui/QPrintDialog>
-#include <QtGui/QPrintPreviewDialog>
-#include <QtGui/QPrinter>
-#include <QtGui/QMenuBar>
-#include <QtGui/QMessageBox>
-#include <QtGui/QStatusBar>
-#include <QtGui/QToolBar>
-#include <QtGui/QInputDialog>
-
-#include <QtWebKit/QWebFrame>
-#include <QtWebKit/QWebHistory>
-
-#include <QtCore/QDebug>
-
-BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags)
- : QMainWindow(parent, flags)
- , m_tabWidget(new TabWidget(this))
- , m_autoSaver(new AutoSaver(this))
- , m_historyBack(0)
- , m_historyForward(0)
- , m_stop(0)
- , m_reload(0)
-{
- setAttribute(Qt::WA_DeleteOnClose, true);
- statusBar()->setSizeGripEnabled(true);
- setupMenu();
- setupToolBar();
-
- QWidget *centralWidget = new QWidget(this);
- BookmarksModel *boomarksModel = BrowserApplication::bookmarksManager()->bookmarksModel();
- m_bookmarksToolbar = new BookmarksToolBar(boomarksModel, this);
- connect(m_bookmarksToolbar, SIGNAL(openUrl(const QUrl&)),
- m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&)));
- connect(m_bookmarksToolbar->toggleViewAction(), SIGNAL(toggled(bool)),
- this, SLOT(updateBookmarksToolbarActionText(bool)));
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setSpacing(0);
- layout->setMargin(0);
-#if defined(Q_WS_MAC)
- layout->addWidget(m_bookmarksToolbar);
- layout->addWidget(new QWidget); // <- OS X tab widget style bug
-#else
- addToolBarBreak();
- addToolBar(m_bookmarksToolbar);
-#endif
- layout->addWidget(m_tabWidget);
- centralWidget->setLayout(layout);
- setCentralWidget(centralWidget);
-
- connect(m_tabWidget, SIGNAL(loadPage(const QString &)),
- this, SLOT(loadPage(const QString &)));
- connect(m_tabWidget, SIGNAL(setCurrentTitle(const QString &)),
- this, SLOT(slotUpdateWindowTitle(const QString &)));
- connect(m_tabWidget, SIGNAL(showStatusBarMessage(const QString&)),
- statusBar(), SLOT(showMessage(const QString&)));
- connect(m_tabWidget, SIGNAL(linkHovered(const QString&)),
- statusBar(), SLOT(showMessage(const QString&)));
- connect(m_tabWidget, SIGNAL(loadProgress(int)),
- this, SLOT(slotLoadProgress(int)));
- connect(m_tabWidget, SIGNAL(tabsChanged()),
- m_autoSaver, SLOT(changeOccurred()));
- connect(m_tabWidget, SIGNAL(geometryChangeRequested(const QRect &)),
- this, SLOT(geometryChangeRequested(const QRect &)));
- connect(m_tabWidget, SIGNAL(printRequested(QWebFrame *)),
- this, SLOT(printRequested(QWebFrame *)));
- connect(m_tabWidget, SIGNAL(menuBarVisibilityChangeRequested(bool)),
- menuBar(), SLOT(setVisible(bool)));
- connect(m_tabWidget, SIGNAL(statusBarVisibilityChangeRequested(bool)),
- statusBar(), SLOT(setVisible(bool)));
- connect(m_tabWidget, SIGNAL(toolBarVisibilityChangeRequested(bool)),
- m_navigationBar, SLOT(setVisible(bool)));
- connect(m_tabWidget, SIGNAL(toolBarVisibilityChangeRequested(bool)),
- m_bookmarksToolbar, SLOT(setVisible(bool)));
-#if defined(Q_WS_MAC)
- connect(m_tabWidget, SIGNAL(lastTabClosed()),
- this, SLOT(close()));
-#else
- connect(m_tabWidget, SIGNAL(lastTabClosed()),
- m_tabWidget, SLOT(newTab()));
-#endif
-
- slotUpdateWindowTitle();
- loadDefaultState();
- m_tabWidget->newTab();
-
- int size = m_tabWidget->lineEditStack()->sizeHint().height();
- m_navigationBar->setIconSize(QSize(size, size));
-
-}
-
-BrowserMainWindow::~BrowserMainWindow()
-{
- m_autoSaver->changeOccurred();
- m_autoSaver->saveIfNeccessary();
-}
-
-void BrowserMainWindow::loadDefaultState()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("BrowserMainWindow"));
- QByteArray data = settings.value(QLatin1String("defaultState")).toByteArray();
- restoreState(data);
- settings.endGroup();
-}
-
-QSize BrowserMainWindow::sizeHint() const
-{
- QRect desktopRect = QApplication::desktop()->screenGeometry();
- QSize size = desktopRect.size() * qreal(0.9);
- return size;
-}
-
-void BrowserMainWindow::save()
-{
- BrowserApplication::instance()->saveSession();
-
- QSettings settings;
- settings.beginGroup(QLatin1String("BrowserMainWindow"));
- QByteArray data = saveState(false);
- settings.setValue(QLatin1String("defaultState"), data);
- settings.endGroup();
-}
-
-static const qint32 BrowserMainWindowMagic = 0xba;
-
-QByteArray BrowserMainWindow::saveState(bool withTabs) const
-{
- int version = 2;
- QByteArray data;
- QDataStream stream(&data, QIODevice::WriteOnly);
-
- stream << qint32(BrowserMainWindowMagic);
- stream << qint32(version);
-
- stream << size();
- stream << !m_navigationBar->isHidden();
- stream << !m_bookmarksToolbar->isHidden();
- stream << !statusBar()->isHidden();
- if (withTabs)
- stream << tabWidget()->saveState();
- else
- stream << QByteArray();
- return data;
-}
-
-bool BrowserMainWindow::restoreState(const QByteArray &state)
-{
- int version = 2;
- QByteArray sd = state;
- QDataStream stream(&sd, QIODevice::ReadOnly);
- if (stream.atEnd())
- return false;
-
- qint32 marker;
- qint32 v;
- stream >> marker;
- stream >> v;
- if (marker != BrowserMainWindowMagic || v != version)
- return false;
-
- QSize size;
- bool showToolbar;
- bool showBookmarksBar;
- bool showStatusbar;
- QByteArray tabState;
-
- stream >> size;
- stream >> showToolbar;
- stream >> showBookmarksBar;
- stream >> showStatusbar;
- stream >> tabState;
-
- resize(size);
-
- m_navigationBar->setVisible(showToolbar);
- updateToolbarActionText(showToolbar);
-
- m_bookmarksToolbar->setVisible(showBookmarksBar);
- updateBookmarksToolbarActionText(showBookmarksBar);
-
- statusBar()->setVisible(showStatusbar);
- updateStatusbarActionText(showStatusbar);
-
- if (!tabWidget()->restoreState(tabState))
- return false;
-
- return true;
-}
-
-void BrowserMainWindow::setupMenu()
-{
- new QShortcut(QKeySequence(Qt::Key_F6), this, SLOT(slotSwapFocus()));
-
- // File
- QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
-
- fileMenu->addAction(tr("&New Window"), this, SLOT(slotFileNew()), QKeySequence::New);
- fileMenu->addAction(m_tabWidget->newTabAction());
- fileMenu->addAction(tr("&Open File..."), this, SLOT(slotFileOpen()), QKeySequence::Open);
- fileMenu->addAction(tr("Open &Location..."), this,
- SLOT(slotSelectLineEdit()), QKeySequence(Qt::ControlModifier + Qt::Key_L));
- fileMenu->addSeparator();
- fileMenu->addAction(m_tabWidget->closeTabAction());
- fileMenu->addSeparator();
- fileMenu->addAction(tr("&Save As..."), this,
- SLOT(slotFileSaveAs()), QKeySequence(QKeySequence::Save));
- fileMenu->addSeparator();
- BookmarksManager *bookmarksManager = BrowserApplication::bookmarksManager();
- fileMenu->addAction(tr("&Import Bookmarks..."), bookmarksManager, SLOT(importBookmarks()));
- fileMenu->addAction(tr("&Export Bookmarks..."), bookmarksManager, SLOT(exportBookmarks()));
- fileMenu->addSeparator();
- fileMenu->addAction(tr("P&rint Preview..."), this, SLOT(slotFilePrintPreview()));
- fileMenu->addAction(tr("&Print..."), this, SLOT(slotFilePrint()), QKeySequence::Print);
- fileMenu->addSeparator();
- QAction *action = fileMenu->addAction(tr("Private &Browsing..."), this, SLOT(slotPrivateBrowsing()));
- action->setCheckable(true);
- fileMenu->addSeparator();
-
-#if defined(Q_WS_MAC)
- fileMenu->addAction(tr("&Quit"), BrowserApplication::instance(), SLOT(quitBrowser()), QKeySequence(Qt::CTRL | Qt::Key_Q));
-#else
- fileMenu->addAction(tr("&Quit"), this, SLOT(close()), QKeySequence(Qt::CTRL | Qt::Key_Q));
-#endif
-
- // Edit
- QMenu *editMenu = menuBar()->addMenu(tr("&Edit"));
- QAction *m_undo = editMenu->addAction(tr("&Undo"));
- m_undo->setShortcuts(QKeySequence::Undo);
- m_tabWidget->addWebAction(m_undo, QWebPage::Undo);
- QAction *m_redo = editMenu->addAction(tr("&Redo"));
- m_redo->setShortcuts(QKeySequence::Redo);
- m_tabWidget->addWebAction(m_redo, QWebPage::Redo);
- editMenu->addSeparator();
- QAction *m_cut = editMenu->addAction(tr("Cu&t"));
- m_cut->setShortcuts(QKeySequence::Cut);
- m_tabWidget->addWebAction(m_cut, QWebPage::Cut);
- QAction *m_copy = editMenu->addAction(tr("&Copy"));
- m_copy->setShortcuts(QKeySequence::Copy);
- m_tabWidget->addWebAction(m_copy, QWebPage::Copy);
- QAction *m_paste = editMenu->addAction(tr("&Paste"));
- m_paste->setShortcuts(QKeySequence::Paste);
- m_tabWidget->addWebAction(m_paste, QWebPage::Paste);
- editMenu->addSeparator();
-
- QAction *m_find = editMenu->addAction(tr("&Find"));
- m_find->setShortcuts(QKeySequence::Find);
- connect(m_find, SIGNAL(triggered()), this, SLOT(slotEditFind()));
- new QShortcut(QKeySequence(Qt::Key_Slash), this, SLOT(slotEditFind()));
-
- QAction *m_findNext = editMenu->addAction(tr("&Find Next"));
- m_findNext->setShortcuts(QKeySequence::FindNext);
- connect(m_findNext, SIGNAL(triggered()), this, SLOT(slotEditFindNext()));
-
- QAction *m_findPrevious = editMenu->addAction(tr("&Find Previous"));
- m_findPrevious->setShortcuts(QKeySequence::FindPrevious);
- connect(m_findPrevious, SIGNAL(triggered()), this, SLOT(slotEditFindPrevious()));
-
- editMenu->addSeparator();
- editMenu->addAction(tr("&Preferences"), this, SLOT(slotPreferences()), tr("Ctrl+,"));
-
- // View
- QMenu *viewMenu = menuBar()->addMenu(tr("&View"));
-
- m_viewBookmarkBar = new QAction(this);
- updateBookmarksToolbarActionText(true);
- m_viewBookmarkBar->setShortcut(tr("Shift+Ctrl+B"));
- connect(m_viewBookmarkBar, SIGNAL(triggered()), this, SLOT(slotViewBookmarksBar()));
- viewMenu->addAction(m_viewBookmarkBar);
-
- m_viewToolbar = new QAction(this);
- updateToolbarActionText(true);
- m_viewToolbar->setShortcut(tr("Ctrl+|"));
- connect(m_viewToolbar, SIGNAL(triggered()), this, SLOT(slotViewToolbar()));
- viewMenu->addAction(m_viewToolbar);
-
- m_viewStatusbar = new QAction(this);
- updateStatusbarActionText(true);
- m_viewStatusbar->setShortcut(tr("Ctrl+/"));
- connect(m_viewStatusbar, SIGNAL(triggered()), this, SLOT(slotViewStatusbar()));
- viewMenu->addAction(m_viewStatusbar);
-
- viewMenu->addSeparator();
-
- m_stop = viewMenu->addAction(tr("&Stop"));
- QList<QKeySequence> shortcuts;
- shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Period));
- shortcuts.append(Qt::Key_Escape);
- m_stop->setShortcuts(shortcuts);
- m_tabWidget->addWebAction(m_stop, QWebPage::Stop);
-
- m_reload = viewMenu->addAction(tr("Reload Page"));
- m_reload->setShortcuts(QKeySequence::Refresh);
- m_tabWidget->addWebAction(m_reload, QWebPage::Reload);
-
- viewMenu->addAction(tr("Zoom &In"), this, SLOT(slotViewZoomIn()), QKeySequence(Qt::CTRL | Qt::Key_Plus));
- viewMenu->addAction(tr("Zoom &Out"), this, SLOT(slotViewZoomOut()), QKeySequence(Qt::CTRL | Qt::Key_Minus));
- viewMenu->addAction(tr("Reset &Zoom"), this, SLOT(slotViewResetZoom()), QKeySequence(Qt::CTRL | Qt::Key_0));
- QAction *zoomTextOnlyAction = viewMenu->addAction(tr("Zoom &Text Only"));
- connect(zoomTextOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotViewZoomTextOnly(bool)));
- zoomTextOnlyAction->setCheckable(true);
- zoomTextOnlyAction->setChecked(false);
-
- viewMenu->addSeparator();
- viewMenu->addAction(tr("Page S&ource"), this, SLOT(slotViewPageSource()), tr("Ctrl+Alt+U"));
- QAction *a = viewMenu->addAction(tr("&Full Screen"), this, SLOT(slotViewFullScreen(bool)), Qt::Key_F11);
- a->setCheckable(true);
-
- // History
- HistoryMenu *historyMenu = new HistoryMenu(this);
- connect(historyMenu, SIGNAL(openUrl(const QUrl&)),
- m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&)));
- connect(historyMenu, SIGNAL(hovered(const QString&)), this,
- SLOT(slotUpdateStatusbar(const QString&)));
- historyMenu->setTitle(tr("Hi&story"));
- menuBar()->addMenu(historyMenu);
- QList<QAction*> historyActions;
-
- m_historyBack = new QAction(tr("Back"), this);
- m_tabWidget->addWebAction(m_historyBack, QWebPage::Back);
- m_historyBack->setShortcuts(QKeySequence::Back);
- m_historyBack->setIconVisibleInMenu(false);
-
- m_historyForward = new QAction(tr("Forward"), this);
- m_tabWidget->addWebAction(m_historyForward, QWebPage::Forward);
- m_historyForward->setShortcuts(QKeySequence::Forward);
- m_historyForward->setIconVisibleInMenu(false);
-
- QAction *m_historyHome = new QAction(tr("Home"), this);
- connect(m_historyHome, SIGNAL(triggered()), this, SLOT(slotHome()));
- m_historyHome->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_H));
-
- m_restoreLastSession = new QAction(tr("Restore Last Session"), this);
- connect(m_restoreLastSession, SIGNAL(triggered()), BrowserApplication::instance(), SLOT(restoreLastSession()));
- m_restoreLastSession->setEnabled(BrowserApplication::instance()->canRestoreSession());
-
- historyActions.append(m_historyBack);
- historyActions.append(m_historyForward);
- historyActions.append(m_historyHome);
- historyActions.append(m_tabWidget->recentlyClosedTabsAction());
- historyActions.append(m_restoreLastSession);
- historyMenu->setInitialActions(historyActions);
-
- // Bookmarks
- BookmarksMenu *bookmarksMenu = new BookmarksMenu(this);
- connect(bookmarksMenu, SIGNAL(openUrl(const QUrl&)),
- m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&)));
- connect(bookmarksMenu, SIGNAL(hovered(const QString&)),
- this, SLOT(slotUpdateStatusbar(const QString&)));
- bookmarksMenu->setTitle(tr("&Bookmarks"));
- menuBar()->addMenu(bookmarksMenu);
-
- QList<QAction*> bookmarksActions;
-
- QAction *showAllBookmarksAction = new QAction(tr("Show All Bookmarks"), this);
- connect(showAllBookmarksAction, SIGNAL(triggered()), this, SLOT(slotShowBookmarksDialog()));
- m_addBookmark = new QAction(QIcon(QLatin1String(":addbookmark.png")), tr("Add Bookmark..."), this);
- m_addBookmark->setIconVisibleInMenu(false);
-
- connect(m_addBookmark, SIGNAL(triggered()), this, SLOT(slotAddBookmark()));
- m_addBookmark->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_D));
-
- bookmarksActions.append(showAllBookmarksAction);
- bookmarksActions.append(m_addBookmark);
- bookmarksMenu->setInitialActions(bookmarksActions);
-
- // Window
- m_windowMenu = menuBar()->addMenu(tr("&Window"));
- connect(m_windowMenu, SIGNAL(aboutToShow()),
- this, SLOT(slotAboutToShowWindowMenu()));
- slotAboutToShowWindowMenu();
-
- QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools"));
- toolsMenu->addAction(tr("Web &Search"), this, SLOT(slotWebSearch()), QKeySequence(tr("Ctrl+K", "Web Search")));
-#ifndef Q_CC_MINGW
- a = toolsMenu->addAction(tr("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool)));
- a->setCheckable(true);
-#endif
-
- QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
- helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
- helpMenu->addAction(tr("About &Demo Browser"), this, SLOT(slotAboutApplication()));
-}
-
-void BrowserMainWindow::setupToolBar()
-{
- setUnifiedTitleAndToolBarOnMac(true);
- m_navigationBar = addToolBar(tr("Navigation"));
- connect(m_navigationBar->toggleViewAction(), SIGNAL(toggled(bool)),
- this, SLOT(updateToolbarActionText(bool)));
-
- m_historyBack->setIcon(style()->standardIcon(QStyle::SP_ArrowBack, 0, this));
- m_historyBackMenu = new QMenu(this);
- m_historyBack->setMenu(m_historyBackMenu);
- connect(m_historyBackMenu, SIGNAL(aboutToShow()),
- this, SLOT(slotAboutToShowBackMenu()));
- connect(m_historyBackMenu, SIGNAL(triggered(QAction *)),
- this, SLOT(slotOpenActionUrl(QAction *)));
- m_navigationBar->addAction(m_historyBack);
-
- m_historyForward->setIcon(style()->standardIcon(QStyle::SP_ArrowForward, 0, this));
- m_historyForwardMenu = new QMenu(this);
- connect(m_historyForwardMenu, SIGNAL(aboutToShow()),
- this, SLOT(slotAboutToShowForwardMenu()));
- connect(m_historyForwardMenu, SIGNAL(triggered(QAction *)),
- this, SLOT(slotOpenActionUrl(QAction *)));
- m_historyForward->setMenu(m_historyForwardMenu);
- m_navigationBar->addAction(m_historyForward);
-
- m_stopReload = new QAction(this);
- m_reloadIcon = style()->standardIcon(QStyle::SP_BrowserReload);
- m_stopReload->setIcon(m_reloadIcon);
-
- m_navigationBar->addAction(m_stopReload);
-
- m_navigationBar->addWidget(m_tabWidget->lineEditStack());
-
- m_toolbarSearch = new ToolbarSearch(m_navigationBar);
- m_navigationBar->addWidget(m_toolbarSearch);
- connect(m_toolbarSearch, SIGNAL(search(const QUrl&)), SLOT(loadUrl(const QUrl&)));
-
- m_chaseWidget = new ChaseWidget(this);
- m_navigationBar->addWidget(m_chaseWidget);
-}
-
-void BrowserMainWindow::slotShowBookmarksDialog()
-{
- BookmarksDialog *dialog = new BookmarksDialog(this);
- connect(dialog, SIGNAL(openUrl(const QUrl&)),
- m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&)));
- dialog->show();
-}
-
-void BrowserMainWindow::slotAddBookmark()
-{
- WebView *webView = currentTab();
- QString url = webView->url().toString();
- QString title = webView->title();
- AddBookmarkDialog dialog(url, title);
- dialog.exec();
-}
-
-void BrowserMainWindow::slotViewToolbar()
-{
- if (m_navigationBar->isVisible()) {
- updateToolbarActionText(false);
- m_navigationBar->close();
- } else {
- updateToolbarActionText(true);
- m_navigationBar->show();
- }
- m_autoSaver->changeOccurred();
-}
-
-void BrowserMainWindow::slotViewBookmarksBar()
-{
- if (m_bookmarksToolbar->isVisible()) {
- updateBookmarksToolbarActionText(false);
- m_bookmarksToolbar->close();
- } else {
- updateBookmarksToolbarActionText(true);
- m_bookmarksToolbar->show();
- }
- m_autoSaver->changeOccurred();
-}
-
-void BrowserMainWindow::updateStatusbarActionText(bool visible)
-{
- m_viewStatusbar->setText(!visible ? tr("Show Status Bar") : tr("Hide Status Bar"));
-}
-
-void BrowserMainWindow::updateToolbarActionText(bool visible)
-{
- m_viewToolbar->setText(!visible ? tr("Show Toolbar") : tr("Hide Toolbar"));
-}
-
-void BrowserMainWindow::updateBookmarksToolbarActionText(bool visible)
-{
- m_viewBookmarkBar->setText(!visible ? tr("Show Bookmarks bar") : tr("Hide Bookmarks bar"));
-}
-
-void BrowserMainWindow::slotViewStatusbar()
-{
- if (statusBar()->isVisible()) {
- updateStatusbarActionText(false);
- statusBar()->close();
- } else {
- updateStatusbarActionText(true);
- statusBar()->show();
- }
- m_autoSaver->changeOccurred();
-}
-
-QUrl BrowserMainWindow::guessUrlFromString(const QString &string)
-{
- QString urlStr = string.trimmed();
- QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*"));
-
- // Check if it looks like a qualified URL. Try parsing it and see.
- bool hasSchema = test.exactMatch(urlStr);
- if (hasSchema) {
- QUrl url = QUrl::fromEncoded(urlStr.toUtf8(), QUrl::TolerantMode);
- if (url.isValid())
- return url;
- }
-
- // Might be a file.
- if (QFile::exists(urlStr)) {
- QFileInfo info(urlStr);
- return QUrl::fromLocalFile(info.absoluteFilePath());
- }
-
- // Might be a shorturl - try to detect the schema.
- if (!hasSchema) {
- int dotIndex = urlStr.indexOf(QLatin1Char('.'));
- if (dotIndex != -1) {
- QString prefix = urlStr.left(dotIndex).toLower();
- QByteArray schema = (prefix == QLatin1String("ftp")) ? prefix.toLatin1() : "http";
- QUrl url =
- QUrl::fromEncoded(schema + "://" + urlStr.toUtf8(), QUrl::TolerantMode);
- if (url.isValid())
- return url;
- }
- }
-
- // Fall back to QUrl's own tolerant parser.
- QUrl url = QUrl::fromEncoded(string.toUtf8(), QUrl::TolerantMode);
-
- // finally for cases where the user just types in a hostname add http
- if (url.scheme().isEmpty())
- url = QUrl::fromEncoded("http://" + string.toUtf8(), QUrl::TolerantMode);
- return url;
-}
-
-void BrowserMainWindow::loadUrl(const QUrl &url)
-{
- if (!currentTab() || !url.isValid())
- return;
-
- m_tabWidget->currentLineEdit()->setText(QString::fromUtf8(url.toEncoded()));
- m_tabWidget->loadUrlInCurrentTab(url);
-}
-
-void BrowserMainWindow::slotDownloadManager()
-{
- BrowserApplication::downloadManager()->show();
-}
-
-void BrowserMainWindow::slotSelectLineEdit()
-{
- m_tabWidget->currentLineEdit()->selectAll();
- m_tabWidget->currentLineEdit()->setFocus();
-}
-
-void BrowserMainWindow::slotFileSaveAs()
-{
- BrowserApplication::downloadManager()->download(currentTab()->url(), true);
-}
-
-void BrowserMainWindow::slotPreferences()
-{
- SettingsDialog *s = new SettingsDialog(this);
- s->show();
-}
-
-void BrowserMainWindow::slotUpdateStatusbar(const QString &string)
-{
- statusBar()->showMessage(string, 2000);
-}
-
-void BrowserMainWindow::slotUpdateWindowTitle(const QString &title)
-{
- if (title.isEmpty()) {
- setWindowTitle(tr("Qt Demo Browser"));
- } else {
-#if defined(Q_WS_MAC)
- setWindowTitle(title);
-#else
- setWindowTitle(tr("%1 - Qt Demo Browser", "Page title and Browser name").arg(title));
-#endif
- }
-}
-
-void BrowserMainWindow::slotAboutApplication()
-{
- QMessageBox::about(this, tr("About"), tr(
- "Version %1"
- "<p>This demo demonstrates Qt's "
- "webkit facilities in action, providing an example "
- "browser for you to experiment with.<p>"
- "<p>QtWebKit is based on the Open Source WebKit Project developed at <a href=\"http://webkit.org/\">http://webkit.org/</a>."
- ).arg(QCoreApplication::applicationVersion()));
-}
-
-void BrowserMainWindow::slotFileNew()
-{
- BrowserApplication::instance()->newMainWindow();
- BrowserMainWindow *mw = BrowserApplication::instance()->mainWindow();
- mw->slotHome();
-}
-
-void BrowserMainWindow::slotFileOpen()
-{
- QString file = QFileDialog::getOpenFileName(this, tr("Open Web Resource"), QString(),
- tr("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)"));
-
- if (file.isEmpty())
- return;
-
- loadPage(file);
-}
-
-void BrowserMainWindow::slotFilePrintPreview()
-{
-#ifndef QT_NO_PRINTER
- if (!currentTab())
- return;
- QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this);
- connect(dialog, SIGNAL(paintRequested(QPrinter *)),
- currentTab(), SLOT(print(QPrinter *)));
- dialog->exec();
-#endif
-}
-
-void BrowserMainWindow::slotFilePrint()
-{
- if (!currentTab())
- return;
- printRequested(currentTab()->page()->mainFrame());
-}
-
-void BrowserMainWindow::printRequested(QWebFrame *frame)
-{
-#ifndef QT_NO_PRINTER
- QPrinter printer;
- QPrintDialog *dialog = new QPrintDialog(&printer, this);
- dialog->setWindowTitle(tr("Print Document"));
- if (dialog->exec() != QDialog::Accepted)
- return;
- frame->print(&printer);
-#endif
-}
-
-void BrowserMainWindow::slotPrivateBrowsing()
-{
- QWebSettings *settings = QWebSettings::globalSettings();
- bool pb = settings->testAttribute(QWebSettings::PrivateBrowsingEnabled);
- if (!pb) {
- QString title = tr("Are you sure you want to turn on private browsing?");
- QString text = tr("<b>%1</b><br><br>When private browsing in turned on,"
- " webpages are not added to the history,"
- " items are automatically removed from the Downloads window," \
- " new cookies are not stored, current cookies can't be accessed," \
- " site icons wont be stored, session wont be saved, " \
- " and searches are not addded to the pop-up menu in the Google search box." \
- " Until you close the window, you can still click the Back and Forward buttons" \
- " to return to the webpages you have opened.").arg(title);
-
- QMessageBox::StandardButton button = QMessageBox::question(this, QString(), text,
- QMessageBox::Ok | QMessageBox::Cancel,
- QMessageBox::Ok);
- if (button == QMessageBox::Ok) {
- settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
- }
- } else {
- settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false);
-
- QList<BrowserMainWindow*> windows = BrowserApplication::instance()->mainWindows();
- for (int i = 0; i < windows.count(); ++i) {
- BrowserMainWindow *window = windows.at(i);
- window->m_lastSearch = QString::null;
- window->tabWidget()->clear();
- }
- }
-}
-
-void BrowserMainWindow::closeEvent(QCloseEvent *event)
-{
- if (m_tabWidget->count() > 1) {
- int ret = QMessageBox::warning(this, QString(),
- tr("Are you sure you want to close the window?"
- " There are %1 tab open").arg(m_tabWidget->count()),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::No);
- if (ret == QMessageBox::No) {
- event->ignore();
- return;
- }
- }
- event->accept();
- deleteLater();
-}
-
-void BrowserMainWindow::slotEditFind()
-{
- if (!currentTab())
- return;
- bool ok;
- QString search = QInputDialog::getText(this, tr("Find"),
- tr("Text:"), QLineEdit::Normal,
- m_lastSearch, &ok);
- if (ok && !search.isEmpty()) {
- m_lastSearch = search;
- if (!currentTab()->findText(m_lastSearch))
- slotUpdateStatusbar(tr("\"%1\" not found.").arg(m_lastSearch));
- }
-}
-
-void BrowserMainWindow::slotEditFindNext()
-{
- if (!currentTab() && !m_lastSearch.isEmpty())
- return;
- currentTab()->findText(m_lastSearch);
-}
-
-void BrowserMainWindow::slotEditFindPrevious()
-{
- if (!currentTab() && !m_lastSearch.isEmpty())
- return;
- currentTab()->findText(m_lastSearch, QWebPage::FindBackward);
-}
-
-void BrowserMainWindow::slotViewZoomIn()
-{
- if (!currentTab())
- return;
- currentTab()->setZoomFactor(currentTab()->zoomFactor() + 0.1);
-}
-
-void BrowserMainWindow::slotViewZoomOut()
-{
- if (!currentTab())
- return;
- currentTab()->setZoomFactor(currentTab()->zoomFactor() - 0.1);
-}
-
-void BrowserMainWindow::slotViewResetZoom()
-{
- if (!currentTab())
- return;
- currentTab()->setZoomFactor(1.0);
-}
-
-void BrowserMainWindow::slotViewZoomTextOnly(bool enable)
-{
- if (!currentTab())
- return;
- currentTab()->page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, enable);
-}
-
-void BrowserMainWindow::slotViewFullScreen(bool makeFullScreen)
-{
- if (makeFullScreen) {
- showFullScreen();
- } else {
- if (isMinimized())
- showMinimized();
- else if (isMaximized())
- showMaximized();
- else showNormal();
- }
-}
-
-void BrowserMainWindow::slotViewPageSource()
-{
- if (!currentTab())
- return;
-
- QString markup = currentTab()->page()->mainFrame()->toHtml();
- QPlainTextEdit *view = new QPlainTextEdit(markup);
- view->setWindowTitle(tr("Page Source of %1").arg(currentTab()->title()));
- view->setMinimumWidth(640);
- view->setAttribute(Qt::WA_DeleteOnClose);
- view->show();
-}
-
-void BrowserMainWindow::slotHome()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("MainWindow"));
- QString home = settings.value(QLatin1String("home"), QLatin1String("http://qtsoftware.com/")).toString();
- loadPage(home);
-}
-
-void BrowserMainWindow::slotWebSearch()
-{
- m_toolbarSearch->lineEdit()->selectAll();
- m_toolbarSearch->lineEdit()->setFocus();
-}
-
-void BrowserMainWindow::slotToggleInspector(bool enable)
-{
- QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable);
- if (enable) {
- int result = QMessageBox::question(this, tr("Web Inspector"),
- tr("The web inspector will only work correctly for pages that were loaded after enabling.\n"
- "Do you want to reload all pages?"),
- QMessageBox::Yes | QMessageBox::No);
- if (result == QMessageBox::Yes) {
- m_tabWidget->reloadAllTabs();
- }
- }
-}
-
-void BrowserMainWindow::slotSwapFocus()
-{
- if (currentTab()->hasFocus())
- m_tabWidget->currentLineEdit()->setFocus();
- else
- currentTab()->setFocus();
-}
-
-void BrowserMainWindow::loadPage(const QString &page)
-{
- QUrl url = guessUrlFromString(page);
- loadUrl(url);
-}
-
-TabWidget *BrowserMainWindow::tabWidget() const
-{
- return m_tabWidget;
-}
-
-WebView *BrowserMainWindow::currentTab() const
-{
- return m_tabWidget->currentWebView();
-}
-
-void BrowserMainWindow::slotLoadProgress(int progress)
-{
- if (progress < 100 && progress > 0) {
- m_chaseWidget->setAnimated(true);
- disconnect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger()));
- if (m_stopIcon.isNull())
- m_stopIcon = style()->standardIcon(QStyle::SP_BrowserStop);
- m_stopReload->setIcon(m_stopIcon);
- connect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger()));
- m_stopReload->setToolTip(tr("Stop loading the current page"));
- } else {
- m_chaseWidget->setAnimated(false);
- disconnect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger()));
- m_stopReload->setIcon(m_reloadIcon);
- connect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger()));
- m_stopReload->setToolTip(tr("Reload the current page"));
- }
-}
-
-void BrowserMainWindow::slotAboutToShowBackMenu()
-{
- m_historyBackMenu->clear();
- if (!currentTab())
- return;
- QWebHistory *history = currentTab()->history();
- int historyCount = history->count();
- for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) {
- QWebHistoryItem item = history->backItems(history->count()).at(i);
- QAction *action = new QAction(this);
- action->setData(-1*(historyCount-i-1));
- QIcon icon = BrowserApplication::instance()->icon(item.url());
- action->setIcon(icon);
- action->setText(item.title());
- m_historyBackMenu->addAction(action);
- }
-}
-
-void BrowserMainWindow::slotAboutToShowForwardMenu()
-{
- m_historyForwardMenu->clear();
- if (!currentTab())
- return;
- QWebHistory *history = currentTab()->history();
- int historyCount = history->count();
- for (int i = 0; i < history->forwardItems(history->count()).count(); ++i) {
- QWebHistoryItem item = history->forwardItems(historyCount).at(i);
- QAction *action = new QAction(this);
- action->setData(historyCount-i);
- QIcon icon = BrowserApplication::instance()->icon(item.url());
- action->setIcon(icon);
- action->setText(item.title());
- m_historyForwardMenu->addAction(action);
- }
-}
-
-void BrowserMainWindow::slotAboutToShowWindowMenu()
-{
- m_windowMenu->clear();
- m_windowMenu->addAction(m_tabWidget->nextTabAction());
- m_windowMenu->addAction(m_tabWidget->previousTabAction());
- m_windowMenu->addSeparator();
- m_windowMenu->addAction(tr("Downloads"), this, SLOT(slotDownloadManager()), QKeySequence(tr("Alt+Ctrl+L", "Download Manager")));
-
- m_windowMenu->addSeparator();
- QList<BrowserMainWindow*> windows = BrowserApplication::instance()->mainWindows();
- for (int i = 0; i < windows.count(); ++i) {
- BrowserMainWindow *window = windows.at(i);
- QAction *action = m_windowMenu->addAction(window->windowTitle(), this, SLOT(slotShowWindow()));
- action->setData(i);
- action->setCheckable(true);
- if (window == this)
- action->setChecked(true);
- }
-}
-
-void BrowserMainWindow::slotShowWindow()
-{
- if (QAction *action = qobject_cast<QAction*>(sender())) {
- QVariant v = action->data();
- if (v.canConvert<int>()) {
- int offset = qvariant_cast<int>(v);
- QList<BrowserMainWindow*> windows = BrowserApplication::instance()->mainWindows();
- windows.at(offset)->activateWindow();
- windows.at(offset)->currentTab()->setFocus();
- }
- }
-}
-
-void BrowserMainWindow::slotOpenActionUrl(QAction *action)
-{
- int offset = action->data().toInt();
- QWebHistory *history = currentTab()->history();
- if (offset < 0)
- history->goToItem(history->backItems(-1*offset).first()); // back
- else if (offset > 0)
- history->goToItem(history->forwardItems(history->count() - offset + 1).back()); // forward
- }
-
-void BrowserMainWindow::geometryChangeRequested(const QRect &geometry)
-{
- setGeometry(geometry);
-}
-
diff --git a/examples/gestures/browser/browsermainwindow.h b/examples/gestures/browser/browsermainwindow.h
deleted file mode 100644
index 04f6c0c..0000000
--- a/examples/gestures/browser/browsermainwindow.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BROWSERMAINWINDOW_H
-#define BROWSERMAINWINDOW_H
-
-#include <QtGui/QMainWindow>
-#include <QtGui/QIcon>
-#include <QtCore/QUrl>
-
-class AutoSaver;
-class BookmarksToolBar;
-class ChaseWidget;
-class QWebFrame;
-class TabWidget;
-class ToolbarSearch;
-class WebView;
-
-/*!
- The MainWindow of the Browser Application.
-
- Handles the tab widget and all the actions
- */
-class BrowserMainWindow : public QMainWindow {
- Q_OBJECT
-
-public:
- BrowserMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
- ~BrowserMainWindow();
- QSize sizeHint() const;
-
-public:
- static QUrl guessUrlFromString(const QString &url);
- TabWidget *tabWidget() const;
- WebView *currentTab() const;
- QByteArray saveState(bool withTabs = true) const;
- bool restoreState(const QByteArray &state);
-
-public slots:
- void loadPage(const QString &url);
- void slotHome();
-
-protected:
- void closeEvent(QCloseEvent *event);
-
-private slots:
- void save();
-
- void slotLoadProgress(int);
- void slotUpdateStatusbar(const QString &string);
- void slotUpdateWindowTitle(const QString &title = QString());
-
- void loadUrl(const QUrl &url);
- void slotPreferences();
-
- void slotFileNew();
- void slotFileOpen();
- void slotFilePrintPreview();
- void slotFilePrint();
- void slotPrivateBrowsing();
- void slotFileSaveAs();
- void slotEditFind();
- void slotEditFindNext();
- void slotEditFindPrevious();
- void slotShowBookmarksDialog();
- void slotAddBookmark();
- void slotViewZoomIn();
- void slotViewZoomOut();
- void slotViewResetZoom();
- void slotViewZoomTextOnly(bool enable);
- void slotViewToolbar();
- void slotViewBookmarksBar();
- void slotViewStatusbar();
- void slotViewPageSource();
- void slotViewFullScreen(bool enable);
-
- void slotWebSearch();
- void slotToggleInspector(bool enable);
- void slotAboutApplication();
- void slotDownloadManager();
- void slotSelectLineEdit();
-
- void slotAboutToShowBackMenu();
- void slotAboutToShowForwardMenu();
- void slotAboutToShowWindowMenu();
- void slotOpenActionUrl(QAction *action);
- void slotShowWindow();
- void slotSwapFocus();
-
- void printRequested(QWebFrame *frame);
- void geometryChangeRequested(const QRect &geometry);
- void updateToolbarActionText(bool visible);
- void updateBookmarksToolbarActionText(bool visible);
-
-private:
- void loadDefaultState();
- void setupMenu();
- void setupToolBar();
- void updateStatusbarActionText(bool visible);
-
-private:
- QToolBar *m_navigationBar;
- ToolbarSearch *m_toolbarSearch;
- BookmarksToolBar *m_bookmarksToolbar;
- ChaseWidget *m_chaseWidget;
- TabWidget *m_tabWidget;
- AutoSaver *m_autoSaver;
-
- QAction *m_historyBack;
- QMenu *m_historyBackMenu;
- QAction *m_historyForward;
- QMenu *m_historyForwardMenu;
- QMenu *m_windowMenu;
-
- QAction *m_stop;
- QAction *m_reload;
- QAction *m_stopReload;
- QAction *m_viewToolbar;
- QAction *m_viewBookmarkBar;
- QAction *m_viewStatusbar;
- QAction *m_restoreLastSession;
- QAction *m_addBookmark;
-
- QIcon m_reloadIcon;
- QIcon m_stopIcon;
-
- QString m_lastSearch;
-};
-
-#endif // BROWSERMAINWINDOW_H
-
diff --git a/examples/gestures/browser/chasewidget.cpp b/examples/gestures/browser/chasewidget.cpp
deleted file mode 100644
index de6c90b..0000000
--- a/examples/gestures/browser/chasewidget.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chasewidget.h"
-
-#include <QtCore/QPoint>
-
-#include <QtGui/QApplication>
-#include <QtGui/QHideEvent>
-#include <QtGui/QPainter>
-#include <QtGui/QPaintEvent>
-#include <QtGui/QShowEvent>
-
-ChaseWidget::ChaseWidget(QWidget *parent, QPixmap pixmap, bool pixmapEnabled)
- : QWidget(parent)
- , m_segment(0)
- , m_delay(100)
- , m_step(40)
- , m_timerId(-1)
- , m_animated(false)
- , m_pixmap(pixmap)
- , m_pixmapEnabled(pixmapEnabled)
-{
-}
-
-void ChaseWidget::setAnimated(bool value)
-{
- if (m_animated == value)
- return;
- m_animated = value;
- if (m_timerId != -1) {
- killTimer(m_timerId);
- m_timerId = -1;
- }
- if (m_animated) {
- m_segment = 0;
- m_timerId = startTimer(m_delay);
- }
- update();
-}
-
-void ChaseWidget::paintEvent(QPaintEvent *event)
-{
- Q_UNUSED(event);
- QPainter p(this);
- if (m_pixmapEnabled && !m_pixmap.isNull()) {
- p.drawPixmap(0, 0, m_pixmap);
- return;
- }
-
- const int extent = qMin(width() - 8, height() - 8);
- const int displ = extent / 4;
- const int ext = extent / 4 - 1;
-
- p.setRenderHint(QPainter::Antialiasing, true);
-
- if(m_animated)
- p.setPen(Qt::gray);
- else
- p.setPen(QPen(palette().dark().color()));
-
- p.translate(width() / 2, height() / 2); // center
-
- for (int segment = 0; segment < segmentCount(); ++segment) {
- p.rotate(QApplication::isRightToLeft() ? m_step : -m_step);
- if(m_animated)
- p.setBrush(colorForSegment(segment));
- else
- p.setBrush(palette().background());
- p.drawEllipse(QRect(displ, -ext / 2, ext, ext));
- }
-}
-
-QSize ChaseWidget::sizeHint() const
-{
- return QSize(32, 32);
-}
-
-void ChaseWidget::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() == m_timerId) {
- ++m_segment;
- update();
- }
- QWidget::timerEvent(event);
-}
-
-QColor ChaseWidget::colorForSegment(int seg) const
-{
- int index = ((seg + m_segment) % segmentCount());
- int comp = qMax(0, 255 - (index * (255 / segmentCount())));
- return QColor(comp, comp, comp, 255);
-}
-
-int ChaseWidget::segmentCount() const
-{
- return 360 / m_step;
-}
-
-void ChaseWidget::setPixmapEnabled(bool enable)
-{
- m_pixmapEnabled = enable;
-}
-
diff --git a/examples/gestures/browser/chasewidget.h b/examples/gestures/browser/chasewidget.h
deleted file mode 100644
index 5b983e4..0000000
--- a/examples/gestures/browser/chasewidget.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHASEWIDGET_H
-#define CHASEWIDGET_H
-
-#include <QtGui/QWidget>
-
-#include <QtCore/QSize>
-#include <QtGui/QColor>
-#include <QtGui/QPixmap>
-
-QT_BEGIN_NAMESPACE
-class QHideEvent;
-class QShowEvent;
-class QPaintEvent;
-class QTimerEvent;
-QT_END_NAMESPACE
-
-class ChaseWidget : public QWidget
-{
- Q_OBJECT
-public:
- ChaseWidget(QWidget *parent = 0, QPixmap pixmap = QPixmap(), bool pixmapEnabled = false);
-
- void setAnimated(bool value);
- void setPixmapEnabled(bool enable);
- QSize sizeHint() const;
-
-protected:
- void paintEvent(QPaintEvent *event);
- void timerEvent(QTimerEvent *event);
-
-private:
- int segmentCount() const;
- QColor colorForSegment(int segment) const;
-
- int m_segment;
- int m_delay;
- int m_step;
- int m_timerId;
- bool m_animated;
- QPixmap m_pixmap;
- bool m_pixmapEnabled;
-};
-
-#endif
diff --git a/examples/gestures/browser/cookiejar.cpp b/examples/gestures/browser/cookiejar.cpp
deleted file mode 100644
index 3ae443f..0000000
--- a/examples/gestures/browser/cookiejar.cpp
+++ /dev/null
@@ -1,733 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cookiejar.h"
-
-#include "autosaver.h"
-
-#include <QtCore/QDateTime>
-#include <QtCore/QDir>
-#include <QtCore/QFile>
-#include <QtCore/QMetaEnum>
-#include <QtCore/QSettings>
-#include <QtCore/QUrl>
-
-#include <QtGui/QCompleter>
-#include <QtGui/QDesktopServices>
-#include <QtGui/QFont>
-#include <QtGui/QFontMetrics>
-#include <QtGui/QHeaderView>
-#include <QtGui/QKeyEvent>
-#include <QtGui/QSortFilterProxyModel>
-
-#include <QtWebKit/QWebSettings>
-
-#include <QtCore/QDebug>
-
-static const unsigned int JAR_VERSION = 23;
-
-QT_BEGIN_NAMESPACE
-QDataStream &operator<<(QDataStream &stream, const QList<QNetworkCookie> &list)
-{
- stream << JAR_VERSION;
- stream << quint32(list.size());
- for (int i = 0; i < list.size(); ++i)
- stream << list.at(i).toRawForm();
- return stream;
-}
-
-QDataStream &operator>>(QDataStream &stream, QList<QNetworkCookie> &list)
-{
- list.clear();
-
- quint32 version;
- stream >> version;
-
- if (version != JAR_VERSION)
- return stream;
-
- quint32 count;
- stream >> count;
- for(quint32 i = 0; i < count; ++i)
- {
- QByteArray value;
- stream >> value;
- QList<QNetworkCookie> newCookies = QNetworkCookie::parseCookies(value);
- if (newCookies.count() == 0 && value.length() != 0) {
- qWarning() << "CookieJar: Unable to parse saved cookie:" << value;
- }
- for (int j = 0; j < newCookies.count(); ++j)
- list.append(newCookies.at(j));
- if (stream.atEnd())
- break;
- }
- return stream;
-}
-QT_END_NAMESPACE
-
-CookieJar::CookieJar(QObject *parent)
- : QNetworkCookieJar(parent)
- , m_loaded(false)
- , m_saveTimer(new AutoSaver(this))
- , m_acceptCookies(AcceptOnlyFromSitesNavigatedTo)
-{
-}
-
-CookieJar::~CookieJar()
-{
- if (m_keepCookies == KeepUntilExit)
- clear();
- m_saveTimer->saveIfNeccessary();
-}
-
-void CookieJar::clear()
-{
- setAllCookies(QList<QNetworkCookie>());
- m_saveTimer->changeOccurred();
- emit cookiesChanged();
-}
-
-void CookieJar::load()
-{
- if (m_loaded)
- return;
- // load cookies and exceptions
- qRegisterMetaTypeStreamOperators<QList<QNetworkCookie> >("QList<QNetworkCookie>");
- QSettings cookieSettings(QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/cookies.ini"), QSettings::IniFormat);
- setAllCookies(qvariant_cast<QList<QNetworkCookie> >(cookieSettings.value(QLatin1String("cookies"))));
- cookieSettings.beginGroup(QLatin1String("Exceptions"));
- m_exceptions_block = cookieSettings.value(QLatin1String("block")).toStringList();
- m_exceptions_allow = cookieSettings.value(QLatin1String("allow")).toStringList();
- m_exceptions_allowForSession = cookieSettings.value(QLatin1String("allowForSession")).toStringList();
- qSort(m_exceptions_block.begin(), m_exceptions_block.end());
- qSort(m_exceptions_allow.begin(), m_exceptions_allow.end());
- qSort(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end());
-
- loadSettings();
-}
-
-void CookieJar::loadSettings()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("cookies"));
- QByteArray value = settings.value(QLatin1String("acceptCookies"),
- QLatin1String("AcceptOnlyFromSitesNavigatedTo")).toByteArray();
- QMetaEnum acceptPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("AcceptPolicy"));
- m_acceptCookies = acceptPolicyEnum.keyToValue(value) == -1 ?
- AcceptOnlyFromSitesNavigatedTo :
- static_cast<AcceptPolicy>(acceptPolicyEnum.keyToValue(value));
-
- value = settings.value(QLatin1String("keepCookiesUntil"), QLatin1String("KeepUntilExpire")).toByteArray();
- QMetaEnum keepPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("KeepPolicy"));
- m_keepCookies = keepPolicyEnum.keyToValue(value) == -1 ?
- KeepUntilExpire :
- static_cast<KeepPolicy>(keepPolicyEnum.keyToValue(value));
-
- if (m_keepCookies == KeepUntilExit)
- setAllCookies(QList<QNetworkCookie>());
-
- m_loaded = true;
- emit cookiesChanged();
-}
-
-void CookieJar::save()
-{
- if (!m_loaded)
- return;
- purgeOldCookies();
- QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
- if (directory.isEmpty())
- directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName();
- if (!QFile::exists(directory)) {
- QDir dir;
- dir.mkpath(directory);
- }
- QSettings cookieSettings(directory + QLatin1String("/cookies.ini"), QSettings::IniFormat);
- QList<QNetworkCookie> cookies = allCookies();
- for (int i = cookies.count() - 1; i >= 0; --i) {
- if (cookies.at(i).isSessionCookie())
- cookies.removeAt(i);
- }
- cookieSettings.setValue(QLatin1String("cookies"), qVariantFromValue<QList<QNetworkCookie> >(cookies));
- cookieSettings.beginGroup(QLatin1String("Exceptions"));
- cookieSettings.setValue(QLatin1String("block"), m_exceptions_block);
- cookieSettings.setValue(QLatin1String("allow"), m_exceptions_allow);
- cookieSettings.setValue(QLatin1String("allowForSession"), m_exceptions_allowForSession);
-
- // save cookie settings
- QSettings settings;
- settings.beginGroup(QLatin1String("cookies"));
- QMetaEnum acceptPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("AcceptPolicy"));
- settings.setValue(QLatin1String("acceptCookies"), QLatin1String(acceptPolicyEnum.valueToKey(m_acceptCookies)));
-
- QMetaEnum keepPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("KeepPolicy"));
- settings.setValue(QLatin1String("keepCookiesUntil"), QLatin1String(keepPolicyEnum.valueToKey(m_keepCookies)));
-}
-
-void CookieJar::purgeOldCookies()
-{
- QList<QNetworkCookie> cookies = allCookies();
- if (cookies.isEmpty())
- return;
- int oldCount = cookies.count();
- QDateTime now = QDateTime::currentDateTime();
- for (int i = cookies.count() - 1; i >= 0; --i) {
- if (!cookies.at(i).isSessionCookie() && cookies.at(i).expirationDate() < now)
- cookies.removeAt(i);
- }
- if (oldCount == cookies.count())
- return;
- setAllCookies(cookies);
- emit cookiesChanged();
-}
-
-QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl &url) const
-{
- CookieJar *that = const_cast<CookieJar*>(this);
- if (!m_loaded)
- that->load();
-
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
- QList<QNetworkCookie> noCookies;
- return noCookies;
- }
-
- return QNetworkCookieJar::cookiesForUrl(url);
-}
-
-bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url)
-{
- if (!m_loaded)
- load();
-
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- return false;
-
- QString host = url.host();
- bool eBlock = qBinaryFind(m_exceptions_block.begin(), m_exceptions_block.end(), host) != m_exceptions_block.end();
- bool eAllow = qBinaryFind(m_exceptions_allow.begin(), m_exceptions_allow.end(), host) != m_exceptions_allow.end();
- bool eAllowSession = qBinaryFind(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end(), host) != m_exceptions_allowForSession.end();
-
- bool addedCookies = false;
- // pass exceptions
- bool acceptInitially = (m_acceptCookies != AcceptNever);
- if ((acceptInitially && !eBlock)
- || (!acceptInitially && (eAllow || eAllowSession))) {
- // pass url domain == cookie domain
- QDateTime soon = QDateTime::currentDateTime();
- soon = soon.addDays(90);
- foreach(QNetworkCookie cookie, cookieList) {
- QList<QNetworkCookie> lst;
- if (m_keepCookies == KeepUntilTimeLimit
- && !cookie.isSessionCookie()
- && cookie.expirationDate() > soon) {
- cookie.setExpirationDate(soon);
- }
- lst += cookie;
- if (QNetworkCookieJar::setCookiesFromUrl(lst, url)) {
- addedCookies = true;
- } else {
- // finally force it in if wanted
- if (m_acceptCookies == AcceptAlways) {
- QList<QNetworkCookie> cookies = allCookies();
- cookies += cookie;
- setAllCookies(cookies);
- addedCookies = true;
- }
-#if 0
- else
- qWarning() << "setCookiesFromUrl failed" << url << cookieList.value(0).toRawForm();
-#endif
- }
- }
- }
-
- if (addedCookies) {
- m_saveTimer->changeOccurred();
- emit cookiesChanged();
- }
- return addedCookies;
-}
-
-CookieJar::AcceptPolicy CookieJar::acceptPolicy() const
-{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
- return m_acceptCookies;
-}
-
-void CookieJar::setAcceptPolicy(AcceptPolicy policy)
-{
- if (!m_loaded)
- load();
- if (policy == m_acceptCookies)
- return;
- m_acceptCookies = policy;
- m_saveTimer->changeOccurred();
-}
-
-CookieJar::KeepPolicy CookieJar::keepPolicy() const
-{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
- return m_keepCookies;
-}
-
-void CookieJar::setKeepPolicy(KeepPolicy policy)
-{
- if (!m_loaded)
- load();
- if (policy == m_keepCookies)
- return;
- m_keepCookies = policy;
- m_saveTimer->changeOccurred();
-}
-
-QStringList CookieJar::blockedCookies() const
-{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
- return m_exceptions_block;
-}
-
-QStringList CookieJar::allowedCookies() const
-{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
- return m_exceptions_allow;
-}
-
-QStringList CookieJar::allowForSessionCookies() const
-{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
- return m_exceptions_allowForSession;
-}
-
-void CookieJar::setBlockedCookies(const QStringList &list)
-{
- if (!m_loaded)
- load();
- m_exceptions_block = list;
- qSort(m_exceptions_block.begin(), m_exceptions_block.end());
- m_saveTimer->changeOccurred();
-}
-
-void CookieJar::setAllowedCookies(const QStringList &list)
-{
- if (!m_loaded)
- load();
- m_exceptions_allow = list;
- qSort(m_exceptions_allow.begin(), m_exceptions_allow.end());
- m_saveTimer->changeOccurred();
-}
-
-void CookieJar::setAllowForSessionCookies(const QStringList &list)
-{
- if (!m_loaded)
- load();
- m_exceptions_allowForSession = list;
- qSort(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end());
- m_saveTimer->changeOccurred();
-}
-
-CookieModel::CookieModel(CookieJar *cookieJar, QObject *parent)
- : QAbstractTableModel(parent)
- , m_cookieJar(cookieJar)
-{
- connect(m_cookieJar, SIGNAL(cookiesChanged()), this, SLOT(cookiesChanged()));
- m_cookieJar->load();
-}
-
-QVariant CookieModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (role == Qt::SizeHintRole) {
- QFont font;
- font.setPointSize(10);
- QFontMetrics fm(font);
- int height = fm.height() + fm.height()/3;
- int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString());
- return QSize(width, height);
- }
-
- if (orientation == Qt::Horizontal) {
- if (role != Qt::DisplayRole)
- return QVariant();
-
- switch (section) {
- case 0:
- return tr("Website");
- case 1:
- return tr("Name");
- case 2:
- return tr("Path");
- case 3:
- return tr("Secure");
- case 4:
- return tr("Expires");
- case 5:
- return tr("Contents");
- default:
- return QVariant();
- }
- }
- return QAbstractTableModel::headerData(section, orientation, role);
-}
-
-QVariant CookieModel::data(const QModelIndex &index, int role) const
-{
- QList<QNetworkCookie> lst;
- if (m_cookieJar)
- lst = m_cookieJar->allCookies();
- if (index.row() < 0 || index.row() >= lst.size())
- return QVariant();
-
- switch (role) {
- case Qt::DisplayRole:
- case Qt::EditRole: {
- QNetworkCookie cookie = lst.at(index.row());
- switch (index.column()) {
- case 0:
- return cookie.domain();
- case 1:
- return cookie.name();
- case 2:
- return cookie.path();
- case 3:
- return cookie.isSecure();
- case 4:
- return cookie.expirationDate();
- case 5:
- return cookie.value();
- }
- }
- case Qt::FontRole:{
- QFont font;
- font.setPointSize(10);
- return font;
- }
- }
-
- return QVariant();
-}
-
-int CookieModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : 6;
-}
-
-int CookieModel::rowCount(const QModelIndex &parent) const
-{
- return (parent.isValid() || !m_cookieJar) ? 0 : m_cookieJar->allCookies().count();
-}
-
-bool CookieModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (parent.isValid() || !m_cookieJar)
- return false;
- int lastRow = row + count - 1;
- beginRemoveRows(parent, row, lastRow);
- QList<QNetworkCookie> lst = m_cookieJar->allCookies();
- for (int i = lastRow; i >= row; --i) {
- lst.removeAt(i);
- }
- m_cookieJar->setAllCookies(lst);
- endRemoveRows();
- return true;
-}
-
-void CookieModel::cookiesChanged()
-{
- reset();
-}
-
-CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent) : QDialog(parent)
-{
- setupUi(this);
- setWindowFlags(Qt::Sheet);
- CookieModel *model = new CookieModel(cookieJar, this);
- m_proxyModel = new QSortFilterProxyModel(this);
- connect(search, SIGNAL(textChanged(QString)),
- m_proxyModel, SLOT(setFilterFixedString(QString)));
- connect(removeButton, SIGNAL(clicked()), cookiesTable, SLOT(removeOne()));
- connect(removeAllButton, SIGNAL(clicked()), cookiesTable, SLOT(removeAll()));
- m_proxyModel->setSourceModel(model);
- cookiesTable->verticalHeader()->hide();
- cookiesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
- cookiesTable->setModel(m_proxyModel);
- cookiesTable->setAlternatingRowColors(true);
- cookiesTable->setTextElideMode(Qt::ElideMiddle);
- cookiesTable->setShowGrid(false);
- cookiesTable->setSortingEnabled(true);
- QFont f = font();
- f.setPointSize(10);
- QFontMetrics fm(f);
- int height = fm.height() + fm.height()/3;
- cookiesTable->verticalHeader()->setDefaultSectionSize(height);
- cookiesTable->verticalHeader()->setMinimumSectionSize(-1);
- for (int i = 0; i < model->columnCount(); ++i){
- int header = cookiesTable->horizontalHeader()->sectionSizeHint(i);
- switch (i) {
- case 0:
- header = fm.width(QLatin1String("averagehost.domain.com"));
- break;
- case 1:
- header = fm.width(QLatin1String("_session_id"));
- break;
- case 4:
- header = fm.width(QDateTime::currentDateTime().toString(Qt::LocalDate));
- break;
- }
- int buffer = fm.width(QLatin1String("xx"));
- header += buffer;
- cookiesTable->horizontalHeader()->resizeSection(i, header);
- }
- cookiesTable->horizontalHeader()->setStretchLastSection(true);
-}
-
-
-
-CookieExceptionsModel::CookieExceptionsModel(CookieJar *cookiejar, QObject *parent)
- : QAbstractTableModel(parent)
- , m_cookieJar(cookiejar)
-{
- m_allowedCookies = m_cookieJar->allowedCookies();
- m_blockedCookies = m_cookieJar->blockedCookies();
- m_sessionCookies = m_cookieJar->allowForSessionCookies();
-}
-
-QVariant CookieExceptionsModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (role == Qt::SizeHintRole) {
- QFont font;
- font.setPointSize(10);
- QFontMetrics fm(font);
- int height = fm.height() + fm.height()/3;
- int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString());
- return QSize(width, height);
- }
-
- if (orientation == Qt::Horizontal
- && role == Qt::DisplayRole) {
- switch (section) {
- case 0:
- return tr("Website");
- case 1:
- return tr("Status");
- }
- }
- return QAbstractTableModel::headerData(section, orientation, role);
-}
-
-QVariant CookieExceptionsModel::data(const QModelIndex &index, int role) const
-{
- if (index.row() < 0 || index.row() >= rowCount())
- return QVariant();
-
- switch (role) {
- case Qt::DisplayRole:
- case Qt::EditRole: {
- int row = index.row();
- if (row < m_allowedCookies.count()) {
- switch (index.column()) {
- case 0:
- return m_allowedCookies.at(row);
- case 1:
- return tr("Allow");
- }
- }
- row = row - m_allowedCookies.count();
- if (row < m_blockedCookies.count()) {
- switch (index.column()) {
- case 0:
- return m_blockedCookies.at(row);
- case 1:
- return tr("Block");
- }
- }
- row = row - m_blockedCookies.count();
- if (row < m_sessionCookies.count()) {
- switch (index.column()) {
- case 0:
- return m_sessionCookies.at(row);
- case 1:
- return tr("Allow For Session");
- }
- }
- }
- case Qt::FontRole:{
- QFont font;
- font.setPointSize(10);
- return font;
- }
- }
- return QVariant();
-}
-
-int CookieExceptionsModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : 2;
-}
-
-int CookieExceptionsModel::rowCount(const QModelIndex &parent) const
-{
- return (parent.isValid() || !m_cookieJar) ? 0 : m_allowedCookies.count() + m_blockedCookies.count() + m_sessionCookies.count();
-}
-
-bool CookieExceptionsModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (parent.isValid() || !m_cookieJar)
- return false;
-
- int lastRow = row + count - 1;
- beginRemoveRows(parent, row, lastRow);
- for (int i = lastRow; i >= row; --i) {
- if (i < m_allowedCookies.count()) {
- m_allowedCookies.removeAt(row);
- continue;
- }
- i = i - m_allowedCookies.count();
- if (i < m_blockedCookies.count()) {
- m_blockedCookies.removeAt(row);
- continue;
- }
- i = i - m_blockedCookies.count();
- if (i < m_sessionCookies.count()) {
- m_sessionCookies.removeAt(row);
- continue;
- }
- }
- m_cookieJar->setAllowedCookies(m_allowedCookies);
- m_cookieJar->setBlockedCookies(m_blockedCookies);
- m_cookieJar->setAllowForSessionCookies(m_sessionCookies);
- endRemoveRows();
- return true;
-}
-
-CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent)
- : QDialog(parent)
- , m_cookieJar(cookieJar)
-{
- setupUi(this);
- setWindowFlags(Qt::Sheet);
- connect(removeButton, SIGNAL(clicked()), exceptionTable, SLOT(removeOne()));
- connect(removeAllButton, SIGNAL(clicked()), exceptionTable, SLOT(removeAll()));
- exceptionTable->verticalHeader()->hide();
- exceptionTable->setSelectionBehavior(QAbstractItemView::SelectRows);
- exceptionTable->setAlternatingRowColors(true);
- exceptionTable->setTextElideMode(Qt::ElideMiddle);
- exceptionTable->setShowGrid(false);
- exceptionTable->setSortingEnabled(true);
- m_exceptionsModel = new CookieExceptionsModel(cookieJar, this);
- m_proxyModel = new QSortFilterProxyModel(this);
- m_proxyModel->setSourceModel(m_exceptionsModel);
- connect(search, SIGNAL(textChanged(QString)),
- m_proxyModel, SLOT(setFilterFixedString(QString)));
- exceptionTable->setModel(m_proxyModel);
-
- CookieModel *cookieModel = new CookieModel(cookieJar, this);
- domainLineEdit->setCompleter(new QCompleter(cookieModel, domainLineEdit));
-
- connect(domainLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(textChanged(const QString &)));
- connect(blockButton, SIGNAL(clicked()), this, SLOT(block()));
- connect(allowButton, SIGNAL(clicked()), this, SLOT(allow()));
- connect(allowForSessionButton, SIGNAL(clicked()), this, SLOT(allowForSession()));
-
- QFont f = font();
- f.setPointSize(10);
- QFontMetrics fm(f);
- int height = fm.height() + fm.height()/3;
- exceptionTable->verticalHeader()->setDefaultSectionSize(height);
- exceptionTable->verticalHeader()->setMinimumSectionSize(-1);
- for (int i = 0; i < m_exceptionsModel->columnCount(); ++i){
- int header = exceptionTable->horizontalHeader()->sectionSizeHint(i);
- switch (i) {
- case 0:
- header = fm.width(QLatin1String("averagebiglonghost.domain.com"));
- break;
- case 1:
- header = fm.width(QLatin1String("Allow For Session"));
- break;
- }
- int buffer = fm.width(QLatin1String("xx"));
- header += buffer;
- exceptionTable->horizontalHeader()->resizeSection(i, header);
- }
-}
-
-void CookiesExceptionsDialog::textChanged(const QString &text)
-{
- bool enabled = !text.isEmpty();
- blockButton->setEnabled(enabled);
- allowButton->setEnabled(enabled);
- allowForSessionButton->setEnabled(enabled);
-}
-
-void CookiesExceptionsDialog::block()
-{
- if (domainLineEdit->text().isEmpty())
- return;
- m_exceptionsModel->m_blockedCookies.append(domainLineEdit->text());
- m_cookieJar->setBlockedCookies(m_exceptionsModel->m_blockedCookies);
- m_exceptionsModel->reset();
-}
-
-void CookiesExceptionsDialog::allow()
-{
- if (domainLineEdit->text().isEmpty())
- return;
- m_exceptionsModel->m_allowedCookies.append(domainLineEdit->text());
- m_cookieJar->setAllowedCookies(m_exceptionsModel->m_allowedCookies);
- m_exceptionsModel->reset();
-}
-
-void CookiesExceptionsDialog::allowForSession()
-{
- if (domainLineEdit->text().isEmpty())
- return;
- m_exceptionsModel->m_sessionCookies.append(domainLineEdit->text());
- m_cookieJar->setAllowForSessionCookies(m_exceptionsModel->m_sessionCookies);
- m_exceptionsModel->reset();
-}
-
diff --git a/examples/gestures/browser/cookiejar.h b/examples/gestures/browser/cookiejar.h
deleted file mode 100644
index 55ba185..0000000
--- a/examples/gestures/browser/cookiejar.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef COOKIEJAR_H
-#define COOKIEJAR_H
-
-#include <QtNetwork/QNetworkCookieJar>
-
-#include <QtCore/QAbstractItemModel>
-#include <QtCore/QStringList>
-
-#include <QtGui/QDialog>
-#include <QtGui/QTableView>
-
-QT_BEGIN_NAMESPACE
-class QSortFilterProxyModel;
-class QKeyEvent;
-QT_END_NAMESPACE
-
-class AutoSaver;
-
-class CookieJar : public QNetworkCookieJar
-{
- friend class CookieModel;
- Q_OBJECT
- Q_PROPERTY(AcceptPolicy acceptPolicy READ acceptPolicy WRITE setAcceptPolicy)
- Q_PROPERTY(KeepPolicy keepPolicy READ keepPolicy WRITE setKeepPolicy)
- Q_PROPERTY(QStringList blockedCookies READ blockedCookies WRITE setBlockedCookies)
- Q_PROPERTY(QStringList allowedCookies READ allowedCookies WRITE setAllowedCookies)
- Q_PROPERTY(QStringList allowForSessionCookies READ allowForSessionCookies WRITE setAllowForSessionCookies)
- Q_ENUMS(KeepPolicy)
- Q_ENUMS(AcceptPolicy)
-
-signals:
- void cookiesChanged();
-
-public:
- enum AcceptPolicy {
- AcceptAlways,
- AcceptNever,
- AcceptOnlyFromSitesNavigatedTo
- };
-
- enum KeepPolicy {
- KeepUntilExpire,
- KeepUntilExit,
- KeepUntilTimeLimit
- };
-
- CookieJar(QObject *parent = 0);
- ~CookieJar();
-
- QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const;
- bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
-
- AcceptPolicy acceptPolicy() const;
- void setAcceptPolicy(AcceptPolicy policy);
-
- KeepPolicy keepPolicy() const;
- void setKeepPolicy(KeepPolicy policy);
-
- QStringList blockedCookies() const;
- QStringList allowedCookies() const;
- QStringList allowForSessionCookies() const;
-
- void setBlockedCookies(const QStringList &list);
- void setAllowedCookies(const QStringList &list);
- void setAllowForSessionCookies(const QStringList &list);
-
-public slots:
- void clear();
- void loadSettings();
-
-private slots:
- void save();
-
-private:
- void purgeOldCookies();
- void load();
- bool m_loaded;
- AutoSaver *m_saveTimer;
-
- AcceptPolicy m_acceptCookies;
- KeepPolicy m_keepCookies;
-
- QStringList m_exceptions_block;
- QStringList m_exceptions_allow;
- QStringList m_exceptions_allowForSession;
-};
-
-class CookieModel : public QAbstractTableModel
-{
- Q_OBJECT
-
-public:
- CookieModel(CookieJar *jar, QObject *parent = 0);
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
-
-private slots:
- void cookiesChanged();
-
-private:
- CookieJar *m_cookieJar;
-};
-
-#include "ui_cookies.h"
-#include "ui_cookiesexceptions.h"
-
-class CookiesDialog : public QDialog, public Ui_CookiesDialog
-{
- Q_OBJECT
-
-public:
- CookiesDialog(CookieJar *cookieJar, QWidget *parent = 0);
-
-private:
- QSortFilterProxyModel *m_proxyModel;
-};
-
-class CookieExceptionsModel : public QAbstractTableModel
-{
- Q_OBJECT
- friend class CookiesExceptionsDialog;
-
-public:
- CookieExceptionsModel(CookieJar *cookieJar, QObject *parent = 0);
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
-
-private:
- CookieJar *m_cookieJar;
-
- // Domains we allow, Domains we block, Domains we allow for this session
- QStringList m_allowedCookies;
- QStringList m_blockedCookies;
- QStringList m_sessionCookies;
-};
-
-class CookiesExceptionsDialog : public QDialog, public Ui_CookiesExceptionsDialog
-{
- Q_OBJECT
-
-public:
- CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent = 0);
-
-private slots:
- void block();
- void allow();
- void allowForSession();
- void textChanged(const QString &text);
-
-private:
- CookieExceptionsModel *m_exceptionsModel;
- QSortFilterProxyModel *m_proxyModel;
- CookieJar *m_cookieJar;
-};
-
-#endif // COOKIEJAR_H
-
diff --git a/examples/gestures/browser/cookies.ui b/examples/gestures/browser/cookies.ui
deleted file mode 100644
index c4bccc5..0000000
--- a/examples/gestures/browser/cookies.ui
+++ /dev/null
@@ -1,106 +0,0 @@
-<ui version="4.0" >
- <class>CookiesDialog</class>
- <widget class="QDialog" name="CookiesDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>550</width>
- <height>370</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Cookies</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>252</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1" >
- <widget class="SearchLineEdit" name="search" />
- </item>
- <item row="1" column="0" colspan="2" >
- <widget class="EditTableView" name="cookiesTable" />
- </item>
- <item row="2" column="0" colspan="2" >
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QPushButton" name="removeButton" >
- <property name="text" >
- <string>&amp;Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="removeAllButton" >
- <property name="text" >
- <string>Remove &amp;All Cookies</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="standardButtons" >
- <set>QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>SearchLineEdit</class>
- <extends>QLineEdit</extends>
- <header>searchlineedit.h</header>
- </customwidget>
- <customwidget>
- <class>EditTableView</class>
- <extends>QTableView</extends>
- <header>edittableview.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>CookiesDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>472</x>
- <y>329</y>
- </hint>
- <hint type="destinationlabel" >
- <x>461</x>
- <y>356</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/gestures/browser/cookiesexceptions.ui b/examples/gestures/browser/cookiesexceptions.ui
deleted file mode 100644
index 3d9ef62..0000000
--- a/examples/gestures/browser/cookiesexceptions.ui
+++ /dev/null
@@ -1,184 +0,0 @@
-<ui version="4.0" >
- <class>CookiesExceptionsDialog</class>
- <widget class="QDialog" name="CookiesExceptionsDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>466</width>
- <height>446</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Cookie Exceptions</string>
- </property>
- <layout class="QVBoxLayout" >
- <item>
- <widget class="QGroupBox" name="newExceptionGroupBox" >
- <property name="title" >
- <string>New Exception</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Domain:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="domainLineEdit" />
- </item>
- </layout>
- </item>
- <item row="1" column="0" >
- <layout class="QHBoxLayout" >
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>81</width>
- <height>25</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="blockButton" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="text" >
- <string>Block</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="allowForSessionButton" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="text" >
- <string>Allow For Session</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="allowButton" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="text" >
- <string>Allow</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="ExceptionsGroupBox" >
- <property name="title" >
- <string>Exceptions</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" colspan="3" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>252</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="3" >
- <widget class="SearchLineEdit" name="search" />
- </item>
- <item row="1" column="0" colspan="4" >
- <widget class="EditTableView" name="exceptionTable" />
- </item>
- <item row="2" column="0" >
- <widget class="QPushButton" name="removeButton" >
- <property name="text" >
- <string>&amp;Remove</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QPushButton" name="removeAllButton" >
- <property name="text" >
- <string>Remove &amp;All</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2" colspan="2" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>SearchLineEdit</class>
- <extends>QLineEdit</extends>
- <header>searchlineedit.h</header>
- </customwidget>
- <customwidget>
- <class>EditTableView</class>
- <extends>QTableView</extends>
- <header>edittableview.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>CookiesExceptionsDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>381</x>
- <y>428</y>
- </hint>
- <hint type="destinationlabel" >
- <x>336</x>
- <y>443</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/gestures/browser/data/addtab.png b/examples/gestures/browser/data/addtab.png
deleted file mode 100644
index 20928fb..0000000
--- a/examples/gestures/browser/data/addtab.png
+++ /dev/null
Binary files differ
diff --git a/examples/gestures/browser/data/browser.svg b/examples/gestures/browser/data/browser.svg
deleted file mode 100644
index 4b0fa72..0000000
--- a/examples/gestures/browser/data/browser.svg
+++ /dev/null
@@ -1,411 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="48px"
- height="48px"
- id="svg2160"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- inkscape:export-filename="c:\icons\qtbrowser48.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90"
- sodipodi:docbase="C:\icons"
- sodipodi:docname="browser.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape">
- <defs
- id="defs2162"><linearGradient
- id="linearGradient3808">
- <stop
- id="stop3810"
- offset="0"
- style="stop-color:#000000;stop-opacity:0.54263568;" />
- <stop
- id="stop3812"
- offset="1"
- style="stop-color:#000000;stop-opacity:0;" />
-</linearGradient>
-<inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 24 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="48 : 24 : 1"
- inkscape:persp3d-origin="24 : 16 : 1"
- id="perspective63" />
-<linearGradient
- id="linearGradient3326">
- <stop
- style="stop-color:#000000;stop-opacity:0.3137255;"
- offset="0"
- id="stop3328" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3330" />
-</linearGradient>
-<linearGradient
- id="linearGradient3318">
- <stop
- style="stop-color:#000000;stop-opacity:0.3137255;"
- offset="0"
- id="stop3320" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3322" />
-</linearGradient>
-<linearGradient
- id="linearGradient3302">
- <stop
- style="stop-color:#000000;stop-opacity:0.3137255;"
- offset="0"
- id="stop3304" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3306" />
-</linearGradient>
-<linearGradient
- id="linearGradient3267">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop3269" />
- <stop
- id="stop3275"
- offset="0.79661018"
- style="stop-color:#000000;stop-opacity:1;" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3271" />
-</linearGradient>
-<linearGradient
- id="linearGradient3745">
- <stop
- style="stop-color:#ffffff;stop-opacity:0.19587629;"
- offset="0"
- id="stop3747" />
- <stop
- style="stop-color:#7cb2ff;stop-opacity:0.07216495;"
- offset="1"
- id="stop3749" />
-</linearGradient>
-<linearGradient
- inkscape:collect="always"
- id="linearGradient3561">
- <stop
- style="stop-color:#b1d0ff;stop-opacity:1;"
- offset="0"
- id="stop3563" />
- <stop
- style="stop-color:#b1d0ff;stop-opacity:0;"
- offset="1"
- id="stop3565" />
-</linearGradient>
-<linearGradient
- id="linearGradient3181">
- <stop
- style="stop-color:#4f7a33;stop-opacity:1;"
- offset="0"
- id="stop3183" />
- <stop
- style="stop-color:#204712;stop-opacity:1;"
- offset="1"
- id="stop3185" />
-</linearGradient>
-<linearGradient
- id="linearGradient3143">
- <stop
- style="stop-color:#c1dbff;stop-opacity:1;"
- offset="0"
- id="stop3145" />
- <stop
- style="stop-color:#004e92;stop-opacity:1;"
- offset="1"
- id="stop3147" />
-</linearGradient>
-<radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3143"
- id="radialGradient3149"
- cx="9.1428566"
- cy="15.142858"
- fx="9.1428566"
- fy="15.142858"
- r="20.121096"
- gradientUnits="userSpaceOnUse" />
-<radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3181"
- id="radialGradient3187"
- cx="10.739879"
- cy="18.250999"
- fx="10.739879"
- fy="18.250999"
- r="7.4191086"
- gradientTransform="matrix(1.0504709,0,0,1.5077925,-0.3797113,-9.2677171)"
- gradientUnits="userSpaceOnUse" />
-<radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3181"
- id="radialGradient3195"
- cx="14.947268"
- cy="35.920116"
- fx="14.947268"
- fy="35.920116"
- r="6.0472684"
- gradientTransform="matrix(1,0,0,0.7248478,0,9.8834985)"
- gradientUnits="userSpaceOnUse" />
-<radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3181"
- id="radialGradient3203"
- cx="34.227203"
- cy="24.681196"
- fx="34.227203"
- fy="24.681196"
- r="6.7517419"
- gradientTransform="matrix(0.9941509,-0.1079997,0.2962199,2.7267411,-7.1108629,-38.921508)"
- gradientUnits="userSpaceOnUse" />
-<radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3561"
- id="radialGradient3567"
- cx="22.714285"
- cy="23.571428"
- fx="22.714285"
- fy="23.571428"
- r="19.828572"
- gradientUnits="userSpaceOnUse" />
-<linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3745"
- id="linearGradient3751"
- x1="0.84126461"
- y1="13.678415"
- x2="31.397495"
- y2="13.678415"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.8791332,0.7829527,-0.6285195,1.0951445,14.147627,-10.49311)" />
-<filter
- inkscape:collect="always"
- id="filter4176">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="0.27747502"
- id="feGaussianBlur4178" />
-</filter>
-<radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3267"
- id="radialGradient3273"
- cx="22.714285"
- cy="23.571428"
- fx="22.714285"
- fy="23.571428"
- r="19.428572"
- gradientUnits="userSpaceOnUse" />
-<inkscape:perspective
- id="perspective136"
- inkscape:persp3d-origin="138.6795 : 92.479329 : 1"
- inkscape:vp_z="277.35901 : 138.71899 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_x="0 : 138.71899 : 1"
- sodipodi:type="inkscape:persp3d" />
-
-
-
-
-
-
-
-
-
-
-<linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3808"
- id="linearGradient3806"
- x1="32.829472"
- y1="32.055603"
- x2="34.522324"
- y2="-1.0290829"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.8832227,0,0,1,-8.0103007,9.1923882)" />
-</defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="5.6568542"
- inkscape:cx="30.924085"
- inkscape:cy="24.59691"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:grid-bbox="true"
- inkscape:document-units="px"
- inkscape:window-width="1299"
- inkscape:window-height="883"
- inkscape:window-x="373"
- inkscape:window-y="89"
- showguides="false" />
- <metadata
- id="metadata2165">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title>Qt Browser</dc:title>
- <dc:creator>
- <cc:Agent>
- <dc:title>Jens Bache-Wiig</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:rights>
- <cc:Agent>
- <dc:title>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</dc:title>
- </cc:Agent>
- </dc:rights>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- id="layer1"
- inkscape:label="Layer 1"
- inkscape:groupmode="layer">
- <path
- sodipodi:type="arc"
- style="opacity:0.78108437;fill:url(#radialGradient3273);fill-opacity:1;stroke:none;stroke-width:0.80000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3407"
- sodipodi:cx="22.714285"
- sodipodi:cy="23.571428"
- sodipodi:rx="19.428572"
- sodipodi:ry="19.428572"
- d="M 42.142857,23.571428 A 19.428572,19.428572 0 1 1 3.2857132,23.571428 A 19.428572,19.428572 0 1 1 42.142857,23.571428 z"
- transform="matrix(1.0818892,0,0,1.0409446,-2.4313375,0.4303723)" />
- <path
- sodipodi:type="arc"
- style="fill:url(#radialGradient3149);fill-opacity:1;stroke:none;stroke-width:0.80000000000000004;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path2170"
- sodipodi:cx="22.714285"
- sodipodi:cy="23.571428"
- sodipodi:rx="19.428572"
- sodipodi:ry="19.428572"
- d="M 42.142857 23.571428 A 19.428572 19.428572 0 1 1 3.2857132,23.571428 A 19.428572 19.428572 0 1 1 42.142857 23.571428 z" />
- <path
- d="M 26.602136,8.2160843 C 26.322653,8.1637524 26.048884,8.1512446 25.78375,8.1745351 L 25.783243,8.1743913 C 25.783243,8.1743913 23.973525,8.3138471 23.891496,8.3211793 C 22.239361,8.4705552 20.985434,10.008307 20.985434,12.131916 L 20.985434,37.174579 L 22.83515,39.126673 L 41.425135,33.998394 C 42.704203,33.746799 43.714709,33.629384 43.714709,31.78483 L 43.714709,11.392226 L 26.602136,8.2160843 z"
- id="path2998"
- style="fill:url(#linearGradient3806);fill-opacity:1"
- sodipodi:nodetypes="cccsccccccc" />
- <path
- style="fill:url(#radialGradient3203);fill-opacity:1;fill-rule:evenodd;stroke:#1d3215;stroke-width:0.51392877000000003;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 37.535517,11.721122 C 32.782916,8.7478602 30.602351,6.3542385 32.09957,13.4346 C 32.320572,14.27055 33.291276,13.739232 33.291276,14.862228 C 33.291276,16.155819 32.607502,17.380765 31.797574,18.146663 C 30.959323,18.939344 31.011357,20.258984 31.797574,21.002459 C 33.06234,22.198469 33.942515,22.715936 35.572536,22.715936 C 36.6448,22.715936 37.003629,23.274262 37.23352,24.143834 C 37.362263,24.630808 38.410486,25.085663 38.894503,25.428942 C 38.938905,25.460433 38.139512,26.551348 38.139512,27.999158 C 38.139512,29.113512 38.405167,29.358325 38.743505,29.998215 C 38.949111,30.387072 36.418877,30.283794 36.025532,30.283794 C 35.005751,30.283794 34.181701,30.712163 33.15656,30.712163 C 32.264543,30.712163 31.099578,30.3566 31.344578,31.283323 C 31.763542,32.868074 32.552566,33.932342 32.552566,35.709806 C 32.552566,36.862272 31.047367,37.598377 30.287588,38.137232 C 29.30273,38.835721 29.133207,39.307154 28.475606,40.136289 C 28.132145,40.569341 26.990548,41.409612 28.475606,40.707448 C 29.476144,40.234375 31.192063,39.423774 32.09957,38.565601 C 33.257846,37.470293 34.527421,37.269266 35.723534,36.138176 C 36.659137,35.253436 37.512933,34.691155 38.29051,33.710749 C 39.024031,32.785889 39.498498,31.90347 39.498498,30.712163 C 39.498498,29.682482 39.308098,28.750366 39.951493,28.141948 C 40.902684,24.235856 42.225874,19.789742 39.751646,16.005086 C 38.569376,15.014407 37.717516,13.109859 37.535517,11.721122 z "
- id="path3151"
- sodipodi:nodetypes="ccsssssssssssssssssssccc" />
- <path
- style="fill:url(#radialGradient3187);fill-opacity:1;fill-rule:evenodd;stroke:#063a0a;stroke-width:0.51231807;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 14.777083,7.8630009 C 14.047432,8.4403746 12.751987,10.898939 13.27641,12.146301 C 13.709874,13.177316 14.920827,13.613143 15.827553,13.859622 C 16.568703,14.061091 17.049015,14.457271 17.478293,15.001835 C 17.832696,15.451415 17.971105,16.346745 18.078563,16.857932 C 18.298637,17.904845 18.947911,17.058563 17.62836,18.000145 C 17.234352,18.281296 14.875696,18.000145 14.476948,18.000145 C 11.976825,18.384083 14.297504,19.464893 14.92715,20.712903 C 15.204987,21.770261 15.377352,22.405336 15.377352,23.711213 C 15.377352,24.875672 15.377352,24.78389 15.377352,25.99564 C 15.377352,27.194757 15.044241,27.28063 13.876679,27.28063 C 13.023055,27.28063 12.647321,26.423969 11.625669,26.423969 C 10.400599,26.423969 11.303539,27.667106 11.475602,27.994513 C 12.006402,29.004538 11.662121,29.599737 10.875334,28.851174 C 9.855722,27.881096 8.8280305,26.760556 8.0240557,25.99564 C 2.8789379,25.807372 4.5677903,23.466499 3.9722395,18.999582 C 5.041259,16.526382 4.7558935,17.248897 7.2737194,12.574632 C 10.149914,9.5491592 13.589212,5.9532919 14.777083,7.8630009 z"
- id="path3159"
- sodipodi:nodetypes="csssssccsssssscccc" />
- <path
- style="fill:url(#radialGradient3195);fill-opacity:1;fill-rule:evenodd;stroke:#163c0c;stroke-width:0.59999999999999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 10.265966,34.571429 C 9.245427,35.081699 8.6225774,36.042538 9.980252,36.857143 C 10.637564,37.25153 11.478587,37.606311 12.265966,38 C 13.258976,38.496505 14.481138,39.018522 15.408823,39.714286 C 16.227572,40.328348 15.587589,39.928184 16.123109,38.857143 C 16.827927,37.447507 18.14516,38.79674 18.837395,39.142857 C 20.044787,39.746554 20.46001,38.652394 20.694537,37.714286 C 20.459863,35.791335 18.579948,34.625723 17.123109,33.285715 C 16.704922,32.588736 15.507117,31.689713 14.837395,31.857143 C 13.49505,33.304042 12.350312,33.960279 10.265966,34.571429 z "
- id="path3161"
- sodipodi:nodetypes="cssssscccc" />
- <path
- sodipodi:type="arc"
- style="fill:none;fill-opacity:1;stroke:url(#radialGradient3567);stroke-width:0.80000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.6502732"
- id="path3557"
- sodipodi:cx="22.714285"
- sodipodi:cy="23.571428"
- sodipodi:rx="19.428572"
- sodipodi:ry="19.428572"
- d="M 42.142857 23.571428 A 19.428572 19.428572 0 1 1 3.2857132,23.571428 A 19.428572 19.428572 0 1 1 42.142857 23.571428 z"
- transform="matrix(0.95317,0,0,0.95317,0.9922816,1.1752786)" />
- <path
- style="fill:url(#linearGradient3751);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="M 39.916926,27.786316 C 44.588637,26.790847 38.225604,13.201712 32.946381,8.5000566 C 18.135275,-0.40265528 10.844456,5.6490056 3.6645529,16.333771 C 5.7478288,18.189127 14.704728,33.158645 39.916926,27.786316 z"
- id="path3578"
- sodipodi:nodetypes="cccs" />
- <path
- d="M 45.902562,20.610592 C 46.007701,20.610592 46.120332,20.603354 46.240455,20.590275 L 45.609873,20.590275 C 45.697743,20.603608 45.798946,20.610592 45.902562,20.610592 z"
- id="path3012"
- style="fill:#0a6333" />
- <path
- sodipodi:type="arc"
- style="fill:none;fill-opacity:1;stroke:#273e5e;stroke-width:0.80000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3818"
- sodipodi:cx="22.714285"
- sodipodi:cy="23.571428"
- sodipodi:rx="19.428572"
- sodipodi:ry="19.428572"
- d="M 42.142857,23.571428 A 19.428572,19.428572 0 1 1 3.2857132,23.571428 A 19.428572,19.428572 0 1 1 42.142857,23.571428 z"
- transform="matrix(0.9754581,0,0,0.9754581,0.3821951,0.7002631)" />
- <g
- transform="matrix(0.1269799,0,0,0.1269799,23.283534,9.5774104)"
- id="g236">
- <path
- style="fill:#024c1c"
- id="path238"
- d="M 44.233,0.368 C 42.032,0.004 39.876,-0.083 37.788,0.079 L 37.784,0.078 C 37.784,0.078 23.532,1.048 22.886,1.099 C 9.875,2.138 0,12.834 0,27.605 L 0,201.792 L 14.567,215.37 L 160.968,190.766 C 171.041,189.016 178.999,177.133 178.999,164.303 L 178.999,22.46 L 44.233,0.368 z" />
-
- <path
- style="fill:#66b036"
- id="path240"
- d="M 179,164.304 C 179,177.134 171.042,189.017 160.969,190.767 L 14.567,215.37 L 14.567,26.683 C 14.567,9.52 28.263,-2.264 44.231,0.368 L 179,22.462 L 179,164.304 z" />
-
- <g
- id="g242">
- <path
- style="fill:#ffffff"
- id="path244"
- d="M 133.897,47.137 L 145.72,48.411 L 145.72,69.158 L 159.025,70.099 L 159.025,83.113 L 145.72,82.502 L 145.72,130.066 C 145.72,134.207 146.176,136.869 147.093,138.064 C 147.919,139.158 149.195,139.697 150.907,139.697 C 151.069,139.697 151.24,139.695 151.414,139.683 C 154.031,139.533 156.878,138.728 159.98,137.314 L 159.98,149.275 C 154.707,151.591 149.532,152.966 144.452,153.398 C 143.716,153.457 143.005,153.486 142.317,153.486 C 137.716,153.486 134.199,152.152 131.797,149.451 C 128.998,146.318 127.598,141.285 127.598,134.387 L 127.598,81.661 L 121.209,81.368 L 121.209,67.424 L 129,67.985 L 133.897,47.137 z" />
-
- </g>
-
- <polygon
- style="fill:#0a6333"
- id="polygon246"
- points="159.027,83.112 145.722,82.501 145.722,82.785 152.854,83.112 159.027,83.112 " />
-
- <path
- style="fill:#024c1c"
- id="path248"
- d="M 148.488,139.21 C 149.168,139.548 149.96,139.696 150.908,139.696 C 151.07,139.696 151.241,139.694 151.415,139.682 C 154.032,139.532 156.879,138.727 159.981,137.313 L 153.806,137.313 C 151.938,138.169 150.178,138.808 148.488,139.21 z" />
-
- <path
- style="fill:#024c1c"
- id="path250"
- d="M 133.897,47.137 L 127.723,47.137 L 122.93,67.549 L 129,67.985 L 133.897,47.137 z M 131.799,149.45 C 129,146.317 127.6,141.284 127.6,134.386 L 127.6,81.661 L 121.211,81.368 L 121.211,67.424 L 115.03,67.424 L 115.03,70.539 C 115.926,73.897 116.63,77.539 117.149,81.465 L 121.426,81.661 L 121.426,134.386 C 121.426,141.284 122.827,146.318 125.625,149.45 C 128.029,152.151 131.541,153.485 136.141,153.485 L 142.318,153.485 C 137.718,153.485 134.2,152.151 131.799,149.45 z" />
-
- <path
- style="fill:#0a6333"
- id="path252"
- d="M 102.954,170.419 C 103.782,170.419 104.669,170.362 105.615,170.259 L 100.649,170.259 C 101.341,170.364 102.138,170.419 102.954,170.419 z" />
-
- <path
- style="fill:#ffffff"
- id="path254"
- d="M 112.036,139.78 C 107.81,149.749 101.365,156.27 92.542,159.288 C 93.43,163.856 94.778,166.929 96.567,168.55 C 97.955,169.796 100.094,170.419 102.958,170.419 C 103.782,170.419 104.671,170.362 105.615,170.259 L 105.615,183.736 L 99.497,184.539 C 97.692,184.771 95.98,184.889 94.361,184.889 C 89.001,184.889 84.665,183.59 81.402,180.961 C 77.085,177.496 73.899,170.805 71.857,160.908 C 62.48,158.91 55.166,152.945 50.103,142.937 C 44.965,132.769 42.349,117.895 42.349,98.441 C 42.349,77.466 45.927,61.985 52.971,52.169 C 58.912,43.885 67.202,39.812 77.634,39.812 C 79.306,39.812 81.033,39.916 82.809,40.124 C 95.081,41.539 103.977,47.329 109.77,57.362 C 115.453,67.177 118.243,81.244 118.243,99.721 C 118.242,116.643 116.186,129.954 112.036,139.78 z M 93.582,135.933 C 95.996,129.724 97.189,117.54 97.189,99.37 C 97.189,83.054 96.007,71.837 93.608,65.682 C 91.21,59.496 87.622,56.153 82.808,55.731 C 82.441,55.7 82.075,55.681 81.724,55.681 C 77.264,55.681 73.84,58.283 71.447,63.508 C 68.863,69.201 67.555,81.003 67.555,98.866 C 67.555,116.129 68.826,128.379 71.388,135.569 C 73.804,142.419 77.423,145.813 82.174,145.813 C 82.384,145.813 82.593,145.805 82.809,145.79 C 87.566,145.489 91.148,142.202 93.582,135.933" />
-
- <path
- style="fill:#024c1c"
- id="path256"
- d="M 84.708,183.003 C 84.59,182.95 84.477,182.896 84.361,182.839 C 84.349,182.835 84.336,182.829 84.323,182.821 C 84.218,182.77 84.115,182.716 84.011,182.663 C 83.991,182.653 83.971,182.642 83.948,182.63 C 83.854,182.579 83.761,182.528 83.667,182.476 C 83.636,182.46 83.609,182.443 83.579,182.427 C 83.494,182.38 83.412,182.331 83.328,182.284 C 83.286,182.263 83.25,182.239 83.209,182.214 C 83.137,182.171 83.062,182.128 82.994,182.083 C 82.943,182.054 82.897,182.024 82.848,181.993 C 82.785,181.954 82.726,181.915 82.663,181.876 C 82.606,181.837 82.552,181.798 82.492,181.759 C 82.442,181.726 82.392,181.693 82.342,181.659 C 82.272,181.612 82.206,181.563 82.141,181.518 C 82.101,181.489 82.061,181.463 82.021,181.432 C 81.943,181.377 81.866,181.319 81.79,181.26 C 81.764,181.239 81.735,181.221 81.708,181.199 C 81.607,181.121 81.505,181.039 81.402,180.959 C 77.085,177.494 73.899,170.803 71.857,160.906 C 62.48,158.908 55.166,152.943 50.103,142.935 C 44.965,132.767 42.349,117.893 42.349,98.439 C 42.349,77.464 45.927,61.983 52.971,52.167 C 58.912,43.883 67.202,39.81 77.634,39.81 C 77.67,39.81 71.114,39.806 71.114,39.806 L 71.114,39.81 C 60.694,39.818 52.411,43.89 46.476,52.167 C 39.434,61.984 35.855,77.465 35.855,98.439 C 35.855,117.892 38.469,132.767 43.609,142.935 C 48.671,152.943 55.983,158.908 65.361,160.906 C 67.403,170.802 70.588,177.494 74.904,180.959 C 78.168,183.588 82.507,184.887 87.867,184.887 C 87.967,184.887 88.07,184.887 88.17,184.885 L 93.861,184.885 C 90.361,184.828 87.306,184.203 84.716,183.006 C 84.712,183.007 84.708,183.007 84.708,183.003 z M 87.113,65.681 C 89.511,71.837 90.69,83.054 90.69,99.369 C 90.69,117.539 89.502,129.723 87.083,135.932 C 85.142,140.942 82.439,144.047 79.013,145.248 C 79.999,145.621 81.058,145.81 82.173,145.81 C 82.383,145.81 82.592,145.802 82.808,145.787 C 87.567,145.488 91.149,142.201 93.582,135.932 C 95.996,129.723 97.189,117.539 97.189,99.369 C 97.189,83.053 96.007,71.836 93.608,65.681 C 91.21,59.495 87.622,56.152 82.808,55.73 C 82.441,55.699 82.075,55.68 81.724,55.68 C 80.601,55.68 79.549,55.845 78.556,56.173 L 78.556,56.175 L 78.556,56.175 C 82.254,57.322 85.104,60.5 87.113,65.681 z" />
-
-</g>
- </g>
-</svg>
diff --git a/examples/gestures/browser/data/closetab.png b/examples/gestures/browser/data/closetab.png
deleted file mode 100644
index ab9d669..0000000
--- a/examples/gestures/browser/data/closetab.png
+++ /dev/null
Binary files differ
diff --git a/examples/gestures/browser/data/data.qrc b/examples/gestures/browser/data/data.qrc
deleted file mode 100644
index c7d0294..0000000
--- a/examples/gestures/browser/data/data.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>addtab.png</file>
- <file>closetab.png</file>
- <file>history.png</file>
- <file>browser.svg</file>
- <file>defaultbookmarks.xbel</file>
- <file>loading.gif</file>
- <file>defaulticon.png</file>
-</qresource>
-</RCC>
diff --git a/examples/gestures/browser/data/defaultbookmarks.xbel b/examples/gestures/browser/data/defaultbookmarks.xbel
deleted file mode 100644
index a168244..0000000
--- a/examples/gestures/browser/data/defaultbookmarks.xbel
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE xbel>
-<xbel version="1.0">
- <folder folded="yes">
- <title>Bookmarks Bar</title>
- <bookmark href="http://qtsoftware.com/">
- <title>Qt Software</title>
- </bookmark>
- <bookmark href="http://webkit.org/">
- <title>WebKit.org</title>
- </bookmark>
- <bookmark href="http://doc.trolltech.com/">
- <title>Qt Documentation</title>
- </bookmark>
- <bookmark href="http://doc.trolltech.com/qq/">
- <title>Qt Quarterly</title>
- </bookmark>
- <bookmark href="http://labs.trolltech.com/">
- <title>Qt Labs</title>
- </bookmark>
- <bookmark href="http://www.qtcentre.org/">
- <title>Qt Centre</title>
- </bookmark>
- <bookmark href="http://qt-apps.org/">
- <title>Qt-Apps.org</title>
- </bookmark>
- <bookmark href="http://qtnode.net/">
- <title>qtnode</title>
- </bookmark>
- <bookmark href="http://xkcd.com/">
- <title>xkcd</title>
- </bookmark>
- </folder>
- <folder folded="yes">
- <title>Bookmarks Menu</title>
- <bookmark href="http://reddit.com/">
- <title>reddit.com: what's new online!</title>
- </bookmark>
- </folder>
-</xbel>
diff --git a/examples/gestures/browser/data/defaulticon.png b/examples/gestures/browser/data/defaulticon.png
deleted file mode 100644
index 01a0920..0000000
--- a/examples/gestures/browser/data/defaulticon.png
+++ /dev/null
Binary files differ
diff --git a/examples/gestures/browser/data/history.png b/examples/gestures/browser/data/history.png
deleted file mode 100644
index 552a1cb..0000000
--- a/examples/gestures/browser/data/history.png
+++ /dev/null
Binary files differ
diff --git a/examples/gestures/browser/data/loading.gif b/examples/gestures/browser/data/loading.gif
deleted file mode 100644
index c1545eb..0000000
--- a/examples/gestures/browser/data/loading.gif
+++ /dev/null
Binary files differ
diff --git a/examples/gestures/browser/downloaditem.ui b/examples/gestures/browser/downloaditem.ui
deleted file mode 100644
index 4a0a0fd..0000000
--- a/examples/gestures/browser/downloaditem.ui
+++ /dev/null
@@ -1,134 +0,0 @@
-<ui version="4.0" >
- <class>DownloadItem</class>
- <widget class="QWidget" name="DownloadItem" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>423</width>
- <height>110</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Form</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="fileIcon" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Ico</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2" >
- <item>
- <widget class="SqueezeLabel" native="1" name="fileNameLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" stdset="0" >
- <string>Filename</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QProgressBar" name="progressBar" >
- <property name="value" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SqueezeLabel" native="1" name="downloadInfoLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" stdset="0" >
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <spacer name="verticalSpacer" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>17</width>
- <height>1</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="tryAgainButton" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="text" >
- <string>Try Again</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="stopButton" >
- <property name="text" >
- <string>Stop</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="openButton" >
- <property name="text" >
- <string>Open</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>17</width>
- <height>5</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>SqueezeLabel</class>
- <extends>QWidget</extends>
- <header>squeezelabel.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/examples/gestures/browser/downloadmanager.cpp b/examples/gestures/browser/downloadmanager.cpp
deleted file mode 100644
index 8e23795..0000000
--- a/examples/gestures/browser/downloadmanager.cpp
+++ /dev/null
@@ -1,579 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "downloadmanager.h"
-
-#include "autosaver.h"
-#include "browserapplication.h"
-#include "networkaccessmanager.h"
-
-#include <math.h>
-
-#include <QtCore/QMetaEnum>
-#include <QtCore/QSettings>
-
-#include <QtGui/QDesktopServices>
-#include <QtGui/QFileDialog>
-#include <QtGui/QHeaderView>
-#include <QtGui/QFileIconProvider>
-
-#include <QtCore/QDebug>
-
-#include <QtWebKit/QWebSettings>
-
-/*!
- DownloadItem is a widget that is displayed in the download manager list.
- It moves the data from the QNetworkReply into the QFile as well
- as update the information/progressbar and report errors.
- */
-DownloadItem::DownloadItem(QNetworkReply *reply, bool requestFileName, QWidget *parent)
- : QWidget(parent)
- , m_reply(reply)
- , m_requestFileName(requestFileName)
- , m_bytesReceived(0)
-{
- setupUi(this);
- QPalette p = downloadInfoLabel->palette();
- p.setColor(QPalette::Text, Qt::darkGray);
- downloadInfoLabel->setPalette(p);
- progressBar->setMaximum(0);
- tryAgainButton->hide();
- connect(stopButton, SIGNAL(clicked()), this, SLOT(stop()));
- connect(openButton, SIGNAL(clicked()), this, SLOT(open()));
- connect(tryAgainButton, SIGNAL(clicked()), this, SLOT(tryAgain()));
-
- init();
-}
-
-void DownloadItem::init()
-{
- if (!m_reply)
- return;
-
- // attach to the m_reply
- m_url = m_reply->url();
- m_reply->setParent(this);
- connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));
- connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
- this, SLOT(error(QNetworkReply::NetworkError)));
- connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)),
- this, SLOT(downloadProgress(qint64, qint64)));
- connect(m_reply, SIGNAL(metaDataChanged()),
- this, SLOT(metaDataChanged()));
- connect(m_reply, SIGNAL(finished()),
- this, SLOT(finished()));
-
- // reset info
- downloadInfoLabel->clear();
- progressBar->setValue(0);
- getFileName();
-
- // start timer for the download estimation
- m_downloadTime.start();
-
- if (m_reply->error() != QNetworkReply::NoError) {
- error(m_reply->error());
- finished();
- }
-}
-
-void DownloadItem::getFileName()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("downloadmanager"));
- QString defaultLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
- QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), defaultLocation).toString();
- if (!downloadDirectory.isEmpty())
- downloadDirectory += QLatin1Char('/');
-
- QString defaultFileName = saveFileName(downloadDirectory);
- QString fileName = defaultFileName;
- if (m_requestFileName) {
- fileName = QFileDialog::getSaveFileName(this, tr("Save File"), defaultFileName);
- if (fileName.isEmpty()) {
- m_reply->close();
- fileNameLabel->setText(tr("Download canceled: %1").arg(QFileInfo(defaultFileName).fileName()));
- return;
- }
- }
- m_output.setFileName(fileName);
- fileNameLabel->setText(QFileInfo(m_output.fileName()).fileName());
- if (m_requestFileName)
- downloadReadyRead();
-}
-
-QString DownloadItem::saveFileName(const QString &directory) const
-{
- // Move this function into QNetworkReply to also get file name sent from the server
- QString path = m_url.path();
- QFileInfo info(path);
- QString baseName = info.completeBaseName();
- QString endName = info.suffix();
-
- if (baseName.isEmpty()) {
- baseName = QLatin1String("unnamed_download");
- qDebug() << "DownloadManager:: downloading unknown file:" << m_url;
- }
- QString name = directory + baseName + QLatin1Char('.') + endName;
- if (QFile::exists(name)) {
- // already exists, don't overwrite
- int i = 1;
- do {
- name = directory + baseName + QLatin1Char('-') + QString::number(i++) + QLatin1Char('.') + endName;
- } while (QFile::exists(name));
- }
- return name;
-}
-
-
-void DownloadItem::stop()
-{
- setUpdatesEnabled(false);
- stopButton->setEnabled(false);
- stopButton->hide();
- tryAgainButton->setEnabled(true);
- tryAgainButton->show();
- setUpdatesEnabled(true);
- m_reply->abort();
-}
-
-void DownloadItem::open()
-{
- QFileInfo info(m_output);
- QUrl url = QUrl::fromLocalFile(info.absolutePath());
- QDesktopServices::openUrl(url);
-}
-
-void DownloadItem::tryAgain()
-{
- if (!tryAgainButton->isEnabled())
- return;
-
- tryAgainButton->setEnabled(false);
- tryAgainButton->setVisible(false);
- stopButton->setEnabled(true);
- stopButton->setVisible(true);
- progressBar->setVisible(true);
-
- QNetworkReply *r = BrowserApplication::networkAccessManager()->get(QNetworkRequest(m_url));
- if (m_reply)
- m_reply->deleteLater();
- if (m_output.exists())
- m_output.remove();
- m_reply = r;
- init();
- emit statusChanged();
-}
-
-void DownloadItem::downloadReadyRead()
-{
- if (m_requestFileName && m_output.fileName().isEmpty())
- return;
- if (!m_output.isOpen()) {
- // in case someone else has already put a file there
- if (!m_requestFileName)
- getFileName();
- if (!m_output.open(QIODevice::WriteOnly)) {
- downloadInfoLabel->setText(tr("Error opening save file: %1")
- .arg(m_output.errorString()));
- stopButton->click();
- emit statusChanged();
- return;
- }
- emit statusChanged();
- }
- if (-1 == m_output.write(m_reply->readAll())) {
- downloadInfoLabel->setText(tr("Error saving: %1")
- .arg(m_output.errorString()));
- stopButton->click();
- }
-}
-
-void DownloadItem::error(QNetworkReply::NetworkError)
-{
- qDebug() << "DownloadItem::error" << m_reply->errorString() << m_url;
- downloadInfoLabel->setText(tr("Network Error: %1").arg(m_reply->errorString()));
- tryAgainButton->setEnabled(true);
- tryAgainButton->setVisible(true);
-}
-
-void DownloadItem::metaDataChanged()
-{
- qDebug() << "DownloadItem::metaDataChanged: not handled.";
-}
-
-void DownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
-{
- m_bytesReceived = bytesReceived;
- if (bytesTotal == -1) {
- progressBar->setValue(0);
- progressBar->setMaximum(0);
- } else {
- progressBar->setValue(bytesReceived);
- progressBar->setMaximum(bytesTotal);
- }
- updateInfoLabel();
-}
-
-void DownloadItem::updateInfoLabel()
-{
- if (m_reply->error() == QNetworkReply::NoError)
- return;
-
- qint64 bytesTotal = progressBar->maximum();
- bool running = !downloadedSuccessfully();
-
- // update info label
- double speed = m_bytesReceived * 1000.0 / m_downloadTime.elapsed();
- double timeRemaining = ((double)(bytesTotal - m_bytesReceived)) / speed;
- QString timeRemainingString = tr("seconds");
- if (timeRemaining > 60) {
- timeRemaining = timeRemaining / 60;
- timeRemainingString = tr("minutes");
- }
- timeRemaining = floor(timeRemaining);
-
- // When downloading the eta should never be 0
- if (timeRemaining == 0)
- timeRemaining = 1;
-
- QString info;
- if (running) {
- QString remaining;
- if (bytesTotal != 0)
- remaining = tr("- %4 %5 remaining")
- .arg(timeRemaining)
- .arg(timeRemainingString);
- info = QString(tr("%1 of %2 (%3/sec) %4"))
- .arg(dataString(m_bytesReceived))
- .arg(bytesTotal == 0 ? tr("?") : dataString(bytesTotal))
- .arg(dataString((int)speed))
- .arg(remaining);
- } else {
- if (m_bytesReceived == bytesTotal)
- info = dataString(m_output.size());
- else
- info = tr("%1 of %2 - Stopped")
- .arg(dataString(m_bytesReceived))
- .arg(dataString(bytesTotal));
- }
- downloadInfoLabel->setText(info);
-}
-
-QString DownloadItem::dataString(int size) const
-{
- QString unit;
- if (size < 1024) {
- unit = tr("bytes");
- } else if (size < 1024*1024) {
- size /= 1024;
- unit = tr("kB");
- } else {
- size /= 1024*1024;
- unit = tr("MB");
- }
- return QString(QLatin1String("%1 %2")).arg(size).arg(unit);
-}
-
-bool DownloadItem::downloading() const
-{
- return (progressBar->isVisible());
-}
-
-bool DownloadItem::downloadedSuccessfully() const
-{
- return (stopButton->isHidden() && tryAgainButton->isHidden());
-}
-
-void DownloadItem::finished()
-{
- progressBar->hide();
- stopButton->setEnabled(false);
- stopButton->hide();
- m_output.close();
- updateInfoLabel();
- emit statusChanged();
-}
-
-/*!
- DownloadManager is a Dialog that contains a list of DownloadItems
-
- It is a basic download manager. It only downloads the file, doesn't do BitTorrent,
- extract zipped files or anything fancy.
- */
-DownloadManager::DownloadManager(QWidget *parent)
- : QDialog(parent)
- , m_autoSaver(new AutoSaver(this))
- , m_manager(BrowserApplication::networkAccessManager())
- , m_iconProvider(0)
- , m_removePolicy(Never)
-{
- setupUi(this);
- downloadsView->setShowGrid(false);
- downloadsView->verticalHeader()->hide();
- downloadsView->horizontalHeader()->hide();
- downloadsView->setAlternatingRowColors(true);
- downloadsView->horizontalHeader()->setStretchLastSection(true);
- m_model = new DownloadModel(this);
- downloadsView->setModel(m_model);
- connect(cleanupButton, SIGNAL(clicked()), this, SLOT(cleanup()));
- load();
-}
-
-DownloadManager::~DownloadManager()
-{
- m_autoSaver->changeOccurred();
- m_autoSaver->saveIfNeccessary();
- if (m_iconProvider)
- delete m_iconProvider;
-}
-
-int DownloadManager::activeDownloads() const
-{
- int count = 0;
- for (int i = 0; i < m_downloads.count(); ++i) {
- if (m_downloads.at(i)->stopButton->isEnabled())
- ++count;
- }
- return count;
-}
-
-void DownloadManager::download(const QNetworkRequest &request, bool requestFileName)
-{
- if (request.url().isEmpty())
- return;
- handleUnsupportedContent(m_manager->get(request), requestFileName);
-}
-
-void DownloadManager::handleUnsupportedContent(QNetworkReply *reply, bool requestFileName)
-{
- if (!reply || reply->url().isEmpty())
- return;
- QVariant header = reply->header(QNetworkRequest::ContentLengthHeader);
- bool ok;
- int size = header.toInt(&ok);
- if (ok && size == 0)
- return;
-
- qDebug() << "DownloadManager::handleUnsupportedContent" << reply->url() << "requestFileName" << requestFileName;
- DownloadItem *item = new DownloadItem(reply, requestFileName, this);
- addItem(item);
-}
-
-void DownloadManager::addItem(DownloadItem *item)
-{
- connect(item, SIGNAL(statusChanged()), this, SLOT(updateRow()));
- int row = m_downloads.count();
- m_model->beginInsertRows(QModelIndex(), row, row);
- m_downloads.append(item);
- m_model->endInsertRows();
- updateItemCount();
- if (row == 0)
- show();
- downloadsView->setIndexWidget(m_model->index(row, 0), item);
- QIcon icon = style()->standardIcon(QStyle::SP_FileIcon);
- item->fileIcon->setPixmap(icon.pixmap(48, 48));
- downloadsView->setRowHeight(row, item->sizeHint().height());
-}
-
-void DownloadManager::updateRow()
-{
- DownloadItem *item = qobject_cast<DownloadItem*>(sender());
- int row = m_downloads.indexOf(item);
- if (-1 == row)
- return;
- if (!m_iconProvider)
- m_iconProvider = new QFileIconProvider();
- QIcon icon = m_iconProvider->icon(item->m_output.fileName());
- if (icon.isNull())
- icon = style()->standardIcon(QStyle::SP_FileIcon);
- item->fileIcon->setPixmap(icon.pixmap(48, 48));
- downloadsView->setRowHeight(row, item->minimumSizeHint().height());
-
- bool remove = false;
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (!item->downloading()
- && globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- remove = true;
-
- if (item->downloadedSuccessfully()
- && removePolicy() == DownloadManager::SuccessFullDownload) {
- remove = true;
- }
- if (remove)
- m_model->removeRow(row);
-
- cleanupButton->setEnabled(m_downloads.count() - activeDownloads() > 0);
-}
-
-DownloadManager::RemovePolicy DownloadManager::removePolicy() const
-{
- return m_removePolicy;
-}
-
-void DownloadManager::setRemovePolicy(RemovePolicy policy)
-{
- if (policy == m_removePolicy)
- return;
- m_removePolicy = policy;
- m_autoSaver->changeOccurred();
-}
-
-void DownloadManager::save() const
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("downloadmanager"));
- QMetaEnum removePolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("RemovePolicy"));
- settings.setValue(QLatin1String("removeDownloadsPolicy"), QLatin1String(removePolicyEnum.valueToKey(m_removePolicy)));
- settings.setValue(QLatin1String("size"), size());
- if (m_removePolicy == Exit)
- return;
-
- for (int i = 0; i < m_downloads.count(); ++i) {
- QString key = QString(QLatin1String("download_%1_")).arg(i);
- settings.setValue(key + QLatin1String("url"), m_downloads[i]->m_url);
- settings.setValue(key + QLatin1String("location"), QFileInfo(m_downloads[i]->m_output).filePath());
- settings.setValue(key + QLatin1String("done"), m_downloads[i]->downloadedSuccessfully());
- }
- int i = m_downloads.count();
- QString key = QString(QLatin1String("download_%1_")).arg(i);
- while (settings.contains(key + QLatin1String("url"))) {
- settings.remove(key + QLatin1String("url"));
- settings.remove(key + QLatin1String("location"));
- settings.remove(key + QLatin1String("done"));
- key = QString(QLatin1String("download_%1_")).arg(++i);
- }
-}
-
-void DownloadManager::load()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("downloadmanager"));
- QSize size = settings.value(QLatin1String("size")).toSize();
- if (size.isValid())
- resize(size);
- QByteArray value = settings.value(QLatin1String("removeDownloadsPolicy"), QLatin1String("Never")).toByteArray();
- QMetaEnum removePolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("RemovePolicy"));
- m_removePolicy = removePolicyEnum.keyToValue(value) == -1 ?
- Never :
- static_cast<RemovePolicy>(removePolicyEnum.keyToValue(value));
-
- int i = 0;
- QString key = QString(QLatin1String("download_%1_")).arg(i);
- while (settings.contains(key + QLatin1String("url"))) {
- QUrl url = settings.value(key + QLatin1String("url")).toUrl();
- QString fileName = settings.value(key + QLatin1String("location")).toString();
- bool done = settings.value(key + QLatin1String("done"), true).toBool();
- if (!url.isEmpty() && !fileName.isEmpty()) {
- DownloadItem *item = new DownloadItem(0, this);
- item->m_output.setFileName(fileName);
- item->fileNameLabel->setText(QFileInfo(item->m_output.fileName()).fileName());
- item->m_url = url;
- item->stopButton->setVisible(false);
- item->stopButton->setEnabled(false);
- item->tryAgainButton->setVisible(!done);
- item->tryAgainButton->setEnabled(!done);
- item->progressBar->setVisible(!done);
- addItem(item);
- }
- key = QString(QLatin1String("download_%1_")).arg(++i);
- }
- cleanupButton->setEnabled(m_downloads.count() - activeDownloads() > 0);
-}
-
-void DownloadManager::cleanup()
-{
- if (m_downloads.isEmpty())
- return;
- m_model->removeRows(0, m_downloads.count());
- updateItemCount();
- if (m_downloads.isEmpty() && m_iconProvider) {
- delete m_iconProvider;
- m_iconProvider = 0;
- }
- m_autoSaver->changeOccurred();
-}
-
-void DownloadManager::updateItemCount()
-{
- int count = m_downloads.count();
- itemCount->setText(count == 1 ? tr("1 Download") : tr("%1 Downloads").arg(count));
-}
-
-DownloadModel::DownloadModel(DownloadManager *downloadManager, QObject *parent)
- : QAbstractListModel(parent)
- , m_downloadManager(downloadManager)
-{
-}
-
-QVariant DownloadModel::data(const QModelIndex &index, int role) const
-{
- if (index.row() < 0 || index.row() >= rowCount(index.parent()))
- return QVariant();
- if (role == Qt::ToolTipRole)
- if (!m_downloadManager->m_downloads.at(index.row())->downloadedSuccessfully())
- return m_downloadManager->m_downloads.at(index.row())->downloadInfoLabel->text();
- return QVariant();
-}
-
-int DownloadModel::rowCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : m_downloadManager->m_downloads.count();
-}
-
-bool DownloadModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (parent.isValid())
- return false;
-
- int lastRow = row + count - 1;
- for (int i = lastRow; i >= row; --i) {
- if (m_downloadManager->m_downloads.at(i)->downloadedSuccessfully()
- || m_downloadManager->m_downloads.at(i)->tryAgainButton->isEnabled()) {
- beginRemoveRows(parent, i, i);
- m_downloadManager->m_downloads.takeAt(i)->deleteLater();
- endRemoveRows();
- }
- }
- m_downloadManager->m_autoSaver->changeOccurred();
- return true;
-}
-
diff --git a/examples/gestures/browser/downloadmanager.h b/examples/gestures/browser/downloadmanager.h
deleted file mode 100644
index af13fec..0000000
--- a/examples/gestures/browser/downloadmanager.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DOWNLOADMANAGER_H
-#define DOWNLOADMANAGER_H
-
-#include "ui_downloads.h"
-#include "ui_downloaditem.h"
-
-#include <QtNetwork/QNetworkReply>
-
-#include <QtCore/QFile>
-#include <QtCore/QTime>
-
-class DownloadItem : public QWidget, public Ui_DownloadItem
-{
- Q_OBJECT
-
-signals:
- void statusChanged();
-
-public:
- DownloadItem(QNetworkReply *reply = 0, bool requestFileName = false, QWidget *parent = 0);
- bool downloading() const;
- bool downloadedSuccessfully() const;
-
- QUrl m_url;
-
- QFile m_output;
- QNetworkReply *m_reply;
-
-private slots:
- void stop();
- void tryAgain();
- void open();
-
- void downloadReadyRead();
- void error(QNetworkReply::NetworkError code);
- void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
- void metaDataChanged();
- void finished();
-
-private:
- void getFileName();
- void init();
- void updateInfoLabel();
- QString dataString(int size) const;
-
- QString saveFileName(const QString &directory) const;
-
- bool m_requestFileName;
- qint64 m_bytesReceived;
- QTime m_downloadTime;
-};
-
-class AutoSaver;
-class DownloadModel;
-QT_BEGIN_NAMESPACE
-class QFileIconProvider;
-QT_END_NAMESPACE
-
-class DownloadManager : public QDialog, public Ui_DownloadDialog
-{
- Q_OBJECT
- Q_PROPERTY(RemovePolicy removePolicy READ removePolicy WRITE setRemovePolicy)
- Q_ENUMS(RemovePolicy)
-
-public:
- enum RemovePolicy {
- Never,
- Exit,
- SuccessFullDownload
- };
-
- DownloadManager(QWidget *parent = 0);
- ~DownloadManager();
- int activeDownloads() const;
-
- RemovePolicy removePolicy() const;
- void setRemovePolicy(RemovePolicy policy);
-
-public slots:
- void download(const QNetworkRequest &request, bool requestFileName = false);
- inline void download(const QUrl &url, bool requestFileName = false)
- { download(QNetworkRequest(url), requestFileName); }
- void handleUnsupportedContent(QNetworkReply *reply, bool requestFileName = false);
- void cleanup();
-
-private slots:
- void save() const;
- void updateRow();
-
-private:
- void addItem(DownloadItem *item);
- void updateItemCount();
- void load();
-
- AutoSaver *m_autoSaver;
- DownloadModel *m_model;
- QNetworkAccessManager *m_manager;
- QFileIconProvider *m_iconProvider;
- QList<DownloadItem*> m_downloads;
- RemovePolicy m_removePolicy;
- friend class DownloadModel;
-};
-
-class DownloadModel : public QAbstractListModel
-{
- friend class DownloadManager;
- Q_OBJECT
-
-public:
- DownloadModel(DownloadManager *downloadManager, QObject *parent = 0);
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
-
-private:
- DownloadManager *m_downloadManager;
-
-};
-
-#endif // DOWNLOADMANAGER_H
-
diff --git a/examples/gestures/browser/downloads.ui b/examples/gestures/browser/downloads.ui
deleted file mode 100644
index a2e2569..0000000
--- a/examples/gestures/browser/downloads.ui
+++ /dev/null
@@ -1,83 +0,0 @@
-<ui version="4.0" >
- <class>DownloadDialog</class>
- <widget class="QDialog" name="DownloadDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>332</width>
- <height>252</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Downloads</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>0</number>
- </property>
- <item row="0" column="0" colspan="3" >
- <widget class="EditTableView" name="downloadsView" />
- </item>
- <item row="1" column="0" >
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <item>
- <widget class="QPushButton" name="cleanupButton" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="text" >
- <string>Clean up</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>58</width>
- <height>24</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="1" column="1" >
- <widget class="QLabel" name="itemCount" >
- <property name="text" >
- <string>0 Items</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>148</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>EditTableView</class>
- <extends>QTableView</extends>
- <header>edittableview.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/examples/gestures/browser/edittableview.cpp b/examples/gestures/browser/edittableview.cpp
deleted file mode 100644
index f7d5e67..0000000
--- a/examples/gestures/browser/edittableview.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "edittableview.h"
-#include <QtGui/QKeyEvent>
-
-EditTableView::EditTableView(QWidget *parent)
- : QTableView(parent)
-{
-}
-
-void EditTableView::keyPressEvent(QKeyEvent *event)
-{
- if ((event->key() == Qt::Key_Delete
- || event->key() == Qt::Key_Backspace)
- && model()) {
- removeOne();
- } else {
- QAbstractItemView::keyPressEvent(event);
- }
-}
-
-void EditTableView::removeOne()
-{
- if (!model() || !selectionModel())
- return;
- int row = currentIndex().row();
- model()->removeRow(row, rootIndex());
- QModelIndex idx = model()->index(row, 0, rootIndex());
- if (!idx.isValid())
- idx = model()->index(row - 1, 0, rootIndex());
- selectionModel()->select(idx, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
-}
-
-void EditTableView::removeAll()
-{
- if (model())
- model()->removeRows(0, model()->rowCount(rootIndex()), rootIndex());
-}
-
diff --git a/examples/gestures/browser/edittreeview.cpp b/examples/gestures/browser/edittreeview.cpp
deleted file mode 100644
index c7cefe6..0000000
--- a/examples/gestures/browser/edittreeview.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "edittreeview.h"
-
-#include <QtGui/QKeyEvent>
-
-EditTreeView::EditTreeView(QWidget *parent)
- : QTreeView(parent)
-{
-}
-
-void EditTreeView::keyPressEvent(QKeyEvent *event)
-{
- if ((event->key() == Qt::Key_Delete
- || event->key() == Qt::Key_Backspace)
- && model()) {
- removeOne();
- } else {
- QAbstractItemView::keyPressEvent(event);
- }
-}
-
-void EditTreeView::removeOne()
-{
- if (!model())
- return;
- QModelIndex ci = currentIndex();
- int row = ci.row();
- model()->removeRow(row, ci.parent());
-}
-
-void EditTreeView::removeAll()
-{
- if (!model())
- return;
- model()->removeRows(0, model()->rowCount(rootIndex()), rootIndex());
-}
-
diff --git a/examples/gestures/browser/history.cpp b/examples/gestures/browser/history.cpp
deleted file mode 100644
index 0e0652d..0000000
--- a/examples/gestures/browser/history.cpp
+++ /dev/null
@@ -1,1282 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "history.h"
-
-#include "autosaver.h"
-#include "browserapplication.h"
-
-#include <QtCore/QBuffer>
-#include <QtCore/QDir>
-#include <QtCore/QFile>
-#include <QtCore/QFileInfo>
-#include <QtCore/QSettings>
-#include <QtCore/QTemporaryFile>
-#include <QtCore/QTextStream>
-
-#include <QtCore/QtAlgorithms>
-
-#include <QtGui/QClipboard>
-#include <QtGui/QDesktopServices>
-#include <QtGui/QHeaderView>
-#include <QtGui/QStyle>
-
-#include <QtWebKit/QWebHistoryInterface>
-#include <QtWebKit/QWebSettings>
-
-#include <QtCore/QDebug>
-
-static const unsigned int HISTORY_VERSION = 23;
-
-HistoryManager::HistoryManager(QObject *parent)
- : QWebHistoryInterface(parent)
- , m_saveTimer(new AutoSaver(this))
- , m_historyLimit(30)
- , m_historyModel(0)
- , m_historyFilterModel(0)
- , m_historyTreeModel(0)
-{
- m_expiredTimer.setSingleShot(true);
- connect(&m_expiredTimer, SIGNAL(timeout()),
- this, SLOT(checkForExpired()));
- connect(this, SIGNAL(entryAdded(const HistoryItem &)),
- m_saveTimer, SLOT(changeOccurred()));
- connect(this, SIGNAL(entryRemoved(const HistoryItem &)),
- m_saveTimer, SLOT(changeOccurred()));
- load();
-
- m_historyModel = new HistoryModel(this, this);
- m_historyFilterModel = new HistoryFilterModel(m_historyModel, this);
- m_historyTreeModel = new HistoryTreeModel(m_historyFilterModel, this);
-
- // QWebHistoryInterface will delete the history manager
- QWebHistoryInterface::setDefaultInterface(this);
-}
-
-HistoryManager::~HistoryManager()
-{
- m_saveTimer->saveIfNeccessary();
-}
-
-QList<HistoryItem> HistoryManager::history() const
-{
- return m_history;
-}
-
-bool HistoryManager::historyContains(const QString &url) const
-{
- return m_historyFilterModel->historyContains(url);
-}
-
-void HistoryManager::addHistoryEntry(const QString &url)
-{
- QUrl cleanUrl(url);
- cleanUrl.setPassword(QString());
- cleanUrl.setHost(cleanUrl.host().toLower());
- HistoryItem item(cleanUrl.toString(), QDateTime::currentDateTime());
- addHistoryItem(item);
-}
-
-void HistoryManager::setHistory(const QList<HistoryItem> &history, bool loadedAndSorted)
-{
- m_history = history;
-
- // verify that it is sorted by date
- if (!loadedAndSorted)
- qSort(m_history.begin(), m_history.end());
-
- checkForExpired();
-
- if (loadedAndSorted) {
- m_lastSavedUrl = m_history.value(0).url;
- } else {
- m_lastSavedUrl = QString();
- m_saveTimer->changeOccurred();
- }
- emit historyReset();
-}
-
-HistoryModel *HistoryManager::historyModel() const
-{
- return m_historyModel;
-}
-
-HistoryFilterModel *HistoryManager::historyFilterModel() const
-{
- return m_historyFilterModel;
-}
-
-HistoryTreeModel *HistoryManager::historyTreeModel() const
-{
- return m_historyTreeModel;
-}
-
-void HistoryManager::checkForExpired()
-{
- if (m_historyLimit < 0 || m_history.isEmpty())
- return;
-
- QDateTime now = QDateTime::currentDateTime();
- int nextTimeout = 0;
-
- while (!m_history.isEmpty()) {
- QDateTime checkForExpired = m_history.last().dateTime;
- checkForExpired.setDate(checkForExpired.date().addDays(m_historyLimit));
- if (now.daysTo(checkForExpired) > 7) {
- // check at most in a week to prevent int overflows on the timer
- nextTimeout = 7 * 86400;
- } else {
- nextTimeout = now.secsTo(checkForExpired);
- }
- if (nextTimeout > 0)
- break;
- HistoryItem item = m_history.takeLast();
- // remove from saved file also
- m_lastSavedUrl = QString();
- emit entryRemoved(item);
- }
-
- if (nextTimeout > 0)
- m_expiredTimer.start(nextTimeout * 1000);
-}
-
-void HistoryManager::addHistoryItem(const HistoryItem &item)
-{
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- return;
-
- m_history.prepend(item);
- emit entryAdded(item);
- if (m_history.count() == 1)
- checkForExpired();
-}
-
-void HistoryManager::updateHistoryItem(const QUrl &url, const QString &title)
-{
- for (int i = 0; i < m_history.count(); ++i) {
- if (url == m_history.at(i).url) {
- m_history[i].title = title;
- m_saveTimer->changeOccurred();
- if (m_lastSavedUrl.isEmpty())
- m_lastSavedUrl = m_history.at(i).url;
- emit entryUpdated(i);
- break;
- }
- }
-}
-
-int HistoryManager::historyLimit() const
-{
- return m_historyLimit;
-}
-
-void HistoryManager::setHistoryLimit(int limit)
-{
- if (m_historyLimit == limit)
- return;
- m_historyLimit = limit;
- checkForExpired();
- m_saveTimer->changeOccurred();
-}
-
-void HistoryManager::clear()
-{
- m_history.clear();
- m_lastSavedUrl = QString();
- m_saveTimer->changeOccurred();
- m_saveTimer->saveIfNeccessary();
- historyReset();
-}
-
-void HistoryManager::loadSettings()
-{
- // load settings
- QSettings settings;
- settings.beginGroup(QLatin1String("history"));
- m_historyLimit = settings.value(QLatin1String("historyLimit"), 30).toInt();
-}
-
-void HistoryManager::load()
-{
- loadSettings();
-
- QFile historyFile(QDesktopServices::storageLocation(QDesktopServices::DataLocation)
- + QLatin1String("/history"));
- if (!historyFile.exists())
- return;
- if (!historyFile.open(QFile::ReadOnly)) {
- qWarning() << "Unable to open history file" << historyFile.fileName();
- return;
- }
-
- QList<HistoryItem> list;
- QDataStream in(&historyFile);
- // Double check that the history file is sorted as it is read in
- bool needToSort = false;
- HistoryItem lastInsertedItem;
- QByteArray data;
- QDataStream stream;
- QBuffer buffer;
- stream.setDevice(&buffer);
- while (!historyFile.atEnd()) {
- in >> data;
- buffer.close();
- buffer.setBuffer(&data);
- buffer.open(QIODevice::ReadOnly);
- quint32 ver;
- stream >> ver;
- if (ver != HISTORY_VERSION)
- continue;
- HistoryItem item;
- stream >> item.url;
- stream >> item.dateTime;
- stream >> item.title;
-
- if (!item.dateTime.isValid())
- continue;
-
- if (item == lastInsertedItem) {
- if (lastInsertedItem.title.isEmpty() && !list.isEmpty())
- list[0].title = item.title;
- continue;
- }
-
- if (!needToSort && !list.isEmpty() && lastInsertedItem < item)
- needToSort = true;
-
- list.prepend(item);
- lastInsertedItem = item;
- }
- if (needToSort)
- qSort(list.begin(), list.end());
-
- setHistory(list, true);
-
- // If we had to sort re-write the whole history sorted
- if (needToSort) {
- m_lastSavedUrl = QString();
- m_saveTimer->changeOccurred();
- }
-}
-
-void HistoryManager::save()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("history"));
- settings.setValue(QLatin1String("historyLimit"), m_historyLimit);
-
- bool saveAll = m_lastSavedUrl.isEmpty();
- int first = m_history.count() - 1;
- if (!saveAll) {
- // find the first one to save
- for (int i = 0; i < m_history.count(); ++i) {
- if (m_history.at(i).url == m_lastSavedUrl) {
- first = i - 1;
- break;
- }
- }
- }
- if (first == m_history.count() - 1)
- saveAll = true;
-
- QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
- if (directory.isEmpty())
- directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName();
- if (!QFile::exists(directory)) {
- QDir dir;
- dir.mkpath(directory);
- }
-
- QFile historyFile(directory + QLatin1String("/history"));
- // When saving everything use a temporary file to prevent possible data loss.
- QTemporaryFile tempFile;
- tempFile.setAutoRemove(false);
- bool open = false;
- if (saveAll) {
- open = tempFile.open();
- } else {
- open = historyFile.open(QFile::Append);
- }
-
- if (!open) {
- qWarning() << "Unable to open history file for saving"
- << (saveAll ? tempFile.fileName() : historyFile.fileName());
- return;
- }
-
- QDataStream out(saveAll ? &tempFile : &historyFile);
- for (int i = first; i >= 0; --i) {
- QByteArray data;
- QDataStream stream(&data, QIODevice::WriteOnly);
- HistoryItem item = m_history.at(i);
- stream << HISTORY_VERSION << item.url << item.dateTime << item.title;
- out << data;
- }
- tempFile.close();
-
- if (saveAll) {
- if (historyFile.exists() && !historyFile.remove())
- qWarning() << "History: error removing old history." << historyFile.errorString();
- if (!tempFile.rename(historyFile.fileName()))
- qWarning() << "History: error moving new history over old." << tempFile.errorString() << historyFile.fileName();
- }
- m_lastSavedUrl = m_history.value(0).url;
-}
-
-HistoryModel::HistoryModel(HistoryManager *history, QObject *parent)
- : QAbstractTableModel(parent)
- , m_history(history)
-{
- Q_ASSERT(m_history);
- connect(m_history, SIGNAL(historyReset()),
- this, SLOT(historyReset()));
- connect(m_history, SIGNAL(entryRemoved(const HistoryItem &)),
- this, SLOT(historyReset()));
-
- connect(m_history, SIGNAL(entryAdded(const HistoryItem &)),
- this, SLOT(entryAdded()));
- connect(m_history, SIGNAL(entryUpdated(int)),
- this, SLOT(entryUpdated(int)));
-}
-
-void HistoryModel::historyReset()
-{
- reset();
-}
-
-void HistoryModel::entryAdded()
-{
- beginInsertRows(QModelIndex(), 0, 0);
- endInsertRows();
-}
-
-void HistoryModel::entryUpdated(int offset)
-{
- QModelIndex idx = index(offset, 0);
- emit dataChanged(idx, idx);
-}
-
-QVariant HistoryModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (orientation == Qt::Horizontal
- && role == Qt::DisplayRole) {
- switch (section) {
- case 0: return tr("Title");
- case 1: return tr("Address");
- }
- }
- return QAbstractTableModel::headerData(section, orientation, role);
-}
-
-QVariant HistoryModel::data(const QModelIndex &index, int role) const
-{
- QList<HistoryItem> lst = m_history->history();
- if (index.row() < 0 || index.row() >= lst.size())
- return QVariant();
-
- const HistoryItem &item = lst.at(index.row());
- switch (role) {
- case DateTimeRole:
- return item.dateTime;
- case DateRole:
- return item.dateTime.date();
- case UrlRole:
- return QUrl(item.url);
- case UrlStringRole:
- return item.url;
- case Qt::DisplayRole:
- case Qt::EditRole: {
- switch (index.column()) {
- case 0:
- // when there is no title try to generate one from the url
- if (item.title.isEmpty()) {
- QString page = QFileInfo(QUrl(item.url).path()).fileName();
- if (!page.isEmpty())
- return page;
- return item.url;
- }
- return item.title;
- case 1:
- return item.url;
- }
- }
- case Qt::DecorationRole:
- if (index.column() == 0) {
- return BrowserApplication::instance()->icon(item.url);
- }
- }
- return QVariant();
-}
-
-int HistoryModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : 2;
-}
-
-int HistoryModel::rowCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : m_history->history().count();
-}
-
-bool HistoryModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (parent.isValid())
- return false;
- int lastRow = row + count - 1;
- beginRemoveRows(parent, row, lastRow);
- QList<HistoryItem> lst = m_history->history();
- for (int i = lastRow; i >= row; --i)
- lst.removeAt(i);
- disconnect(m_history, SIGNAL(historyReset()), this, SLOT(historyReset()));
- m_history->setHistory(lst);
- connect(m_history, SIGNAL(historyReset()), this, SLOT(historyReset()));
- endRemoveRows();
- return true;
-}
-
-#define MOVEDROWS 15
-
-/*
- Maps the first bunch of items of the source model to the root
-*/
-HistoryMenuModel::HistoryMenuModel(HistoryTreeModel *sourceModel, QObject *parent)
- : QAbstractProxyModel(parent)
- , m_treeModel(sourceModel)
-{
- setSourceModel(sourceModel);
-}
-
-int HistoryMenuModel::bumpedRows() const
-{
- QModelIndex first = m_treeModel->index(0, 0);
- if (!first.isValid())
- return 0;
- return qMin(m_treeModel->rowCount(first), MOVEDROWS);
-}
-
-int HistoryMenuModel::columnCount(const QModelIndex &parent) const
-{
- return m_treeModel->columnCount(mapToSource(parent));
-}
-
-int HistoryMenuModel::rowCount(const QModelIndex &parent) const
-{
- if (parent.column() > 0)
- return 0;
-
- if (!parent.isValid()) {
- int folders = sourceModel()->rowCount();
- int bumpedItems = bumpedRows();
- if (bumpedItems <= MOVEDROWS
- && bumpedItems == sourceModel()->rowCount(sourceModel()->index(0, 0)))
- --folders;
- return bumpedItems + folders;
- }
-
- if (parent.internalId() == -1) {
- if (parent.row() < bumpedRows())
- return 0;
- }
-
- QModelIndex idx = mapToSource(parent);
- int defaultCount = sourceModel()->rowCount(idx);
- if (idx == sourceModel()->index(0, 0))
- return defaultCount - bumpedRows();
- return defaultCount;
-}
-
-QModelIndex HistoryMenuModel::mapFromSource(const QModelIndex &sourceIndex) const
-{
- // currently not used or autotested
- Q_ASSERT(false);
- int sr = m_treeModel->mapToSource(sourceIndex).row();
- return createIndex(sourceIndex.row(), sourceIndex.column(), sr);
-}
-
-QModelIndex HistoryMenuModel::mapToSource(const QModelIndex &proxyIndex) const
-{
- if (!proxyIndex.isValid())
- return QModelIndex();
-
- if (proxyIndex.internalId() == -1) {
- int bumpedItems = bumpedRows();
- if (proxyIndex.row() < bumpedItems)
- return m_treeModel->index(proxyIndex.row(), proxyIndex.column(), m_treeModel->index(0, 0));
- if (bumpedItems <= MOVEDROWS && bumpedItems == sourceModel()->rowCount(m_treeModel->index(0, 0)))
- --bumpedItems;
- return m_treeModel->index(proxyIndex.row() - bumpedItems, proxyIndex.column());
- }
-
- QModelIndex historyIndex = m_treeModel->sourceModel()->index(proxyIndex.internalId(), proxyIndex.column());
- QModelIndex treeIndex = m_treeModel->mapFromSource(historyIndex);
- return treeIndex;
-}
-
-QModelIndex HistoryMenuModel::index(int row, int column, const QModelIndex &parent) const
-{
- if (row < 0
- || column < 0 || column >= columnCount(parent)
- || parent.column() > 0)
- return QModelIndex();
- if (!parent.isValid())
- return createIndex(row, column, -1);
-
- QModelIndex treeIndexParent = mapToSource(parent);
-
- int bumpedItems = 0;
- if (treeIndexParent == m_treeModel->index(0, 0))
- bumpedItems = bumpedRows();
- QModelIndex treeIndex = m_treeModel->index(row + bumpedItems, column, treeIndexParent);
- QModelIndex historyIndex = m_treeModel->mapToSource(treeIndex);
- int historyRow = historyIndex.row();
- if (historyRow == -1)
- historyRow = treeIndex.row();
- return createIndex(row, column, historyRow);
-}
-
-QModelIndex HistoryMenuModel::parent(const QModelIndex &index) const
-{
- int offset = index.internalId();
- if (offset == -1 || !index.isValid())
- return QModelIndex();
-
- QModelIndex historyIndex = m_treeModel->sourceModel()->index(index.internalId(), 0);
- QModelIndex treeIndex = m_treeModel->mapFromSource(historyIndex);
- QModelIndex treeIndexParent = treeIndex.parent();
-
- int sr = m_treeModel->mapToSource(treeIndexParent).row();
- int bumpedItems = bumpedRows();
- if (bumpedItems <= MOVEDROWS && bumpedItems == sourceModel()->rowCount(sourceModel()->index(0, 0)))
- --bumpedItems;
- return createIndex(bumpedItems + treeIndexParent.row(), treeIndexParent.column(), sr);
-}
-
-
-HistoryMenu::HistoryMenu(QWidget *parent)
- : ModelMenu(parent)
- , m_history(0)
-{
- connect(this, SIGNAL(activated(const QModelIndex &)),
- this, SLOT(activated(const QModelIndex &)));
- setHoverRole(HistoryModel::UrlStringRole);
-}
-
-void HistoryMenu::activated(const QModelIndex &index)
-{
- emit openUrl(index.data(HistoryModel::UrlRole).toUrl());
-}
-
-bool HistoryMenu::prePopulated()
-{
- if (!m_history) {
- m_history = BrowserApplication::historyManager();
- m_historyMenuModel = new HistoryMenuModel(m_history->historyTreeModel(), this);
- setModel(m_historyMenuModel);
- }
- // initial actions
- for (int i = 0; i < m_initialActions.count(); ++i)
- addAction(m_initialActions.at(i));
- if (!m_initialActions.isEmpty())
- addSeparator();
- setFirstSeparator(m_historyMenuModel->bumpedRows());
-
- return false;
-}
-
-void HistoryMenu::postPopulated()
-{
- if (m_history->history().count() > 0)
- addSeparator();
-
- QAction *showAllAction = new QAction(tr("Show All History"), this);
- connect(showAllAction, SIGNAL(triggered()), this, SLOT(showHistoryDialog()));
- addAction(showAllAction);
-
- QAction *clearAction = new QAction(tr("Clear History"), this);
- connect(clearAction, SIGNAL(triggered()), m_history, SLOT(clear()));
- addAction(clearAction);
-}
-
-void HistoryMenu::showHistoryDialog()
-{
- HistoryDialog *dialog = new HistoryDialog(this);
- connect(dialog, SIGNAL(openUrl(const QUrl&)),
- this, SIGNAL(openUrl(const QUrl&)));
- dialog->show();
-}
-
-void HistoryMenu::setInitialActions(QList<QAction*> actions)
-{
- m_initialActions = actions;
- for (int i = 0; i < m_initialActions.count(); ++i)
- addAction(m_initialActions.at(i));
-}
-
-TreeProxyModel::TreeProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
-{
- setSortRole(HistoryModel::DateTimeRole);
- setFilterCaseSensitivity(Qt::CaseInsensitive);
-}
-
-bool TreeProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
-{
- if (!source_parent.isValid())
- return true;
- return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
-}
-
-HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory) : QDialog(parent)
-{
- HistoryManager *history = setHistory;
- if (!history)
- history = BrowserApplication::historyManager();
- setupUi(this);
- tree->setUniformRowHeights(true);
- tree->setSelectionBehavior(QAbstractItemView::SelectRows);
- tree->setTextElideMode(Qt::ElideMiddle);
- QAbstractItemModel *model = history->historyTreeModel();
- TreeProxyModel *proxyModel = new TreeProxyModel(this);
- connect(search, SIGNAL(textChanged(QString)),
- proxyModel, SLOT(setFilterFixedString(QString)));
- connect(removeButton, SIGNAL(clicked()), tree, SLOT(removeOne()));
- connect(removeAllButton, SIGNAL(clicked()), history, SLOT(clear()));
- proxyModel->setSourceModel(model);
- tree->setModel(proxyModel);
- tree->setExpanded(proxyModel->index(0, 0), true);
- tree->setAlternatingRowColors(true);
- QFontMetrics fm(font());
- int header = fm.width(QLatin1Char('m')) * 40;
- tree->header()->resizeSection(0, header);
- tree->header()->setStretchLastSection(true);
- connect(tree, SIGNAL(activated(const QModelIndex&)),
- this, SLOT(open()));
- tree->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(tree, SIGNAL(customContextMenuRequested(const QPoint &)),
- this, SLOT(customContextMenuRequested(const QPoint &)));
-}
-
-void HistoryDialog::customContextMenuRequested(const QPoint &pos)
-{
- QMenu menu;
- QModelIndex index = tree->indexAt(pos);
- index = index.sibling(index.row(), 0);
- if (index.isValid() && !tree->model()->hasChildren(index)) {
- menu.addAction(tr("Open"), this, SLOT(open()));
- menu.addSeparator();
- menu.addAction(tr("Copy"), this, SLOT(copy()));
- }
- menu.addAction(tr("Delete"), tree, SLOT(removeOne()));
- menu.exec(QCursor::pos());
-}
-
-void HistoryDialog::open()
-{
- QModelIndex index = tree->currentIndex();
- if (!index.parent().isValid())
- return;
- emit openUrl(index.data(HistoryModel::UrlRole).toUrl());
-}
-
-void HistoryDialog::copy()
-{
- QModelIndex index = tree->currentIndex();
- if (!index.parent().isValid())
- return;
- QString url = index.data(HistoryModel::UrlStringRole).toString();
-
- QClipboard *clipboard = QApplication::clipboard();
- clipboard->setText(url);
-}
-
-HistoryFilterModel::HistoryFilterModel(QAbstractItemModel *sourceModel, QObject *parent)
- : QAbstractProxyModel(parent),
- m_loaded(false)
-{
- setSourceModel(sourceModel);
-}
-
-int HistoryFilterModel::historyLocation(const QString &url) const
-{
- load();
- if (!m_historyHash.contains(url))
- return 0;
- return sourceModel()->rowCount() - m_historyHash.value(url);
-}
-
-QVariant HistoryFilterModel::data(const QModelIndex &index, int role) const
-{
- return QAbstractProxyModel::data(index, role);
-}
-
-void HistoryFilterModel::setSourceModel(QAbstractItemModel *newSourceModel)
-{
- if (sourceModel()) {
- disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset()));
- disconnect(sourceModel(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
- this, SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
- disconnect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsInserted(const QModelIndex &, int, int)));
- disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int)));
- }
-
- QAbstractProxyModel::setSourceModel(newSourceModel);
-
- if (sourceModel()) {
- m_loaded = false;
- connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset()));
- connect(sourceModel(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
- this, SLOT(sourceDataChanged(const QModelIndex &, const QModelIndex &)));
- connect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsInserted(const QModelIndex &, int, int)));
- connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int)));
- }
-}
-
-void HistoryFilterModel::sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
-{
- emit dataChanged(mapFromSource(topLeft), mapFromSource(bottomRight));
-}
-
-QVariant HistoryFilterModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- return sourceModel()->headerData(section, orientation, role);
-}
-
-void HistoryFilterModel::sourceReset()
-{
- m_loaded = false;
- reset();
-}
-
-int HistoryFilterModel::rowCount(const QModelIndex &parent) const
-{
- load();
- if (parent.isValid())
- return 0;
- return m_historyHash.count();
-}
-
-int HistoryFilterModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : 2;
-}
-
-QModelIndex HistoryFilterModel::mapToSource(const QModelIndex &proxyIndex) const
-{
- load();
- int sourceRow = sourceModel()->rowCount() - proxyIndex.internalId();
- return sourceModel()->index(sourceRow, proxyIndex.column());
-}
-
-QModelIndex HistoryFilterModel::mapFromSource(const QModelIndex &sourceIndex) const
-{
- load();
- QString url = sourceIndex.data(HistoryModel::UrlStringRole).toString();
- if (!m_historyHash.contains(url))
- return QModelIndex();
-
- // This can be done in a binary search, but we can't use qBinary find
- // because it can't take: qBinaryFind(m_sourceRow.end(), m_sourceRow.begin(), v);
- // so if this is a performance bottlneck then convert to binary search, until then
- // the cleaner/easier to read code wins the day.
- int realRow = -1;
- int sourceModelRow = sourceModel()->rowCount() - sourceIndex.row();
-
- for (int i = 0; i < m_sourceRow.count(); ++i) {
- if (m_sourceRow.at(i) == sourceModelRow) {
- realRow = i;
- break;
- }
- }
- if (realRow == -1)
- return QModelIndex();
-
- return createIndex(realRow, sourceIndex.column(), sourceModel()->rowCount() - sourceIndex.row());
-}
-
-QModelIndex HistoryFilterModel::index(int row, int column, const QModelIndex &parent) const
-{
- load();
- if (row < 0 || row >= rowCount(parent)
- || column < 0 || column >= columnCount(parent))
- return QModelIndex();
-
- return createIndex(row, column, m_sourceRow[row]);
-}
-
-QModelIndex HistoryFilterModel::parent(const QModelIndex &) const
-{
- return QModelIndex();
-}
-
-void HistoryFilterModel::load() const
-{
- if (m_loaded)
- return;
- m_sourceRow.clear();
- m_historyHash.clear();
- m_historyHash.reserve(sourceModel()->rowCount());
- for (int i = 0; i < sourceModel()->rowCount(); ++i) {
- QModelIndex idx = sourceModel()->index(i, 0);
- QString url = idx.data(HistoryModel::UrlStringRole).toString();
- if (!m_historyHash.contains(url)) {
- m_sourceRow.append(sourceModel()->rowCount() - i);
- m_historyHash[url] = sourceModel()->rowCount() - i;
- }
- }
- m_loaded = true;
-}
-
-void HistoryFilterModel::sourceRowsInserted(const QModelIndex &parent, int start, int end)
-{
- Q_ASSERT(start == end && start == 0);
- Q_UNUSED(end);
- if (!m_loaded)
- return;
- QModelIndex idx = sourceModel()->index(start, 0, parent);
- QString url = idx.data(HistoryModel::UrlStringRole).toString();
- if (m_historyHash.contains(url)) {
- int sourceRow = sourceModel()->rowCount() - m_historyHash[url];
- int realRow = mapFromSource(sourceModel()->index(sourceRow, 0)).row();
- beginRemoveRows(QModelIndex(), realRow, realRow);
- m_sourceRow.removeAt(realRow);
- m_historyHash.remove(url);
- endRemoveRows();
- }
- beginInsertRows(QModelIndex(), 0, 0);
- m_historyHash.insert(url, sourceModel()->rowCount() - start);
- m_sourceRow.insert(0, sourceModel()->rowCount());
- endInsertRows();
-}
-
-void HistoryFilterModel::sourceRowsRemoved(const QModelIndex &, int start, int end)
-{
- Q_UNUSED(start);
- Q_UNUSED(end);
- sourceReset();
-}
-
-/*
- Removing a continuous block of rows will remove filtered rows too as this is
- the users intention.
-*/
-bool HistoryFilterModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (row < 0 || count <= 0 || row + count > rowCount(parent) || parent.isValid())
- return false;
- int lastRow = row + count - 1;
- disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int)));
- beginRemoveRows(parent, row, lastRow);
- int oldCount = rowCount();
- int start = sourceModel()->rowCount() - m_sourceRow.value(row);
- int end = sourceModel()->rowCount() - m_sourceRow.value(lastRow);
- sourceModel()->removeRows(start, end - start + 1);
- endRemoveRows();
- connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int)));
- m_loaded = false;
- if (oldCount - count != rowCount())
- reset();
- return true;
-}
-
-HistoryCompletionModel::HistoryCompletionModel(QObject *parent)
- : QAbstractProxyModel(parent)
-{
-}
-
-QVariant HistoryCompletionModel::data(const QModelIndex &index, int role) const
-{
- if (sourceModel()
- && (role == Qt::EditRole || role == Qt::DisplayRole)
- && index.isValid()) {
- QModelIndex idx = mapToSource(index);
- idx = idx.sibling(idx.row(), 1);
- QString urlString = idx.data(HistoryModel::UrlStringRole).toString();
- if (index.row() % 2) {
- QUrl url = urlString;
- QString s = url.toString(QUrl::RemoveScheme
- | QUrl::RemoveUserInfo
- | QUrl::StripTrailingSlash);
- return s.mid(2); // strip // from the front
- }
- return urlString;
- }
- return QAbstractProxyModel::data(index, role);
-}
-
-int HistoryCompletionModel::rowCount(const QModelIndex &parent) const
-{
- return (parent.isValid() || !sourceModel()) ? 0 : sourceModel()->rowCount(parent) * 2;
-}
-
-int HistoryCompletionModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : 1;
-}
-
-QModelIndex HistoryCompletionModel::mapFromSource(const QModelIndex &sourceIndex) const
-{
- int row = sourceIndex.row() * 2;
- return index(row, sourceIndex.column());
-}
-
-QModelIndex HistoryCompletionModel::mapToSource(const QModelIndex &proxyIndex) const
-{
- if (!sourceModel())
- return QModelIndex();
- int row = proxyIndex.row() / 2;
- return sourceModel()->index(row, proxyIndex.column());
-}
-
-QModelIndex HistoryCompletionModel::index(int row, int column, const QModelIndex &parent) const
-{
- if (row < 0 || row >= rowCount(parent)
- || column < 0 || column >= columnCount(parent))
- return QModelIndex();
- return createIndex(row, column, 0);
-}
-
-QModelIndex HistoryCompletionModel::parent(const QModelIndex &) const
-{
- return QModelIndex();
-}
-
-void HistoryCompletionModel::setSourceModel(QAbstractItemModel *newSourceModel)
-{
- if (sourceModel()) {
- disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset()));
- disconnect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(sourceReset()));
- disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(sourceReset()));
- }
-
- QAbstractProxyModel::setSourceModel(newSourceModel);
-
- if (newSourceModel) {
- connect(newSourceModel, SIGNAL(modelReset()), this, SLOT(sourceReset()));
- connect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(sourceReset()));
- connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(sourceReset()));
- }
-
- reset();
-}
-
-void HistoryCompletionModel::sourceReset()
-{
- reset();
-}
-
-HistoryTreeModel::HistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent)
- : QAbstractProxyModel(parent)
-{
- setSourceModel(sourceModel);
-}
-
-QVariant HistoryTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- return sourceModel()->headerData(section, orientation, role);
-}
-
-QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const
-{
- if ((role == Qt::EditRole || role == Qt::DisplayRole)) {
- int start = index.internalId();
- if (start == 0) {
- int offset = sourceDateRow(index.row());
- if (index.column() == 0) {
- QModelIndex idx = sourceModel()->index(offset, 0);
- QDate date = idx.data(HistoryModel::DateRole).toDate();
- if (date == QDate::currentDate())
- return tr("Earlier Today");
- return date.toString(QLatin1String("dddd, MMMM d, yyyy"));
- }
- if (index.column() == 1) {
- return tr("%1 items").arg(rowCount(index.sibling(index.row(), 0)));
- }
- }
- }
- if (role == Qt::DecorationRole && index.column() == 0 && !index.parent().isValid())
- return QIcon(QLatin1String(":history.png"));
- if (role == HistoryModel::DateRole && index.column() == 0 && index.internalId() == 0) {
- int offset = sourceDateRow(index.row());
- QModelIndex idx = sourceModel()->index(offset, 0);
- return idx.data(HistoryModel::DateRole);
- }
-
- return QAbstractProxyModel::data(index, role);
-}
-
-int HistoryTreeModel::columnCount(const QModelIndex &parent) const
-{
- return sourceModel()->columnCount(mapToSource(parent));
-}
-
-int HistoryTreeModel::rowCount(const QModelIndex &parent) const
-{
- if ( parent.internalId() != 0
- || parent.column() > 0
- || !sourceModel())
- return 0;
-
- // row count OF dates
- if (!parent.isValid()) {
- if (!m_sourceRowCache.isEmpty())
- return m_sourceRowCache.count();
- QDate currentDate;
- int rows = 0;
- int totalRows = sourceModel()->rowCount();
-
- for (int i = 0; i < totalRows; ++i) {
- QDate rowDate = sourceModel()->index(i, 0).data(HistoryModel::DateRole).toDate();
- if (rowDate != currentDate) {
- m_sourceRowCache.append(i);
- currentDate = rowDate;
- ++rows;
- }
- }
- Q_ASSERT(m_sourceRowCache.count() == rows);
- return rows;
- }
-
- // row count FOR a date
- int start = sourceDateRow(parent.row());
- int end = sourceDateRow(parent.row() + 1);
- return (end - start);
-}
-
-// Translate the top level date row into the offset where that date starts
-int HistoryTreeModel::sourceDateRow(int row) const
-{
- if (row <= 0)
- return 0;
-
- if (m_sourceRowCache.isEmpty())
- rowCount(QModelIndex());
-
- if (row >= m_sourceRowCache.count()) {
- if (!sourceModel())
- return 0;
- return sourceModel()->rowCount();
- }
- return m_sourceRowCache.at(row);
-}
-
-QModelIndex HistoryTreeModel::mapToSource(const QModelIndex &proxyIndex) const
-{
- int offset = proxyIndex.internalId();
- if (offset == 0)
- return QModelIndex();
- int startDateRow = sourceDateRow(offset - 1);
- return sourceModel()->index(startDateRow + proxyIndex.row(), proxyIndex.column());
-}
-
-QModelIndex HistoryTreeModel::index(int row, int column, const QModelIndex &parent) const
-{
- if (row < 0
- || column < 0 || column >= columnCount(parent)
- || parent.column() > 0)
- return QModelIndex();
-
- if (!parent.isValid())
- return createIndex(row, column, 0);
- return createIndex(row, column, parent.row() + 1);
-}
-
-QModelIndex HistoryTreeModel::parent(const QModelIndex &index) const
-{
- int offset = index.internalId();
- if (offset == 0 || !index.isValid())
- return QModelIndex();
- return createIndex(offset - 1, 0, 0);
-}
-
-bool HistoryTreeModel::hasChildren(const QModelIndex &parent) const
-{
- QModelIndex grandparent = parent.parent();
- if (!grandparent.isValid())
- return true;
- return false;
-}
-
-Qt::ItemFlags HistoryTreeModel::flags(const QModelIndex &index) const
-{
- if (!index.isValid())
- return Qt::NoItemFlags;
- return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled;
-}
-
-bool HistoryTreeModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (row < 0 || count <= 0 || row + count > rowCount(parent))
- return false;
-
- if (parent.isValid()) {
- // removing pages
- int offset = sourceDateRow(parent.row());
- return sourceModel()->removeRows(offset + row, count);
- } else {
- // removing whole dates
- for (int i = row + count - 1; i >= row; --i) {
- QModelIndex dateParent = index(i, 0);
- int offset = sourceDateRow(dateParent.row());
- if (!sourceModel()->removeRows(offset, rowCount(dateParent)))
- return false;
- }
- }
- return true;
-}
-
-void HistoryTreeModel::setSourceModel(QAbstractItemModel *newSourceModel)
-{
- if (sourceModel()) {
- disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset()));
- disconnect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(sourceReset()));
- disconnect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsInserted(const QModelIndex &, int, int)));
- disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int)));
- }
-
- QAbstractProxyModel::setSourceModel(newSourceModel);
-
- if (newSourceModel) {
- connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset()));
- connect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(sourceReset()));
- connect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsInserted(const QModelIndex &, int, int)));
- connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int)));
- }
-
- reset();
-}
-
-void HistoryTreeModel::sourceReset()
-{
- m_sourceRowCache.clear();
- reset();
-}
-
-void HistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start, int end)
-{
- Q_UNUSED(parent); // Avoid warnings when compiling release
- Q_ASSERT(!parent.isValid());
- if (start != 0 || start != end) {
- m_sourceRowCache.clear();
- reset();
- return;
- }
-
- m_sourceRowCache.clear();
- QModelIndex treeIndex = mapFromSource(sourceModel()->index(start, 0));
- QModelIndex treeParent = treeIndex.parent();
- if (rowCount(treeParent) == 1) {
- beginInsertRows(QModelIndex(), 0, 0);
- endInsertRows();
- } else {
- beginInsertRows(treeParent, treeIndex.row(), treeIndex.row());
- endInsertRows();
- }
-}
-
-QModelIndex HistoryTreeModel::mapFromSource(const QModelIndex &sourceIndex) const
-{
- if (!sourceIndex.isValid())
- return QModelIndex();
-
- if (m_sourceRowCache.isEmpty())
- rowCount(QModelIndex());
-
- QList<int>::iterator it;
- it = qLowerBound(m_sourceRowCache.begin(), m_sourceRowCache.end(), sourceIndex.row());
- if (*it != sourceIndex.row())
- --it;
- int dateRow = qMax(0, it - m_sourceRowCache.begin());
- int row = sourceIndex.row() - m_sourceRowCache.at(dateRow);
- return createIndex(row, sourceIndex.column(), dateRow + 1);
-}
-
-void HistoryTreeModel::sourceRowsRemoved(const QModelIndex &parent, int start, int end)
-{
- Q_UNUSED(parent); // Avoid warnings when compiling release
- Q_ASSERT(!parent.isValid());
- if (m_sourceRowCache.isEmpty())
- return;
- for (int i = end; i >= start;) {
- QList<int>::iterator it;
- it = qLowerBound(m_sourceRowCache.begin(), m_sourceRowCache.end(), i);
- // playing it safe
- if (it == m_sourceRowCache.end()) {
- m_sourceRowCache.clear();
- reset();
- return;
- }
-
- if (*it != i)
- --it;
- int row = qMax(0, it - m_sourceRowCache.begin());
- int offset = m_sourceRowCache[row];
- QModelIndex dateParent = index(row, 0);
- // If we can remove all the rows in the date do that and skip over them
- int rc = rowCount(dateParent);
- if (i - rc + 1 == offset && start <= i - rc + 1) {
- beginRemoveRows(QModelIndex(), row, row);
- m_sourceRowCache.removeAt(row);
- i -= rc + 1;
- } else {
- beginRemoveRows(dateParent, i - offset, i - offset);
- ++row;
- --i;
- }
- for (int j = row; j < m_sourceRowCache.count(); ++j)
- --m_sourceRowCache[j];
- endRemoveRows();
- }
-}
-
diff --git a/examples/gestures/browser/history.h b/examples/gestures/browser/history.h
deleted file mode 100644
index 626e2f3..0000000
--- a/examples/gestures/browser/history.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef HISTORY_H
-#define HISTORY_H
-
-#include "modelmenu.h"
-
-#include <QtCore/QDateTime>
-#include <QtCore/QHash>
-#include <QtCore/QObject>
-#include <QtCore/QTimer>
-#include <QtCore/QUrl>
-
-#include <QtGui/QSortFilterProxyModel>
-
-#include <QWebHistoryInterface>
-
-class HistoryItem
-{
-public:
- HistoryItem() {}
- HistoryItem(const QString &u,
- const QDateTime &d = QDateTime(), const QString &t = QString())
- : title(t), url(u), dateTime(d) {}
-
- inline bool operator==(const HistoryItem &other) const
- { return other.title == title
- && other.url == url && other.dateTime == dateTime; }
-
- // history is sorted in reverse
- inline bool operator <(const HistoryItem &other) const
- { return dateTime > other.dateTime; }
-
- QString title;
- QString url;
- QDateTime dateTime;
-};
-
-class AutoSaver;
-class HistoryModel;
-class HistoryFilterModel;
-class HistoryTreeModel;
-class HistoryManager : public QWebHistoryInterface
-{
- Q_OBJECT
- Q_PROPERTY(int historyLimit READ historyLimit WRITE setHistoryLimit)
-
-signals:
- void historyReset();
- void entryAdded(const HistoryItem &item);
- void entryRemoved(const HistoryItem &item);
- void entryUpdated(int offset);
-
-public:
- HistoryManager(QObject *parent = 0);
- ~HistoryManager();
-
- bool historyContains(const QString &url) const;
- void addHistoryEntry(const QString &url);
-
- void updateHistoryItem(const QUrl &url, const QString &title);
-
- int historyLimit() const;
- void setHistoryLimit(int limit);
-
- QList<HistoryItem> history() const;
- void setHistory(const QList<HistoryItem> &history, bool loadedAndSorted = false);
-
- // History manager keeps around these models for use by the completer and other classes
- HistoryModel *historyModel() const;
- HistoryFilterModel *historyFilterModel() const;
- HistoryTreeModel *historyTreeModel() const;
-
-public slots:
- void clear();
- void loadSettings();
-
-private slots:
- void save();
- void checkForExpired();
-
-protected:
- void addHistoryItem(const HistoryItem &item);
-
-private:
- void load();
-
- AutoSaver *m_saveTimer;
- int m_historyLimit;
- QTimer m_expiredTimer;
- QList<HistoryItem> m_history;
- QString m_lastSavedUrl;
-
- HistoryModel *m_historyModel;
- HistoryFilterModel *m_historyFilterModel;
- HistoryTreeModel *m_historyTreeModel;
-};
-
-class HistoryModel : public QAbstractTableModel
-{
- Q_OBJECT
-
-public slots:
- void historyReset();
- void entryAdded();
- void entryUpdated(int offset);
-
-public:
- enum Roles {
- DateRole = Qt::UserRole + 1,
- DateTimeRole = Qt::UserRole + 2,
- UrlRole = Qt::UserRole + 3,
- UrlStringRole = Qt::UserRole + 4
- };
-
- HistoryModel(HistoryManager *history, QObject *parent = 0);
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
-
-private:
- HistoryManager *m_history;
-};
-
-/*!
- Proxy model that will remove any duplicate entries.
- Both m_sourceRow and m_historyHash store their offsets not from
- the front of the list, but as offsets from the back.
- */
-class HistoryFilterModel : public QAbstractProxyModel
-{
- Q_OBJECT
-
-public:
- HistoryFilterModel(QAbstractItemModel *sourceModel, QObject *parent = 0);
-
- inline bool historyContains(const QString &url) const
- { load(); return m_historyHash.contains(url); }
- int historyLocation(const QString &url) const;
-
- QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
- QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
- void setSourceModel(QAbstractItemModel *sourceModel);
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- QModelIndex index(int, int, const QModelIndex& = QModelIndex()) const;
- QModelIndex parent(const QModelIndex& index= QModelIndex()) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
-private slots:
- void sourceReset();
- void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
- void sourceRowsInserted(const QModelIndex &parent, int start, int end);
- void sourceRowsRemoved(const QModelIndex &, int, int);
-
-private:
- void load() const;
-
- mutable QList<int> m_sourceRow;
- mutable QHash<QString, int> m_historyHash;
- mutable bool m_loaded;
-};
-
-/*
- The history menu
- - Removes the first twenty entries and puts them as children of the top level.
- - If there are less then twenty entries then the first folder is also removed.
-
- The mapping is done by knowing that HistoryTreeModel is over a table
- We store that row offset in our index's private data.
-*/
-class HistoryMenuModel : public QAbstractProxyModel
-{
- Q_OBJECT
-
-public:
- HistoryMenuModel(HistoryTreeModel *sourceModel, QObject *parent = 0);
- int columnCount(const QModelIndex &parent) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QModelIndex mapFromSource(const QModelIndex & sourceIndex) const;
- QModelIndex mapToSource(const QModelIndex & proxyIndex) const;
- QModelIndex index(int, int, const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &index = QModelIndex()) const;
-
- int bumpedRows() const;
-
-private:
- HistoryTreeModel *m_treeModel;
-};
-
-// Menu that is dynamically populated from the history
-class HistoryMenu : public ModelMenu
-{
- Q_OBJECT
-
-signals:
- void openUrl(const QUrl &url);
-
-public:
- HistoryMenu(QWidget *parent = 0);
- void setInitialActions(QList<QAction*> actions);
-
-protected:
- bool prePopulated();
- void postPopulated();
-
-private slots:
- void activated(const QModelIndex &index);
- void showHistoryDialog();
-
-private:
- HistoryManager *m_history;
- HistoryMenuModel *m_historyMenuModel;
- QList<QAction*> m_initialActions;
-};
-
-// proxy model for the history model that
-// exposes each url http://www.foo.com and it url starting at the host www.foo.com
-class HistoryCompletionModel : public QAbstractProxyModel
-{
- Q_OBJECT
-
-public:
- HistoryCompletionModel(QObject *parent = 0);
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
- QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
- QModelIndex index(int, int, const QModelIndex& = QModelIndex()) const;
- QModelIndex parent(const QModelIndex& index= QModelIndex()) const;
- void setSourceModel(QAbstractItemModel *sourceModel);
-
-private slots:
- void sourceReset();
-
-};
-
-// proxy model for the history model that converts the list
-// into a tree, one top level node per day.
-// Used in the HistoryDialog.
-class HistoryTreeModel : public QAbstractProxyModel
-{
- Q_OBJECT
-
-public:
- HistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent = 0);
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int columnCount(const QModelIndex &parent) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
- QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &index= QModelIndex()) const;
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
-
- void setSourceModel(QAbstractItemModel *sourceModel);
-
-private slots:
- void sourceReset();
- void sourceRowsInserted(const QModelIndex &parent, int start, int end);
- void sourceRowsRemoved(const QModelIndex &parent, int start, int end);
-
-private:
- int sourceDateRow(int row) const;
- mutable QList<int> m_sourceRowCache;
-
-};
-
-// A modified QSortFilterProxyModel that always accepts the root nodes in the tree
-// so filtering is only done on the children.
-// Used in the HistoryDialog
-class TreeProxyModel : public QSortFilterProxyModel
-{
- Q_OBJECT
-
-public:
- TreeProxyModel(QObject *parent = 0);
-
-protected:
- bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
-};
-
-#include "ui_history.h"
-
-class HistoryDialog : public QDialog, public Ui_HistoryDialog
-{
- Q_OBJECT
-
-signals:
- void openUrl(const QUrl &url);
-
-public:
- HistoryDialog(QWidget *parent = 0, HistoryManager *history = 0);
-
-private slots:
- void customContextMenuRequested(const QPoint &pos);
- void open();
- void copy();
-
-};
-
-#endif // HISTORY_H
-
diff --git a/examples/gestures/browser/history.ui b/examples/gestures/browser/history.ui
deleted file mode 100644
index 0944940..0000000
--- a/examples/gestures/browser/history.ui
+++ /dev/null
@@ -1,106 +0,0 @@
-<ui version="4.0" >
- <class>HistoryDialog</class>
- <widget class="QDialog" name="HistoryDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>758</width>
- <height>450</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>History</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>252</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1" >
- <widget class="SearchLineEdit" name="search" />
- </item>
- <item row="1" column="0" colspan="2" >
- <widget class="EditTreeView" name="tree" />
- </item>
- <item row="2" column="0" colspan="2" >
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QPushButton" name="removeButton" >
- <property name="text" >
- <string>&amp;Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="removeAllButton" >
- <property name="text" >
- <string>Remove &amp;All</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="standardButtons" >
- <set>QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>SearchLineEdit</class>
- <extends>QLineEdit</extends>
- <header>searchlineedit.h</header>
- </customwidget>
- <customwidget>
- <class>EditTreeView</class>
- <extends>QTreeView</extends>
- <header>edittreeview.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>HistoryDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>472</x>
- <y>329</y>
- </hint>
- <hint type="destinationlabel" >
- <x>461</x>
- <y>356</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/gestures/browser/htmls/htmls.qrc b/examples/gestures/browser/htmls/htmls.qrc
deleted file mode 100644
index 03b256c..0000000
--- a/examples/gestures/browser/htmls/htmls.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>notfound.html</file>
-</qresource>
-</RCC>
diff --git a/examples/gestures/browser/htmls/notfound.html b/examples/gestures/browser/htmls/notfound.html
deleted file mode 100644
index b04a9f8..0000000
--- a/examples/gestures/browser/htmls/notfound.html
+++ /dev/null
@@ -1,63 +0,0 @@
-<html>
-<head>
-<title>%1</title>
-<style>
-body {
- padding: 3em 0em;
- background: #eeeeee;
-}
-hr {
- color: lightgray;
- width: 100%;
-}
-img {
- float: left;
- opacity: .8;
-}
-#box {
- background: white;
- border: 1px solid lightgray;
- width: 600px;
- padding: 60px;
- margin: auto;
-}
-h1 {
- font-size: 130%;
- font-weight: bold;
- border-bottom: 1px solid lightgray;
- margin-left: 48px;
-}
-h2 {
- font-size: 100%;
- font-weight: normal;
- border-bottom: 1px solid lightgray;
- margin-left: 48px;
-}
-ul {
- font-size: 80%;
- padding-left: 48px;
- margin: 0;
-}
-#reloadButton {
- padding-left: 48px;
-}
-</style>
-</head>
-<body>
- <div id="box">
- <img src="data:image/png;base64,IMAGE_BINARY_DATA_HERE" width="32" height="32"/>
- <h1>%2</h1>
- <h2>When connecting to: %3.</h2>
- <ul>
- <li>Check the address for errors such as <b>ww</b>.trolltech.com
- instead of <b>www</b>.trolltech.com</li>
- <li>If the address is correct, try checking the network
- connection.</li>
- <li>If your computer or network is protected by a firewall or
- proxy, make sure that the browser demo is permitted to access
- the network.</li>
- </ul>
- <br/><br/>
- </div>
-</body>
-</html>
diff --git a/examples/gestures/browser/modelmenu.cpp b/examples/gestures/browser/modelmenu.cpp
deleted file mode 100644
index 2e81d0d..0000000
--- a/examples/gestures/browser/modelmenu.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "modelmenu.h"
-
-#include <QtCore/QAbstractItemModel>
-#include <qdebug.h>
-
-ModelMenu::ModelMenu(QWidget * parent)
- : QMenu(parent)
- , m_maxRows(7)
- , m_firstSeparator(-1)
- , m_maxWidth(-1)
- , m_hoverRole(0)
- , m_separatorRole(0)
- , m_model(0)
-{
- connect(this, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
-}
-
-bool ModelMenu::prePopulated()
-{
- return false;
-}
-
-void ModelMenu::postPopulated()
-{
-}
-
-void ModelMenu::setModel(QAbstractItemModel *model)
-{
- m_model = model;
-}
-
-QAbstractItemModel *ModelMenu::model() const
-{
- return m_model;
-}
-
-void ModelMenu::setMaxRows(int max)
-{
- m_maxRows = max;
-}
-
-int ModelMenu::maxRows() const
-{
- return m_maxRows;
-}
-
-void ModelMenu::setFirstSeparator(int offset)
-{
- m_firstSeparator = offset;
-}
-
-int ModelMenu::firstSeparator() const
-{
- return m_firstSeparator;
-}
-
-void ModelMenu::setRootIndex(const QModelIndex &index)
-{
- m_root = index;
-}
-
-QModelIndex ModelMenu::rootIndex() const
-{
- return m_root;
-}
-
-void ModelMenu::setHoverRole(int role)
-{
- m_hoverRole = role;
-}
-
-int ModelMenu::hoverRole() const
-{
- return m_hoverRole;
-}
-
-void ModelMenu::setSeparatorRole(int role)
-{
- m_separatorRole = role;
-}
-
-int ModelMenu::separatorRole() const
-{
- return m_separatorRole;
-}
-
-Q_DECLARE_METATYPE(QModelIndex)
-void ModelMenu::aboutToShow()
-{
- if (QMenu *menu = qobject_cast<QMenu*>(sender())) {
- QVariant v = menu->menuAction()->data();
- if (v.canConvert<QModelIndex>()) {
- QModelIndex idx = qvariant_cast<QModelIndex>(v);
- createMenu(idx, -1, menu, menu);
- disconnect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
- return;
- }
- }
-
- clear();
- if (prePopulated())
- addSeparator();
- int max = m_maxRows;
- if (max != -1)
- max += m_firstSeparator;
- createMenu(m_root, max, this, this);
- postPopulated();
-}
-
-void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu, QMenu *menu)
-{
- if (!menu) {
- QString title = parent.data().toString();
- menu = new QMenu(title, this);
- QIcon icon = qvariant_cast<QIcon>(parent.data(Qt::DecorationRole));
- menu->setIcon(icon);
- parentMenu->addMenu(menu);
- QVariant v;
- v.setValue(parent);
- menu->menuAction()->setData(v);
- connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
- return;
- }
-
- int end = m_model->rowCount(parent);
- if (max != -1)
- end = qMin(max, end);
-
- connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(triggered(QAction*)));
- connect(menu, SIGNAL(hovered(QAction*)), this, SLOT(hovered(QAction*)));
-
- for (int i = 0; i < end; ++i) {
- QModelIndex idx = m_model->index(i, 0, parent);
- if (m_model->hasChildren(idx)) {
- createMenu(idx, -1, menu);
- } else {
- if (m_separatorRole != 0
- && idx.data(m_separatorRole).toBool())
- addSeparator();
- else
- menu->addAction(makeAction(idx));
- }
- if (menu == this && i == m_firstSeparator - 1)
- addSeparator();
- }
-}
-
-QAction *ModelMenu::makeAction(const QModelIndex &index)
-{
- QIcon icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole));
- QAction *action = makeAction(icon, index.data().toString(), this);
- QVariant v;
- v.setValue(index);
- action->setData(v);
- return action;
-}
-
-QAction *ModelMenu::makeAction(const QIcon &icon, const QString &text, QObject *parent)
-{
- QFontMetrics fm(font());
- if (-1 == m_maxWidth)
- m_maxWidth = fm.width(QLatin1Char('m')) * 30;
- QString smallText = fm.elidedText(text, Qt::ElideMiddle, m_maxWidth);
- return new QAction(icon, smallText, parent);
-}
-
-void ModelMenu::triggered(QAction *action)
-{
- QVariant v = action->data();
- if (v.canConvert<QModelIndex>()) {
- QModelIndex idx = qvariant_cast<QModelIndex>(v);
- emit activated(idx);
- }
-}
-
-void ModelMenu::hovered(QAction *action)
-{
- QVariant v = action->data();
- if (v.canConvert<QModelIndex>()) {
- QModelIndex idx = qvariant_cast<QModelIndex>(v);
- QString hoveredString = idx.data(m_hoverRole).toString();
- if (!hoveredString.isEmpty())
- emit hovered(hoveredString);
- }
-}
-
diff --git a/examples/gestures/browser/modelmenu.h b/examples/gestures/browser/modelmenu.h
deleted file mode 100644
index b44daa8..0000000
--- a/examples/gestures/browser/modelmenu.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MODELMENU_H
-#define MODELMENU_H
-
-#include <QtGui/QMenu>
-#include <QtCore/QAbstractItemModel>
-
-// A QMenu that is dynamically populated from a QAbstractItemModel
-class ModelMenu : public QMenu
-{
- Q_OBJECT
-
-signals:
- void activated(const QModelIndex &index);
- void hovered(const QString &text);
-
-public:
- ModelMenu(QWidget *parent = 0);
-
- void setModel(QAbstractItemModel *model);
- QAbstractItemModel *model() const;
-
- void setMaxRows(int max);
- int maxRows() const;
-
- void setFirstSeparator(int offset);
- int firstSeparator() const;
-
- void setRootIndex(const QModelIndex &index);
- QModelIndex rootIndex() const;
-
- void setHoverRole(int role);
- int hoverRole() const;
-
- void setSeparatorRole(int role);
- int separatorRole() const;
-
- QAction *makeAction(const QIcon &icon, const QString &text, QObject *parent);
-
-protected:
- // add any actions before the tree, return true if any actions are added.
- virtual bool prePopulated();
- // add any actions after the tree
- virtual void postPopulated();
- // put all of the children of parent into menu up to max
- void createMenu(const QModelIndex &parent, int max, QMenu *parentMenu = 0, QMenu *menu = 0);
-
-private slots:
- void aboutToShow();
- void triggered(QAction *action);
- void hovered(QAction *action);
-
-private:
- QAction *makeAction(const QModelIndex &index);
- int m_maxRows;
- int m_firstSeparator;
- int m_maxWidth;
- int m_hoverRole;
- int m_separatorRole;
- QAbstractItemModel *m_model;
- QPersistentModelIndex m_root;
-};
-
-#endif // MODELMENU_H
-
diff --git a/examples/gestures/browser/networkaccessmanager.cpp b/examples/gestures/browser/networkaccessmanager.cpp
deleted file mode 100644
index 3a4598c..0000000
--- a/examples/gestures/browser/networkaccessmanager.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "networkaccessmanager.h"
-
-#include "browserapplication.h"
-#include "browsermainwindow.h"
-#include "ui_passworddialog.h"
-#include "ui_proxy.h"
-
-#include <QtCore/QSettings>
-
-#include <QtGui/QDesktopServices>
-#include <QtGui/QDialog>
-#include <QtGui/QMessageBox>
-#include <QtGui/QStyle>
-#include <QtGui/QTextDocument>
-
-#include <QtNetwork/QAuthenticator>
-#include <QtNetwork/QNetworkDiskCache>
-#include <QtNetwork/QNetworkProxy>
-#include <QtNetwork/QNetworkReply>
-#include <QtNetwork/QSslError>
-
-NetworkAccessManager::NetworkAccessManager(QObject *parent)
- : QNetworkAccessManager(parent)
-{
- connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
- SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*)));
- connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),
- SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));
-#ifndef QT_NO_OPENSSL
- connect(this, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
- SLOT(sslErrors(QNetworkReply*, const QList<QSslError>&)));
-#endif
- loadSettings();
-
- QNetworkDiskCache *diskCache = new QNetworkDiskCache(this);
- QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
- diskCache->setCacheDirectory(location);
- setCache(diskCache);
-}
-
-void NetworkAccessManager::loadSettings()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("proxy"));
- QNetworkProxy proxy;
- if (settings.value(QLatin1String("enabled"), false).toBool()) {
- if (settings.value(QLatin1String("type"), 0).toInt() == 0)
- proxy = QNetworkProxy::Socks5Proxy;
- else
- proxy = QNetworkProxy::HttpProxy;
- proxy.setHostName(settings.value(QLatin1String("hostName")).toString());
- proxy.setPort(settings.value(QLatin1String("port"), 1080).toInt());
- proxy.setUser(settings.value(QLatin1String("userName")).toString());
- proxy.setPassword(settings.value(QLatin1String("password")).toString());
- }
- setProxy(proxy);
-}
-
-void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthenticator *auth)
-{
- BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
-
- QDialog dialog(mainWindow);
- dialog.setWindowFlags(Qt::Sheet);
-
- Ui::PasswordDialog passwordDialog;
- passwordDialog.setupUi(&dialog);
-
- passwordDialog.iconLabel->setText(QString());
- passwordDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32));
-
- QString introMessage = tr("<qt>Enter username and password for \"%1\" at %2</qt>");
- introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString()));
- passwordDialog.introLabel->setText(introMessage);
- passwordDialog.introLabel->setWordWrap(true);
-
- if (dialog.exec() == QDialog::Accepted) {
- auth->setUser(passwordDialog.userNameLineEdit->text());
- auth->setPassword(passwordDialog.passwordLineEdit->text());
- }
-}
-
-void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth)
-{
- BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
-
- QDialog dialog(mainWindow);
- dialog.setWindowFlags(Qt::Sheet);
-
- Ui::ProxyDialog proxyDialog;
- proxyDialog.setupUi(&dialog);
-
- proxyDialog.iconLabel->setText(QString());
- proxyDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32));
-
- QString introMessage = tr("<qt>Connect to proxy \"%1\" using:</qt>");
- introMessage = introMessage.arg(Qt::escape(proxy.hostName()));
- proxyDialog.introLabel->setText(introMessage);
- proxyDialog.introLabel->setWordWrap(true);
-
- if (dialog.exec() == QDialog::Accepted) {
- auth->setUser(proxyDialog.userNameLineEdit->text());
- auth->setPassword(proxyDialog.passwordLineEdit->text());
- }
-}
-
-#ifndef QT_NO_OPENSSL
-void NetworkAccessManager::sslErrors(QNetworkReply *reply, const QList<QSslError> &error)
-{
- // check if SSL certificate has been trusted already
- QString replyHost = reply->url().host() + ":" + reply->url().port();
- if(! sslTrustedHostList.contains(replyHost)) {
- BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
-
- QStringList errorStrings;
- for (int i = 0; i < error.count(); ++i)
- errorStrings += error.at(i).errorString();
- QString errors = errorStrings.join(QLatin1String("\n"));
- int ret = QMessageBox::warning(mainWindow, QCoreApplication::applicationName(),
- tr("SSL Errors:\n\n%1\n\n%2\n\n"
- "Do you want to ignore these errors for this host?").arg(reply->url().toString()).arg(errors),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::No);
- if (ret == QMessageBox::Yes) {
- reply->ignoreSslErrors();
- sslTrustedHostList.append(replyHost);
- }
- }
-}
-#endif
diff --git a/examples/gestures/browser/passworddialog.ui b/examples/gestures/browser/passworddialog.ui
deleted file mode 100644
index 7c16658..0000000
--- a/examples/gestures/browser/passworddialog.ui
+++ /dev/null
@@ -1,111 +0,0 @@
-<ui version="4.0" >
- <class>PasswordDialog</class>
- <widget class="QDialog" name="PasswordDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>399</width>
- <height>148</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Authentication Required</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" colspan="2" >
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="iconLabel" >
- <property name="text" >
- <string>DUMMY ICON</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="introLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>INTRO TEXT DUMMY</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="userNameLineEdit" />
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="lblPassword" >
- <property name="text" >
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QLineEdit" name="passwordLineEdit" >
- <property name="echoMode" >
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2" >
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>PasswordDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel" >
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>PasswordDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel" >
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/gestures/browser/proxy.ui b/examples/gestures/browser/proxy.ui
deleted file mode 100644
index 62a8be6..0000000
--- a/examples/gestures/browser/proxy.ui
+++ /dev/null
@@ -1,104 +0,0 @@
-<ui version="4.0" >
- <class>ProxyDialog</class>
- <widget class="QDialog" name="ProxyDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>369</width>
- <height>144</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Proxy Authentication</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="iconLabel" >
- <property name="text" >
- <string>ICON</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2" >
- <widget class="QLabel" name="introLabel" >
- <property name="text" >
- <string>Connect to proxy</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2" >
- <widget class="QLabel" name="usernameLabel" >
- <property name="text" >
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <widget class="QLineEdit" name="userNameLineEdit" />
- </item>
- <item row="2" column="0" colspan="2" >
- <widget class="QLabel" name="passwordLabel" >
- <property name="text" >
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2" >
- <widget class="QLineEdit" name="passwordLineEdit" >
- <property name="echoMode" >
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="3" >
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>ProxyDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel" >
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>ProxyDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel" >
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/gestures/browser/searchlineedit.cpp b/examples/gestures/browser/searchlineedit.cpp
deleted file mode 100644
index e04010d..0000000
--- a/examples/gestures/browser/searchlineedit.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "searchlineedit.h"
-
-#include <QtGui/QPainter>
-#include <QtGui/QMouseEvent>
-#include <QtGui/QMenu>
-#include <QtGui/QStyle>
-#include <QtGui/QStyleOptionFrameV2>
-
-ClearButton::ClearButton(QWidget *parent)
- : QAbstractButton(parent)
-{
- setCursor(Qt::ArrowCursor);
- setToolTip(tr("Clear"));
- setVisible(false);
- setFocusPolicy(Qt::NoFocus);
-}
-
-void ClearButton::paintEvent(QPaintEvent *event)
-{
- Q_UNUSED(event);
- QPainter painter(this);
- int height = this->height();
-
- painter.setRenderHint(QPainter::Antialiasing, true);
- QColor color = palette().color(QPalette::Mid);
- painter.setBrush(isDown()
- ? palette().color(QPalette::Dark)
- : palette().color(QPalette::Mid));
- painter.setPen(painter.brush().color());
- int size = width();
- int offset = size / 5;
- int radius = size - offset * 2;
- painter.drawEllipse(offset, offset, radius, radius);
-
- painter.setPen(palette().color(QPalette::Base));
- int border = offset * 2;
- painter.drawLine(border, border, width() - border, height - border);
- painter.drawLine(border, height - border, width() - border, border);
-}
-
-void ClearButton::textChanged(const QString &text)
-{
- setVisible(!text.isEmpty());
-}
-
-/*
- Search icon on the left hand side of the search widget
- When a menu is set a down arrow appears
- */
-class SearchButton : public QAbstractButton {
-public:
- SearchButton(QWidget *parent = 0);
- void paintEvent(QPaintEvent *event);
- QMenu *m_menu;
-
-protected:
- void mousePressEvent(QMouseEvent *event);
-};
-
-SearchButton::SearchButton(QWidget *parent)
- : QAbstractButton(parent),
- m_menu(0)
-{
- setObjectName(QLatin1String("SearchButton"));
- setCursor(Qt::ArrowCursor);
- setFocusPolicy(Qt::NoFocus);
-}
-
-void SearchButton::mousePressEvent(QMouseEvent *event)
-{
- if (m_menu && event->button() == Qt::LeftButton) {
- QWidget *p = parentWidget();
- if (p) {
- QPoint r = p->mapToGlobal(QPoint(0, p->height()));
- m_menu->exec(QPoint(r.x() + height() / 2, r.y()));
- }
- event->accept();
- }
- QAbstractButton::mousePressEvent(event);
-}
-
-void SearchButton::paintEvent(QPaintEvent *event)
-{
- Q_UNUSED(event);
- QPainterPath myPath;
-
- int radius = (height() / 5) * 2;
- QRect circle(height() / 3 - 1, height() / 4, radius, radius);
- myPath.addEllipse(circle);
-
- myPath.arcMoveTo(circle, 300);
- QPointF c = myPath.currentPosition();
- int diff = height() / 7;
- myPath.lineTo(qMin(width() - 2, (int)c.x() + diff), c.y() + diff);
-
- QPainter painter(this);
- painter.setRenderHint(QPainter::Antialiasing, true);
- painter.setPen(QPen(Qt::darkGray, 2));
- painter.drawPath(myPath);
-
- if (m_menu) {
- QPainterPath dropPath;
- dropPath.arcMoveTo(circle, 320);
- QPointF c = dropPath.currentPosition();
- c = QPointF(c.x() + 3.5, c.y() + 0.5);
- dropPath.moveTo(c);
- dropPath.lineTo(c.x() + 4, c.y());
- dropPath.lineTo(c.x() + 2, c.y() + 2);
- dropPath.closeSubpath();
- painter.setPen(Qt::darkGray);
- painter.setBrush(Qt::darkGray);
- painter.setRenderHint(QPainter::Antialiasing, false);
- painter.drawPath(dropPath);
- }
- painter.end();
-}
-
-/*
- SearchLineEdit is an enhanced QLineEdit
- - A Search icon on the left with optional menu
- - When there is no text and doesn't have focus an "inactive text" is displayed
- - When there is text a clear button is displayed on the right hand side
- */
-SearchLineEdit::SearchLineEdit(QWidget *parent) : ExLineEdit(parent),
- m_searchButton(new SearchButton(this))
-{
- connect(lineEdit(), SIGNAL(textChanged(const QString &)),
- this, SIGNAL(textChanged(const QString &)));
- setLeftWidget(m_searchButton);
- m_inactiveText = tr("Search");
-
- QSizePolicy policy = sizePolicy();
- setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());
-}
-
-void SearchLineEdit::paintEvent(QPaintEvent *event)
-{
- if (lineEdit()->text().isEmpty() && !hasFocus() && !m_inactiveText.isEmpty()) {
- ExLineEdit::paintEvent(event);
- QStyleOptionFrameV2 panel;
- initStyleOption(&panel);
- QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
- QFontMetrics fm = fontMetrics();
- int horizontalMargin = lineEdit()->x();
- QRect lineRect(horizontalMargin + r.x(), r.y() + (r.height() - fm.height() + 1) / 2,
- r.width() - 2 * horizontalMargin, fm.height());
- QPainter painter(this);
- painter.setPen(palette().brush(QPalette::Disabled, QPalette::Text).color());
- painter.drawText(lineRect, Qt::AlignLeft|Qt::AlignVCenter, m_inactiveText);
- } else {
- ExLineEdit::paintEvent(event);
- }
-}
-
-void SearchLineEdit::resizeEvent(QResizeEvent *event)
-{
- updateGeometries();
- ExLineEdit::resizeEvent(event);
-}
-
-void SearchLineEdit::updateGeometries()
-{
- int menuHeight = height();
- int menuWidth = menuHeight + 1;
- if (!m_searchButton->m_menu)
- menuWidth = (menuHeight / 5) * 4;
- m_searchButton->resize(QSize(menuWidth, menuHeight));
-}
-
-QString SearchLineEdit::inactiveText() const
-{
- return m_inactiveText;
-}
-
-void SearchLineEdit::setInactiveText(const QString &text)
-{
- m_inactiveText = text;
-}
-
-void SearchLineEdit::setMenu(QMenu *menu)
-{
- if (m_searchButton->m_menu)
- m_searchButton->m_menu->deleteLater();
- m_searchButton->m_menu = menu;
- updateGeometries();
-}
-
-QMenu *SearchLineEdit::menu() const
-{
- if (!m_searchButton->m_menu) {
- m_searchButton->m_menu = new QMenu(m_searchButton);
- if (isVisible())
- (const_cast<SearchLineEdit*>(this))->updateGeometries();
- }
- return m_searchButton->m_menu;
-}
-
diff --git a/examples/gestures/browser/searchlineedit.h b/examples/gestures/browser/searchlineedit.h
deleted file mode 100644
index ad37dc7..0000000
--- a/examples/gestures/browser/searchlineedit.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SEARCHLINEEDIT_H
-#define SEARCHLINEEDIT_H
-
-#include "urllineedit.h"
-
-#include <QtGui/QLineEdit>
-#include <QtGui/QAbstractButton>
-
-QT_BEGIN_NAMESPACE
-class QMenu;
-QT_END_NAMESPACE
-
-class SearchButton;
-
-/*
- Clear button on the right hand side of the search widget.
- Hidden by default
- "A circle with an X in it"
- */
-class ClearButton : public QAbstractButton
-{
- Q_OBJECT
-
-public:
- ClearButton(QWidget *parent = 0);
- void paintEvent(QPaintEvent *event);
-
-public slots:
- void textChanged(const QString &text);
-};
-
-
-class SearchLineEdit : public ExLineEdit
-{
- Q_OBJECT
- Q_PROPERTY(QString inactiveText READ inactiveText WRITE setInactiveText)
-
-signals:
- void textChanged(const QString &text);
-
-public:
- SearchLineEdit(QWidget *parent = 0);
-
- QString inactiveText() const;
- void setInactiveText(const QString &text);
-
- QMenu *menu() const;
- void setMenu(QMenu *menu);
-
-protected:
- void resizeEvent(QResizeEvent *event);
- void paintEvent(QPaintEvent *event);
-
-private:
- void updateGeometries();
-
- SearchButton *m_searchButton;
- QString m_inactiveText;
-};
-
-#endif // SEARCHLINEEDIT_H
-
diff --git a/examples/gestures/browser/settings.cpp b/examples/gestures/browser/settings.cpp
deleted file mode 100644
index 2576449..0000000
--- a/examples/gestures/browser/settings.cpp
+++ /dev/null
@@ -1,324 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "settings.h"
-
-#include "browserapplication.h"
-#include "browsermainwindow.h"
-#include "cookiejar.h"
-#include "history.h"
-#include "networkaccessmanager.h"
-#include "webview.h"
-
-#include <QtCore/QSettings>
-#include <QtGui/QtGui>
-#include <QtWebKit/QtWebKit>
-
-SettingsDialog::SettingsDialog(QWidget *parent)
- : QDialog(parent)
-{
- setupUi(this);
- connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
- connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
- connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies()));
- connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
- connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
-
- loadDefaults();
- loadFromSettings();
-}
-
-void SettingsDialog::loadDefaults()
-{
- QWebSettings *defaultSettings = QWebSettings::globalSettings();
- QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
- int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
- standardFont = QFont(standardFontFamily, standardFontSize);
- standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize()));
-
- QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
- int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
- fixedFont = QFont(fixedFontFamily, fixedFontSize);
- fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize()));
-
- downloadsLocation->setText(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
-
- enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled));
- enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled));
-}
-
-void SettingsDialog::loadFromSettings()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("MainWindow"));
- QString defaultHome = QLatin1String("http://qtsoftware.com");
- homeLineEdit->setText(settings.value(QLatin1String("home"), defaultHome).toString());
- settings.endGroup();
-
- settings.beginGroup(QLatin1String("history"));
- int historyExpire = settings.value(QLatin1String("historyExpire")).toInt();
- int idx = 0;
- switch (historyExpire) {
- case 1: idx = 0; break;
- case 7: idx = 1; break;
- case 14: idx = 2; break;
- case 30: idx = 3; break;
- case 365: idx = 4; break;
- case -1: idx = 5; break;
- default:
- idx = 5;
- }
- expireHistory->setCurrentIndex(idx);
- settings.endGroup();
-
- settings.beginGroup(QLatin1String("downloadmanager"));
- QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), downloadsLocation->text()).toString();
- downloadsLocation->setText(downloadDirectory);
- settings.endGroup();
-
- settings.beginGroup(QLatin1String("general"));
- openLinksIn->setCurrentIndex(settings.value(QLatin1String("openLinksIn"), openLinksIn->currentIndex()).toInt());
-
- settings.endGroup();
-
- // Appearance
- settings.beginGroup(QLatin1String("websettings"));
- fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
- standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
-
- standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize()));
- fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize()));
-
- enableJavascript->setChecked(settings.value(QLatin1String("enableJavascript"), enableJavascript->isChecked()).toBool());
- enablePlugins->setChecked(settings.value(QLatin1String("enablePlugins"), enablePlugins->isChecked()).toBool());
- userStyleSheet->setText(settings.value(QLatin1String("userStyleSheet")).toUrl().toString());
- settings.endGroup();
-
- // Privacy
- settings.beginGroup(QLatin1String("cookies"));
-
- CookieJar *jar = BrowserApplication::cookieJar();
- QByteArray value = settings.value(QLatin1String("acceptCookies"), QLatin1String("AcceptOnlyFromSitesNavigatedTo")).toByteArray();
- QMetaEnum acceptPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("AcceptPolicy"));
- CookieJar::AcceptPolicy acceptCookies = acceptPolicyEnum.keyToValue(value) == -1 ?
- CookieJar::AcceptOnlyFromSitesNavigatedTo :
- static_cast<CookieJar::AcceptPolicy>(acceptPolicyEnum.keyToValue(value));
- switch(acceptCookies) {
- case CookieJar::AcceptAlways:
- acceptCombo->setCurrentIndex(0);
- break;
- case CookieJar::AcceptNever:
- acceptCombo->setCurrentIndex(1);
- break;
- case CookieJar::AcceptOnlyFromSitesNavigatedTo:
- acceptCombo->setCurrentIndex(2);
- break;
- }
-
- value = settings.value(QLatin1String("keepCookiesUntil"), QLatin1String("Expire")).toByteArray();
- QMetaEnum keepPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("KeepPolicy"));
- CookieJar::KeepPolicy keepCookies = keepPolicyEnum.keyToValue(value) == -1 ?
- CookieJar::KeepUntilExpire :
- static_cast<CookieJar::KeepPolicy>(keepPolicyEnum.keyToValue(value));
- switch(keepCookies) {
- case CookieJar::KeepUntilExpire:
- keepUntilCombo->setCurrentIndex(0);
- break;
- case CookieJar::KeepUntilExit:
- keepUntilCombo->setCurrentIndex(1);
- break;
- case CookieJar::KeepUntilTimeLimit:
- keepUntilCombo->setCurrentIndex(2);
- break;
- }
- settings.endGroup();
-
-
- // Proxy
- settings.beginGroup(QLatin1String("proxy"));
- proxySupport->setChecked(settings.value(QLatin1String("enabled"), false).toBool());
- proxyType->setCurrentIndex(settings.value(QLatin1String("type"), 0).toInt());
- proxyHostName->setText(settings.value(QLatin1String("hostName")).toString());
- proxyPort->setValue(settings.value(QLatin1String("port"), 1080).toInt());
- proxyUserName->setText(settings.value(QLatin1String("userName")).toString());
- proxyPassword->setText(settings.value(QLatin1String("password")).toString());
- settings.endGroup();
-}
-
-void SettingsDialog::saveToSettings()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("MainWindow"));
- settings.setValue(QLatin1String("home"), homeLineEdit->text());
- settings.endGroup();
-
- settings.beginGroup(QLatin1String("general"));
- settings.setValue(QLatin1String("openLinksIn"), openLinksIn->currentIndex());
- settings.endGroup();
-
- settings.beginGroup(QLatin1String("history"));
- int historyExpire = expireHistory->currentIndex();
- int idx = -1;
- switch (historyExpire) {
- case 0: idx = 1; break;
- case 1: idx = 7; break;
- case 2: idx = 14; break;
- case 3: idx = 30; break;
- case 4: idx = 365; break;
- case 5: idx = -1; break;
- }
- settings.setValue(QLatin1String("historyExpire"), idx);
- settings.endGroup();
-
- // Appearance
- settings.beginGroup(QLatin1String("websettings"));
- settings.setValue(QLatin1String("fixedFont"), fixedFont);
- settings.setValue(QLatin1String("standardFont"), standardFont);
- settings.setValue(QLatin1String("enableJavascript"), enableJavascript->isChecked());
- settings.setValue(QLatin1String("enablePlugins"), enablePlugins->isChecked());
- QString userStyleSheetString = userStyleSheet->text();
- if (QFile::exists(userStyleSheetString))
- settings.setValue(QLatin1String("userStyleSheet"), QUrl::fromLocalFile(userStyleSheetString));
- else
- settings.setValue(QLatin1String("userStyleSheet"), QUrl(userStyleSheetString));
- settings.endGroup();
-
- //Privacy
- settings.beginGroup(QLatin1String("cookies"));
-
- CookieJar::KeepPolicy keepCookies;
- switch(acceptCombo->currentIndex()) {
- default:
- case 0:
- keepCookies = CookieJar::KeepUntilExpire;
- break;
- case 1:
- keepCookies = CookieJar::KeepUntilExit;
- break;
- case 2:
- keepCookies = CookieJar::KeepUntilTimeLimit;
- break;
- }
- CookieJar *jar = BrowserApplication::cookieJar();
- QMetaEnum acceptPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("AcceptPolicy"));
- settings.setValue(QLatin1String("acceptCookies"), QLatin1String(acceptPolicyEnum.valueToKey(keepCookies)));
-
- CookieJar::KeepPolicy keepPolicy;
- switch(keepUntilCombo->currentIndex()) {
- default:
- case 0:
- keepPolicy = CookieJar::KeepUntilExpire;
- break;
- case 1:
- keepPolicy = CookieJar::KeepUntilExit;
- break;
- case 2:
- keepPolicy = CookieJar::KeepUntilTimeLimit;
- break;
- }
-
- QMetaEnum keepPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("KeepPolicy"));
- settings.setValue(QLatin1String("keepCookiesUntil"), QLatin1String(keepPolicyEnum.valueToKey(keepPolicy)));
-
- settings.endGroup();
-
- // proxy
- settings.beginGroup(QLatin1String("proxy"));
- settings.setValue(QLatin1String("enabled"), proxySupport->isChecked());
- settings.setValue(QLatin1String("type"), proxyType->currentIndex());
- settings.setValue(QLatin1String("hostName"), proxyHostName->text());
- settings.setValue(QLatin1String("port"), proxyPort->text());
- settings.setValue(QLatin1String("userName"), proxyUserName->text());
- settings.setValue(QLatin1String("password"), proxyPassword->text());
- settings.endGroup();
-
- BrowserApplication::instance()->loadSettings();
- BrowserApplication::networkAccessManager()->loadSettings();
- BrowserApplication::cookieJar()->loadSettings();
- BrowserApplication::historyManager()->loadSettings();
-}
-
-void SettingsDialog::accept()
-{
- saveToSettings();
- QDialog::accept();
-}
-
-void SettingsDialog::showCookies()
-{
- CookiesDialog *dialog = new CookiesDialog(BrowserApplication::cookieJar(), this);
- dialog->exec();
-}
-
-void SettingsDialog::showExceptions()
-{
- CookiesExceptionsDialog *dialog = new CookiesExceptionsDialog(BrowserApplication::cookieJar(), this);
- dialog->exec();
-}
-
-void SettingsDialog::chooseFont()
-{
- bool ok;
- QFont font = QFontDialog::getFont(&ok, standardFont, this);
- if ( ok ) {
- standardFont = font;
- standardLabel->setText(QString(QLatin1String("%1 %2")).arg(font.family()).arg(font.pointSize()));
- }
-}
-
-void SettingsDialog::chooseFixedFont()
-{
- bool ok;
- QFont font = QFontDialog::getFont(&ok, fixedFont, this);
- if ( ok ) {
- fixedFont = font;
- fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(font.family()).arg(font.pointSize()));
- }
-}
-
-void SettingsDialog::setHomeToCurrentPage()
-{
- BrowserMainWindow *mw = static_cast<BrowserMainWindow*>(parent());
- WebView *webView = mw->currentTab();
- if (webView)
- homeLineEdit->setText(webView->url().toString());
-}
-
diff --git a/examples/gestures/browser/settings.h b/examples/gestures/browser/settings.h
deleted file mode 100644
index 900be7b..0000000
--- a/examples/gestures/browser/settings.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SETTINGS_H
-#define SETTINGS_H
-
-#include <QtGui/QDialog>
-#include "ui_settings.h"
-
-class SettingsDialog : public QDialog, public Ui_Settings
-{
- Q_OBJECT
-
-public:
- SettingsDialog(QWidget *parent = 0);
- void accept();
-
-private slots:
- void loadDefaults();
- void loadFromSettings();
- void saveToSettings();
-
- void setHomeToCurrentPage();
- void showCookies();
- void showExceptions();
-
- void chooseFont();
- void chooseFixedFont();
-
-private:
- QFont standardFont;
- QFont fixedFont;
-};
-
-#endif // SETTINGS_H
-
diff --git a/examples/gestures/browser/settings.ui b/examples/gestures/browser/settings.ui
deleted file mode 100644
index 3491ce0..0000000
--- a/examples/gestures/browser/settings.ui
+++ /dev/null
@@ -1,614 +0,0 @@
-<ui version="4.0" >
- <class>Settings</class>
- <widget class="QDialog" name="Settings" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>657</width>
- <height>322</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Settings</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="2" column="0" >
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QTabWidget" name="tabWidget" >
- <property name="currentIndex" >
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>627</width>
- <height>243</height>
- </rect>
- </property>
- <attribute name="title" >
- <string>General</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_4" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>Home:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2" >
- <widget class="QLineEdit" name="homeLineEdit" />
- </item>
- <item row="1" column="1" >
- <widget class="QPushButton" name="setHomeToCurrentPageButton" >
- <property name="text" >
- <string>Set to current page</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>280</width>
- <height>18</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>Remove history items:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2" >
- <widget class="QComboBox" name="expireHistory" >
- <item>
- <property name="text" >
- <string>After one day</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>After one week</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>After two weeks</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>After one month</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>After one year</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Manually</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_7" >
- <property name="text" >
- <string>Save downloads to:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="2" >
- <widget class="QLineEdit" name="downloadsLocation" />
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_8" >
- <property name="text" >
- <string>Open links from applications:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2" >
- <widget class="QComboBox" name="openLinksIn" >
- <item>
- <property name="text" >
- <string>In a tab in the current window</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>In a new window</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="5" column="1" colspan="2" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>391</width>
- <height>262</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_3" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>627</width>
- <height>243</height>
- </rect>
- </property>
- <attribute name="title" >
- <string>Appearance</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_3" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_5" >
- <property name="text" >
- <string>Standard font:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLabel" name="standardLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape" >
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="text" >
- <string>Times 16</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QPushButton" name="standardFontButton" >
- <property name="text" >
- <string>Select...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_6" >
- <property name="text" >
- <string>Fixed-width font:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QLabel" name="fixedLabel" >
- <property name="frameShape" >
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="text" >
- <string>Courier 13</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <widget class="QPushButton" name="fixedFontButton" >
- <property name="text" >
- <string>Select...</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <spacer name="verticalSpacer" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>93</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_2" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>627</width>
- <height>243</height>
- </rect>
- </property>
- <attribute name="title" >
- <string>Privacy</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_3" >
- <item>
- <widget class="QGroupBox" name="groupBox" >
- <property name="title" >
- <string>Web Content</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2" >
- <item>
- <widget class="QCheckBox" name="enablePlugins" >
- <property name="text" >
- <string>Enable Plugins</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="enableJavascript" >
- <property name="text" >
- <string>Enable Javascript</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="cookiesGroupBox" >
- <property name="title" >
- <string>Cookies</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Accept Cookies:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QComboBox" name="acceptCombo" >
- <item>
- <property name="text" >
- <string>Always</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Never</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Only from sites you navigate to</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QPushButton" name="exceptionsButton" >
- <property name="text" >
- <string>Exceptions...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Keep until:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QComboBox" name="keepUntilCombo" >
- <item>
- <property name="text" >
- <string>They expire</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>I exit the application</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>At most 90 days</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="2" >
- <widget class="QPushButton" name="cookiesButton" >
- <property name="text" >
- <string>Cookies...</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>371</width>
- <height>177</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_4" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>627</width>
- <height>243</height>
- </rect>
- </property>
- <attribute name="title" >
- <string>Proxy</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <widget class="QGroupBox" name="proxySupport" >
- <property name="title" >
- <string>Enable proxy</string>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_6" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_9" >
- <property name="text" >
- <string>Type:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2" >
- <widget class="QComboBox" name="proxyType" >
- <item>
- <property name="text" >
- <string>Socks5</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Http</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_10" >
- <property name="text" >
- <string>Host:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1" colspan="2" >
- <widget class="QLineEdit" name="proxyHostName" />
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_11" >
- <property name="text" >
- <string>Port:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QSpinBox" name="proxyPort" >
- <property name="maximum" >
- <number>10000</number>
- </property>
- <property name="value" >
- <number>1080</number>
- </property>
- </widget>
- </item>
- <item row="2" column="2" >
- <spacer name="horizontalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>293</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_12" >
- <property name="text" >
- <string>User Name:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="2" >
- <widget class="QLineEdit" name="proxyUserName" />
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_13" >
- <property name="text" >
- <string>Password:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2" >
- <widget class="QLineEdit" name="proxyPassword" >
- <property name="echoMode" >
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="5" column="0" >
- <spacer name="verticalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>8</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_5" >
- <attribute name="title" >
- <string>Advanced</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_2" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_14" >
- <property name="text" >
- <string>Style Sheet:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="userStyleSheet" />
- </item>
- <item row="1" column="1" >
- <spacer name="verticalSpacer_3" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>176</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>Settings</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel" >
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>Settings</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel" >
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/gestures/browser/squeezelabel.cpp b/examples/gestures/browser/squeezelabel.cpp
deleted file mode 100644
index 3247330..0000000
--- a/examples/gestures/browser/squeezelabel.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "squeezelabel.h"
-
-SqueezeLabel::SqueezeLabel(QWidget *parent) : QLabel(parent)
-{
-}
-
-void SqueezeLabel::paintEvent(QPaintEvent *event)
-{
- QFontMetrics fm = fontMetrics();
- if (fm.width(text()) > contentsRect().width()) {
- QString elided = fm.elidedText(text(), Qt::ElideMiddle, width());
- QString oldText = text();
- setText(elided);
- QLabel::paintEvent(event);
- setText(oldText);
- } else {
- QLabel::paintEvent(event);
- }
-}
-
diff --git a/examples/gestures/browser/tabwidget.cpp b/examples/gestures/browser/tabwidget.cpp
deleted file mode 100644
index 67714e4..0000000
--- a/examples/gestures/browser/tabwidget.cpp
+++ /dev/null
@@ -1,830 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tabwidget.h"
-
-#include "browserapplication.h"
-#include "browsermainwindow.h"
-#include "history.h"
-#include "urllineedit.h"
-#include "webview.h"
-
-#include <QtGui/QClipboard>
-#include <QtGui/QCompleter>
-#include <QtGui/QListView>
-#include <QtGui/QMenu>
-#include <QtGui/QMessageBox>
-#include <QtGui/QMouseEvent>
-#include <QtGui/QStackedWidget>
-#include <QtGui/QStyle>
-#include <QtGui/QToolButton>
-
-#include <QtCore/QDebug>
-
-TabBar::TabBar(QWidget *parent)
- : QTabBar(parent)
-{
- setContextMenuPolicy(Qt::CustomContextMenu);
- setAcceptDrops(true);
- connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
- this, SLOT(contextMenuRequested(const QPoint &)));
-
- QString alt = QLatin1String("Alt+%1");
- for (int i = 1; i <= 10; ++i) {
- int key = i;
- if (key == 10)
- key = 0;
- QShortcut *shortCut = new QShortcut(alt.arg(key), this);
- m_tabShortcuts.append(shortCut);
- connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction()));
- }
- setTabsClosable(true);
- connect(this, SIGNAL(tabCloseRequested(int)),
- this, SIGNAL(closeTab(int)));
- setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
- setMovable(true);
-}
-
-void TabBar::selectTabAction()
-{
- if (QShortcut *shortCut = qobject_cast<QShortcut*>(sender())) {
- int index = m_tabShortcuts.indexOf(shortCut);
- if (index == 0)
- index = 10;
- setCurrentIndex(index);
- }
-}
-
-void TabBar::contextMenuRequested(const QPoint &position)
-{
- QMenu menu;
- menu.addAction(tr("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab);
- int index = tabAt(position);
- if (-1 != index) {
- QAction *action = menu.addAction(tr("Clone Tab"),
- this, SLOT(cloneTab()));
- action->setData(index);
-
- menu.addSeparator();
-
- action = menu.addAction(tr("&Close Tab"),
- this, SLOT(closeTab()), QKeySequence::Close);
- action->setData(index);
-
- action = menu.addAction(tr("Close &Other Tabs"),
- this, SLOT(closeOtherTabs()));
- action->setData(index);
-
- menu.addSeparator();
-
- action = menu.addAction(tr("Reload Tab"),
- this, SLOT(reloadTab()), QKeySequence::Refresh);
- action->setData(index);
- } else {
- menu.addSeparator();
- }
- menu.addAction(tr("Reload All Tabs"), this, SIGNAL(reloadAllTabs()));
- menu.exec(QCursor::pos());
-}
-
-void TabBar::cloneTab()
-{
- if (QAction *action = qobject_cast<QAction*>(sender())) {
- int index = action->data().toInt();
- emit cloneTab(index);
- }
-}
-
-void TabBar::closeTab()
-{
- if (QAction *action = qobject_cast<QAction*>(sender())) {
- int index = action->data().toInt();
- emit closeTab(index);
- }
-}
-
-void TabBar::closeOtherTabs()
-{
- if (QAction *action = qobject_cast<QAction*>(sender())) {
- int index = action->data().toInt();
- emit closeOtherTabs(index);
- }
-}
-
-void TabBar::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton)
- m_dragStartPos = event->pos();
- QTabBar::mousePressEvent(event);
-}
-
-void TabBar::mouseMoveEvent(QMouseEvent *event)
-{
- if (event->buttons() == Qt::LeftButton) {
- int diffX = event->pos().x() - m_dragStartPos.x();
- int diffY = event->pos().y() - m_dragStartPos.y();
- if ((event->pos() - m_dragStartPos).manhattanLength() > QApplication::startDragDistance()
- && diffX < 3 && diffX > -3
- && diffY < -10) {
- QDrag *drag = new QDrag(this);
- QMimeData *mimeData = new QMimeData;
- QList<QUrl> urls;
- int index = tabAt(event->pos());
- QUrl url = tabData(index).toUrl();
- urls.append(url);
- mimeData->setUrls(urls);
- mimeData->setText(tabText(index));
- mimeData->setData(QLatin1String("action"), "tab-reordering");
- drag->setMimeData(mimeData);
- drag->exec();
- }
- }
- QTabBar::mouseMoveEvent(event);
-}
-
-// When index is -1 index chooses the current tab
-void TabWidget::reloadTab(int index)
-{
- if (index < 0)
- index = currentIndex();
- if (index < 0 || index >= count())
- return;
-
- QWidget *widget = this->widget(index);
- if (WebView *tab = qobject_cast<WebView*>(widget))
- tab->reload();
-}
-
-void TabBar::reloadTab()
-{
- if (QAction *action = qobject_cast<QAction*>(sender())) {
- int index = action->data().toInt();
- emit reloadTab(index);
- }
-}
-
-TabWidget::TabWidget(QWidget *parent)
- : QTabWidget(parent)
- , m_recentlyClosedTabsAction(0)
- , m_newTabAction(0)
- , m_closeTabAction(0)
- , m_nextTabAction(0)
- , m_previousTabAction(0)
- , m_recentlyClosedTabsMenu(0)
- , m_lineEditCompleter(0)
- , m_lineEdits(0)
- , m_tabBar(new TabBar(this))
-{
- setElideMode(Qt::ElideRight);
-
- connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newTab()));
- connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
- connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
- connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
- connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
- connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
- connect(m_tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(moveTab(int, int)));
- setTabBar(m_tabBar);
- setDocumentMode(true);
-
- // Actions
- m_newTabAction = new QAction(QIcon(QLatin1String(":addtab.png")), tr("New &Tab"), this);
- m_newTabAction->setShortcuts(QKeySequence::AddTab);
- m_newTabAction->setIconVisibleInMenu(false);
- connect(m_newTabAction, SIGNAL(triggered()), this, SLOT(newTab()));
-
- m_closeTabAction = new QAction(QIcon(QLatin1String(":closetab.png")), tr("&Close Tab"), this);
- m_closeTabAction->setShortcuts(QKeySequence::Close);
- m_closeTabAction->setIconVisibleInMenu(false);
- connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab()));
-
- m_nextTabAction = new QAction(tr("Show Next Tab"), this);
- QList<QKeySequence> shortcuts;
- shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceRight));
- shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageDown));
- shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketRight));
- shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Less));
- m_nextTabAction->setShortcuts(shortcuts);
- connect(m_nextTabAction, SIGNAL(triggered()), this, SLOT(nextTab()));
-
- m_previousTabAction = new QAction(tr("Show Previous Tab"), this);
- shortcuts.clear();
- shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceLeft));
- shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageUp));
- shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketLeft));
- shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Greater));
- m_previousTabAction->setShortcuts(shortcuts);
- connect(m_previousTabAction, SIGNAL(triggered()), this, SLOT(previousTab()));
-
- m_recentlyClosedTabsMenu = new QMenu(this);
- connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()),
- this, SLOT(aboutToShowRecentTabsMenu()));
- connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)),
- this, SLOT(aboutToShowRecentTriggeredAction(QAction *)));
- m_recentlyClosedTabsAction = new QAction(tr("Recently Closed Tabs"), this);
- m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu);
- m_recentlyClosedTabsAction->setEnabled(false);
-
- connect(this, SIGNAL(currentChanged(int)),
- this, SLOT(currentChanged(int)));
-
- m_lineEdits = new QStackedWidget(this);
-}
-
-void TabWidget::clear()
-{
- // clear the recently closed tabs
- m_recentlyClosedTabs.clear();
- // clear the line edit history
- for (int i = 0; i < m_lineEdits->count(); ++i) {
- QLineEdit *qLineEdit = lineEdit(i);
- qLineEdit->setText(qLineEdit->text());
- }
-}
-
-void TabWidget::moveTab(int fromIndex, int toIndex)
-{
- QWidget *lineEdit = m_lineEdits->widget(fromIndex);
- m_lineEdits->removeWidget(lineEdit);
- m_lineEdits->insertWidget(toIndex, lineEdit);
-}
-
-void TabWidget::addWebAction(QAction *action, QWebPage::WebAction webAction)
-{
- if (!action)
- return;
- m_actions.append(new WebActionMapper(action, webAction, this));
-}
-
-void TabWidget::currentChanged(int index)
-{
- WebView *webView = this->webView(index);
- if (!webView)
- return;
-
- Q_ASSERT(m_lineEdits->count() == count());
-
- WebView *oldWebView = this->webView(m_lineEdits->currentIndex());
- if (oldWebView) {
- disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)),
- this, SIGNAL(showStatusBarMessage(const QString&)));
- disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
- this, SIGNAL(linkHovered(const QString&)));
- disconnect(oldWebView, SIGNAL(loadProgress(int)),
- this, SIGNAL(loadProgress(int)));
- }
-
- connect(webView, SIGNAL(statusBarMessage(const QString&)),
- this, SIGNAL(showStatusBarMessage(const QString&)));
- connect(webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
- this, SIGNAL(linkHovered(const QString&)));
- connect(webView, SIGNAL(loadProgress(int)),
- this, SIGNAL(loadProgress(int)));
-
- for (int i = 0; i < m_actions.count(); ++i) {
- WebActionMapper *mapper = m_actions[i];
- mapper->updateCurrent(webView->page());
- }
- emit setCurrentTitle(webView->title());
- m_lineEdits->setCurrentIndex(index);
- emit loadProgress(webView->progress());
- emit showStatusBarMessage(webView->lastStatusBarText());
- if (webView->url().isEmpty())
- m_lineEdits->currentWidget()->setFocus();
- else
- webView->setFocus();
-}
-
-QAction *TabWidget::newTabAction() const
-{
- return m_newTabAction;
-}
-
-QAction *TabWidget::closeTabAction() const
-{
- return m_closeTabAction;
-}
-
-QAction *TabWidget::recentlyClosedTabsAction() const
-{
- return m_recentlyClosedTabsAction;
-}
-
-QAction *TabWidget::nextTabAction() const
-{
- return m_nextTabAction;
-}
-
-QAction *TabWidget::previousTabAction() const
-{
- return m_previousTabAction;
-}
-
-QWidget *TabWidget::lineEditStack() const
-{
- return m_lineEdits;
-}
-
-QLineEdit *TabWidget::currentLineEdit() const
-{
- return lineEdit(m_lineEdits->currentIndex());
-}
-
-WebView *TabWidget::currentWebView() const
-{
- return webView(currentIndex());
-}
-
-QLineEdit *TabWidget::lineEdit(int index) const
-{
- UrlLineEdit *urlLineEdit = qobject_cast<UrlLineEdit*>(m_lineEdits->widget(index));
- if (urlLineEdit)
- return urlLineEdit->lineEdit();
- return 0;
-}
-
-WebView *TabWidget::webView(int index) const
-{
- QWidget *widget = this->widget(index);
- if (WebView *webView = qobject_cast<WebView*>(widget)) {
- return webView;
- } else {
- // optimization to delay creating the first webview
- if (count() == 1) {
- TabWidget *that = const_cast<TabWidget*>(this);
- that->setUpdatesEnabled(false);
- that->newTab();
- that->closeTab(0);
- that->setUpdatesEnabled(true);
- return currentWebView();
- }
- }
- return 0;
-}
-
-int TabWidget::webViewIndex(WebView *webView) const
-{
- int index = indexOf(webView);
- return index;
-}
-
-WebView *TabWidget::newTab(bool makeCurrent)
-{
- // line edit
- UrlLineEdit *urlLineEdit = new UrlLineEdit;
- QLineEdit *lineEdit = urlLineEdit->lineEdit();
- if (!m_lineEditCompleter && count() > 0) {
- HistoryCompletionModel *completionModel = new HistoryCompletionModel(this);
- completionModel->setSourceModel(BrowserApplication::historyManager()->historyFilterModel());
- m_lineEditCompleter = new QCompleter(completionModel, this);
- // Should this be in Qt by default?
- QAbstractItemView *popup = m_lineEditCompleter->popup();
- QListView *listView = qobject_cast<QListView*>(popup);
- if (listView)
- listView->setUniformItemSizes(true);
- }
- lineEdit->setCompleter(m_lineEditCompleter);
- connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(lineEditReturnPressed()));
- m_lineEdits->addWidget(urlLineEdit);
- m_lineEdits->setSizePolicy(lineEdit->sizePolicy());
-
- // optimization to delay creating the more expensive WebView, history, etc
- if (count() == 0) {
- QWidget *emptyWidget = new QWidget;
- QPalette p = emptyWidget->palette();
- p.setColor(QPalette::Window, palette().color(QPalette::Base));
- emptyWidget->setPalette(p);
- emptyWidget->setAutoFillBackground(true);
- disconnect(this, SIGNAL(currentChanged(int)),
- this, SLOT(currentChanged(int)));
- addTab(emptyWidget, tr("(Untitled)"));
- connect(this, SIGNAL(currentChanged(int)),
- this, SLOT(currentChanged(int)));
- return 0;
- }
-
- // webview
- WebView *webView = new WebView;
- urlLineEdit->setWebView(webView);
- connect(webView, SIGNAL(loadStarted()),
- this, SLOT(webViewLoadStarted()));
- connect(webView, SIGNAL(loadFinished(bool)),
- this, SLOT(webViewIconChanged()));
- connect(webView, SIGNAL(iconChanged()),
- this, SLOT(webViewIconChanged()));
- connect(webView, SIGNAL(titleChanged(const QString &)),
- this, SLOT(webViewTitleChanged(const QString &)));
- connect(webView, SIGNAL(urlChanged(const QUrl &)),
- this, SLOT(webViewUrlChanged(const QUrl &)));
- connect(webView->page(), SIGNAL(windowCloseRequested()),
- this, SLOT(windowCloseRequested()));
- connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
- this, SIGNAL(geometryChangeRequested(const QRect &)));
- connect(webView->page(), SIGNAL(printRequested(QWebFrame *)),
- this, SIGNAL(printRequested(QWebFrame *)));
- connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)),
- this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
- connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)),
- this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
- connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)),
- this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
- addTab(webView, tr("(Untitled)"));
- if (makeCurrent)
- setCurrentWidget(webView);
-
- // webview actions
- for (int i = 0; i < m_actions.count(); ++i) {
- WebActionMapper *mapper = m_actions[i];
- mapper->addChild(webView->page()->action(mapper->webAction()));
- }
-
- if (count() == 1)
- currentChanged(currentIndex());
- emit tabsChanged();
- return webView;
-}
-
-void TabWidget::reloadAllTabs()
-{
- for (int i = 0; i < count(); ++i) {
- QWidget *tabWidget = widget(i);
- if (WebView *tab = qobject_cast<WebView*>(tabWidget)) {
- tab->reload();
- }
- }
-}
-
-void TabWidget::lineEditReturnPressed()
-{
- if (QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender())) {
- emit loadPage(lineEdit->text());
- if (m_lineEdits->currentWidget() == lineEdit)
- currentWebView()->setFocus();
- }
-}
-
-void TabWidget::windowCloseRequested()
-{
- WebPage *webPage = qobject_cast<WebPage*>(sender());
- WebView *webView = qobject_cast<WebView*>(webPage->view());
- int index = webViewIndex(webView);
- if (index >= 0) {
- if (count() == 1)
- webView->webPage()->mainWindow()->close();
- else
- closeTab(index);
- }
-}
-
-void TabWidget::closeOtherTabs(int index)
-{
- if (-1 == index)
- return;
- for (int i = count() - 1; i > index; --i)
- closeTab(i);
- for (int i = index - 1; i >= 0; --i)
- closeTab(i);
-}
-
-// When index is -1 index chooses the current tab
-void TabWidget::cloneTab(int index)
-{
- if (index < 0)
- index = currentIndex();
- if (index < 0 || index >= count())
- return;
- WebView *tab = newTab(false);
- tab->setUrl(webView(index)->url());
-}
-
-// When index is -1 index chooses the current tab
-void TabWidget::closeTab(int index)
-{
- if (index < 0)
- index = currentIndex();
- if (index < 0 || index >= count())
- return;
-
- bool hasFocus = false;
- if (WebView *tab = webView(index)) {
- if (tab->isModified()) {
- QMessageBox closeConfirmation(tab);
- closeConfirmation.setWindowFlags(Qt::Sheet);
- closeConfirmation.setWindowTitle(tr("Do you really want to close this page?"));
- closeConfirmation.setInformativeText(tr("You have modified this page and when closing it you would lose the modification.\n"
- "Do you really want to close this page?\n"));
- closeConfirmation.setIcon(QMessageBox::Question);
- closeConfirmation.addButton(QMessageBox::Yes);
- closeConfirmation.addButton(QMessageBox::No);
- closeConfirmation.setEscapeButton(QMessageBox::No);
- if (closeConfirmation.exec() == QMessageBox::No)
- return;
- }
- hasFocus = tab->hasFocus();
-
- m_recentlyClosedTabsAction->setEnabled(true);
- m_recentlyClosedTabs.prepend(tab->url());
- if (m_recentlyClosedTabs.size() >= TabWidget::m_recentlyClosedTabsSize)
- m_recentlyClosedTabs.removeLast();
- }
- QWidget *lineEdit = m_lineEdits->widget(index);
- m_lineEdits->removeWidget(lineEdit);
- lineEdit->deleteLater();
- QWidget *webView = widget(index);
- removeTab(index);
- webView->deleteLater();
- emit tabsChanged();
- if (hasFocus && count() > 0)
- currentWebView()->setFocus();
- if (count() == 0)
- emit lastTabClosed();
-}
-
-void TabWidget::webViewLoadStarted()
-{
- WebView *webView = qobject_cast<WebView*>(sender());
- int index = webViewIndex(webView);
- if (-1 != index) {
- QIcon icon(QLatin1String(":loading.gif"));
- setTabIcon(index, icon);
- }
-}
-
-void TabWidget::webViewIconChanged()
-{
- WebView *webView = qobject_cast<WebView*>(sender());
- int index = webViewIndex(webView);
- if (-1 != index) {
- QIcon icon = BrowserApplication::instance()->icon(webView->url());
- setTabIcon(index, icon);
- }
-}
-
-void TabWidget::webViewTitleChanged(const QString &title)
-{
- WebView *webView = qobject_cast<WebView*>(sender());
- int index = webViewIndex(webView);
- if (-1 != index) {
- setTabText(index, title);
- }
- if (currentIndex() == index)
- emit setCurrentTitle(title);
- BrowserApplication::historyManager()->updateHistoryItem(webView->url(), title);
-}
-
-void TabWidget::webViewUrlChanged(const QUrl &url)
-{
- WebView *webView = qobject_cast<WebView*>(sender());
- int index = webViewIndex(webView);
- if (-1 != index) {
- m_tabBar->setTabData(index, url);
- }
- emit tabsChanged();
-}
-
-void TabWidget::aboutToShowRecentTabsMenu()
-{
- m_recentlyClosedTabsMenu->clear();
- for (int i = 0; i < m_recentlyClosedTabs.count(); ++i) {
- QAction *action = new QAction(m_recentlyClosedTabsMenu);
- action->setData(m_recentlyClosedTabs.at(i));
- QIcon icon = BrowserApplication::instance()->icon(m_recentlyClosedTabs.at(i));
- action->setIcon(icon);
- action->setText(m_recentlyClosedTabs.at(i).toString());
- m_recentlyClosedTabsMenu->addAction(action);
- }
-}
-
-void TabWidget::aboutToShowRecentTriggeredAction(QAction *action)
-{
- QUrl url = action->data().toUrl();
- loadUrlInCurrentTab(url);
-}
-
-void TabWidget::mouseDoubleClickEvent(QMouseEvent *event)
-{
- if (!childAt(event->pos())
- // Remove the line below when QTabWidget does not have a one pixel frame
- && event->pos().y() < (tabBar()->y() + tabBar()->height())) {
- newTab();
- return;
- }
- QTabWidget::mouseDoubleClickEvent(event);
-}
-
-void TabWidget::contextMenuEvent(QContextMenuEvent *event)
-{
- if (!childAt(event->pos())) {
- m_tabBar->contextMenuRequested(event->pos());
- return;
- }
- QTabWidget::contextMenuEvent(event);
-}
-
-void TabWidget::mouseReleaseEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::MidButton && !childAt(event->pos())
- // Remove the line below when QTabWidget does not have a one pixel frame
- && event->pos().y() < (tabBar()->y() + tabBar()->height())) {
- QUrl url(QApplication::clipboard()->text(QClipboard::Selection));
- if (!url.isEmpty() && url.isValid() && !url.scheme().isEmpty()) {
- WebView *webView = newTab();
- webView->setUrl(url);
- }
- }
-}
-
-void TabWidget::loadUrlInCurrentTab(const QUrl &url)
-{
- WebView *webView = currentWebView();
- if (webView) {
- webView->loadUrl(url);
- webView->setFocus();
- }
-}
-
-void TabWidget::nextTab()
-{
- int next = currentIndex() + 1;
- if (next == count())
- next = 0;
- setCurrentIndex(next);
-}
-
-void TabWidget::previousTab()
-{
- int next = currentIndex() - 1;
- if (next < 0)
- next = count() - 1;
- setCurrentIndex(next);
-}
-
-static const qint32 TabWidgetMagic = 0xaa;
-
-QByteArray TabWidget::saveState() const
-{
- int version = 1;
- QByteArray data;
- QDataStream stream(&data, QIODevice::WriteOnly);
-
- stream << qint32(TabWidgetMagic);
- stream << qint32(version);
-
- QStringList tabs;
- for (int i = 0; i < count(); ++i) {
- if (WebView *tab = qobject_cast<WebView*>(widget(i))) {
- tabs.append(tab->url().toString());
- } else {
- tabs.append(QString::null);
- }
- }
- stream << tabs;
- stream << currentIndex();
- return data;
-}
-
-bool TabWidget::restoreState(const QByteArray &state)
-{
- int version = 1;
- QByteArray sd = state;
- QDataStream stream(&sd, QIODevice::ReadOnly);
- if (stream.atEnd())
- return false;
-
- qint32 marker;
- qint32 v;
- stream >> marker;
- stream >> v;
- if (marker != TabWidgetMagic || v != version)
- return false;
-
- QStringList openTabs;
- stream >> openTabs;
-
- for (int i = 0; i < openTabs.count(); ++i) {
- if (i != 0)
- newTab();
- loadPage(openTabs.at(i));
- }
-
- int currentTab;
- stream >> currentTab;
- setCurrentIndex(currentTab);
-
- return true;
-}
-
-WebActionMapper::WebActionMapper(QAction *root, QWebPage::WebAction webAction, QObject *parent)
- : QObject(parent)
- , m_currentParent(0)
- , m_root(root)
- , m_webAction(webAction)
-{
- if (!m_root)
- return;
- connect(m_root, SIGNAL(triggered()), this, SLOT(rootTriggered()));
- connect(root, SIGNAL(destroyed(QObject *)), this, SLOT(rootDestroyed()));
- root->setEnabled(false);
-}
-
-void WebActionMapper::rootDestroyed()
-{
- m_root = 0;
-}
-
-void WebActionMapper::currentDestroyed()
-{
- updateCurrent(0);
-}
-
-void WebActionMapper::addChild(QAction *action)
-{
- if (!action)
- return;
- connect(action, SIGNAL(changed()), this, SLOT(childChanged()));
-}
-
-QWebPage::WebAction WebActionMapper::webAction() const
-{
- return m_webAction;
-}
-
-void WebActionMapper::rootTriggered()
-{
- if (m_currentParent) {
- QAction *gotoAction = m_currentParent->action(m_webAction);
- gotoAction->trigger();
- }
-}
-
-void WebActionMapper::childChanged()
-{
- if (QAction *source = qobject_cast<QAction*>(sender())) {
- if (m_root
- && m_currentParent
- && source->parent() == m_currentParent) {
- m_root->setChecked(source->isChecked());
- m_root->setEnabled(source->isEnabled());
- }
- }
-}
-
-void WebActionMapper::updateCurrent(QWebPage *currentParent)
-{
- if (m_currentParent)
- disconnect(m_currentParent, SIGNAL(destroyed(QObject *)),
- this, SLOT(currentDestroyed()));
-
- m_currentParent = currentParent;
- if (!m_root)
- return;
- if (!m_currentParent) {
- m_root->setEnabled(false);
- m_root->setChecked(false);
- return;
- }
- QAction *source = m_currentParent->action(m_webAction);
- m_root->setChecked(source->isChecked());
- m_root->setEnabled(source->isEnabled());
- connect(m_currentParent, SIGNAL(destroyed(QObject *)),
- this, SLOT(currentDestroyed()));
-}
-
diff --git a/examples/gestures/browser/tabwidget.h b/examples/gestures/browser/tabwidget.h
deleted file mode 100644
index ee7b226..0000000
--- a/examples/gestures/browser/tabwidget.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TABWIDGET_H
-#define TABWIDGET_H
-
-#include <QtGui/QTabBar>
-
-#include <QtGui/QShortcut>
-/*
- Tab bar with a few more features such as a context menu and shortcuts
- */
-class TabBar : public QTabBar
-{
- Q_OBJECT
-
-signals:
- void newTab();
- void cloneTab(int index);
- void closeTab(int index);
- void closeOtherTabs(int index);
- void reloadTab(int index);
- void reloadAllTabs();
- void tabMoveRequested(int fromIndex, int toIndex);
-
-public:
- TabBar(QWidget *parent = 0);
-
-protected:
- void mousePressEvent(QMouseEvent* event);
- void mouseMoveEvent(QMouseEvent* event);
-
-private slots:
- void selectTabAction();
- void cloneTab();
- void closeTab();
- void closeOtherTabs();
- void reloadTab();
- void contextMenuRequested(const QPoint &position);
-
-private:
- QList<QShortcut*> m_tabShortcuts;
- friend class TabWidget;
-
- QPoint m_dragStartPos;
- int m_dragCurrentIndex;
-};
-
-#include <QtWebKit/QWebPage>
-
-QT_BEGIN_NAMESPACE
-class QAction;
-QT_END_NAMESPACE
-class WebView;
-/*!
- A proxy object that connects a single browser action
- to one child webpage action at a time.
-
- Example usage: used to keep the main window stop action in sync with
- the current tabs webview's stop action.
- */
-class WebActionMapper : public QObject
-{
- Q_OBJECT
-
-public:
- WebActionMapper(QAction *root, QWebPage::WebAction webAction, QObject *parent);
- QWebPage::WebAction webAction() const;
- void addChild(QAction *action);
- void updateCurrent(QWebPage *currentParent);
-
-private slots:
- void rootTriggered();
- void childChanged();
- void rootDestroyed();
- void currentDestroyed();
-
-private:
- QWebPage *m_currentParent;
- QAction *m_root;
- QWebPage::WebAction m_webAction;
-};
-
-#include <QtCore/QUrl>
-#include <QtGui/QTabWidget>
-QT_BEGIN_NAMESPACE
-class QCompleter;
-class QLineEdit;
-class QMenu;
-class QStackedWidget;
-QT_END_NAMESPACE
-/*!
- TabWidget that contains WebViews and a stack widget of associated line edits.
-
- Connects up the current tab's signals to this class's signal and uses WebActionMapper
- to proxy the actions.
- */
-class TabWidget : public QTabWidget
-{
- Q_OBJECT
-
-signals:
- // tab widget signals
- void loadPage(const QString &url);
- void tabsChanged();
- void lastTabClosed();
-
- // current tab signals
- void setCurrentTitle(const QString &url);
- void showStatusBarMessage(const QString &message);
- void linkHovered(const QString &link);
- void loadProgress(int progress);
- void geometryChangeRequested(const QRect &geometry);
- void menuBarVisibilityChangeRequested(bool visible);
- void statusBarVisibilityChangeRequested(bool visible);
- void toolBarVisibilityChangeRequested(bool visible);
- void printRequested(QWebFrame *frame);
-
-public:
- TabWidget(QWidget *parent = 0);
- void clear();
- void addWebAction(QAction *action, QWebPage::WebAction webAction);
-
- QAction *newTabAction() const;
- QAction *closeTabAction() const;
- QAction *recentlyClosedTabsAction() const;
- QAction *nextTabAction() const;
- QAction *previousTabAction() const;
-
- QWidget *lineEditStack() const;
- QLineEdit *currentLineEdit() const;
- WebView *currentWebView() const;
- WebView *webView(int index) const;
- QLineEdit *lineEdit(int index) const;
- int webViewIndex(WebView *webView) const;
-
- QByteArray saveState() const;
- bool restoreState(const QByteArray &state);
-
-protected:
- void mouseDoubleClickEvent(QMouseEvent *event);
- void contextMenuEvent(QContextMenuEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
-
-public slots:
- void loadUrlInCurrentTab(const QUrl &url);
- WebView *newTab(bool makeCurrent = true);
- void cloneTab(int index = -1);
- void closeTab(int index = -1);
- void closeOtherTabs(int index);
- void reloadTab(int index = -1);
- void reloadAllTabs();
- void nextTab();
- void previousTab();
-
-private slots:
- void currentChanged(int index);
- void aboutToShowRecentTabsMenu();
- void aboutToShowRecentTriggeredAction(QAction *action);
- void webViewLoadStarted();
- void webViewIconChanged();
- void webViewTitleChanged(const QString &title);
- void webViewUrlChanged(const QUrl &url);
- void lineEditReturnPressed();
- void windowCloseRequested();
- void moveTab(int fromIndex, int toIndex);
-
-private:
- QAction *m_recentlyClosedTabsAction;
- QAction *m_newTabAction;
- QAction *m_closeTabAction;
- QAction *m_nextTabAction;
- QAction *m_previousTabAction;
-
- QMenu *m_recentlyClosedTabsMenu;
- static const int m_recentlyClosedTabsSize = 10;
- QList<QUrl> m_recentlyClosedTabs;
- QList<WebActionMapper*> m_actions;
-
- QCompleter *m_lineEditCompleter;
- QStackedWidget *m_lineEdits;
- TabBar *m_tabBar;
-};
-
-#endif // TABWIDGET_H
-
diff --git a/examples/gestures/browser/toolbarsearch.cpp b/examples/gestures/browser/toolbarsearch.cpp
deleted file mode 100644
index 0fb5322..0000000
--- a/examples/gestures/browser/toolbarsearch.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "toolbarsearch.h"
-#include "autosaver.h"
-
-#include <QtCore/QSettings>
-#include <QtCore/QUrl>
-
-#include <QtGui/QCompleter>
-#include <QtGui/QMenu>
-#include <QtGui/QStringListModel>
-
-#include <QtWebKit/QWebSettings>
-
-/*
- ToolbarSearch is a very basic search widget that also contains a small history.
- Searches are turned into urls that use Google to perform search
- */
-ToolbarSearch::ToolbarSearch(QWidget *parent)
- : SearchLineEdit(parent)
- , m_autosaver(new AutoSaver(this))
- , m_maxSavedSearches(10)
- , m_stringListModel(new QStringListModel(this))
-{
- QMenu *m = menu();
- connect(m, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMenu()));
- connect(m, SIGNAL(triggered(QAction*)), this, SLOT(triggeredMenuAction(QAction*)));
-
- QCompleter *completer = new QCompleter(m_stringListModel, this);
- completer->setCompletionMode(QCompleter::InlineCompletion);
- lineEdit()->setCompleter(completer);
-
- connect(lineEdit(), SIGNAL(returnPressed()), SLOT(searchNow()));
- setInactiveText(tr("Google"));
- load();
-}
-
-ToolbarSearch::~ToolbarSearch()
-{
- m_autosaver->saveIfNeccessary();
-}
-
-void ToolbarSearch::save()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("toolbarsearch"));
- settings.setValue(QLatin1String("recentSearches"), m_stringListModel->stringList());
- settings.setValue(QLatin1String("maximumSaved"), m_maxSavedSearches);
- settings.endGroup();
-}
-
-void ToolbarSearch::load()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("toolbarsearch"));
- QStringList list = settings.value(QLatin1String("recentSearches")).toStringList();
- m_maxSavedSearches = settings.value(QLatin1String("maximumSaved"), m_maxSavedSearches).toInt();
- m_stringListModel->setStringList(list);
- settings.endGroup();
-}
-
-void ToolbarSearch::searchNow()
-{
- QString searchText = lineEdit()->text();
- QStringList newList = m_stringListModel->stringList();
- if (newList.contains(searchText))
- newList.removeAt(newList.indexOf(searchText));
- newList.prepend(searchText);
- if (newList.size() >= m_maxSavedSearches)
- newList.removeLast();
-
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (!globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
- m_stringListModel->setStringList(newList);
- m_autosaver->changeOccurred();
- }
-
- QUrl url(QLatin1String("http://www.google.com/search"));
- url.addQueryItem(QLatin1String("q"), searchText);
- url.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8"));
- url.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8"));
- url.addQueryItem(QLatin1String("client"), QLatin1String("qtdemobrowser"));
- emit search(url);
-}
-
-void ToolbarSearch::aboutToShowMenu()
-{
- lineEdit()->selectAll();
- QMenu *m = menu();
- m->clear();
- QStringList list = m_stringListModel->stringList();
- if (list.isEmpty()) {
- m->addAction(tr("No Recent Searches"));
- return;
- }
-
- QAction *recent = m->addAction(tr("Recent Searches"));
- recent->setEnabled(false);
- for (int i = 0; i < list.count(); ++i) {
- QString text = list.at(i);
- m->addAction(text)->setData(text);
- }
- m->addSeparator();
- m->addAction(tr("Clear Recent Searches"), this, SLOT(clear()));
-}
-
-void ToolbarSearch::triggeredMenuAction(QAction *action)
-{
- QVariant v = action->data();
- if (v.canConvert<QString>()) {
- QString text = v.toString();
- lineEdit()->setText(text);
- searchNow();
- }
-}
-
-void ToolbarSearch::clear()
-{
- m_stringListModel->setStringList(QStringList());
- m_autosaver->changeOccurred();;
-}
-
diff --git a/examples/gestures/browser/urllineedit.cpp b/examples/gestures/browser/urllineedit.cpp
deleted file mode 100644
index 70951d1..0000000
--- a/examples/gestures/browser/urllineedit.cpp
+++ /dev/null
@@ -1,340 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "urllineedit.h"
-
-#include "browserapplication.h"
-#include "searchlineedit.h"
-#include "webview.h"
-
-#include <QtCore/QEvent>
-
-#include <QtGui/QApplication>
-#include <QtGui/QCompleter>
-#include <QtGui/QFocusEvent>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
-#include <QtGui/QPainter>
-#include <QtGui/QStyle>
-#include <QtGui/QStyleOptionFrameV2>
-
-#include <QtCore/QDebug>
-
-ExLineEdit::ExLineEdit(QWidget *parent)
- : QWidget(parent)
- , m_leftWidget(0)
- , m_lineEdit(new QLineEdit(this))
- , m_clearButton(0)
-{
- setFocusPolicy(m_lineEdit->focusPolicy());
- setAttribute(Qt::WA_InputMethodEnabled);
- setSizePolicy(m_lineEdit->sizePolicy());
- setBackgroundRole(m_lineEdit->backgroundRole());
- setMouseTracking(true);
- setAcceptDrops(true);
- setAttribute(Qt::WA_MacShowFocusRect, true);
- QPalette p = m_lineEdit->palette();
- setPalette(p);
-
- // line edit
- m_lineEdit->setFrame(false);
- m_lineEdit->setFocusProxy(this);
- m_lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
- QPalette clearPalette = m_lineEdit->palette();
- clearPalette.setBrush(QPalette::Base, QBrush(Qt::transparent));
- m_lineEdit->setPalette(clearPalette);
-
- // clearButton
- m_clearButton = new ClearButton(this);
- connect(m_clearButton, SIGNAL(clicked()),
- m_lineEdit, SLOT(clear()));
- connect(m_lineEdit, SIGNAL(textChanged(const QString&)),
- m_clearButton, SLOT(textChanged(const QString&)));
-}
-
-void ExLineEdit::setLeftWidget(QWidget *widget)
-{
- m_leftWidget = widget;
-}
-
-QWidget *ExLineEdit::leftWidget() const
-{
- return m_leftWidget;
-}
-
-void ExLineEdit::resizeEvent(QResizeEvent *event)
-{
- Q_ASSERT(m_leftWidget);
- updateGeometries();
- QWidget::resizeEvent(event);
-}
-
-void ExLineEdit::updateGeometries()
-{
- QStyleOptionFrameV2 panel;
- initStyleOption(&panel);
- QRect rect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
-
- int height = rect.height();
- int width = rect.width();
-
- int m_leftWidgetHeight = m_leftWidget->height();
- m_leftWidget->setGeometry(rect.x() + 2, rect.y() + (height - m_leftWidgetHeight)/2,
- m_leftWidget->width(), m_leftWidget->height());
-
- int clearButtonWidth = this->height();
- m_lineEdit->setGeometry(m_leftWidget->x() + m_leftWidget->width(), 0,
- width - clearButtonWidth - m_leftWidget->width(), this->height());
-
- m_clearButton->setGeometry(this->width() - clearButtonWidth, 0,
- clearButtonWidth, this->height());
-}
-
-void ExLineEdit::initStyleOption(QStyleOptionFrameV2 *option) const
-{
- option->initFrom(this);
- option->rect = contentsRect();
- option->lineWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, option, this);
- option->midLineWidth = 0;
- option->state |= QStyle::State_Sunken;
- if (m_lineEdit->isReadOnly())
- option->state |= QStyle::State_ReadOnly;
-#ifdef QT_KEYPAD_NAVIGATION
- if (hasEditFocus())
- option->state |= QStyle::State_HasEditFocus;
-#endif
- option->features = QStyleOptionFrameV2::None;
-}
-
-QSize ExLineEdit::sizeHint() const
-{
- m_lineEdit->setFrame(true);
- QSize size = m_lineEdit->sizeHint();
- m_lineEdit->setFrame(false);
- return size;
-}
-
-void ExLineEdit::focusInEvent(QFocusEvent *event)
-{
- m_lineEdit->event(event);
- QWidget::focusInEvent(event);
-}
-
-void ExLineEdit::focusOutEvent(QFocusEvent *event)
-{
- m_lineEdit->event(event);
-
- if (m_lineEdit->completer()) {
- connect(m_lineEdit->completer(), SIGNAL(activated(QString)),
- m_lineEdit, SLOT(setText(QString)));
- connect(m_lineEdit->completer(), SIGNAL(highlighted(QString)),
- m_lineEdit, SLOT(_q_completionHighlighted(QString)));
- }
- QWidget::focusOutEvent(event);
-}
-
-void ExLineEdit::keyPressEvent(QKeyEvent *event)
-{
- m_lineEdit->event(event);
-}
-
-bool ExLineEdit::event(QEvent *event)
-{
- if (event->type() == QEvent::ShortcutOverride)
- return m_lineEdit->event(event);
- return QWidget::event(event);
-}
-
-void ExLineEdit::paintEvent(QPaintEvent *)
-{
- QPainter p(this);
- QStyleOptionFrameV2 panel;
- initStyleOption(&panel);
- style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this);
-}
-
-QVariant ExLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const
-{
- return m_lineEdit->inputMethodQuery(property);
-}
-
-void ExLineEdit::inputMethodEvent(QInputMethodEvent *e)
-{
- m_lineEdit->event(e);
-}
-
-
-class UrlIconLabel : public QLabel
-{
-
-public:
- UrlIconLabel(QWidget *parent);
-
- WebView *m_webView;
-
-protected:
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
-
-private:
- QPoint m_dragStartPos;
-
-};
-
-UrlIconLabel::UrlIconLabel(QWidget *parent)
- : QLabel(parent)
- , m_webView(0)
-{
- setMinimumWidth(16);
- setMinimumHeight(16);
-}
-
-void UrlIconLabel::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton)
- m_dragStartPos = event->pos();
- QLabel::mousePressEvent(event);
-}
-
-void UrlIconLabel::mouseMoveEvent(QMouseEvent *event)
-{
- if (event->buttons() == Qt::LeftButton
- && (event->pos() - m_dragStartPos).manhattanLength() > QApplication::startDragDistance()
- && m_webView) {
- QDrag *drag = new QDrag(this);
- QMimeData *mimeData = new QMimeData;
- mimeData->setText(QString::fromUtf8(m_webView->url().toEncoded()));
- QList<QUrl> urls;
- urls.append(m_webView->url());
- mimeData->setUrls(urls);
- drag->setMimeData(mimeData);
- drag->exec();
- }
-}
-
-UrlLineEdit::UrlLineEdit(QWidget *parent)
- : ExLineEdit(parent)
- , m_webView(0)
- , m_iconLabel(0)
-{
- // icon
- m_iconLabel = new UrlIconLabel(this);
- m_iconLabel->resize(16, 16);
- setLeftWidget(m_iconLabel);
- m_defaultBaseColor = palette().color(QPalette::Base);
-
- webViewIconChanged();
-}
-
-void UrlLineEdit::setWebView(WebView *webView)
-{
- Q_ASSERT(!m_webView);
- m_webView = webView;
- m_iconLabel->m_webView = webView;
- connect(webView, SIGNAL(urlChanged(const QUrl &)),
- this, SLOT(webViewUrlChanged(const QUrl &)));
- connect(webView, SIGNAL(loadFinished(bool)),
- this, SLOT(webViewIconChanged()));
- connect(webView, SIGNAL(iconChanged()),
- this, SLOT(webViewIconChanged()));
- connect(webView, SIGNAL(loadProgress(int)),
- this, SLOT(update()));
-}
-
-void UrlLineEdit::webViewUrlChanged(const QUrl &url)
-{
- m_lineEdit->setText(QString::fromUtf8(url.toEncoded()));
- m_lineEdit->setCursorPosition(0);
-}
-
-void UrlLineEdit::webViewIconChanged()
-{
- QUrl url = (m_webView) ? m_webView->url() : QUrl();
- QIcon icon = BrowserApplication::instance()->icon(url);
- QPixmap pixmap(icon.pixmap(16, 16));
- m_iconLabel->setPixmap(pixmap);
-}
-
-QLinearGradient UrlLineEdit::generateGradient(const QColor &color) const
-{
- QLinearGradient gradient(0, 0, 0, height());
- gradient.setColorAt(0, m_defaultBaseColor);
- gradient.setColorAt(0.15, color.lighter(120));
- gradient.setColorAt(0.5, color);
- gradient.setColorAt(0.85, color.lighter(120));
- gradient.setColorAt(1, m_defaultBaseColor);
- return gradient;
-}
-
-void UrlLineEdit::focusOutEvent(QFocusEvent *event)
-{
- if (m_lineEdit->text().isEmpty() && m_webView)
- m_lineEdit->setText(QString::fromUtf8(m_webView->url().toEncoded()));
- ExLineEdit::focusOutEvent(event);
-}
-
-void UrlLineEdit::paintEvent(QPaintEvent *event)
-{
- QPalette p = palette();
- if (m_webView && m_webView->url().scheme() == QLatin1String("https")) {
- QColor lightYellow(248, 248, 210);
- p.setBrush(QPalette::Base, generateGradient(lightYellow));
- } else {
- p.setBrush(QPalette::Base, m_defaultBaseColor);
- }
- setPalette(p);
- ExLineEdit::paintEvent(event);
-
- QPainter painter(this);
- QStyleOptionFrameV2 panel;
- initStyleOption(&panel);
- QRect backgroundRect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
- if (m_webView && !hasFocus()) {
- int progress = m_webView->progress();
- QColor loadingColor = QColor(116, 192, 250);
- painter.setBrush(generateGradient(loadingColor));
- painter.setPen(Qt::transparent);
- int mid = backgroundRect.width() / 100 * progress;
- QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height());
- painter.drawRect(progressRect);
- }
-}
diff --git a/examples/gestures/browser/webview.cpp b/examples/gestures/browser/webview.cpp
deleted file mode 100644
index e50872f..0000000
--- a/examples/gestures/browser/webview.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "browserapplication.h"
-#include "browsermainwindow.h"
-#include "cookiejar.h"
-#include "downloadmanager.h"
-#include "networkaccessmanager.h"
-#include "tabwidget.h"
-#include "webview.h"
-
-#include <QtGui/QClipboard>
-#include <QtGui/QGesture>
-#include <QtGui/QMenu>
-#include <QtGui/QMessageBox>
-#include <QtGui/QMouseEvent>
-
-#include <QtWebKit/QWebHitTestResult>
-
-#include <QtUiTools/QUiLoader>
-
-#include <QtCore/QDebug>
-#include <QtCore/QBuffer>
-
-WebPage::WebPage(QObject *parent)
- : QWebPage(parent)
- , m_keyboardModifiers(Qt::NoModifier)
- , m_pressedButtons(Qt::NoButton)
- , m_openInNewTab(false)
-{
- setNetworkAccessManager(BrowserApplication::networkAccessManager());
- connect(this, SIGNAL(unsupportedContent(QNetworkReply *)),
- this, SLOT(handleUnsupportedContent(QNetworkReply *)));
-}
-
-BrowserMainWindow *WebPage::mainWindow()
-{
- QObject *w = this->parent();
- while (w) {
- if (BrowserMainWindow *mw = qobject_cast<BrowserMainWindow*>(w))
- return mw;
- w = w->parent();
- }
- return BrowserApplication::instance()->mainWindow();
-}
-
-bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
-{
- // ctrl open in new tab
- // ctrl-shift open in new tab and select
- // ctrl-alt open in new window
- if (type == QWebPage::NavigationTypeLinkClicked
- && (m_keyboardModifiers & Qt::ControlModifier
- || m_pressedButtons == Qt::MidButton)) {
- bool newWindow = (m_keyboardModifiers & Qt::AltModifier);
- WebView *webView;
- if (newWindow) {
- BrowserApplication::instance()->newMainWindow();
- BrowserMainWindow *newMainWindow = BrowserApplication::instance()->mainWindow();
- webView = newMainWindow->currentTab();
- newMainWindow->raise();
- newMainWindow->activateWindow();
- webView->setFocus();
- } else {
- bool selectNewTab = (m_keyboardModifiers & Qt::ShiftModifier);
- webView = mainWindow()->tabWidget()->newTab(selectNewTab);
- }
- webView->load(request);
- m_keyboardModifiers = Qt::NoModifier;
- m_pressedButtons = Qt::NoButton;
- return false;
- }
- if (frame == mainFrame()) {
- m_loadingUrl = request.url();
- emit loadingUrl(m_loadingUrl);
- }
- return QWebPage::acceptNavigationRequest(frame, request, type);
-}
-
-QWebPage *WebPage::createWindow(QWebPage::WebWindowType type)
-{
- Q_UNUSED(type);
- if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
- m_openInNewTab = true;
- if (m_openInNewTab) {
- m_openInNewTab = false;
- return mainWindow()->tabWidget()->newTab()->page();
- }
- BrowserApplication::instance()->newMainWindow();
- BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
- return mainWindow->currentTab()->page();
-}
-
-#if !defined(QT_NO_UITOOLS)
-QObject *WebPage::createPlugin(const QString &classId, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
-{
- Q_UNUSED(url);
- Q_UNUSED(paramNames);
- Q_UNUSED(paramValues);
- QUiLoader loader;
- return loader.createWidget(classId, view());
-}
-#endif // !defined(QT_NO_UITOOLS)
-
-void WebPage::handleUnsupportedContent(QNetworkReply *reply)
-{
- if (reply->error() == QNetworkReply::NoError) {
- BrowserApplication::downloadManager()->handleUnsupportedContent(reply);
- return;
- }
-
- QFile file(QLatin1String(":/notfound.html"));
- bool isOpened = file.open(QIODevice::ReadOnly);
- Q_ASSERT(isOpened);
- QString title = tr("Error loading page: %1").arg(reply->url().toString());
- QString html = QString(QLatin1String(file.readAll()))
- .arg(title)
- .arg(reply->errorString())
- .arg(reply->url().toString());
-
- QBuffer imageBuffer;
- imageBuffer.open(QBuffer::ReadWrite);
- QIcon icon = view()->style()->standardIcon(QStyle::SP_MessageBoxWarning, 0, view());
- QPixmap pixmap = icon.pixmap(QSize(32,32));
- if (pixmap.save(&imageBuffer, "PNG")) {
- html.replace(QLatin1String("IMAGE_BINARY_DATA_HERE"),
- QString(QLatin1String(imageBuffer.buffer().toBase64())));
- }
-
- QList<QWebFrame*> frames;
- frames.append(mainFrame());
- while (!frames.isEmpty()) {
- QWebFrame *frame = frames.takeFirst();
- if (frame->url() == reply->url()) {
- frame->setHtml(html, reply->url());
- return;
- }
- QList<QWebFrame *> children = frame->childFrames();
- foreach(QWebFrame *frame, children)
- frames.append(frame);
- }
- if (m_loadingUrl == reply->url()) {
- mainFrame()->setHtml(html, reply->url());
- }
-}
-
-
-WebView::WebView(QWidget* parent)
- : QWebView(parent)
- , m_progress(0)
- , m_page(new WebPage(this))
- , m_currentPanFrame(0)
-{
- grabGesture(Qt::PanGesture);
- setPage(m_page);
- connect(page(), SIGNAL(statusBarMessage(const QString&)),
- SLOT(setStatusBarText(const QString&)));
- connect(this, SIGNAL(loadProgress(int)),
- this, SLOT(setProgress(int)));
- connect(this, SIGNAL(loadFinished(bool)),
- this, SLOT(loadFinished()));
- connect(page(), SIGNAL(loadingUrl(const QUrl&)),
- this, SIGNAL(urlChanged(const QUrl &)));
- connect(page(), SIGNAL(downloadRequested(const QNetworkRequest &)),
- this, SLOT(downloadRequested(const QNetworkRequest &)));
- page()->setForwardUnsupportedContent(true);
-
-}
-
-void WebView::contextMenuEvent(QContextMenuEvent *event)
-{
- QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos());
- if (!r.linkUrl().isEmpty()) {
- QMenu menu(this);
- menu.addAction(pageAction(QWebPage::OpenLinkInNewWindow));
- menu.addAction(tr("Open in New Tab"), this, SLOT(openLinkInNewTab()));
- menu.addSeparator();
- menu.addAction(pageAction(QWebPage::DownloadLinkToDisk));
- // Add link to bookmarks...
- menu.addSeparator();
- menu.addAction(pageAction(QWebPage::CopyLinkToClipboard));
- if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled))
- menu.addAction(pageAction(QWebPage::InspectElement));
- menu.exec(mapToGlobal(event->pos()));
- return;
- }
- QWebView::contextMenuEvent(event);
-}
-
-void WebView::wheelEvent(QWheelEvent *event)
-{
- if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
- int numDegrees = event->delta() / 8;
- int numSteps = numDegrees / 15;
- setTextSizeMultiplier(textSizeMultiplier() + numSteps * 0.1);
- event->accept();
- return;
- }
- QWebView::wheelEvent(event);
-}
-
-void WebView::openLinkInNewTab()
-{
- m_page->m_openInNewTab = true;
- pageAction(QWebPage::OpenLinkInNewWindow)->trigger();
-}
-
-void WebView::setProgress(int progress)
-{
- m_progress = progress;
-}
-
-void WebView::loadFinished()
-{
- if (100 != m_progress) {
- qWarning() << "Recieved finished signal while progress is still:" << progress()
- << "Url:" << url();
- }
- m_progress = 0;
-}
-
-void WebView::loadUrl(const QUrl &url)
-{
- m_initialUrl = url;
- load(url);
-}
-
-QString WebView::lastStatusBarText() const
-{
- return m_statusBarText;
-}
-
-QUrl WebView::url() const
-{
- QUrl url = QWebView::url();
- if (!url.isEmpty())
- return url;
-
- return m_initialUrl;
-}
-
-void WebView::mousePressEvent(QMouseEvent *event)
-{
- m_page->m_pressedButtons = event->buttons();
- m_page->m_keyboardModifiers = event->modifiers();
- QWebView::mousePressEvent(event);
-}
-
-void WebView::mouseReleaseEvent(QMouseEvent *event)
-{
- QWebView::mouseReleaseEvent(event);
- if (!event->isAccepted() && (m_page->m_pressedButtons & Qt::MidButton)) {
- QUrl url(QApplication::clipboard()->text(QClipboard::Selection));
- if (!url.isEmpty() && url.isValid() && !url.scheme().isEmpty()) {
- setUrl(url);
- }
- }
-}
-
-void WebView::setStatusBarText(const QString &string)
-{
- m_statusBarText = string;
-}
-
-void WebView::downloadRequested(const QNetworkRequest &request)
-{
- BrowserApplication::downloadManager()->download(request);
-}
-
-bool WebView::event(QEvent *event)
-{
- if (event->type() == QEvent::Gesture)
- {
- gestureEvent(static_cast<QGestureEvent*>(event));
- return true;
- }
- return QWebView::event(event);
-}
-
-void WebView::gestureEvent(QGestureEvent *event)
-{
- if (const QGesture *g = event->gesture(Qt::PanGesture)) {
- if (g->state() == Qt::GestureUpdated) {
- if (m_currentPanFrame) {
- m_panSpeed = g->pos() - g->lastPos();
- m_currentPanFrame->scroll(-m_panSpeed.x(), -m_panSpeed.y());
- }
- } else if (g->state() == Qt::GestureStarted) {
- startTimer(20);
- m_currentPanFrame = 0;
- if (QWebFrame *frame = page()->mainFrame()) {
- QWebHitTestResult result = frame->hitTestContent(g->startPos());
- if (!result.isNull())
- m_currentPanFrame = result.frame();
- while (m_currentPanFrame &&
- m_currentPanFrame->scrollBarMinimum(Qt::Vertical) == 0 &&
- m_currentPanFrame->scrollBarMaximum(Qt::Vertical) == 0 &&
- m_currentPanFrame->scrollBarMinimum(Qt::Horizontal) == 0 &&
- m_currentPanFrame->scrollBarMaximum(Qt::Horizontal) == 0) {
- m_currentPanFrame = m_currentPanFrame->parentFrame();
- }
- }
- } else {
- }
- event->accept();
- }
-}
-
-static QPoint deaccelerate(const QPoint &speed, int a = 1, int max = 64)
-{
- int x = qBound(-max, speed.x(), max);
- int y = qBound(-max, speed.y(), max);
- x = (x == 0) ? x : (x > 0) ? qMax(0, x - a) : qMin(0, x + a);
- y = (y == 0) ? y : (y > 0) ? qMax(0, y - a) : qMin(0, y + a);
- return QPoint(x, y);
-}
-
-void WebView::timerEvent(QTimerEvent *event)
-{
- m_panSpeed = deaccelerate(m_panSpeed);
- if (m_panSpeed.isNull())
- killTimer(event->timerId());
- if (m_currentPanFrame)
- m_currentPanFrame->scroll(-m_panSpeed.x(), -m_panSpeed.y());
-}
diff --git a/examples/gestures/browser/webview.h b/examples/gestures/browser/webview.h
deleted file mode 100644
index 71aca1a..0000000
--- a/examples/gestures/browser/webview.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WEBVIEW_H
-#define WEBVIEW_H
-
-#include <QtWebKit/QWebView>
-
-QT_BEGIN_NAMESPACE
-class QAuthenticator;
-class QMouseEvent;
-class QNetworkProxy;
-class QNetworkReply;
-class QSslError;
-QT_END_NAMESPACE
-
-class BrowserMainWindow;
-class WebPage : public QWebPage {
- Q_OBJECT
-
-signals:
- void loadingUrl(const QUrl &url);
-
-public:
- WebPage(QObject *parent = 0);
- BrowserMainWindow *mainWindow();
-
-protected:
- bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type);
- QWebPage *createWindow(QWebPage::WebWindowType type);
-#if !defined(QT_NO_UITOOLS)
- QObject *createPlugin(const QString &classId, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues);
-#endif
-
-private slots:
- void handleUnsupportedContent(QNetworkReply *reply);
-
-private:
- friend class WebView;
-
- // set the webview mousepressedevent
- Qt::KeyboardModifiers m_keyboardModifiers;
- Qt::MouseButtons m_pressedButtons;
- bool m_openInNewTab;
- QUrl m_loadingUrl;
-};
-
-class WebView : public QWebView {
- Q_OBJECT
-
-public:
- WebView(QWidget *parent = 0);
- WebPage *webPage() const { return m_page; }
-
- void loadUrl(const QUrl &url);
- QUrl url() const;
-
- QString lastStatusBarText() const;
- inline int progress() const { return m_progress; }
-
-protected:
- bool event(QEvent *event);
- void gestureEvent(QGestureEvent *event);
- void timerEvent(QTimerEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void contextMenuEvent(QContextMenuEvent *event);
- void wheelEvent(QWheelEvent *event);
-
-private slots:
- void setProgress(int progress);
- void loadFinished();
- void setStatusBarText(const QString &string);
- void downloadRequested(const QNetworkRequest &request);
- void openLinkInNewTab();
-
-private:
- QString m_statusBarText;
- QUrl m_initialUrl;
- int m_progress;
- WebPage *m_page;
- QPoint m_panSpeed;
- QWebFrame *m_currentPanFrame;
-};
-
-#endif
diff --git a/examples/gestures/browser/xbel.cpp b/examples/gestures/browser/xbel.cpp
deleted file mode 100644
index 6145281..0000000
--- a/examples/gestures/browser/xbel.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xbel.h"
-
-#include <QtCore/QFile>
-
-BookmarkNode::BookmarkNode(BookmarkNode::Type type, BookmarkNode *parent) :
- expanded(false)
- , m_parent(parent)
- , m_type(type)
-{
- if (parent)
- parent->add(this);
-}
-
-BookmarkNode::~BookmarkNode()
-{
- if (m_parent)
- m_parent->remove(this);
- qDeleteAll(m_children);
- m_parent = 0;
- m_type = BookmarkNode::Root;
-}
-
-bool BookmarkNode::operator==(const BookmarkNode &other)
-{
- if (url != other.url
- || title != other.title
- || desc != other.desc
- || expanded != other.expanded
- || m_type != other.m_type
- || m_children.count() != other.m_children.count())
- return false;
-
- for (int i = 0; i < m_children.count(); ++i)
- if (!((*(m_children[i])) == (*(other.m_children[i]))))
- return false;
- return true;
-}
-
-BookmarkNode::Type BookmarkNode::type() const
-{
- return m_type;
-}
-
-void BookmarkNode::setType(Type type)
-{
- m_type = type;
-}
-
-QList<BookmarkNode *> BookmarkNode::children() const
-{
- return m_children;
-}
-
-BookmarkNode *BookmarkNode::parent() const
-{
- return m_parent;
-}
-
-void BookmarkNode::add(BookmarkNode *child, int offset)
-{
- Q_ASSERT(child->m_type != Root);
- if (child->m_parent)
- child->m_parent->remove(child);
- child->m_parent = this;
- if (-1 == offset)
- offset = m_children.size();
- m_children.insert(offset, child);
-}
-
-void BookmarkNode::remove(BookmarkNode *child)
-{
- child->m_parent = 0;
- m_children.removeAll(child);
-}
-
-
-XbelReader::XbelReader()
-{
-}
-
-BookmarkNode *XbelReader::read(const QString &fileName)
-{
- QFile file(fileName);
- if (!file.exists()) {
- return new BookmarkNode(BookmarkNode::Root);
- }
- file.open(QFile::ReadOnly);
- return read(&file);
-}
-
-BookmarkNode *XbelReader::read(QIODevice *device)
-{
- BookmarkNode *root = new BookmarkNode(BookmarkNode::Root);
- setDevice(device);
- while (!atEnd()) {
- readNext();
- if (isStartElement()) {
- QString version = attributes().value(QLatin1String("version")).toString();
- if (name() == QLatin1String("xbel")
- && (version.isEmpty() || version == QLatin1String("1.0"))) {
- readXBEL(root);
- } else {
- raiseError(QObject::tr("The file is not an XBEL version 1.0 file."));
- }
- }
- }
- return root;
-}
-
-void XbelReader::readXBEL(BookmarkNode *parent)
-{
- Q_ASSERT(isStartElement() && name() == QLatin1String("xbel"));
-
- while (!atEnd()) {
- readNext();
- if (isEndElement())
- break;
-
- if (isStartElement()) {
- if (name() == QLatin1String("folder"))
- readFolder(parent);
- else if (name() == QLatin1String("bookmark"))
- readBookmarkNode(parent);
- else if (name() == QLatin1String("separator"))
- readSeparator(parent);
- else
- skipUnknownElement();
- }
- }
-}
-
-void XbelReader::readFolder(BookmarkNode *parent)
-{
- Q_ASSERT(isStartElement() && name() == QLatin1String("folder"));
-
- BookmarkNode *folder = new BookmarkNode(BookmarkNode::Folder, parent);
- folder->expanded = (attributes().value(QLatin1String("folded")) == QLatin1String("no"));
-
- while (!atEnd()) {
- readNext();
-
- if (isEndElement())
- break;
-
- if (isStartElement()) {
- if (name() == QLatin1String("title"))
- readTitle(folder);
- else if (name() == QLatin1String("desc"))
- readDescription(folder);
- else if (name() == QLatin1String("folder"))
- readFolder(folder);
- else if (name() == QLatin1String("bookmark"))
- readBookmarkNode(folder);
- else if (name() == QLatin1String("separator"))
- readSeparator(folder);
- else
- skipUnknownElement();
- }
- }
-}
-
-void XbelReader::readTitle(BookmarkNode *parent)
-{
- Q_ASSERT(isStartElement() && name() == QLatin1String("title"));
- parent->title = readElementText();
-}
-
-void XbelReader::readDescription(BookmarkNode *parent)
-{
- Q_ASSERT(isStartElement() && name() == QLatin1String("desc"));
- parent->desc = readElementText();
-}
-
-void XbelReader::readSeparator(BookmarkNode *parent)
-{
- new BookmarkNode(BookmarkNode::Separator, parent);
- // empty elements have a start and end element
- readNext();
-}
-
-void XbelReader::readBookmarkNode(BookmarkNode *parent)
-{
- Q_ASSERT(isStartElement() && name() == QLatin1String("bookmark"));
- BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark, parent);
- bookmark->url = attributes().value(QLatin1String("href")).toString();
- while (!atEnd()) {
- readNext();
- if (isEndElement())
- break;
-
- if (isStartElement()) {
- if (name() == QLatin1String("title"))
- readTitle(bookmark);
- else if (name() == QLatin1String("desc"))
- readDescription(bookmark);
- else
- skipUnknownElement();
- }
- }
- if (bookmark->title.isEmpty())
- bookmark->title = QObject::tr("Unknown title");
-}
-
-void XbelReader::skipUnknownElement()
-{
- Q_ASSERT(isStartElement());
-
- while (!atEnd()) {
- readNext();
-
- if (isEndElement())
- break;
-
- if (isStartElement())
- skipUnknownElement();
- }
-}
-
-
-XbelWriter::XbelWriter()
-{
- setAutoFormatting(true);
-}
-
-bool XbelWriter::write(const QString &fileName, const BookmarkNode *root)
-{
- QFile file(fileName);
- if (!root || !file.open(QFile::WriteOnly))
- return false;
- return write(&file, root);
-}
-
-bool XbelWriter::write(QIODevice *device, const BookmarkNode *root)
-{
- setDevice(device);
-
- writeStartDocument();
- writeDTD(QLatin1String("<!DOCTYPE xbel>"));
- writeStartElement(QLatin1String("xbel"));
- writeAttribute(QLatin1String("version"), QLatin1String("1.0"));
- if (root->type() == BookmarkNode::Root) {
- for (int i = 0; i < root->children().count(); ++i)
- writeItem(root->children().at(i));
- } else {
- writeItem(root);
- }
-
- writeEndDocument();
- return true;
-}
-
-void XbelWriter::writeItem(const BookmarkNode *parent)
-{
- switch (parent->type()) {
- case BookmarkNode::Folder:
- writeStartElement(QLatin1String("folder"));
- writeAttribute(QLatin1String("folded"), parent->expanded ? QLatin1String("no") : QLatin1String("yes"));
- writeTextElement(QLatin1String("title"), parent->title);
- for (int i = 0; i < parent->children().count(); ++i)
- writeItem(parent->children().at(i));
- writeEndElement();
- break;
- case BookmarkNode::Bookmark:
- writeStartElement(QLatin1String("bookmark"));
- if (!parent->url.isEmpty())
- writeAttribute(QLatin1String("href"), parent->url);
- writeTextElement(QLatin1String("title"), parent->title);
- if (!parent->desc.isEmpty())
- writeAttribute(QLatin1String("desc"), parent->desc);
- writeEndElement();
- break;
- case BookmarkNode::Separator:
- writeEmptyElement(QLatin1String("separator"));
- break;
- default:
- break;
- }
-}
-
diff --git a/examples/gestures/browser/xbel.h b/examples/gestures/browser/xbel.h
deleted file mode 100644
index 20cbda6..0000000
--- a/examples/gestures/browser/xbel.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XBEL_H
-#define XBEL_H
-
-#include <QtCore/QXmlStreamReader>
-#include <QtCore/QDateTime>
-
-class BookmarkNode
-{
-public:
- enum Type {
- Root,
- Folder,
- Bookmark,
- Separator
- };
-
- BookmarkNode(Type type = Root, BookmarkNode *parent = 0);
- ~BookmarkNode();
- bool operator==(const BookmarkNode &other);
-
- Type type() const;
- void setType(Type type);
- QList<BookmarkNode *> children() const;
- BookmarkNode *parent() const;
-
- void add(BookmarkNode *child, int offset = -1);
- void remove(BookmarkNode *child);
-
- QString url;
- QString title;
- QString desc;
- bool expanded;
-
-private:
- BookmarkNode *m_parent;
- Type m_type;
- QList<BookmarkNode *> m_children;
-
-};
-
-class XbelReader : public QXmlStreamReader
-{
-public:
- XbelReader();
- BookmarkNode *read(const QString &fileName);
- BookmarkNode *read(QIODevice *device);
-
-private:
- void skipUnknownElement();
- void readXBEL(BookmarkNode *parent);
- void readTitle(BookmarkNode *parent);
- void readDescription(BookmarkNode *parent);
- void readSeparator(BookmarkNode *parent);
- void readFolder(BookmarkNode *parent);
- void readBookmarkNode(BookmarkNode *parent);
-};
-
-#include <QtCore/QXmlStreamWriter>
-
-class XbelWriter : public QXmlStreamWriter
-{
-public:
- XbelWriter();
- bool write(const QString &fileName, const BookmarkNode *root);
- bool write(QIODevice *device, const BookmarkNode *root);
-
-private:
- void writeItem(const BookmarkNode *parent);
-};
-
-#endif // XBEL_H
-
diff --git a/examples/gestures/collidingmice/collidingmice.pro b/examples/gestures/collidingmice/collidingmice.pro
deleted file mode 100644
index 15164ce..0000000
--- a/examples/gestures/collidingmice/collidingmice.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-HEADERS += \
- mouse.h \
- gesturerecognizerlinjazax.h \
- linjazaxgesture.h
-
-SOURCES += \
- main.cpp \
- mouse.cpp \
- gesturerecognizerlinjazax.cpp
-
-RESOURCES += \
- mice.qrc
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/gestures/collidingmice
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS collidingmice.pro images
-sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/collidingmice
-INSTALLS += target sources
diff --git a/examples/gestures/collidingmice/gesturerecognizerlinjazax.cpp b/examples/gestures/collidingmice/gesturerecognizerlinjazax.cpp
deleted file mode 100644
index 2070f6f..0000000
--- a/examples/gestures/collidingmice/gesturerecognizerlinjazax.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "gesturerecognizerlinjazax.h"
-
-#include <QRegExp>
-#include <QDebug>
-
-static const int SIZE = 20;
-
-DirectionSimpleRecognizer::DirectionSimpleRecognizer()
-{
-}
-
-Direction DirectionSimpleRecognizer::addPosition(const QPoint &pos)
-{
- if (!directions.isEmpty()) {
- const QPoint tmp = pos - directions.back().point;
- if (tmp.manhattanLength() < 5)
- return Direction();
- }
- if (lastPoint.isNull()) {
- lastPoint = pos;
- return Direction();
- }
- int dx = pos.x() - lastPoint.x();
- int dy = pos.y() - lastPoint.y();
- QString direction;
- if (dx < 0) {
- if (-1*dx >= SIZE/2)
- direction = "4";
- } else {
- if (dx >= SIZE/2)
- direction = "6";
- }
- if (dy < 0) {
- if (-1*dy >= SIZE/2)
- direction = "8";
- } else {
- if (dy >= SIZE/2)
- direction = "2";
- }
- if (direction.isEmpty())
- return Direction();
-
- lastPoint = pos;
- directions.push_back(Direction(direction, pos));
- return Direction(direction, pos);
-}
-
-
-DirectionList DirectionSimpleRecognizer::getDirections() const
-{
- return directions;
-}
-
-void DirectionSimpleRecognizer::reset()
-{
- directions.clear();
- lastPoint = QPoint();
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-GestureRecognizerLinjaZax::GestureRecognizerLinjaZax()
- : QGestureRecognizer(QLatin1String("LinjaZax")), mousePressed(false), gestureFinished(false),
- zoomState(LinjaZaxGesture::NoZoom)
-{
-}
-
-QGestureRecognizer::Result GestureRecognizerLinjaZax::filterEvent(const QEvent *event)
-{
- if (zoomState != LinjaZaxGesture::NoZoom && !lastDirections.isEmpty()) {
- lastDirections = lastDirections.right(1);
- zoomState = LinjaZaxGesture::NoZoom;
- }
-
- if (event->type() == QEvent::MouseButtonPress) {
- if (!currentDirection.isEmpty()) {
- reset();
- return QGestureRecognizer::NotGesture;
- }
- mousePressed = true;
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- pressedPos = lastPos = currentPos = ev->pos();
- return QGestureRecognizer::MaybeGesture;
- } else if (event->type() == QEvent::MouseButtonRelease) {
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- if (mousePressed && !currentDirection.isEmpty()) {
- gestureFinished = true;
- currentPos = ev->pos();
- internalReset();
- return QGestureRecognizer::GestureFinished;
- }
- reset();
- return QGestureRecognizer::NotGesture;
- } else if (event->type() == QEvent::MouseMove) {
- if (!mousePressed)
- return QGestureRecognizer::NotGesture;
- lastPos = currentPos;
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- currentPos = ev->pos();
- QString direction =
- simpleRecognizer.addPosition(ev->pos()).direction;
- QGestureRecognizer::Result result = QGestureRecognizer::NotGesture;
- if (currentDirection.isEmpty()) {
- if (direction.isEmpty())
- result = QGestureRecognizer::MaybeGesture;
- else
- result = QGestureRecognizer::GestureStarted;
- } else {
- result = QGestureRecognizer::GestureStarted;
- }
- if (!direction.isEmpty()) {
- lastDirections.append(direction);
- currentDirection = direction;
- if (lastDirections.length() > 5)
- lastDirections.remove(0, 1);
- if (lastDirections.contains("248") || lastDirections.contains("2448"))
- zoomState = LinjaZaxGesture::ZoomingIn;
- else if (lastDirections.contains("268") || lastDirections.contains("2668"))
- zoomState = LinjaZaxGesture::ZoomingOut;
- }
- return result;
- }
- return QGestureRecognizer::NotGesture;
-}
-
-static inline LinjaZaxGesture::DirectionType convertPanningDirection(const QString &direction)
-{
- if (direction.length() == 1) {
- if (direction == "4")
- return LinjaZaxGesture::Left;
- else if (direction == "6")
- return LinjaZaxGesture::Right;
- else if (direction == "8")
- return LinjaZaxGesture::Up;
- else if (direction == "2")
- return LinjaZaxGesture::Down;
- }
- return LinjaZaxGesture::None;
-}
-
-QGesture* GestureRecognizerLinjaZax::getGesture()
-{
- LinjaZaxGesture::DirectionType dir = convertPanningDirection(currentDirection);
- LinjaZaxGesture::DirectionType lastDir = convertPanningDirection(lastDirections.right(1));
- if (dir == LinjaZaxGesture::None)
- return 0;
- LinjaZaxGesture *g =
- new LinjaZaxGesture(this, pressedPos, lastPos, currentPos,
- QRect(), pressedPos, QDateTime(), 0,
- gestureFinished ? Qt::GestureFinished : Qt::GestureStarted);
- g->lastDirection_ = lastDir;
- g->direction_ = dir;
- g->zoomState_ = zoomState;
-
- return g;
-}
-
-void GestureRecognizerLinjaZax::reset()
-{
- mousePressed = false;
- lastDirections.clear();
- currentDirection.clear();
- gestureFinished = false;
- simpleRecognizer.reset();
- zoomState = LinjaZaxGesture::NoZoom;
-}
-
-void GestureRecognizerLinjaZax::internalReset()
-{
- mousePressed = false;
- simpleRecognizer.reset();
-}
diff --git a/examples/gestures/collidingmice/gesturerecognizerlinjazax.h b/examples/gestures/collidingmice/gesturerecognizerlinjazax.h
deleted file mode 100644
index 79b2c2b..0000000
--- a/examples/gestures/collidingmice/gesturerecognizerlinjazax.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GESTURERECOGNIZERLINJAZAX_H
-#define GESTURERECOGNIZERLINJAZAX_H
-
-#include <QList>
-#include <QPoint>
-#include <QString>
-#include <QGesture>
-#include <QGestureRecognizer>
-
-#include "linjazaxgesture.h"
-
-struct Direction
-{
- QString direction;
- QPoint point;
-
- Direction(QString dir, const QPoint &pt)
- : direction(dir), point(pt) { }
- Direction()
- : direction() { }
-
- inline bool isEmpty() const { return direction.isEmpty(); }
- inline bool isNull() const { return direction.isEmpty(); }
-};
-typedef QList<Direction> DirectionList;
-
-class DirectionSimpleRecognizer
-{
-public:
- DirectionSimpleRecognizer();
- Direction addPosition(const QPoint &pos);
- DirectionList getDirections() const;
- void reset();
-
-private:
- QPoint lastPoint;
- DirectionList directions;
-};
-
-class GestureRecognizerLinjaZax : public QGestureRecognizer
-{
- Q_OBJECT
-public:
- GestureRecognizerLinjaZax();
-
- QGestureRecognizer::Result filterEvent(const QEvent *event);
- QGesture* getGesture();
-
- void reset();
-
-private:
- void internalReset();
-
- QPoint pressedPos;
- QPoint lastPos;
- QPoint currentPos;
- bool mousePressed;
- bool gestureFinished;
- QString lastDirections;
- QString currentDirection;
- DirectionSimpleRecognizer simpleRecognizer;
- LinjaZaxGesture::ZoomState zoomState;
-};
-
-#endif
diff --git a/examples/gestures/collidingmice/images/cheese.jpg b/examples/gestures/collidingmice/images/cheese.jpg
deleted file mode 100644
index dea5795..0000000
--- a/examples/gestures/collidingmice/images/cheese.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/gestures/collidingmice/linjazaxgesture.h b/examples/gestures/collidingmice/linjazaxgesture.h
deleted file mode 100644
index 53b907e..0000000
--- a/examples/gestures/collidingmice/linjazaxgesture.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LINJAZAXGESTURE_H
-#define LINJAZAXGESTURE_H
-
-#include <QGesture>
-
-class LinjaZaxGesture : public QGesture
-{
-public:
- enum DirectionType
- {
- None = 0,
- LeftDown = 1,
- DownLeft = LeftDown,
- Down = 2,
- RightDown = 3,
- DownRight = RightDown,
- Left = 4,
- Right = 6,
- LeftUp = 7,
- UpLeft = LeftUp,
- Up = 8,
- RightUp = 9,
- UpRight = RightUp
- };
-
- enum ZoomState
- {
- NoZoom,
- ZoomingIn,
- ZoomingOut
- };
-
-public:
- explicit LinjaZaxGesture(QObject *parent,
- Qt::GestureState state = Qt::GestureStarted)
- : QGesture(parent, QLatin1String("LinjaZax"), state), lastDirection_(None),
- direction_(None), zoomState_(NoZoom) { }
- LinjaZaxGesture(QObject *parent, const QPoint &startPos,
- const QPoint &lastPos, const QPoint &pos, const QRect &rect,
- const QPoint &hotSpot, const QDateTime &startTime,
- uint duration, Qt::GestureState state)
- : QGesture(parent, QLatin1String("LinjaZax"), startPos, lastPos,
- pos, rect, hotSpot, startTime, duration, state) { }
- ~LinjaZaxGesture() { }
-
- DirectionType lastDirection() const
- { return lastDirection_; }
- DirectionType direction() const
- { return direction_; }
-
- ZoomState zoomState() const
- { return zoomState_; }
-
-private:
- DirectionType lastDirection_;
- DirectionType direction_;
- ZoomState zoomState_;
- friend class GestureRecognizerLinjaZax;
-};
-
-#endif
diff --git a/examples/gestures/collidingmice/main.cpp b/examples/gestures/collidingmice/main.cpp
deleted file mode 100644
index 3638442..0000000
--- a/examples/gestures/collidingmice/main.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mouse.h"
-
-#include "gesturerecognizerlinjazax.h"
-#include "linjazaxgesture.h"
-
-#include <QtGui>
-
-#include <math.h>
-
-#define ZOOMING_ANIMATION
-#ifdef ZOOMING_ANIMATION
-static const int AnimationSteps = 10;
-#endif
-
-static const int MouseCount = 7;
-
-class PannableGraphicsView : public QGraphicsView
-{
- Q_OBJECT
-public:
- PannableGraphicsView(QGraphicsScene *scene, QWidget *parent = 0)
- : QGraphicsView(scene, parent)
- {
- grabGesture(QLatin1String("LinjaZax"));
-#ifdef ZOOMING_ANIMATION
- timeline = new QTimeLine(700, this);
- timeline->setFrameRange(0, AnimationSteps);
- connect(timeline, SIGNAL(frameChanged(int)), this, SLOT(animationStep(int)));
-#endif
- }
-protected:
- bool event(QEvent *event)
- {
- if (event->type() == QEvent::Gesture) {
- QGestureEvent *ge = static_cast<QGestureEvent*>(event);
- const LinjaZaxGesture *g = static_cast<const LinjaZaxGesture*>(ge->gesture("LinjaZax"));
- if (g) {
- switch (g->zoomState()) {
- case LinjaZaxGesture::ZoomingIn:
-#ifdef ZOOMING_ANIMATION
- scaleStep = 1. + 0.5/AnimationSteps;
- timeline->stop();
- timeline->start();
-#else
- scale(1.5, 1.5);
-#endif
- break;
- case LinjaZaxGesture::ZoomingOut:
-#ifdef ZOOMING_ANIMATION
- scaleStep = 1. - 0.5/AnimationSteps;
- timeline->stop();
- timeline->start();
-#else
- scale(0.6, 0.6);
-#endif
- break;
- default:
- break;
- };
- QPoint pt = g->pos() - g->lastPos();
- horizontalScrollBar()->setValue(horizontalScrollBar()->value() - pt.x());
- verticalScrollBar()->setValue(verticalScrollBar()->value() - pt.y());
- event->accept();
- return true;
- }
- }
- return QGraphicsView::event(event);
- }
-private slots:
-#ifdef ZOOMING_ANIMATION
- void animationStep(int step)
- {
- scale(scaleStep, scaleStep);
- }
-private:
- qreal scaleStep;
- QTimeLine *timeline;
-#endif
-};
-
-//! [0]
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- app.addGestureRecognizer(new GestureRecognizerLinjaZax);
- qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
-//! [0]
-
-//! [1]
- QGraphicsScene scene;
- scene.setSceneRect(-600, -600, 1200, 1200);
-//! [1] //! [2]
- scene.setItemIndexMethod(QGraphicsScene::NoIndex);
-//! [2]
-
-//! [3]
- for (int i = 0; i < MouseCount; ++i) {
- Mouse *mouse = new Mouse;
- mouse->setPos(::sin((i * 6.28) / MouseCount) * 200,
- ::cos((i * 6.28) / MouseCount) * 200);
- scene.addItem(mouse);
- }
-//! [3]
-
-//! [4]
- PannableGraphicsView view(&scene);
- view.setRenderHint(QPainter::Antialiasing);
- view.setBackgroundBrush(QPixmap(":/images/cheese.jpg"));
-//! [4] //! [5]
- view.setCacheMode(QGraphicsView::CacheBackground);
- view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
- //view.setDragMode(QGraphicsView::ScrollHandDrag);
-//! [5] //! [6]
- view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Colliding Mice"));
- view.resize(400, 300);
- view.show();
-
- return app.exec();
-}
-//! [6]
-
-#include "main.moc"
diff --git a/examples/gestures/collidingmice/mice.qrc b/examples/gestures/collidingmice/mice.qrc
deleted file mode 100644
index accdb4d..0000000
--- a/examples/gestures/collidingmice/mice.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/" >
- <file>images/cheese.jpg</file>
- </qresource>
-</RCC>
diff --git a/examples/gestures/collidingmice/mouse.cpp b/examples/gestures/collidingmice/mouse.cpp
deleted file mode 100644
index 256811a..0000000
--- a/examples/gestures/collidingmice/mouse.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mouse.h"
-
-#include <QGraphicsScene>
-#include <QPainter>
-#include <QStyleOption>
-
-#include <math.h>
-
-static const double Pi = 3.14159265358979323846264338327950288419717;
-static double TwoPi = 2.0 * Pi;
-
-static qreal normalizeAngle(qreal angle)
-{
- while (angle < 0)
- angle += TwoPi;
- while (angle > TwoPi)
- angle -= TwoPi;
- return angle;
-}
-
-//! [0]
-Mouse::Mouse()
- : angle(0), speed(0), mouseEyeDirection(0),
- color(qrand() % 256, qrand() % 256, qrand() % 256)
-{
- rotate(qrand() % (360 * 16));
- startTimer(1000 / 33);
-}
-//! [0]
-
-//! [1]
-QRectF Mouse::boundingRect() const
-{
- qreal adjust = 0.5;
- return QRectF(-18 - adjust, -22 - adjust,
- 36 + adjust, 60 + adjust);
-}
-//! [1]
-
-//! [2]
-QPainterPath Mouse::shape() const
-{
- QPainterPath path;
- path.addRect(-10, -20, 20, 40);
- return path;
-}
-//! [2]
-
-//! [3]
-void Mouse::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
-{
- // Body
- painter->setBrush(color);
- painter->drawEllipse(-10, -20, 20, 40);
-
- // Eyes
- painter->setBrush(Qt::white);
- painter->drawEllipse(-10, -17, 8, 8);
- painter->drawEllipse(2, -17, 8, 8);
-
- // Nose
- painter->setBrush(Qt::black);
- painter->drawEllipse(QRectF(-2, -22, 4, 4));
-
- // Pupils
- painter->drawEllipse(QRectF(-8.0 + mouseEyeDirection, -17, 4, 4));
- painter->drawEllipse(QRectF(4.0 + mouseEyeDirection, -17, 4, 4));
-
- // Ears
- painter->setBrush(scene()->collidingItems(this).isEmpty() ? Qt::darkYellow : Qt::red);
- painter->drawEllipse(-17, -12, 16, 16);
- painter->drawEllipse(1, -12, 16, 16);
-
- // Tail
- QPainterPath path(QPointF(0, 20));
- path.cubicTo(-5, 22, -5, 22, 0, 25);
- path.cubicTo(5, 27, 5, 32, 0, 30);
- path.cubicTo(-5, 32, -5, 42, 0, 35);
- painter->setBrush(Qt::NoBrush);
- painter->drawPath(path);
-}
-//! [3]
-
-//! [4]
-void Mouse::timerEvent(QTimerEvent *)
-{
-//! [4]
- // Don't move too far away
-//! [5]
- QLineF lineToCenter(QPointF(0, 0), mapFromScene(0, 0));
- if (lineToCenter.length() > 150) {
- qreal angleToCenter = ::acos(lineToCenter.dx() / lineToCenter.length());
- if (lineToCenter.dy() < 0)
- angleToCenter = TwoPi - angleToCenter;
- angleToCenter = normalizeAngle((Pi - angleToCenter) + Pi / 2);
-
- if (angleToCenter < Pi && angleToCenter > Pi / 4) {
- // Rotate left
- angle += (angle < -Pi / 2) ? 0.25 : -0.25;
- } else if (angleToCenter >= Pi && angleToCenter < (Pi + Pi / 2 + Pi / 4)) {
- // Rotate right
- angle += (angle < Pi / 2) ? 0.25 : -0.25;
- }
- } else if (::sin(angle) < 0) {
- angle += 0.25;
- } else if (::sin(angle) > 0) {
- angle -= 0.25;
-//! [5] //! [6]
- }
-//! [6]
-
- // Try not to crash with any other mice
-//! [7]
- QList<QGraphicsItem *> dangerMice = scene()->items(QPolygonF()
- << mapToScene(0, 0)
- << mapToScene(-30, -50)
- << mapToScene(30, -50));
- foreach (QGraphicsItem *item, dangerMice) {
- if (item == this)
- continue;
-
- QLineF lineToMouse(QPointF(0, 0), mapFromItem(item, 0, 0));
- qreal angleToMouse = ::acos(lineToMouse.dx() / lineToMouse.length());
- if (lineToMouse.dy() < 0)
- angleToMouse = TwoPi - angleToMouse;
- angleToMouse = normalizeAngle((Pi - angleToMouse) + Pi / 2);
-
- if (angleToMouse >= 0 && angleToMouse < Pi / 2) {
- // Rotate right
- angle += 0.5;
- } else if (angleToMouse <= TwoPi && angleToMouse > (TwoPi - Pi / 2)) {
- // Rotate left
- angle -= 0.5;
-//! [7] //! [8]
- }
-//! [8] //! [9]
- }
-//! [9]
-
- // Add some random movement
-//! [10]
- if (dangerMice.size() > 1 && (qrand() % 10) == 0) {
- if (qrand() % 1)
- angle += (qrand() % 100) / 500.0;
- else
- angle -= (qrand() % 100) / 500.0;
- }
-//! [10]
-
-//! [11]
- speed += (-50 + qrand() % 100) / 100.0;
-
- qreal dx = ::sin(angle) * 10;
- mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5;
-
- rotate(dx);
- setPos(mapToParent(0, -(3 + sin(speed) * 3)));
-}
-//! [11]
diff --git a/examples/gestures/collidingmice/mouse.h b/examples/gestures/collidingmice/mouse.h
deleted file mode 100644
index 6c8486f..0000000
--- a/examples/gestures/collidingmice/mouse.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOUSE_H
-#define MOUSE_H
-
-#include <QGraphicsItem>
-#include <QObject>
-
-//! [0]
-class Mouse : public QObject, public QGraphicsItem
-{
- Q_OBJECT
-
-public:
- Mouse();
-
- QRectF boundingRect() const;
- QPainterPath shape() const;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget);
-
-protected:
- void timerEvent(QTimerEvent *event);
-
-private:
- qreal angle;
- qreal speed;
- qreal mouseEyeDirection;
- QColor color;
-};
-//! [0]
-
-#endif
diff --git a/examples/gestures/gestures.pro b/examples/gestures/gestures.pro
index d0735ae..09cd56a 100644
--- a/examples/gestures/gestures.pro
+++ b/examples/gestures/gestures.pro
@@ -1,14 +1,7 @@
TEMPLATE = \
subdirs
SUBDIRS = \
- imageviewer \
- graphicsview \
- collidingmice
-
-contains(QT_CONFIG, webkit) {
- SUBDIRS += pannablewebview
- contains(QT_CONFIG, svg):SUBDIRS += browser
-}
+ imageviewer
# install
target.path = $$[QT_INSTALL_EXAMPLES]/gestures
diff --git a/examples/gestures/graphicsview/graphicsview.pro b/examples/gestures/graphicsview/graphicsview.pro
deleted file mode 100644
index 9cef564..0000000
--- a/examples/gestures/graphicsview/graphicsview.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = main.cpp
-
diff --git a/examples/gestures/graphicsview/main.cpp b/examples/gestures/graphicsview/main.cpp
deleted file mode 100644
index 12f4e75..0000000
--- a/examples/gestures/graphicsview/main.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-class PannableGraphicsView : public QGraphicsView
-{
-public:
- PannableGraphicsView()
- {
- grabGesture(Qt::PanGesture);
- }
-protected:
- bool event(QEvent *event)
- {
- if (event->type() == QEvent::Gesture) {
- QGestureEvent *gestureEvent = static_cast<QGestureEvent*>(event);
- if (const QGesture *g = gestureEvent->gesture(Qt::PanGesture)) {
- QPoint pt = g->pos() - g->lastPos();
- horizontalScrollBar()->setValue(horizontalScrollBar()->value() - pt.x());
- verticalScrollBar()->setValue(verticalScrollBar()->value() - pt.y());
- event->accept();
- return true;
- }
- }
- return QGraphicsView::event(event);
- }
-};
-
-class ImageItem : public QGraphicsItem
-{
-public:
- ImageItem()
- : colored(false)
- {
- grabGesture(Qt::DoubleTapGesture);
- }
-
- QRectF boundingRect() const
- {
- return pixmap.isNull() ? QRectF(0, 0, 100, 100)
- : QRectF(QPointF(0,0), QSizeF(pixmap.size()));
- }
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*)
- {
- if (pixmap.isNull()) {
- painter->setBrush(QBrush( colored ? Qt::green : Qt::white));
- painter->drawRect(0, 0, 100, 100);
- painter->drawLine(0, 0, 100, 100);
- painter->drawLine(0, 100, 100, 0);
- return;
- }
- painter->drawPixmap(0, 0, pixmap);
- }
-
- bool sceneEvent(QEvent *event)
- {
- if (event->type() == QEvent::GraphicsSceneGesture) {
- QGraphicsSceneGestureEvent *gestureEvent = static_cast<QGraphicsSceneGestureEvent*>(event);
- if (gestureEvent->gesture(Qt::DoubleTapGesture)) {
- event->accept();
- colored = !colored;
- update();
- return true;
- } else {
- qWarning("Item received unknown gesture");
- }
- }
- return QGraphicsItem::sceneEvent(event);
- }
-
-private:
- QPixmap pixmap;
- bool colored;
-};
-
-class MainWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- MainWidget(QWidget *parent = 0)
- : QWidget(parent)
- {
- QVBoxLayout *l = new QVBoxLayout(this);
- view = new PannableGraphicsView;
- l->addWidget(view);
- scene = new QGraphicsScene(0, 0, 1024, 768, view);
- view->setScene(scene);
-
- ImageItem *item = new ImageItem;
- scene->addItem(item);
- item->setPos(scene->width()/3, scene->height()/3);
- }
-
-signals:
-public slots:
-private:
- QGraphicsView *view;
- QGraphicsScene *scene;
-};
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWidget w;
- w.show();
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imageviewer/imagewidget.cpp
index a4f3c9a..717bb09 100644
--- a/examples/gestures/imageviewer/imagewidget.cpp
+++ b/examples/gestures/imageviewer/imagewidget.cpp
@@ -46,6 +46,7 @@
ImageWidget::ImageWidget(QWidget *parent)
: QWidget(parent)
{
+ setAttribute(Qt::WA_AcceptTouchEvents);
setAttribute(Qt::WA_PaintOnScreen);
setAttribute(Qt::WA_OpaquePaintEvent);
setAttribute(Qt::WA_NoSystemBackground);
@@ -61,9 +62,11 @@ ImageWidget::ImageWidget(QWidget *parent)
horizontalOffset = 0;
verticalOffset = 0;
- grabGesture(Qt::DoubleTapGesture);
- grabGesture(Qt::PanGesture);
- grabGesture(Qt::TapAndHoldGesture);
+ panGesture = new QPanGesture(this);
+ connect(panGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered()));
+
+ tapAndHoldGesture = new QTapAndHoldGesture(this);
+ connect(tapAndHoldGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered()));
}
void ImageWidget::paintEvent(QPaintEvent*)
@@ -131,30 +134,33 @@ void ImageWidget::paintEvent(QPaintEvent*)
p.restore();
}
-bool ImageWidget::event(QEvent *event)
+void ImageWidget::mousePressEvent(QMouseEvent *event)
{
- if (event->type() == QEvent::Gesture) {
- gestureEvent(static_cast<QGestureEvent*>(event));
- return true;
- }
- return QWidget::event(event);
+ touchFeedback.tapped = true;
+ touchFeedback.position = event->pos();
+}
+
+void ImageWidget::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ touchFeedback.doubleTapped = true;
+ const QPoint p = event->pos();
+ touchFeedback.position = p;
+ horizontalOffset = p.x() - currentImage.width()*1.0*p.x()/width();
+ verticalOffset = p.y() - currentImage.height()*1.0*p.y()/height();
+ setZoomedIn(!zoomedIn);
+ zoomed = rotated = false;
+ updateImage();
+
+ feedbackFadeOutTimer.start(500, this);
}
-void ImageWidget::gestureEvent(QGestureEvent *event)
+void ImageWidget::gestureTriggered()
{
+ touchFeedback.tapped = false;
touchFeedback.doubleTapped = false;
- Q_ASSERT(event);
- if (event->contains(Qt::TapGesture)) {
- //
- } else if (const QGesture *g = event->gesture(Qt::DoubleTapGesture)) {
- touchFeedback.doubleTapped = true;
- horizontalOffset = g->hotSpot().x() - currentImage.width()*1.0*g->hotSpot().x()/width();
- verticalOffset = g->hotSpot().y() - currentImage.height()*1.0*g->hotSpot().y()/height();
- setZoomedIn(!zoomedIn);
- zoomed = rotated = false;
- updateImage();
- } else if (const QGesture *g = event->gesture(Qt::PanGesture)) {
+ QGesture *g = qobject_cast<QGesture*>(sender());
+ if (sender() == panGesture) {
if (zoomedIn) {
// usual panning
#ifndef QT_NO_CURSOR
@@ -170,24 +176,22 @@ void ImageWidget::gestureEvent(QGestureEvent *event)
update();
} else {
// only slide gesture should be accepted
- const QPanningGesture *pg = static_cast<const QPanningGesture*>(g);
- if (pg->direction() != pg->lastDirection()) {
- // ###: event->cancel();
- }
+ const QPanGesture *pg = static_cast<const QPanGesture*>(g);
if (g->state() == Qt::GestureFinished) {
touchFeedback.sliding = false;
zoomed = rotated = false;
- if (pg->direction() == Qt::RightDirection) {
+ if (pg->totalOffset().width() > 0) {
qDebug() << "slide right";
goNextImage();
- } else if (pg->direction() == Qt::LeftDirection) {
+ } else {
qDebug() << "slide left";
goPrevImage();
}
updateImage();
}
}
- } else if (const QGesture *g = event->gesture(Qt::TapAndHoldGesture)) {
+ feedbackFadeOutTimer.start(500, this);
+ } else if (sender() == tapAndHoldGesture) {
if (g->state() == Qt::GestureFinished) {
qDebug() << "tap and hold detected";
touchFeedback.reset();
@@ -197,13 +201,20 @@ void ImageWidget::gestureEvent(QGestureEvent *event)
menu.addAction("Action 1");
menu.addAction("Action 2");
menu.addAction("Action 3");
- menu.exec(mapToGlobal(g->hotSpot()));
+ menu.exec(mapToGlobal(g->pos()));
}
- } else {
- qDebug() << "unknown gesture";
+ feedbackFadeOutTimer.start(500, this);
}
- feedbackFadeOutTimer.start(500, this);
- event->accept();
+}
+
+void ImageWidget::gestureFinished()
+{
+ qDebug() << "gesture finished" << sender();
+}
+
+void ImageWidget::gestureCancelled()
+{
+ qDebug() << "gesture cancelled" << sender();
}
void ImageWidget::resizeEvent(QResizeEvent*)
@@ -345,3 +356,5 @@ void ImageWidget::timerEvent(QTimerEvent *event)
}
update();
}
+
+#include "moc_imagewidget.cpp"
diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imageviewer/imagewidget.h
index 7ec73a7..e12634d 100644
--- a/examples/gestures/imageviewer/imagewidget.h
+++ b/examples/gestures/imageviewer/imagewidget.h
@@ -50,17 +50,24 @@
class ImageWidget : public QWidget
{
+ Q_OBJECT
+
public:
ImageWidget(QWidget *parent = 0);
void openDirectory(const QString &path);
protected:
- bool event(QEvent *event);
void paintEvent(QPaintEvent*);
- void gestureEvent(QGestureEvent *event);
void resizeEvent(QResizeEvent*);
void timerEvent(QTimerEvent*);
+ void mousePressEvent(QMouseEvent*);
+ void mouseDoubleClickEvent(QMouseEvent*);
+
+private slots:
+ void gestureTriggered();
+ void gestureFinished();
+ void gestureCancelled();
private:
void updateImage();
@@ -71,6 +78,9 @@ private:
void goPrevImage();
void goToImage(int index);
+ QPanGesture *panGesture;
+ QTapAndHoldGesture *tapAndHoldGesture;
+
QString path;
QStringList files;
int position;
diff --git a/examples/gestures/pannablewebview/main.cpp b/examples/gestures/pannablewebview/main.cpp
deleted file mode 100644
index 89c1fce..0000000
--- a/examples/gestures/pannablewebview/main.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <QtWebKit>
-
-class PannableWebView : public QWebView
-{
-public:
- PannableWebView(QWidget *parent = 0)
- : QWebView(parent)
- {
-#if 0
- QPushButton *btn = new QPushButton("Some test button", this);
- btn->resize(300, 200);
- btn->move(40, 300);
-#endif
- grabGesture(Qt::PanGesture);
- }
-protected:
- bool event(QEvent *event)
- {
- if (event->type() == QEvent::Gesture)
- {
- QGestureEvent *ev = static_cast<QGestureEvent*>(event);
- if (const QGesture *g = ev->gesture(Qt::PanGesture)) {
- if (QWebFrame *frame = page()->mainFrame()) {
- QPoint offset = g->pos() - g->lastPos();
- frame->setScrollPosition(frame->scrollPosition() - offset);
- }
- event->accept();
- }
- return true;
- }
- return QWebView::event(event);
- }
-};
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QGraphicsScene scene;
- QGraphicsView w(&scene);
-
- QWebView *wv = new PannableWebView;
- wv->resize(480, 800);
- wv->setUrl(QUrl("http://www.trolltech.com"));
- scene.addWidget(wv);
- w.show();
-
- return app.exec();
-}
diff --git a/examples/gestures/pannablewebview/pannablewebview.pro b/examples/gestures/pannablewebview/pannablewebview.pro
deleted file mode 100644
index 07d8f91..0000000
--- a/examples/gestures/pannablewebview/pannablewebview.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-SOURCES += \
- main.cpp
-
-QT += webkit
diff --git a/examples/mainwindows/application/main.cpp b/examples/mainwindows/application/main.cpp
index f83e709..2fe6d5f 100644
--- a/examples/mainwindows/application/main.cpp
+++ b/examples/mainwindows/application/main.cpp
@@ -49,6 +49,8 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(application);
QApplication app(argc, argv);
+ app.setOrganizationName("Trolltech");
+ app.setApplicationName("Application Example");
MainWindow mainWin;
mainWin.show();
return app.exec();
diff --git a/examples/mainwindows/application/mainwindow.cpp b/examples/mainwindows/application/mainwindow.cpp
index 68c7287..43dfe14 100644
--- a/examples/mainwindows/application/mainwindow.cpp
+++ b/examples/mainwindows/application/mainwindow.cpp
@@ -377,13 +377,10 @@ void MainWindow::setCurrentFile(const QString &fileName)
textEdit->document()->setModified(false);
setWindowModified(false);
- QString shownName;
+ QString shownName = curFile;
if (curFile.isEmpty())
shownName = "untitled.txt";
- else
- shownName = strippedName(curFile);
-
- setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("Application")));
+ setWindowFilePath(shownName);
}
//! [47]
diff --git a/examples/mainwindows/mdi/mainwindow.cpp b/examples/mainwindows/mdi/mainwindow.cpp
index 3cb54f1..9ef2cae 100644
--- a/examples/mainwindows/mdi/mainwindow.cpp
+++ b/examples/mainwindows/mdi/mainwindow.cpp
@@ -259,7 +259,6 @@ void MainWindow::createActions()
connect(pasteAct, SIGNAL(triggered()), this, SLOT(paste()));
closeAct = new QAction(tr("Cl&ose"), this);
- closeAct->setShortcut(tr("Ctrl+F4"));
closeAct->setStatusTip(tr("Close the active window"));
connect(closeAct, SIGNAL(triggered()),
mdiArea, SLOT(closeActiveSubWindow()));
diff --git a/examples/mainwindows/recentfiles/main.cpp b/examples/mainwindows/recentfiles/main.cpp
index 5417429..1dd3c1b 100644
--- a/examples/mainwindows/recentfiles/main.cpp
+++ b/examples/mainwindows/recentfiles/main.cpp
@@ -46,6 +46,8 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
+ app.setOrganizationName("Trolltech");
+ app.setApplicationName("Recent Files Example");
MainWindow *mainWin = new MainWindow;
mainWin->show();
return app.exec();
diff --git a/examples/mainwindows/recentfiles/mainwindow.cpp b/examples/mainwindows/recentfiles/mainwindow.cpp
index 1671f53..53d0d0e 100644
--- a/examples/mainwindows/recentfiles/mainwindow.cpp
+++ b/examples/mainwindows/recentfiles/mainwindow.cpp
@@ -54,7 +54,7 @@ MainWindow::MainWindow()
createMenus();
(void)statusBar();
- setWindowTitle(tr("Recent Files"));
+ setWindowFilePath(QString());
resize(400, 300);
}
@@ -209,13 +209,9 @@ void MainWindow::saveFile(const QString &fileName)
void MainWindow::setCurrentFile(const QString &fileName)
{
curFile = fileName;
- if (curFile.isEmpty())
- setWindowTitle(tr("Recent Files"));
- else
- setWindowTitle(tr("%1 - %2").arg(strippedName(curFile))
- .arg(tr("Recent Files")));
+ setWindowFilePath(curFile);
- QSettings settings("Trolltech", "Recent Files Example");
+ QSettings settings;
QStringList files = settings.value("recentFileList").toStringList();
files.removeAll(fileName);
files.prepend(fileName);
@@ -233,7 +229,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
void MainWindow::updateRecentFileActions()
{
- QSettings settings("Trolltech", "Recent Files Example");
+ QSettings settings;
QStringList files = settings.value("recentFileList").toStringList();
int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
diff --git a/examples/mainwindows/sdi/main.cpp b/examples/mainwindows/sdi/main.cpp
index a7e20d8..055d761 100644
--- a/examples/mainwindows/sdi/main.cpp
+++ b/examples/mainwindows/sdi/main.cpp
@@ -47,6 +47,8 @@ int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(sdi);
QApplication app(argc, argv);
+ app.setApplicationName("SDI Example");
+ app.setOrganizationName("Trolltech");
MainWindow *mainWin = new MainWindow;
mainWin->show();
return app.exec();
diff --git a/examples/mainwindows/sdi/mainwindow.cpp b/examples/mainwindows/sdi/mainwindow.cpp
index 8710105..1e7f2c0 100644
--- a/examples/mainwindows/sdi/mainwindow.cpp
+++ b/examples/mainwindows/sdi/mainwindow.cpp
@@ -266,7 +266,7 @@ void MainWindow::createStatusBar()
void MainWindow::readSettings()
{
- QSettings settings("Trolltech", "SDI Example");
+ QSettings settings;
QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
QSize size = settings.value("size", QSize(400, 400)).toSize();
move(pos);
@@ -275,7 +275,7 @@ void MainWindow::readSettings()
void MainWindow::writeSettings()
{
- QSettings settings("Trolltech", "SDI Example");
+ QSettings settings;
settings.setValue("pos", pos());
settings.setValue("size", size());
}
@@ -352,9 +352,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
textEdit->document()->setModified(false);
setWindowModified(false);
-
- setWindowTitle(tr("%1[*] - %2").arg(strippedName(curFile))
- .arg(tr("SDI")));
+ setWindowFilePath(curFile);
}
QString MainWindow::strippedName(const QString &fullFileName)
diff --git a/examples/opengl/hellogl_es2/glwidget.cpp b/examples/opengl/hellogl_es2/glwidget.cpp
index 6b08662..bb07b22 100644
--- a/examples/opengl/hellogl_es2/glwidget.cpp
+++ b/examples/opengl/hellogl_es2/glwidget.cpp
@@ -41,6 +41,7 @@
#include "glwidget.h"
#include <QPainter>
+#include <QPaintEngine>
#include <math.h>
#include "bubble.h"
@@ -265,6 +266,8 @@ void GLWidget::paintGL()
QPainter painter;
painter.begin(this);
+ painter.paintEngine()->syncState();
+
glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
diff --git a/examples/openvg/README b/examples/openvg/README
new file mode 100644
index 0000000..5e385ea
--- /dev/null
+++ b/examples/openvg/README
@@ -0,0 +1,40 @@
+Qt provides support for integration with OpenVG implementations on
+platforms with appropriate hardware acceleration.
+
+These examples demonstrate the basic techniques used to take advantage of
+OpenVG in Qt applications. In particular, the "star" example shows how
+to mix QPainter and OpenVG calls in the same paint event.
+
+The example launcher provided with Qt can be used to explore each of the
+examples in this directory.
+
+Documentation for these examples can be found via the Tutorial and Examples
+link in the main Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/openvg/openvg.pro b/examples/openvg/openvg.pro
new file mode 100644
index 0000000..d76a389
--- /dev/null
+++ b/examples/openvg/openvg.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+SUBDIRS = star
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/openvg
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS openvg.pro README
+sources.path = $$[QT_INSTALL_EXAMPLES]/openvg
+INSTALLS += target sources
diff --git a/examples/openvg/star/main.cpp b/examples/openvg/star/main.cpp
new file mode 100644
index 0000000..eec2186
--- /dev/null
+++ b/examples/openvg/star/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include "starwidget.h"
+
+int main(int argc, char *argv[])
+{
+#ifdef Q_OS_SYMBIAN
+ QApplication::setGraphicsSystem("openvg");
+#endif
+ QApplication app(argc, argv);
+ StarWidget mw;
+ mw.show();
+ return app.exec();
+}
diff --git a/examples/openvg/star/star.pro b/examples/openvg/star/star.pro
new file mode 100644
index 0000000..90c236d
--- /dev/null
+++ b/examples/openvg/star/star.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+TARGET = star
+CONFIG += qt debug warn_on
+QT += openvg
+SOURCES = starwidget.cpp main.cpp
+HEADERS = starwidget.h
diff --git a/examples/openvg/star/starwidget.cpp b/examples/openvg/star/starwidget.cpp
new file mode 100644
index 0000000..9d2a255
--- /dev/null
+++ b/examples/openvg/star/starwidget.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "starwidget.h"
+
+StarWidget::StarWidget(QWidget *parent)
+ : QWidget(parent)
+ , path(VG_INVALID_HANDLE)
+ , pen(Qt::red, 4.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)
+ , brush(Qt::yellow)
+{
+ setMinimumSize(220, 250);
+ setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+}
+
+static VGubyte const starSegments[] = {
+ VG_MOVE_TO_ABS,
+ VG_LINE_TO_REL,
+ VG_LINE_TO_REL,
+ VG_LINE_TO_REL,
+ VG_LINE_TO_REL,
+ VG_CLOSE_PATH
+};
+static VGfloat const starCoords[] = {
+ 110, 35,
+ 50, 160,
+ -130, -100,
+ 160, 0,
+ -130, 100
+};
+
+void StarWidget::paintEvent(QPaintEvent *)
+{
+ QPainter painter;
+ painter.begin(this);
+
+ // Make sure that we are using the OpenVG paint engine.
+ if (painter.paintEngine()->type() != QPaintEngine::OpenVG) {
+#ifdef Q_WS_QWS
+ qWarning("Not using OpenVG: use the '-display' option to specify an OpenVG driver");
+#else
+ qWarning("Not using OpenVG: specify '-graphicssystem OpenVG'");
+#endif
+ return;
+ }
+
+ // Select a pen and a brush for drawing the star.
+ painter.setPen(pen);
+ painter.setBrush(brush);
+
+ // We want the star border to be anti-aliased.
+ painter.setRenderHints(QPainter::Antialiasing);
+
+ // Flush the state changes to the OpenVG implementation
+ // and prepare to perform raw OpenVG calls.
+ painter.paintEngine()->syncState();
+
+ // Cache the path if we haven't already.
+ if (path == VG_INVALID_HANDLE) {
+ path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ 6, // segmentCapacityHint
+ 10, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
+ vgAppendPathData(path, sizeof(starSegments), starSegments, starCoords);
+ }
+
+ // Draw the star directly using the OpenVG API.
+ vgDrawPath(path, VG_FILL_PATH | VG_STROKE_PATH);
+
+ // Restore normal QPainter operations.
+ painter.paintEngine()->syncState();
+
+ painter.end();
+}
diff --git a/examples/gestures/browser/edittableview.h b/examples/openvg/star/starwidget.h
index fb033ce..883f8c4 100644
--- a/examples/gestures/browser/edittableview.h
+++ b/examples/openvg/star/starwidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the QtOpenGL module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,23 +39,28 @@
**
****************************************************************************/
-#ifndef EDITTABLEVIEW_H
-#define EDITTABLEVIEW_H
+#ifndef STARWIDGET_H
+#define STARWIDGET_H
-#include <QtGui/QTableView>
+#include <QWidget>
+#include <QPainter>
+#include <QPaintEngine>
+#include "qvg.h"
-class EditTableView : public QTableView
+class StarWidget : public QWidget
{
Q_OBJECT
-
public:
- EditTableView(QWidget *parent = 0);
- void keyPressEvent(QKeyEvent *event);
+ StarWidget(QWidget *parent = 0);
+ ~StarWidget() {}
-public slots:
- void removeOne();
- void removeAll();
-};
+protected:
+ void paintEvent(QPaintEvent *);
-#endif // EDITTABLEVIEW_H
+private:
+ VGPath path;
+ QPen pen;
+ QBrush brush;
+};
+#endif
diff --git a/examples/statemachine/factorial/main.cpp b/examples/statemachine/factorial/main.cpp
index 18a9521..5050347 100644
--- a/examples/statemachine/factorial/main.cpp
+++ b/examples/statemachine/factorial/main.cpp
@@ -151,14 +151,14 @@ int main(int argc, char **argv)
//! [3]
//! [4]
- QState *compute = new QState(machine.rootState());
+ QState *compute = new QState(&machine);
compute->assignProperty(&factorial, "fac", 1);
compute->assignProperty(&factorial, "x", 6);
compute->addTransition(new FactorialLoopTransition(&factorial));
//! [4]
//! [5]
- QFinalState *done = new QFinalState(machine.rootState());
+ QFinalState *done = new QFinalState(&machine);
FactorialDoneTransition *doneTransition = new FactorialDoneTransition(&factorial);
doneTransition->setTargetState(done);
compute->addTransition(doneTransition);
diff --git a/examples/statemachine/tankgame/mainwindow.cpp b/examples/statemachine/tankgame/mainwindow.cpp
index 68a8d68..596cdfe 100644
--- a/examples/statemachine/tankgame/mainwindow.cpp
+++ b/examples/statemachine/tankgame/mainwindow.cpp
@@ -160,7 +160,7 @@ void MainWindow::init()
connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
m_machine = new QStateMachine(this);
- QState *stoppedState = new QState(m_machine->rootState());
+ QState *stoppedState = new QState(m_machine);
stoppedState->setObjectName("stoppedState");
stoppedState->assignProperty(runGameAction, "enabled", true);
stoppedState->assignProperty(stopGameAction, "enabled", false);
@@ -188,14 +188,14 @@ void MainWindow::init()
stoppedState->setInitialState(hs);
//! [0]
- m_runningState = new QState(QState::ParallelStates, m_machine->rootState());
+ m_runningState = new QState(QState::ParallelStates, m_machine);
//! [0]
m_runningState->setObjectName("runningState");
m_runningState->assignProperty(addTankAction, "enabled", false);
m_runningState->assignProperty(runGameAction, "enabled", false);
m_runningState->assignProperty(stopGameAction, "enabled", true);
- QState *gameOverState = new QState(m_machine->rootState());
+ QState *gameOverState = new QState(m_machine);
gameOverState->setObjectName("gameOverState");
gameOverState->assignProperty(stopGameAction, "enabled", false);
connect(gameOverState, SIGNAL(entered()), this, SLOT(gameOver()));
diff --git a/examples/tools/codecs/encodedfiles/.gitattributes b/examples/tools/codecs/encodedfiles/.gitattributes
deleted file mode 100644
index 996aab2..0000000
--- a/examples/tools/codecs/encodedfiles/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-iso-8859-15.txt -crlf
-iso-8859-1.txt -crlf
diff --git a/examples/tools/codecs/encodedfiles/iso-8859-1.txt b/examples/tools/codecs/encodedfiles/iso-8859-1.txt
index 4a7ebe3..d7fcaca 100644
--- a/examples/tools/codecs/encodedfiles/iso-8859-1.txt
+++ b/examples/tools/codecs/encodedfiles/iso-8859-1.txt
@@ -1,6 +1,6 @@
-Paulo Coelho: O Gênio e as Rosas
-Anna Hallström, Urban Östberg: Svår svenska
-Darrell Huff: How to Lie with Statistics
-Franz Kafka: Das Schloß
-Walter Moers: Die 13½ Leben des Käpt'n Blaubär
-Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige
+Paulo Coelho: O Gênio e as Rosas
+Anna Hallström, Urban Östberg: Svår svenska
+Darrell Huff: How to Lie with Statistics
+Franz Kafka: Das Schloß
+Walter Moers: Die 13½ Leben des Käpt'n Blaubär
+Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige
diff --git a/examples/tools/codecs/encodedfiles/iso-8859-15.txt b/examples/tools/codecs/encodedfiles/iso-8859-15.txt
index cd43ea3..be2d83c 100644
--- a/examples/tools/codecs/encodedfiles/iso-8859-15.txt
+++ b/examples/tools/codecs/encodedfiles/iso-8859-15.txt
@@ -1,8 +1,8 @@
-Paulo Coelho: O Gênio e as Rosas
-Jean-Pierre Coffe: À table en famille avec 15 ¤ par jour
-Anna Hallström, Urban Östberg: Svår svenska
-Darrell Huff: How to Lie with Statistics
-Franz Kafka: Das Schloß
-Helena Lehecková: T¨ekkiä suomalaisille
-Arthur Rimbaud: ¼uvres complètes
-Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige
+Paulo Coelho: O Gênio e as Rosas
+Jean-Pierre Coffe: À table en famille avec 15 ¤ par jour
+Anna Hallström, Urban Östberg: Svår svenska
+Darrell Huff: How to Lie with Statistics
+Franz Kafka: Das Schloß
+Helena Lehecková: T¨ekkiä suomalaisille
+Arthur Rimbaud: ¼uvres complètes
+Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige
diff --git a/examples/tools/completer/mainwindow.cpp b/examples/tools/completer/mainwindow.cpp
index 8ea1c39..c98482a 100644
--- a/examples/tools/completer/mainwindow.cpp
+++ b/examples/tools/completer/mainwindow.cpp
@@ -78,6 +78,12 @@ MainWindow::MainWindow(QWidget *parent)
//! [0]
//! [1]
+ QLabel *maxVisibleLabel = new QLabel;
+ maxVisibleLabel->setText(tr("Max Visible Items"));
+ maxVisibleSpinBox = new QSpinBox;
+ maxVisibleSpinBox->setRange(3,25);
+ maxVisibleSpinBox->setValue(10);
+
wrapCheckBox = new QCheckBox;
wrapCheckBox->setText(tr("Wrap around completions"));
wrapCheckBox->setChecked(true);
@@ -90,6 +96,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(modelCombo, SIGNAL(activated(int)), this, SLOT(changeModel()));
connect(modeCombo, SIGNAL(activated(int)), this, SLOT(changeMode(int)));
connect(caseCombo, SIGNAL(activated(int)), this, SLOT(changeCase(int)));
+ connect(maxVisibleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeMaxVisible(int)));
//! [2]
//! [3]
@@ -99,9 +106,10 @@ MainWindow::MainWindow(QWidget *parent)
layout->addWidget(modelLabel, 0, 0); layout->addWidget(modelCombo, 0, 1);
layout->addWidget(modeLabel, 1, 0); layout->addWidget(modeCombo, 1, 1);
layout->addWidget(caseLabel, 2, 0); layout->addWidget(caseCombo, 2, 1);
- layout->addWidget(wrapCheckBox, 3, 0);
- layout->addWidget(contentsLabel, 4, 0, 1, 2);
- layout->addWidget(lineEdit, 5, 0, 1, 2);
+ layout->addWidget(maxVisibleLabel, 3, 0); layout->addWidget(maxVisibleSpinBox, 3, 1);
+ layout->addWidget(wrapCheckBox, 4, 0);
+ layout->addWidget(contentsLabel, 5, 0, 1, 2);
+ layout->addWidget(lineEdit, 6, 0, 1, 2);
centralWidget->setLayout(layout);
setCentralWidget(centralWidget);
@@ -205,6 +213,7 @@ void MainWindow::changeModel()
{
delete completer;
completer = new QCompleter(this);
+ completer->setMaxVisibleItems(maxVisibleSpinBox->value());
switch (modelCombo->currentIndex()) {
default:
@@ -256,9 +265,16 @@ void MainWindow::changeModel()
//! [14]
//! [15]
+void MainWindow::changeMaxVisible(int max)
+{
+ completer->setMaxVisibleItems(max);
+}
+//! [15]
+
+//! [16]
void MainWindow::about()
{
QMessageBox::about(this, tr("About"), tr("This example demonstrates the "
"different features of the QCompleter class."));
}
-//! [15]
+//! [16]
diff --git a/examples/tools/completer/mainwindow.h b/examples/tools/completer/mainwindow.h
index f6c962b..30b8d26 100644
--- a/examples/tools/completer/mainwindow.h
+++ b/examples/tools/completer/mainwindow.h
@@ -52,6 +52,7 @@ class QLabel;
class QLineEdit;
class QProgressBar;
class QCheckBox;
+class QSpinBox;
QT_END_NAMESPACE
//! [0]
@@ -67,6 +68,7 @@ private slots:
void changeCase(int);
void changeMode(int);
void changeModel();
+ void changeMaxVisible(int);
//! [0]
//! [1]
@@ -77,6 +79,7 @@ private:
QComboBox *caseCombo;
QComboBox *modeCombo;
QComboBox *modelCombo;
+ QSpinBox *maxVisibleSpinBox;
QCheckBox *wrapCheckBox;
QCompleter *completer;
QLabel *contentsLabel;
diff --git a/examples/tools/regexp/regexpdialog.cpp b/examples/tools/regexp/regexpdialog.cpp
index 42cb617..7aab1be 100644
--- a/examples/tools/regexp/regexpdialog.cpp
+++ b/examples/tools/regexp/regexpdialog.cpp
@@ -69,6 +69,7 @@ RegExpDialog::RegExpDialog(QWidget *parent)
syntaxComboBox->addItem(tr("Regular expression v2"), QRegExp::RegExp2);
syntaxComboBox->addItem(tr("Wildcard"), QRegExp::Wildcard);
syntaxComboBox->addItem(tr("Fixed string"), QRegExp::FixedString);
+ syntaxComboBox->addItem(tr("W3C Xml Schema 1.1"), QRegExp::W3CXmlSchema11);
syntaxLabel = new QLabel(tr("&Pattern Syntax:"));
syntaxLabel->setBuddy(syntaxComboBox);
diff --git a/examples/uitools/textfinder/forms/input.txt b/examples/uitools/textfinder/forms/input.txt
index fae542f..29dfe5d 100644
--- a/examples/uitools/textfinder/forms/input.txt
+++ b/examples/uitools/textfinder/forms/input.txt
@@ -1,5 +1,5 @@
These forms are processed at run-time to produce dynamically-generated user interfaces.
-In order to generate a form at run-time, a resource file containing a .ui file is needed.
+In order to generate a form at run-time, a resource file containing a UI file is needed.
Applications that use the form handling classes need to be configured to be built against
the QtUiTools module. This is done by including the following declaration in a qmake project
file to ensure that the application is compiled and linked appropriately. A form loader object,
diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp
index 4e8150e..3e9ae38 100644
--- a/examples/widgets/tablet/tabletcanvas.cpp
+++ b/examples/widgets/tablet/tabletcanvas.cpp
@@ -137,11 +137,6 @@ void TabletCanvas::paintImage(QPainter &painter, QTabletEvent *event)
QPoint brushAdjust(10, 10);
switch (myTabletDevice) {
- case QTabletEvent::Stylus:
- painter.setBrush(myBrush);
- painter.setPen(myPen);
- painter.drawLine(polyLine[1], event->pos());
- break;
case QTabletEvent::Airbrush:
myBrush.setColor(myColor);
myBrush.setStyle(brushPattern(event->pressure()));
@@ -156,10 +151,32 @@ void TabletCanvas::paintImage(QPainter &painter, QTabletEvent *event)
case QTabletEvent::Puck:
case QTabletEvent::FourDMouse:
case QTabletEvent::RotationStylus:
- qWarning("This input device is not supported by the example.");
+ {
+ const QString error(tr("This input device is not supported by the example."));
+#ifndef QT_NO_STATUSTIP
+ QStatusTipEvent status(error);
+ QApplication::sendEvent(this, &status);
+#else
+ qWarning() << error;
+#endif
+ }
break;
default:
- qWarning("Unknown tablet device.");
+ {
+ const QString error(tr("Unknown tablet device - treating as stylus"));
+#ifndef QT_NO_STATUSTIP
+ QStatusTipEvent status(error);
+ QApplication::sendEvent(this, &status);
+#else
+ qWarning() << error;
+#endif
+ }
+ // FALL-THROUGH
+ case QTabletEvent::Stylus:
+ painter.setBrush(myBrush);
+ painter.setPen(myPen);
+ painter.drawLine(polyLine[1], event->pos());
+ break;
}
}
//! [5]
@@ -250,7 +267,7 @@ void TabletCanvas::updateBrush(QTabletEvent *event)
}
//! [11]
-void TabletCanvas::resizeEvent(QResizeEvent *event)
+void TabletCanvas::resizeEvent(QResizeEvent *)
{
initImage();
polyLine[0] = polyLine[1] = polyLine[2] = QPoint();
diff --git a/examples/xmlpatterns/schema/files/contact.xsd b/examples/xmlpatterns/schema/files/contact.xsd
new file mode 100644
index 0000000..3e1b570
--- /dev/null
+++ b/examples/xmlpatterns/schema/files/contact.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="contact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="givenName" type="xsd:string"/>
+ <xsd:element name="familyName" type="xsd:string"/>
+ <xsd:element name="birthdate" type="xsd:date" minOccurs="0"/>
+ <xsd:element name="homeAddress" type="address"/>
+ <xsd:element name="workAddress" type="address" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="address">
+ <xsd:sequence>
+ <xsd:element name="street" type="xsd:string"/>
+ <xsd:element name="zipCode" type="xsd:string"/>
+ <xsd:element name="city" type="xsd:string"/>
+ <xsd:element name="country" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/examples/xmlpatterns/schema/files/invalid_contact.xml b/examples/xmlpatterns/schema/files/invalid_contact.xml
new file mode 100644
index 0000000..42f1edd
--- /dev/null
+++ b/examples/xmlpatterns/schema/files/invalid_contact.xml
@@ -0,0 +1,11 @@
+<contact>
+ <givenName>John</givenName>
+ <familyName>Doe</familyName>
+ <title>Prof.</title>
+ <workAddress>
+ <street>Sandakerveien 116</street>
+ <zipCode>N-0550</zipCode>
+ <city>Oslo</city>
+ <country>Norway</country>
+ </workAddress>
+</contact>
diff --git a/examples/xmlpatterns/schema/files/invalid_order.xml b/examples/xmlpatterns/schema/files/invalid_order.xml
new file mode 100644
index 0000000..8ffc5fd
--- /dev/null
+++ b/examples/xmlpatterns/schema/files/invalid_order.xml
@@ -0,0 +1,13 @@
+<order>
+ <customerId>234219</customerId>
+ <article>
+ <articleId>21692</articleId>
+ <count>3</count>
+ </article>
+ <article>
+ <articleId>24749</articleId>
+ <count>9</count>
+ </article>
+ <deliveryDate>2009-01-23</deliveryDate>
+ <payed>yes</payed>
+</order>
diff --git a/examples/xmlpatterns/schema/files/invalid_recipe.xml b/examples/xmlpatterns/schema/files/invalid_recipe.xml
new file mode 100644
index 0000000..4d75af6
--- /dev/null
+++ b/examples/xmlpatterns/schema/files/invalid_recipe.xml
@@ -0,0 +1,14 @@
+<recipe>
+ <title>Cheese on Toast</title>
+ <ingredient name="Bread" quantity="2" unit="slices"/>
+ <ingredient name="Cheese" quantity="2" unit="slices"/>
+ <time quantity="3" unit="days"/>
+ <method>
+ <step>1. Slice the bread and cheese.</step>
+ <step>2. Grill one side of each slice of bread.</step>
+ <step>3. Turn over the bread and place a slice of cheese on each piece.</step>
+ <step>4. Grill until the cheese has started to melt.</step>
+ <step>5. Serve and enjoy!</step>
+ </method>
+ <comment>Tell your friends about it!</comment>
+</recipe>
diff --git a/examples/xmlpatterns/schema/files/order.xsd b/examples/xmlpatterns/schema/files/order.xsd
new file mode 100644
index 0000000..405cafe
--- /dev/null
+++ b/examples/xmlpatterns/schema/files/order.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="order">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerId" type="xsd:positiveInteger"/>
+ <xsd:element name="article" type="articleType" maxOccurs="unbounded"/>
+ <xsd:element name="deliveryDate" type="xsd:date"/>
+ <xsd:element name="payed" type="xsd:boolean"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="articleType">
+ <xsd:sequence>
+ <xsd:element name="articleId" type="xsd:positiveInteger"/>
+ <xsd:element name="count" type="xsd:positiveInteger"/>
+ <xsd:element name="comment" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/examples/xmlpatterns/schema/files/recipe.xsd b/examples/xmlpatterns/schema/files/recipe.xsd
new file mode 100644
index 0000000..bbbafd9
--- /dev/null
+++ b/examples/xmlpatterns/schema/files/recipe.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="recipe">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string"/>
+ <xsd:element name="ingredient" type="ingredientType" maxOccurs="unbounded"/>
+ <xsd:element name="time" type="timeType"/>
+ <xsd:element name="method">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="step" type="xsd:string" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="ingredientType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="quantity" type="xsd:positiveInteger"/>
+ <xsd:attribute name="unit" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="timeType">
+ <xsd:attribute name="quantity" type="xsd:positiveInteger"/>
+ <xsd:attribute name="unit">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="seconds"/>
+ <xsd:enumeration value="minutes"/>
+ <xsd:enumeration value="hours"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/examples/xmlpatterns/schema/files/valid_contact.xml b/examples/xmlpatterns/schema/files/valid_contact.xml
new file mode 100644
index 0000000..53c04d4
--- /dev/null
+++ b/examples/xmlpatterns/schema/files/valid_contact.xml
@@ -0,0 +1,11 @@
+<contact>
+ <givenName>John</givenName>
+ <familyName>Doe</familyName>
+ <birthdate>1977-12-25</birthdate>
+ <homeAddress>
+ <street>Sandakerveien 116</street>
+ <zipCode>N-0550</zipCode>
+ <city>Oslo</city>
+ <country>Norway</country>
+ </homeAddress>
+</contact>
diff --git a/examples/xmlpatterns/schema/files/valid_order.xml b/examples/xmlpatterns/schema/files/valid_order.xml
new file mode 100644
index 0000000..f83c36c
--- /dev/null
+++ b/examples/xmlpatterns/schema/files/valid_order.xml
@@ -0,0 +1,18 @@
+<order>
+ <customerId>194223</customerId>
+ <article>
+ <articleId>22242</articleId>
+ <count>5</count>
+ </article>
+ <article>
+ <articleId>32372</articleId>
+ <count>12</count>
+ <comment>without stripes</comment>
+ </article>
+ <article>
+ <articleId>23649</articleId>
+ <count>2</count>
+ </article>
+ <deliveryDate>2009-01-23</deliveryDate>
+ <payed>true</payed>
+</order>
diff --git a/examples/xmlpatterns/schema/files/valid_recipe.xml b/examples/xmlpatterns/schema/files/valid_recipe.xml
new file mode 100644
index 0000000..f6499ba
--- /dev/null
+++ b/examples/xmlpatterns/schema/files/valid_recipe.xml
@@ -0,0 +1,13 @@
+<recipe>
+ <title>Cheese on Toast</title>
+ <ingredient name="Bread" quantity="2" unit="slices"/>
+ <ingredient name="Cheese" quantity="2" unit="slices"/>
+ <time quantity="3" unit="minutes"/>
+ <method>
+ <step>1. Slice the bread and cheese.</step>
+ <step>2. Grill one side of each slice of bread.</step>
+ <step>3. Turn over the bread and place a slice of cheese on each piece.</step>
+ <step>4. Grill until the cheese has started to melt.</step>
+ <step>5. Serve and enjoy!</step>
+ </method>
+</recipe>
diff --git a/examples/gestures/browser/squeezelabel.h b/examples/xmlpatterns/schema/main.cpp
index 550a275..b1ec8b0 100644
--- a/examples/gestures/browser/squeezelabel.h
+++ b/examples/xmlpatterns/schema/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -39,22 +39,16 @@
**
****************************************************************************/
-#ifndef SQUEEZELABEL_H
-#define SQUEEZELABEL_H
+#include <QtGui>
+#include "mainwindow.h"
-#include <QtGui/QLabel>
-
-class SqueezeLabel : public QLabel
+//! [0]
+int main(int argc, char* argv[])
{
- Q_OBJECT
-
-public:
- SqueezeLabel(QWidget *parent = 0);
-
-protected:
- void paintEvent(QPaintEvent *event);
-
-};
-
-#endif // SQUEEZELABEL_H
-
+ Q_INIT_RESOURCE(schema);
+ QApplication app(argc, argv);
+ MainWindow* const window = new MainWindow;
+ window->show();
+ return app.exec();
+}
+//! [0]
diff --git a/examples/xmlpatterns/schema/mainwindow.cpp b/examples/xmlpatterns/schema/mainwindow.cpp
new file mode 100644
index 0000000..0bb21f5
--- /dev/null
+++ b/examples/xmlpatterns/schema/mainwindow.cpp
@@ -0,0 +1,218 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtXmlPatterns>
+
+#include "mainwindow.h"
+#include "xmlsyntaxhighlighter.h"
+
+//! [4]
+class MessageHandler : public QAbstractMessageHandler
+{
+ public:
+ MessageHandler()
+ : QAbstractMessageHandler(0)
+ {
+ }
+
+ QString statusMessage() const
+ {
+ return m_description;
+ }
+
+ int line() const
+ {
+ return m_sourceLocation.line();
+ }
+
+ int column() const
+ {
+ return m_sourceLocation.column();
+ }
+
+ protected:
+ virtual void handleMessage(QtMsgType type, const QString &description,
+ const QUrl &identifier, const QSourceLocation &sourceLocation)
+ {
+ Q_UNUSED(type);
+ Q_UNUSED(identifier);
+
+ m_messageType = type;
+ m_description = description;
+ m_sourceLocation = sourceLocation;
+ }
+
+ private:
+ QtMsgType m_messageType;
+ QString m_description;
+ QSourceLocation m_sourceLocation;
+};
+//! [4]
+
+//! [0]
+MainWindow::MainWindow()
+{
+ setupUi(this);
+
+ new XmlSyntaxHighlighter(schemaView->document());
+ new XmlSyntaxHighlighter(instanceEdit->document());
+
+ schemaSelection->addItem(tr("Contact Schema"));
+ schemaSelection->addItem(tr("Recipe Schema"));
+ schemaSelection->addItem(tr("Order Schema"));
+
+ instanceSelection->addItem(tr("Valid Contact Instance"));
+ instanceSelection->addItem(tr("Invalid Contact Instance"));
+
+ connect(schemaSelection, SIGNAL(currentIndexChanged(int)), SLOT(schemaSelected(int)));
+ connect(instanceSelection, SIGNAL(currentIndexChanged(int)), SLOT(instanceSelected(int)));
+ connect(validateButton, SIGNAL(clicked()), SLOT(validate()));
+ connect(instanceEdit, SIGNAL(textChanged()), SLOT(textChanged()));
+
+ validationStatus->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
+
+ schemaSelected(0);
+ instanceSelected(0);
+}
+//! [0]
+
+//! [1]
+void MainWindow::schemaSelected(int index)
+{
+ instanceSelection->clear();
+ if (index == 0) {
+ instanceSelection->addItem(tr("Valid Contact Instance"));
+ instanceSelection->addItem(tr("Invalid Contact Instance"));
+ } else if (index == 1) {
+ instanceSelection->addItem(tr("Valid Recipe Instance"));
+ instanceSelection->addItem(tr("Invalid Recipe Instance"));
+ } else if (index == 2) {
+ instanceSelection->addItem(tr("Valid Order Instance"));
+ instanceSelection->addItem(tr("Invalid Order Instance"));
+ }
+ textChanged();
+
+ QFile schemaFile(QString(":/schema_%1.xsd").arg(index));
+ schemaFile.open(QIODevice::ReadOnly);
+ const QString schemaText(QString::fromUtf8(schemaFile.readAll()));
+ schemaView->setPlainText(schemaText);
+
+ validate();
+}
+//! [1]
+
+//! [2]
+void MainWindow::instanceSelected(int index)
+{
+ QFile instanceFile(QString(":/instance_%1.xml").arg((2*schemaSelection->currentIndex()) + index));
+ instanceFile.open(QIODevice::ReadOnly);
+ const QString instanceText(QString::fromUtf8(instanceFile.readAll()));
+ instanceEdit->setPlainText(instanceText);
+
+ validate();
+}
+//! [2]
+
+//! [3]
+void MainWindow::validate()
+{
+ const QByteArray schemaData = schemaView->toPlainText().toUtf8();
+ const QByteArray instanceData = instanceEdit->toPlainText().toUtf8();
+
+ MessageHandler messageHandler;
+
+ QXmlSchema schema;
+ schema.setMessageHandler(&messageHandler);
+
+ schema.load(schemaData);
+
+ bool errorOccurred = false;
+ if (!schema.isValid()) {
+ errorOccurred = true;
+ } else {
+ QXmlSchemaValidator validator(schema);
+ if (!validator.validate(instanceData))
+ errorOccurred = true;
+ }
+
+ if (errorOccurred) {
+ validationStatus->setText(messageHandler.statusMessage());
+ moveCursor(messageHandler.line(), messageHandler.column());
+ } else {
+ validationStatus->setText(tr("validation successful"));
+ }
+
+ const QString styleSheet = QString("QLabel {background: %1; padding: 3px}")
+ .arg(errorOccurred ? QColor(Qt::red).lighter(160).name() :
+ QColor(Qt::green).lighter(160).name());
+ validationStatus->setStyleSheet(styleSheet);
+}
+//! [3]
+
+void MainWindow::textChanged()
+{
+ instanceEdit->setExtraSelections(QList<QTextEdit::ExtraSelection>());
+}
+
+void MainWindow::moveCursor(int line, int column)
+{
+ instanceEdit->moveCursor(QTextCursor::Start);
+ for (int i = 1; i < line; ++i)
+ instanceEdit->moveCursor(QTextCursor::Down);
+
+ for (int i = 1; i < column; ++i)
+ instanceEdit->moveCursor(QTextCursor::Right);
+
+ QList<QTextEdit::ExtraSelection> extraSelections;
+ QTextEdit::ExtraSelection selection;
+
+ const QColor lineColor = QColor(Qt::red).lighter(160);
+ selection.format.setBackground(lineColor);
+ selection.format.setProperty(QTextFormat::FullWidthSelection, true);
+ selection.cursor = instanceEdit->textCursor();
+ selection.cursor.clearSelection();
+ extraSelections.append(selection);
+
+ instanceEdit->setExtraSelections(extraSelections);
+
+ instanceEdit->setFocus();
+}
diff --git a/examples/xmlpatterns/schema/mainwindow.h b/examples/xmlpatterns/schema/mainwindow.h
new file mode 100644
index 0000000..420c627
--- /dev/null
+++ b/examples/xmlpatterns/schema/mainwindow.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+#include "ui_schema.h"
+
+//! [0]
+class MainWindow : public QMainWindow,
+ private Ui::SchemaMainWindow
+{
+ Q_OBJECT
+
+ public:
+ MainWindow();
+
+ private Q_SLOTS:
+ void schemaSelected(int index);
+ void instanceSelected(int index);
+ void validate();
+ void textChanged();
+
+ private:
+ void moveCursor(int line, int column);
+};
+//! [0]
+#endif
diff --git a/examples/xmlpatterns/schema/schema.pro b/examples/xmlpatterns/schema/schema.pro
new file mode 100644
index 0000000..af32e0a
--- /dev/null
+++ b/examples/xmlpatterns/schema/schema.pro
@@ -0,0 +1,11 @@
+QT += xmlpatterns
+FORMS += schema.ui
+HEADERS = mainwindow.h ../shared/xmlsyntaxhighlighter.h
+RESOURCES = schema.qrc
+SOURCES = main.cpp mainwindow.cpp ../shared/xmlsyntaxhighlighter.cpp
+INCLUDEPATH += ../shared/
+
+target.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xq *.html files
+sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema
+INSTALLS += target sources
diff --git a/examples/xmlpatterns/schema/schema.qrc b/examples/xmlpatterns/schema/schema.qrc
new file mode 100644
index 0000000..eb7ddfd
--- /dev/null
+++ b/examples/xmlpatterns/schema/schema.qrc
@@ -0,0 +1,13 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file alias="schema_0.xsd">files/contact.xsd</file>
+ <file alias="schema_1.xsd">files/recipe.xsd</file>
+ <file alias="schema_2.xsd">files/order.xsd</file>
+ <file alias="instance_0.xml">files/valid_contact.xml</file>
+ <file alias="instance_1.xml">files/invalid_contact.xml</file>
+ <file alias="instance_2.xml">files/valid_recipe.xml</file>
+ <file alias="instance_3.xml">files/invalid_recipe.xml</file>
+ <file alias="instance_4.xml">files/valid_order.xml</file>
+ <file alias="instance_5.xml">files/invalid_order.xml</file>
+</qresource>
+</RCC>
diff --git a/examples/xmlpatterns/schema/schema.ui b/examples/xmlpatterns/schema/schema.ui
new file mode 100644
index 0000000..b67f444
--- /dev/null
+++ b/examples/xmlpatterns/schema/schema.ui
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SchemaMainWindow</class>
+ <widget class="QMainWindow" name="SchemaMainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>417</width>
+ <height>594</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>XML Schema Validation</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="schemaLabel">
+ <property name="text">
+ <string>XML Schema Document:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2" colspan="2">
+ <widget class="QComboBox" name="schemaSelection"/>
+ </item>
+ <item row="1" column="0" colspan="4">
+ <widget class="QTextBrowser" name="schemaView"/>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="instanceLabel">
+ <property name="text">
+ <string>XML Instance Document:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" colspan="2">
+ <widget class="QComboBox" name="instanceSelection"/>
+ </item>
+ <item row="3" column="0" colspan="4">
+ <widget class="QTextEdit" name="instanceEdit"/>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Status:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" colspan="2">
+ <widget class="QLabel" name="validationStatus">
+ <property name="text">
+ <string>not validated</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3">
+ <widget class="QPushButton" name="validateButton">
+ <property name="text">
+ <string>Validate</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/xmlpatterns/trafficinfo/mainwindow.cpp b/examples/xmlpatterns/trafficinfo/mainwindow.cpp
index 943055a..105ede4 100644
--- a/examples/xmlpatterns/trafficinfo/mainwindow.cpp
+++ b/examples/xmlpatterns/trafficinfo/mainwindow.cpp
@@ -111,7 +111,9 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
void MainWindow::paintEvent(QPaintEvent*)
{
- QLinearGradient gradient(QPoint(width()/2, 0), QPoint(width()/2, height()));
+ const QPoint start(width()/2, 0);
+ const QPoint finalStop(width()/2, height());
+ QLinearGradient gradient(start, finalStop);
const QColor qtGreen(102, 176, 54);
gradient.setColorAt(0, qtGreen.dark());
gradient.setColorAt(0.5, qtGreen);
diff --git a/examples/xmlpatterns/xmlpatterns.pro b/examples/xmlpatterns/xmlpatterns.pro
index 081abde..d5b3498 100644
--- a/examples/xmlpatterns/xmlpatterns.pro
+++ b/examples/xmlpatterns/xmlpatterns.pro
@@ -2,7 +2,8 @@ TEMPLATE = subdirs
SUBDIRS = recipes \
trafficinfo \
xquery \
- filetree
+ filetree \
+ schema
# This example depends on QtWebkit as well.
contains(QT_CONFIG, webkit):SUBDIRS += qobjectxmlmodel
diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf
index fdc72ca..42ce1bc 100644
--- a/mkspecs/features/moc.prf
+++ b/mkspecs/features/moc.prf
@@ -15,10 +15,7 @@ WIN_INCLUDETEMP=
win32:count($$list($$INCPATH), 40, >) {
INCLUDETEMP = $$MOC_DIR/mocinclude.tmp
- # Remove any existing mocinclude.tmp when qmake runs
WIN_INCLUDETEMP=$$INCLUDETEMP
- WIN_INCLUDETEMP~=s,/,\,g
- system($$QMAKE_DEL_FILE $$WIN_INCLUDETEMP > NUL 2>&1)
EOC = $$escape_expand(\n\t)
@@ -65,7 +62,9 @@ moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAK
moc_header.input = HEADERS
moc_header.variable_out = SOURCES
moc_header.name = MOC ${QMAKE_FILE_IN}
-!isEmpty(INCLUDETEMP):moc_header.depends += $$INCLUDETEMP
+if(!contains(TEMPLATE, "vc.*"):!contains(TEMPLATE_PREFIX, "vc")) {
+ !isEmpty(INCLUDETEMP):moc_header.depends += $$INCLUDETEMP
+}
silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands
QMAKE_EXTRA_COMPILERS += moc_header
INCREDIBUILD_XGE += moc_header
@@ -77,7 +76,9 @@ moc_source.commands = ${QMAKE_FUNC_mocCmd}
moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC}
moc_source.input = SOURCES OBJECTIVE_SOURCES
moc_source.name = MOC ${QMAKE_FILE_IN}
-!isEmpty(INCLUDETEMP):moc_source.depends += $$INCLUDETEMP
+if(!contains(TEMPLATE, "vc.*"):!contains(TEMPLATE_PREFIX, "vc")) {
+ !isEmpty(INCLUDETEMP):moc_source.depends += $$INCLUDETEMP
+}
silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands
QMAKE_EXTRA_COMPILERS += moc_source
INCREDIBUILD_XGE += moc_source
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 9ac67dd..f5b38c5 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -167,6 +167,7 @@ for(QTLIB, $$list($$lower($$unique(QT)))) {
} else {
DEFINES *= $$upper(QT_$${QTLIB}_LIB)
isEqual(QTLIB, opengl):CONFIG += opengl
+ isEqual(QTLIB, openvg):CONFIG += openvg
isEqual(QTLIB, qt3support):DEFINES *= QT3_SUPPORT
isEqual(QTLIB, testlib):CONFIG += console
isEqual(QTLIB, dbus):CONFIG += dbusadaptors dbusinterfaces
diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf
index 385765b..eaf373a 100644
--- a/mkspecs/features/uic.prf
+++ b/mkspecs/features/uic.prf
@@ -51,7 +51,7 @@ equals(UI_DIR, .) {
uic3 {
isEmpty(FORMS3) {
UIC3_FORMS = FORMS
- !build_pass:message("Project contains CONFIG+=uic3, but no files in FORMS3; .ui files in FORMS treated as UIC3 form files.")
+ !build_pass:message("Project contains CONFIG+=uic3, but no files in FORMS3; UI files in FORMS treated as UIC3 form files.")
} else {
UIC3_FORMS = FORMS3
}
diff --git a/mkspecs/features/unix/openvg.prf b/mkspecs/features/unix/openvg.prf
index a21d1ca..29acec1 100644
--- a/mkspecs/features/unix/openvg.prf
+++ b/mkspecs/features/unix/openvg.prf
@@ -1,9 +1,15 @@
!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG
!isEmpty(QMAKE_LIBDIR_OPENVG): QMAKE_LIBDIR += -L$$QMAKE_LIBDIR_OPENVG
-!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $QMAKE_LIBS_OPENVG
+!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG
+
+contains(QT_CONFIG, egl) {
+ !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
+ !isEmpty(QMAKE_LIBDIR_EGL): LIBS += -L$$QMAKE_LIBDIR_EGL
+ !isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
+}
contains(QT_CONFIG, openvg_on_opengl) {
!isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
!isEmpty(QMAKE_LIBDIR_OPENGL): QMAKE_LIBDIR += -L$$QMAKE_LIBDIR_OPENGL
- !isEmpty(QMAKE_LIBS_OPENGL): LIBS += $QMAKE_LIBS_OPENGL
+ !isEmpty(QMAKE_LIBS_OPENGL): LIBS += $$QMAKE_LIBS_OPENGL
}
diff --git a/mkspecs/win32-g++/qplatformdefs.h b/mkspecs/win32-g++/qplatformdefs.h
index c4ee4b4..97c63f5 100644
--- a/mkspecs/win32-g++/qplatformdefs.h
+++ b/mkspecs/win32-g++/qplatformdefs.h
@@ -60,7 +60,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <stdlib.h>
-#include <windows.h>
+#include <qt_windows.h>
#include <limits.h>
#if !defined(_WIN32_WINNT) || (_WIN32_WINNT-0 < 0x0500)
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix
index c7f4dc4..6ba5b6b 100644
--- a/qmake/Makefile.unix
+++ b/qmake/Makefile.unix
@@ -13,7 +13,7 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \
symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o
#qt code
-QOBJS=qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \
+QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \
qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlistdata.o qfile.o \
qfsfileengine_unix.o qfsfileengine_iterator_unix.o qfsfileengine.o \
qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o \
@@ -47,6 +47,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge
generators/win32/msvc_objectmodel.cpp generators/win32/msvc_nmake.cpp generators/win32/borland_bmake.cpp \
generators/symbian/symmake.cpp generators/symbian/initprojectdeploy_symbian.cpp \
generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \
+ $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \
$(SOURCE_PATH)/src/corelib/io/qtextstream.cpp $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \
$(SOURCE_PATH)/src/corelib/global/qmalloc.cpp \
@@ -165,6 +166,12 @@ qcore_mac.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp
qurl.o: $(SOURCE_PATH)/src/corelib/io/qurl.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qurl.cpp
+qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
+
+qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp
+
qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32
index 54c2872..40b08eb 100644
--- a/qmake/Makefile.win32
+++ b/qmake/Makefile.win32
@@ -110,6 +110,8 @@ QTOBJS= \
qmalloc.obj \
qmap.obj \
qregexp.obj \
+ qtextcodec.obj \
+ qutfcodec.obj \
qstring.obj \
qstringlist.obj \
qtextstream.obj \
@@ -198,6 +200,8 @@ clean::
-del qmalloc.obj
-del qmap.obj
-del qregexp.obj
+ -del qtextcodec.obj
+ -del qutfcodec.obj
-del qstring.obj
-del qstringlist.obj
-del qtextstream.obj
@@ -347,6 +351,9 @@ qbytearraymatcher.obj: $(SOURCE_PATH)\src\corelib\tools\qbytearraymatcher.cpp
qchar.obj: $(SOURCE_PATH)\src\corelib\tools\qchar.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qchar.cpp
+qutfcodec.obj: $(SOURCE_PATH)\src\corelib\codecs\qutfcodec.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\codecs\qutfcodec.cpp
+
qstring.obj: $(SOURCE_PATH)\src\corelib\tools\qstring.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qstring.cpp
@@ -389,8 +396,8 @@ qfsfileengine_iterator.obj: $(SOURCE_PATH)\src\corelib\io\qfsfileengine_iterator
qabstractfileengine.obj: $(SOURCE_PATH)\src\corelib\io\qabstractfileengine.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\io\qabstractfileengine.cpp
-qtextcodec.obj: $(SOURCE_PATH)\src\codecs\qtextcodec.cpp
- $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\codecs\qtextcodec.cpp
+qtextcodec.obj: $(SOURCE_PATH)\src\corelib\codecs\qtextcodec.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\codecs\qtextcodec.cpp
qregexp.obj: $(SOURCE_PATH)\src\corelib\tools\qregexp.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qregexp.cpp
diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++
index dd65145..a3ddf11 100644
--- a/qmake/Makefile.win32-g++
+++ b/qmake/Makefile.win32-g++
@@ -75,6 +75,8 @@ QTOBJS= \
qmalloc.o \
qmap.o \
qregexp.o \
+ qtextcodec.o \
+ qutfcodec.o \
qstring.o \
qstringlist.o \
qtextstream.o \
@@ -198,6 +200,9 @@ qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp
qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp
+qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
+
qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
@@ -237,8 +242,8 @@ qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp
qfsfileengine_iterator.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp
-qtextcodec.o: $(SOURCE_PATH)/src/codecs/qtextcodec.cpp
- $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/codecs/qtextcodec.cpp
+qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp
qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp
diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh
index 646815b..85a7e45 100644
--- a/qmake/Makefile.win32-g++-sh
+++ b/qmake/Makefile.win32-g++-sh
@@ -75,6 +75,8 @@ QTOBJS= \
qmalloc.o \
qmap.o \
qregexp.o \
+ qtextcodec.o \
+ qutfcodec.o \
qstring.o \
qstringlist.o \
qtextstream.o \
@@ -197,6 +199,9 @@ qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp
qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp
+qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
+
qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
@@ -236,8 +241,8 @@ qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp
qfsfileengine_iterator.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp
-qtextcodec.o: $(SOURCE_PATH)/src/codecs/qtextcodec.cpp
- $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/codecs/qtextcodec.cpp
+qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp
qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 5eaa39f..4d74573 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -121,7 +121,7 @@ bool MakefileGenerator::mkdir(const QString &in_path) const
QDir d;
if(path.startsWith(QDir::separator())) {
d.cd(QString(QDir::separator()));
- path = path.right(path.length() - 1);
+ path.remove(0, 1);
}
bool ret = true;
#ifdef Q_OS_WIN
@@ -129,7 +129,7 @@ bool MakefileGenerator::mkdir(const QString &in_path) const
if(!QDir::isRelativePath(path)) {
if(QFile::exists(path.left(3))) {
d.cd(path.left(3));
- path = path.right(path.length() - 3);
+ path.remove(0, 3);
} else {
warn_msg(WarnLogic, "Cannot access drive '%s' (%s)",
path.left(3).toLatin1().data(), path.toLatin1().data());
@@ -201,13 +201,13 @@ MakefileGenerator::initOutPaths()
if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty() &&
v.contains("QMAKE_ABSOLUTE_SOURCE_ROOT")) {
QString root = v["QMAKE_ABSOLUTE_SOURCE_ROOT"].first();
- root = Option::fixPathToTargetOS(root);
+ root = QDir::fromNativeSeparators(root);
if(!root.isEmpty()) {
QFileInfo fi = fileInfo(Option::mkfile::cachefile);
if(!fi.makeAbsolute()) {
QString cache_r = fi.path(), pwd = Option::output_dir;
if(pwd.startsWith(cache_r) && !pwd.startsWith(root)) {
- pwd = Option::fixPathToTargetOS(root + pwd.mid(cache_r.length()));
+ pwd = root + pwd.mid(cache_r.length());
if(exists(pwd))
v.insert("QMAKE_ABSOLUTE_SOURCE_PATH", QStringList(pwd));
}
@@ -217,7 +217,7 @@ MakefileGenerator::initOutPaths()
}
if(!v["QMAKE_ABSOLUTE_SOURCE_PATH"].isEmpty()) {
QString &asp = v["QMAKE_ABSOLUTE_SOURCE_PATH"].first();
- asp = Option::fixPathToTargetOS(asp);
+ asp = QDir::fromNativeSeparators(asp);
if(asp.isEmpty() || asp == Option::output_dir) //if they're the same, why bother?
v["QMAKE_ABSOLUTE_SOURCE_PATH"].clear();
}
@@ -243,7 +243,7 @@ MakefileGenerator::initOutPaths()
if(!(dirs[x] == "DLLDESTDIR"))
#endif
{
- if(pathRef.right(Option::dir_sep.length()) != Option::dir_sep)
+ if(!pathRef.endsWith(Option::dir_sep))
pathRef += Option::dir_sep;
}
@@ -346,7 +346,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v
QString real_dir = Option::fixPathToLocalOS((*vpath_it));
if(exists(real_dir + QDir::separator() + val)) {
QString dir = (*vpath_it);
- if(dir.right(Option::dir_sep.length()) != Option::dir_sep)
+ if(!dir.endsWith(Option::dir_sep))
dir += Option::dir_sep;
val = dir + val;
if(!(flags & VPATH_NoFixify))
@@ -365,7 +365,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v
real_dir = dir;
if(!(flags & VPATH_NoFixify))
real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir);
- regex = regex.right(regex.length() - dir.length());
+ regex.remove(0, dir.length());
}
if(real_dir.isEmpty() || exists(real_dir)) {
QStringList files = QDir(real_dir).entryList(QStringList(regex));
@@ -725,14 +725,14 @@ MakefileGenerator::init()
if(project->isActiveConfig("qmake_cache")) {
QString cache_file;
if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) {
- cache_file = Option::fixPathToLocalOS(project->first("QMAKE_INTERNAL_CACHE_FILE"));
+ cache_file = QDir::fromNativeSeparators(project->first("QMAKE_INTERNAL_CACHE_FILE"));
} else {
cache_file = ".qmake.internal.cache";
if(project->isActiveConfig("build_pass"))
cache_file += ".BUILD." + project->first("BUILD_PASS");
}
- if(cache_file.indexOf(QDir::separator()) == -1)
- cache_file.prepend(Option::output_dir + QDir::separator());
+ if(cache_file.indexOf('/') == -1)
+ cache_file.prepend(Option::output_dir + '/');
QMakeSourceFileInfo::setCacheFile(cache_file);
}
@@ -789,7 +789,7 @@ MakefileGenerator::init()
QString dir, regex = Option::fixPathToLocalOS((*dep_it));
if(regex.lastIndexOf(Option::dir_sep) != -1) {
dir = regex.left(regex.lastIndexOf(Option::dir_sep) + 1);
- regex = regex.right(regex.length() - dir.length());
+ regex.remove(0, dir.length());
}
QStringList files = QDir(dir).entryList(QStringList(regex));
if(files.isEmpty()) {
@@ -939,7 +939,7 @@ MakefileGenerator::writePrlFile(QTextStream &t)
QString target = project->first("TARGET");
int slsh = target.lastIndexOf(Option::dir_sep);
if(slsh != -1)
- target = target.right(target.length() - slsh - 1);
+ target.remove(0, slsh + 1);
QString bdir = Option::output_dir;
if(bdir.isEmpty())
bdir = qmake_getpwd();
@@ -1057,11 +1057,11 @@ MakefileGenerator::prlFileName(bool fixify)
ret = project->first("TARGET");
int slsh = ret.lastIndexOf(Option::dir_sep);
if(slsh != -1)
- ret = ret.right(ret.length() - slsh);
+ ret.remove(0, slsh);
if(!ret.endsWith(Option::prl_ext)) {
int dot = ret.indexOf('.');
if(dot != -1)
- ret = ret.left(dot);
+ ret.truncate(dot);
ret += Option::prl_ext;
}
if(!project->isEmpty("QMAKE_BUNDLE"))
@@ -1211,7 +1211,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n
if(project->values((*it) + ".CONFIG").indexOf("no_path") == -1 &&
project->values((*it) + ".CONFIG").indexOf("dummy_install") == -1) {
dst = fileFixify(unescapeFilePath(project->values(pvar).first()), FileFixifyAbsolute, false);
- if(dst.right(1) != Option::dir_sep)
+ if(!dst.endsWith(Option::dir_sep))
dst += Option::dir_sep;
}
dst = escapeFilePath(dst);
@@ -1240,9 +1240,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n
int slsh = filestr.lastIndexOf(Option::dir_sep);
if(slsh != -1) {
dirstr = filestr.left(slsh+1);
- filestr = filestr.right(filestr.length() - slsh - 1);
+ filestr.remove(0, slsh+1);
}
- if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep)
+ if(!dirstr.endsWith(Option::dir_sep))
dirstr += Option::dir_sep;
if(exists(wild)) { //real file
QString file = wild;
@@ -1342,7 +1342,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n
const QStringList &dirs = project->values(pvar);
for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) {
QString tmp_dst = fileFixify((*pit), FileFixifyAbsolute, false);
- if (!isWindowsShell() && tmp_dst.right(1) != Option::dir_sep)
+ if (!isWindowsShell() && !tmp_dst.endsWith(Option::dir_sep))
tmp_dst += Option::dir_sep;
t << mkdir_p_asstring(filePrefixRoot(root, tmp_dst)) << "\n\t";
}
@@ -2277,8 +2277,8 @@ MakefileGenerator::findSubDirsSubTargets() const
st->profile = file.section(Option::dir_sep, -1) + Option::pro_ext;
st->in_directory = file;
}
- while(st->in_directory.right(1) == Option::dir_sep)
- st->in_directory = st->in_directory.left(st->in_directory.length() - 1);
+ while(st->in_directory.endsWith(Option::dir_sep))
+ st->in_directory.chop(1);
if(fileInfo(st->in_directory).isRelative())
st->out_directory = st->in_directory;
else
@@ -2358,7 +2358,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
if (!(flags & SubTargetSkipDefaultVariables)) {
QString ofile = Option::fixPathToTargetOS(Option::output.fileName());
if(ofile.lastIndexOf(Option::dir_sep) != -1)
- ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1);
+ ofile.remove(0, ofile.lastIndexOf(Option::dir_sep) +1);
t << "MAKEFILE = " << ofile << endl;
/* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires
* back-slashes to be turned into slashes. */
@@ -2802,11 +2802,13 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
return cacheVal;
//do the fixin'
- const QString pwd = qmake_getpwd() + "/";
+ QString pwd = qmake_getpwd();
+ if (!pwd.endsWith('/'))
+ pwd += '/';
QString orig_file = ret;
if(ret.startsWith(QLatin1Char('~'))) {
if(ret.startsWith(QLatin1String("~/")))
- ret = QDir::homePath() + Option::dir_sep + ret.mid(1);
+ ret = QDir::homePath() + ret.mid(1);
else
warn_msg(WarnLogic, "Unable to expand ~ in %s", ret.toLatin1().constData());
}
@@ -2895,13 +2897,13 @@ MakefileGenerator::checkMultipleDefinition(const QString &f, const QString &w)
QString file = f;
int slsh = f.lastIndexOf(Option::dir_sep);
if(slsh != -1)
- file = file.right(file.length() - slsh - 1);
+ file.remove(0, slsh + 1);
QStringList &l = project->values(w);
for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) {
QString file2((*val_it));
slsh = file2.lastIndexOf(Option::dir_sep);
if(slsh != -1)
- file2 = file2.right(file2.length() - slsh - 1);
+ file2.remove(0, slsh + 1);
if(file2 == file) {
warn_msg(WarnLogic, "Found potential symbol conflict of %s (%s) in %s",
file.toLatin1().constData(), (*val_it).toLatin1().constData(), w.toLatin1().constData());
@@ -3055,7 +3057,7 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const
file.setFileName(Option::output_dir + "/" + file.fileName()); //pwd when qmake was run
QFileInfo fi(fileInfo(file.fileName()));
if(fi.isDir())
- outdir = file.fileName() + QDir::separator();
+ outdir = file.fileName() + '/';
}
if(!outdir.isEmpty() || file.fileName().isEmpty()) {
QString fname = "Makefile";
@@ -3075,7 +3077,7 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const
file.setFileName(file.fileName() + "." + build);
if(project->isEmpty("QMAKE_MAKEFILE"))
project->values("QMAKE_MAKEFILE").append(file.fileName());
- int slsh = file.fileName().lastIndexOf(Option::dir_sep);
+ int slsh = file.fileName().lastIndexOf('/');
if(slsh != -1)
mkdir(file.fileName().left(slsh));
if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
@@ -3085,9 +3087,13 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const
od = fileInfo(fi.readLink()).absolutePath();
else
od = fi.path();
- od = Option::fixPathToTargetOS(od);
- if(QDir::isRelativePath(od))
- od.prepend(Option::output_dir);
+ od = QDir::fromNativeSeparators(od);
+ if(QDir::isRelativePath(od)) {
+ QString dir = Option::output_dir;
+ if (!dir.endsWith('/') && !od.isEmpty())
+ dir += '/';
+ od.prepend(dir);
+ }
Option::output_dir = od;
return true;
}
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index 63b0f17..d36be3c 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -294,9 +294,9 @@ SubdirsMetaMakefileGenerator::init()
init_flag = true;
if(Option::recursive) {
- QString old_output_dir = QDir::cleanPath(Option::output_dir);
+ QString old_output_dir = Option::output_dir;
QString old_output = Option::output.fileName();
- QString oldpwd = QDir::cleanPath(qmake_getpwd());
+ QString oldpwd = qmake_getpwd();
QString thispwd = oldpwd;
if(!thispwd.endsWith('/'))
thispwd += '/';
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 303e3e1..78a552b 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -120,14 +120,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
QString rSubkeyPath = keyPath(rSubkey);
HKEY handle = 0;
- LONG res;
- QT_WA( {
- res = RegOpenKeyExW(parentHandle, (WCHAR*)rSubkeyPath.utf16(),
- 0, KEY_READ, &handle);
- } , {
- res = RegOpenKeyExA(parentHandle, rSubkeyPath.toLocal8Bit(),
- 0, KEY_READ, &handle);
- } );
+ LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle);
if (res != ERROR_SUCCESS)
return QString();
@@ -135,11 +128,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
// get the size and type of the value
DWORD dataType;
DWORD dataSize;
- QT_WA( {
- res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize);
- }, {
- res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize);
- } );
+ res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize);
if (res != ERROR_SUCCESS) {
RegCloseKey(handle);
return QString();
@@ -147,13 +136,8 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
// get the value
QByteArray data(dataSize, 0);
- QT_WA( {
- res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, 0,
- reinterpret_cast<unsigned char*>(data.data()), &dataSize);
- }, {
- res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0,
- reinterpret_cast<unsigned char*>(data.data()), &dataSize);
- } );
+ res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0,
+ reinterpret_cast<unsigned char*>(data.data()), &dataSize);
if (res != ERROR_SUCCESS) {
RegCloseKey(handle);
return QString();
@@ -163,11 +147,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
switch (dataType) {
case REG_EXPAND_SZ:
case REG_SZ: {
- QT_WA( {
- result = QString::fromUtf16(((const ushort*)data.constData()));
- }, {
- result = QString::fromLatin1(data.constData());
- } );
+ result = QString::fromWCharArray(((const wchar_t *)data.constData()));
break;
}
@@ -175,12 +155,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
QStringList l;
int i = 0;
for (;;) {
- QString s;
- QT_WA( {
- s = QString::fromUtf16((const ushort*)data.constData() + i);
- }, {
- s = QString::fromLatin1(data.constData() + i);
- } );
+ QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i);
i += s.length() + 1;
if (s.isEmpty())
@@ -193,11 +168,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
case REG_NONE:
case REG_BINARY: {
- QT_WA( {
- result = QString::fromUtf16((const ushort*)data.constData(), data.size()/2);
- }, {
- result = QString::fromLatin1(data.constData(), data.size());
- } );
+ result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2);
break;
}
@@ -1268,9 +1239,8 @@ void VcprojGenerator::initDeploymentTool()
foreach(QString item, project->values("DEPLOYMENT")) {
// get item.path
QString devicePath = project->first(item + ".path");
- // if the path does not exist, skip it
if (devicePath.isEmpty())
- continue;
+ devicePath = targetPath;
// check if item.path is relative (! either /,\ or %)
if (!(devicePath.at(0) == QLatin1Char('/')
|| devicePath.at(0) == QLatin1Char('\\')
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 0e4a608..5f8c4f4 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -716,16 +716,9 @@ QString qmake_libraryInfoFile()
{
QString ret;
#if defined( Q_OS_WIN )
- QFileInfo filePath;
- QT_WA({
- unsigned short module_name[256];
- GetModuleFileNameW(0, reinterpret_cast<wchar_t *>(module_name), sizeof(module_name));
- filePath = QString::fromUtf16(module_name);
- }, {
- char module_name[256];
- GetModuleFileNameA(0, module_name, sizeof(module_name));
- filePath = QString::fromLocal8Bit(module_name);
- });
+ wchar_t module_name[MAX_PATH];
+ GetModuleFileName(0, module_name, MAX_PATH);
+ QFileInfo filePath = QString::fromWCharArray(module_name);
ret = filePath.filePath();
#else
QString argv0 = QFile::decodeName(QByteArray(Option::application_argv0));
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 0a5e9a3..92eb461 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -3261,9 +3261,9 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList
ret = "Windows";
} else if(type == "name") {
DWORD name_length = 1024;
- TCHAR name[1024];
- if(GetComputerName(name, &name_length))
- ret = QString::fromUtf16((ushort*)name, name_length);
+ wchar_t name[1024];
+ if (GetComputerName(name, &name_length))
+ ret = QString::fromWCharArray(name);
} else if(type == "version" || type == "version_string") {
QSysInfo::WinVersion ver = QSysInfo::WindowsVersion;
if(type == "version")
diff --git a/qmake/qmake.pri b/qmake/qmake.pri
index 2304fab..6808f68 100644
--- a/qmake/qmake.pri
+++ b/qmake/qmake.pri
@@ -68,6 +68,8 @@ bootstrap { #Qt code
qmap.cpp \
qmetatype.cpp \
qregexp.cpp \
+ qtextcodec.cpp \
+ qutfcodec.cpp \
qstring.cpp \
qstringlist.cpp \
qtemporaryfile.cpp \
@@ -107,6 +109,8 @@ bootstrap { #Qt code
qmap.h \
qmetatype.h \
qregexp.h \
+ qtextcodec.h \
+ qutfcodec.h \
qstring.h \
qstringlist.h \
qstringmatcher.h \
diff --git a/src/3rdparty/phonon/ds9/backend.cpp b/src/3rdparty/phonon/ds9/backend.cpp
index 245749a..2c56af7 100644
--- a/src/3rdparty/phonon/ds9/backend.cpp
+++ b/src/3rdparty/phonon/ds9/backend.cpp
@@ -50,7 +50,7 @@ namespace Phonon
Backend::Backend(QObject *parent, const QVariantList &)
: QObject(parent)
{
- ::CoInitialize(0);
+ ::CoInitialize(0);
//registering meta types
qRegisterMetaType<HRESULT>("HRESULT");
@@ -61,7 +61,7 @@ namespace Phonon
{
m_audioOutputs.clear();
m_audioEffects.clear();
- ::CoUninitialize();
+ ::CoUninitialize();
}
QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args)
@@ -216,7 +216,7 @@ namespace Phonon
LPOLESTR str = 0;
HRESULT hr = mon->GetDisplayName(0,0, &str);
if (SUCCEEDED(hr)) {
- QString name = QString::fromUtf16((unsigned short*)str);
+ QString name = QString::fromUtf16((unsigned short*)str);
ComPointer<IMalloc> alloc;
::CoGetMalloc(1, alloc.pparam());
alloc->Free(str);
diff --git a/src/3rdparty/phonon/ds9/backendnode.cpp b/src/3rdparty/phonon/ds9/backendnode.cpp
index 7e0b3cd..855357a 100644
--- a/src/3rdparty/phonon/ds9/backendnode.cpp
+++ b/src/3rdparty/phonon/ds9/backendnode.cpp
@@ -57,6 +57,8 @@ namespace Phonon
BackendNode::~BackendNode()
{
+ //this will remove the filter from the graph
+ mediaObjectDestroyed();
}
void BackendNode::setMediaObject(MediaObject *mo)
diff --git a/src/3rdparty/phonon/ds9/fakesource.cpp b/src/3rdparty/phonon/ds9/fakesource.cpp
index 9a61a2e..a4d4640 100644
--- a/src/3rdparty/phonon/ds9/fakesource.cpp
+++ b/src/3rdparty/phonon/ds9/fakesource.cpp
@@ -29,8 +29,10 @@ namespace Phonon
namespace DS9
{
static WAVEFORMATEX g_defaultWaveFormat = {WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0};
- static BITMAPINFOHEADER g_defautBitmapHeader = { sizeof(BITMAPINFOHEADER), 1, 1, 1, 0, 0, 0, 0, 0, 0, 0};
- static VIDEOINFOHEADER2 g_defaultVideoInfo = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ static VIDEOINFOHEADER2 g_defaultVideoInfo = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, {sizeof(BITMAPINFOHEADER), 1, 1, 1, 0, 0, 0, 0, 0, 0, 0} };
+
+ static const AM_MEDIA_TYPE g_fakeAudioType = {MEDIATYPE_Audio, MEDIASUBTYPE_PCM, 0, 0, 2, FORMAT_WaveFormatEx, 0, sizeof(WAVEFORMATEX), reinterpret_cast<BYTE*>(&g_defaultWaveFormat)};
+ static const AM_MEDIA_TYPE g_fakeVideoType = {MEDIATYPE_Video, MEDIASUBTYPE_RGB32, TRUE, FALSE, 0, FORMAT_VideoInfo2, 0, sizeof(VIDEOINFOHEADER2), reinterpret_cast<BYTE*>(&g_defaultVideoInfo)};
class FakePin : public QPin
{
@@ -128,36 +130,12 @@ namespace Phonon
void FakeSource::createFakeAudioPin()
{
- AM_MEDIA_TYPE mt;
- qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE));
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = MEDIASUBTYPE_PCM;
- mt.formattype = FORMAT_WaveFormatEx;
- mt.lSampleSize = 2;
-
- //fake the format (stereo 44.1 khz stereo 16 bits)
- mt.cbFormat = sizeof(WAVEFORMATEX);
- mt.pbFormat = reinterpret_cast<BYTE*>(&g_defaultWaveFormat);
-
- new FakePin(this, mt);
+ new FakePin(this, g_fakeAudioType);
}
void FakeSource::createFakeVideoPin()
{
- AM_MEDIA_TYPE mt;
- qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE));
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = MEDIASUBTYPE_RGB32;
- mt.formattype = FORMAT_VideoInfo2;
- mt.bFixedSizeSamples = 1;
-
- g_defaultVideoInfo.bmiHeader = g_defautBitmapHeader;
-
- //fake the format
- mt.cbFormat = sizeof(VIDEOINFOHEADER2);
- mt.pbFormat = reinterpret_cast<BYTE*>(&g_defaultVideoInfo);
-
- new FakePin(this, mt);
+ new FakePin(this, g_fakeVideoType);
}
}
diff --git a/src/3rdparty/phonon/ds9/iodevicereader.cpp b/src/3rdparty/phonon/ds9/iodevicereader.cpp
index ec10278..38c983b 100644
--- a/src/3rdparty/phonon/ds9/iodevicereader.cpp
+++ b/src/3rdparty/phonon/ds9/iodevicereader.cpp
@@ -36,19 +36,10 @@ namespace Phonon
//these mediatypes define a stream, its type will be autodetected by DirectShow
static QVector<AM_MEDIA_TYPE> getMediaTypes()
{
- AM_MEDIA_TYPE mt;
- mt.majortype = MEDIATYPE_Stream;
- mt.bFixedSizeSamples = TRUE;
- mt.bTemporalCompression = FALSE;
- mt.lSampleSize = 1;
- mt.formattype = GUID_NULL;
- mt.pUnk = 0;
- mt.cbFormat = 0;
- mt.pbFormat = 0;
+ AM_MEDIA_TYPE mt = { MEDIATYPE_Stream, MEDIASUBTYPE_NULL, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0};
QVector<AM_MEDIA_TYPE> ret;
//normal auto-detect stream
- mt.subtype = MEDIASUBTYPE_NULL;
ret << mt;
//AVI stream
mt.subtype = MEDIASUBTYPE_Avi;
diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp
index 1d0b69d..df42011 100644
--- a/src/3rdparty/phonon/ds9/mediaobject.cpp
+++ b/src/3rdparty/phonon/ds9/mediaobject.cpp
@@ -36,7 +36,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QtCore/QDebug>
-#define TIMER_INTERVAL 16 //... ms for the timer that polls the current state (we use the multimedia timer
+#define TIMER_INTERVAL 16 //... ms for the timer that polls the current state (we use the multimedia timer)
#define PRELOAD_TIME 2000 // 2 seconds to load a source
QT_BEGIN_NAMESPACE
@@ -89,7 +89,7 @@ namespace Phonon
DWORD result = ::WaitForMultipleObjects(count, handles, FALSE, INFINITE);
if (result == WAIT_OBJECT_0) {
if (m_finished) {
- //that's the end if the thread execution
+ //that's the end of the thread execution
return;
}
@@ -207,12 +207,14 @@ namespace Phonon
HRESULT hr = S_OK;
- m_currentRender = w.graph;
- m_currentRenderId = w.id;
- if (w.task == ReplaceGraph) {
+ {
QMutexLocker locker(&m_mutex);
- HANDLE h;
+ m_currentRender = w.graph;
+ m_currentRenderId = w.id;
+ }
+ if (w.task == ReplaceGraph) {
+ QMutexLocker locker(&m_mutex);
int index = -1;
for(int i = 0; i < FILTER_COUNT; ++i) {
if (m_graphHandle[i].graph == w.oldGraph) {
@@ -228,6 +230,7 @@ namespace Phonon
Q_ASSERT(index != -1);
//add the new graph
+ HANDLE h;
if (SUCCEEDED(ComPointer<IMediaEvent>(w.graph, IID_IMediaEvent)
->GetEventHandle(reinterpret_cast<OAEVENT*>(&h)))) {
m_graphHandle[index].graph = w.graph;
@@ -250,7 +253,7 @@ namespace Phonon
hr = w.graph->RenderFile(reinterpret_cast<const wchar_t *>(w.url.utf16()), 0);
}
if (hr != E_ABORT) {
- emit asyncRenderFinished(w.id, hr, w.graph);
+ emit asyncRenderFinished(w.id, hr, w.graph);
}
} else if (w.task == Seek) {
//that's a seekrequest
@@ -266,7 +269,7 @@ namespace Phonon
}
}
emit asyncSeekingFinished(w.id, currentTime);
- hr = E_ABORT; //to avoid emitting asyncRenderFinished
+ hr = E_ABORT; //to avoid emitting asyncRenderFinished
} else if (w.task == ChangeState) {
//remove useless decoders
@@ -324,16 +327,17 @@ namespace Phonon
}
}
- m_currentRender = Graph();
- m_currentRenderId = 0;
-
+ {
+ QMutexLocker locker(&m_mutex);
+ m_currentRender = Graph();
+ m_currentRenderId = 0;
+ }
}
- void WorkerThread::abortCurrentRender(qint16 renderId)
- {
+ void WorkerThread::abortCurrentRender(qint16 renderId)
+ {
QMutexLocker locker(&m_mutex);
bool found = false;
- //we try to see if there is already an attempt to seek and we remove it
for(int i = 0; !found && i < m_queue.size(); ++i) {
const Work &w = m_queue.at(i);
if (w.id == renderId) {
@@ -342,10 +346,10 @@ namespace Phonon
}
}
- if (m_currentRender && m_currentRenderId == renderId) {
- m_currentRender->Abort();
- }
- }
+ if (m_currentRender && m_currentRenderId == renderId) {
+ m_currentRender->Abort();
+ }
+ }
//tells the thread to stop processing
void WorkerThread::signalStop()
@@ -383,13 +387,13 @@ namespace Phonon
{
for(int i = 0; i < FILTER_COUNT; ++i) {
- m_graphs[i] = new MediaGraph(this, i);
+ m_graphs[i] = new MediaGraph(this, i);
}
- connect(&m_thread, SIGNAL(stateReady(Graph, Phonon::State)),
+ connect(&m_thread, SIGNAL(stateReady(Graph, Phonon::State)),
SLOT(slotStateReady(Graph, Phonon::State)));
- connect(&m_thread, SIGNAL(eventReady(Graph, long, long)),
+ connect(&m_thread, SIGNAL(eventReady(Graph, long, long)),
SLOT(handleEvents(Graph, long, long)));
connect(&m_thread, SIGNAL(asyncRenderFinished(quint16, HRESULT, Graph)),
@@ -484,7 +488,7 @@ namespace Phonon
}
if (!m_aboutToFinishSent && remaining < PRELOAD_TIME - m_transitionTime + TIMER_INTERVAL/2) {
- //let's take a 2 seconds time time to actually load the next file
+ //let's take a 2 seconds time to actually load the next file
#ifdef GRAPH_DEBUG
qDebug() << "DS9: emit aboutToFinish" << remaining << QTime::currentTime().toString();
#endif
@@ -573,7 +577,7 @@ namespace Phonon
{
#ifndef QT_NO_PHONON_MEDIACONTROLLER
//1st, check if there is more titles after
- const qint64 ret = (m_currentTitle < _iface_availableTitles() - 1) ?
+ const qint64 ret = (m_currentTitle < _iface_availableTitles() - 1) ?
titleAbsolutePosition(m_currentTitle+1) : currentGraph()->absoluteTotalTime();
//this is the duration of the current title
@@ -586,7 +590,7 @@ namespace Phonon
qint64 MediaObject::currentTime() const
{
//this handles inaccuracy when stopping on a title
- return currentGraph()->absoluteCurrentTime()
+ return currentGraph()->absoluteCurrentTime()
#ifndef QT_NO_PHONON_MEDIACONTROLLER
- titleAbsolutePosition(m_currentTitle)
#endif //QT_NO_PHONON_MEDIACONTROLLER
@@ -736,7 +740,7 @@ namespace Phonon
m_oldHasVideo = currentGraph()->hasVideo();
setState(Phonon::LoadingState);
//After loading we go into stopped state
- m_nextState = Phonon::StoppedState;
+ m_nextState = Phonon::StoppedState;
catchComError(currentGraph()->loadSource(source));
emit currentSourceChanged(source);
}
@@ -750,7 +754,7 @@ namespace Phonon
void MediaObject::loadingFinished(MediaGraph *mg)
{
- if (mg == currentGraph()) {
+ if (mg == currentGraph()) {
#ifndef QT_NO_PHONON_MEDIACONTROLLER
//Title interface
m_currentTitle = 0;
@@ -807,7 +811,7 @@ namespace Phonon
void MediaObject::seekingFinished(MediaGraph *mg)
{
- if (mg == currentGraph()) {
+ if (mg == currentGraph()) {
updateTargetTick();
if (currentTime() < totalTime() - m_prefinishMark) {
@@ -882,7 +886,7 @@ namespace Phonon
#ifndef QT_NO_PHONON_VIDEO
if (VideoWidget *video = qobject_cast<VideoWidget*>(sink)) {
m_videoWidgets += video;
- } else
+ } else
#endif //QT_NO_PHONON_VIDEO
if (AudioOutput *audio = qobject_cast<AudioOutput*>(sink)) {
m_audioOutputs += audio;
@@ -901,7 +905,7 @@ namespace Phonon
#ifndef QT_NO_PHONON_VIDEO
if (VideoWidget *video = qobject_cast<VideoWidget*>(sink)) {
m_videoWidgets.removeOne(video);
- } else
+ } else
#endif //QT_NO_PHONON_VIDEO
if (AudioOutput *audio = qobject_cast<AudioOutput*>(sink)) {
m_audioOutputs.removeOne(audio);
@@ -983,7 +987,7 @@ namespace Phonon
emit stateChanged(state(), m_state);
}
break;
- case EC_LENGTH_CHANGED:
+ case EC_LENGTH_CHANGED:
if (graph == currentGraph()->graph()) {
emit totalTimeChanged( totalTime() );
}
diff --git a/src/3rdparty/phonon/ds9/qaudiocdreader.cpp b/src/3rdparty/phonon/ds9/qaudiocdreader.cpp
index b9f9fd6..6d0f335 100644
--- a/src/3rdparty/phonon/ds9/qaudiocdreader.cpp
+++ b/src/3rdparty/phonon/ds9/qaudiocdreader.cpp
@@ -103,8 +103,8 @@ namespace Phonon
private:
HANDLE m_cddrive;
- CDROM_TOC *m_toc;
- WaveStructure *m_waveHeader;
+ CDROM_TOC m_toc;
+ WaveStructure m_waveHeader;
qint64 m_trackAddress;
};
@@ -112,19 +112,8 @@ namespace Phonon
#define SECTOR_SIZE 2352
#define NB_SECTORS_READ 20
- static AM_MEDIA_TYPE getAudioCDMediaType()
- {
- AM_MEDIA_TYPE mt;
- qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE));
- mt.majortype = MEDIATYPE_Stream;
- mt.subtype = MEDIASUBTYPE_WAVE;
- mt.bFixedSizeSamples = TRUE;
- mt.bTemporalCompression = FALSE;
- mt.lSampleSize = 1;
- mt.formattype = GUID_NULL;
- return mt;
- }
-
+ static const AM_MEDIA_TYPE audioCDMediaType = { MEDIATYPE_Stream, MEDIASUBTYPE_WAVE, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0};
+
int addressToSectors(UCHAR address[4])
{
return ((address[0] * 60 + address[1]) * 60 + address[2]) * 75 + address[3] - 150;
@@ -141,11 +130,8 @@ namespace Phonon
}
- QAudioCDReader::QAudioCDReader(QBaseFilter *parent, QChar drive) : QAsyncReader(parent, QVector<AM_MEDIA_TYPE>() << getAudioCDMediaType())
+ QAudioCDReader::QAudioCDReader(QBaseFilter *parent, QChar drive) : QAsyncReader(parent, QVector<AM_MEDIA_TYPE>() << audioCDMediaType)
{
- m_toc = new CDROM_TOC;
- m_waveHeader = new WaveStructure;
-
//now open the cd-drive
QString path;
if (drive.isNull()) {
@@ -154,36 +140,30 @@ namespace Phonon
path = QString::fromLatin1("\\\\.\\%1:").arg(drive);
}
- m_cddrive = QT_WA_INLINE (
- ::CreateFile( (TCHAR*)path.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ),
- ::CreateFileA( path.toLocal8Bit().constData(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL )
- );
+ m_cddrive = ::CreateFile((const wchar_t *)path.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
- qMemSet(m_toc, 0, sizeof(CDROM_TOC));
+ qMemSet(&m_toc, 0, sizeof(CDROM_TOC));
//read the TOC
DWORD bytesRead = 0;
- bool tocRead = ::DeviceIoControl(m_cddrive, IOCTL_CDROM_READ_TOC, 0, 0, m_toc, sizeof(CDROM_TOC), &bytesRead, 0);
+ bool tocRead = ::DeviceIoControl(m_cddrive, IOCTL_CDROM_READ_TOC, 0, 0, &m_toc, sizeof(CDROM_TOC), &bytesRead, 0);
if (!tocRead) {
qWarning("unable to load the TOC from the CD");
return;
}
- m_trackAddress = addressToSectors(m_toc->TrackData[0].Address);
- const qint32 nbSectorsToRead = (addressToSectors(m_toc->TrackData[m_toc->LastTrack + 1 - m_toc->FirstTrack].Address)
+ m_trackAddress = addressToSectors(m_toc.TrackData[0].Address);
+ const qint32 nbSectorsToRead = (addressToSectors(m_toc.TrackData[m_toc.LastTrack + 1 - m_toc.FirstTrack].Address)
- m_trackAddress);
const qint32 dataLength = nbSectorsToRead * SECTOR_SIZE;
- m_waveHeader->chunksize = 4 + (8 + m_waveHeader->chunksize2) + (8 + dataLength);
- m_waveHeader->dataLength = dataLength;
+ m_waveHeader.chunksize = 4 + (8 + m_waveHeader.chunksize2) + (8 + dataLength);
+ m_waveHeader.dataLength = dataLength;
}
QAudioCDReader::~QAudioCDReader()
{
::CloseHandle(m_cddrive);
- delete m_toc;
- delete m_waveHeader;
-
}
STDMETHODIMP_(ULONG) QAudioCDReader::AddRef()
@@ -199,7 +179,7 @@ namespace Phonon
STDMETHODIMP QAudioCDReader::Length(LONGLONG *total,LONGLONG *available)
{
- const LONGLONG length = sizeof(WaveStructure) + m_waveHeader->dataLength;
+ const LONGLONG length = sizeof(WaveStructure) + m_waveHeader.dataLength;
if (total) {
*total = length;
}
@@ -238,11 +218,11 @@ namespace Phonon
if (pos < sizeof(WaveStructure)) {
//we first copy the content of the structure
nbRead = qMin(LONG(sizeof(WaveStructure) - pos), length);
- qMemCopy(buffer, reinterpret_cast<char*>(m_waveHeader) + pos, nbRead);
+ qMemCopy(buffer, reinterpret_cast<char*>(&m_waveHeader) + pos, nbRead);
}
const LONGLONG posInTrack = pos - sizeof(WaveStructure) + nbRead;
- const int bytesLeft = qMin(m_waveHeader->dataLength - posInTrack, LONGLONG(length - nbRead));
+ const int bytesLeft = qMin(m_waveHeader.dataLength - posInTrack, LONGLONG(length - nbRead));
if (bytesLeft > 0) {
@@ -297,8 +277,8 @@ namespace Phonon
{
QList<qint64> ret;
ret << 0;
- for(int i = m_toc->FirstTrack; i <= m_toc->LastTrack ; ++i) {
- const uchar *address = m_toc->TrackData[i].Address;
+ for(int i = m_toc.FirstTrack; i <= m_toc.LastTrack ; ++i) {
+ const uchar *address = m_toc.TrackData[i].Address;
ret << ((address[0] * 60 + address[1]) * 60 + address[2]) * 1000 + address[3]*1000/75 - 2000;
}
diff --git a/src/3rdparty/phonon/ds9/qmeminputpin.cpp b/src/3rdparty/phonon/ds9/qmeminputpin.cpp
index 0af1bfd..dca99db 100644
--- a/src/3rdparty/phonon/ds9/qmeminputpin.cpp
+++ b/src/3rdparty/phonon/ds9/qmeminputpin.cpp
@@ -28,7 +28,7 @@ namespace Phonon
namespace DS9
{
- QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform) :
+ QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform) :
QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform)
{
}
@@ -203,7 +203,7 @@ namespace Phonon
for (int i = 0; i < m_outputs.count(); ++i) {
QPin *current = m_outputs.at(i);
- IMediaSample *outSample = m_shouldDuplicateSamples ?
+ IMediaSample *outSample = m_shouldDuplicateSamples ?
duplicateSampleForOutput(sample, current->memoryAllocator())
: sample;
@@ -261,7 +261,7 @@ namespace Phonon
}
//addition
- //this should be used by the filter to tell it's input pins to which output they should route the samples
+ //this should be used by the filter to tell its input pins to which output they should route the samples
void QMemInputPin::addOutput(QPin *output)
{
diff --git a/src/3rdparty/phonon/ds9/qpin.cpp b/src/3rdparty/phonon/ds9/qpin.cpp
index 37fe48d..68a4ec0 100644
--- a/src/3rdparty/phonon/ds9/qpin.cpp
+++ b/src/3rdparty/phonon/ds9/qpin.cpp
@@ -28,20 +28,7 @@ namespace Phonon
namespace DS9
{
- static const AM_MEDIA_TYPE defaultMediaType()
- {
- AM_MEDIA_TYPE ret;
- ret.majortype = MEDIATYPE_NULL;
- ret.subtype = MEDIASUBTYPE_NULL;
- ret.bFixedSizeSamples = TRUE;
- ret.bTemporalCompression = FALSE;
- ret.lSampleSize = 1;
- ret.formattype = GUID_NULL;
- ret.pUnk = 0;
- ret.cbFormat = 0;
- ret.pbFormat = 0;
- return ret;
- }
+ static const AM_MEDIA_TYPE defaultMediaType = { MEDIATYPE_NULL, MEDIASUBTYPE_NULL, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0};
class QEnumMediaTypes : public IEnumMediaTypes
{
@@ -159,7 +146,7 @@ namespace Phonon
QPin::QPin(QBaseFilter *parent, PIN_DIRECTION dir, const QVector<AM_MEDIA_TYPE> &mt) :
m_memAlloc(0), m_parent(parent), m_refCount(1), m_connected(0),
- m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType()),
+ m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType),
m_flushing(false)
{
Q_ASSERT(m_parent);
@@ -273,7 +260,7 @@ namespace Phonon
if (FAILED(hr)) {
setConnected(0);
- setConnectedType(defaultMediaType());
+ setConnectedType(defaultMediaType);
} else {
ComPointer<IMemInputPin> input(pin, IID_IMemInputPin);
if (input) {
@@ -315,10 +302,8 @@ namespace Phonon
}
setConnected(0);
- setConnectedType(defaultMediaType());
- if (m_direction == PINDIR_INPUT) {
- setMemoryAllocator(0);
- }
+ setConnectedType(defaultMediaType);
+ setMemoryAllocator(0);
return S_OK;
}
@@ -456,8 +441,8 @@ namespace Phonon
HRESULT QPin::checkOutputMediaTypesConnection(IPin *pin)
{
- IEnumMediaTypes *emt = 0;
- HRESULT hr = pin->EnumMediaTypes(&emt);
+ ComPointer<IEnumMediaTypes> emt;
+ HRESULT hr = pin->EnumMediaTypes(emt.pparam());
if (hr != S_OK) {
return hr;
}
@@ -470,7 +455,7 @@ namespace Phonon
freeMediaType(type);
return S_OK;
} else {
- setConnectedType(defaultMediaType());
+ setConnectedType(defaultMediaType);
freeMediaType(type);
}
}
diff --git a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp
index dd6e076..2112267 100644
--- a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp
+++ b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp
@@ -63,9 +63,9 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
static const char yv12ToRgb[] =
"!!ARBfp1.0"
"PARAM c[5] = { program.local[0..1],"
-" { 1.164, 0, 1.596, 0.5 },"
-" { 0.0625, 1.164, -0.391, -0.81300002 },"
-" { 1.164, 2.0179999, 0 } };"
+"{ 1.164, 0, 1.596, 0.5 },"
+"{ 0.0625, 1.164, -0.391, -0.81300002 },"
+"{ 1.164, 2.0179999, 0 } };"
"TEMP R0;"
"TEX R0.x, fragment.texcoord[0], texture[1], 2D;"
"ADD R0.y, R0.x, -c[2].w;"
@@ -89,11 +89,11 @@ static const char yv12ToRgb[] =
"END";
static const char yuy2ToRgb[] =
- "!!ARBfp1.0"
+"!!ARBfp1.0"
"PARAM c[5] = { program.local[0..1],"
-" { 0.5, 2, 1, 0.0625 },"
-" { 1.164, 0, 1.596, 2.0179999 },"
-" { 1.164, -0.391, -0.81300002 } };"
+"{ 0.5, 2, 1, 0.0625 },"
+"{ 1.164, 0, 1.596, 2.0179999 },"
+"{ 1.164, -0.391, -0.81300002 } };"
"TEMP R0;"
"TEMP R1;"
"TEMP R2;"
@@ -149,24 +149,16 @@ namespace Phonon
{
static const QVector<AM_MEDIA_TYPE> videoMediaTypes()
{
- AM_MEDIA_TYPE mt;
- qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE));
- mt.majortype = MEDIATYPE_Video;
-
- //we accept any video format
- mt.formattype = GUID_NULL;
- mt.cbFormat = 0;
- mt.pbFormat = 0;
+ AM_MEDIA_TYPE mt = { MEDIATYPE_Video, MEDIASUBTYPE_YV12, 0, 0, 0, GUID_NULL, 0, 0, 0 };
QVector<AM_MEDIA_TYPE> ret;
- //we support YUV (YV12 and YUY2) and RGB32
- mt.subtype = MEDIASUBTYPE_YV12;
- ret << mt;
+ //we add all the subtypes we support
+ ret << mt; //YV12
mt.subtype = MEDIASUBTYPE_YUY2;
- ret << mt;
+ ret << mt; //YUY2
mt.subtype = MEDIASUBTYPE_RGB32;
- ret << mt;
+ ret << mt; //RGB32
return ret;
}
diff --git a/src/3rdparty/phonon/ds9/videowidget.cpp b/src/3rdparty/phonon/ds9/videowidget.cpp
index 0ef653f..34ff8cb 100644
--- a/src/3rdparty/phonon/ds9/videowidget.cpp
+++ b/src/3rdparty/phonon/ds9/videowidget.cpp
@@ -153,7 +153,7 @@ namespace Phonon
}
} else if (!isEmbedded()) {
m_currentRenderer = m_node->switchRendering(m_currentRenderer);
- setAttribute(Qt::WA_PaintOnScreen, true);
+ setAttribute(Qt::WA_PaintOnScreen, false);
}
}
diff --git a/src/3rdparty/phonon/ds9/volumeeffect.cpp b/src/3rdparty/phonon/ds9/volumeeffect.cpp
index 2fd1afc..b9a5fce 100644
--- a/src/3rdparty/phonon/ds9/volumeeffect.cpp
+++ b/src/3rdparty/phonon/ds9/volumeeffect.cpp
@@ -68,17 +68,7 @@ namespace Phonon
static const QVector<AM_MEDIA_TYPE> audioMediaType()
{
QVector<AM_MEDIA_TYPE> ret;
-
- AM_MEDIA_TYPE mt;
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = MEDIASUBTYPE_PCM;
- mt.bFixedSizeSamples = 1;
- mt.bTemporalCompression = 0;
- mt.pUnk = 0;
- mt.lSampleSize = 1;
- mt.cbFormat = 0;
- mt.pbFormat = 0;
- mt.formattype = GUID_NULL;
+ AM_MEDIA_TYPE mt = { MEDIATYPE_Audio, MEDIASUBTYPE_PCM, 1, 0, 1, GUID_NULL, 0, 0, 0};
ret << mt;
return ret;
}
diff --git a/src/3rdparty/phonon/phonon/audiooutput.cpp b/src/3rdparty/phonon/phonon/audiooutput.cpp
index 752580a..00b2ebd 100644
--- a/src/3rdparty/phonon/phonon/audiooutput.cpp
+++ b/src/3rdparty/phonon/phonon/audiooutput.cpp
@@ -264,8 +264,8 @@ void AudioOutputPrivate::setupBackendObject()
if (deviceList.isEmpty()) {
return;
}
- foreach (int devIndex, deviceList) {
- const AudioOutputDevice &dev = AudioOutputDevice::fromIndex(devIndex);
+ for (int i = 0; i < deviceList.count(); ++i) {
+ const AudioOutputDevice &dev = AudioOutputDevice::fromIndex(deviceList.at(i));
if (callSetOutputDevice(this, dev)) {
handleAutomaticDeviceChange(dev, AudioOutputPrivate::FallbackChange);
return; // found one that works
@@ -305,8 +305,9 @@ void AudioOutputPrivate::_k_audioDeviceFailed()
pDebug() << Q_FUNC_INFO;
// outputDeviceIndex identifies a failing device
// fall back in the preference list of output devices
- QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices);
- foreach (int devIndex, deviceList) {
+ const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices);
+ for (int i = 0; i < deviceList.count(); ++i) {
+ const int devIndex = deviceList.at(i);
// if it's the same device as the one that failed, ignore it
if (device.index() != devIndex) {
const AudioOutputDevice &info = AudioOutputDevice::fromIndex(devIndex);
@@ -326,9 +327,10 @@ void AudioOutputPrivate::_k_deviceListChanged()
{
pDebug() << Q_FUNC_INFO;
// let's see if there's a usable device higher in the preference list
- QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings);
+ const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings);
DeviceChangeType changeType = HigherPreferenceChange;
- foreach (int devIndex, deviceList) {
+ for (int i = 0; i < deviceList.count(); ++i) {
+ const int devIndex = deviceList.at(i);
const AudioOutputDevice &info = AudioOutputDevice::fromIndex(devIndex);
if (!info.property("available").toBool()) {
if (device.index() == devIndex) {
diff --git a/src/3rdparty/phonon/phonon/backendcapabilities.cpp b/src/3rdparty/phonon/phonon/backendcapabilities.cpp
index 5dee6a0..62c9cc9 100644
--- a/src/3rdparty/phonon/phonon/backendcapabilities.cpp
+++ b/src/3rdparty/phonon/phonon/backendcapabilities.cpp
@@ -76,8 +76,8 @@ QList<AudioOutputDevice> BackendCapabilities::availableAudioOutputDevices()
{
QList<AudioOutputDevice> ret;
const QList<int> deviceIndexes = GlobalConfig().audioOutputDeviceListFor(Phonon::NoCategory);
- foreach (int i, deviceIndexes) {
- ret.append(AudioOutputDevice::fromIndex(i));
+ for (int i = 0; i < deviceIndexes.count(); ++i) {
+ ret.append(AudioOutputDevice::fromIndex(deviceIndexes.at(i)));
}
return ret;
}
@@ -88,8 +88,8 @@ QList<AudioCaptureDevice> BackendCapabilities::availableAudioCaptureDevices()
{
QList<AudioCaptureDevice> ret;
const QList<int> deviceIndexes = GlobalConfig().audioCaptureDeviceListFor(Phonon::NoCategory);
- foreach (int i, deviceIndexes) {
- ret.append(AudioCaptureDevice::fromIndex(i));
+ for (int i = 0; i < deviceIndexes.count(); ++i) {
+ ret.append(AudioCaptureDevice::fromIndex(deviceIndexes.at(i)));
}
return ret;
}
@@ -101,9 +101,9 @@ QList<EffectDescription> BackendCapabilities::availableAudioEffects()
BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend());
QList<EffectDescription> ret;
if (backendIface) {
- QList<int> deviceIndexes = backendIface->objectDescriptionIndexes(Phonon::EffectType);
- foreach (int i, deviceIndexes) {
- ret.append(EffectDescription::fromIndex(i));
+ const QList<int> deviceIndexes = backendIface->objectDescriptionIndexes(Phonon::EffectType);
+ for (int i = 0; i < deviceIndexes.count(); ++i) {
+ ret.append(EffectDescription::fromIndex(deviceIndexes.at(i)));
}
}
return ret;
diff --git a/src/3rdparty/phonon/phonon/backendcapabilities.h b/src/3rdparty/phonon/phonon/backendcapabilities.h
index 65b2830..36454a3 100644
--- a/src/3rdparty/phonon/phonon/backendcapabilities.h
+++ b/src/3rdparty/phonon/phonon/backendcapabilities.h
@@ -6,7 +6,7 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
- successor approved by the membership of KDE e.V.), Trolltech ASA
+ successor approved by the membership of KDE e.V.), Trolltech ASA
(or its successors, if any) and the KDE Free Qt Foundation, which shall
act as a proxy defined in Section 6 of version 3 of the license.
@@ -15,7 +15,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
+ You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -88,19 +88,18 @@ namespace BackendCapabilities
};
/**
- * Use this function to get a QObject pointer to connect to the capabilitiesChanged signal.
+ * Use this function to get a QObject pointer to connect to one of the Notifier signals.
*
* \return a pointer to a QObject.
*
- * The capabilitiesChanged signal is emitted if the capabilities have changed. This can
- * happen if the user has requested a backend change.
- *
- * To connect to this signal do the following:
+ * To connect to the signal do the following:
* \code
* QObject::connect(BackendCapabilities::notifier(), SIGNAL(capabilitiesChanged()), ...
* \endcode
*
* \see Notifier::capabilitiesChanged()
+ * \see Notifier::availableAudioOutputDevicesChanged()
+ * \see Notifier::availableAudioCaptureDevicesChanged()
*/
PHONON_EXPORT Notifier *notifier();
diff --git a/src/3rdparty/phonon/phonon/effect.cpp b/src/3rdparty/phonon/phonon/effect.cpp
index c125232..98662a5 100644
--- a/src/3rdparty/phonon/phonon/effect.cpp
+++ b/src/3rdparty/phonon/phonon/effect.cpp
@@ -107,7 +107,8 @@ bool EffectPrivate::aboutToDeleteBackendObject()
{
if (m_backendObject) {
const QList<EffectParameter> parameters = pINTERFACE_CALL(parameters());
- foreach (const EffectParameter &p, parameters) {
+ for (int i = 0; i < parameters.count(); ++i) {
+ const EffectParameter &p = parameters.at(i);
parameterValues[p] = pINTERFACE_CALL(parameterValue(p));
}
}
@@ -120,7 +121,8 @@ void EffectPrivate::setupBackendObject()
// set up attributes
const QList<EffectParameter> parameters = pINTERFACE_CALL(parameters());
- foreach (const EffectParameter &p, parameters) {
+ for (int i = 0; i < parameters.count(); ++i) {
+ const EffectParameter &p = parameters.at(i);
pINTERFACE_CALL(setParameterValue(p, parameterValues[p]));
}
}
diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp
index d5c6c81..99478f7 100644
--- a/src/3rdparty/phonon/phonon/effectwidget.cpp
+++ b/src/3rdparty/phonon/phonon/effectwidget.cpp
@@ -97,7 +97,8 @@ void EffectWidgetPrivate::autogenerateUi()
Q_Q(EffectWidget);
QVBoxLayout *mainLayout = new QVBoxLayout(q);
mainLayout->setMargin(0);
- foreach (const EffectParameter &para, effect->parameters()) {
+ for (int i = 0; i < effect->parameters().count(); ++i) {
+ const EffectParameter &para = effect->parameters().at(i);
QVariant value = effect->parameterValue(para);
QHBoxLayout *pLayout = new QHBoxLayout;
mainLayout->addLayout(pLayout);
@@ -117,13 +118,14 @@ void EffectWidgetPrivate::autogenerateUi()
control = cb;
if (value.type() == QVariant::Int) {
//value just defines the item index
- foreach (const QVariant &item, para.possibleValues()) {
- cb->addItem(item.toString());
+ for (int i = 0; i < para.possibleValues().count(); ++i) {
+ cb->addItem(para.possibleValues().at(i).toString());
}
cb->setCurrentIndex(value.toInt());
QObject::connect(cb, SIGNAL(currentIndexChanged(int)), q, SLOT(_k_setIntParameter(int)));
} else {
- foreach (const QVariant &item, para.possibleValues()) {
+ for (int i = 0; i < para.possibleValues().count(); ++i) {
+ const QVariant &item = para.possibleValues().at(i);
cb->addItem(item.toString());
if (item == value) {
cb->setCurrentIndex(cb->count() - 1);
diff --git a/src/3rdparty/phonon/phonon/factory.cpp b/src/3rdparty/phonon/phonon/factory.cpp
index 43c45ee..fef88f0 100644
--- a/src/3rdparty/phonon/phonon/factory.cpp
+++ b/src/3rdparty/phonon/phonon/factory.cpp
@@ -124,15 +124,18 @@ bool FactoryPrivate::createBackend()
// could not load a backend through the platform plugin. Falling back to the default
// (finding the first loadable backend).
const QLatin1String suffix("/phonon_backend/");
- foreach (QString libPath, QCoreApplication::libraryPaths()) {
- libPath += suffix;
+ const QStringList paths = QCoreApplication::libraryPaths();
+ for (int i = 0; i < paths.count(); ++i) {
+ const QString libPath = paths.at(i) + suffix;
const QDir dir(libPath);
if (!dir.exists()) {
pDebug() << Q_FUNC_INFO << dir.absolutePath() << "does not exist";
continue;
}
- foreach (const QString &pluginName, dir.entryList(QDir::Files)) {
- QPluginLoader pluginLoader(libPath + pluginName);
+
+ const QStringList files = dir.entryList(QDir::Files);
+ for (int i = 0; i < files.count(); ++i) {
+ QPluginLoader pluginLoader(libPath + files.at(i));
if (!pluginLoader.load()) {
pDebug() << Q_FUNC_INFO << " load failed:"
<< pluginLoader.errorString();
@@ -183,14 +186,8 @@ FactoryPrivate::FactoryPrivate()
FactoryPrivate::~FactoryPrivate()
{
- foreach (QObject *o, objects) {
- MediaObject *m = qobject_cast<MediaObject *>(o);
- if (m) {
- m->stop();
- }
- }
- foreach (MediaNodePrivate *bp, mediaNodePrivateList) {
- bp->deleteBackendObject();
+ for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
+ mediaNodePrivateList.at(i)->deleteBackendObject();
}
if (objects.size() > 0) {
pError() << "The backend objects are not deleted as was requested.";
@@ -258,8 +255,8 @@ void Factory::deregisterFrontendObject(MediaNodePrivate *bp)
void FactoryPrivate::phononBackendChanged()
{
if (m_backendObject) {
- foreach (MediaNodePrivate *bp, mediaNodePrivateList) {
- bp->deleteBackendObject();
+ for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
+ mediaNodePrivateList.at(i)->deleteBackendObject();
}
if (objects.size() > 0) {
pDebug() << "WARNING: we were asked to change the backend but the application did\n"
@@ -268,8 +265,8 @@ void FactoryPrivate::phononBackendChanged()
"backendswitching possible.";
// in case there were objects deleted give 'em a chance to recreate
// them now
- foreach (MediaNodePrivate *bp, mediaNodePrivateList) {
- bp->createBackendObject();
+ for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
+ mediaNodePrivateList.at(i)->createBackendObject();
}
return;
}
@@ -277,8 +274,8 @@ void FactoryPrivate::phononBackendChanged()
m_backendObject = 0;
}
createBackend();
- foreach (MediaNodePrivate *bp, mediaNodePrivateList) {
- bp->createBackendObject();
+ for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
+ mediaNodePrivateList.at(i)->createBackendObject();
}
emit backendChanged();
}
@@ -362,15 +359,17 @@ PlatformPlugin *FactoryPrivate::platformPlugin()
QStringList())
);
dir.setFilter(QDir::Files);
+ const QStringList libPaths = QCoreApplication::libraryPaths();
forever {
- foreach (QString libPath, QCoreApplication::libraryPaths()) {
- libPath += suffix;
+ for (int i = 0; i < libPaths.count(); ++i) {
+ const QString libPath = libPaths.at(i) + suffix;
dir.setPath(libPath);
if (!dir.exists()) {
continue;
}
- foreach (const QString &pluginName, dir.entryList()) {
- QPluginLoader pluginLoader(libPath + pluginName);
+ const QStringList files = dir.entryList(QDir::Files);
+ for (int i = 0; i < files.count(); ++i) {
+ QPluginLoader pluginLoader(libPath + files.at(i));
if (!pluginLoader.load()) {
pDebug() << Q_FUNC_INFO << " platform plugin load failed:"
<< pluginLoader.errorString();
diff --git a/src/3rdparty/phonon/phonon/medianode.cpp b/src/3rdparty/phonon/phonon/medianode.cpp
index 4693cb8..63fa2e3 100644
--- a/src/3rdparty/phonon/phonon/medianode.cpp
+++ b/src/3rdparty/phonon/phonon/medianode.cpp
@@ -67,8 +67,8 @@ bool MediaNode::isValid() const
MediaNodePrivate::~MediaNodePrivate()
{
- foreach (MediaNodeDestructionHandler *handler, handlers) {
- handler->phononObjectDestroyed(this);
+ for (int i = 0 ; i < handlers.count(); ++i) {
+ handlers.at(i)->phononObjectDestroyed(this);
}
Factory::deregisterFrontendObject(this);
delete m_backendObject;
diff --git a/src/3rdparty/phonon/phonon/mediaobject.cpp b/src/3rdparty/phonon/phonon/mediaobject.cpp
index de5fbc8..10fefbd 100644
--- a/src/3rdparty/phonon/phonon/mediaobject.cpp
+++ b/src/3rdparty/phonon/phonon/mediaobject.cpp
@@ -300,15 +300,15 @@ void MediaObject::enqueue(const MediaSource &source)
void MediaObject::enqueue(const QList<MediaSource> &sources)
{
- foreach (const MediaSource &m, sources) {
- enqueue(m);
+ for (int i = 0; i < sources.count(); ++i) {
+ enqueue(sources.at(i));
}
}
void MediaObject::enqueue(const QList<QUrl> &urls)
{
- foreach (const QUrl &url, urls) {
- enqueue(url);
+ for (int i = 0; i < urls.count(); ++i) {
+ enqueue(urls.at(i));
}
}
@@ -502,8 +502,8 @@ void MediaObjectPrivate::setupBackendObject()
}
#ifndef QT_NO_PHONON_MEDIACONTROLLER
- foreach (FrontendInterfacePrivate *f, interfaceList) {
- f->_backendObjectChanged();
+ for (int i = 0 ; i < interfaceList.count(); ++i) {
+ interfaceList.at(i)->_backendObjectChanged();
}
#endif //QT_NO_PHONON_MEDIACONTROLLER
diff --git a/src/3rdparty/phonon/phonon/mediaobject.h b/src/3rdparty/phonon/phonon/mediaobject.h
index 5cbddbb..c56b6b5 100644
--- a/src/3rdparty/phonon/phonon/mediaobject.h
+++ b/src/3rdparty/phonon/phonon/mediaobject.h
@@ -6,7 +6,7 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
- successor approved by the membership of KDE e.V.), Trolltech ASA
+ successor approved by the membership of KDE e.V.), Trolltech ASA
(or its successors, if any) and the KDE Free Qt Foundation, which shall
act as a proxy defined in Section 6 of version 3 of the license.
@@ -15,7 +15,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
+ You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -58,7 +58,7 @@ namespace Phonon
* media->play();
* \endcode
*
- * If you want to play more that one media file (one after another) you can
+ * If you want to play more than one media file (one after another) you can
* either tell MediaObject about all those files
* \code
* media->setCurrentSource(":/sounds/startsound.ogg");
@@ -198,18 +198,18 @@ namespace Phonon
* Check whether the current media may be seeked.
*
* \warning This information cannot be known immediately. It is best
- * to also listen to the hasVideoChanged signal.
+ * to also listen to the seekableChanged signal.
*
* \code
- * connect(media, SIGNAL(hasVideoChanged(bool)), hasVideoChanged(bool));
+ * connect(media, SIGNAL(seekableChanged(bool)), seekableChanged(bool));
* media->setCurrentSource("somevideo.avi");
- * media->hasVideo(); // returns false;
+ * media->isSeekable(); // returns false;
* }
*
- * void hasVideoChanged(bool b)
+ * void seekableChanged(bool b)
* {
* // b == true
- * media->hasVideo(); // returns true;
+ * media->isSeekable(); // returns true;
* }
* \endcode
*
@@ -301,7 +301,7 @@ namespace Phonon
void setCurrentSource(const MediaSource &source);
/**
- * Returns the queued media sources. This does list does not include
+ * Returns the queued media sources. This list does not include
* the current source (returned by currentSource).
*/
QList<MediaSource> queue() const;
@@ -456,8 +456,6 @@ namespace Phonon
Q_SIGNALS:
/**
* Emitted when the state of the MediaObject has changed.
- * In case you're not interested in the old state you can also
- * connect to a slot that only has one State argument.
*
* @param newstate The state the Player is in now.
* @param oldstate The state the Player was in before.
@@ -587,7 +585,7 @@ namespace Phonon
/**
* This signal is emitted as soon as the total time of the media file is
* known or has changed. For most non-local media data the total
- * time of the media can only be known after some time. At that time the
+ * time of the media can only be known after some time. Initially the
* totalTime function can not return useful information. You have
* to wait for this signal to know the real total time.
*
diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp b/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp
index e989d0c..b67344f 100644
--- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp
+++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp
@@ -321,8 +321,8 @@ bool ObjectDescriptionModelData::dropMimeData(ObjectDescriptionType type, const
}
}
d->model->beginInsertRows(QModelIndex(), row, row + toInsert.size() - 1);
- foreach (const QExplicitlySharedDataPointer<ObjectDescriptionData> &obj, toInsert) {
- d->data.insert(row, obj);
+ for (int i = 0 ; i < toInsert.count(); ++i) {
+ d->data.insert(row, toInsert.at(i));
}
d->model->endInsertRows();
return true;
diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h
index 84dc0bb..ba3cb42 100644
--- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h
+++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h
@@ -292,8 +292,8 @@ namespace Phonon
*/
inline void setModelData(const QList<ObjectDescription<type> > &data) { //krazy:exclude=inline
QList<QExplicitlySharedDataPointer<ObjectDescriptionData> > list;
- Q_FOREACH (const ObjectDescription<type> &desc, data) {
- list << desc.d;
+ for (int i = 0; i < data.count(); ++i) {
+ list += data.at(i).d;
}
d->setModelData(list);
}
@@ -307,8 +307,8 @@ namespace Phonon
inline QList<ObjectDescription<type> > modelData() const { //krazy:exclude=inline
QList<ObjectDescription<type> > ret;
QList<QExplicitlySharedDataPointer<ObjectDescriptionData> > list = d->modelData();
- Q_FOREACH (const QExplicitlySharedDataPointer<ObjectDescriptionData> &data, list) {
- ret << ObjectDescription<type>(data);
+ for (int i = 0; i < list.count(); ++i) {
+ ret << ObjectDescription<type>(list.at(i));
}
return ret;
}
diff --git a/src/3rdparty/phonon/phonon/path.cpp b/src/3rdparty/phonon/phonon/path.cpp
index b46d30a..aec8d05 100644
--- a/src/3rdparty/phonon/phonon/path.cpp
+++ b/src/3rdparty/phonon/phonon/path.cpp
@@ -58,8 +58,8 @@ class ConnectionTransaction
PathPrivate::~PathPrivate()
{
#ifndef QT_NO_PHONON_EFFECT
- foreach (Effect *e, effects) {
- e->k_ptr->removeDestructionHandler(this);
+ for (int i = 0; i < effects.count(); ++i) {
+ effects.at(i)->k_ptr->removeDestructionHandler(this);
}
delete effectsParent;
#endif
@@ -233,8 +233,8 @@ bool Path::disconnect()
if (d->sourceNode)
list << d->sourceNode->k_ptr->backendObject();
#ifndef QT_NO_PHONON_EFFECT
- foreach(Effect *e, d->effects) {
- list << e->k_ptr->backendObject();
+ for (int i = 0; i < d->effects.count(); ++i) {
+ list << d->effects.at(i)->k_ptr->backendObject();
}
#endif
if (d->sinkNode) {
@@ -260,8 +260,8 @@ bool Path::disconnect()
d->sourceNode = 0;
#ifndef QT_NO_PHONON_EFFECT
- foreach(Effect *e, d->effects) {
- e->k_ptr->removeDestructionHandler(d.data());
+ for (int i = 0; i < d->effects.count(); ++i) {
+ d->effects.at(i)->k_ptr->removeDestructionHandler(d.data());
}
d->effects.clear();
#endif
@@ -292,11 +292,13 @@ MediaNode *Path::sink() const
bool PathPrivate::executeTransaction( const QList<QObjectPair> &disconnections, const QList<QObjectPair> &connections)
{
QSet<QObject*> nodesForTransaction;
- foreach(const QObjectPair &pair, disconnections) {
+ for (int i = 0; i < disconnections.count(); ++i) {
+ const QObjectPair &pair = disconnections.at(i);
nodesForTransaction << pair.first;
nodesForTransaction << pair.second;
}
- foreach(const QObjectPair &pair, connections) {
+ for (int i = 0; i < connections.count(); ++i) {
+ const QObjectPair &pair = connections.at(i);
nodesForTransaction << pair.first;
nodesForTransaction << pair.second;
}
@@ -338,7 +340,8 @@ bool PathPrivate::executeTransaction( const QList<QObjectPair> &disconnections,
}
//and now let's reconnect the nodes that were disconnected: rollback
- foreach(const QObjectPair &pair, disconnections) {
+ for (int i = 0; i < disconnections.count(); ++i) {
+ const QObjectPair &pair = disconnections.at(i);
bool success = backend->connectNodes(pair.first, pair.second);
Q_ASSERT(success); //a failure here means it is impossible to reestablish the connection
Q_UNUSED(success);
@@ -417,7 +420,8 @@ void PathPrivate::phononObjectDestroyed(MediaNodePrivate *mediaNodePrivate)
sinkNode = 0;
} else {
#ifndef QT_NO_PHONON_EFFECT
- foreach (Effect *e, effects) {
+ for (int i = 0; i < effects.count(); ++i) {
+ Effect *e = effects.at(i);
if (e->k_ptr == mediaNodePrivate) {
removeEffect(e);
}
diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog
index f2cc9a2..fa8e3ff 100644
--- a/src/3rdparty/webkit/ChangeLog
+++ b/src/3rdparty/webkit/ChangeLog
@@ -1,3 +1,72 @@
+2009-07-13 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Build fix for QtWebKit on Win
+ https://bugs.webkit.org/show_bug.cgi?id=27205
+
+ * WebKit.pri: Include the major version number in the QtWebKit
+ library file for Win.
+
+2009-07-13 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Add the test netscape plugin for the Qt DRT to the build.
+
+ * WebKit.pro:
+
+2009-07-13 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs
+ https://bugs.webkit.org/show_bug.cgi?id=26932
+
+ Added ENABLE(SHARED_WORKERS) flag.
+
+ * configure.ac:
+
+2009-07-12 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Bump version in preparation for 1.1.11 release.
+
+ * configure.ac:
+
+2009-07-07 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Exclude DumpRenderTree.pro from symbian build
+
+ * WebKit.pro:
+
+2009-07-09 Drew Wilson <atwilson@google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26903
+
+ Turned on CHANNEL_MESSAGING by default because the MessageChannel API
+ can now be implemented for Web Workers and is reasonably stable.
+
+ * configure.ac: enable CHANNEL_MESSAGING.
+
+2009-07-03 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Xan Lopez and Gustavo Noronha.
+
+ Set user-agent from application
+ https://bugs.webkit.org/show_bug.cgi?id=17375
+
+ Define UA version macros to be used by the UA string.
+ Add new WebSettings unit test for the User-Agent string API.
+
+ * GNUmakefile.am:
+ * configure.ac:
+
2009-06-20 Gustavo Noronha Silva <gns@gnome.org>
Reviewed by Jan Alonzo.
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index c8bba0f..cd46bf5 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,464 @@
+2009-07-13 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed make dist build fix.
+
+ * GNUmakefile.am:
+
+2009-07-13 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs
+ https://bugs.webkit.org/show_bug.cgi?id=26932
+
+ Added ENABLE(SHARED_WORKERS) flag (off by default).
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-07-07 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Maciej Stachoviak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27058
+
+ Removed superfluous parenthesis around single expression.
+ Compilers on Symbian platform fail to properly parse and compile.
+
+ * JavaScriptCore/wtf/Platform.h:
+
+2009-07-13 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Maciej Stachoviak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27054
+
+ Renamed Translator to HashTranslator
+
+ Codewarrior compiler (WINSCW) latest b482 cannot resolve typename
+ mismatch between template declaration and definition
+ (HashTranslator / Translator)
+
+ * wtf/HashSet.h:
+
+2009-07-13 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27053
+
+ Ambiguity in LabelScope initialization
+
+ Codewarrior compiler (WINSCW) latest b482 on Symbian cannot resolve
+ type of "0" unambiguously. Set expression explicitly to
+ PassRefPtr<Label>::PassRefPtr()
+
+ * bytecompiler/BytecodeGenerator.cpp
+
+2009-07-11 Simon Fraser <simon.fraser@apple.com>
+
+ Enable support for accelerated compositing and 3d transforms on Leopard.
+ <https://bugs.webkit.org/show_bug.cgi?id=20166>
+ <rdar://problem/6120614>
+
+ Reviewed by Oliver Hunt.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * wtf/Platform.h:
+
+2009-07-10 Mark Rowe <mrowe@apple.com>
+
+ Second part of the "make Windows happier" dance.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-10 Mark Rowe <mrowe@apple.com>
+
+ Try and make the Windows build happy.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-10 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ * debugger/Debugger.h: Made this function virtual for use in WebCore's
+ WebInspector.
+
+2009-07-10 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ ParserArenaDeletable should override delete
+ https://bugs.webkit.org/show_bug.cgi?id=26790
+
+ ParserArenaDeletable overrides new, but it does not override delete.
+ ParserArenaDeletable must be freed by fastFree
+ because it is allocated by fastMalloc.
+
+ * parser/NodeConstructors.h:
+ (JSC::ParserArenaDeletable::operator delete):
+ * parser/Nodes.h:
+
+2009-07-10 Adam Roben <aroben@apple.com>
+
+ Sort all our Xcode projects
+
+ Accomplished using sort-Xcode-project-file.
+
+ Requested by Dave Kilzer.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-07-09 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ Windows build fix for the last change.
+
+ * wtf/dtoa.cpp: Forgot to include Vector.h
+
+2009-07-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION: crash in edge cases of floating point parsing.
+ https://bugs.webkit.org/show_bug.cgi?id=27110
+ <rdar://problem/7044458>
+
+ Tests: fast/css/number-parsing-crash.html
+ fast/css/number-parsing-crash.html
+ fast/js/number-parsing-crash.html
+
+ * wtf/dtoa.cpp:
+ (WTF::BigInt::BigInt): Converted this to more a proper class, using a Vector
+ with inline capacity
+
+ (WTF::lshift): Rearranged logic somewhat nontrivially to deal with the new way of sizing BigInts.
+ Added an assertion to verify that invariants are maintained.
+
+ All other functions are adapted fairly mechanically to the above changes.
+ (WTF::BigInt::clear):
+ (WTF::BigInt::size):
+ (WTF::BigInt::resize):
+ (WTF::BigInt::words):
+ (WTF::BigInt::append):
+ (WTF::multadd):
+ (WTF::s2b):
+ (WTF::i2b):
+ (WTF::mult):
+ (WTF::cmp):
+ (WTF::diff):
+ (WTF::b2d):
+ (WTF::d2b):
+ (WTF::ratio):
+ (WTF::strtod):
+ (WTF::quorem):
+ (WTF::dtoa):
+
+2009-07-09 Drew Wilson <atwilson@google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Turned on CHANNEL_MESSAGING by default because the MessageChannel API
+ can now be implemented for Web Workers and is reasonably stable.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-07-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-07-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 27016 - Interpreter crashes due to invalid array indexes
+ <https://bugs.webkit.org/show_bug.cgi?id=27016>
+
+ Unsigned vs signed conversions results in incorrect behaviour in
+ 64bit interpreter builds.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-07-09 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Upstream JavaScriptCore.gypi, the project file for Chromium build.
+ https://bugs.webkit.org/show_bug.cgi?id=27135
+
+ * JavaScriptCore.gypi: Added.
+
+2009-07-09 Joe Mason <joe.mason@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Authors: Yong Li <yong.li@torchmobile.com>, Joe Mason <joe.mason@torchmobile.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=27031
+ Add an override for deleteOwnedPtr(HDC) on Windows
+
+ * wtf/OwnPtrCommon.h:
+ * wtf/OwnPtrWin.cpp:
+ (WTF::deleteOwnedPtr):
+
+2009-07-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Guard singal.h dependency with HAVE(SIGNAL_H) to enable building jsc
+ on SYMBIAN.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27026
+
+ Based on Norbert Leser's work.
+
+ * jsc.cpp:
+ (printUsageStatement):
+ (parseArguments):
+ * wtf/Platform.h:
+
+2009-07-07 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Stop loading constants into the register file.
+
+ Instead, use high register values (highest bit bar the sign bit set) to indicate
+ constants in the instruction stream, and when we encounter such a value load it
+ directly from the CodeBlock.
+
+ Since constants are no longer copied into the register file, this patch renders
+ the 'unexpected constant' mechanism redundant, and removes it.
+
+ 2% improvement, thanks to Sam Weinig.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::mark):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::isTemporaryRegisterIndex):
+ (JSC::CodeBlock::constantRegister):
+ (JSC::CodeBlock::isConstantRegisterIndex):
+ (JSC::CodeBlock::getConstant):
+ (JSC::ExecState::r):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::preserveLastVar):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::addConstantValue):
+ (JSC::BytecodeGenerator::emitEqualityOp):
+ (JSC::BytecodeGenerator::emitLoad):
+ (JSC::BytecodeGenerator::emitResolveBase):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ (JSC::BytecodeGenerator::emitNewError):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitNode):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::noCaller):
+ (JSC::ExecState::hasHostCallFrameFlag):
+ (JSC::ExecState::addHostCallFrameFlag):
+ (JSC::ExecState::removeHostCallFrameFlag):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::resolveBaseAndFunc):
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoadDouble):
+ (JSC::JIT::emitLoadInt32ToDouble):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_new_error):
+ (JSC::JIT::emit_op_enter):
+ (JSC::JIT::emit_op_enter_with_activation):
+ * parser/Nodes.cpp:
+ (JSC::DeleteResolveNode::emitBytecode):
+ (JSC::DeleteValueNode::emitBytecode):
+ (JSC::PrefixResolveNode::emitBytecode):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ * wtf/Platform.h:
+
+2009-07-07 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix <https://bugs.webkit.org/show_bug.cgi?id=27025> / <rdar://problem/7033448>.
+ Bug 27025: Crashes and regression test failures related to regexps in 64-bit
+
+ For x86_64 RegexGenerator uses rbx, a callee-save register, as a scratch register but
+ neglects to save and restore it. The change in handling of the output vector in r45545
+ altered code generation so that the RegExp::match was now storing important data in rbx,
+ which caused crashes and bogus results when it was clobbered.
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter): Save rbx.
+ (JSC::Yarr::RegexGenerator::generateReturn): Restore rbx.
+
+2009-07-06 Ada Chan <adachan@apple.com>
+
+ Reviewed by Darin Adler and Mark Rowe.
+
+ Decommitted spans are added to the list of normal spans rather than
+ the returned spans in TCMalloc_PageHeap::Delete().
+ https://bugs.webkit.org/show_bug.cgi?id=26998
+
+ In TCMalloc_PageHeap::Delete(), the deleted span can be decommitted in
+ the process of merging with neighboring spans that are also decommitted.
+ The merged span needs to be placed in the list of returned spans (spans
+ whose memory has been returned to the system). Right now it's always added
+ to the list of the normal spans which can theoretically cause thrashing.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::Delete):
+
+2009-07-05 Lars Knoll <lars.knoll@nokia.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26843
+
+ Fix run-time crashes in JavaScriptCore with the Metrowerks compiler on Symbian.
+
+ The Metrowerks compiler on the Symbian platform moves the globally
+ defined Hashtables into read-only memory, despite one of the members
+ being mutable. This causes crashes at run-time due to write access to
+ read-only memory.
+
+ Avoid the use of const with this compiler by introducing the
+ JSC_CONST_HASHTABLE macro.
+
+ Based on idea by Norbert Leser.
+
+ * runtime/Lookup.h: Define JSC_CONST_HASHTABLE as const for !WINSCW.
+ * create_hash_table: Use JSC_CONST_HASHTABLE for hashtables.
+ * runtime/JSGlobalData.cpp: Import various global hashtables via the macro.
+
+2009-07-04 Dan Bernstein <mitz@apple.com>
+
+ - debug build fix
+
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::getLastParen):
+
+2009-07-03 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by Maciej Stachowiak (and revised slightly)
+
+ RegExp::match to be optimized
+ https://bugs.webkit.org/show_bug.cgi?id=26957
+
+ Allow regexp matching to use Vectors with inline capacity instead of
+ allocating a new ovector buffer every time.
+
+ ~5% speedup on SunSpider string-unpack-code test, 0.3% on SunSpider overall.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructorPrivate::RegExpConstructorPrivate):
+ (JSC::RegExpConstructorPrivate::lastOvector):
+ (JSC::RegExpConstructorPrivate::tempOvector):
+ (JSC::RegExpConstructorPrivate::changeLastOvector):
+ (JSC::RegExpConstructor::performMatch):
+ (JSC::RegExpMatchesArray::RegExpMatchesArray):
+ (JSC::RegExpMatchesArray::fillArrayInstance):
+ (JSC::RegExpConstructor::getBackref):
+ (JSC::RegExpConstructor::getLastParen):
+ (JSC::RegExpConstructor::getLeftContext):
+ (JSC::RegExpConstructor::getRightContext):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncSplit):
+
+2009-06-30 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ Override operator new/delete with const std::nothrow_t& as the second
+ argument.
+ https://bugs.webkit.org/show_bug.cgi?id=26792
+
+ On Windows CE, operator new/delete, new[]/delete[] with const
+ std::nothrow_t& must be overrided because some standard template
+ libraries use these operators.
+
+ The problem occurs when memory allocated by new(size_t s, const
+ std::nothrow_t&) is freed by delete(void* p). This causes the umatched
+ malloc/free problem.
+
+ The patch overrides all new, delete, new[] and delete[] to use
+ fastMaloc and fastFree consistently.
+
+ * wtf/FastMalloc.h:
+ (throw):
+
+2009-06-30 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Sam Weinig.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=24986>
+
+ Remove unnecessary references to AssemblerBuffer.
+
+ * interpreter/Interpreter.cpp:
+ * interpreter/Interpreter.h:
+
+2009-06-29 David Levin <levin@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ Still seeing occasional leaks from UString::sharedBuffer code
+ https://bugs.webkit.org/show_bug.cgi?id=26420
+
+ The problem is that the pointer to the memory allocation isn't visible
+ by "leaks" due to the lower bits being used as flags. The fix is to
+ make the pointer visible in memory (in debug only). The downside of
+ this fix that the memory allocated by sharedBuffer will still look like
+ a leak in non-debug builds when any flags are set.
+
+ * wtf/PtrAndFlags.h:
+ (WTF::PtrAndFlags::set):
+
+2009-06-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Remove more unused scons support.
+
+ * SConstruct: Removed.
+
+2009-06-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/7016214> JSON.parse fails to parse valid JSON with most Unicode characters
+ <https://bugs.webkit.org/show_bug.cgi?id=26802>
+
+ In the original JSON.parse patch unicode was handled correctly, however in some last
+ minute "clean up" I oversimplified isSafeStringCharacter. This patch corrects this bug.
+
+ * runtime/LiteralParser.cpp:
+ (JSC::isSafeStringCharacter):
+ (JSC::LiteralParser::Lexer::lexString):
+
2009-06-26 Oliver Hunt <oliver@apple.com>
Reviewed by Dan Bernstein.
diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi
new file mode 100644
index 0000000..2d69c7d
--- /dev/null
+++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi
@@ -0,0 +1,452 @@
+{
+ 'variables': {
+ 'javascriptcore_files': [
+ 'AllInOneFile.cpp',
+ 'API/APICast.h',
+ 'API/JavaScript.h',
+ 'API/JavaScriptCore.h',
+ 'API/JSBase.cpp',
+ 'API/JSBase.h',
+ 'API/JSBasePrivate.h',
+ 'API/JSCallbackConstructor.cpp',
+ 'API/JSCallbackConstructor.h',
+ 'API/JSCallbackFunction.cpp',
+ 'API/JSCallbackFunction.h',
+ 'API/JSCallbackObject.cpp',
+ 'API/JSCallbackObject.h',
+ 'API/JSCallbackObjectFunctions.h',
+ 'API/JSClassRef.cpp',
+ 'API/JSClassRef.h',
+ 'API/JSContextRef.cpp',
+ 'API/JSContextRef.h',
+ 'API/JSObjectRef.cpp',
+ 'API/JSObjectRef.h',
+ 'API/JSProfilerPrivate.cpp',
+ 'API/JSProfilerPrivate.h',
+ 'API/JSRetainPtr.h',
+ 'API/JSStringRef.cpp',
+ 'API/JSStringRef.h',
+ 'API/JSStringRefBSTR.cpp',
+ 'API/JSStringRefBSTR.h',
+ 'API/JSStringRefCF.cpp',
+ 'API/JSStringRefCF.h',
+ 'API/JSValueRef.cpp',
+ 'API/JSValueRef.h',
+ 'API/OpaqueJSString.cpp',
+ 'API/OpaqueJSString.h',
+ 'API/tests/JSNode.h',
+ 'API/tests/JSNodeList.h',
+ 'API/tests/Node.h',
+ 'API/tests/NodeList.h',
+ 'API/WebKitAvailability.h',
+ 'assembler/AbstractMacroAssembler.h',
+ 'assembler/ARMv7Assembler.h',
+ 'assembler/AssemblerBuffer.h',
+ 'assembler/CodeLocation.h',
+ 'assembler/MacroAssembler.h',
+ 'assembler/MacroAssemblerARMv7.h',
+ 'assembler/MacroAssemblerCodeRef.h',
+ 'assembler/MacroAssemblerX86.h',
+ 'assembler/MacroAssemblerX86_64.h',
+ 'assembler/MacroAssemblerX86Common.h',
+ 'assembler/X86Assembler.h',
+ 'bytecode/CodeBlock.cpp',
+ 'bytecode/CodeBlock.h',
+ 'bytecode/EvalCodeCache.h',
+ 'bytecode/Instruction.h',
+ 'bytecode/JumpTable.cpp',
+ 'bytecode/JumpTable.h',
+ 'bytecode/Opcode.cpp',
+ 'bytecode/Opcode.h',
+ 'bytecode/SamplingTool.cpp',
+ 'bytecode/SamplingTool.h',
+ 'bytecode/StructureStubInfo.cpp',
+ 'bytecode/StructureStubInfo.h',
+ 'bytecompiler/BytecodeGenerator.cpp',
+ 'bytecompiler/BytecodeGenerator.h',
+ 'bytecompiler/Label.h',
+ 'bytecompiler/LabelScope.h',
+ 'bytecompiler/RegisterID.h',
+ 'config.h',
+ 'debugger/Debugger.cpp',
+ 'debugger/Debugger.h',
+ 'debugger/DebuggerActivation.cpp',
+ 'debugger/DebuggerActivation.h',
+ 'debugger/DebuggerCallFrame.cpp',
+ 'debugger/DebuggerCallFrame.h',
+ 'icu/unicode/parseerr.h',
+ 'icu/unicode/platform.h',
+ 'icu/unicode/putil.h',
+ 'icu/unicode/uchar.h',
+ 'icu/unicode/ucnv.h',
+ 'icu/unicode/ucnv_err.h',
+ 'icu/unicode/ucol.h',
+ 'icu/unicode/uconfig.h',
+ 'icu/unicode/uenum.h',
+ 'icu/unicode/uiter.h',
+ 'icu/unicode/uloc.h',
+ 'icu/unicode/umachine.h',
+ 'icu/unicode/unorm.h',
+ 'icu/unicode/urename.h',
+ 'icu/unicode/uset.h',
+ 'icu/unicode/ustring.h',
+ 'icu/unicode/utf.h',
+ 'icu/unicode/utf16.h',
+ 'icu/unicode/utf8.h',
+ 'icu/unicode/utf_old.h',
+ 'icu/unicode/utypes.h',
+ 'icu/unicode/uversion.h',
+ 'interpreter/CachedCall.h',
+ 'interpreter/CallFrame.cpp',
+ 'interpreter/CallFrame.h',
+ 'interpreter/CallFrameClosure.h',
+ 'interpreter/Interpreter.cpp',
+ 'interpreter/Interpreter.h',
+ 'interpreter/Register.h',
+ 'interpreter/RegisterFile.cpp',
+ 'interpreter/RegisterFile.h',
+ 'JavaScriptCorePrefix.h',
+ 'jit/ExecutableAllocator.cpp',
+ 'jit/ExecutableAllocator.h',
+ 'jit/ExecutableAllocatorFixedVMPool.cpp',
+ 'jit/ExecutableAllocatorPosix.cpp',
+ 'jit/ExecutableAllocatorWin.cpp',
+ 'jit/JIT.cpp',
+ 'jit/JIT.h',
+ 'jit/JITArithmetic.cpp',
+ 'jit/JITCall.cpp',
+ 'jit/JITCode.h',
+ 'jit/JITInlineMethods.h',
+ 'jit/JITOpcodes.cpp',
+ 'jit/JITPropertyAccess.cpp',
+ 'jit/JITStubCall.h',
+ 'jit/JITStubs.cpp',
+ 'jit/JITStubs.h',
+ 'jsc.cpp',
+ 'os-win32/stdbool.h',
+ 'os-win32/stdint.h',
+ 'parser/Lexer.cpp',
+ 'parser/Lexer.h',
+ 'parser/NodeConstructors.h',
+ 'parser/NodeInfo.h',
+ 'parser/Nodes.cpp',
+ 'parser/Nodes.h',
+ 'parser/Parser.cpp',
+ 'parser/Parser.h',
+ 'parser/ParserArena.cpp',
+ 'parser/ParserArena.h',
+ 'parser/ResultType.h',
+ 'parser/SourceCode.h',
+ 'parser/SourceProvider.h',
+ 'pcre/pcre.h',
+ 'pcre/pcre_compile.cpp',
+ 'pcre/pcre_exec.cpp',
+ 'pcre/pcre_internal.h',
+ 'pcre/pcre_tables.cpp',
+ 'pcre/pcre_ucp_searchfuncs.cpp',
+ 'pcre/pcre_xclass.cpp',
+ 'pcre/ucpinternal.h',
+ 'pcre/ucptable.cpp',
+ 'profiler/CallIdentifier.h',
+ 'profiler/HeavyProfile.cpp',
+ 'profiler/HeavyProfile.h',
+ 'profiler/Profile.cpp',
+ 'profiler/Profile.h',
+ 'profiler/ProfileGenerator.cpp',
+ 'profiler/ProfileGenerator.h',
+ 'profiler/ProfileNode.cpp',
+ 'profiler/ProfileNode.h',
+ 'profiler/Profiler.cpp',
+ 'profiler/Profiler.h',
+ 'profiler/ProfilerServer.h',
+ 'profiler/TreeProfile.cpp',
+ 'profiler/TreeProfile.h',
+ 'runtime/ArgList.cpp',
+ 'runtime/ArgList.h',
+ 'runtime/Arguments.cpp',
+ 'runtime/Arguments.h',
+ 'runtime/ArrayConstructor.cpp',
+ 'runtime/ArrayConstructor.h',
+ 'runtime/ArrayPrototype.cpp',
+ 'runtime/ArrayPrototype.h',
+ 'runtime/BatchedTransitionOptimizer.h',
+ 'runtime/BooleanConstructor.cpp',
+ 'runtime/BooleanConstructor.h',
+ 'runtime/BooleanObject.cpp',
+ 'runtime/BooleanObject.h',
+ 'runtime/BooleanPrototype.cpp',
+ 'runtime/BooleanPrototype.h',
+ 'runtime/CallData.cpp',
+ 'runtime/CallData.h',
+ 'runtime/ClassInfo.h',
+ 'runtime/Collector.cpp',
+ 'runtime/Collector.h',
+ 'runtime/CollectorHeapIterator.h',
+ 'runtime/CommonIdentifiers.cpp',
+ 'runtime/CommonIdentifiers.h',
+ 'runtime/Completion.cpp',
+ 'runtime/Completion.h',
+ 'runtime/ConstructData.cpp',
+ 'runtime/ConstructData.h',
+ 'runtime/DateConstructor.cpp',
+ 'runtime/DateConstructor.h',
+ 'runtime/DateConversion.cpp',
+ 'runtime/DateConversion.h',
+ 'runtime/DateInstance.cpp',
+ 'runtime/DateInstance.h',
+ 'runtime/DatePrototype.cpp',
+ 'runtime/DatePrototype.h',
+ 'runtime/Error.cpp',
+ 'runtime/Error.h',
+ 'runtime/ErrorConstructor.cpp',
+ 'runtime/ErrorConstructor.h',
+ 'runtime/ErrorInstance.cpp',
+ 'runtime/ErrorInstance.h',
+ 'runtime/ErrorPrototype.cpp',
+ 'runtime/ErrorPrototype.h',
+ 'runtime/ExceptionHelpers.cpp',
+ 'runtime/ExceptionHelpers.h',
+ 'runtime/FunctionConstructor.cpp',
+ 'runtime/FunctionConstructor.h',
+ 'runtime/FunctionPrototype.cpp',
+ 'runtime/FunctionPrototype.h',
+ 'runtime/GetterSetter.cpp',
+ 'runtime/GetterSetter.h',
+ 'runtime/GlobalEvalFunction.cpp',
+ 'runtime/GlobalEvalFunction.h',
+ 'runtime/Identifier.cpp',
+ 'runtime/Identifier.h',
+ 'runtime/InitializeThreading.cpp',
+ 'runtime/InitializeThreading.h',
+ 'runtime/InternalFunction.cpp',
+ 'runtime/InternalFunction.h',
+ 'runtime/JSActivation.cpp',
+ 'runtime/JSActivation.h',
+ 'runtime/JSArray.cpp',
+ 'runtime/JSArray.h',
+ 'runtime/JSByteArray.cpp',
+ 'runtime/JSByteArray.h',
+ 'runtime/JSCell.cpp',
+ 'runtime/JSCell.h',
+ 'runtime/JSFunction.cpp',
+ 'runtime/JSFunction.h',
+ 'runtime/JSGlobalData.cpp',
+ 'runtime/JSGlobalData.h',
+ 'runtime/JSGlobalObject.cpp',
+ 'runtime/JSGlobalObject.h',
+ 'runtime/JSGlobalObjectFunctions.cpp',
+ 'runtime/JSGlobalObjectFunctions.h',
+ 'runtime/JSImmediate.cpp',
+ 'runtime/JSImmediate.h',
+ 'runtime/JSLock.cpp',
+ 'runtime/JSLock.h',
+ 'runtime/JSNotAnObject.cpp',
+ 'runtime/JSNotAnObject.h',
+ 'runtime/JSNumberCell.cpp',
+ 'runtime/JSNumberCell.h',
+ 'runtime/JSObject.cpp',
+ 'runtime/JSObject.h',
+ 'runtime/JSONObject.cpp',
+ 'runtime/JSONObject.h',
+ 'runtime/JSPropertyNameIterator.cpp',
+ 'runtime/JSPropertyNameIterator.h',
+ 'runtime/JSStaticScopeObject.cpp',
+ 'runtime/JSStaticScopeObject.h',
+ 'runtime/JSString.cpp',
+ 'runtime/JSString.h',
+ 'runtime/JSType.h',
+ 'runtime/JSValue.cpp',
+ 'runtime/JSValue.h',
+ 'runtime/JSVariableObject.cpp',
+ 'runtime/JSVariableObject.h',
+ 'runtime/JSWrapperObject.cpp',
+ 'runtime/JSWrapperObject.h',
+ 'runtime/LiteralParser.cpp',
+ 'runtime/LiteralParser.h',
+ 'runtime/Lookup.cpp',
+ 'runtime/Lookup.h',
+ 'runtime/MathObject.cpp',
+ 'runtime/MathObject.h',
+ 'runtime/NativeErrorConstructor.cpp',
+ 'runtime/NativeErrorConstructor.h',
+ 'runtime/NativeErrorPrototype.cpp',
+ 'runtime/NativeErrorPrototype.h',
+ 'runtime/NativeFunctionWrapper.h',
+ 'runtime/NumberConstructor.cpp',
+ 'runtime/NumberConstructor.h',
+ 'runtime/NumberObject.cpp',
+ 'runtime/NumberObject.h',
+ 'runtime/NumberPrototype.cpp',
+ 'runtime/NumberPrototype.h',
+ 'runtime/ObjectConstructor.cpp',
+ 'runtime/ObjectConstructor.h',
+ 'runtime/ObjectPrototype.cpp',
+ 'runtime/ObjectPrototype.h',
+ 'runtime/Operations.cpp',
+ 'runtime/Operations.h',
+ 'runtime/PropertyMapHashTable.h',
+ 'runtime/PropertyNameArray.cpp',
+ 'runtime/PropertyNameArray.h',
+ 'runtime/PropertySlot.cpp',
+ 'runtime/PropertySlot.h',
+ 'runtime/Protect.h',
+ 'runtime/PrototypeFunction.cpp',
+ 'runtime/PrototypeFunction.h',
+ 'runtime/PutPropertySlot.h',
+ 'runtime/RegExp.cpp',
+ 'runtime/RegExp.h',
+ 'runtime/RegExpConstructor.cpp',
+ 'runtime/RegExpConstructor.h',
+ 'runtime/RegExpMatchesArray.h',
+ 'runtime/RegExpObject.cpp',
+ 'runtime/RegExpObject.h',
+ 'runtime/RegExpPrototype.cpp',
+ 'runtime/RegExpPrototype.h',
+ 'runtime/ScopeChain.cpp',
+ 'runtime/ScopeChain.h',
+ 'runtime/ScopeChainMark.h',
+ 'runtime/SmallStrings.cpp',
+ 'runtime/SmallStrings.h',
+ 'runtime/StringConstructor.cpp',
+ 'runtime/StringConstructor.h',
+ 'runtime/StringObject.cpp',
+ 'runtime/StringObject.h',
+ 'runtime/StringObjectThatMasqueradesAsUndefined.h',
+ 'runtime/StringPrototype.cpp',
+ 'runtime/StringPrototype.h',
+ 'runtime/Structure.cpp',
+ 'runtime/Structure.h',
+ 'runtime/StructureChain.cpp',
+ 'runtime/StructureChain.h',
+ 'runtime/StructureTransitionTable.h',
+ 'runtime/SymbolTable.h',
+ 'runtime/TimeoutChecker.cpp',
+ 'runtime/TimeoutChecker.h',
+ 'runtime/Tracing.h',
+ 'runtime/TypeInfo.h',
+ 'runtime/UString.cpp',
+ 'runtime/UString.h',
+ 'wrec/CharacterClass.cpp',
+ 'wrec/CharacterClass.h',
+ 'wrec/CharacterClassConstructor.cpp',
+ 'wrec/CharacterClassConstructor.h',
+ 'wrec/Escapes.h',
+ 'wrec/Quantifier.h',
+ 'wrec/WREC.cpp',
+ 'wrec/WREC.h',
+ 'wrec/WRECFunctors.cpp',
+ 'wrec/WRECFunctors.h',
+ 'wrec/WRECGenerator.cpp',
+ 'wrec/WRECGenerator.h',
+ 'wrec/WRECParser.cpp',
+ 'wrec/WRECParser.h',
+ 'wtf/AlwaysInline.h',
+ 'wtf/ASCIICType.h',
+ 'wtf/Assertions.cpp',
+ 'wtf/Assertions.h',
+ 'wtf/AVLTree.h',
+ 'wtf/ByteArray.cpp',
+ 'wtf/ByteArray.h',
+ 'wtf/chromium/ChromiumThreading.h',
+ 'wtf/chromium/MainThreadChromium.cpp',
+ 'wtf/CrossThreadRefCounted.h',
+ 'wtf/CurrentTime.cpp',
+ 'wtf/CurrentTime.h',
+ 'wtf/DateMath.cpp',
+ 'wtf/DateMath.h',
+ 'wtf/Deque.h',
+ 'wtf/DisallowCType.h',
+ 'wtf/dtoa.cpp',
+ 'wtf/dtoa.h',
+ 'wtf/FastAllocBase.h',
+ 'wtf/FastMalloc.cpp',
+ 'wtf/FastMalloc.h',
+ 'wtf/Forward.h',
+ 'wtf/GetPtr.h',
+ 'wtf/GOwnPtr.cpp',
+ 'wtf/GOwnPtr.h',
+ 'wtf/gtk/MainThreadGtk.cpp',
+ 'wtf/gtk/ThreadingGtk.cpp',
+ 'wtf/HashCountedSet.h',
+ 'wtf/HashFunctions.h',
+ 'wtf/HashIterators.h',
+ 'wtf/HashMap.h',
+ 'wtf/HashSet.h',
+ 'wtf/HashTable.cpp',
+ 'wtf/HashTable.h',
+ 'wtf/HashTraits.h',
+ 'wtf/ListHashSet.h',
+ 'wtf/ListRefPtr.h',
+ 'wtf/Locker.h',
+ 'wtf/MainThread.cpp',
+ 'wtf/MainThread.h',
+ 'wtf/MallocZoneSupport.h',
+ 'wtf/MathExtras.h',
+ 'wtf/MessageQueue.h',
+ 'wtf/Noncopyable.h',
+ 'wtf/NotFound.h',
+ 'wtf/OwnArrayPtr.h',
+ 'wtf/OwnFastMallocPtr.h',
+ 'wtf/OwnPtr.h',
+ 'wtf/OwnPtrCommon.h',
+ 'wtf/OwnPtrWin.cpp',
+ 'wtf/PassOwnPtr.h',
+ 'wtf/PassRefPtr.h',
+ 'wtf/Platform.h',
+ 'wtf/PtrAndFlags.h',
+ 'wtf/qt/MainThreadQt.cpp',
+ 'wtf/qt/ThreadingQt.cpp',
+ 'wtf/RandomNumber.cpp',
+ 'wtf/RandomNumber.h',
+ 'wtf/RandomNumberSeed.h',
+ 'wtf/RefCounted.h',
+ 'wtf/RefCountedLeakCounter.cpp',
+ 'wtf/RefCountedLeakCounter.h',
+ 'wtf/RefPtr.h',
+ 'wtf/RefPtrHashMap.h',
+ 'wtf/RetainPtr.h',
+ 'wtf/SegmentedVector.h',
+ 'wtf/StdLibExtras.h',
+ 'wtf/StringExtras.h',
+ 'wtf/TCPackedCache.h',
+ 'wtf/TCPageMap.h',
+ 'wtf/TCSpinLock.h',
+ 'wtf/TCSystemAlloc.cpp',
+ 'wtf/TCSystemAlloc.h',
+ 'wtf/Threading.cpp',
+ 'wtf/Threading.h',
+ 'wtf/ThreadingNone.cpp',
+ 'wtf/ThreadingPthreads.cpp',
+ 'wtf/ThreadingWin.cpp',
+ 'wtf/ThreadSpecific.h',
+ 'wtf/ThreadSpecificWin.cpp',
+ 'wtf/TypeTraits.cpp',
+ 'wtf/TypeTraits.h',
+ 'wtf/unicode/Collator.h',
+ 'wtf/unicode/CollatorDefault.cpp',
+ 'wtf/unicode/glib/UnicodeGLib.cpp',
+ 'wtf/unicode/glib/UnicodeGLib.h',
+ 'wtf/unicode/glib/UnicodeMacrosFromICU.h',
+ 'wtf/unicode/icu/CollatorICU.cpp',
+ 'wtf/unicode/icu/UnicodeIcu.h',
+ 'wtf/unicode/qt4/UnicodeQt4.h',
+ 'wtf/unicode/Unicode.h',
+ 'wtf/unicode/UTF8.cpp',
+ 'wtf/unicode/UTF8.h',
+ 'wtf/UnusedParam.h',
+ 'wtf/Vector.h',
+ 'wtf/VectorTraits.h',
+ 'wtf/VMTags.h',
+ 'wtf/win/MainThreadWin.cpp',
+ 'wtf/wx/MainThreadWx.cpp',
+ 'yarr/RegexCompiler.cpp',
+ 'yarr/RegexCompiler.h',
+ 'yarr/RegexInterpreter.cpp',
+ 'yarr/RegexInterpreter.h',
+ 'yarr/RegexJIT.cpp',
+ 'yarr/RegexJIT.h',
+ 'yarr/RegexParser.h',
+ 'yarr/RegexPattern.h',
+ ]
+ }
+}
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
index d777f73..5dae952 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -363,15 +363,6 @@ void CodeBlock::dump(ExecState* exec) const
} while (i < m_constantRegisters.size());
}
- if (m_rareData && !m_rareData->m_unexpectedConstants.isEmpty()) {
- printf("\nUnexpected Constants:\n");
- size_t i = 0;
- do {
- printf(" k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, m_rareData->m_unexpectedConstants[i]).ascii());
- ++i;
- } while (i < m_rareData->m_unexpectedConstants.size());
- }
-
if (m_rareData && !m_rareData->m_regexps.isEmpty()) {
printf("\nm_regexps:\n");
size_t i = 0;
@@ -506,12 +497,6 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
printf("[%4d] convert_this %s\n", location, registerName(r0).c_str());
break;
}
- case op_unexpected_load: {
- int r0 = (++it)->u.operand;
- int k0 = (++it)->u.operand;
- printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, unexpectedConstant(k0)).c_str());
- break;
- }
case op_new_object: {
int r0 = (++it)->u.operand;
printf("[%4d] new_object\t %s\n", location, registerName(r0).c_str());
@@ -1084,7 +1069,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
int r0 = (++it)->u.operand;
int errorType = (++it)->u.operand;
int k0 = (++it)->u.operand;
- printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, unexpectedConstant(k0)).c_str());
+ printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, getConstant(k0)).c_str());
break;
}
case op_jsr: {
@@ -1142,7 +1127,6 @@ static HashSet<CodeBlock*> liveCodeBlockSet;
#define FOR_EACH_MEMBER_VECTOR_RARE_DATA(macro) \
macro(regexps) \
macro(functions) \
- macro(unexpectedConstants) \
macro(exceptionHandlers) \
macro(immediateSwitchJumpTables) \
macro(characterSwitchJumpTables) \
@@ -1267,7 +1251,6 @@ void CodeBlock::dumpStatistics()
CodeBlock::CodeBlock(ScopeNode* ownerNode)
: m_numCalleeRegisters(0)
- , m_numConstants(0)
, m_numVars(0)
, m_numParameters(0)
, m_ownerNode(ownerNode)
@@ -1290,7 +1273,6 @@ CodeBlock::CodeBlock(ScopeNode* ownerNode)
CodeBlock::CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
: m_numCalleeRegisters(0)
- , m_numConstants(0)
, m_numVars(0)
, m_numParameters(0)
, m_ownerNode(ownerNode)
@@ -1455,10 +1437,6 @@ void CodeBlock::mark()
for (size_t i = 0; i < m_rareData->m_functions.size(); ++i)
m_rareData->m_functions[i]->body()->mark();
- for (size_t i = 0; i < m_rareData->m_unexpectedConstants.size(); ++i) {
- if (!m_rareData->m_unexpectedConstants[i].marked())
- m_rareData->m_unexpectedConstants[i].mark();
- }
m_rareData->m_evalCodeCache.mark();
}
}
@@ -1757,7 +1735,6 @@ void CodeBlock::shrinkToFit()
if (m_rareData) {
m_rareData->m_exceptionHandlers.shrinkToFit();
m_rareData->m_functions.shrinkToFit();
- m_rareData->m_unexpectedConstants.shrinkToFit();
m_rareData->m_regexps.shrinkToFit();
m_rareData->m_immediateSwitchJumpTables.shrinkToFit();
m_rareData->m_characterSwitchJumpTables.shrinkToFit();
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h
index afd32f0..64b6c98 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h
@@ -46,6 +46,12 @@
#include "StructureStubInfo.h"
#endif
+// Register numbers used in bytecode operations have different meaning accoring to their ranges:
+// 0x80000000-0xFFFFFFFF Negative indicies from the CallFrame pointer are entries in the call frame, see RegisterFile.h.
+// 0x00000000-0x3FFFFFFF Forwards indices from the CallFrame pointer are local vars and temporaries with the function's callframe.
+// 0x40000000-0x7FFFFFFF Positive indices from 0x40000000 specify entries in the constant pool on the CodeBlock.
+static const int FirstConstantRegisterIndex = 0x40000000;
+
namespace JSC {
class ExecState;
@@ -248,19 +254,9 @@ namespace JSC {
return false;
}
- ALWAYS_INLINE bool isConstantRegisterIndex(int index)
- {
- return index >= m_numVars && index < m_numVars + m_numConstants;
- }
-
- ALWAYS_INLINE JSValue getConstant(int index)
- {
- return m_constantRegisters[index - m_numVars].jsValue();
- }
-
ALWAYS_INLINE bool isTemporaryRegisterIndex(int index)
{
- return index >= m_numVars + m_numConstants;
+ return index >= m_numVars;
}
HandlerInfo* handlerForBytecodeOffset(unsigned bytecodeOffset);
@@ -400,7 +396,9 @@ namespace JSC {
size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); }
void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); }
- Register& constantRegister(int index) { return m_constantRegisters[index]; }
+ Register& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; }
+ ALWAYS_INLINE bool isConstantRegisterIndex(int index) { return index >= FirstConstantRegisterIndex; }
+ ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); }
unsigned addFunctionExpression(FuncExprNode* n) { unsigned size = m_functionExpressions.size(); m_functionExpressions.append(n); return size; }
FuncExprNode* functionExpression(int index) const { return m_functionExpressions[index].get(); }
@@ -410,9 +408,6 @@ namespace JSC {
bool hasFunctions() const { return m_functionExpressions.size() || (m_rareData && m_rareData->m_functions.size()); }
- unsigned addUnexpectedConstant(JSValue v) { createRareDataIfNecessary(); unsigned size = m_rareData->m_unexpectedConstants.size(); m_rareData->m_unexpectedConstants.append(v); return size; }
- JSValue unexpectedConstant(int index) const { ASSERT(m_rareData); return m_rareData->m_unexpectedConstants[index]; }
-
unsigned addRegExp(RegExp* r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; }
RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); }
@@ -441,11 +436,6 @@ namespace JSC {
// FIXME: Make these remaining members private.
int m_numCalleeRegisters;
- // NOTE: numConstants holds the number of constant registers allocated
- // by the code generator, not the number of constant registers used.
- // (Duplicate constants are uniqued during code generation, and spare
- // constant registers may be allocated.)
- int m_numConstants;
int m_numVars;
int m_numParameters;
@@ -519,7 +509,6 @@ namespace JSC {
// Rare Constants
Vector<RefPtr<FuncDeclNode> > m_functions;
- Vector<JSValue> m_unexpectedConstants;
Vector<RefPtr<RegExp> > m_regexps;
// Jump Tables
@@ -574,6 +563,14 @@ namespace JSC {
int m_baseScopeDepth;
};
+ inline Register& ExecState::r(int index)
+ {
+ CodeBlock* codeBlock = this->codeBlock();
+ if (codeBlock->isConstantRegisterIndex(index))
+ return codeBlock->constantRegister(index);
+ return this[index];
+ }
+
} // namespace JSC
#endif // CodeBlock_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h
index f4421df..27b016e 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h
@@ -44,7 +44,6 @@ namespace JSC {
macro(op_create_arguments, 1) \
macro(op_convert_this, 2) \
\
- macro(op_unexpected_load, 3) \
macro(op_new_object, 2) \
macro(op_new_array, 4) \
macro(op_new_regexp, 3) \
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
index 7feb3c8..15261ee 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -196,17 +196,10 @@ bool BytecodeGenerator::addGlobalVar(const Identifier& ident, bool isConstant, R
return result.second;
}
-void BytecodeGenerator::allocateConstants(size_t count)
+void BytecodeGenerator::preserveLastVar()
{
- m_codeBlock->m_numConstants = count;
- if (!count)
- return;
-
- m_nextConstantIndex = m_calleeRegisters.size();
-
- for (size_t i = 0; i < count; ++i)
- newRegister();
- m_lastConstant = &m_calleeRegisters.last();
+ if ((m_firstConstantIndex = m_calleeRegisters.size()) != 0)
+ m_lastVar = &m_calleeRegisters.last();
}
BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* debugger, const ScopeChain& scopeChain, SymbolTable* symbolTable, ProgramCodeBlock* codeBlock)
@@ -222,6 +215,7 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
, m_baseScopeDepth(0)
, m_codeType(GlobalCode)
, m_nextGlobalIndex(-1)
+ , m_nextConstantOffset(0)
, m_globalConstantIndex(0)
, m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
, m_lastOpcodeID(op_end)
@@ -272,7 +266,7 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
if (!globalObject->hasProperty(exec, varStack[i].first))
newVars.append(addGlobalVar(varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant));
- allocateConstants(programNode->neededConstants());
+ preserveLastVar();
for (size_t i = 0; i < newVars.size(); ++i)
emitLoad(newVars[i], jsUndefined());
@@ -290,7 +284,7 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
globalObject->putWithAttributes(exec, varStack[i].first, jsUndefined(), attributes);
}
- allocateConstants(programNode->neededConstants());
+ preserveLastVar();
}
}
@@ -305,6 +299,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
, m_dynamicScopeDepth(0)
, m_baseScopeDepth(0)
, m_codeType(FunctionCode)
+ , m_nextConstantOffset(0)
, m_globalConstantIndex(0)
, m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
, m_lastOpcodeID(op_end)
@@ -372,7 +367,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
for (size_t i = 0; i < parameterCount; ++i)
addParameter(parameters[i]);
- allocateConstants(functionBody->neededConstants());
+ preserveLastVar();
}
BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugger, const ScopeChain& scopeChain, SymbolTable* symbolTable, EvalCodeBlock* codeBlock)
@@ -387,6 +382,7 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge
, m_dynamicScopeDepth(0)
, m_baseScopeDepth(codeBlock->baseScopeDepth())
, m_codeType(EvalCode)
+ , m_nextConstantOffset(0)
, m_globalConstantIndex(0)
, m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
, m_lastOpcodeID(op_end)
@@ -401,7 +397,7 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge
codeBlock->setGlobalData(m_globalData);
m_codeBlock->m_numParameters = 1; // Allocate space for "this"
- allocateConstants(evalNode->neededConstants());
+ preserveLastVar();
}
RegisterID* BytecodeGenerator::addParameter(const Identifier& ident)
@@ -525,7 +521,7 @@ PassRefPtr<LabelScope> BytecodeGenerator::newLabelScope(LabelScope::Type type, c
m_labelScopes.removeLast();
// Allocate new label scope.
- LabelScope scope(type, name, scopeDepth(), newLabel(), type == LabelScope::Loop ? newLabel() : 0); // Only loops have continue targets.
+ LabelScope scope(type, name, scopeDepth(), newLabel(), type == LabelScope::Loop ? newLabel() : PassRefPtr<Label>()); // Only loops have continue targets.
m_labelScopes.append(scope);
return &m_labelScopes.last();
}
@@ -791,34 +787,19 @@ unsigned BytecodeGenerator::addConstant(const Identifier& ident)
return result.first->second;
}
-RegisterID* BytecodeGenerator::addConstant(JSValue v)
+RegisterID* BytecodeGenerator::addConstantValue(JSValue v)
{
- pair<JSValueMap::iterator, bool> result = m_jsValueMap.add(JSValue::encode(v), m_nextConstantIndex);
- if (result.second) {
- RegisterID& constant = m_calleeRegisters[m_nextConstantIndex];
-
- ++m_nextConstantIndex;
+ int index = m_nextConstantOffset;
+ pair<JSValueMap::iterator, bool> result = m_jsValueMap.add(JSValue::encode(v), m_nextConstantOffset);
+ if (result.second) {
+ m_constantPoolRegisters.append(FirstConstantRegisterIndex + m_nextConstantOffset);
+ ++m_nextConstantOffset;
m_codeBlock->addConstantRegister(JSValue(v));
- return &constant;
- }
+ } else
+ index = result.first->second;
- return &registerFor(result.first->second);
-}
-
-unsigned BytecodeGenerator::addUnexpectedConstant(JSValue v)
-{
- return m_codeBlock->addUnexpectedConstant(v);
-}
-
-RegisterID* BytecodeGenerator::emitLoadGlobalObject(RegisterID* dst, JSObject* globalObject)
-{
- if (!m_globalConstantIndex)
- m_globalConstantIndex = m_codeBlock->addUnexpectedConstant(globalObject);
- emitOpcode(op_unexpected_load);
- instructions().append(dst->index());
- instructions().append(m_globalConstantIndex);
- return dst;
+ return &m_constantPoolRegisters[index];
}
unsigned BytecodeGenerator::addRegExp(RegExp* r)
@@ -898,8 +879,8 @@ RegisterID* BytecodeGenerator::emitEqualityOp(OpcodeID opcodeID, RegisterID* dst
if (src1->index() == dstIndex
&& src1->isTemporary()
&& m_codeBlock->isConstantRegisterIndex(src2->index())
- && m_codeBlock->constantRegister(src2->index() - m_codeBlock->m_numVars).jsValue().isString()) {
- const UString& value = asString(m_codeBlock->constantRegister(src2->index() - m_codeBlock->m_numVars).jsValue())->value();
+ && m_codeBlock->constantRegister(src2->index()).jsValue().isString()) {
+ const UString& value = asString(m_codeBlock->constantRegister(src2->index()).jsValue())->value();
if (value == "undefined") {
rewindUnaryOp();
emitOpcode(op_is_undefined);
@@ -979,28 +960,12 @@ RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, const Identifier& ident
RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, JSValue v)
{
- RegisterID* constantID = addConstant(v);
+ RegisterID* constantID = addConstantValue(v);
if (dst)
return emitMove(dst, constantID);
return constantID;
}
-RegisterID* BytecodeGenerator::emitUnexpectedLoad(RegisterID* dst, bool b)
-{
- emitOpcode(op_unexpected_load);
- instructions().append(dst->index());
- instructions().append(addUnexpectedConstant(jsBoolean(b)));
- return dst;
-}
-
-RegisterID* BytecodeGenerator::emitUnexpectedLoad(RegisterID* dst, double d)
-{
- emitOpcode(op_unexpected_load);
- instructions().append(dst->index());
- instructions().append(addUnexpectedConstant(jsNumber(globalData(), d)));
- return dst;
-}
-
bool BytecodeGenerator::findScopedProperty(const Identifier& property, int& index, size_t& stackDepth, bool forWriting, JSObject*& globalObject)
{
// Cases where we cannot statically optimize the lookup.
@@ -1169,7 +1134,7 @@ RegisterID* BytecodeGenerator::emitResolveBase(RegisterID* dst, const Identifier
}
// Global object is the base
- return emitLoadGlobalObject(dst, globalObject);
+ return emitLoad(dst, JSValue(globalObject));
}
RegisterID* BytecodeGenerator::emitResolveWithBase(RegisterID* baseDst, RegisterID* propDst, const Identifier& property)
@@ -1196,7 +1161,7 @@ RegisterID* BytecodeGenerator::emitResolveWithBase(RegisterID* baseDst, Register
}
// Global object is the base
- emitLoadGlobalObject(baseDst, globalObject);
+ emitLoad(baseDst, JSValue(globalObject));
if (index != missingSymbolMarker() && !forceGlobalResolve) {
// Directly index the property lookup across multiple scopes.
@@ -1831,7 +1796,7 @@ RegisterID* BytecodeGenerator::emitNewError(RegisterID* dst, ErrorType type, JSV
emitOpcode(op_new_error);
instructions().append(dst->index());
instructions().append(static_cast<int>(type));
- instructions().append(addUnexpectedConstant(message));
+ instructions().append(addConstantValue(message)->index());
return dst;
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h
index d29a24d..54d0289 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h
@@ -245,9 +245,6 @@ namespace JSC {
RegisterID* emitLoad(RegisterID* dst, double);
RegisterID* emitLoad(RegisterID* dst, const Identifier&);
RegisterID* emitLoad(RegisterID* dst, JSValue);
- RegisterID* emitUnexpectedLoad(RegisterID* dst, bool);
- RegisterID* emitUnexpectedLoad(RegisterID* dst, double);
- RegisterID* emitLoadGlobalObject(RegisterID* dst, JSObject* globalObject);
RegisterID* emitUnaryOp(OpcodeID, RegisterID* dst, RegisterID* src);
RegisterID* emitBinaryOp(OpcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes);
@@ -399,7 +396,7 @@ namespace JSC {
RegisterID* addParameter(const Identifier&);
- void allocateConstants(size_t);
+ void preserveLastVar();
RegisterID& registerFor(int index)
{
@@ -420,8 +417,7 @@ namespace JSC {
unsigned addConstant(FuncDeclNode*);
unsigned addConstant(FuncExprNode*);
unsigned addConstant(const Identifier&);
- RegisterID* addConstant(JSValue);
- unsigned addUnexpectedConstant(JSValue);
+ RegisterID* addConstantValue(JSValue);
unsigned addRegExp(RegExp*);
Vector<Instruction>& instructions() { return m_codeBlock->instructions(); }
@@ -450,12 +446,13 @@ namespace JSC {
RegisterID m_thisRegister;
RegisterID m_argumentsRegister;
int m_activationRegisterIndex;
+ WTF::SegmentedVector<RegisterID, 32> m_constantPoolRegisters;
WTF::SegmentedVector<RegisterID, 32> m_calleeRegisters;
WTF::SegmentedVector<RegisterID, 32> m_parameters;
WTF::SegmentedVector<RegisterID, 32> m_globals;
WTF::SegmentedVector<Label, 32> m_labels;
WTF::SegmentedVector<LabelScope, 8> m_labelScopes;
- RefPtr<RegisterID> m_lastConstant;
+ RefPtr<RegisterID> m_lastVar;
int m_finallyDepth;
int m_dynamicScopeDepth;
int m_baseScopeDepth;
@@ -466,7 +463,8 @@ namespace JSC {
int m_nextGlobalIndex;
int m_nextParameterIndex;
- int m_nextConstantIndex;
+ int m_firstConstantIndex;
+ int m_nextConstantOffset;
unsigned m_globalConstantIndex;
int m_globalVarStorageOffset;
diff --git a/src/3rdparty/webkit/JavaScriptCore/create_hash_table b/src/3rdparty/webkit/JavaScriptCore/create_hash_table
index 25d0b02..4184500 100755
--- a/src/3rdparty/webkit/JavaScriptCore/create_hash_table
+++ b/src/3rdparty/webkit/JavaScriptCore/create_hash_table
@@ -268,7 +268,7 @@ sub output() {
}
print " { 0, 0, 0, 0 }\n";
print "};\n\n";
- print "extern const struct HashTable $name =\n";
+ print "extern JSC_CONST_HASHTABLE HashTable $name =\n";
print " \{ $compactSize, $compactHashSizeMask, $nameEntries, 0 \};\n";
print "} // namespace\n";
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h
index 868ea71..98d0935 100644
--- a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h
+++ b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h
@@ -38,7 +38,7 @@ namespace JSC {
virtual ~Debugger();
void attach(JSGlobalObject*);
- void detach(JSGlobalObject*);
+ virtual void detach(JSGlobalObject*);
virtual void sourceParsed(ExecState*, const SourceCode&, int errorLine, const UString& errorMsg) = 0;
virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/ArrayPrototype.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/ArrayPrototype.lut.h
index 2a7c98f..5732add 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/ArrayPrototype.lut.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/ArrayPrototype.lut.h
@@ -29,6 +29,6 @@ static const struct HashTableValue arrayTableValues[22] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable arrayTable =
+extern JSC_CONST_HASHTABLE HashTable arrayTable =
{ 65, 63, arrayTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/DatePrototype.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/DatePrototype.lut.h
index 1f43d4d..8b1c735 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/DatePrototype.lut.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/DatePrototype.lut.h
@@ -54,6 +54,6 @@ static const struct HashTableValue dateTableValues[47] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable dateTable =
+extern JSC_CONST_HASHTABLE HashTable dateTable =
{ 134, 127, dateTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp
index 8e80eca..4e16e25 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -47,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -55,159 +54,28 @@
/* Pure parsers. */
#define YYPURE 1
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
/* Using locations. */
#define YYLSP_NEEDED 1
/* Substitute the variable and function names. */
-#define yyparse jscyyparse
-#define yylex jscyylex
-#define yyerror jscyyerror
-#define yylval jscyylval
-#define yychar jscyychar
-#define yydebug jscyydebug
-#define yynerrs jscyynerrs
-#define yylloc jscyylloc
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- NULLTOKEN = 258,
- TRUETOKEN = 259,
- FALSETOKEN = 260,
- BREAK = 261,
- CASE = 262,
- DEFAULT = 263,
- FOR = 264,
- NEW = 265,
- VAR = 266,
- CONSTTOKEN = 267,
- CONTINUE = 268,
- FUNCTION = 269,
- RETURN = 270,
- VOIDTOKEN = 271,
- DELETETOKEN = 272,
- IF = 273,
- THISTOKEN = 274,
- DO = 275,
- WHILE = 276,
- INTOKEN = 277,
- INSTANCEOF = 278,
- TYPEOF = 279,
- SWITCH = 280,
- WITH = 281,
- RESERVED = 282,
- THROW = 283,
- TRY = 284,
- CATCH = 285,
- FINALLY = 286,
- DEBUGGER = 287,
- IF_WITHOUT_ELSE = 288,
- ELSE = 289,
- EQEQ = 290,
- NE = 291,
- STREQ = 292,
- STRNEQ = 293,
- LE = 294,
- GE = 295,
- OR = 296,
- AND = 297,
- PLUSPLUS = 298,
- MINUSMINUS = 299,
- LSHIFT = 300,
- RSHIFT = 301,
- URSHIFT = 302,
- PLUSEQUAL = 303,
- MINUSEQUAL = 304,
- MULTEQUAL = 305,
- DIVEQUAL = 306,
- LSHIFTEQUAL = 307,
- RSHIFTEQUAL = 308,
- URSHIFTEQUAL = 309,
- ANDEQUAL = 310,
- MODEQUAL = 311,
- XOREQUAL = 312,
- OREQUAL = 313,
- OPENBRACE = 314,
- CLOSEBRACE = 315,
- NUMBER = 316,
- IDENT = 317,
- STRING = 318,
- AUTOPLUSPLUS = 319,
- AUTOMINUSMINUS = 320
- };
-#endif
-/* Tokens. */
-#define NULLTOKEN 258
-#define TRUETOKEN 259
-#define FALSETOKEN 260
-#define BREAK 261
-#define CASE 262
-#define DEFAULT 263
-#define FOR 264
-#define NEW 265
-#define VAR 266
-#define CONSTTOKEN 267
-#define CONTINUE 268
-#define FUNCTION 269
-#define RETURN 270
-#define VOIDTOKEN 271
-#define DELETETOKEN 272
-#define IF 273
-#define THISTOKEN 274
-#define DO 275
-#define WHILE 276
-#define INTOKEN 277
-#define INSTANCEOF 278
-#define TYPEOF 279
-#define SWITCH 280
-#define WITH 281
-#define RESERVED 282
-#define THROW 283
-#define TRY 284
-#define CATCH 285
-#define FINALLY 286
-#define DEBUGGER 287
-#define IF_WITHOUT_ELSE 288
-#define ELSE 289
-#define EQEQ 290
-#define NE 291
-#define STREQ 292
-#define STRNEQ 293
-#define LE 294
-#define GE 295
-#define OR 296
-#define AND 297
-#define PLUSPLUS 298
-#define MINUSMINUS 299
-#define LSHIFT 300
-#define RSHIFT 301
-#define URSHIFT 302
-#define PLUSEQUAL 303
-#define MINUSEQUAL 304
-#define MULTEQUAL 305
-#define DIVEQUAL 306
-#define LSHIFTEQUAL 307
-#define RSHIFTEQUAL 308
-#define URSHIFTEQUAL 309
-#define ANDEQUAL 310
-#define MODEQUAL 311
-#define XOREQUAL 312
-#define OREQUAL 313
-#define OPENBRACE 314
-#define CLOSEBRACE 315
-#define NUMBER 316
-#define IDENT 317
-#define STRING 318
-#define AUTOPLUSPLUS 319
-#define AUTOMINUSMINUS 320
-
-
-
+#define yyparse jscyyparse
+#define yylex jscyylex
+#define yyerror jscyyerror
+#define yylval jscyylval
+#define yychar jscyychar
+#define yydebug jscyydebug
+#define yynerrs jscyynerrs
+#define yylloc jscyylloc
/* Copy the first part of user declarations. */
+
+/* Line 189 of yacc.c */
#line 3 "../parser/Grammar.y"
@@ -363,6 +231,9 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<D
+/* Line 189 of yacc.c */
+#line 236 "JavaScriptCore/tmp/../generated/Grammar.tab.c"
+
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -381,10 +252,88 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<D
# define YYTOKEN_TABLE 0
#endif
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ NULLTOKEN = 258,
+ TRUETOKEN = 259,
+ FALSETOKEN = 260,
+ BREAK = 261,
+ CASE = 262,
+ DEFAULT = 263,
+ FOR = 264,
+ NEW = 265,
+ VAR = 266,
+ CONSTTOKEN = 267,
+ CONTINUE = 268,
+ FUNCTION = 269,
+ RETURN = 270,
+ VOIDTOKEN = 271,
+ DELETETOKEN = 272,
+ IF = 273,
+ THISTOKEN = 274,
+ DO = 275,
+ WHILE = 276,
+ INTOKEN = 277,
+ INSTANCEOF = 278,
+ TYPEOF = 279,
+ SWITCH = 280,
+ WITH = 281,
+ RESERVED = 282,
+ THROW = 283,
+ TRY = 284,
+ CATCH = 285,
+ FINALLY = 286,
+ DEBUGGER = 287,
+ IF_WITHOUT_ELSE = 288,
+ ELSE = 289,
+ EQEQ = 290,
+ NE = 291,
+ STREQ = 292,
+ STRNEQ = 293,
+ LE = 294,
+ GE = 295,
+ OR = 296,
+ AND = 297,
+ PLUSPLUS = 298,
+ MINUSMINUS = 299,
+ LSHIFT = 300,
+ RSHIFT = 301,
+ URSHIFT = 302,
+ PLUSEQUAL = 303,
+ MINUSEQUAL = 304,
+ MULTEQUAL = 305,
+ DIVEQUAL = 306,
+ LSHIFTEQUAL = 307,
+ RSHIFTEQUAL = 308,
+ URSHIFTEQUAL = 309,
+ ANDEQUAL = 310,
+ MODEQUAL = 311,
+ XOREQUAL = 312,
+ OREQUAL = 313,
+ OPENBRACE = 314,
+ CLOSEBRACE = 315,
+ NUMBER = 316,
+ IDENT = 317,
+ STRING = 318,
+ AUTOPLUSPLUS = 319,
+ AUTOMINUSMINUS = 320
+ };
+#endif
+
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 157 "../parser/Grammar.y"
{
+
+/* Line 214 of yacc.c */
+#line 157 "../parser/Grammar.y"
+
int intValue;
double doubleValue;
Identifier* ident;
@@ -414,13 +363,15 @@ typedef union YYSTYPE
ParameterListInfo parameterList;
Operator op;
-}
-/* Line 187 of yacc.c. */
-#line 420 "JavaScriptCore/tmp/../generated/Grammar.tab.c"
- YYSTYPE;
+
+
+
+/* Line 214 of yacc.c */
+#line 371 "JavaScriptCore/tmp/../generated/Grammar.tab.c"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
@@ -440,8 +391,8 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
-/* Line 216 of yacc.c. */
-#line 445 "JavaScriptCore/tmp/../generated/Grammar.tab.c"
+/* Line 264 of yacc.c */
+#line 396 "JavaScriptCore/tmp/../generated/Grammar.tab.c"
#ifdef short
# undef short
@@ -516,14 +467,14 @@ typedef short int yytype_int16;
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
-YYID (int i)
+YYID (int yyi)
#else
static int
-YYID (i)
- int i;
+YYID (yyi)
+ int yyi;
#endif
{
- return i;
+ return yyi;
}
#endif
@@ -605,9 +556,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- YYLTYPE yyls;
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+ YYLTYPE yyls_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
@@ -642,12 +593,12 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
@@ -2361,17 +2312,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
-yy_stack_print (bottom, top)
- yytype_int16 *bottom;
- yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
- for (; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
YYFPRINTF (stderr, "\n");
}
@@ -2406,11 +2360,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule)
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
- fprintf (stderr, " $%d = ", yyi + 1);
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
, &(yylsp[(yyi + 1) - (yynrhs)]) );
- fprintf (stderr, "\n");
+ YYFPRINTF (stderr, "\n");
}
}
@@ -2692,10 +2646,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp)
break;
}
}
-
/* Prevent warnings from -Wmissing-prototypes. */
-
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
@@ -2714,10 +2666,9 @@ int yyparse ();
-
-/*----------.
-| yyparse. |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse. |
+`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -2741,88 +2692,97 @@ yyparse ()
#endif
#endif
{
- /* The look-ahead symbol. */
+/* The lookahead symbol. */
int yychar;
-/* The semantic value of the look-ahead symbol. */
+/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-/* Number of syntax errors so far. */
-int yynerrs;
-/* Location data for the look-ahead symbol. */
+/* Location data for the lookahead symbol. */
YYLTYPE yylloc;
- int yystate;
- int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
+ /* Number of syntax errors so far. */
+ int yynerrs;
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
+ /* The stacks and their tools:
+ `yyss': related to states.
+ `yyvs': related to semantic values.
+ `yyls': related to locations.
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss = yyssa;
- yytype_int16 *yyssp;
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
- /* The location stack. */
- YYLTYPE yylsa[YYINITDEPTH];
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
- /* The locations where the error started and ended. */
- YYLTYPE yyerror_range[2];
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+ /* The location stack. */
+ YYLTYPE yylsa[YYINITDEPTH];
+ YYLTYPE *yyls;
+ YYLTYPE *yylsp;
+
+ /* The locations where the error started and ended. */
+ YYLTYPE yyerror_range[2];
- YYSIZE_T yystacksize = YYINITDEPTH;
+ YYSIZE_T yystacksize;
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
YYLTYPE yyloc;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
+ yytoken = 0;
+ yyss = yyssa;
+ yyvs = yyvsa;
+ yyls = yylsa;
+ yystacksize = YYINITDEPTH;
+
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
+ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
-
yyssp = yyss;
yyvsp = yyvs;
yylsp = yyls;
+
#if YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1;
- yylloc.first_column = yylloc.last_column = 0;
+ yylloc.first_column = yylloc.last_column = 1;
#endif
goto yysetstate;
@@ -2861,6 +2821,7 @@ YYLTYPE yylloc;
&yyvs1, yysize * sizeof (*yyvsp),
&yyls1, yysize * sizeof (*yylsp),
&yystacksize);
+
yyls = yyls1;
yyss = yyss1;
yyvs = yyvs1;
@@ -2882,9 +2843,9 @@ YYLTYPE yylloc;
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
- YYSTACK_RELOCATE (yyls);
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
@@ -2905,6 +2866,9 @@ YYLTYPE yylloc;
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
goto yybackup;
/*-----------.
@@ -2913,16 +2877,16 @@ YYLTYPE yylloc;
yybackup:
/* Do appropriate processing given the current state. Read a
- look-ahead token if we need one and don't already have one. */
+ lookahead token if we need one and don't already have one. */
- /* First try to decide what to do without reference to look-ahead token. */
+ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
- /* Not known => get a look-ahead token if don't already have one. */
+ /* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
@@ -2954,20 +2918,16 @@ yybackup:
goto yyreduce;
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
- /* Shift the look-ahead token. */
+ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
- /* Discard the shifted token unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
@@ -3008,31 +2968,43 @@ yyreduce:
switch (yyn)
{
case 2:
+
+/* Line 1455 of yacc.c */
#line 290 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NullNode(GLOBAL_DATA), 0, 1); ;}
break;
case 3:
+
+/* Line 1455 of yacc.c */
#line 291 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, true), 0, 1); ;}
break;
case 4:
+
+/* Line 1455 of yacc.c */
#line 292 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, false), 0, 1); ;}
break;
case 5:
+
+/* Line 1455 of yacc.c */
#line 293 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, (yyvsp[(1) - (1)].doubleValue)), 0, 1); ;}
break;
case 6:
+
+/* Line 1455 of yacc.c */
#line 294 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)), 0, 1); ;}
break;
case 7:
+
+/* Line 1455 of yacc.c */
#line 295 "../parser/Grammar.y"
{
Lexer& l = *LEXER;
@@ -3046,6 +3018,8 @@ yyreduce:
break;
case 8:
+
+/* Line 1455 of yacc.c */
#line 304 "../parser/Grammar.y"
{
Lexer& l = *LEXER;
@@ -3059,26 +3033,36 @@ yyreduce:
break;
case 9:
+
+/* Line 1455 of yacc.c */
#line 316 "../parser/Grammar.y"
{ (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 10:
+
+/* Line 1455 of yacc.c */
#line 317 "../parser/Grammar.y"
{ (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 11:
+
+/* Line 1455 of yacc.c */
#line 318 "../parser/Grammar.y"
{ (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from((yyvsp[(1) - (3)].doubleValue))), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 12:
+
+/* Line 1455 of yacc.c */
#line 319 "../parser/Grammar.y"
{ (yyval.propertyNode) = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (7)].ident), *(yyvsp[(2) - (7)].ident), 0, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); if (!(yyval.propertyNode).m_node) YYABORT; ;}
break;
case 13:
+
+/* Line 1455 of yacc.c */
#line 321 "../parser/Grammar.y"
{
(yyval.propertyNode) = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (8)].ident), *(yyvsp[(2) - (8)].ident), (yyvsp[(4) - (8)].parameterList).m_node.head, (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line)), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0);
@@ -3091,6 +3075,8 @@ yyreduce:
break;
case 14:
+
+/* Line 1455 of yacc.c */
#line 332 "../parser/Grammar.y"
{ (yyval.propertyList).m_node.head = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].propertyNode).m_node);
(yyval.propertyList).m_node.tail = (yyval.propertyList).m_node.head;
@@ -3099,6 +3085,8 @@ yyreduce:
break;
case 15:
+
+/* Line 1455 of yacc.c */
#line 336 "../parser/Grammar.y"
{ (yyval.propertyList).m_node.head = (yyvsp[(1) - (3)].propertyList).m_node.head;
(yyval.propertyList).m_node.tail = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, (yyvsp[(3) - (3)].propertyNode).m_node, (yyvsp[(1) - (3)].propertyList).m_node.tail);
@@ -3107,51 +3095,71 @@ yyreduce:
break;
case 17:
+
+/* Line 1455 of yacc.c */
#line 344 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA), 0, 0); ;}
break;
case 18:
+
+/* Line 1455 of yacc.c */
#line 345 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (3)].propertyList).m_node.head), (yyvsp[(2) - (3)].propertyList).m_features, (yyvsp[(2) - (3)].propertyList).m_numConstants); ;}
break;
case 19:
+
+/* Line 1455 of yacc.c */
#line 347 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (4)].propertyList).m_node.head), (yyvsp[(2) - (4)].propertyList).m_features, (yyvsp[(2) - (4)].propertyList).m_numConstants); ;}
break;
case 20:
+
+/* Line 1455 of yacc.c */
#line 351 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ThisNode(GLOBAL_DATA), ThisFeature, 0); ;}
break;
case 23:
+
+/* Line 1455 of yacc.c */
#line 354 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), (yylsp[(1) - (1)]).first_column), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;}
break;
case 24:
+
+/* Line 1455 of yacc.c */
#line 355 "../parser/Grammar.y"
{ (yyval.expressionNode) = (yyvsp[(2) - (3)].expressionNode); ;}
break;
case 25:
+
+/* Line 1455 of yacc.c */
#line 359 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].intValue)), 0, (yyvsp[(2) - (3)].intValue) ? 1 : 0); ;}
break;
case 26:
+
+/* Line 1455 of yacc.c */
#line 360 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].elementList).m_node.head), (yyvsp[(2) - (3)].elementList).m_features, (yyvsp[(2) - (3)].elementList).m_numConstants); ;}
break;
case 27:
+
+/* Line 1455 of yacc.c */
#line 361 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, (yyvsp[(4) - (5)].intValue), (yyvsp[(2) - (5)].elementList).m_node.head), (yyvsp[(2) - (5)].elementList).m_features, (yyvsp[(4) - (5)].intValue) ? (yyvsp[(2) - (5)].elementList).m_numConstants + 1 : (yyvsp[(2) - (5)].elementList).m_numConstants); ;}
break;
case 28:
+
+/* Line 1455 of yacc.c */
#line 365 "../parser/Grammar.y"
{ (yyval.elementList).m_node.head = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].intValue), (yyvsp[(2) - (2)].expressionNode).m_node);
(yyval.elementList).m_node.tail = (yyval.elementList).m_node.head;
@@ -3160,6 +3168,8 @@ yyreduce:
break;
case 29:
+
+/* Line 1455 of yacc.c */
#line 370 "../parser/Grammar.y"
{ (yyval.elementList).m_node.head = (yyvsp[(1) - (4)].elementList).m_node.head;
(yyval.elementList).m_node.tail = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, (yyvsp[(1) - (4)].elementList).m_node.tail, (yyvsp[(3) - (4)].intValue), (yyvsp[(4) - (4)].expressionNode).m_node);
@@ -3168,26 +3178,36 @@ yyreduce:
break;
case 30:
+
+/* Line 1455 of yacc.c */
#line 377 "../parser/Grammar.y"
{ (yyval.intValue) = 0; ;}
break;
case 32:
+
+/* Line 1455 of yacc.c */
#line 382 "../parser/Grammar.y"
{ (yyval.intValue) = 1; ;}
break;
case 33:
+
+/* Line 1455 of yacc.c */
#line 383 "../parser/Grammar.y"
{ (yyval.intValue) = (yyvsp[(1) - (2)].intValue) + 1; ;}
break;
case 35:
+
+/* Line 1455 of yacc.c */
#line 388 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>((yyvsp[(1) - (1)].funcExprNode).m_node, (yyvsp[(1) - (1)].funcExprNode).m_features, (yyvsp[(1) - (1)].funcExprNode).m_numConstants); ;}
break;
case 36:
+
+/* Line 1455 of yacc.c */
#line 389 "../parser/Grammar.y"
{ BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
@@ -3196,6 +3216,8 @@ yyreduce:
break;
case 37:
+
+/* Line 1455 of yacc.c */
#line 393 "../parser/Grammar.y"
{ DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3204,6 +3226,8 @@ yyreduce:
break;
case 38:
+
+/* Line 1455 of yacc.c */
#line 397 "../parser/Grammar.y"
{ NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3212,6 +3236,8 @@ yyreduce:
break;
case 40:
+
+/* Line 1455 of yacc.c */
#line 405 "../parser/Grammar.y"
{ BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
@@ -3220,6 +3246,8 @@ yyreduce:
break;
case 41:
+
+/* Line 1455 of yacc.c */
#line 409 "../parser/Grammar.y"
{ DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3228,6 +3256,8 @@ yyreduce:
break;
case 42:
+
+/* Line 1455 of yacc.c */
#line 413 "../parser/Grammar.y"
{ NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3236,6 +3266,8 @@ yyreduce:
break;
case 44:
+
+/* Line 1455 of yacc.c */
#line 421 "../parser/Grammar.y"
{ NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column);
@@ -3244,6 +3276,8 @@ yyreduce:
break;
case 46:
+
+/* Line 1455 of yacc.c */
#line 429 "../parser/Grammar.y"
{ NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column);
@@ -3252,16 +3286,22 @@ yyreduce:
break;
case 47:
+
+/* Line 1455 of yacc.c */
#line 436 "../parser/Grammar.y"
{ (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
break;
case 48:
+
+/* Line 1455 of yacc.c */
#line 437 "../parser/Grammar.y"
{ (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
break;
case 49:
+
+/* Line 1455 of yacc.c */
#line 438 "../parser/Grammar.y"
{ BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
@@ -3270,6 +3310,8 @@ yyreduce:
break;
case 50:
+
+/* Line 1455 of yacc.c */
#line 442 "../parser/Grammar.y"
{ DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3277,16 +3319,22 @@ yyreduce:
break;
case 51:
+
+/* Line 1455 of yacc.c */
#line 448 "../parser/Grammar.y"
{ (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
break;
case 52:
+
+/* Line 1455 of yacc.c */
#line 449 "../parser/Grammar.y"
{ (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
break;
case 53:
+
+/* Line 1455 of yacc.c */
#line 450 "../parser/Grammar.y"
{ BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
@@ -3295,6 +3343,8 @@ yyreduce:
break;
case 54:
+
+/* Line 1455 of yacc.c */
#line 454 "../parser/Grammar.y"
{ DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3303,16 +3353,22 @@ yyreduce:
break;
case 55:
+
+/* Line 1455 of yacc.c */
#line 461 "../parser/Grammar.y"
{ (yyval.argumentsNode) = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA), 0, 0); ;}
break;
case 56:
+
+/* Line 1455 of yacc.c */
#line 462 "../parser/Grammar.y"
{ (yyval.argumentsNode) = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA, (yyvsp[(2) - (3)].argumentList).m_node.head), (yyvsp[(2) - (3)].argumentList).m_features, (yyvsp[(2) - (3)].argumentList).m_numConstants); ;}
break;
case 57:
+
+/* Line 1455 of yacc.c */
#line 466 "../parser/Grammar.y"
{ (yyval.argumentList).m_node.head = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].expressionNode).m_node);
(yyval.argumentList).m_node.tail = (yyval.argumentList).m_node.head;
@@ -3321,6 +3377,8 @@ yyreduce:
break;
case 58:
+
+/* Line 1455 of yacc.c */
#line 470 "../parser/Grammar.y"
{ (yyval.argumentList).m_node.head = (yyvsp[(1) - (3)].argumentList).m_node.head;
(yyval.argumentList).m_node.tail = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (3)].argumentList).m_node.tail, (yyvsp[(3) - (3)].expressionNode).m_node);
@@ -3329,181 +3387,253 @@ yyreduce:
break;
case 64:
+
+/* Line 1455 of yacc.c */
#line 488 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
break;
case 65:
+
+/* Line 1455 of yacc.c */
#line 489 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
break;
case 67:
+
+/* Line 1455 of yacc.c */
#line 494 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
break;
case 68:
+
+/* Line 1455 of yacc.c */
#line 495 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
break;
case 69:
+
+/* Line 1455 of yacc.c */
#line 499 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDeleteNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 70:
+
+/* Line 1455 of yacc.c */
#line 500 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) VoidNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants + 1); ;}
break;
case 71:
+
+/* Line 1455 of yacc.c */
#line 501 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 72:
+
+/* Line 1455 of yacc.c */
#line 502 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 73:
+
+/* Line 1455 of yacc.c */
#line 503 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 74:
+
+/* Line 1455 of yacc.c */
#line 504 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 75:
+
+/* Line 1455 of yacc.c */
#line 505 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 76:
+
+/* Line 1455 of yacc.c */
#line 506 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 77:
+
+/* Line 1455 of yacc.c */
#line 507 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 78:
+
+/* Line 1455 of yacc.c */
#line 508 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeBitwiseNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 79:
+
+/* Line 1455 of yacc.c */
#line 509 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 85:
+
+/* Line 1455 of yacc.c */
#line 523 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 86:
+
+/* Line 1455 of yacc.c */
#line 524 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 87:
+
+/* Line 1455 of yacc.c */
#line 525 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 89:
+
+/* Line 1455 of yacc.c */
#line 531 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 90:
+
+/* Line 1455 of yacc.c */
#line 533 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 91:
+
+/* Line 1455 of yacc.c */
#line 535 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 93:
+
+/* Line 1455 of yacc.c */
#line 540 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 94:
+
+/* Line 1455 of yacc.c */
#line 541 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 96:
+
+/* Line 1455 of yacc.c */
#line 547 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 97:
+
+/* Line 1455 of yacc.c */
#line 549 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 99:
+
+/* Line 1455 of yacc.c */
#line 554 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 100:
+
+/* Line 1455 of yacc.c */
#line 555 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 101:
+
+/* Line 1455 of yacc.c */
#line 556 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 103:
+
+/* Line 1455 of yacc.c */
#line 561 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 104:
+
+/* Line 1455 of yacc.c */
#line 562 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 105:
+
+/* Line 1455 of yacc.c */
#line 563 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 107:
+
+/* Line 1455 of yacc.c */
#line 568 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 108:
+
+/* Line 1455 of yacc.c */
#line 569 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 109:
+
+/* Line 1455 of yacc.c */
#line 570 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 110:
+
+/* Line 1455 of yacc.c */
#line 571 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 111:
+
+/* Line 1455 of yacc.c */
#line 572 "../parser/Grammar.y"
{ InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3511,6 +3641,8 @@ yyreduce:
break;
case 112:
+
+/* Line 1455 of yacc.c */
#line 575 "../parser/Grammar.y"
{ InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3518,26 +3650,36 @@ yyreduce:
break;
case 114:
+
+/* Line 1455 of yacc.c */
#line 582 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 115:
+
+/* Line 1455 of yacc.c */
#line 583 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 116:
+
+/* Line 1455 of yacc.c */
#line 584 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 117:
+
+/* Line 1455 of yacc.c */
#line 585 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 118:
+
+/* Line 1455 of yacc.c */
#line 587 "../parser/Grammar.y"
{ InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3545,26 +3687,36 @@ yyreduce:
break;
case 120:
+
+/* Line 1455 of yacc.c */
#line 594 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 121:
+
+/* Line 1455 of yacc.c */
#line 595 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 122:
+
+/* Line 1455 of yacc.c */
#line 596 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 123:
+
+/* Line 1455 of yacc.c */
#line 597 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 124:
+
+/* Line 1455 of yacc.c */
#line 599 "../parser/Grammar.y"
{ InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3572,6 +3724,8 @@ yyreduce:
break;
case 125:
+
+/* Line 1455 of yacc.c */
#line 603 "../parser/Grammar.y"
{ InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3579,156 +3733,218 @@ yyreduce:
break;
case 127:
+
+/* Line 1455 of yacc.c */
#line 610 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 128:
+
+/* Line 1455 of yacc.c */
#line 611 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 129:
+
+/* Line 1455 of yacc.c */
#line 612 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 130:
+
+/* Line 1455 of yacc.c */
#line 613 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 132:
+
+/* Line 1455 of yacc.c */
#line 619 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 133:
+
+/* Line 1455 of yacc.c */
#line 621 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 134:
+
+/* Line 1455 of yacc.c */
#line 623 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 135:
+
+/* Line 1455 of yacc.c */
#line 625 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 137:
+
+/* Line 1455 of yacc.c */
#line 631 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 138:
+
+/* Line 1455 of yacc.c */
#line 632 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 139:
+
+/* Line 1455 of yacc.c */
#line 634 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 140:
+
+/* Line 1455 of yacc.c */
#line 636 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 142:
+
+/* Line 1455 of yacc.c */
#line 641 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 144:
+
+/* Line 1455 of yacc.c */
#line 647 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 146:
+
+/* Line 1455 of yacc.c */
#line 652 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 148:
+
+/* Line 1455 of yacc.c */
#line 657 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 150:
+
+/* Line 1455 of yacc.c */
#line 663 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 152:
+
+/* Line 1455 of yacc.c */
#line 669 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 154:
+
+/* Line 1455 of yacc.c */
#line 674 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 156:
+
+/* Line 1455 of yacc.c */
#line 680 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 158:
+
+/* Line 1455 of yacc.c */
#line 686 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 160:
+
+/* Line 1455 of yacc.c */
#line 691 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 162:
+
+/* Line 1455 of yacc.c */
#line 697 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 164:
+
+/* Line 1455 of yacc.c */
#line 703 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 166:
+
+/* Line 1455 of yacc.c */
#line 708 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 168:
+
+/* Line 1455 of yacc.c */
#line 714 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 170:
+
+/* Line 1455 of yacc.c */
#line 719 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 172:
+
+/* Line 1455 of yacc.c */
#line 725 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;}
break;
case 174:
+
+/* Line 1455 of yacc.c */
#line 731 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;}
break;
case 176:
+
+/* Line 1455 of yacc.c */
#line 737 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;}
break;
case 178:
+
+/* Line 1455 of yacc.c */
#line 743 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature,
(yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants);
@@ -3736,6 +3952,8 @@ yyreduce:
break;
case 180:
+
+/* Line 1455 of yacc.c */
#line 751 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature,
(yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants);
@@ -3743,6 +3961,8 @@ yyreduce:
break;
case 182:
+
+/* Line 1455 of yacc.c */
#line 759 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature,
(yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants);
@@ -3750,99 +3970,137 @@ yyreduce:
break;
case 183:
+
+/* Line 1455 of yacc.c */
#line 765 "../parser/Grammar.y"
{ (yyval.op) = OpEqual; ;}
break;
case 184:
+
+/* Line 1455 of yacc.c */
#line 766 "../parser/Grammar.y"
{ (yyval.op) = OpPlusEq; ;}
break;
case 185:
+
+/* Line 1455 of yacc.c */
#line 767 "../parser/Grammar.y"
{ (yyval.op) = OpMinusEq; ;}
break;
case 186:
+
+/* Line 1455 of yacc.c */
#line 768 "../parser/Grammar.y"
{ (yyval.op) = OpMultEq; ;}
break;
case 187:
+
+/* Line 1455 of yacc.c */
#line 769 "../parser/Grammar.y"
{ (yyval.op) = OpDivEq; ;}
break;
case 188:
+
+/* Line 1455 of yacc.c */
#line 770 "../parser/Grammar.y"
{ (yyval.op) = OpLShift; ;}
break;
case 189:
+
+/* Line 1455 of yacc.c */
#line 771 "../parser/Grammar.y"
{ (yyval.op) = OpRShift; ;}
break;
case 190:
+
+/* Line 1455 of yacc.c */
#line 772 "../parser/Grammar.y"
{ (yyval.op) = OpURShift; ;}
break;
case 191:
+
+/* Line 1455 of yacc.c */
#line 773 "../parser/Grammar.y"
{ (yyval.op) = OpAndEq; ;}
break;
case 192:
+
+/* Line 1455 of yacc.c */
#line 774 "../parser/Grammar.y"
{ (yyval.op) = OpXOrEq; ;}
break;
case 193:
+
+/* Line 1455 of yacc.c */
#line 775 "../parser/Grammar.y"
{ (yyval.op) = OpOrEq; ;}
break;
case 194:
+
+/* Line 1455 of yacc.c */
#line 776 "../parser/Grammar.y"
{ (yyval.op) = OpModEq; ;}
break;
case 196:
+
+/* Line 1455 of yacc.c */
#line 781 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 198:
+
+/* Line 1455 of yacc.c */
#line 786 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 200:
+
+/* Line 1455 of yacc.c */
#line 791 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 218:
+
+/* Line 1455 of yacc.c */
#line 815 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
break;
case 219:
+
+/* Line 1455 of yacc.c */
#line 817 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].sourceElements).m_node), (yyvsp[(2) - (3)].sourceElements).m_varDeclarations, (yyvsp[(2) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (3)].sourceElements).m_features, (yyvsp[(2) - (3)].sourceElements).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
break;
case 220:
+
+/* Line 1455 of yacc.c */
#line 822 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
break;
case 221:
+
+/* Line 1455 of yacc.c */
#line 824 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)]));
@@ -3850,6 +4108,8 @@ yyreduce:
break;
case 222:
+
+/* Line 1455 of yacc.c */
#line 830 "../parser/Grammar.y"
{ (yyval.varDeclList).m_node = 0;
(yyval.varDeclList).m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
@@ -3861,6 +4121,8 @@ yyreduce:
break;
case 223:
+
+/* Line 1455 of yacc.c */
#line 837 "../parser/Grammar.y"
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column);
@@ -3874,6 +4136,8 @@ yyreduce:
break;
case 224:
+
+/* Line 1455 of yacc.c */
#line 847 "../parser/Grammar.y"
{ (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node;
(yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations;
@@ -3885,6 +4149,8 @@ yyreduce:
break;
case 225:
+
+/* Line 1455 of yacc.c */
#line 855 "../parser/Grammar.y"
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column);
@@ -3898,6 +4164,8 @@ yyreduce:
break;
case 226:
+
+/* Line 1455 of yacc.c */
#line 867 "../parser/Grammar.y"
{ (yyval.varDeclList).m_node = 0;
(yyval.varDeclList).m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
@@ -3909,6 +4177,8 @@ yyreduce:
break;
case 227:
+
+/* Line 1455 of yacc.c */
#line 874 "../parser/Grammar.y"
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column);
@@ -3922,6 +4192,8 @@ yyreduce:
break;
case 228:
+
+/* Line 1455 of yacc.c */
#line 884 "../parser/Grammar.y"
{ (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node;
(yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations;
@@ -3933,6 +4205,8 @@ yyreduce:
break;
case 229:
+
+/* Line 1455 of yacc.c */
#line 892 "../parser/Grammar.y"
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column);
@@ -3946,18 +4220,24 @@ yyreduce:
break;
case 230:
+
+/* Line 1455 of yacc.c */
#line 904 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
break;
case 231:
+
+/* Line 1455 of yacc.c */
#line 907 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;}
break;
case 232:
+
+/* Line 1455 of yacc.c */
#line 912 "../parser/Grammar.y"
{ (yyval.constDeclList).m_node.head = (yyvsp[(1) - (1)].constDeclNode).m_node;
(yyval.constDeclList).m_node.tail = (yyval.constDeclList).m_node.head;
@@ -3970,6 +4250,8 @@ yyreduce:
break;
case 233:
+
+/* Line 1455 of yacc.c */
#line 921 "../parser/Grammar.y"
{ (yyval.constDeclList).m_node.head = (yyvsp[(1) - (3)].constDeclList).m_node.head;
(yyvsp[(1) - (3)].constDeclList).m_node.tail->m_next = (yyvsp[(3) - (3)].constDeclNode).m_node;
@@ -3982,49 +4264,67 @@ yyreduce:
break;
case 234:
+
+/* Line 1455 of yacc.c */
#line 932 "../parser/Grammar.y"
{ (yyval.constDeclNode) = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), 0), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;}
break;
case 235:
+
+/* Line 1455 of yacc.c */
#line 933 "../parser/Grammar.y"
{ (yyval.constDeclNode) = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node), ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 236:
+
+/* Line 1455 of yacc.c */
#line 937 "../parser/Grammar.y"
{ (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;}
break;
case 237:
+
+/* Line 1455 of yacc.c */
#line 941 "../parser/Grammar.y"
{ (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;}
break;
case 238:
+
+/* Line 1455 of yacc.c */
#line 945 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); ;}
break;
case 239:
+
+/* Line 1455 of yacc.c */
#line 949 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
break;
case 240:
+
+/* Line 1455 of yacc.c */
#line 951 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;}
break;
case 241:
+
+/* Line 1455 of yacc.c */
#line 957 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;}
break;
case 242:
+
+/* Line 1455 of yacc.c */
#line 960 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].statementNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node),
mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations),
@@ -4035,24 +4335,32 @@ yyreduce:
break;
case 243:
+
+/* Line 1455 of yacc.c */
#line 969 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;}
break;
case 244:
+
+/* Line 1455 of yacc.c */
#line 971 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;}
break;
case 245:
+
+/* Line 1455 of yacc.c */
#line 973 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WhileNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;}
break;
case 246:
+
+/* Line 1455 of yacc.c */
#line 976 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, (yyvsp[(3) - (9)].expressionNode).m_node, (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, false), (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations,
(yyvsp[(3) - (9)].expressionNode).m_features | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features,
@@ -4062,6 +4370,8 @@ yyreduce:
break;
case 247:
+
+/* Line 1455 of yacc.c */
#line 982 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, (yyvsp[(4) - (10)].varDeclList).m_node, (yyvsp[(6) - (10)].expressionNode).m_node, (yyvsp[(8) - (10)].expressionNode).m_node, (yyvsp[(10) - (10)].statementNode).m_node, true),
mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_varDeclarations, (yyvsp[(10) - (10)].statementNode).m_varDeclarations),
@@ -4072,6 +4382,8 @@ yyreduce:
break;
case 248:
+
+/* Line 1455 of yacc.c */
#line 989 "../parser/Grammar.y"
{
ForInNode* node = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node);
@@ -4084,6 +4396,8 @@ yyreduce:
break;
case 249:
+
+/* Line 1455 of yacc.c */
#line 998 "../parser/Grammar.y"
{ ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (8)].ident), 0, (yyvsp[(6) - (8)].expressionNode).m_node, (yyvsp[(8) - (8)].statementNode).m_node, (yylsp[(5) - (8)]).first_column, (yylsp[(5) - (8)]).first_column - (yylsp[(4) - (8)]).first_column, (yylsp[(6) - (8)]).last_column - (yylsp[(5) - (8)]).first_column);
SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (8)]).first_column, (yylsp[(5) - (8)]).first_column + 1, (yylsp[(6) - (8)]).last_column);
@@ -4093,6 +4407,8 @@ yyreduce:
break;
case 250:
+
+/* Line 1455 of yacc.c */
#line 1004 "../parser/Grammar.y"
{ ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (9)].ident), (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, (yylsp[(5) - (9)]).first_column, (yylsp[(5) - (9)]).first_column - (yylsp[(4) - (9)]).first_column, (yylsp[(5) - (9)]).last_column - (yylsp[(5) - (9)]).first_column);
SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (9)]).first_column, (yylsp[(6) - (9)]).first_column + 1, (yylsp[(7) - (9)]).last_column);
@@ -4104,16 +4420,22 @@ yyreduce:
break;
case 251:
+
+/* Line 1455 of yacc.c */
#line 1014 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(0, 0, 0); ;}
break;
case 253:
+
+/* Line 1455 of yacc.c */
#line 1019 "../parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(0, 0, 0); ;}
break;
case 255:
+
+/* Line 1455 of yacc.c */
#line 1024 "../parser/Grammar.y"
{ ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4122,6 +4444,8 @@ yyreduce:
break;
case 256:
+
+/* Line 1455 of yacc.c */
#line 1028 "../parser/Grammar.y"
{ ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4130,6 +4454,8 @@ yyreduce:
break;
case 257:
+
+/* Line 1455 of yacc.c */
#line 1032 "../parser/Grammar.y"
{ ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4138,6 +4464,8 @@ yyreduce:
break;
case 258:
+
+/* Line 1455 of yacc.c */
#line 1036 "../parser/Grammar.y"
{ ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4146,6 +4474,8 @@ yyreduce:
break;
case 259:
+
+/* Line 1455 of yacc.c */
#line 1043 "../parser/Grammar.y"
{ BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4153,6 +4483,8 @@ yyreduce:
break;
case 260:
+
+/* Line 1455 of yacc.c */
#line 1046 "../parser/Grammar.y"
{ BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4160,6 +4492,8 @@ yyreduce:
break;
case 261:
+
+/* Line 1455 of yacc.c */
#line 1049 "../parser/Grammar.y"
{ BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4167,6 +4501,8 @@ yyreduce:
break;
case 262:
+
+/* Line 1455 of yacc.c */
#line 1052 "../parser/Grammar.y"
{ BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4174,6 +4510,8 @@ yyreduce:
break;
case 263:
+
+/* Line 1455 of yacc.c */
#line 1058 "../parser/Grammar.y"
{ ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4181,6 +4519,8 @@ yyreduce:
break;
case 264:
+
+/* Line 1455 of yacc.c */
#line 1061 "../parser/Grammar.y"
{ ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4188,6 +4528,8 @@ yyreduce:
break;
case 265:
+
+/* Line 1455 of yacc.c */
#line 1064 "../parser/Grammar.y"
{ ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4195,6 +4537,8 @@ yyreduce:
break;
case 266:
+
+/* Line 1455 of yacc.c */
#line 1067 "../parser/Grammar.y"
{ ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4202,6 +4546,8 @@ yyreduce:
break;
case 267:
+
+/* Line 1455 of yacc.c */
#line 1073 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WithNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node, (yylsp[(3) - (5)]).last_column, (yylsp[(3) - (5)]).last_column - (yylsp[(3) - (5)]).first_column),
(yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features | WithFeature, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants);
@@ -4209,6 +4555,8 @@ yyreduce:
break;
case 268:
+
+/* Line 1455 of yacc.c */
#line 1079 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) SwitchNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].caseBlockNode).m_node), (yyvsp[(5) - (5)].caseBlockNode).m_varDeclarations, (yyvsp[(5) - (5)].caseBlockNode).m_funcDeclarations,
(yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].caseBlockNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].caseBlockNode).m_numConstants);
@@ -4216,11 +4564,15 @@ yyreduce:
break;
case 269:
+
+/* Line 1455 of yacc.c */
#line 1085 "../parser/Grammar.y"
{ (yyval.caseBlockNode) = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].clauseList).m_node.head, 0, 0), (yyvsp[(2) - (3)].clauseList).m_varDeclarations, (yyvsp[(2) - (3)].clauseList).m_funcDeclarations, (yyvsp[(2) - (3)].clauseList).m_features, (yyvsp[(2) - (3)].clauseList).m_numConstants); ;}
break;
case 270:
+
+/* Line 1455 of yacc.c */
#line 1087 "../parser/Grammar.y"
{ (yyval.caseBlockNode) = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (5)].clauseList).m_node.head, (yyvsp[(3) - (5)].caseClauseNode).m_node, (yyvsp[(4) - (5)].clauseList).m_node.head),
mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_varDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_varDeclarations), (yyvsp[(4) - (5)].clauseList).m_varDeclarations),
@@ -4230,11 +4582,15 @@ yyreduce:
break;
case 271:
+
+/* Line 1455 of yacc.c */
#line 1095 "../parser/Grammar.y"
{ (yyval.clauseList).m_node.head = 0; (yyval.clauseList).m_node.tail = 0; (yyval.clauseList).m_varDeclarations = 0; (yyval.clauseList).m_funcDeclarations = 0; (yyval.clauseList).m_features = 0; (yyval.clauseList).m_numConstants = 0; ;}
break;
case 273:
+
+/* Line 1455 of yacc.c */
#line 1100 "../parser/Grammar.y"
{ (yyval.clauseList).m_node.head = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].caseClauseNode).m_node);
(yyval.clauseList).m_node.tail = (yyval.clauseList).m_node.head;
@@ -4245,6 +4601,8 @@ yyreduce:
break;
case 274:
+
+/* Line 1455 of yacc.c */
#line 1106 "../parser/Grammar.y"
{ (yyval.clauseList).m_node.head = (yyvsp[(1) - (2)].clauseList).m_node.head;
(yyval.clauseList).m_node.tail = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (2)].clauseList).m_node.tail, (yyvsp[(2) - (2)].caseClauseNode).m_node);
@@ -4256,26 +4614,36 @@ yyreduce:
break;
case 275:
+
+/* Line 1455 of yacc.c */
#line 1116 "../parser/Grammar.y"
{ (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node), 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); ;}
break;
case 276:
+
+/* Line 1455 of yacc.c */
#line 1117 "../parser/Grammar.y"
{ (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].sourceElements).m_node), (yyvsp[(4) - (4)].sourceElements).m_varDeclarations, (yyvsp[(4) - (4)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (4)].expressionNode).m_features | (yyvsp[(4) - (4)].sourceElements).m_features, (yyvsp[(2) - (4)].expressionNode).m_numConstants + (yyvsp[(4) - (4)].sourceElements).m_numConstants); ;}
break;
case 277:
+
+/* Line 1455 of yacc.c */
#line 1121 "../parser/Grammar.y"
{ (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); ;}
break;
case 278:
+
+/* Line 1455 of yacc.c */
#line 1122 "../parser/Grammar.y"
{ (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0, (yyvsp[(3) - (3)].sourceElements).m_node), (yyvsp[(3) - (3)].sourceElements).m_varDeclarations, (yyvsp[(3) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(3) - (3)].sourceElements).m_features, (yyvsp[(3) - (3)].sourceElements).m_numConstants); ;}
break;
case 279:
+
+/* Line 1455 of yacc.c */
#line 1126 "../parser/Grammar.y"
{ LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].statementNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4283,6 +4651,8 @@ yyreduce:
break;
case 280:
+
+/* Line 1455 of yacc.c */
#line 1132 "../parser/Grammar.y"
{ ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4291,6 +4661,8 @@ yyreduce:
break;
case 281:
+
+/* Line 1455 of yacc.c */
#line 1136 "../parser/Grammar.y"
{ ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4299,6 +4671,8 @@ yyreduce:
break;
case 282:
+
+/* Line 1455 of yacc.c */
#line 1143 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, (yyvsp[(2) - (4)].statementNode).m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, (yyvsp[(4) - (4)].statementNode).m_node),
mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_varDeclarations, (yyvsp[(4) - (4)].statementNode).m_varDeclarations),
@@ -4309,6 +4683,8 @@ yyreduce:
break;
case 283:
+
+/* Line 1455 of yacc.c */
#line 1149 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, *(yyvsp[(5) - (7)].ident), ((yyvsp[(7) - (7)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (7)].statementNode).m_node, 0),
mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations),
@@ -4319,6 +4695,8 @@ yyreduce:
break;
case 284:
+
+/* Line 1455 of yacc.c */
#line 1156 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, (yyvsp[(2) - (9)].statementNode).m_node, *(yyvsp[(5) - (9)].ident), ((yyvsp[(7) - (9)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (9)].statementNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node),
mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_varDeclarations, (yyvsp[(7) - (9)].statementNode).m_varDeclarations), (yyvsp[(9) - (9)].statementNode).m_varDeclarations),
@@ -4329,23 +4707,31 @@ yyreduce:
break;
case 285:
+
+/* Line 1455 of yacc.c */
#line 1165 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
break;
case 286:
+
+/* Line 1455 of yacc.c */
#line 1167 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;}
break;
case 287:
+
+/* Line 1455 of yacc.c */
#line 1172 "../parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*(yyvsp[(2) - (7)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); (yyval.statementNode).m_funcDeclarations->data.append(static_cast<FuncDeclNode*>((yyval.statementNode).m_node)); ;}
break;
case 288:
+
+/* Line 1455 of yacc.c */
#line 1174 "../parser/Grammar.y"
{
(yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*(yyvsp[(2) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0);
@@ -4357,11 +4743,15 @@ yyreduce:
break;
case 289:
+
+/* Line 1455 of yacc.c */
#line 1184 "../parser/Grammar.y"
{ (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(5) - (6)].functionBodyNode), LEXER->sourceCode((yyvsp[(4) - (6)].intValue), (yyvsp[(6) - (6)].intValue), (yylsp[(4) - (6)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(5) - (6)].functionBodyNode), (yylsp[(4) - (6)]), (yylsp[(6) - (6)])); ;}
break;
case 290:
+
+/* Line 1455 of yacc.c */
#line 1186 "../parser/Grammar.y"
{
(yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line), (yyvsp[(3) - (7)].parameterList).m_node.head), (yyvsp[(3) - (7)].parameterList).m_features | ClosureFeature, 0);
@@ -4372,11 +4762,15 @@ yyreduce:
break;
case 291:
+
+/* Line 1455 of yacc.c */
#line 1192 "../parser/Grammar.y"
{ (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); ;}
break;
case 292:
+
+/* Line 1455 of yacc.c */
#line 1194 "../parser/Grammar.y"
{
(yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0);
@@ -4387,6 +4781,8 @@ yyreduce:
break;
case 293:
+
+/* Line 1455 of yacc.c */
#line 1203 "../parser/Grammar.y"
{ (yyval.parameterList).m_node.head = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident));
(yyval.parameterList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
@@ -4394,6 +4790,8 @@ yyreduce:
break;
case 294:
+
+/* Line 1455 of yacc.c */
#line 1206 "../parser/Grammar.y"
{ (yyval.parameterList).m_node.head = (yyvsp[(1) - (3)].parameterList).m_node.head;
(yyval.parameterList).m_features = (yyvsp[(1) - (3)].parameterList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
@@ -4401,27 +4799,37 @@ yyreduce:
break;
case 295:
+
+/* Line 1455 of yacc.c */
#line 1212 "../parser/Grammar.y"
{ (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;}
break;
case 296:
+
+/* Line 1455 of yacc.c */
#line 1213 "../parser/Grammar.y"
{ (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;}
break;
case 297:
+
+/* Line 1455 of yacc.c */
#line 1217 "../parser/Grammar.y"
{ GLOBAL_DATA->parser->didFinishParsing(new (GLOBAL_DATA) SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, (yylsp[(0) - (0)]).last_line, 0); ;}
break;
case 298:
+
+/* Line 1455 of yacc.c */
#line 1218 "../parser/Grammar.y"
{ GLOBAL_DATA->parser->didFinishParsing((yyvsp[(1) - (1)].sourceElements).m_node, (yyvsp[(1) - (1)].sourceElements).m_varDeclarations, (yyvsp[(1) - (1)].sourceElements).m_funcDeclarations, (yyvsp[(1) - (1)].sourceElements).m_features,
(yylsp[(1) - (1)]).last_line, (yyvsp[(1) - (1)].sourceElements).m_numConstants); ;}
break;
case 299:
+
+/* Line 1455 of yacc.c */
#line 1223 "../parser/Grammar.y"
{ (yyval.sourceElements).m_node = new (GLOBAL_DATA) SourceElements(GLOBAL_DATA);
(yyval.sourceElements).m_node->append((yyvsp[(1) - (1)].statementNode).m_node);
@@ -4433,6 +4841,8 @@ yyreduce:
break;
case 300:
+
+/* Line 1455 of yacc.c */
#line 1230 "../parser/Grammar.y"
{ (yyval.sourceElements).m_node->append((yyvsp[(2) - (2)].statementNode).m_node);
(yyval.sourceElements).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_varDeclarations, (yyvsp[(2) - (2)].statementNode).m_varDeclarations);
@@ -4443,188 +4853,261 @@ yyreduce:
break;
case 304:
+
+/* Line 1455 of yacc.c */
#line 1244 "../parser/Grammar.y"
{ ;}
break;
case 305:
+
+/* Line 1455 of yacc.c */
#line 1245 "../parser/Grammar.y"
{ ;}
break;
case 306:
+
+/* Line 1455 of yacc.c */
#line 1246 "../parser/Grammar.y"
{ Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;}
break;
case 307:
+
+/* Line 1455 of yacc.c */
#line 1247 "../parser/Grammar.y"
{ Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;}
break;
case 308:
+
+/* Line 1455 of yacc.c */
#line 1251 "../parser/Grammar.y"
{ ;}
break;
case 309:
+
+/* Line 1455 of yacc.c */
#line 1252 "../parser/Grammar.y"
{ ;}
break;
case 310:
+
+/* Line 1455 of yacc.c */
#line 1253 "../parser/Grammar.y"
{ ;}
break;
case 311:
+
+/* Line 1455 of yacc.c */
#line 1254 "../parser/Grammar.y"
{ if (*(yyvsp[(1) - (7)].ident) != "get" && *(yyvsp[(1) - (7)].ident) != "set") YYABORT; ;}
break;
case 312:
+
+/* Line 1455 of yacc.c */
#line 1255 "../parser/Grammar.y"
{ if (*(yyvsp[(1) - (8)].ident) != "get" && *(yyvsp[(1) - (8)].ident) != "set") YYABORT; ;}
break;
case 316:
+
+/* Line 1455 of yacc.c */
#line 1265 "../parser/Grammar.y"
{ ;}
break;
case 317:
+
+/* Line 1455 of yacc.c */
#line 1266 "../parser/Grammar.y"
{ ;}
break;
case 318:
+
+/* Line 1455 of yacc.c */
#line 1268 "../parser/Grammar.y"
{ ;}
break;
case 322:
+
+/* Line 1455 of yacc.c */
#line 1275 "../parser/Grammar.y"
{ ;}
break;
case 517:
+
+/* Line 1455 of yacc.c */
#line 1643 "../parser/Grammar.y"
{ ;}
break;
case 518:
+
+/* Line 1455 of yacc.c */
#line 1644 "../parser/Grammar.y"
{ ;}
break;
case 520:
+
+/* Line 1455 of yacc.c */
#line 1649 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 521:
+
+/* Line 1455 of yacc.c */
#line 1653 "../parser/Grammar.y"
{ ;}
break;
case 522:
+
+/* Line 1455 of yacc.c */
#line 1654 "../parser/Grammar.y"
{ ;}
break;
case 525:
+
+/* Line 1455 of yacc.c */
#line 1660 "../parser/Grammar.y"
{ ;}
break;
case 526:
+
+/* Line 1455 of yacc.c */
#line 1661 "../parser/Grammar.y"
{ ;}
break;
case 530:
+
+/* Line 1455 of yacc.c */
#line 1668 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 533:
+
+/* Line 1455 of yacc.c */
#line 1677 "../parser/Grammar.y"
{ ;}
break;
case 534:
+
+/* Line 1455 of yacc.c */
#line 1678 "../parser/Grammar.y"
{ ;}
break;
case 539:
+
+/* Line 1455 of yacc.c */
#line 1695 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 555:
+
+/* Line 1455 of yacc.c */
#line 1726 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 557:
+
+/* Line 1455 of yacc.c */
#line 1728 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 559:
+
+/* Line 1455 of yacc.c */
#line 1733 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 561:
+
+/* Line 1455 of yacc.c */
#line 1735 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 563:
+
+/* Line 1455 of yacc.c */
#line 1740 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 565:
+
+/* Line 1455 of yacc.c */
#line 1742 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 568:
+
+/* Line 1455 of yacc.c */
#line 1754 "../parser/Grammar.y"
{ ;}
break;
case 569:
+
+/* Line 1455 of yacc.c */
#line 1755 "../parser/Grammar.y"
{ ;}
break;
case 578:
+
+/* Line 1455 of yacc.c */
#line 1779 "../parser/Grammar.y"
{ ;}
break;
case 580:
+
+/* Line 1455 of yacc.c */
#line 1784 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 585:
+
+/* Line 1455 of yacc.c */
#line 1795 "../parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 592:
+
+/* Line 1455 of yacc.c */
#line 1811 "../parser/Grammar.y"
{ ;}
break;
-/* Line 1267 of yacc.c. */
-#line 4628 "JavaScriptCore/tmp/../generated/Grammar.tab.c"
+
+/* Line 1455 of yacc.c */
+#line 5111 "JavaScriptCore/tmp/../generated/Grammar.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -4700,7 +5183,7 @@ yyerrlab:
if (yyerrstatus == 3)
{
- /* If just tried and failed to reuse look-ahead token after an
+ /* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
@@ -4717,7 +5200,7 @@ yyerrlab:
}
}
- /* Else will try to reuse look-ahead token after shifting the error
+ /* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
@@ -4775,14 +5258,11 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
*++yyvsp = yylval;
yyerror_range[1] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
- the look-ahead. YYLOC is available though. */
+ the lookahead. YYLOC is available though. */
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
*++yylsp = yyloc;
@@ -4807,7 +5287,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -4818,7 +5298,7 @@ yyexhaustedlab:
#endif
yyreturn:
- if (yychar != YYEOF && yychar != YYEMPTY)
+ if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, &yylloc);
/* Do not reclaim the symbols of the rule which action triggered
@@ -4844,6 +5324,8 @@ yyreturn:
}
+
+/* Line 1675 of yacc.c */
#line 1827 "../parser/Grammar.y"
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h
index ebd30c8..c7d3837 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -29,10 +28,11 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -104,78 +104,16 @@
AUTOMINUSMINUS = 320
};
#endif
-/* Tokens. */
-#define NULLTOKEN 258
-#define TRUETOKEN 259
-#define FALSETOKEN 260
-#define BREAK 261
-#define CASE 262
-#define DEFAULT 263
-#define FOR 264
-#define NEW 265
-#define VAR 266
-#define CONSTTOKEN 267
-#define CONTINUE 268
-#define FUNCTION 269
-#define RETURN 270
-#define VOIDTOKEN 271
-#define DELETETOKEN 272
-#define IF 273
-#define THISTOKEN 274
-#define DO 275
-#define WHILE 276
-#define INTOKEN 277
-#define INSTANCEOF 278
-#define TYPEOF 279
-#define SWITCH 280
-#define WITH 281
-#define RESERVED 282
-#define THROW 283
-#define TRY 284
-#define CATCH 285
-#define FINALLY 286
-#define DEBUGGER 287
-#define IF_WITHOUT_ELSE 288
-#define ELSE 289
-#define EQEQ 290
-#define NE 291
-#define STREQ 292
-#define STRNEQ 293
-#define LE 294
-#define GE 295
-#define OR 296
-#define AND 297
-#define PLUSPLUS 298
-#define MINUSMINUS 299
-#define LSHIFT 300
-#define RSHIFT 301
-#define URSHIFT 302
-#define PLUSEQUAL 303
-#define MINUSEQUAL 304
-#define MULTEQUAL 305
-#define DIVEQUAL 306
-#define LSHIFTEQUAL 307
-#define RSHIFTEQUAL 308
-#define URSHIFTEQUAL 309
-#define ANDEQUAL 310
-#define MODEQUAL 311
-#define XOREQUAL 312
-#define OREQUAL 313
-#define OPENBRACE 314
-#define CLOSEBRACE 315
-#define NUMBER 316
-#define IDENT 317
-#define STRING 318
-#define AUTOPLUSPLUS 319
-#define AUTOMINUSMINUS 320
-
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 157 "../parser/Grammar.y"
{
+
+/* Line 1676 of yacc.c */
+#line 157 "../parser/Grammar.y"
+
int intValue;
double doubleValue;
Identifier* ident;
@@ -205,13 +143,15 @@ typedef union YYSTYPE
ParameterListInfo parameterList;
Operator op;
-}
-/* Line 1489 of yacc.c. */
-#line 211 "JavaScriptCore/tmp/../generated/Grammar.tab.h"
- YYSTYPE;
+
+
+
+/* Line 1676 of yacc.c */
+#line 151 "JavaScriptCore/tmp/../generated/Grammar.tab.h"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
@@ -230,3 +170,4 @@ typedef struct YYLTYPE
#endif
+
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/JSONObject.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/JSONObject.lut.h
index 2b7e836..a9b1631 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/JSONObject.lut.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/JSONObject.lut.h
@@ -10,6 +10,6 @@ static const struct HashTableValue jsonTableValues[3] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable jsonTable =
+extern JSC_CONST_HASHTABLE HashTable jsonTable =
{ 4, 3, jsonTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Lexer.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/Lexer.lut.h
index fb1ae29..95c33b6 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/Lexer.lut.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/Lexer.lut.h
@@ -44,6 +44,6 @@ static const struct HashTableValue mainTableValues[37] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable mainTable =
+extern JSC_CONST_HASHTABLE HashTable mainTable =
{ 133, 127, mainTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/MathObject.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/MathObject.lut.h
index 7d9b43e..9cb0ee2 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/MathObject.lut.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/MathObject.lut.h
@@ -26,6 +26,6 @@ static const struct HashTableValue mathTableValues[19] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable mathTable =
+extern JSC_CONST_HASHTABLE HashTable mathTable =
{ 67, 63, mathTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/NumberConstructor.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/NumberConstructor.lut.h
index e963e1a..6285d62 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/NumberConstructor.lut.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/NumberConstructor.lut.h
@@ -13,6 +13,6 @@ static const struct HashTableValue numberTableValues[6] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable numberTable =
+extern JSC_CONST_HASHTABLE HashTable numberTable =
{ 16, 15, numberTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/RegExpConstructor.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/RegExpConstructor.lut.h
index fd822c6..a3f15b3 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/RegExpConstructor.lut.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/RegExpConstructor.lut.h
@@ -29,6 +29,6 @@ static const struct HashTableValue regExpConstructorTableValues[22] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable regExpConstructorTable =
+extern JSC_CONST_HASHTABLE HashTable regExpConstructorTable =
{ 65, 63, regExpConstructorTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/RegExpObject.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/RegExpObject.lut.h
index 81d5b60..8c87f16 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/RegExpObject.lut.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/RegExpObject.lut.h
@@ -13,6 +13,6 @@ static const struct HashTableValue regExpTableValues[6] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable regExpTable =
+extern JSC_CONST_HASHTABLE HashTable regExpTable =
{ 17, 15, regExpTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/StringPrototype.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/StringPrototype.lut.h
index dfb9c20..f912298 100644
--- a/src/3rdparty/webkit/JavaScriptCore/generated/StringPrototype.lut.h
+++ b/src/3rdparty/webkit/JavaScriptCore/generated/StringPrototype.lut.h
@@ -40,6 +40,6 @@ static const struct HashTableValue stringTableValues[33] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable stringTable =
+extern JSC_CONST_HASHTABLE HashTable stringTable =
{ 71, 63, stringTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h
index 0b0e5fe..2d677ce 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h
@@ -124,26 +124,23 @@ namespace JSC {
setCalleeArguments(0);
}
- private:
- friend class Arguments;
- friend class JSActivation;
- friend class JSGlobalObject;
- friend class Interpreter;
- friend struct CallFrameClosure;
+ // Read a register from the codeframe (or constant from the CodeBlock).
+ inline Register& r(int);
+ static CallFrame* noCaller() { return reinterpret_cast<CallFrame*>(HostCallFrameFlag); }
int returnValueRegister() const { return this[RegisterFile::ReturnValueRegister].i(); }
+ bool hasHostCallFrameFlag() const { return reinterpret_cast<intptr_t>(this) & HostCallFrameFlag; }
+ CallFrame* addHostCallFrameFlag() const { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) | HostCallFrameFlag); }
+ CallFrame* removeHostCallFrameFlag() { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) & ~HostCallFrameFlag); }
+
+ private:
void setArgumentCount(int count) { this[RegisterFile::ArgumentCount] = count; }
void setCallee(JSFunction* callee) { this[RegisterFile::Callee] = callee; }
void setCodeBlock(CodeBlock* codeBlock) { this[RegisterFile::CodeBlock] = codeBlock; }
static const intptr_t HostCallFrameFlag = 1;
- static CallFrame* noCaller() { return reinterpret_cast<CallFrame*>(HostCallFrameFlag); }
- bool hasHostCallFrameFlag() const { return reinterpret_cast<intptr_t>(this) & HostCallFrameFlag; }
- CallFrame* addHostCallFrameFlag() const { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) | HostCallFrameFlag); }
- CallFrame* removeHostCallFrameFlag() { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) & ~HostCallFrameFlag); }
-
ExecState();
~ExecState();
};
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp
index 7b1e547..ed7e1ee 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp
@@ -65,10 +65,6 @@
#include "JIT.h"
#endif
-#if ENABLE(ASSEMBLER)
-#include "AssemblerBuffer.h"
-#endif
-
using namespace std;
namespace JSC {
@@ -112,7 +108,7 @@ NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, J
exceptionValue = callFrame->globalData().exception;
if (exceptionValue)
return false;
- callFrame[dst] = JSValue(result);
+ callFrame->r(dst) = JSValue(result);
return true;
}
} while (++iter != end);
@@ -145,7 +141,7 @@ NEVER_INLINE bool Interpreter::resolveSkip(CallFrame* callFrame, Instruction* vP
exceptionValue = callFrame->globalData().exception;
if (exceptionValue)
return false;
- callFrame[dst] = JSValue(result);
+ callFrame->r(dst) = JSValue(result);
return true;
}
} while (++iter != end);
@@ -163,7 +159,7 @@ NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction*
int offset = (vPC + 5)->u.operand;
if (structure == globalObject->structure()) {
- callFrame[dst] = JSValue(globalObject->getDirectOffset(offset));
+ callFrame->r(dst) = JSValue(globalObject->getDirectOffset(offset));
return true;
}
@@ -178,14 +174,14 @@ NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction*
globalObject->structure()->ref();
vPC[4] = globalObject->structure();
vPC[5] = slot.cachedOffset();
- callFrame[dst] = JSValue(result);
+ callFrame->r(dst) = JSValue(result);
return true;
}
exceptionValue = callFrame->globalData().exception;
if (exceptionValue)
return false;
- callFrame[dst] = JSValue(result);
+ callFrame->r(dst) = JSValue(result);
return true;
}
@@ -197,7 +193,7 @@ NEVER_INLINE void Interpreter::resolveBase(CallFrame* callFrame, Instruction* vP
{
int dst = (vPC + 1)->u.operand;
int property = (vPC + 2)->u.operand;
- callFrame[dst] = JSValue(JSC::resolveBase(callFrame, callFrame->codeBlock()->identifier(property), callFrame->scopeChain()));
+ callFrame->r(dst) = JSValue(JSC::resolveBase(callFrame, callFrame->codeBlock()->identifier(property), callFrame->scopeChain()));
}
NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
@@ -225,8 +221,8 @@ NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Inst
exceptionValue = callFrame->globalData().exception;
if (exceptionValue)
return false;
- callFrame[propDst] = JSValue(result);
- callFrame[baseDst] = JSValue(base);
+ callFrame->r(propDst) = JSValue(result);
+ callFrame->r(baseDst) = JSValue(base);
return true;
}
++iter;
@@ -270,8 +266,8 @@ NEVER_INLINE bool Interpreter::resolveBaseAndFunc(CallFrame* callFrame, Instruct
if (exceptionValue)
return false;
- callFrame[baseDst] = JSValue(thisObj);
- callFrame[funcDst] = JSValue(result);
+ callFrame->r(baseDst) = JSValue(thisObj);
+ callFrame->r(funcDst) = JSValue(result);
return true;
}
++iter;
@@ -436,17 +432,7 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
}
printf("----------------------------------------------------\n");
- end = it + codeBlock->m_numConstants;
- if (it != end) {
- do {
- printf("[r%2d] | %10p | %10p \n", registerCount, it, (*it).v());
- ++it;
- ++registerCount;
- } while (it != end);
- }
- printf("----------------------------------------------------\n");
-
- end = it + codeBlock->m_numCalleeRegisters - codeBlock->m_numConstants - codeBlock->m_numVars;
+ end = it + codeBlock->m_numCalleeRegisters - codeBlock->m_numVars;
if (it != end) {
do {
printf("[r%2d] | %10p | %10p \n", registerCount, it, (*it).v());
@@ -567,13 +553,13 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
if (Profiler* profiler = *Profiler::enabledProfilerReference()) {
#if !ENABLE(JIT)
if (isCallBytecode(codeBlock->instructions()[bytecodeOffset].u.opcode))
- profiler->didExecute(callFrame, callFrame[codeBlock->instructions()[bytecodeOffset + 2].u.operand].jsValue());
+ profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 2].u.operand).jsValue());
else if (codeBlock->instructions()[bytecodeOffset + 8].u.opcode == getOpcode(op_construct))
- profiler->didExecute(callFrame, callFrame[codeBlock->instructions()[bytecodeOffset + 10].u.operand].jsValue());
+ profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 10].u.operand).jsValue());
#else
int functionRegisterIndex;
if (codeBlock->functionRegisterForBytecodeOffset(bytecodeOffset, functionRegisterIndex))
- profiler->didExecute(callFrame, callFrame[functionRegisterIndex].jsValue());
+ profiler->didExecute(callFrame, callFrame->r(functionRegisterIndex).jsValue());
#endif
}
@@ -625,7 +611,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco
globalObject->copyGlobalsTo(m_registerFile);
CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize);
- newCallFrame[codeBlock->thisRegister()] = JSValue(thisObj);
+ newCallFrame->r(codeBlock->thisRegister()) = JSValue(thisObj);
newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), 0, 0, 0);
if (codeBlock->needsFullScopeChain())
@@ -682,10 +668,10 @@ JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* call
CallFrame* newCallFrame = CallFrame::create(oldEnd);
size_t dst = 0;
- newCallFrame[0] = JSValue(thisObj);
+ newCallFrame->r(0) = JSValue(thisObj);
ArgList::const_iterator end = args.end();
for (ArgList::const_iterator it = args.begin(); it != end; ++it)
- newCallFrame[++dst] = *it;
+ newCallFrame->r(++dst) = *it;
CodeBlock* codeBlock = &functionBodyNode->bytecode(scopeChain);
newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
@@ -743,7 +729,7 @@ CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBod
CallFrame* newCallFrame = CallFrame::create(oldEnd);
size_t dst = 0;
for (int i = 0; i < argc; ++i)
- newCallFrame[++dst] = jsUndefined();
+ newCallFrame->r(++dst) = jsUndefined();
CodeBlock* codeBlock = &functionBodyNode->bytecode(scopeChain);
newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
@@ -854,7 +840,7 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject*
CallFrame* newCallFrame = CallFrame::create(m_registerFile.start() + globalRegisterOffset);
// a 0 codeBlock indicates a built-in caller
- newCallFrame[codeBlock->thisRegister()] = JSValue(thisObj);
+ newCallFrame->r(codeBlock->thisRegister()) = JSValue(thisObj);
newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, 0, 0);
if (codeBlock->needsFullScopeChain())
@@ -918,9 +904,9 @@ NEVER_INLINE ScopeChainNode* Interpreter::createExceptionScope(CallFrame* callFr
int dst = (++vPC)->u.operand;
CodeBlock* codeBlock = callFrame->codeBlock();
Identifier& property = codeBlock->identifier((++vPC)->u.operand);
- JSValue value = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue value = callFrame->r((++vPC)->u.operand).jsValue();
JSObject* scope = new (callFrame) JSStaticScopeObject(callFrame, property, value, DontDelete);
- callFrame[dst] = JSValue(scope);
+ callFrame->r(dst) = JSValue(scope);
return callFrame->scopeChain()->push(scope);
}
@@ -1197,7 +1183,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
constructor, and puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- callFrame[dst] = JSValue(constructEmptyObject(callFrame));
+ callFrame->r(dst) = JSValue(constructEmptyObject(callFrame));
++vPC;
NEXT_INSTRUCTION();
@@ -1214,7 +1200,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int firstArg = (++vPC)->u.operand;
int argCount = (++vPC)->u.operand;
ArgList args(callFrame->registers() + firstArg, argCount);
- callFrame[dst] = JSValue(constructArray(callFrame, args));
+ callFrame->r(dst) = JSValue(constructArray(callFrame, args));
++vPC;
NEXT_INSTRUCTION();
@@ -1228,7 +1214,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int regExp = (++vPC)->u.operand;
- callFrame[dst] = JSValue(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexp(regExp)));
+ callFrame->r(dst) = JSValue(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexp(regExp)));
++vPC;
NEXT_INSTRUCTION();
@@ -1240,7 +1226,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = callFrame[src];
+ callFrame->r(dst) = callFrame->r(src);
++vPC;
NEXT_INSTRUCTION();
@@ -1253,14 +1239,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
if (JSFastMath::canDoFastBitwiseOperations(src1, src2))
- callFrame[dst] = JSFastMath::equal(src1, src2);
+ callFrame->r(dst) = JSFastMath::equal(src1, src2);
else {
JSValue result = jsBoolean(JSValue::equalSlowCase(callFrame, src1, src2));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
++vPC;
@@ -1273,15 +1259,15 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
operator, and puts the result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src = callFrame->r((++vPC)->u.operand).jsValue();
if (src.isUndefinedOrNull()) {
- callFrame[dst] = jsBoolean(true);
+ callFrame->r(dst) = jsBoolean(true);
++vPC;
NEXT_INSTRUCTION();
}
- callFrame[dst] = jsBoolean(src.isCell() && src.asCell()->structure()->typeInfo().masqueradesAsUndefined());
+ callFrame->r(dst) = jsBoolean(src.isCell() && src.asCell()->structure()->typeInfo().masqueradesAsUndefined());
++vPC;
NEXT_INSTRUCTION();
}
@@ -1293,14 +1279,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
if (JSFastMath::canDoFastBitwiseOperations(src1, src2))
- callFrame[dst] = JSFastMath::notEqual(src1, src2);
+ callFrame->r(dst) = JSFastMath::notEqual(src1, src2);
else {
JSValue result = jsBoolean(!JSValue::equalSlowCase(callFrame, src1, src2));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
++vPC;
@@ -1313,15 +1299,15 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
operator, and puts the result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src = callFrame->r((++vPC)->u.operand).jsValue();
if (src.isUndefinedOrNull()) {
- callFrame[dst] = jsBoolean(false);
+ callFrame->r(dst) = jsBoolean(false);
++vPC;
NEXT_INSTRUCTION();
}
- callFrame[dst] = jsBoolean(!src.isCell() || !asCell(src)->structure()->typeInfo().masqueradesAsUndefined());
+ callFrame->r(dst) = jsBoolean(!src.isCell() || !asCell(src)->structure()->typeInfo().masqueradesAsUndefined());
++vPC;
NEXT_INSTRUCTION();
}
@@ -1333,9 +1319,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
- callFrame[dst] = jsBoolean(JSValue::strictEqual(src1, src2));
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
+ callFrame->r(dst) = jsBoolean(JSValue::strictEqual(src1, src2));
++vPC;
NEXT_INSTRUCTION();
@@ -1348,9 +1334,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
puts the result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
- callFrame[dst] = jsBoolean(!JSValue::strictEqual(src1, src2));
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
+ callFrame->r(dst) = jsBoolean(!JSValue::strictEqual(src1, src2));
++vPC;
NEXT_INSTRUCTION();
@@ -1363,11 +1349,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
JSValue result = jsBoolean(jsLess(callFrame, src1, src2));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
++vPC;
NEXT_INSTRUCTION();
@@ -1380,11 +1366,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
puts the result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
JSValue result = jsBoolean(jsLessEq(callFrame, src1, src2));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
++vPC;
NEXT_INSTRUCTION();
@@ -1396,13 +1382,13 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
back in register srcDst.
*/
int srcDst = (++vPC)->u.operand;
- JSValue v = callFrame[srcDst].jsValue();
+ JSValue v = callFrame->r(srcDst).jsValue();
if (JSFastMath::canDoFastAdditiveOperations(v))
- callFrame[srcDst] = JSValue(JSFastMath::incImmediateNumber(v));
+ callFrame->r(srcDst) = JSValue(JSFastMath::incImmediateNumber(v));
else {
JSValue result = jsNumber(callFrame, v.toNumber(callFrame) + 1);
CHECK_FOR_EXCEPTION();
- callFrame[srcDst] = result;
+ callFrame->r(srcDst) = result;
}
++vPC;
@@ -1415,13 +1401,13 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
back in register srcDst.
*/
int srcDst = (++vPC)->u.operand;
- JSValue v = callFrame[srcDst].jsValue();
+ JSValue v = callFrame->r(srcDst).jsValue();
if (JSFastMath::canDoFastAdditiveOperations(v))
- callFrame[srcDst] = JSValue(JSFastMath::decImmediateNumber(v));
+ callFrame->r(srcDst) = JSValue(JSFastMath::decImmediateNumber(v));
else {
JSValue result = jsNumber(callFrame, v.toNumber(callFrame) - 1);
CHECK_FOR_EXCEPTION();
- callFrame[srcDst] = result;
+ callFrame->r(srcDst) = result;
}
++vPC;
@@ -1436,15 +1422,15 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int srcDst = (++vPC)->u.operand;
- JSValue v = callFrame[srcDst].jsValue();
+ JSValue v = callFrame->r(srcDst).jsValue();
if (JSFastMath::canDoFastAdditiveOperations(v)) {
- callFrame[dst] = v;
- callFrame[srcDst] = JSValue(JSFastMath::incImmediateNumber(v));
+ callFrame->r(dst) = v;
+ callFrame->r(srcDst) = JSValue(JSFastMath::incImmediateNumber(v));
} else {
- JSValue number = callFrame[srcDst].jsValue().toJSNumber(callFrame);
+ JSValue number = callFrame->r(srcDst).jsValue().toJSNumber(callFrame);
CHECK_FOR_EXCEPTION();
- callFrame[dst] = number;
- callFrame[srcDst] = JSValue(jsNumber(callFrame, number.uncheckedGetNumber() + 1));
+ callFrame->r(dst) = number;
+ callFrame->r(srcDst) = JSValue(jsNumber(callFrame, number.uncheckedGetNumber() + 1));
}
++vPC;
@@ -1459,15 +1445,15 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int srcDst = (++vPC)->u.operand;
- JSValue v = callFrame[srcDst].jsValue();
+ JSValue v = callFrame->r(srcDst).jsValue();
if (JSFastMath::canDoFastAdditiveOperations(v)) {
- callFrame[dst] = v;
- callFrame[srcDst] = JSValue(JSFastMath::decImmediateNumber(v));
+ callFrame->r(dst) = v;
+ callFrame->r(srcDst) = JSValue(JSFastMath::decImmediateNumber(v));
} else {
- JSValue number = callFrame[srcDst].jsValue().toJSNumber(callFrame);
+ JSValue number = callFrame->r(srcDst).jsValue().toJSNumber(callFrame);
CHECK_FOR_EXCEPTION();
- callFrame[dst] = number;
- callFrame[srcDst] = JSValue(jsNumber(callFrame, number.uncheckedGetNumber() - 1));
+ callFrame->r(dst) = number;
+ callFrame->r(srcDst) = JSValue(jsNumber(callFrame, number.uncheckedGetNumber() - 1));
}
++vPC;
@@ -1482,14 +1468,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- JSValue srcVal = callFrame[src].jsValue();
+ JSValue srcVal = callFrame->r(src).jsValue();
if (LIKELY(srcVal.isNumber()))
- callFrame[dst] = callFrame[src];
+ callFrame->r(dst) = callFrame->r(src);
else {
JSValue result = srcVal.toJSNumber(callFrame);
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
++vPC;
@@ -1502,15 +1488,15 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src = callFrame->r((++vPC)->u.operand).jsValue();
++vPC;
double v;
if (src.getNumber(v))
- callFrame[dst] = JSValue(jsNumber(callFrame, -v));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, -v));
else {
JSValue result = jsNumber(callFrame, -src.toNumber(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
NEXT_INSTRUCTION();
@@ -1523,14 +1509,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
numeric add, depending on the types of the operands.)
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
if (JSFastMath::canDoFastAdditiveOperations(src1, src2))
- callFrame[dst] = JSValue(JSFastMath::addImmediateNumbers(src1, src2));
+ callFrame->r(dst) = JSValue(JSFastMath::addImmediateNumbers(src1, src2));
else {
JSValue result = jsAdd(callFrame, src1, src2);
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
vPC += 2;
NEXT_INSTRUCTION();
@@ -1542,23 +1528,23 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
numbers), and puts the product in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
double left;
double right;
if (JSValue::areBothInt32Fast(src1, src2)) {
int32_t left = src1.getInt32Fast();
int32_t right = src2.getInt32Fast();
if ((left | right) >> 15 == 0)
- callFrame[dst] = JSValue(jsNumber(callFrame, left * right));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, left * right));
else
- callFrame[dst] = JSValue(jsNumber(callFrame, static_cast<double>(left) * static_cast<double>(right)));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, static_cast<double>(left) * static_cast<double>(right)));
} else if (src1.getNumber(left) && src2.getNumber(right))
- callFrame[dst] = JSValue(jsNumber(callFrame, left * right));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, left * right));
else {
JSValue result = jsNumber(callFrame, src1.toNumber(callFrame) * src2.toNumber(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
vPC += 2;
@@ -1572,16 +1558,16 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
quotient in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue dividend = callFrame[(++vPC)->u.operand].jsValue();
- JSValue divisor = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue dividend = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue divisor = callFrame->r((++vPC)->u.operand).jsValue();
double left;
double right;
if (dividend.getNumber(left) && divisor.getNumber(right))
- callFrame[dst] = JSValue(jsNumber(callFrame, left / right));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, left / right));
else {
JSValue result = jsNumber(callFrame, dividend.toNumber(callFrame) / divisor.toNumber(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
++vPC;
NEXT_INSTRUCTION();
@@ -1597,15 +1583,15 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dividend = (++vPC)->u.operand;
int divisor = (++vPC)->u.operand;
- JSValue dividendValue = callFrame[dividend].jsValue();
- JSValue divisorValue = callFrame[divisor].jsValue();
+ JSValue dividendValue = callFrame->r(dividend).jsValue();
+ JSValue divisorValue = callFrame->r(divisor).jsValue();
if (JSValue::areBothInt32Fast(dividendValue, divisorValue) && divisorValue != jsNumber(callFrame, 0)) {
// We expect the result of the modulus of a number that was representable as an int32 to also be representable
// as an int32.
JSValue result = JSValue::makeInt32Fast(dividendValue.getInt32Fast() % divisorValue.getInt32Fast());
ASSERT(result);
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
++vPC;
NEXT_INSTRUCTION();
}
@@ -1613,7 +1599,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
double d = dividendValue.toNumber(callFrame);
JSValue result = jsNumber(callFrame, fmod(d, divisorValue.toNumber(callFrame)));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
++vPC;
NEXT_INSTRUCTION();
}
@@ -1625,18 +1611,18 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
double left;
double right;
if (JSFastMath::canDoFastAdditiveOperations(src1, src2))
- callFrame[dst] = JSValue(JSFastMath::subImmediateNumbers(src1, src2));
+ callFrame->r(dst) = JSValue(JSFastMath::subImmediateNumbers(src1, src2));
else if (src1.getNumber(left) && src2.getNumber(right))
- callFrame[dst] = JSValue(jsNumber(callFrame, left - right));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, left - right));
else {
JSValue result = jsNumber(callFrame, src1.toNumber(callFrame) - src2.toNumber(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
vPC += 2;
NEXT_INSTRUCTION();
@@ -1649,18 +1635,18 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue val = callFrame[(++vPC)->u.operand].jsValue();
- JSValue shift = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue val = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue shift = callFrame->r((++vPC)->u.operand).jsValue();
int32_t left;
uint32_t right;
if (JSValue::areBothInt32Fast(val, shift))
- callFrame[dst] = JSValue(jsNumber(callFrame, val.getInt32Fast() << (shift.getInt32Fast() & 0x1f)));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, val.getInt32Fast() << (shift.getInt32Fast() & 0x1f)));
else if (val.numberToInt32(left) && shift.numberToUInt32(right))
- callFrame[dst] = JSValue(jsNumber(callFrame, left << (right & 0x1f)));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, left << (right & 0x1f)));
else {
JSValue result = jsNumber(callFrame, (val.toInt32(callFrame)) << (shift.toUInt32(callFrame) & 0x1f));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
++vPC;
@@ -1674,18 +1660,18 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
uint32), and puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue val = callFrame[(++vPC)->u.operand].jsValue();
- JSValue shift = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue val = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue shift = callFrame->r((++vPC)->u.operand).jsValue();
int32_t left;
uint32_t right;
if (JSFastMath::canDoFastRshift(val, shift))
- callFrame[dst] = JSValue(JSFastMath::rightShiftImmediateNumbers(val, shift));
+ callFrame->r(dst) = JSValue(JSFastMath::rightShiftImmediateNumbers(val, shift));
else if (val.numberToInt32(left) && shift.numberToUInt32(right))
- callFrame[dst] = JSValue(jsNumber(callFrame, left >> (right & 0x1f)));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, left >> (right & 0x1f)));
else {
JSValue result = jsNumber(callFrame, (val.toInt32(callFrame)) >> (shift.toUInt32(callFrame) & 0x1f));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
++vPC;
@@ -1699,14 +1685,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
uint32), and puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue val = callFrame[(++vPC)->u.operand].jsValue();
- JSValue shift = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue val = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue shift = callFrame->r((++vPC)->u.operand).jsValue();
if (JSFastMath::canDoFastUrshift(val, shift))
- callFrame[dst] = JSValue(JSFastMath::rightShiftImmediateNumbers(val, shift));
+ callFrame->r(dst) = JSValue(JSFastMath::rightShiftImmediateNumbers(val, shift));
else {
JSValue result = jsNumber(callFrame, (val.toUInt32(callFrame)) >> (shift.toUInt32(callFrame) & 0x1f));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
++vPC;
@@ -1720,18 +1706,18 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
int32_t left;
int32_t right;
if (JSFastMath::canDoFastBitwiseOperations(src1, src2))
- callFrame[dst] = JSValue(JSFastMath::andImmediateNumbers(src1, src2));
+ callFrame->r(dst) = JSValue(JSFastMath::andImmediateNumbers(src1, src2));
else if (src1.numberToInt32(left) && src2.numberToInt32(right))
- callFrame[dst] = JSValue(jsNumber(callFrame, left & right));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, left & right));
else {
JSValue result = jsNumber(callFrame, src1.toInt32(callFrame) & src2.toInt32(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
vPC += 2;
@@ -1745,18 +1731,18 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
int32_t left;
int32_t right;
if (JSFastMath::canDoFastBitwiseOperations(src1, src2))
- callFrame[dst] = JSValue(JSFastMath::xorImmediateNumbers(src1, src2));
+ callFrame->r(dst) = JSValue(JSFastMath::xorImmediateNumbers(src1, src2));
else if (src1.numberToInt32(left) && src2.numberToInt32(right))
- callFrame[dst] = JSValue(jsNumber(callFrame, left ^ right));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, left ^ right));
else {
JSValue result = jsNumber(callFrame, src1.toInt32(callFrame) ^ src2.toInt32(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
vPC += 2;
@@ -1770,18 +1756,18 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
int32_t left;
int32_t right;
if (JSFastMath::canDoFastBitwiseOperations(src1, src2))
- callFrame[dst] = JSValue(JSFastMath::orImmediateNumbers(src1, src2));
+ callFrame->r(dst) = JSValue(JSFastMath::orImmediateNumbers(src1, src2));
else if (src1.numberToInt32(left) && src2.numberToInt32(right))
- callFrame[dst] = JSValue(jsNumber(callFrame, left | right));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, left | right));
else {
JSValue result = jsNumber(callFrame, src1.toInt32(callFrame) | src2.toInt32(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
vPC += 2;
@@ -1794,14 +1780,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
and puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue src = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src = callFrame->r((++vPC)->u.operand).jsValue();
int32_t value;
if (src.numberToInt32(value))
- callFrame[dst] = JSValue(jsNumber(callFrame, ~value));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, ~value));
else {
JSValue result = jsNumber(callFrame, ~src.toInt32(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
}
++vPC;
NEXT_INSTRUCTION();
@@ -1814,9 +1800,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- JSValue result = jsBoolean(!callFrame[src].jsValue().toBoolean(callFrame));
+ JSValue result = jsBoolean(!callFrame->r(src).jsValue().toBoolean(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
++vPC;
NEXT_INSTRUCTION();
@@ -1839,14 +1825,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int base = vPC[3].u.operand;
int baseProto = vPC[4].u.operand;
- JSValue baseVal = callFrame[base].jsValue();
+ JSValue baseVal = callFrame->r(base).jsValue();
if (isInvalidParamForInstanceOf(callFrame, callFrame->codeBlock(), vPC, baseVal, exceptionValue))
goto vm_throw;
- bool result = asObject(baseVal)->hasInstance(callFrame, callFrame[value].jsValue(), callFrame[baseProto].jsValue());
+ bool result = asObject(baseVal)->hasInstance(callFrame, callFrame->r(value).jsValue(), callFrame->r(baseProto).jsValue());
CHECK_FOR_EXCEPTION();
- callFrame[dst] = jsBoolean(result);
+ callFrame->r(dst) = jsBoolean(result);
vPC += 5;
NEXT_INSTRUCTION();
@@ -1859,7 +1845,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = JSValue(jsTypeStringForValue(callFrame, callFrame[src].jsValue()));
+ callFrame->r(dst) = JSValue(jsTypeStringForValue(callFrame, callFrame->r(src).jsValue()));
++vPC;
NEXT_INSTRUCTION();
@@ -1873,8 +1859,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- JSValue v = callFrame[src].jsValue();
- callFrame[dst] = jsBoolean(v.isCell() ? v.asCell()->structure()->typeInfo().masqueradesAsUndefined() : v.isUndefined());
+ JSValue v = callFrame->r(src).jsValue();
+ callFrame->r(dst) = jsBoolean(v.isCell() ? v.asCell()->structure()->typeInfo().masqueradesAsUndefined() : v.isUndefined());
++vPC;
NEXT_INSTRUCTION();
@@ -1888,7 +1874,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = jsBoolean(callFrame[src].jsValue().isBoolean());
+ callFrame->r(dst) = jsBoolean(callFrame->r(src).jsValue().isBoolean());
++vPC;
NEXT_INSTRUCTION();
@@ -1902,7 +1888,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = jsBoolean(callFrame[src].jsValue().isNumber());
+ callFrame->r(dst) = jsBoolean(callFrame->r(src).jsValue().isNumber());
++vPC;
NEXT_INSTRUCTION();
@@ -1916,7 +1902,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = jsBoolean(callFrame[src].jsValue().isString());
+ callFrame->r(dst) = jsBoolean(callFrame->r(src).jsValue().isString());
++vPC;
NEXT_INSTRUCTION();
@@ -1930,7 +1916,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = jsBoolean(jsIsObjectType(callFrame[src].jsValue()));
+ callFrame->r(dst) = jsBoolean(jsIsObjectType(callFrame->r(src).jsValue()));
++vPC;
NEXT_INSTRUCTION();
@@ -1944,7 +1930,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = jsBoolean(jsIsFunctionType(callFrame[src].jsValue()));
+ callFrame->r(dst) = jsBoolean(jsIsFunctionType(callFrame->r(src).jsValue()));
++vPC;
NEXT_INSTRUCTION();
@@ -1962,21 +1948,21 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int property = (++vPC)->u.operand;
int base = (++vPC)->u.operand;
- JSValue baseVal = callFrame[base].jsValue();
+ JSValue baseVal = callFrame->r(base).jsValue();
if (isInvalidParamForIn(callFrame, callFrame->codeBlock(), vPC, baseVal, exceptionValue))
goto vm_throw;
JSObject* baseObj = asObject(baseVal);
- JSValue propName = callFrame[property].jsValue();
+ JSValue propName = callFrame->r(property).jsValue();
uint32_t i;
if (propName.getUInt32(i))
- callFrame[dst] = jsBoolean(baseObj->hasProperty(callFrame, i));
+ callFrame->r(dst) = jsBoolean(baseObj->hasProperty(callFrame, i));
else {
Identifier property(callFrame, propName.toString(callFrame));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = jsBoolean(baseObj->hasProperty(callFrame, property));
+ callFrame->r(dst) = jsBoolean(baseObj->hasProperty(callFrame, property));
}
++vPC;
@@ -2034,7 +2020,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
ASSERT(scope->isGlobalObject());
int index = (++vPC)->u.operand;
- callFrame[dst] = scope->registerAt(index);
+ callFrame->r(dst) = scope->registerAt(index);
++vPC;
NEXT_INSTRUCTION();
}
@@ -2048,7 +2034,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int index = (++vPC)->u.operand;
int value = (++vPC)->u.operand;
- scope->registerAt(index) = JSValue(callFrame[value].jsValue());
+ scope->registerAt(index) = JSValue(callFrame->r(value).jsValue());
++vPC;
NEXT_INSTRUCTION();
}
@@ -2073,7 +2059,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
ASSERT((*iter)->isVariableObject());
JSVariableObject* scope = static_cast<JSVariableObject*>(*iter);
- callFrame[dst] = scope->registerAt(index);
+ callFrame->r(dst) = scope->registerAt(index);
++vPC;
NEXT_INSTRUCTION();
}
@@ -2096,7 +2082,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
ASSERT((*iter)->isVariableObject());
JSVariableObject* scope = static_cast<JSVariableObject*>(*iter);
- scope->registerAt(index) = JSValue(callFrame[value].jsValue());
+ scope->registerAt(index) = JSValue(callFrame->r(value).jsValue());
++vPC;
NEXT_INSTRUCTION();
}
@@ -2164,14 +2150,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
CodeBlock* codeBlock = callFrame->codeBlock();
Identifier& ident = codeBlock->identifier(property);
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
PropertySlot slot(baseValue);
JSValue result = baseValue.get(callFrame, ident, slot);
CHECK_FOR_EXCEPTION();
tryCacheGetByID(callFrame, codeBlock, vPC, baseValue, ident, slot);
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
vPC += 8;
NEXT_INSTRUCTION();
}
@@ -2183,7 +2169,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
op_get_by_id.
*/
int base = vPC[2].u.operand;
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
if (LIKELY(baseValue.isCell())) {
JSCell* baseCell = asCell(baseValue);
@@ -2196,7 +2182,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int offset = vPC[5].u.operand;
ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
- callFrame[dst] = JSValue(baseObject->getDirectOffset(offset));
+ callFrame->r(dst) = JSValue(baseObject->getDirectOffset(offset));
vPC += 8;
NEXT_INSTRUCTION();
@@ -2214,7 +2200,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
reverts to op_get_by_id.
*/
int base = vPC[2].u.operand;
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
if (LIKELY(baseValue.isCell())) {
JSCell* baseCell = asCell(baseValue);
@@ -2230,7 +2216,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int offset = vPC[6].u.operand;
ASSERT(protoObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
- callFrame[dst] = JSValue(protoObject->getDirectOffset(offset));
+ callFrame->r(dst) = JSValue(protoObject->getDirectOffset(offset));
vPC += 8;
NEXT_INSTRUCTION();
@@ -2263,7 +2249,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
reverts to op_get_by_id.
*/
int base = vPC[2].u.operand;
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
if (LIKELY(baseValue.isCell())) {
JSCell* baseCell = asCell(baseValue);
@@ -2285,7 +2271,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int offset = vPC[7].u.operand;
ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
- callFrame[dst] = JSValue(baseObject->getDirectOffset(offset));
+ callFrame->r(dst) = JSValue(baseObject->getDirectOffset(offset));
vPC += 8;
NEXT_INSTRUCTION();
@@ -2311,12 +2297,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int property = vPC[3].u.operand;
Identifier& ident = callFrame->codeBlock()->identifier(property);
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
PropertySlot slot(baseValue);
JSValue result = baseValue.get(callFrame, ident, slot);
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
vPC += 8;
NEXT_INSTRUCTION();
}
@@ -2329,10 +2315,10 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int base = vPC[2].u.operand;
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
if (LIKELY(isJSArray(globalData, baseValue))) {
int dst = vPC[1].u.operand;
- callFrame[dst] = JSValue(jsNumber(callFrame, asArray(baseValue)->length()));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, asArray(baseValue)->length()));
vPC += 8;
NEXT_INSTRUCTION();
}
@@ -2349,10 +2335,10 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int base = vPC[2].u.operand;
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
if (LIKELY(isJSString(globalData, baseValue))) {
int dst = vPC[1].u.operand;
- callFrame[dst] = JSValue(jsNumber(callFrame, asString(baseValue)->value().size()));
+ callFrame->r(dst) = JSValue(jsNumber(callFrame, asString(baseValue)->value().size()));
vPC += 8;
NEXT_INSTRUCTION();
}
@@ -2375,10 +2361,10 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int value = vPC[3].u.operand;
CodeBlock* codeBlock = callFrame->codeBlock();
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
Identifier& ident = codeBlock->identifier(property);
PutPropertySlot slot;
- baseValue.put(callFrame, ident, callFrame[value].jsValue(), slot);
+ baseValue.put(callFrame, ident, callFrame->r(value).jsValue(), slot);
CHECK_FOR_EXCEPTION();
tryCachePutByID(callFrame, codeBlock, vPC, baseValue, slot);
@@ -2398,7 +2384,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
the register file.
*/
int base = vPC[1].u.operand;
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
if (LIKELY(baseValue.isCell())) {
JSCell* baseCell = asCell(baseValue);
@@ -2426,7 +2412,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int value = vPC[3].u.operand;
unsigned offset = vPC[7].u.operand;
ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset);
- baseObject->putDirectOffset(offset, callFrame[value].jsValue());
+ baseObject->putDirectOffset(offset, callFrame->r(value).jsValue());
vPC += 8;
NEXT_INSTRUCTION();
@@ -2448,7 +2434,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
the register file.
*/
int base = vPC[1].u.operand;
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
if (LIKELY(baseValue.isCell())) {
JSCell* baseCell = asCell(baseValue);
@@ -2461,7 +2447,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
unsigned offset = vPC[5].u.operand;
ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset);
- baseObject->putDirectOffset(offset, callFrame[value].jsValue());
+ baseObject->putDirectOffset(offset, callFrame->r(value).jsValue());
vPC += 8;
NEXT_INSTRUCTION();
@@ -2484,10 +2470,10 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int property = vPC[2].u.operand;
int value = vPC[3].u.operand;
- JSValue baseValue = callFrame[base].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
Identifier& ident = callFrame->codeBlock()->identifier(property);
PutPropertySlot slot;
- baseValue.put(callFrame, ident, callFrame[value].jsValue(), slot);
+ baseValue.put(callFrame, ident, callFrame->r(value).jsValue(), slot);
CHECK_FOR_EXCEPTION();
vPC += 8;
@@ -2505,11 +2491,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int base = (++vPC)->u.operand;
int property = (++vPC)->u.operand;
- JSObject* baseObj = callFrame[base].jsValue().toObject(callFrame);
+ JSObject* baseObj = callFrame->r(base).jsValue().toObject(callFrame);
Identifier& ident = callFrame->codeBlock()->identifier(property);
JSValue result = jsBoolean(baseObj->deleteProperty(callFrame, ident));
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
++vPC;
NEXT_INSTRUCTION();
}
@@ -2525,8 +2511,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int base = (++vPC)->u.operand;
int property = (++vPC)->u.operand;
- JSValue baseValue = callFrame[base].jsValue();
- JSValue subscript = callFrame[property].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
+ JSValue subscript = callFrame->r(property).jsValue();
JSValue result;
@@ -2550,7 +2536,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
++vPC;
NEXT_INSTRUCTION();
}
@@ -2569,21 +2555,21 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int property = (++vPC)->u.operand;
int value = (++vPC)->u.operand;
- JSValue baseValue = callFrame[base].jsValue();
- JSValue subscript = callFrame[property].jsValue();
+ JSValue baseValue = callFrame->r(base).jsValue();
+ JSValue subscript = callFrame->r(property).jsValue();
if (LIKELY(subscript.isUInt32Fast())) {
uint32_t i = subscript.getUInt32Fast();
if (isJSArray(globalData, baseValue)) {
JSArray* jsArray = asArray(baseValue);
if (jsArray->canSetIndex(i))
- jsArray->setIndex(i, callFrame[value].jsValue());
+ jsArray->setIndex(i, callFrame->r(value).jsValue());
else
- jsArray->JSArray::put(callFrame, i, callFrame[value].jsValue());
+ jsArray->JSArray::put(callFrame, i, callFrame->r(value).jsValue());
} else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
JSByteArray* jsByteArray = asByteArray(baseValue);
double dValue = 0;
- JSValue jsValue = callFrame[value].jsValue();
+ JSValue jsValue = callFrame->r(value).jsValue();
if (jsValue.isInt32Fast())
jsByteArray->setIndex(i, jsValue.getInt32Fast());
else if (jsValue.getNumber(dValue))
@@ -2591,12 +2577,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
else
baseValue.put(callFrame, i, jsValue);
} else
- baseValue.put(callFrame, i, callFrame[value].jsValue());
+ baseValue.put(callFrame, i, callFrame->r(value).jsValue());
} else {
Identifier property(callFrame, subscript.toString(callFrame));
if (!globalData->exception) { // Don't put to an object if toString threw an exception.
PutPropertySlot slot;
- baseValue.put(callFrame, property, callFrame[value].jsValue(), slot);
+ baseValue.put(callFrame, property, callFrame->r(value).jsValue(), slot);
}
}
@@ -2616,9 +2602,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int base = (++vPC)->u.operand;
int property = (++vPC)->u.operand;
- JSObject* baseObj = callFrame[base].jsValue().toObject(callFrame); // may throw
+ JSObject* baseObj = callFrame->r(base).jsValue().toObject(callFrame); // may throw
- JSValue subscript = callFrame[property].jsValue();
+ JSValue subscript = callFrame->r(property).jsValue();
JSValue result;
uint32_t i;
if (subscript.getUInt32(i))
@@ -2631,7 +2617,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
CHECK_FOR_EXCEPTION();
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
++vPC;
NEXT_INSTRUCTION();
}
@@ -2651,7 +2637,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
unsigned property = (++vPC)->u.operand;
int value = (++vPC)->u.operand;
- callFrame[base].jsValue().put(callFrame, property, callFrame[value].jsValue());
+ callFrame->r(base).jsValue().put(callFrame, property, callFrame->r(value).jsValue());
++vPC;
NEXT_INSTRUCTION();
@@ -2698,7 +2684,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int cond = (++vPC)->u.operand;
int target = (++vPC)->u.operand;
- if (callFrame[cond].jsValue().toBoolean(callFrame)) {
+ if (callFrame->r(cond).jsValue().toBoolean(callFrame)) {
vPC += target;
CHECK_FOR_TIMEOUT();
NEXT_INSTRUCTION();
@@ -2715,7 +2701,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int cond = (++vPC)->u.operand;
int target = (++vPC)->u.operand;
- if (callFrame[cond].jsValue().toBoolean(callFrame)) {
+ if (callFrame->r(cond).jsValue().toBoolean(callFrame)) {
vPC += target;
NEXT_INSTRUCTION();
}
@@ -2731,7 +2717,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int cond = (++vPC)->u.operand;
int target = (++vPC)->u.operand;
- if (!callFrame[cond].jsValue().toBoolean(callFrame)) {
+ if (!callFrame->r(cond).jsValue().toBoolean(callFrame)) {
vPC += target;
NEXT_INSTRUCTION();
}
@@ -2747,7 +2733,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int src = (++vPC)->u.operand;
int target = (++vPC)->u.operand;
- JSValue srcValue = callFrame[src].jsValue();
+ JSValue srcValue = callFrame->r(src).jsValue();
if (srcValue.isUndefinedOrNull() || (srcValue.isCell() && srcValue.asCell()->structure()->typeInfo().masqueradesAsUndefined())) {
vPC += target;
@@ -2765,7 +2751,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int src = (++vPC)->u.operand;
int target = (++vPC)->u.operand;
- JSValue srcValue = callFrame[src].jsValue();
+ JSValue srcValue = callFrame->r(src).jsValue();
if (!srcValue.isUndefinedOrNull() || (srcValue.isCell() && !srcValue.asCell()->structure()->typeInfo().masqueradesAsUndefined())) {
vPC += target;
@@ -2784,7 +2770,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int src = (++vPC)->u.operand;
JSValue ptr = JSValue((++vPC)->u.jsCell);
int target = (++vPC)->u.operand;
- JSValue srcValue = callFrame[src].jsValue();
+ JSValue srcValue = callFrame->r(src).jsValue();
if (srcValue != ptr) {
vPC += target;
NEXT_INSTRUCTION();
@@ -2804,8 +2790,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
Additionally this loop instruction may terminate JS execution is
the JS timeout is reached.
*/
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
int target = (++vPC)->u.operand;
bool result = jsLess(callFrame, src1, src2);
@@ -2831,8 +2817,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
Additionally this loop instruction may terminate JS execution is
the JS timeout is reached.
*/
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
int target = (++vPC)->u.operand;
bool result = jsLessEq(callFrame, src1, src2);
@@ -2855,8 +2841,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
target from the current instruction, if and only if the
result of the comparison is false.
*/
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
int target = (++vPC)->u.operand;
bool result = jsLess(callFrame, src1, src2);
@@ -2878,8 +2864,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
and then jumps to offset target from the current instruction,
if and only if theresult of the comparison is false.
*/
- JSValue src1 = callFrame[(++vPC)->u.operand].jsValue();
- JSValue src2 = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue src1 = callFrame->r((++vPC)->u.operand).jsValue();
+ JSValue src2 = callFrame->r((++vPC)->u.operand).jsValue();
int target = (++vPC)->u.operand;
bool result = jsLessEq(callFrame, src1, src2);
@@ -2904,7 +2890,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int tableIndex = (++vPC)->u.operand;
int defaultOffset = (++vPC)->u.operand;
- JSValue scrutinee = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue scrutinee = callFrame->r((++vPC)->u.operand).jsValue();
if (scrutinee.isInt32Fast())
vPC += callFrame->codeBlock()->immediateSwitchJumpTable(tableIndex).offsetForValue(scrutinee.getInt32Fast(), defaultOffset);
else {
@@ -2928,7 +2914,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int tableIndex = (++vPC)->u.operand;
int defaultOffset = (++vPC)->u.operand;
- JSValue scrutinee = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue scrutinee = callFrame->r((++vPC)->u.operand).jsValue();
if (!scrutinee.isString())
vPC += defaultOffset;
else {
@@ -2951,7 +2937,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int tableIndex = (++vPC)->u.operand;
int defaultOffset = (++vPC)->u.operand;
- JSValue scrutinee = callFrame[(++vPC)->u.operand].jsValue();
+ JSValue scrutinee = callFrame->r((++vPC)->u.operand).jsValue();
if (!scrutinee.isString())
vPC += defaultOffset;
else
@@ -2969,7 +2955,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = (++vPC)->u.operand;
int func = (++vPC)->u.operand;
- callFrame[dst] = callFrame->codeBlock()->function(func)->makeFunction(callFrame, callFrame->scopeChain());
+ callFrame->r(dst) = callFrame->codeBlock()->function(func)->makeFunction(callFrame, callFrame->scopeChain());
++vPC;
NEXT_INSTRUCTION();
@@ -2985,7 +2971,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = (++vPC)->u.operand;
int func = (++vPC)->u.operand;
- callFrame[dst] = callFrame->codeBlock()->functionExpression(func)->makeFunction(callFrame, callFrame->scopeChain());
+ callFrame->r(dst) = callFrame->codeBlock()->functionExpression(func)->makeFunction(callFrame, callFrame->scopeChain());
++vPC;
NEXT_INSTRUCTION();
@@ -3007,7 +2993,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int argCount = vPC[3].u.operand;
int registerOffset = vPC[4].u.operand;
- JSValue funcVal = callFrame[func].jsValue();
+ JSValue funcVal = callFrame->r(func).jsValue();
Register* newCallFrame = callFrame->registers() + registerOffset;
Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount;
@@ -3018,7 +3004,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
JSValue result = callEval(callFrame, registerFile, argv, argCount, registerOffset, exceptionValue);
if (exceptionValue)
goto vm_throw;
- callFrame[dst] = result;
+ callFrame->r(dst) = result;
vPC += 5;
NEXT_INSTRUCTION();
@@ -3044,7 +3030,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int argCount = vPC[3].u.operand;
int registerOffset = vPC[4].u.operand;
- JSValue v = callFrame[func].jsValue();
+ JSValue v = callFrame->r(func).jsValue();
CallData callData;
CallType callType = v.getCallData(callData);
@@ -3093,7 +3079,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
CHECK_FOR_EXCEPTION();
- callFrame[dst] = JSValue(returnValue);
+ callFrame->r(dst) = JSValue(returnValue);
vPC += 5;
NEXT_INSTRUCTION();
@@ -3108,19 +3094,19 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int argCountDst = (++vPC)->u.operand;
int argsOffset = (++vPC)->u.operand;
- JSValue arguments = callFrame[argsOffset].jsValue();
- uint32_t argCount = 0;
+ JSValue arguments = callFrame->r(argsOffset).jsValue();
+ int32_t argCount = 0;
if (!arguments) {
- argCount = (uint32_t)(callFrame[RegisterFile::ArgumentCount].u.i) - 1;
+ argCount = (uint32_t)(callFrame->argumentCount()) - 1;
int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize;
Register* newEnd = callFrame->registers() + sizeDelta;
if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) {
exceptionValue = createStackOverflowError(callFrame);
goto vm_throw;
}
- uint32_t expectedParams = asFunction(callFrame[RegisterFile::Callee].jsValue())->body()->parameterCount();
- uint32_t inplaceArgs = min(argCount, expectedParams);
- uint32_t i = 0;
+ int32_t expectedParams = callFrame->callee()->body()->parameterCount();
+ int32_t inplaceArgs = min(argCount, expectedParams);
+ int32_t i = 0;
Register* argStore = callFrame->registers() + argsOffset;
// First step is to copy the "expected" parameters from their normal location relative to the callframe
@@ -3164,7 +3150,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
goto vm_throw;
}
Register* argsBuffer = callFrame->registers() + argsOffset;
- for (unsigned i = 0; i < argCount; ++i) {
+ for (int32_t i = 0; i < argCount; ++i) {
argsBuffer[i] = asObject(arguments)->get(callFrame, i);
CHECK_FOR_EXCEPTION();
}
@@ -3176,7 +3162,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
}
CHECK_FOR_EXCEPTION();
- callFrame[argCountDst] = argCount + 1;
+ callFrame->r(argCountDst) = argCount + 1;
++vPC;
NEXT_INSTRUCTION();
}
@@ -3197,8 +3183,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int argCountReg = vPC[3].u.operand;
int registerOffset = vPC[4].u.operand;
- JSValue v = callFrame[func].jsValue();
- int argCount = callFrame[argCountReg].i();
+ JSValue v = callFrame->r(func).jsValue();
+ int argCount = callFrame->r(argCountReg).i();
registerOffset += argCount;
CallData callData;
CallType callType = v.getCallData(callData);
@@ -3247,7 +3233,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
CHECK_FOR_EXCEPTION();
- callFrame[dst] = JSValue(returnValue);
+ callFrame->r(dst) = JSValue(returnValue);
vPC += 5;
NEXT_INSTRUCTION();
@@ -3274,7 +3260,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int src = (++vPC)->u.operand;
ASSERT(callFrame->codeBlock()->needsFullScopeChain());
- asActivation(callFrame[src].jsValue())->copyRegisters(callFrame->optionalCalleeArguments());
+ asActivation(callFrame->r(src).jsValue())->copyRegisters(callFrame->optionalCalleeArguments());
++vPC;
NEXT_INSTRUCTION();
@@ -3314,7 +3300,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (callFrame->codeBlock()->needsFullScopeChain())
callFrame->scopeChain()->deref();
- JSValue returnValue = callFrame[result].jsValue();
+ JSValue returnValue = callFrame->r(result).jsValue();
vPC = callFrame->returnPC();
int dst = callFrame->returnValueRegister();
@@ -3323,7 +3309,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (callFrame->hasHostCallFrameFlag())
return returnValue;
- callFrame[dst] = JSValue(returnValue);
+ callFrame->r(dst) = JSValue(returnValue);
NEXT_INSTRUCTION();
}
@@ -3342,10 +3328,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
CodeBlock* codeBlock = callFrame->codeBlock();
for (size_t count = codeBlock->m_numVars; i < count; ++i)
- callFrame[i] = jsUndefined();
-
- for (size_t count = codeBlock->numberOfConstantRegisters(), j = 0; j < count; ++i, ++j)
- callFrame[i] = codeBlock->constantRegister(j);
+ callFrame->r(i) = jsUndefined();
++vPC;
NEXT_INSTRUCTION();
@@ -3367,14 +3350,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
CodeBlock* codeBlock = callFrame->codeBlock();
for (size_t count = codeBlock->m_numVars; i < count; ++i)
- callFrame[i] = jsUndefined();
-
- for (size_t count = codeBlock->numberOfConstantRegisters(), j = 0; j < count; ++i, ++j)
- callFrame[i] = codeBlock->constantRegister(j);
+ callFrame->r(i) = jsUndefined();
int dst = (++vPC)->u.operand;
JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode()));
- callFrame[dst] = activation;
+ callFrame->r(dst) = activation;
callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation));
++vPC;
@@ -3393,9 +3373,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int thisRegister = (++vPC)->u.operand;
- JSValue thisVal = callFrame[thisRegister].jsValue();
+ JSValue thisVal = callFrame->r(thisRegister).jsValue();
if (thisVal.needsThisConversion())
- callFrame[thisRegister] = JSValue(thisVal.toThisObject(callFrame));
+ callFrame->r(thisRegister) = JSValue(thisVal.toThisObject(callFrame));
++vPC;
NEXT_INSTRUCTION();
@@ -3410,7 +3390,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
This opcode should only be used at the beginning of a code
block.
*/
- callFrame[RegisterFile::ArgumentsRegister] = JSValue();
+ callFrame->r(RegisterFile::ArgumentsRegister) = JSValue();
++vPC;
NEXT_INSTRUCTION();
}
@@ -3425,7 +3405,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (!callFrame->optionalCalleeArguments()) {
Arguments* arguments = new (globalData) Arguments(callFrame);
callFrame->setCalleeArguments(arguments);
- callFrame[RegisterFile::ArgumentsRegister] = arguments;
+ callFrame->r(RegisterFile::ArgumentsRegister) = arguments;
}
++vPC;
NEXT_INSTRUCTION();
@@ -3452,7 +3432,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int proto = vPC[5].u.operand;
int thisRegister = vPC[6].u.operand;
- JSValue v = callFrame[func].jsValue();
+ JSValue v = callFrame->r(func).jsValue();
ConstructData constructData;
ConstructType constructType = v.getConstructData(constructData);
@@ -3463,14 +3443,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain);
Structure* structure;
- JSValue prototype = callFrame[proto].jsValue();
+ JSValue prototype = callFrame->r(proto).jsValue();
if (prototype.isObject())
structure = asObject(prototype)->inheritorID();
else
structure = callDataScopeChain->globalObject()->emptyObjectStructure();
JSObject* newObject = new (globalData) JSObject(structure);
- callFrame[thisRegister] = JSValue(newObject); // "this" value
+ callFrame->r(thisRegister) = JSValue(newObject); // "this" value
CallFrame* previousCallFrame = callFrame;
@@ -3504,7 +3484,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
returnValue = constructData.native.function(newCallFrame, asObject(v), args);
}
CHECK_FOR_EXCEPTION();
- callFrame[dst] = JSValue(returnValue);
+ callFrame->r(dst) = JSValue(returnValue);
vPC += 7;
NEXT_INSTRUCTION();
@@ -3523,13 +3503,13 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = vPC[1].u.operand;
- if (LIKELY(callFrame[dst].jsValue().isObject())) {
+ if (LIKELY(callFrame->r(dst).jsValue().isObject())) {
vPC += 3;
NEXT_INSTRUCTION();
}
int override = vPC[2].u.operand;
- callFrame[dst] = callFrame[override];
+ callFrame->r(dst) = callFrame->r(override);
vPC += 3;
NEXT_INSTRUCTION();
@@ -3539,7 +3519,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int src = (++vPC)->u.operand;
int count = (++vPC)->u.operand;
- callFrame[dst] = concatenateStrings(callFrame, &callFrame->registers()[src], count);
+ callFrame->r(dst) = concatenateStrings(callFrame, &callFrame->registers()[src], count);
++vPC;
NEXT_INSTRUCTION();
@@ -3548,7 +3528,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = callFrame[src].jsValue().toPrimitive(callFrame);
+ callFrame->r(dst) = callFrame->r(src).jsValue().toPrimitive(callFrame);
++vPC;
NEXT_INSTRUCTION();
@@ -3561,11 +3541,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
are replaced by the result of toObject conversion of the scope.
*/
int scope = (++vPC)->u.operand;
- JSValue v = callFrame[scope].jsValue();
+ JSValue v = callFrame->r(scope).jsValue();
JSObject* o = v.toObject(callFrame);
CHECK_FOR_EXCEPTION();
- callFrame[scope] = JSValue(o);
+ callFrame->r(scope) = JSValue(o);
callFrame->setScopeChain(callFrame->scopeChain()->push(o));
++vPC;
@@ -3592,7 +3572,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = (++vPC)->u.operand;
int base = (++vPC)->u.operand;
- callFrame[dst] = JSPropertyNameIterator::create(callFrame, callFrame[base].jsValue());
+ callFrame->r(dst) = JSPropertyNameIterator::create(callFrame, callFrame->r(base).jsValue());
++vPC;
NEXT_INSTRUCTION();
}
@@ -3609,10 +3589,10 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int iter = (++vPC)->u.operand;
int target = (++vPC)->u.operand;
- JSPropertyNameIterator* it = callFrame[iter].propertyNameIterator();
+ JSPropertyNameIterator* it = callFrame->r(iter).propertyNameIterator();
if (JSValue temp = it->next(callFrame)) {
CHECK_FOR_TIMEOUT();
- callFrame[dst] = JSValue(temp);
+ callFrame->r(dst) = JSValue(temp);
vPC += target;
NEXT_INSTRUCTION();
}
@@ -3668,7 +3648,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
ASSERT(exceptionValue);
ASSERT(!globalData->exception);
int ex = (++vPC)->u.operand;
- callFrame[ex] = exceptionValue;
+ callFrame->r(ex) = exceptionValue;
exceptionValue = JSValue();
++vPC;
@@ -3686,7 +3666,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int ex = (++vPC)->u.operand;
- exceptionValue = callFrame[ex].jsValue();
+ exceptionValue = callFrame->r(ex).jsValue();
handler = throwException(callFrame, exceptionValue, vPC - callFrame->codeBlock()->instructions().begin(), true);
if (!handler) {
@@ -3697,18 +3677,6 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
vPC = callFrame->codeBlock()->instructions().begin() + handler->target;
NEXT_INSTRUCTION();
}
- DEFINE_OPCODE(op_unexpected_load) {
- /* unexpected_load load dst(r) src(k)
-
- Copies constant src to register dst.
- */
- int dst = (++vPC)->u.operand;
- int src = (++vPC)->u.operand;
- callFrame[dst] = JSValue(callFrame->codeBlock()->unexpectedConstant(src));
-
- ++vPC;
- NEXT_INSTRUCTION();
- }
DEFINE_OPCODE(op_new_error) {
/* new_error dst(r) type(n) message(k)
@@ -3722,7 +3690,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int message = (++vPC)->u.operand;
CodeBlock* codeBlock = callFrame->codeBlock();
- callFrame[dst] = JSValue(Error::create(callFrame, (ErrorType)type, codeBlock->unexpectedConstant(message).toString(callFrame), codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()));
+ callFrame->r(dst) = JSValue(Error::create(callFrame, (ErrorType)type, callFrame->r(message).jsValue().toString(callFrame), codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()));
++vPC;
NEXT_INSTRUCTION();
@@ -3740,7 +3708,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
scopeChain->deref();
}
int result = (++vPC)->u.operand;
- return callFrame[result].jsValue();
+ return callFrame->r(result).jsValue();
}
DEFINE_OPCODE(op_put_getter) {
/* put_getter base(r) property(id) function(r)
@@ -3757,11 +3725,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int property = (++vPC)->u.operand;
int function = (++vPC)->u.operand;
- ASSERT(callFrame[base].jsValue().isObject());
- JSObject* baseObj = asObject(callFrame[base].jsValue());
+ ASSERT(callFrame->r(base).jsValue().isObject());
+ JSObject* baseObj = asObject(callFrame->r(base).jsValue());
Identifier& ident = callFrame->codeBlock()->identifier(property);
- ASSERT(callFrame[function].jsValue().isObject());
- baseObj->defineGetter(callFrame, ident, asObject(callFrame[function].jsValue()));
+ ASSERT(callFrame->r(function).jsValue().isObject());
+ baseObj->defineGetter(callFrame, ident, asObject(callFrame->r(function).jsValue()));
++vPC;
NEXT_INSTRUCTION();
@@ -3781,11 +3749,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int property = (++vPC)->u.operand;
int function = (++vPC)->u.operand;
- ASSERT(callFrame[base].jsValue().isObject());
- JSObject* baseObj = asObject(callFrame[base].jsValue());
+ ASSERT(callFrame->r(base).jsValue().isObject());
+ JSObject* baseObj = asObject(callFrame->r(base).jsValue());
Identifier& ident = callFrame->codeBlock()->identifier(property);
- ASSERT(callFrame[function].jsValue().isObject());
- baseObj->defineSetter(callFrame, ident, asObject(callFrame[function].jsValue()));
+ ASSERT(callFrame->r(function).jsValue().isObject());
+ baseObj->defineSetter(callFrame, ident, asObject(callFrame->r(function).jsValue()));
++vPC;
NEXT_INSTRUCTION();
@@ -3802,7 +3770,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int retAddrDst = (++vPC)->u.operand;
int target = (++vPC)->u.operand;
- callFrame[retAddrDst] = vPC + 1;
+ callFrame->r(retAddrDst) = vPC + 1;
vPC += target;
NEXT_INSTRUCTION();
@@ -3815,7 +3783,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
register, not as an immediate.
*/
int retAddrSrc = (++vPC)->u.operand;
- vPC = callFrame[retAddrSrc].vPC();
+ vPC = callFrame->r(retAddrSrc).vPC();
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_debug) {
@@ -3842,7 +3810,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int function = vPC[1].u.operand;
if (*enabledProfilerReference)
- (*enabledProfilerReference)->willExecute(callFrame, callFrame[function].jsValue());
+ (*enabledProfilerReference)->willExecute(callFrame, callFrame->r(function).jsValue());
vPC += 2;
NEXT_INSTRUCTION();
@@ -3856,7 +3824,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int function = vPC[1].u.operand;
if (*enabledProfilerReference)
- (*enabledProfilerReference)->didExecute(callFrame, callFrame[function].jsValue());
+ (*enabledProfilerReference)->didExecute(callFrame, callFrame->r(function).jsValue());
vPC += 2;
NEXT_INSTRUCTION();
@@ -3899,12 +3867,12 @@ JSValue Interpreter::retrieveArguments(CallFrame* callFrame, JSFunction* functio
ASSERT(codeBlock->codeType() == FunctionCode);
SymbolTable& symbolTable = codeBlock->symbolTable();
int argumentsIndex = symbolTable.get(functionCallFrame->propertyNames().arguments.ustring().rep()).getIndex();
- if (!functionCallFrame[argumentsIndex].arguments()) {
+ if (!functionCallFrame->r(argumentsIndex).arguments()) {
Arguments* arguments = new (callFrame) Arguments(functionCallFrame);
functionCallFrame->setCalleeArguments(arguments);
- functionCallFrame[RegisterFile::ArgumentsRegister] = arguments;
+ functionCallFrame->r(RegisterFile::ArgumentsRegister) = arguments;
}
- return functionCallFrame[argumentsIndex].jsValue();
+ return functionCallFrame->r(argumentsIndex).jsValue();
}
Arguments* arguments = functionCallFrame->optionalCalleeArguments();
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h
index 702c89c..fa6f7db 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h
@@ -45,7 +45,6 @@ namespace JSC {
class FunctionBodyNode;
class Instruction;
class InternalFunction;
- class AssemblerBuffer;
class JSFunction;
class JSGlobalObject;
class ProgramNode;
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp
index 02cb09b..f1b22c0 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp
@@ -275,7 +275,6 @@ void JIT::privateCompileMainPass()
DEFINE_OP(op_throw)
DEFINE_OP(op_to_jsnumber)
DEFINE_OP(op_to_primitive)
- DEFINE_OP(op_unexpected_load)
case op_get_array_length:
case op_get_by_id_chain:
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
index dbcb34d..b669dfa 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
@@ -505,13 +505,6 @@ void JIT::emit_op_jneq_ptr(Instruction* currentInstruction)
RECORD_JUMP_TARGET(target + 3);
}
-void JIT::emit_op_unexpected_load(Instruction* currentInstruction)
-{
- JSValue v = m_codeBlock->unexpectedConstant(currentInstruction[2].u.operand);
- move(ImmPtr(JSValue::encode(v)), regT0);
- emitPutVirtualRegister(currentInstruction[1].u.operand);
-}
-
void JIT::emit_op_jsr(Instruction* currentInstruction)
{
int retAddrDst = currentInstruction[1].u.operand;
@@ -759,7 +752,7 @@ void JIT::emit_op_new_error(Instruction* currentInstruction)
{
JITStubCall stubCall(this, JITStubs::cti_op_new_error);
stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
- stubCall.addArgument(ImmPtr(JSValue::encode(m_codeBlock->unexpectedConstant(currentInstruction[3].u.operand))));
+ stubCall.addArgument(ImmPtr(JSValue::encode(m_codeBlock->getConstant(currentInstruction[3].u.operand))));
stubCall.addArgument(Imm32(m_bytecodeIndex));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -828,7 +821,7 @@ void JIT::emit_op_enter(Instruction*)
// Even though CTI doesn't use them, we initialize our constant
// registers to zap stale pointers, to avoid unnecessarily prolonging
// object lifetime and increasing GC pressure.
- size_t count = m_codeBlock->m_numVars + m_codeBlock->numberOfConstantRegisters();
+ size_t count = m_codeBlock->m_numVars;
for (size_t j = 0; j < count; ++j)
emitInitRegister(j);
@@ -839,7 +832,7 @@ void JIT::emit_op_enter_with_activation(Instruction* currentInstruction)
// Even though CTI doesn't use them, we initialize our constant
// registers to zap stale pointers, to avoid unnecessarily prolonging
// object lifetime and increasing GC pressure.
- size_t count = m_codeBlock->m_numVars + m_codeBlock->numberOfConstantRegisters();
+ size_t count = m_codeBlock->m_numVars;
for (size_t j = 0; j < count; ++j)
emitInitRegister(j);
diff --git a/src/3rdparty/webkit/JavaScriptCore/jsc.cpp b/src/3rdparty/webkit/JavaScriptCore/jsc.cpp
index 20d6694..769169b 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jsc.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jsc.cpp
@@ -48,7 +48,7 @@
#include <sys/time.h>
#endif
-#if PLATFORM(UNIX)
+#if HAVE(SIGNAL_H)
#include <signal.h>
#endif
@@ -489,7 +489,9 @@ static NO_RETURN void printUsageStatement(JSGlobalData* globalData, bool help =
fprintf(stderr, " -f Specifies a source file (deprecated)\n");
fprintf(stderr, " -h|--help Prints this help message\n");
fprintf(stderr, " -i Enables interactive mode (default if no files are specified)\n");
+#if HAVE(SIGNAL_H)
fprintf(stderr, " -s Installs signal handlers that exit on a crash (Unix platforms only)\n");
+#endif
cleanupGlobalData(globalData);
exit(help ? EXIT_SUCCESS : EXIT_FAILURE);
@@ -524,7 +526,7 @@ static void parseArguments(int argc, char** argv, Options& options, JSGlobalData
continue;
}
if (strcmp(arg, "-s") == 0) {
-#if PLATFORM(UNIX)
+#if HAVE(SIGNAL_H)
signal(SIGILL, _exit);
signal(SIGFPE, _exit);
signal(SIGBUS, _exit);
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h b/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h
index d17da69..780a624 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h
+++ b/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h
@@ -39,6 +39,11 @@ namespace JSC {
return fastMalloc(size);
}
+ inline void ParserArenaDeletable::operator delete(void* p)
+ {
+ fastFree(p);
+ }
+
inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData)
{
globalData->parser->arena().derefWithArena(adoptRef(this));
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp
index ba6e1e0..105ceaf 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp
@@ -601,7 +601,7 @@ RegisterID* PostfixErrorNode::emitBytecode(BytecodeGenerator& generator, Registe
RegisterID* DeleteResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
if (generator.registerFor(m_ident))
- return generator.emitUnexpectedLoad(generator.finalDestination(dst), false);
+ return generator.emitLoad(generator.finalDestination(dst), false);
generator.emitExpressionInfo(divot(), startOffset(), endOffset());
RegisterID* base = generator.emitResolveBase(generator.tempDestination(dst), m_ident);
@@ -636,7 +636,7 @@ RegisterID* DeleteValueNode::emitBytecode(BytecodeGenerator& generator, Register
generator.emitNode(generator.ignoredResult(), m_expr);
// delete on a non-location expression ignores the value and returns true
- return generator.emitUnexpectedLoad(generator.finalDestination(dst), true);
+ return generator.emitLoad(generator.finalDestination(dst), true);
}
// ------------------------------ VoidNode -------------------------------------
@@ -688,7 +688,7 @@ RegisterID* PrefixResolveNode::emitBytecode(BytecodeGenerator& generator, Regist
if (generator.isLocalConstant(m_ident)) {
if (dst == generator.ignoredResult())
return 0;
- RefPtr<RegisterID> r0 = generator.emitUnexpectedLoad(generator.finalDestination(dst), (m_operator == OpPlusPlus) ? 1.0 : -1.0);
+ RefPtr<RegisterID> r0 = generator.emitLoad(generator.finalDestination(dst), (m_operator == OpPlusPlus) ? 1.0 : -1.0);
return generator.emitBinaryOp(op_add, r0.get(), local, r0.get(), OperandTypes());
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h
index a9f88b7..34b4497 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h
+++ b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h
@@ -109,6 +109,8 @@ namespace JSC {
// Objects created with this version of new are not deleted when the arena is deleted.
// Other arrangements must be made.
void* operator new(size_t);
+
+ void operator delete(void*);
};
class ParserArenaRefCounted : public RefCounted<ParserArenaRefCounted> {
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.cpp
index 8996629..3bef263 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.cpp
@@ -40,7 +40,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSActivation);
const ClassInfo JSActivation::info = { "JSActivation", 0, 0, 0 };
JSActivation::JSActivation(CallFrame* callFrame, PassRefPtr<FunctionBodyNode> functionBody)
- : Base(callFrame->globalData().activationStructure, new JSActivationData(functionBody, callFrame))
+ : Base(callFrame->globalData().activationStructure, new JSActivationData(functionBody, callFrame->registers()))
{
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.cpp
index d5c4ee4..ff728e8 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -59,14 +59,14 @@ using namespace WTF;
namespace JSC {
-extern const HashTable arrayTable;
-extern const HashTable jsonTable;
-extern const HashTable dateTable;
-extern const HashTable mathTable;
-extern const HashTable numberTable;
-extern const HashTable regExpTable;
-extern const HashTable regExpConstructorTable;
-extern const HashTable stringTable;
+extern JSC_CONST_HASHTABLE HashTable arrayTable;
+extern JSC_CONST_HASHTABLE HashTable jsonTable;
+extern JSC_CONST_HASHTABLE HashTable dateTable;
+extern JSC_CONST_HASHTABLE HashTable mathTable;
+extern JSC_CONST_HASHTABLE HashTable numberTable;
+extern JSC_CONST_HASHTABLE HashTable regExpTable;
+extern JSC_CONST_HASHTABLE HashTable regExpConstructorTable;
+extern JSC_CONST_HASHTABLE HashTable stringTable;
struct VPtrSet {
VPtrSet();
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.cpp
index 3f3fab9..798013a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.cpp
@@ -124,9 +124,9 @@ LiteralParser::TokenType LiteralParser::Lexer::lex(LiteralParserToken& token)
return TokError;
}
-static inline bool isSafeStringCharacter(UChar c)
+template <LiteralParser::ParserMode mode> static inline bool isSafeStringCharacter(UChar c)
{
- return (c >= ' ' && c <= 0xff && c != '\\' && c != '"') || c == '\t';
+ return (c >= ' ' && (mode == LiteralParser::StrictJSON || c <= 0xff) && c != '\\' && c != '"') || c == '\t';
}
template <LiteralParser::ParserMode mode> LiteralParser::TokenType LiteralParser::Lexer::lexString(LiteralParserToken& token)
@@ -136,7 +136,7 @@ template <LiteralParser::ParserMode mode> LiteralParser::TokenType LiteralParser
token.stringToken = UString();
do {
runStart = m_ptr;
- while (m_ptr < m_end && isSafeStringCharacter(*m_ptr))
+ while (m_ptr < m_end && isSafeStringCharacter<mode>(*m_ptr))
++m_ptr;
if (runStart < m_ptr)
token.stringToken.append(runStart, m_ptr - runStart);
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.h
index 3b7353d..167f2bc 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.h
@@ -29,6 +29,13 @@
#include <stdio.h>
#include <wtf/Assertions.h>
+// Bug #26843: Work around Metrowerks compiler bug
+#if COMPILER(WINSCW)
+#define JSC_CONST_HASHTABLE
+#else
+#define JSC_CONST_HASHTABLE const
+#endif
+
namespace JSC {
// Hash table generated by the create_hash_table script.
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.cpp
index 857a316..7dd4a8f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 1999-2001, 2004 Harri Porten (porten@kde.org)
* Copyright (c) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -110,7 +111,7 @@ void RegExp::compile(JSGlobalData* globalData)
#endif
}
-int RegExp::match(const UString& s, int startOffset, OwnArrayPtr<int>* ovector)
+int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
{
if (startOffset < 0)
startOffset = 0;
@@ -126,16 +127,20 @@ int RegExp::match(const UString& s, int startOffset, OwnArrayPtr<int>* ovector)
if (m_regExpBytecode) {
#endif
int offsetVectorSize = (m_numSubpatterns + 1) * 3; // FIXME: should be 2 - but adding temporary fallback to pcre.
- int* offsetVector = new int [offsetVectorSize];
+ int* offsetVector;
+ Vector<int, 32> nonReturnedOvector;
+ if (ovector) {
+ ovector->resize(offsetVectorSize);
+ offsetVector = ovector->data();
+ } else {
+ nonReturnedOvector.resize(offsetVectorSize);
+ offsetVector = nonReturnedOvector.data();
+ }
+
ASSERT(offsetVector);
for (int j = 0; j < offsetVectorSize; ++j)
offsetVector[j] = -1;
- OwnArrayPtr<int> nonReturnedOvector;
- if (!ovector)
- nonReturnedOvector.set(offsetVector);
- else
- ovector->set(offsetVector);
#if ENABLE(YARR_JIT)
int result = Yarr::executeRegex(m_regExpJITCode, s.data(), startOffset, s.size(), offsetVector, offsetVectorSize);
@@ -177,7 +182,7 @@ void RegExp::compile(JSGlobalData* globalData)
m_regExp = jsRegExpCompile(reinterpret_cast<const UChar*>(m_pattern.data()), m_pattern.size(), ignoreCaseOption, multilineOption, &m_numSubpatterns, &m_constructionError);
}
-int RegExp::match(const UString& s, int startOffset, OwnArrayPtr<int>* ovector)
+int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
{
if (startOffset < 0)
startOffset = 0;
@@ -190,17 +195,19 @@ int RegExp::match(const UString& s, int startOffset, OwnArrayPtr<int>* ovector)
#if ENABLE(WREC)
if (m_wrecFunction) {
int offsetVectorSize = (m_numSubpatterns + 1) * 2;
- int* offsetVector = new int [offsetVectorSize];
+ int* offsetVector;
+ Vector<int, 32> nonReturnedOvector;
+ if (ovector) {
+ ovector->resize(offsetVectorSize);
+ offsetVector = ovector->data();
+ } else {
+ nonReturnedOvector.resize(offsetVectorSize);
+ offsetVector = nonReturnedOvector.data();
+ }
ASSERT(offsetVector);
for (int j = 0; j < offsetVectorSize; ++j)
offsetVector[j] = -1;
- OwnArrayPtr<int> nonReturnedOvector;
- if (!ovector)
- nonReturnedOvector.set(offsetVector);
- else
- ovector->set(offsetVector);
-
int result = m_wrecFunction(s.data(), startOffset, s.size(), offsetVector);
if (result < 0) {
@@ -226,8 +233,8 @@ int RegExp::match(const UString& s, int startOffset, OwnArrayPtr<int>* ovector)
offsetVector = fixedSizeOffsetVector;
} else {
offsetVectorSize = (m_numSubpatterns + 1) * 3;
- offsetVector = new int [offsetVectorSize];
- ovector->set(offsetVector);
+ ovector->resize(offsetVectorSize);
+ offsetVector = ovector->data();
}
int numMatches = jsRegExpExecute(m_regExp, reinterpret_cast<const UChar*>(s.data()), s.size(), startOffset, offsetVector, offsetVectorSize);
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.h b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.h
index f3be656..24d4199 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.h
@@ -1,6 +1,7 @@
/*
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
* Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -53,7 +54,7 @@ namespace JSC {
bool isValid() const { return !m_constructionError; }
const char* errorMessage() const { return m_constructionError; }
- int match(const UString&, int startOffset, OwnArrayPtr<int>* ovector = 0);
+ int match(const UString&, int startOffset, Vector<int, 32>* ovector = 0);
unsigned numSubpatterns() const { return m_numSubpatterns; }
private:
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.cpp
index bcd0d07..e468521 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
* Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -93,14 +94,21 @@ struct RegExpConstructorPrivate {
RegExpConstructorPrivate()
: lastNumSubPatterns(0)
, multiline(false)
+ , lastOvectorIndex(0)
{
}
+ const Vector<int, 32>& lastOvector() const { return ovector[lastOvectorIndex]; }
+ Vector<int, 32>& lastOvector() { return ovector[lastOvectorIndex]; }
+ Vector<int, 32>& tempOvector() { return ovector[lastOvectorIndex ? 0 : 1]; }
+ void changeLastOvector() { lastOvectorIndex = lastOvectorIndex ? 0 : 1; }
+
UString input;
UString lastInput;
- OwnArrayPtr<int> lastOvector;
- unsigned lastNumSubPatterns : 31;
+ Vector<int, 32> ovector[2];
+ unsigned lastNumSubPatterns : 30;
bool multiline : 1;
+ unsigned lastOvectorIndex : 1;
};
RegExpConstructor::RegExpConstructor(ExecState* exec, PassRefPtr<Structure> structure, RegExpPrototype* regExpPrototype)
@@ -121,20 +129,19 @@ RegExpConstructor::RegExpConstructor(ExecState* exec, PassRefPtr<Structure> stru
*/
void RegExpConstructor::performMatch(RegExp* r, const UString& s, int startOffset, int& position, int& length, int** ovector)
{
- OwnArrayPtr<int> tmpOvector;
- position = r->match(s, startOffset, &tmpOvector);
+ position = r->match(s, startOffset, &d->tempOvector());
if (ovector)
- *ovector = tmpOvector.get();
+ *ovector = d->tempOvector().data();
if (position != -1) {
- ASSERT(tmpOvector);
+ ASSERT(!d->tempOvector().isEmpty());
- length = tmpOvector[1] - tmpOvector[0];
+ length = d->tempOvector()[1] - d->tempOvector()[0];
d->input = s;
d->lastInput = s;
- d->lastOvector.set(tmpOvector.release());
+ d->changeLastOvector();
d->lastNumSubPatterns = r->numSubpatterns();
}
}
@@ -147,8 +154,8 @@ RegExpMatchesArray::RegExpMatchesArray(ExecState* exec, RegExpConstructorPrivate
d->lastInput = data->lastInput;
d->lastNumSubPatterns = data->lastNumSubPatterns;
unsigned offsetVectorSize = (data->lastNumSubPatterns + 1) * 2; // only copying the result part of the vector
- d->lastOvector.set(new int[offsetVectorSize]);
- memcpy(d->lastOvector.get(), data->lastOvector.get(), offsetVectorSize * sizeof(int));
+ d->lastOvector().resize(offsetVectorSize);
+ memcpy(d->lastOvector().data(), data->lastOvector().data(), offsetVectorSize * sizeof(int));
// d->multiline is not needed, and remains uninitialized
setLazyCreationData(d);
@@ -167,13 +174,13 @@ void RegExpMatchesArray::fillArrayInstance(ExecState* exec)
unsigned lastNumSubpatterns = d->lastNumSubPatterns;
for (unsigned i = 0; i <= lastNumSubpatterns; ++i) {
- int start = d->lastOvector[2 * i];
+ int start = d->lastOvector()[2 * i];
if (start >= 0)
- JSArray::put(exec, i, jsSubstring(exec, d->lastInput, start, d->lastOvector[2 * i + 1] - start));
+ JSArray::put(exec, i, jsSubstring(exec, d->lastInput, start, d->lastOvector()[2 * i + 1] - start));
}
PutPropertySlot slot;
- JSArray::put(exec, exec->propertyNames().index, jsNumber(exec, d->lastOvector[0]), slot);
+ JSArray::put(exec, exec->propertyNames().index, jsNumber(exec, d->lastOvector()[0]), slot);
JSArray::put(exec, exec->propertyNames().input, jsString(exec, d->input), slot);
delete d;
@@ -187,10 +194,10 @@ JSObject* RegExpConstructor::arrayOfMatches(ExecState* exec) const
JSValue RegExpConstructor::getBackref(ExecState* exec, unsigned i) const
{
- if (d->lastOvector && i <= d->lastNumSubPatterns) {
- int start = d->lastOvector[2 * i];
+ if (!d->lastOvector().isEmpty() && i <= d->lastNumSubPatterns) {
+ int start = d->lastOvector()[2 * i];
if (start >= 0)
- return jsSubstring(exec, d->lastInput, start, d->lastOvector[2 * i + 1] - start);
+ return jsSubstring(exec, d->lastInput, start, d->lastOvector()[2 * i + 1] - start);
}
return jsEmptyString(exec);
}
@@ -199,25 +206,25 @@ JSValue RegExpConstructor::getLastParen(ExecState* exec) const
{
unsigned i = d->lastNumSubPatterns;
if (i > 0) {
- ASSERT(d->lastOvector);
- int start = d->lastOvector[2 * i];
+ ASSERT(!d->lastOvector().isEmpty());
+ int start = d->lastOvector()[2 * i];
if (start >= 0)
- return jsSubstring(exec, d->lastInput, start, d->lastOvector[2 * i + 1] - start);
+ return jsSubstring(exec, d->lastInput, start, d->lastOvector()[2 * i + 1] - start);
}
return jsEmptyString(exec);
}
JSValue RegExpConstructor::getLeftContext(ExecState* exec) const
{
- if (d->lastOvector)
- return jsSubstring(exec, d->lastInput, 0, d->lastOvector[0]);
+ if (!d->lastOvector().isEmpty())
+ return jsSubstring(exec, d->lastInput, 0, d->lastOvector()[0]);
return jsEmptyString(exec);
}
JSValue RegExpConstructor::getRightContext(ExecState* exec) const
{
- if (d->lastOvector)
- return jsSubstring(exec, d->lastInput, d->lastOvector[1], d->lastInput.size() - d->lastOvector[1]);
+ if (!d->lastOvector().isEmpty())
+ return jsSubstring(exec, d->lastInput, d->lastOvector()[1], d->lastInput.size() - d->lastOvector()[1]);
return jsEmptyString(exec);
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp
index d6939cb..ceb6b1e 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -575,7 +576,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec, JSObject*, JSValue t
}
int pos = 0;
while (i != limit && pos < s.size()) {
- OwnArrayPtr<int> ovector;
+ Vector<int, 32> ovector;
int mpos = reg->match(s, pos, &ovector);
if (mpos < 0)
break;
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp
index c65ba85..d6850e6 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp
@@ -1526,10 +1526,6 @@ inline void TCMalloc_PageHeap::Delete(Span* span) {
// necessary. We do not bother resetting the stale pagemap
// entries for the pieces we are merging together because we only
// care about the pagemap entries for the boundaries.
- //
- // Note that the spans we merge into "span" may come out of
- // a "returned" list. For simplicity, we move these into the
- // "normal" list of the appropriate size class.
const PageID p = span->start;
const Length n = span->length;
Span* prev = GetDescriptor(p-1);
@@ -1560,10 +1556,19 @@ inline void TCMalloc_PageHeap::Delete(Span* span) {
Event(span, 'D', span->length);
span->free = 1;
- if (span->length < kMaxPages) {
- DLL_Prepend(&free_[span->length].normal, span);
- } else {
- DLL_Prepend(&large_.normal, span);
+#if TCMALLOC_TRACK_DECOMMITED_SPANS
+ if (span->decommitted) {
+ if (span->length < kMaxPages)
+ DLL_Prepend(&free_[span->length].returned, span);
+ else
+ DLL_Prepend(&large_.returned, span);
+ } else
+#endif
+ {
+ if (span->length < kMaxPages)
+ DLL_Prepend(&free_[span->length].normal, span);
+ else
+ DLL_Prepend(&large_.normal, span);
}
free_pages_ += n;
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h
index 9e13cf9..61ebe32 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h
@@ -179,6 +179,13 @@ WTF_PRIVATE_INLINE void* operator new(size_t s) { return fastMalloc(s); }
WTF_PRIVATE_INLINE void operator delete(void* p) { fastFree(p); }
WTF_PRIVATE_INLINE void* operator new[](size_t s) { return fastMalloc(s); }
WTF_PRIVATE_INLINE void operator delete[](void* p) { fastFree(p); }
+
+#if PLATFORM(WINCE)
+WTF_PRIVATE_INLINE void* operator new(size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); }
+WTF_PRIVATE_INLINE void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); }
+WTF_PRIVATE_INLINE void* operator new[](size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); }
+WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); }
+#endif
#endif
#endif // _CRTDBG_MAP_ALLOC
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h
index d664c67..990670d 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h
@@ -176,28 +176,28 @@ namespace WTF {
}
template<typename Value, typename HashFunctions, typename Traits>
- template<typename T, typename Translator>
+ template<typename T, typename HashTranslator>
typename HashSet<Value, HashFunctions, Traits>::iterator
inline HashSet<Value, HashFunctions, Traits>::find(const T& value)
{
- typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, Translator> Adapter;
+ typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
return m_impl.template find<T, Adapter>(value);
}
template<typename Value, typename HashFunctions, typename Traits>
- template<typename T, typename Translator>
+ template<typename T, typename HashTranslator>
typename HashSet<Value, HashFunctions, Traits>::const_iterator
inline HashSet<Value, HashFunctions, Traits>::find(const T& value) const
{
- typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, Translator> Adapter;
+ typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
return m_impl.template find<T, Adapter>(value);
}
template<typename Value, typename HashFunctions, typename Traits>
- template<typename T, typename Translator>
+ template<typename T, typename HashTranslator>
inline bool HashSet<Value, HashFunctions, Traits>::contains(const T& value) const
{
- typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, Translator> Adapter;
+ typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
return m_impl.template contains<T, Adapter>(value);
}
@@ -208,11 +208,11 @@ namespace WTF {
}
template<typename Value, typename HashFunctions, typename Traits>
- template<typename T, typename Translator>
+ template<typename T, typename HashTranslator>
pair<typename HashSet<Value, HashFunctions, Traits>::iterator, bool>
HashSet<Value, HashFunctions, Traits>::add(const T& value)
{
- typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, Translator> Adapter;
+ typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
return m_impl.template addPassingHashCode<T, T, Adapter>(value, value);
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrCommon.h b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrCommon.h
index 6cd8bdd..6d91a54 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrCommon.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrCommon.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,6 +30,7 @@
#if PLATFORM(WIN)
typedef struct HBITMAP__* HBITMAP;
typedef struct HBRUSH__* HBRUSH;
+typedef struct HDC__* HDC;
typedef struct HFONT__* HFONT;
typedef struct HPALETTE__* HPALETTE;
typedef struct HPEN__* HPEN;
@@ -47,6 +49,7 @@ namespace WTF {
#if PLATFORM(WIN)
void deleteOwnedPtr(HBITMAP);
void deleteOwnedPtr(HBRUSH);
+ void deleteOwnedPtr(HDC);
void deleteOwnedPtr(HFONT);
void deleteOwnedPtr(HPALETTE);
void deleteOwnedPtr(HPEN);
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrWin.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrWin.cpp
index b08d7dc..67a32ff 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrWin.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrWin.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,6 +43,12 @@ void deleteOwnedPtr(HBRUSH ptr)
DeleteObject(ptr);
}
+void deleteOwnedPtr(HDC ptr)
+{
+ if (ptr)
+ DeleteDC(ptr);
+}
+
void deleteOwnedPtr(HFONT ptr)
{
if (ptr)
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
index c82d1f7..5e37e09 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
@@ -27,11 +27,11 @@
#define WTF_Platform_h
/* PLATFORM handles OS, operating environment, graphics API, and CPU */
-#define PLATFORM(WTF_FEATURE) (defined( WTF_PLATFORM_##WTF_FEATURE ) && WTF_PLATFORM_##WTF_FEATURE)
-#define COMPILER(WTF_FEATURE) (defined( WTF_COMPILER_##WTF_FEATURE ) && WTF_COMPILER_##WTF_FEATURE)
-#define HAVE(WTF_FEATURE) (defined( HAVE_##WTF_FEATURE ) && HAVE_##WTF_FEATURE)
-#define USE(WTF_FEATURE) (defined( WTF_USE_##WTF_FEATURE ) && WTF_USE_##WTF_FEATURE)
-#define ENABLE(WTF_FEATURE) (defined( ENABLE_##WTF_FEATURE ) && ENABLE_##WTF_FEATURE)
+#define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE)
+#define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE)
+#define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE)
+#define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE)
+#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE)
/* Operating systems - low-level dependencies */
@@ -402,6 +402,10 @@
#endif
#endif /* !defined(HAVE_ACCESSIBILITY) */
+#if PLATFORM(UNIX) && !PLATFORM(SYMBIAN)
+#define HAVE_SIGNAL_H 1
+#endif
+
#if PLATFORM(DARWIN)
#define HAVE_ERRNO_H 1
@@ -549,6 +553,7 @@
#endif
#endif
+#if ENABLE(JIT)
#ifndef ENABLE_JIT_OPTIMIZE_CALL
#define ENABLE_JIT_OPTIMIZE_CALL 1
#endif
@@ -564,6 +569,7 @@
#ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS
#define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1
#endif
+#endif
#if PLATFORM(X86) && COMPILER(MSVC)
#define JSC_HOST_CALL __fastcall
@@ -630,7 +636,7 @@
/* Accelerated compositing */
#if PLATFORM(MAC)
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+#if !defined(BUILDING_ON_TIGER)
#define WTF_USE_ACCELERATED_COMPOSITING 1
#endif
#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h b/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h
index 477e893..f4527df 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Google Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -42,9 +42,20 @@ namespace WTF {
void setFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags |= (1 << flagNumber);}
void clearFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags &= ~(1 << flagNumber);}
T* get() const { return reinterpret_cast<T*>(m_ptrAndFlags & ~3); }
- void set(T* ptr) { ASSERT(!(reinterpret_cast<intptr_t>(ptr) & 3)); m_ptrAndFlags = reinterpret_cast<intptr_t>(ptr) | (m_ptrAndFlags & 3);}
+ void set(T* ptr)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(ptr) & 3));
+ m_ptrAndFlags = reinterpret_cast<intptr_t>(ptr) | (m_ptrAndFlags & 3);
+#ifndef NDEBUG
+ m_leaksPtr = ptr;
+#endif
+ }
+
private:
intptr_t m_ptrAndFlags;
+#ifndef NDEBUG
+ void* m_leaksPtr; // Only used to allow tools like leaks on OSX to detect that the memory is referenced.
+#endif
};
} // namespace WTF
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp
index 9509388..d75c17a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp
@@ -148,6 +148,7 @@
#include <wtf/AlwaysInline.h>
#include <wtf/Assertions.h>
#include <wtf/FastMalloc.h>
+#include <wtf/Vector.h>
#include <wtf/Threading.h>
#include <stdio.h>
@@ -255,6 +256,8 @@ typedef union { double d; uint32_t L[2]; } U;
#define Big0 (Frac_mask1 | Exp_msk1 * (DBL_MAX_EXP + Bias - 1))
#define Big1 0xffffffff
+
+// FIXME: we should remove non-Pack_32 mode since it is unused and unmaintained
#ifndef Pack_32
#define Pack_32
#endif
@@ -278,25 +281,41 @@ typedef union { double d; uint32_t L[2]; } U;
#define Kmax 15
struct BigInt {
- BigInt() : sign(0), wds(0) { }
- BigInt(const BigInt& other) : sign(other.sign), wds(other.wds)
+ BigInt() : sign(0) { }
+ int sign;
+
+ void clear()
+ {
+ sign = 0;
+ m_words.clear();
+ }
+
+ size_t size() const
+ {
+ return m_words.size();
+ }
+
+ void resize(size_t s)
{
- for (int i = 0; i < 64; ++i)
- x[i] = other.x[i];
+ m_words.resize(s);
+ }
+
+ uint32_t* words()
+ {
+ return m_words.data();
}
- BigInt& operator=(const BigInt& other)
+ const uint32_t* words() const
{
- sign = other.sign;
- wds = other.wds;
- for (int i = 0; i < 64; ++i)
- x[i] = other.x[i];
- return *this;
+ return m_words.data();
}
- int sign;
- int wds;
- uint32_t x[64];
+ void append(uint32_t w)
+ {
+ m_words.append(w);
+ }
+
+ Vector<uint32_t, 16> m_words;
};
static void multadd(BigInt& b, int m, int a) /* multiply by m and add a */
@@ -307,8 +326,8 @@ static void multadd(BigInt& b, int m, int a) /* multiply by m and add a */
uint32_t carry;
#endif
- int wds = b.wds;
- uint32_t* x = b.x;
+ int wds = b.size();
+ uint32_t* x = b.words();
int i = 0;
carry = a;
do {
@@ -331,10 +350,8 @@ static void multadd(BigInt& b, int m, int a) /* multiply by m and add a */
#endif
} while (++i < wds);
- if (carry) {
- b.x[wds++] = (uint32_t)carry;
- b.wds = wds;
- }
+ if (carry)
+ b.append((uint32_t)carry);
}
static void s2b(BigInt& b, const char* s, int nd0, int nd, uint32_t y9)
@@ -346,12 +363,12 @@ static void s2b(BigInt& b, const char* s, int nd0, int nd, uint32_t y9)
for (k = 0, y = 1; x > y; y <<= 1, k++) { }
#ifdef Pack_32
b.sign = 0;
- b.x[0] = y9;
- b.wds = 1;
+ b.resize(1);
+ b.words()[0] = y9;
#else
b.sign = 0;
- b.x[0] = y9 & 0xffff;
- b.wds = (b->x[1] = y9 >> 16) ? 2 : 1;
+ b.resize((b->x[1] = y9 >> 16) ? 2 : 1);
+ b.words()[0] = y9 & 0xffff;
#endif
int i = 9;
@@ -440,8 +457,8 @@ static int lo0bits (uint32_t* y)
static void i2b(BigInt& b, int i)
{
b.sign = 0;
- b.x[0] = i;
- b.wds = 1;
+ b.resize(1);
+ b.words()[0] = i;
}
static void mult(BigInt& aRef, const BigInt& bRef)
@@ -459,23 +476,24 @@ static void mult(BigInt& aRef, const BigInt& bRef)
uint32_t carry, z;
#endif
- if (a->wds < b->wds) {
+ if (a->size() < b->size()) {
const BigInt* tmp = a;
a = b;
b = tmp;
}
- wa = a->wds;
- wb = b->wds;
+ wa = a->size();
+ wb = b->size();
wc = wa + wb;
+ c.resize(wc);
- for (xc = c.x, xa = xc + wc; xc < xa; xc++)
+ for (xc = c.words(), xa = xc + wc; xc < xa; xc++)
*xc = 0;
- xa = a->x;
+ xa = a->words();
xae = xa + wa;
- xb = b->x;
+ xb = b->words();
xbe = xb + wb;
- xc0 = c.x;
+ xc0 = c.words();
#ifdef USE_LONG_LONG
for (; xb < xbe; xc0++) {
if ((y = *xb++)) {
@@ -537,8 +555,8 @@ static void mult(BigInt& aRef, const BigInt& bRef)
}
#endif
#endif
- for (xc0 = c.x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) { }
- c.wds = wc;
+ for (xc0 = c.words(), xc = xc0 + wc; wc > 0 && !*--xc; --wc) { }
+ c.resize(wc);
aRef = c;
}
@@ -617,14 +635,20 @@ static ALWAYS_INLINE void lshift(BigInt& b, int k)
int n = k >> 4;
#endif
- int n1 = n + b.wds + 1;
+ int origSize = b.size();
+ int n1 = n + origSize + 1;
+
+ if (k &= 0x1f)
+ b.resize(b.size() + n + 1);
+ else
+ b.resize(b.size() + n);
- const uint32_t* srcStart = b.x;
- uint32_t* dstStart = b.x;
- const uint32_t* src = srcStart + b.wds - 1;
+ const uint32_t* srcStart = b.words();
+ uint32_t* dstStart = b.words();
+ const uint32_t* src = srcStart + origSize - 1;
uint32_t* dst = dstStart + n1 - 1;
#ifdef Pack_32
- if (k &= 0x1f) {
+ if (k) {
uint32_t hiSubword = 0;
int s = 32 - k;
for (; src >= srcStart; --src) {
@@ -633,7 +657,8 @@ static ALWAYS_INLINE void lshift(BigInt& b, int k)
}
*dst = hiSubword;
ASSERT(dst == dstStart + n);
- b.wds = b.wds + n + (b.x[n1 - 1] != 0);
+
+ b.resize(origSize + n + (b.words()[n1 - 1] != 0));
}
#else
if (k &= 0xf) {
@@ -652,10 +677,11 @@ static ALWAYS_INLINE void lshift(BigInt& b, int k)
do {
*--dst = *src--;
} while (src >= srcStart);
- b.wds = b.wds + n;
}
for (dst = dstStart + n; dst != dstStart; )
*--dst = 0;
+
+ ASSERT(b.size() <= 1 || b.words()[b.size() - 1]);
}
static int cmp(const BigInt& a, const BigInt& b)
@@ -663,15 +689,15 @@ static int cmp(const BigInt& a, const BigInt& b)
const uint32_t *xa, *xa0, *xb, *xb0;
int i, j;
- i = a.wds;
- j = b.wds;
- ASSERT(i <= 1 || a.x[i - 1]);
- ASSERT(j <= 1 || b.x[j - 1]);
+ i = a.size();
+ j = b.size();
+ ASSERT(i <= 1 || a.words()[i - 1]);
+ ASSERT(j <= 1 || b.words()[j - 1]);
if (i -= j)
return i;
- xa0 = a.x;
+ xa0 = a.words();
xa = xa0 + j;
- xb0 = b.x;
+ xb0 = b.words();
xb = xb0 + j;
for (;;) {
if (*--xa != *--xb)
@@ -692,8 +718,8 @@ static ALWAYS_INLINE void diff(BigInt& c, const BigInt& aRef, const BigInt& bRef
i = cmp(*a, *b);
if (!i) {
c.sign = 0;
- c.wds = 1;
- c.x[0] = 0;
+ c.resize(1);
+ c.words()[0] = 0;
return;
}
if (i < 0) {
@@ -704,15 +730,16 @@ static ALWAYS_INLINE void diff(BigInt& c, const BigInt& aRef, const BigInt& bRef
} else
i = 0;
- c.wds = 0;
- c.sign = i;
- wa = a->wds;
- const uint32_t* xa = a->x;
+ wa = a->size();
+ const uint32_t* xa = a->words();
const uint32_t* xae = xa + wa;
- wb = b->wds;
- const uint32_t* xb = b->x;
+ wb = b->size();
+ const uint32_t* xb = b->words();
const uint32_t* xbe = xb + wb;
- xc = c.x;
+
+ c.resize(wa);
+ c.sign = i;
+ xc = c.words();
#ifdef USE_LONG_LONG
unsigned long long borrow = 0;
do {
@@ -757,7 +784,7 @@ static ALWAYS_INLINE void diff(BigInt& c, const BigInt& aRef, const BigInt& bRef
#endif
while (!*--xc)
wa--;
- c.wds = wa;
+ c.resize(wa);
}
static double ulp(U *x)
@@ -804,8 +831,8 @@ static double b2d(const BigInt& a, int* e)
#define d0 word0(&d)
#define d1 word1(&d)
- xa0 = a.x;
- xa = xa0 + a.wds;
+ xa0 = a.words();
+ xa = xa0 + a.size();
y = *--xa;
ASSERT(y);
k = hi0bits(y);
@@ -860,11 +887,11 @@ static ALWAYS_INLINE void d2b(BigInt& b, U* d, int* e, int* bits)
b.sign = 0;
#ifdef Pack_32
- b.wds = 1;
+ b.resize(1);
#else
- b.wds = 2;
+ b.resize(2);
#endif
- x = b.x;
+ x = b.words();
z = d0 & Frac_mask;
d0 &= 0x7fffffff; /* clear sign bit, which we ignore */
@@ -881,17 +908,21 @@ static ALWAYS_INLINE void d2b(BigInt& b, U* d, int* e, int* bits)
z >>= k;
} else
x[0] = y;
+ if (z) {
+ b.resize(2);
+ x[1] = z;
+ }
+
#ifndef Sudden_Underflow
- i =
+ i = b.size();
#endif
- b.wds = (x[1] = z) ? 2 : 1;
} else {
k = lo0bits(&z);
x[0] = z;
#ifndef Sudden_Underflow
- i =
+ i = 1;
#endif
- b.wds = 1;
+ b.resize(1);
k += 32;
}
#else
@@ -929,7 +960,7 @@ static ALWAYS_INLINE void d2b(BigInt& b, U* d, int* e, int* bits)
k += 32;
} while (!x[i])
--i;
- b->wds = i + 1;
+ b->resize(i + 1);
#endif
#ifndef Sudden_Underflow
if (de) {
@@ -958,9 +989,9 @@ static double ratio(const BigInt& a, const BigInt& b)
dval(&da) = b2d(a, &ka);
dval(&db) = b2d(b, &kb);
#ifdef Pack_32
- k = ka - kb + 32 * (a.wds - b.wds);
+ k = ka - kb + 32 * (a.size() - b.size());
#else
- k = ka - kb + 16 * (a.wds - b.wds);
+ k = ka - kb + 16 * (a.size() - b.size());
#endif
if (k > 0)
word0(&da) += k * Exp_msk1;
@@ -1452,12 +1483,12 @@ undfl:
#endif
) {
#ifdef SET_INEXACT
- if (!delta->x[0] && delta->wds <= 1)
+ if (!delta->words()[0] && delta->size() <= 1)
inexact = 0;
#endif
break;
}
- if (!delta.x[0] && delta.wds <= 1) {
+ if (!delta.words()[0] && delta.size() <= 1) {
/* exact result */
#ifdef SET_INEXACT
inexact = 0;
@@ -1700,7 +1731,7 @@ ret:
static ALWAYS_INLINE int quorem(BigInt& b, BigInt& S)
{
- int n;
+ size_t n;
uint32_t *bx, *bxe, q, *sx, *sxe;
#ifdef USE_LONG_LONG
unsigned long long borrow, carry, y, ys;
@@ -1710,14 +1741,16 @@ static ALWAYS_INLINE int quorem(BigInt& b, BigInt& S)
uint32_t si, z, zs;
#endif
#endif
+ ASSERT(b.size() <= 1 || b.words()[b.size() - 1]);
+ ASSERT(S.size() <= 1 || S.words()[S.size() - 1]);
- n = S.wds;
- ASSERT_WITH_MESSAGE(b.wds <= n, "oversize b in quorem");
- if (b.wds < n)
+ n = S.size();
+ ASSERT_WITH_MESSAGE(b.size() <= n, "oversize b in quorem");
+ if (b.size() < n)
return 0;
- sx = S.x;
+ sx = S.words();
sxe = sx + --n;
- bx = b.x;
+ bx = b.words();
bxe = bx + n;
q = *bxe / (*sxe + 1); /* ensure q <= true quotient */
ASSERT_WITH_MESSAGE(q <= 9, "oversized quotient in quorem");
@@ -1752,18 +1785,18 @@ static ALWAYS_INLINE int quorem(BigInt& b, BigInt& S)
#endif
} while (sx <= sxe);
if (!*bxe) {
- bx = b.x;
+ bx = b.words();
while (--bxe > bx && !*bxe)
--n;
- b.wds = n;
+ b.resize(n);
}
}
if (cmp(b, S) >= 0) {
q++;
borrow = 0;
carry = 0;
- bx = b.x;
- sx = S.x;
+ bx = b.words();
+ sx = S.words();
do {
#ifdef USE_LONG_LONG
ys = *sx++ + carry;
@@ -1791,12 +1824,12 @@ static ALWAYS_INLINE int quorem(BigInt& b, BigInt& S)
#endif
#endif
} while (sx <= sxe);
- bx = b.x;
+ bx = b.words();
bxe = bx + n;
if (!*bxe) {
while (--bxe > bx && !*bxe)
--n;
- b.wds = n;
+ b.resize(n);
}
}
return q;
@@ -2027,7 +2060,8 @@ void dtoa(char* result, double dd, int ndigits, int* decpt, int* sign, char** rv
dval(&eps) = (ieps * dval(&u)) + 7.;
word0(&eps) -= (P - 1) * Exp_msk1;
if (ilim == 0) {
- S = mhi = BigInt();
+ S.clear();
+ mhi.clear();
dval(&u) -= 5.;
if (dval(&u) > dval(&eps))
goto one_digit;
@@ -2090,7 +2124,8 @@ fast_failed:
/* Yes. */
ds = tens[k];
if (ndigits < 0 && ilim <= 0) {
- S = mhi = BigInt();
+ S.clear();
+ mhi.clear();
if (ilim < 0 || dval(&u) <= 5 * ds)
goto no_digits;
goto one_digit;
@@ -2132,7 +2167,8 @@ bump_up:
m2 = b2;
m5 = b5;
- mhi = mlo = BigInt();
+ mhi.clear();
+ mlo.clear();
if (leftright) {
i =
#ifndef Sudden_Underflow
@@ -2186,10 +2222,10 @@ bump_up:
* can do shifts and ors to compute the numerator for q.
*/
#ifdef Pack_32
- if ((i = ((s5 ? 32 - hi0bits(S.x[S.wds - 1]) : 1) + s2) & 0x1f))
+ if ((i = ((s5 ? 32 - hi0bits(S.words()[S.size() - 1]) : 1) + s2) & 0x1f))
i = 32 - i;
#else
- if ((i = ((s5 ? 32 - hi0bits(S.x[S.wds - 1]) : 1) + s2) & 0xf))
+ if ((i = ((s5 ? 32 - hi0bits(S.words()[S.size() - 1]) : 1) + s2) & 0xf))
i = 16 - i;
#endif
if (i > 4) {
@@ -2252,7 +2288,7 @@ bump_up:
goto ret;
}
if (j < 0 || (j == 0 && !(word1(&u) & 1))) {
- if (!b.x[0] && b.wds <= 1) {
+ if (!b.words()[0] && b.size() <= 1) {
#ifdef SET_INEXACT
inexact = 0;
#endif
@@ -2287,7 +2323,7 @@ round_9_up:
} else
for (i = 1;; i++) {
*s++ = dig = quorem(b,S) + '0';
- if (!b.x[0] && b.wds <= 1) {
+ if (!b.words()[0] && b.size() <= 1) {
#ifdef SET_INEXACT
inexact = 0;
#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp
index 29a9d18..65c53cf 100644
--- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp
@@ -1292,6 +1292,7 @@ class RegexGenerator : private MacroAssembler {
#if PLATFORM(X86_64)
push(X86::ebp);
move(stackPointerRegister, X86::ebp);
+ push(X86::ebx);
#elif PLATFORM(X86)
push(X86::ebp);
move(stackPointerRegister, X86::ebp);
@@ -1319,6 +1320,7 @@ class RegexGenerator : private MacroAssembler {
void generateReturn()
{
#if PLATFORM(X86_64)
+ pop(X86::ebx);
pop(X86::ebp);
#elif PLATFORM(X86)
pop(X86::esi);
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 730c023..fc32632 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -1,11 +1,11 @@
This is a snapshot of the Qt port of WebKit from
- git://code.staikos.net/webkit
+ git://gitorious.org/qtwebkit/qtwebkit.git
The commit imported was from the
- qtwebkit-4.6-snapshot-29062009 branch/tag
+ qtwebkit-4.6-snapshot-13072009 branch/tag
and has the sha1 checksum
- 22aadba1b4356ad7d8e9446b95baccb6b2c037b0
+ b2abc0c271880b8135507861056af497f895adf5
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 8991528..35640c5 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,5488 @@
+2009-07-13 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed make dist build fix.
+
+ * GNUmakefile.am:
+
+2009-07-13 Cédric Luthi <cedric.luthi@gmail.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Fix NPWindow clip rect in PluginViewMac
+
+ The rect should be in window-coordinates. This bug can be observed
+ with Flash 10 here: http://www.permadi.com/tutorial/cursorTracker/
+
+ * plugins/mac/PluginViewMac.cpp:
+
+2009-07-13 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Fix Qt implementation of WebCore::directoryName to return the absolute
+ directory name instead of the base file name.
+
+ * platform/qt/FileSystemQt.cpp:
+ (WebCore::directoryName):
+
+2009-07-13 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Fix WebCore::Path::isEmpty() for the Qt port to return true
+ if there is no element in the path.
+
+ QPainterPath::isEmpty() returns also true if there is one single
+ MoveTo element inside, which makes sense but doesn't patch Webcore's
+ is-empty definition.
+
+ * platform/graphics/qt/PathQt.cpp:
+ (WebCore::Path::isEmpty): Use elementCount() == 0.
+
+2009-07-13 Albert J. Wong <ajwong@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Upstream fixes to NPV8Object.cpp that make ~30 layout tests pass.
+ https://bugs.webkit.org/show_bug.cgi?id=27127
+
+ There were a number of bugs introduced during the last upstreaming
+ effort that broke around 30 layout tests. This fixes those bugs.
+ It also has compile fixes to match the recent cutting apart of
+ V8Proxy.
+
+ * bindings/v8/NPV8Object.cpp:
+ (freeV8NPObject):
+ (npCreateV8ScriptObject):
+ (NPN_Invoke):
+ (NPN_InvokeDefault):
+ (NPN_EvaluateHelper):
+ (NPN_SetException):
+ (NPN_Construct):
+
+2009-07-13 Mads Ager <ager@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Fix memory leak in the V8 binding layer.
+ https://bugs.webkit.org/show_bug.cgi?id=27163
+
+ Reinitializing the context is not necessary when clearing the proxy for navigation
+ and it will lead us to hold on to an empty context for each frame.
+
+ Test for empty context instead of empty global object handle when
+ updating the document for a context.
+
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::clearForNavigation):
+ (WebCore::V8Proxy::updateDocument):
+
+2009-07-13 John Gregg <johnnyg@google.com>
+
+ Reviewed by David Levin.
+
+ Correct the logic to determine if a V8 callback returns a value.
+ https://bugs.webkit.org/show_bug.cgi?id=27155
+
+ * bindings/v8/custom/V8CustomVoidCallback.cpp:
+ (WebCore::invokeCallback):
+ - Don't crash if result.IsEmpty().
+
+2009-07-13 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs
+ https://bugs.webkit.org/show_bug.cgi?id=26932
+
+ Initial IDL definition and bindings for SharedWorkers.
+
+ * Configurations/FeatureDefines.xcconfig:
+ Added new files for SharedWorker support.
+ * DerivedSources.make:
+ Added new files for SharedWorker support.
+ * GNUmakefile.am:
+ Added new files for SharedWorker support.
+ * WebCore.gypi:
+ Added new files for SharedWorker support.
+ * WebCore.pro:
+ Added new files for SharedWorker support.
+ * WebCore.xcodeproj/project.pbxproj:
+ Added new files for SharedWorker support.
+ * bindings/js/JSAbstractWorkerCustom.cpp: Added.
+ (WebCore::JSAbstractWorker::mark):
+ Custom mark handler that marks the event listeners.
+ (WebCore::JSAbstractWorker::addEventListener):
+ (WebCore::JSAbstractWorker::removeEventListener):
+ (WebCore::JSAbstractWorker::toJS):
+ Custom toJS handler which differentiates between various subclasses.
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::sharedWorker):
+ SharedWorker constructor (only enabled when SHARED_WORKERS is
+ enabled).
+ * bindings/js/JSEventTarget.cpp:
+ (WebCore::toJS):
+ (WebCore::toEventTarget):
+ Added support for converting to/from SharedWorkers.
+ * bindings/js/JSSharedWorkerConstructor.cpp: Added.
+ (WebCore::JSSharedWorkerConstructor::JSSharedWorkerConstructor):
+ (WebCore::constructSharedWorker):
+ (WebCore::JSSharedWorkerConstructor::getConstructData):
+ * bindings/js/JSSharedWorkerConstructor.h: Added.
+ (WebCore::JSSharedWorkerConstructor::classInfo):
+ * bindings/js/JSSharedWorkerCustom.cpp: Added.
+ (WebCore::JSSharedWorker::mark):
+ Custom mark function that marks the internal MessagePort.
+ * bindings/v8/DOMObjectsInclude.h:
+ Updated to include new header files.
+ * bindings/v8/V8Index.cpp:
+ * bindings/v8/V8Index.h:
+ * bindings/v8/custom/V8AbstractWorkerCustom.cpp: Added.
+ (WebCore::getEventListener):
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ V8 handlers for add/removeEventListener().
+ * bindings/v8/custom/V8CustomBinding.h:
+ * bindings/v8/custom/V8SharedWorkerCustom.cpp: Added.
+ (WebCore::CALLBACK_FUNC_DECL):
+ Custom constructor for SharedWorker.
+ * dom/EventTarget.cpp:
+ (WebCore::EventTarget::toSharedWorker):
+ * dom/EventTarget.h:
+ * page/DOMWindow.idl:
+ * workers/AbstractWorker.cpp: Added.
+ (WebCore::AbstractWorker::AbstractWorker):
+ Common base class for SharedWorker and (soon) Worker. The functions below were copied from Worker.cpp.
+ This is the first step in refactoring Worker to derive from AbstractWorker to enable code sharing.
+ (WebCore::AbstractWorker::~AbstractWorker):
+ (WebCore::AbstractWorker::addEventListener):
+ (WebCore::AbstractWorker::removeEventListener):
+ (WebCore::AbstractWorker::dispatchEvent):
+ (WebCore::AbstractWorker::dispatchLoadErrorEvent):
+ (WebCore::AbstractWorker::dispatchScriptErrorEvent):
+ * workers/AbstractWorker.h: Added.
+ Definitions of functionality shared by Worker.h and SharedWorker.h. In a future patch, Worker will derive from AbstractWorker.
+ (WebCore::AbstractWorker::scriptExecutionContext):
+ (WebCore::AbstractWorker::setOnerror):
+ (WebCore::AbstractWorker::onerror):
+ (WebCore::AbstractWorker::eventListeners):
+ (WebCore::AbstractWorker::refEventTarget):
+ (WebCore::AbstractWorker::derefEventTarget):
+ * workers/AbstractWorker.idl: Added.
+ * workers/SharedWorker.cpp: Added.
+ (WebCore::SharedWorker::SharedWorker):
+ (WebCore::SharedWorker::~SharedWorker):
+ * workers/SharedWorker.h: Added.
+ (WebCore::SharedWorker::create):
+ (WebCore::SharedWorker::port):
+ (WebCore::SharedWorker::toSharedWorker):
+ * workers/SharedWorker.idl: Added.
+
+2009-07-13 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Cleanup - Remove prf install target
+ https://bugs.webkit.org/show_bug.cgi?id=27191
+
+ qtwebkit.prf has been removed; this cleans up the related
+ install target as well.
+
+ * WebCore.pro: Remove prf install target
+
+2009-07-12 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Facebook Chat is broken due to XSS auditor
+ https://bugs.webkit.org/show_bug.cgi?id=27179
+
+ Instead of just using the script's URL as to detect an XSS attack, we
+ now use a bit of context before the URL. In particular, we use the
+ bytes from the beginning of the attribute name to the end of the
+ attribute value. In virtually all injection attacks, the attacker
+ would need to supply the attribute name as well as the attribute value.
+ However, in the Facebook false positive, the attribute name is not
+ present in the URL.
+
+ Tests: http/tests/security/xssAuditor/script-tag-src-redirect-safe.html
+ http/tests/security/xssAuditor/script-tag-with-source-double-quote.html
+ http/tests/security/xssAuditor/script-tag-with-source-no-quote.html
+
+ * html/HTMLTokenizer.cpp:
+ (WebCore::HTMLTokenizer::parseTag):
+ * html/HTMLTokenizer.h:
+ * page/XSSAuditor.cpp:
+ (WebCore::XSSAuditor::canLoadExternalScriptFromSrc):
+ * page/XSSAuditor.h:
+
+2009-07-12 Keishi Hattori <casey.hattori@gmail.com>
+
+ Reviewed by Timothy Hatcher.
+
+ Refactor ConsoleMessage to add MessageType attribute.
+ https://bugs.webkit.org/show_bug.cgi?id=20625
+
+ * bindings/js/JSCustomXPathNSResolver.cpp:
+ (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
+ * bindings/js/JSDOMWindowBase.cpp:
+ (WebCore::JSDOMWindowBase::printErrorMessage):
+ * dom/Document.cpp:
+ (WebCore::Document::reportException):
+ (WebCore::Document::addMessage):
+ * dom/Document.h:
+ * dom/ScriptExecutionContext.h:
+ * html/HTMLParser.cpp:
+ (WebCore::HTMLParser::reportErrorToConsole):
+ * inspector/ConsoleMessage.cpp:
+ (WebCore::ConsoleMessage::ConsoleMessage):
+ (WebCore::ConsoleMessage::addToConsole):
+ (WebCore::ConsoleMessage::isEqual):
+ * inspector/ConsoleMessage.h:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::addMessageToConsole):
+ (WebCore::InspectorController::startGroup):
+ (WebCore::InspectorController::endGroup):
+ (WebCore::InspectorController::addProfileFinishedMessageToConsole):
+ (WebCore::InspectorController::addStartProfilingMessageToConsole):
+ (WebCore::InspectorController::count):
+ * inspector/InspectorController.h:
+ * inspector/front-end/Console.js:
+ (WebInspector.Console.prototype.addMessage):
+ (WebInspector.ConsoleMessage): Added type property.
+ (WebInspector.ConsoleMessage.prototype.toMessageElement):
+ (WebInspector.ConsoleMessage.prototype.toString):
+ (WebInspector.ConsoleMessage.prototype.isEqual):
+ (WebInspector.ConsoleCommandResult):
+ (WebInspector.ConsoleGroup.prototype.addMessage):
+ (WebInspector.ConsoleGroup.prototype._titleClicked):
+ * inspector/front-end/Resource.js:
+ (WebInspector.Resource.prototype._addTip):
+ (WebInspector.Resource.prototype._checkWarning):
+ * inspector/front-end/inspector.css: Changed ".console-group-title-level" to ".console-group-title"
+ * inspector/front-end/inspector.js:
+ (WebInspector.addMessageToConsole):
+ * loader/DocLoader.cpp:
+ (WebCore::DocLoader::printAccessDeniedMessage):
+ * loader/EmptyClients.h:
+ (WebCore::EmptyChromeClient::addMessageToConsole):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::reportLocalLoadFailed):
+ (WebCore::FrameLoader::shouldAllowNavigation):
+ * page/ChromeClient.h:
+ * page/Console.cpp:
+ (WebCore::printMessageSourceAndLevelPrefix):
+ (WebCore::Console::addMessage):
+ (WebCore::Console::error):
+ (WebCore::Console::log):
+ (WebCore::Console::dir):
+ (WebCore::Console::trace):
+ (WebCore::Console::assertCondition):
+ (WebCore::Console::timeEnd):
+ (WebCore::Console::warn):
+ * page/Console.h: Added MessageType enum.
+ (WebCore::):
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::postMessageTimerFired):
+ * page/XSSAuditor.cpp:
+ (WebCore::XSSAuditor::canEvaluate):
+ (WebCore::XSSAuditor::canLoadExternalScriptFromSrc):
+ (WebCore::XSSAuditor::canLoadObject):
+ * svg/SVGDocumentExtensions.cpp:
+ (WebCore::SVGDocumentExtensions::reportWarning):
+ (WebCore::SVGDocumentExtensions::reportError):
+ * wml/WMLErrorHandling.cpp:
+ (WebCore::reportWMLError):
+ * workers/GenericWorkerTask.h: Added GenericWorkerTask8 for the extra argument.
+ (WebCore::GenericWorkerTask8::create):
+ (WebCore::GenericWorkerTask8::GenericWorkerTask8):
+ (WebCore::GenericWorkerTask8::performTask):
+ (WebCore::createCallbackTask):
+ * workers/WorkerContext.cpp:
+ (WebCore::WorkerContext::addMessage):
+ (WebCore::WorkerContext::importScripts):
+ * workers/WorkerContext.h:
+ * workers/WorkerMessagingProxy.cpp:
+ (WebCore::postConsoleMessageTask):
+ (WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject):
+ * workers/WorkerMessagingProxy.h:
+ * workers/WorkerObjectProxy.h:
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::reportUnsafeUsage):
+ (WebCore::XMLHttpRequest::didFinishLoading):
+ * xml/XSLTProcessor.cpp:
+ (WebCore::XSLTProcessor::parseErrorFunc):
+
+2009-07-12 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Upstream UndetectableHTMLCollection.idl as HTMLAllCollection.idl.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27132
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/v8/DOMObjectsInclude.h:
+ * bindings/v8/DerivedSourcesAllInOne.cpp:
+ * bindings/v8/V8DOMWrapper.cpp:
+ (WebCore::V8DOMWrapper::getTemplate):
+ (WebCore::V8DOMWrapper::instantiateV8Object):
+ * bindings/v8/V8Index.cpp:
+ * bindings/v8/V8Index.h:
+ * dom/HTMLAllCollection.idl: Added.
+
+2009-07-12 Joseph Pecoraro <joepeck02@gmail.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Inspector: Duplicate Computation in Autocompletion
+ https://bugs.webkit.org/show_bug.cgi?id=26778
+
+ * inspector/front-end/TextPrompt.js:
+ (WebInspector.TextPrompt.prototype._completionsReady):
+
+2009-07-12 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27196
+ Rename bidi.cpp to RenderBlockLineLayout.cpp and remove bidi.h
+
+ * GNUmakefile.am: Updated.
+ * WebCore.gypi: Updated.
+ * WebCore.pro: Updated.
+ * WebCore.vcproj/WebCore.vcproj: Updated.
+ * WebCore.xcodeproj/project.pbxproj: Updated.
+ * WebCoreSources.bkl: Updated.
+ * rendering/RenderBlock.h: Removed unnecessary forward declaration and
+ updated comments.
+ * rendering/RenderBlockLineLayout.cpp: Copied from WebCore/rendering/bidi.cpp.
+ Removed unnecessary #include statements.
+ (WebCore::BidiRun::BidiRun): Moved here from bidi.h.
+ (WebCore::RenderBlock::layoutInlineChildren): Removed outdated comment.
+ * rendering/bidi.cpp: Removed.
+ * rendering/bidi.h: Removed.
+
+2009-07-12 Dan Bernstein <mitz@apple.com>
+
+ - Windows build fix
+
+ * platform/graphics/cg/PDFDocumentImage.cpp:
+ (WebCore::PDFDocumentImage::dataChanged):
+
+2009-07-12 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - Image cleanup
+
+ * platform/graphics/BitmapImage.cpp:
+ (WebCore::BitmapImage::destroyDecodedData): Use the data() accessor
+ instead of the m_data member.
+ (WebCore::BitmapImage::dataChanged): Ditto.
+ * platform/graphics/Image.h: Re-ordered #includes and class
+ declarations. Removed the drawPatternCallback() declaration. Made member
+ variables private.
+ * platform/graphics/cg/ImageCG.cpp:
+ (WebCore::drawPatternCallback): Changed this from a member function to a
+ static function.
+ * platform/graphics/cg/PDFDocumentImage.cpp:
+ (WebCore::PDFDocumentImage::dataChanged): Use the data() accessor
+ instead of the m_data member.
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::dataChanged): Ditto.
+
+2009-07-12 Daniel Bates <dbates@intudata.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27189
+
+ Fixes insufficient check in XSSAuditor::canSetBaseElementURL that caused
+ XSSAuditor to incorrectly block HTML Base elements whose base path coincided
+ with the URL of the page.
+
+ Test: http/tests/security/xssAuditor/base-href-safe3.html
+
+ * page/XSSAuditor.cpp:
+ (WebCore::XSSAuditor::canSetBaseElementURL): Changed conditional to only call
+ XSSAuditor::findInRequest() if the host in the page URL disagrees with the host
+ in the base element URL.
+
+2009-07-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Text searching with ICU should take the user's default locale into account
+ https://bugs.webkit.org/show_bug.cgi?id=27184
+ rdar://problem/6812121
+
+ No simple way to test this since it's dependent on user locale.
+ After this, the user's default locale is used only on Mac.
+
+ * editing/TextIterator.cpp:
+ (WebCore::createSearcher): Pass result of the currentSearchLocaleID
+ function as the locale.
+
+ * platform/text/TextBreakIteratorInternalICU.h: Added declaration of
+ currentSearchLocaleID function.
+
+ * platform/text/android/TextBreakIteratorInternalICU.cpp:
+ (WebCore::currentSearchLocaleID): Added. Returns the empty string.
+ * platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp:
+ (WebCore::currentSearchLocaleID): Ditto.
+ * platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp:
+ (WebCore::currentSearchLocaleID): Ditto.
+
+ * platform/text/mac/TextBreakIteratorInternalICUMac.mm:
+ (WebCore::textBreakLocalePreference): Added. Returns the value of
+ the AppleTextBreakLocale preference.
+ (WebCore::topLanguagePreference): Added. Returns the value of the
+ first item in the AppleLanguages preference.
+ (WebCore::canonicalLanguageIdentifier): Added. Cover for the
+ CFLocaleCreateCanonicalLanguageIdentifierFromString function.
+ (WebCore::getLocale): Added. Transfers the locale from a CFStringRef
+ into a buffer.
+ (WebCore::getSearchLocale): Added. Calls topLanguagePreference,
+ canonicalLanguageIdentifier, and getLocale.
+ (WebCore::currentSearchLocaleID): Added. Calls getSearchLocale once.
+ (WebCore::getTextBreakLocale): Changed to call
+ textBreakLocalePreference, topLanguagePreference,
+ canonicalLanguageIdentifier, and getLocale.
+
+ * platform/text/win/TextBreakIteratorInternalICUWin.cpp:
+ (WebCore::currentSearchLocaleID): Added. Returns the empty string.
+ * platform/wx/TemporaryLinkStubs.cpp:
+ (WebCore::currentSearchLocaleID): Ditto.
+
+2009-07-12 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25415
+ [GTK][ATK] Please implement support for get_text_at_offset
+
+ Create a PangoLayout that properly represents the visual
+ appearance of the text in the web page so that the line boundary
+ modes of getText{At,Before,After}Offset work correctly.
+
+ * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
+ (UTF16ToUTF8):
+ (g_substr):
+ (convertUniCharToUTF8):
+ (getPangoLayoutForAtk):
+
+2009-07-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Bug 27187 - Match Gecko behaviour for canvas path mutation APIs on an empty path
+ <https://bugs.webkit.org/show_bug.cgi?id=27187>
+
+ Simple API change, check for the empty path and add appropriate point if necessary.
+
+ Test: fast/canvas/canvas-modify-emptyPath.html
+
+ * Info.plist:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::lineTo):
+ (WebCore::CanvasRenderingContext2D::quadraticCurveTo):
+ (WebCore::CanvasRenderingContext2D::bezierCurveTo):
+
+2009-07-11 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Antti Koivisto.
+
+ HTMLMediaElement.canPlayType "maybe" and "probably" reversed
+ https://bugs.webkit.org/show_bug.cgi?id=27186
+
+ * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivate::supportsType):
+ Return "probably" if type has codecs parameter.
+
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivate::supportsType):
+ Ditto.
+
+ * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
+ (WebCore::MediaPlayerPrivate::supportsType):
+ Ditto.
+
+2009-07-11 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ A worker-thread inspired follow-up for:
+ https://bugs.webkit.org/show_bug.cgi?id=26496 and <rdar://problem/7046520>
+ REGRESSION: XHR stream connection blocks iFrame loading and resource downloading
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::loadRequestAsynchronously): Don't perform the XHR compensation when the XHR
+ is running on a worker thread. Accessing the global Cache data structures from a non-main thread is
+ not currently supported.
+
+2009-07-11 Simon Fraser <simon.fraser@apple.com>
+
+ Enable support for accelerated compositing and 3d transforms on Leopard.
+ <https://bugs.webkit.org/show_bug.cgi?id=20166>
+ <rdar://problem/6120614>
+
+ Reviewed by Oliver Hunt.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-07-11 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the Qt build after r45724.
+
+ * bridge/qt/qt_instance.cpp:
+ (JSC::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
+ * bridge/qt/qt_runtime.cpp:
+ (JSC::Bindings::QtRuntimeMethod::QtRuntimeMethod):
+
+2009-07-10 Daniel Bates <dbates@intudata.com>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26921
+
+ Implements support for HTML entities, so XSSAuditor can protect against attacks
+ encoded with HTML entities.
+
+ Tests: http/tests/security/xssAuditor/inline-event-HTML-entities.html
+ http/tests/security/xssAuditor/javascript-link-HTML-entities-control-char.html
+ http/tests/security/xssAuditor/javascript-link-HTML-entities-named.html
+ http/tests/security/xssAuditor/javascript-link-HTML-entities-null-char.html
+ http/tests/security/xssAuditor/javascript-link-HTML-entities.html
+ http/tests/security/xssAuditor/link-onclick-entities.html
+ http/tests/security/xssAuditor/script-tag-entities.html
+ http/tests/security/xssAuditor/script-tag-with-source-entities.html
+
+ * page/XSSAuditor.cpp:
+ (WebCore::XSSAuditor::canEvaluate):
+ (WebCore::XSSAuditor::canEvaluateJavaScriptURL):
+ (WebCore::XSSAuditor::decodeURL): Modified to call WebCore::XSSAuditor::decodeHTMLEntities
+ to decode HTML entities.
+ (WebCore::XSSAuditor::decodeHTMLEntities): Added method to decode HTML entities.
+ (WebCore::XSSAuditor::findInRequest):
+ * page/XSSAuditor.h:
+
+2009-07-10 David Kilzer <ddkilzer@apple.com>
+
+ Bug 27007: Build fixes when ICONDATABASE is disabled
+
+ <https://bugs.webkit.org/show_bug.cgi?id=27007>
+
+ Reviewed by Sam Weinig.
+
+ * WebCore.xcodeproj/project.pbxproj: Added IconDatabaseNone.cpp
+ to the project.
+ * loader/icon/IconDatabase.cpp: Added
+ #if ENABLE(ICONDATABASE)/#endif macro guard.
+ * loader/icon/IconDatabase.h: Removed three public methods from
+ #if ENABLE(ICONDATABASE)/#endif macro so that they may be
+ stubbed out in IconDatabaseNone.cpp.
+ * loader/icon/IconDatabaseNone.cpp: Added
+ #if !ENABLE(ICONDATABASE)/#endif macro guard.
+ (WebCore::IconDatabase::importIconURLForPageURL): Added.
+ (WebCore::IconDatabase::importIconDataForIconURL): Added.
+ (WebCore::IconDatabase::shouldStopThreadActivity): Added.
+
+2009-07-10 Daniel Bates <dbates@intudata.com>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27151
+
+ Fixes issue where JavaScript URLs that contain null- and non-null control characters can
+ bypass XSSAuditor.
+
+ Tests: http/tests/security/xssAuditor/javascript-link-control-char.html
+ http/tests/security/xssAuditor/javascript-link-null-char.html
+ http/tests/security/xssAuditor/javascript-link.html
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::evaluate): Separated out logic for JavaScript URLs from
+ inline scripts. For JavaScript URLs, calls XSSAuditor::canEvaluateJavaScriptURL.
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::evaluate): Made similar changes to evaluate() as in
+ bindings/js/ScriptController.cpp.
+ * page/XSSAuditor.cpp:
+ (WebCore::XSSAuditor::canEvaluateJavaScriptURL): Separated out logic for JavaScript URLs
+ into its own method.
+ * page/XSSAuditor.h:
+
+2009-07-10 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by David Kilzer.
+
+ WebKit needs a style linting tool
+ https://bugs.webkit.org/show_bug.cgi?id=25884
+
+ Fix bunch of style issues by autofix of cpplint.
+ This patch is created to demonstrate the autofix of cpplint.py.
+
+ No new testcases because it's a style fix
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseMediaQuery):
+ (WebCore::CSSParser::validUnit):
+ (WebCore::CSSParser::parseValue):
+ (WebCore::skipCommaInDashboardRegion):
+ (WebCore::CSSParser::parseDashboardRegions):
+ (WebCore::ShadowParseContext::commitValue):
+ (WebCore::ShadowParseContext::commitLength):
+ (WebCore::ShadowParseContext::commitColor):
+ (WebCore::BorderImageParseContext::commitNumber):
+ (WebCore::BorderImageParseContext::commitWidth):
+ (WebCore::BorderImageParseContext::commitRule):
+ (WebCore::BorderImageParseContext::commitBorderImage):
+ (WebCore::CSSParser::lex):
+ (WebCore::CSSParser::text):
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+ * css/MediaList.cpp:
+ (WebCore::MediaList::deleteMedium):
+ * css/MediaQuery.h:
+ * css/MediaQueryEvaluator.cpp:
+ (WebCore::parseAspectRatio):
+ * css/MediaQueryEvaluator.h:
+ * css/MediaQueryExp.h:
+ (WebCore::MediaQueryExp::operator==):
+ * css/WebKitCSSMatrix.h:
+ * dom/Comment.h:
+ * dom/Document.cpp:
+ (WebCore::Document::setFocusedNode):
+ * dom/Document.h:
+ (WebCore::Document::setHasDashboardRegions):
+ * dom/DocumentFragment.cpp:
+ (WebCore::DocumentFragment::nodeName):
+ * dom/DocumentFragment.h:
+ * dom/DynamicNodeList.h:
+ * dom/EditingText.h:
+ * dom/Element.cpp:
+ (WebCore::Element::dispatchAttrAdditionEvent):
+ * dom/NamedAttrMap.cpp:
+ (WebCore::NamedNodeMap::item):
+ * dom/Node.cpp:
+ (WebCore::Node::nodeValue):
+ (WebCore::Node::nodeIndex):
+ * dom/NodeRareData.h:
+ (WebCore::NodeListsNodeData::create):
+ * dom/Notation.h:
+ * dom/ProcessingInstruction.h:
+ * dom/Range.cpp:
+ (WebCore::Range::processContents):
+ * dom/StyledElement.cpp:
+ (WebCore::toHex):
+ * dom/XMLTokenizerLibxml2.cpp:
+ (WebCore::PendingCallbacks::PendingStartElementNSCallback::~PendingStartElementNSCallback):
+ (WebCore::PendingCallbacks::PendingStartElementNSCallback::call):
+ (WebCore::PendingCallbacks::):
+ (WebCore::OffsetBuffer::readOutBytes):
+ (WebCore::handleElementNamespaces):
+ (WebCore::handleElementAttributes):
+ (WebCore::attributesStartElementNsHandler):
+ * dom/XMLTokenizerQt.cpp:
+ (WebCore::attributesStartElementNsHandler):
+ (WebCore::XMLTokenizer::parseStartElement):
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::applyInlineStyle):
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::removeNode):
+ * editing/Editor.cpp:
+ (WebCore::Editor::pasteAsPlainText):
+ * editing/SelectionController.cpp:
+ (WebCore::SelectionController::directionOfEnclosingBlock):
+ * editing/SmartReplaceICU.cpp:
+ (WebCore::addAllCodePoints):
+ * history/HistoryItem.cpp:
+ (WebCore::HistoryItem::icon):
+ (WebCore::HistoryItem::adoptVisitCounts):
+ * html/CanvasStyle.cpp:
+ (WebCore::CanvasStyle::applyFillColor):
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::setActive):
+ (WebCore::HTMLAnchorElement::isLiveLink):
+ * html/HTMLAppletElement.h:
+ * html/HTMLAudioElement.h:
+ * html/HTMLBRElement.h:
+ * html/HTMLBaseElement.h:
+ * html/HTMLBaseFontElement.h:
+ * html/HTMLDListElement.h:
+ * html/HTMLDirectoryElement.h:
+ * html/HTMLFieldSetElement.cpp:
+ (WebCore::HTMLFieldSetElement::HTMLFieldSetElement):
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::reset):
+ * html/HTMLHRElement.cpp:
+ (WebCore::HTMLHRElement::parseMappedAttribute):
+ * html/HTMLHeadElement.h:
+ * html/HTMLHtmlElement.h:
+ * html/HTMLImageElement.h:
+ (WebCore::HTMLImageElement::setLoadManually):
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::selection):
+ * html/HTMLIsIndexElement.h:
+ * html/HTMLMarqueeElement.cpp:
+ * html/HTMLMediaElement.h:
+ (WebCore::HTMLMediaElement::):
+ * html/HTMLMenuElement.h:
+ * html/HTMLMetaElement.h:
+ * html/HTMLModElement.h:
+ * html/HTMLOListElement.h:
+ * html/HTMLOptionElement.cpp:
+ (WebCore::HTMLOptionElement::childrenChanged):
+ * html/HTMLParamElement.h:
+ * html/HTMLQuoteElement.h:
+ * html/HTMLStyleElement.h:
+ * html/HTMLTableCaptionElement.h:
+ * html/HTMLTableCellElement.h:
+ * html/HTMLTableColElement.h:
+ * html/HTMLTableSectionElement.cpp:
+ (WebCore::HTMLTableSectionElement::deleteRow):
+ * html/HTMLTitleElement.h:
+ * html/HTMLTokenizer.cpp:
+ (WebCore::HTMLTokenizer::parseNonHTMLText):
+ (WebCore::HTMLTokenizer::parseEntity):
+ (WebCore::HTMLTokenizer::parseTag):
+ (WebCore::HTMLTokenizer::write):
+ * html/HTMLUListElement.h:
+ * html/HTMLVideoElement.h:
+ * html/TimeRanges.h:
+ (WebCore::TimeRanges::Range::Range):
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::enableResourceTracking):
+ (WebCore::InspectorController::disableResourceTracking):
+ * inspector/InspectorFrontend.cpp:
+ (WebCore::InspectorFrontend::newInspectorJSONObject):
+ * page/Console.cpp:
+ (WebCore::Console::addMessage):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleMousePressEvent):
+ (WebCore::EventHandler::selectCursor):
+ (WebCore::EventHandler::defaultKeyboardEventHandler):
+ * page/Frame.cpp:
+ (WebCore::Frame::jsDefaultStatusBarText):
+ * page/android/DragControllerAndroid.cpp:
+ (WebCore::DragController::dragOperation):
+ * page/android/EventHandlerAndroid.cpp:
+ (WebCore::EventHandler::tabsToAllControls):
+ (WebCore::EventHandler::eventActivatedView):
+ * page/animation/AnimationController.cpp:
+ (WebCore::AnimationControllerPrivate::updateStyleIfNeededDispatcherFired):
+ * page/gtk/DragControllerGtk.cpp:
+ (WebCore::DragController::dragOperation):
+ * page/qt/DragControllerQt.cpp:
+ * page/win/DragControllerWin.cpp:
+ (WebCore::DragController::isCopyKeyDown):
+ * page/win/FrameWin.h:
+ * rendering/RenderSlider.cpp:
+ (WebCore::RenderSlider::mouseEventOffsetToThumb):
+ * rendering/style/RenderStyle.h:
+ (WebCore::InheritedFlags::setVerticalAlignLength):
+ (WebCore::InheritedFlags::setUnicodeBidi):
+ (WebCore::InheritedFlags::setCursor):
+ * rendering/style/RenderStyleConstants.h:
+ (WebCore::):
+ * rendering/style/SVGRenderStyleDefs.h:
+ * rendering/style/StyleInheritedData.h:
+ (WebCore::StyleInheritedData::operator!=):
+ * storage/DatabaseTask.h:
+ * svg/GradientAttributes.h:
+ * svg/LinearGradientAttributes.h:
+ * svg/PatternAttributes.h:
+ * svg/RadialGradientAttributes.h:
+ * svg/SVGAnimatedPathData.h:
+ * svg/SVGAnimatedPoints.h:
+ * svg/SVGAnimationElement.h:
+ * svg/SVGClipPathElement.h:
+ * svg/SVGElementInstance.h:
+ * svg/SVGFEBlendElement.cpp:
+ (WebCore::SVGFEBlendElement::build):
+ * svg/SVGFEBlendElement.h:
+ * svg/SVGFEColorMatrixElement.cpp:
+ (WebCore::SVGFEColorMatrixElement::build):
+ * svg/SVGFEComponentTransferElement.cpp:
+ (WebCore::SVGFEComponentTransferElement::build):
+ * svg/SVGFECompositeElement.cpp:
+ (WebCore::SVGFECompositeElement::build):
+ * svg/SVGFEDiffuseLightingElement.cpp:
+ (WebCore::SVGFEDiffuseLightingElement::build):
+ * svg/SVGFEDisplacementMapElement.cpp:
+ (WebCore::SVGFEDisplacementMapElement::build):
+ * svg/SVGFEDistantLightElement.h:
+ * svg/SVGFEFloodElement.cpp:
+ (WebCore::SVGFEFloodElement::build):
+ * svg/SVGFEFloodElement.h:
+ * svg/SVGFEFuncAElement.h:
+ * svg/SVGFEFuncBElement.h:
+ * svg/SVGFEFuncGElement.h:
+ * svg/SVGFEFuncRElement.h:
+ * svg/SVGFEGaussianBlurElement.cpp:
+ (WebCore::SVGFEGaussianBlurElement::build):
+ * svg/SVGFEImageElement.cpp:
+ (WebCore::SVGFEImageElement::build):
+ * svg/SVGFEMergeElement.cpp:
+ (WebCore::SVGFEMergeElement::build):
+ * svg/SVGFEOffsetElement.cpp:
+ (WebCore::SVGFEOffsetElement::build):
+ * svg/SVGFEPointLightElement.h:
+ * svg/SVGFESpecularLightingElement.cpp:
+ (WebCore::SVGFESpecularLightingElement::build):
+ * svg/SVGFESpotLightElement.h:
+ * svg/SVGFETileElement.cpp:
+ (WebCore::SVGFETileElement::build):
+ * svg/SVGLineElement.cpp:
+ (WebCore::SVGLineElement::parseMappedAttribute):
+ * svg/SVGList.h:
+ * svg/SVGListTraits.h:
+ (WebCore::):
+ * svg/SVGMPathElement.h:
+ * svg/SVGMetadataElement.h:
+ * svg/SVGParserUtilities.cpp:
+ (WebCore::SVGPathParser::parseSVG):
+ (WebCore::SVGPathParser::calculateArc):
+ * svg/SVGPathElement.h:
+ * svg/SVGPathSegClosePath.h:
+ * svg/SVGSVGElement.h:
+ * svg/SVGSetElement.h:
+ * svg/SVGSwitchElement.h:
+ * svg/SVGTextPathElement.cpp:
+ (WebCore::SVGTextPathElement::parseMappedAttribute):
+ * svg/SVGTextPathElement.h:
+ * svg/SVGTitleElement.h:
+ * svg/SVGTransformable.cpp:
+ (WebCore::):
+ * svg/SVGViewSpec.cpp:
+ (WebCore::):
+ * svg/animation/SMILTime.cpp:
+ (WebCore::operator+):
+ (WebCore::operator-):
+ (WebCore::operator*):
+ * svg/animation/SVGSMILElement.h:
+ * svg/graphics/SVGResource.cpp:
+ (WebCore::clientMap):
+ * wml/WMLPostfieldElement.cpp:
+ (WebCore::WMLPostfieldElement::value):
+ * wml/WMLSetvarElement.cpp:
+ (WebCore::WMLSetvarElement::value):
+ * workers/WorkerRunLoop.cpp:
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::dropProtection):
+ * xml/XPathPath.h:
+
+2009-07-10 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/7049066>.
+ Update SnowLeopard media controller layout.
+
+ * css/mediaControlsQT.css:
+ Update for new layout.
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::movieLoadType):
+ Added to replace isStreaming.
+ * html/HTMLMediaElement.h:
+ Declare movieLoadType, remove isStreaming.
+
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlStatusDisplayElement::update):
+ Use movieLoadType instead of isStreaming.
+ (WebCore::MediaControlTimelineContainerElement::rendererIsNeeded):
+ MediaControlElement is the base class, not HTMLInputElement.
+ (WebCore::MediaControlStatusDisplayElement::rendererIsNeeded):
+ Ditto.
+ (WebCore::MediaControlRewindButtonElement::rendererIsNeeded):
+ Don't display rewind button for live streams.
+ (WebCore::MediaControlReturnToRealtimeButtonElement::rendererIsNeeded):
+ MediaControlInputElement is the base class, not HTMLInputElement.
+ * rendering/MediaControlElements.h:
+
+ * rendering/RenderThemeMac.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::getMediaUIPartStateFlags):
+ New, return wkDrawMediaUIPart flags.
+ (WebCore::RenderThemeMac::paintMediaFullscreenButton):
+ (WebCore::RenderThemeMac::paintMediaMuteButton):
+ (WebCore::RenderThemeMac::paintMediaPlayButton):
+ (WebCore::RenderThemeMac::paintMediaSeekBackButton):
+ (WebCore::RenderThemeMac::paintMediaSeekForwardButton):
+ (WebCore::RenderThemeMac::paintMediaSliderTrack):
+ (WebCore::RenderThemeMac::paintMediaSliderThumb):
+ (WebCore::RenderThemeMac::paintMediaRewindButton):
+ (WebCore::RenderThemeMac::paintMediaReturnToRealtimeButton):
+ (WebCore::RenderThemeMac::paintMediaControlsBackground):
+ (WebCore::RenderThemeMac::paintMediaCurrentTime):
+ (WebCore::RenderThemeMac::paintMediaTimeRemaining):
+ Use getMediaUIPartStateFlags.
+
+2009-07-10 Michelangelo De Simone <micdesim@gmail.com>
+
+ Reviewed by Adele Peterson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19562
+ Added build stuff and stub for the ValidityState class, part of HTML5
+ section Forms:
+ http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#validitystate
+
+ Test: fast/forms/ValidityState-001.html
+
+ * DerivedSources.cpp: Fix aimed to include ValidityState files
+ * DerivedSources.make: ditto
+ * GNUmakefile.am: ditto
+ * WebCore.gypi: ditto
+ * WebCore.pro: ditto
+ * WebCore.vcproj/WebCore.vcproj: ditto
+ * WebCore.xcodeproj/project.pbxproj: ditto
+ * WebCoreSources.bkl: ditto
+ * html/HTMLButtonElement.idl: "validity" attribute
+ * html/HTMLFieldSetElement.idl: ditto
+ * html/HTMLFormControlElement.cpp: object getter
+ (WebCore::HTMLFormControlElement::validity):
+ * html/HTMLFormControlElement.h: ditto
+ * html/HTMLInputElement.idl: "validity" attribute
+ * html/HTMLSelectElement.idl: ditto
+ * html/HTMLTextAreaElement.idl: ditto
+ * html/ValidityState.cpp: Added.
+ (WebCore::ValidityState::ValidityState):
+ (WebCore::ValidityState::valid): validation flag
+ * html/ValidityState.h: Added.
+ (WebCore::ValidityState::create): creation routine
+ (WebCore::ValidityState::control): ValidityState's parent getter
+ (WebCore::ValidityState::valueMissing): validation flag
+ (WebCore::ValidityState::typeMismatch): ditto
+ (WebCore::ValidityState::patternMismatch): ditto
+ (WebCore::ValidityState::tooLong): ditto
+ (WebCore::ValidityState::rangeUnderflow): ditto
+ (WebCore::ValidityState::rangeOverflow): ditto
+ (WebCore::ValidityState::stepMismatch): ditto
+ (WebCore::ValidityState::customError): ditto
+ * html/ValidityState.idl: Added.
+
+2009-07-10 Brady Eidson <beidson@apple.com>
+
+ Style cleanup over my last patch.
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::~XMLHttpRequest):
+
+2009-07-10 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ * inspector/JavaScriptCallFrame.cpp:
+ (WebCore::JavaScriptCallFrame::dynamicGlobalObject):
+ * inspector/JavaScriptCallFrame.h: New helper method, used below.
+
+ * inspector/JavaScriptDebugServer.cpp:
+ (WebCore::JavaScriptDebugServer::detach): In the special case
+ where we detach from a window currently executing JavaScript,
+ manually tear down our representation of the JavaScript
+ call stack, since we won't get any more callbacks from JavaScriptCore
+ to automatically tear it down. It's too bad that WebCore is
+ responsible for this kind of tracking -- in the future, it would
+ be nice if more of the breakpoint handling was inside of JavaScriptCore.
+
+2009-07-10 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Antti Koivisto.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26496 and <rdar://problem/7046520>
+ REGRESSION: XHR stream connection blocks iFrame loading and resource downloading
+
+ With this test we ended up going over the maximum-connections-per-host limit that CFNetwork expected.
+ When that happened, the first request that was over the limit ended up in a bizarre state where it
+ wasn't fully serviced until after the long running XHR was complete.
+
+ Loader and Loader::Host work together to try to not exceed the max-connection limit but non-cache
+ resources - such as XHR - could still end up causing this limit to be exceeded.
+
+ This fix adds a workaround specifically for XHR while we hash out a more thorough solution that will
+ handle this at the resource handle level.
+
+ * loader/loader.cpp:
+ (WebCore::Loader::nonCacheRequestInFlight):
+ (WebCore::Loader::nonCacheRequestComplete):
+ (WebCore::Loader::Host::Host):
+ (WebCore::Loader::Host::nonCacheRequestInFlight):
+ (WebCore::Loader::Host::nonCacheRequestComplete):
+ (WebCore::Loader::Host::servePendingRequests): Take nonCacheRequestsInFlight into account.
+ * loader/loader.h:
+ (WebCore::Loader::Host::processingResource): Take nonCacheRequestsInFlight into account.
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::XMLHttpRequest):
+ (WebCore::XMLHttpRequest::~XMLHttpRequest):
+ (WebCore::XMLHttpRequest::loadRequestAsynchronously): Bump the nonCacheRequestInFlight count.
+ (WebCore::XMLHttpRequest::didFail): Decrement that count if the Loader was notified.
+ (WebCore::XMLHttpRequest::didFinishLoading): Ditto.
+
+2009-07-10 Antti Koivisto <antti@apple.com>
+
+ Try to unbreak non-Mac build.
+
+ * page/ChromeClient.h:
+ (WebCore::ChromeClient::formDidFocus):
+ (WebCore::ChromeClient::formDidBlur):
+
+2009-07-10 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ The rest of the fix for <rdar://problem/7038831> REGRESSION (TOT):
+ In Mail, a crash occurs at WebCore::Widget::afterMouseDown() after
+ clicking To Do's close box
+
+ Make the Widget* in passMouseDownEventToWidget() a RefPtr.
+
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::EventHandler::passMouseDownEventToWidget):
+
+2009-07-10 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ rename getDOMStructure calls w/o JSGlobalObject* to deprecatedGetDOMStructure
+ https://bugs.webkit.org/show_bug.cgi?id=27157
+
+ This is the first step to fixing
+ https://bugs.webkit.org/show_bug.cgi?id=27088
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::deprecatedGetDOMStructure):
+ (WebCore::createDOMObjectWrapper):
+ (WebCore::createDOMNodeWrapper):
+ * bindings/js/JSNamedNodesCollection.cpp:
+ (WebCore::JSNamedNodesCollection::JSNamedNodesCollection):
+ * bindings/js/JSRGBColor.cpp:
+ (WebCore::JSRGBColor::JSRGBColor):
+ * bridge/objc/objc_runtime.mm:
+ (JSC::Bindings::ObjcFallbackObjectImp::ObjcFallbackObjectImp):
+ * bridge/runtime_array.cpp:
+ (JSC::RuntimeArray::RuntimeArray):
+ * bridge/runtime_method.cpp:
+ (JSC::RuntimeMethod::RuntimeMethod):
+ * bridge/runtime_object.cpp:
+ (JSC::RuntimeObjectImp::RuntimeObjectImp):
+
+2009-07-10 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Antti Koivisto.
+
+ Add delegate methods about focus and blur and state change
+ https://bugs.webkit.org/show_bug.cgi?id=27153
+
+ Call the appropriate new ChromeClient methods for focus and blur.
+
+ * html/HTMLFormControlElement.cpp:
+ (WebCore::HTMLFormControlElement::dispatchFocusEvent):
+ (WebCore::HTMLFormControlElement::dispatchBlurEvent):
+ * html/HTMLFormControlElement.h:
+ * loader/EmptyClients.h:
+ (WebCore::EmptyChromeClient::formDidFocus):
+ (WebCore::EmptyChromeClient::formDidBlur):
+ * page/ChromeClient.h:
+
+2009-07-10 Steve Falkenburg <sfalken@apple.com>
+
+ <rdar://problem/7048741> REGRESSION: Error about missing SwMenuX.dll opening pages with Shockwave
+
+ Use altered search path while loading plug-ins. This modifies the DLL search order
+ to look in the directory containing the plug-in even if a call to SetDllDirectory
+ was previously made. Use of SetDllDirectory removes the current directory from the search path,
+ breaking the previous strategy for locating any dependent DLLs of the plug-in.
+
+ Reviewed by Jon Honeycutt.
+
+ * plugins/win/PluginPackageWin.cpp:
+ (WebCore::PluginPackage::load): Use LoadLibraryEx with LOAD_WITH_ALTERED_SEARCH_PATH
+
+2009-07-10 Adam Roben <aroben@apple.com>
+
+ Sort all our Xcode projects
+
+ Accomplished using sort-Xcode-project-file.
+
+ Requested by Dave Kilzer.
+
+ * WebCore.xcodeproj/project.pbxproj:
+
+2009-07-10 Adam Langley <agl@google.com>
+
+ Reviewed by Darin Fisher.
+
+ Chromium Linux: use disabled images for disabled widgets.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27106
+
+ Previously, checkboxes and radio controls rendered the same even if disabled.
+ The Chromium side of this change is r20224.
+
+ * rendering/RenderThemeChromiumSkia.cpp:
+ (WebCore::RenderThemeChromiumSkia::paintCheckbox):
+ (WebCore::RenderThemeChromiumSkia::paintRadio):
+
+2009-07-10 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by John Sullivan.
+
+ Fix crash when changing the zoom level in http://iphone.akamai.com/
+ <rdar://problem/7029077>
+
+ RenderLayerBacking's paintIntoLayer() method called updateLayerListsIfNeeded(),
+ which could potentially destroy that compositing layer, causing a crash.
+ Prevent this from happening by not doing a compositing update from paintIntoLayer().
+
+ The existing updateLayerListsIfNeeded() was renamed to updateCompositingAndLayerListsIfNeeded(),
+ and still does the compositing update. The new updateLayerListsIfNeeded() does not touch
+ compositing layers, and is still called from paintIntoLayer().
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::paintLayer):
+ (WebCore::RenderLayer::hitTestLayer):
+ (WebCore::RenderLayer::updateLayerListsIfNeeded):
+ (WebCore::RenderLayer::updateCompositingAndLayerListsIfNeeded):
+ * rendering/RenderLayer.h:
+
+2009-07-10 Drew Wilson <atwilson@google.com>
+
+ Reviewed by Darin Adler.
+
+ Need to remove UsesManualToJSImplementation() in favor of CustomToJS.
+ https://bugs.webkit.org/show_bug.cgi?id=27010
+
+ Added support for CustomToJS IDL attribute to replace the hard-coded class list in UsesManualToJSImplementation().
+
+ This is just a cleanup of existing functionality, so existing LayoutTests adequately cover this patch.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ Removed UsesManualToJSImplementation(), added support for CustomToJS attribute.
+ * css/CSSRule.idl:
+ * css/CSSValue.idl:
+ * css/StyleSheet.idl:
+ * dom/Document.idl:
+ * dom/Event.idl:
+ * dom/Node.idl:
+ * html/ImageData.idl:
+ * svg/SVGElementInstance.idl:
+ * svg/SVGPathSeg.idl:
+ Added CustomToJS attribute to all the above IDL files.
+
+2009-07-10 Dan Bernstein <mitz@apple.com>
+
+ - fix the build by reverting the ill-advised r45711
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scrollToAnchor):
+
+2009-07-09 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Updated WebCore.base.exp to add some needed functions.
+
+ * WebCore.base.exp:
+
+2009-07-10 Dan Bernstein <mitz@apple.com>
+
+ - address a review comment from Simon Fraser which I forgot to include
+ in the last check-in
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scrollToAnchor): Pass true to getRect() for
+ maximum transform friendliness!
+
+2009-07-10 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=27137
+ <rdar://problem/7043124> REGRESSION (r44311): Reproducible crash due
+ to infinite recursion into FrameLoader::gotoAnchor() ->
+ FrameView::layout()
+
+ Test: fast/loader/goto-anchor-infinite-layout.html
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::gotoAnchor): Moved the code to update layout,
+ find the renderer to scroll to, and scroll from here to methods on
+ FrameView, and replaced it with a call to
+ FrameView::maintainScrollPositionAtAnchor().
+ (WebCore::FrameLoader::completed): Call maintainScrollPositionAtAnchor()
+ instead of setLockedToAnchor().
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::FrameView): Removed initialization of
+ m_lockedToAnchor.
+ (WebCore::FrameView::reset): Reset m_maintainScrollPositionAnchor instead
+ of m_lockedToAnchor.
+ (WebCore::FrameView::layout): Removed the code related to scrolling to
+ the anchor from here, because scrolling can trigger events which
+ invalidate the layout, and as such, belongs with the post-layout tasks.
+ (WebCore::FrameView::maintainScrollPositionAtAnchor): Added. When called
+ with a node scrolls the view to the top of that node and maintains it
+ scrolled to the top of the node during subsequent layouts, until
+ this function is called with 0 or other things trigger scrolling.
+ (WebCore::FrameView::scrollRectIntoViewRecursively): Reset
+ m_maintainScrollPositionAnchor.
+ (WebCore::FrameView::setScrollPosition): Ditto.
+ (WebCore::FrameView::scrollToAnchor): Added. Scrolls to the top of
+ m_maintainScrollPositionAnchor, if it is set.
+ (WebCore::FrameView::performPostLayoutTasks): Call scrollToAnchor().
+ (WebCore::FrameView::setWasScrolledByUser): Reset
+ m_maintainScrollPositionAnchor.
+
+ * page/FrameView.h: Removed lockedToAnchor(), setLockedToAnchor(),
+ and m_lockedToAnchor. Added maintainScrollPositionAtAnchor() and
+ m_maintainScrollPositionAnchor.
+
+2009-07-04 Sriram Yadavalli <sriram.yadavalli@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26439
+
+ QtWebKit fails in loading www.nytimes.com in Windows/Linux
+
+ QNetworkReplyHandler is ignoring content associated with 401 error.
+ This causes the XHR response handling to fail.
+
+ Simon: Added also ProxyAuthenticationRequiredError, to handle the same
+ case when going through proxies, as suggested by Prasanth.
+
+ * platform/network/qt/QNetworkReplyHandler.cpp:
+ (WebCore::QNetworkReplyHandler::finish):
+
+2009-07-10 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ Enable HTML 5 Messaging to fix message channel Qt DRT failures in
+ fast/events.
+
+ * WebCore.pro:
+
+2009-07-09 Roland Steiner <rolandsteiner@google.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ added InlineBox::isLeaf()
+ firstLeafChild()/lastLeafChild() not virtual and not callable on InlineBox anymore.
+ firstLeafChild()/lastLeafChild() will no longer return a node outside of the given subtree.
+ Removed firstLeafChildAfterBox()/lastLeafChildBeforeBox()
+ Removed potentially quadratic behavior if all nodes before/after a given box are empty InlineFlowBoxes
+
+ Currently, these methods are called on RootInlineBox objects only, so above changes should not have
+ any observable effect (only the removal of the square performance behavior could apply,
+ but the conditions for that are probably of a rather theoretical nature).
+
+ * rendering/InlineBox.cpp:
+ (WebCore::InlineBox::nextLeafChild):
+ (WebCore::InlineBox::prevLeafChild):
+ * rendering/InlineBox.h:
+ (WebCore::InlineBox::isLeaf):
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::firstLeafChild):
+ (WebCore::InlineFlowBox::lastLeafChild):
+ * rendering/InlineFlowBox.h:
+ (WebCore::InlineFlowBox::firstChild):
+ (WebCore::InlineFlowBox::lastChild):
+ (WebCore::InlineFlowBox::isLeaf):
+ * rendering/RootInlineBox.cpp:
+ (WebCore::RootInlineBox::closestLeafChildForXPos):
+
+2009-07-09 Roland Steiner <rolandsteiner@google.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Added InlineBox::baselinePosition() and lineHeight() methods
+ (adapted remaining code accordingly to use those methods)
+
+ No change in functionality.
+
+ * rendering/InlineBox.h:
+ (WebCore::InlineBox::baselinePosition):
+ (WebCore::InlineBox::lineHeight):
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::adjustMaxAscentAndDescent):
+ (WebCore::InlineFlowBox::computeLogicalBoxHeights):
+ (WebCore::InlineFlowBox::placeBoxesVertically):
+
+2009-07-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 27142 - canPlayType() should return empty string for unsupported content
+ <https://bugs.webkit.org/show_bug.cgi?id=27142>
+
+ Return "" instead of "no" for unsupport media types.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::canPlayType):
+
+2009-07-09 Roland Steiner <rolandsteiner@google.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Implement the part of HTML5 spec that deals with parsing of <rp> and <rt> tags
+ in that their end tags are optional if followed by <rp>/<rt>.
+
+ Also specify a new accessibility role "annotation" for <rp> and <rt>.
+
+ Affected code parts are not enclosed in #IF ENABLE(RUBY), since the parsing
+ is not affected by whether ruby is rendered properly or not (in fact, it may
+ be more profound without ruby layouting, since the contents of <rp> are not hidden).
+
+ Test: fast/ruby/parse-rp.html
+
+ * accessibility/AccessibilityObject.h:
+ (WebCore::):
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::roleValue):
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::endTagRequirement):
+ (WebCore::HTMLElement::tagPriority):
+ (WebCore::inlineTagList):
+ * html/HTMLParser.cpp:
+ (WebCore::HTMLParser::rpCreateErrorCheck):
+ (WebCore::HTMLParser::rtCreateErrorCheck):
+ (WebCore::HTMLParser::getNode):
+ * html/HTMLParser.h:
+ * html/HTMLTagNames.in:
+
+2009-07-09 Dmitry Titov <dimich@chromium.org>
+
+ Not reviewed, fix for previous commit.
+
+ The change http://trac.webkit.org/changeset/45695 did not correctly
+ enabled GTL and QT build flags. This caused layout tests failure.
+ This is speculative fix for those failures.
+
+ * GNUmakefile.am: added ENABLE_CHANNEL_MESSAGING flag.
+ * WebCore.pro: ditto.
+ * page/DOMWindow.idl: touched to cause recompile.
+ * workers/WorkerContext.idl: ditto.
+
+2009-07-09 Drew Wilson <atwilson@google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26903
+
+ Turned on CHANNEL_MESSAGING by default because the MessageChannel API
+ is now implemented for Web Workers and is reasonably stable.
+
+ Tests: fast/events/message-channel-gc-2.html
+ fast/events/message-channel-gc-3.html
+ fast/events/message-channel-gc-4.html
+ fast/events/message-channel-gc.html
+ fast/events/message-channel-listener-circular-ownership.html
+ fast/events/message-port-clone.html
+ fast/events/message-port-constructor-for-deleted-document.html
+ fast/events/message-port-deleted-document.html
+ fast/events/message-port-deleted-frame.html
+ fast/events/message-port-inactive-document.html
+ fast/events/message-port-no-wrapper.html
+ fast/events/message-port.html
+ fast/workers/worker-cloneport.html
+ fast/workers/worker-messageport-gc.html
+ fast/workers/worker-messageport.html
+
+ * Configurations/FeatureDefines.xcconfig: Turned on ENABLE_CHANNEL_MESSAGING.
+ * WebCore/WebCore.vcproj/WebCoreCommon.vsprops: ditto.
+ * WebCore/WebCore.vcproj/build-generated-files.sh: ditto.
+ * WebCore/page/DOMWindow.idl: touch the file to cause re-generation of headers.
+ * WebCore/workers/WorkerContext.idl: ditto.
+
+
+2009-07-09 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Full page zoom breaks remaining and elapsed time display in the <video> controller.
+ https://bugs.webkit.org/show_bug.cgi?id=27123
+
+ We are changing the size of the time remaining and time elapsed field, to
+ automatically hide them, when the controller is too short.
+
+ Because we toggle the size between 0 and the previous value of the
+ controller, we miss any width change that may occur during full page zoom,
+ and we fail to restore a correct width.
+
+ This change fixes that problem by using a cloned style on which we
+ set the width to 0, and restoring the previous style when going back to
+ the normal width.
+
+ We take care about properly using the cloned style or the pseudo style,
+ by overriding styleForElement().
+
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlElement::styleForElement):
+ (WebCore::MediaControlElement::attach):
+ (WebCore::MediaControlElement::updateStyle):
+ (WebCore::MediaControlInputElement::styleForElement):
+ (WebCore::MediaControlInputElement::attach):
+ (WebCore::MediaControlInputElement::updateStyle):
+ (WebCore::MediaControlTimeDisplayElement::MediaControlTimeDisplayElement):
+ (WebCore::MediaControlTimeDisplayElement::styleForElement):
+ (WebCore::MediaControlTimeDisplayElement::setVisible):
+ * rendering/MediaControlElements.h:
+ * rendering/RenderMedia.cpp:
+ (WebCore::RenderMedia::shouldShowTimeDisplayControls): Make sure
+ we take in account the zoom level when deciding if we should hide the
+ ellapsed and remaining time.
+
+2009-07-09 Michael Nordman <michaeln@google.com>
+
+ Reviewed by Darin Adler.
+
+ Fix chromium build bustage due to Widget being a RefCounted class.
+ https://bugs.webkit.org/show_bug.cgi?id=27139
+
+ * platform/chromium/PopupMenuChromium.cpp:
+ * platform/chromium/PopupMenuChromium.h:
+
+2009-07-09 Chris Fleizach <cfleizach@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 27130 - Need to implement ARIA role="toolbar"
+ https://bugs.webkit.org/show_bug.cgi?id=27130
+
+ Test: platform/mac/accessibility/aria-toolbar.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::RoleEntry::):
+ * accessibility/mac/AccessibilityObjectWrapper.mm:
+ (-[AccessibilityObjectWrapper roleDescription]):
+
+2009-07-09 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Upstream WebCore.gypi, the project file for Chromium build.
+ https://bugs.webkit.org/show_bug.cgi?id=27135
+
+ * WebCore.gypi: Added.
+
+2009-07-09 Jon Honeycutt <jhoneycutt@apple.com>
+
+ A more robust fix for <rdar://problem/6930280> Reproducible crash at
+ USA Today photo gallery
+
+ Reviewed by Steve Falkenburg.
+
+ * plugins/win/PluginMessageThrottlerWin.cpp:
+ (WebCore::PluginMessageThrottlerWin::messageThrottleTimerFired):
+ Protect the PluginView from destruction before calling its window proc.
+
+2009-07-09 Jon Honeycutt <jhoneycutt@apple.com>
+
+ <rdar://problem/6978804> WER #16: Repro Access Violation in
+ WebCore::PluginView::bindingInstance (1310178023)
+
+ Reviewed by Darin Adler.
+
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::bindingInstance):
+ Protect the PluginView from destruction before calling NPN_GetValue. If
+ the renderer for the PluginView was destroyed during the call, and the
+ PluginView's ref count is now 1, return null.
+
+2009-07-09 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Speculative fix for <rdar://problem/6991251> WER #13: Crash in
+ WebKit!WebCore::PluginView::performRequest+203 (1311461169)
+
+ Reviewed by Darin Adler.
+
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::performRequest):
+ Protect the PluginView from destruction before performing a load.
+ Removed some trailing whitespace.
+
+2009-07-09 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Build fix.
+
+ * inspector/JavaScriptDebugServer.cpp:
+ (WebCore::JavaScriptDebugServer::setJavaScriptPaused):
+
+2009-07-09 Beth Dakin and Jon Honeycutt <bdakin@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Make Widget RefCounted to fix or make fixable:
+
+ <rdar://problem/7038831> REGRESSION (TOT): In Mail, a crash occurs
+ at WebCore::Widget::afterMouseDown() after clicking To Do's close
+ box
+ <rdar://problem/6978804> WER #16: Repro Access Violation in
+ WebCore::PluginView::bindingInstance (1310178023)
+ -and-
+ <rdar://problem/6991251> WER #13: Crash in WebKit!
+ WebCore::PluginView::performRequest+203 (1311461169)
+
+ * loader/EmptyClients.h:
+ (WebCore::EmptyFrameLoaderClient::createPlugin):
+ Changed to return PassRefPtr
+ (WebCore::EmptyFrameLoaderClient::createJavaAppletWidget):
+ Ditto.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadSubframe):
+ (WebCore::FrameLoader::loadPlugin):
+ Make the widget variable a RefPtr. Use .get() when passing it to
+ RenderPart::setWidget().
+ (WebCore::FrameLoader::createJavaAppletWidget):
+ Make the widget variable a RefPtr.
+
+ * loader/FrameLoader.h:
+ Changed the return type of createJavaAppletWidget().
+
+ * loader/FrameLoaderClient.h:
+ Change the return types of createPlugin() and
+ createJavaAppletWidget().
+
+ * page/Frame.cpp:
+ (WebCore::Frame::createView):
+ No need to call .get() since setWidget() takes a RefPtr.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::layoutIfNeededRecursive):
+ children() now returns a HashSet of RefPtrs.
+
+ * page/FrameView.h:
+ Remove inheritance from RefCounted; we pick this up from ScrollView
+ through Widget.
+
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::addChild):
+ addChild() now takes a PassRefPtr and m_children now keeps a
+ HashSet of RefPtrs.
+
+ * platform/ScrollView.h:
+ ScrollView constructor is now protected.
+ (WebCore::ScrollView::children):
+ m_children is now a HashSet of RefPtrs.
+
+ * platform/Scrollbar.h:
+ Remove inheritance from RefCounted; we pick this up from ScrollView
+ through Widget.
+
+ * platform/Widget.h:
+ Inherit from RefCounted. Cleaned up some whitespace. Make m_widget
+ a RefPtr.
+
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::create):
+ Adopt the PluginView when returning it.
+
+ * plugins/PluginView.h:
+ Changed create() to return a PassRefPtr.
+
+ * rendering/RenderApplet.cpp:
+ Receive result in a RefPtr when calling createJavaAppletWidget().
+
+ * rendering/RenderPart.cpp:
+ (WebCore::RenderPart::setWidget):
+ setWidget() now takes a PassRefPtr. Also removed the manual ref of
+ FrameViews. This is handled by having m_widget be a RefPtr. Removed
+ deleteWidget().
+
+ * rendering/RenderPart.h:
+ Removed override of deleteWidget().
+
+ * rendering/RenderWidget.cpp:
+ (WebCore::RenderWidget::destroy):
+ (WebCore::RenderWidget::setWidget):
+ (WebCore::RenderWidget::paint):
+ (WebCore::RenderWidget::setOverlapTestResult):
+ (WebCore::RenderWidget::updateWidgetPosition):
+ Use .get().
+ (WebCore::RenderWidget::clearWidget):
+ Don't call deleteWidget(). It was removed.
+
+ * rendering/RenderWidget.h:
+ Removed deleteWidget(). Made m_widget a RefPtr.
+ (WebCore::RenderWidget::widget):
+ Use .get().
+
+2009-07-09 Chris Fleizach <cfleizach@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 27129 - AX: possible assertion for a non-native image in accessibility
+ https://bugs.webkit.org/show_bug.cgi?id=27129
+
+ It's possible for an image that is not really an image to assert, because its renderer
+ is turned into a RenderImage.
+
+ Test: accessibility/non-native-image-crash.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::accessibilityIsIgnored):
+ (WebCore::RoleEntry::):
+ * accessibility/mac/AccessibilityObjectWrapper.mm:
+ (-[AccessibilityObjectWrapper roleDescription]):
+
+2009-07-09 Simon Fraser <simon.fraser@apple.com>
+
+ Build fix for SnowLeopard.
+
+ Avoid using the contentsTransform methods if not on Leopard, because
+ we don't need to call them.
+
+ * platform/graphics/mac/GraphicsLayerCA.mm:
+ (WebCore::GraphicsLayerCA::updateContentsTransform):
+ * platform/graphics/mac/WebLayer.mm:
+ (-[WebLayer setNeedsDisplayInRect:]):
+ * platform/graphics/mac/WebTiledLayer.mm:
+ (-[WebTiledLayer setNeedsDisplayInRect:]):
+
+2009-07-09 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dave Hyatt
+
+ Improve the appearance of text in compositing layers when -[CALayer geometryFlipped]
+ is not available.
+ <rdar://problem/6120614>
+
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::setContentsOrientation):
+ (WebCore::GraphicsLayer::contentsOrientation):
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::GraphicsLayer):
+ Add a m_contentsOrientation member and getter/setter to control whether
+ the contents of this layer have a transform applied to them before display.
+
+ * platform/graphics/mac/GraphicsLayerCA.h:
+ New method to return the default contents orientation.
+
+ * platform/graphics/mac/GraphicsLayerCA.mm:
+ (WebCore::flipTransform):
+ Convenience method to return a transform with a Y flip.
+
+ (WebCore::GraphicsLayerCA::GraphicsLayerCA):
+ (WebCore::GraphicsLayerCA::setSize):
+ After the size changes we have to update the contentsTransform.
+
+ (WebCore::GraphicsLayerCA::setGeometryOrientation):
+ (WebCore::GraphicsLayerCA::geometryOrientation):
+ If -setGeometryFlipped: is not available, use a children transform.
+
+ (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
+ Tiled layers have issues with flipped contentsTransform, so just use
+ top-down drawing for them. Call updateContentsTransform() to set the
+ new contents transform after swapping layers.
+
+ (WebCore::GraphicsLayerCA::defaultContentsOrientation):
+ Use bottom-up when -geometryFlipped is not available, otherwise top-down.
+
+ (WebCore::GraphicsLayerCA::updateContentsTransform):
+ Set the layer contents transform based on contentsOrientation().
+
+ (WebCore::GraphicsLayerCA::setContentsLayer):
+ We have to manually flip contents layers if we're not using -geometryFlipped.
+
+ * platform/graphics/mac/WebLayer.h:
+ * platform/graphics/mac/WebLayer.mm:
+ Do early return if layerContents is nil. Flip the CTM if the layer has
+ bottom-up coordinates, so that CG sees a CTM with no flip.
+ Do the CGContextRestoreGState() after drawing the debug indicator.
+
+ (-[WebLayer setNeedsDisplayInRect:]):
+ * platform/graphics/mac/WebTiledLayer.mm:
+ (-[WebTiledLayer setNeedsDisplayInRect:]):
+ Need to map the dirty rect through the contentsTransform.
+
+2009-07-09 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/6921671> Visit counter shouldn't be incremented by redirects.
+
+ Can't test this functionality with layout tests.
+
+ * WebCore.base.exp:
+ * history/HistoryItem.cpp:
+ (WebCore::HistoryItem::recordVisitAtTime):
+ (WebCore::HistoryItem::visited):
+ * history/HistoryItem.h:
+ Only increase visit count if explicitly told to. Now, some visits change last access time,
+ but do not increase visit count.
+
+2009-07-09 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/7046098> MediaControllerThemeQT requires QuickTime 7.6.3
+
+ Require QuickTime 7.6.3 or higher to enable the new media controller UI.
+
+ * rendering/RenderThemeMac.mm:
+ (WebCore::mediaControllerTheme):
+
+2009-07-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Beth Dakin.
+
+ Remove incorrect comment.
+
+ * page/MouseEventWithHitTestResults.h:
+
+2009-07-09 Mads Ager <ager@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Update the V8 bindings codegenerator to use the RGBColor::create
+ method to handle refcounts for RGBColor objects correctly.
+
+ * bindings/scripts/CodeGeneratorV8.pm: Use RGBColor::create to create RGBColor objects.
+
+2009-07-09 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Crash in RenderMedia::styleDidChange.
+ <rdar://problem/7044313> CrashTracer: quicklook crashed generating thumbnail for page with
+ media element (RenderMedia::styleDidChange + 115)
+
+ Speculative fix for crash in styleDidChange. Null check controller elements before tell
+ them to update style.
+
+ * rendering/RenderMedia.cpp:
+ (WebCore::RenderMedia::styleDidChange):
+
+2009-07-09 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [V8] Move V8DOMWrapper to its own file
+ https://bugs.webkit.org/show_bug.cgi?id=27121
+
+ * bindings/v8/V8DOMWrapper.cpp: Added.
+ (WebCore::GetToStringName):
+ (WebCore::ConstructorToString):
+ (WebCore::V8DOMWrapper::convertSVGElementInstanceToV8Object):
+ (WebCore::V8DOMWrapper::convertSVGObjectWithContextToV8Object):
+ (WebCore::V8DOMWrapper::domObjectHasJSWrapper):
+ (WebCore::V8DOMWrapper::setJSWrapperForDOMObject):
+ (WebCore::V8DOMWrapper::setJSWrapperForActiveDOMObject):
+ (WebCore::V8DOMWrapper::setJSWrapperForDOMNode):
+ (WebCore::V8DOMWrapper::getTemplate):
+ (WebCore::V8DOMWrapper::convertToV8Object):
+ (WebCore::V8DOMWrapper::setHiddenWindowReference):
+ (WebCore::V8DOMWrapper::domWrapperType):
+ (WebCore::V8DOMWrapper::convertToNativeObjectImpl):
+ (WebCore::V8DOMWrapper::convertToSVGPODTypeImpl):
+ (WebCore::V8DOMWrapper::lookupDOMWrapper):
+ (WebCore::V8DOMWrapper::convertDOMWrapperToNodeHelper):
+ (WebCore::V8DOMWrapper::wrapNativeNodeFilter):
+ (WebCore::V8DOMWrapper::instantiateV8Object):
+ (WebCore::V8DOMWrapper::setDOMWrapper):
+ (WebCore::V8DOMWrapper::maybeDOMWrapper):
+ (WebCore::V8DOMWrapper::isDOMEventWrapper):
+ (WebCore::V8DOMWrapper::isWrapperOfType):
+ (WebCore::V8DOMWrapper::htmlElementType):
+ (WebCore::V8DOMWrapper::svgElementType):
+ (WebCore::V8DOMWrapper::convertEventToV8Object):
+ (WebCore::):
+ (WebCore::V8DOMWrapper::convertNodeToV8Object):
+ (WebCore::V8DOMWrapper::convertEventTargetToV8Object):
+ (WebCore::V8DOMWrapper::convertEventListenerToV8Object):
+ (WebCore::V8DOMWrapper::convertDOMImplementationToV8Object):
+ (WebCore::V8DOMWrapper::convertStyleSheetToV8Object):
+ (WebCore::V8DOMWrapper::convertCSSValueToV8Object):
+ (WebCore::V8DOMWrapper::convertCSSRuleToV8Object):
+ (WebCore::V8DOMWrapper::convertWindowToV8Object):
+ * bindings/v8/V8DOMWrapper.h: Added.
+ (WebCore::V8DOMWrapper::convertDOMWrapperToNative):
+ (WebCore::V8DOMWrapper::wrapCPointer):
+ (WebCore::V8DOMWrapper::extractCPointer):
+ (WebCore::V8DOMWrapper::convertDOMWrapperToNode):
+ (WebCore::V8DOMWrapper::convertToV8Object):
+ (WebCore::V8DOMWrapper::convertToNativeObject):
+ (WebCore::V8DOMWrapper::convertToNativeEvent):
+ (WebCore::V8DOMWrapper::extractCPointerImpl):
+ (WebCore::V8DOMWrapper::instantiateV8Object):
+ * bindings/v8/V8Proxy.cpp:
+ * bindings/v8/V8Proxy.h:
+
+2009-07-09 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Crash in setFocusedFrame.
+ <rdar://7032869> Crashing in setFocusedFrame on blogger.com.
+
+ Speculative fix for crasher in setFocusedFrame. Make sure to ref both frames and fire
+ the events only after the local member has been updated.
+
+ * page/FocusController.cpp:
+ (WebCore::FocusController::setFocusedFrame):
+
+2009-07-09 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Possible crashes when mouse clicks not dispatched because range input destroyed while
+ thumb is being dragged (e.g. scrub to end of movie)
+ <rdar://problem/7037494>
+ https://bugs.webkit.org/show_bug.cgi?id=27101
+
+ Some shadow nodes "capture" all mouse events from mouseDown to mouseUp so they continue to
+ get mouse events even when the mouse is moved outside of the node. This is done by putting
+ EventHandler into a mode where it sends all mouse events to the node regardless of the
+ actual mouse position. The mode is set on mouseDown and cleared on mouseUp but if the
+ node is deleted while in this mode, the mouseUp is never sent and EventHandler continues
+ to try to send events to the deleted node. This sometimes results in a crash, and sometimes
+ in a page that doesn't respond to click events.
+
+ Tests: fast/forms/search-delete-while-cancel-button-clicked.html
+ fast/forms/slider-delete-while-dragging-thumb.html
+ media/audio-delete-while-slider-thumb-clicked.html
+ media/audio-delete-while-step-button-clicked.html
+
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlSeekButtonElement::detach):
+ New, call setCapturingMouseEventsNode if capturing mouse events.
+ * rendering/MediaControlElements.h:
+ Declare detach().
+
+ * rendering/RenderSlider.cpp:
+ (WebCore::SliderThumbElement::detach):
+ New, call setCapturingMouseEventsNode if capturing mouse events.
+
+ * rendering/TextControlInnerElements.cpp:
+ (WebCore::SearchFieldCancelButtonElement::detach):
+ New, call setCapturingMouseEventsNode if capturing mouse events.
+ * rendering/TextControlInnerElements.h:
+ Declare detach().
+
+2009-07-09 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Enter the Frame's context before creating new objects in setContextDebugId.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27112
+
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::setContextDebugId):
+
+2009-07-09 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the Qt build.
+
+ * WebCore.pro: Add new storage impl files to the build.
+
+2009-07-08 Adam Barth <abarth@webkit.org>
+
+ Rubber stamped by Eric Seidel.
+
+ [V8] Move DOM wrapper functions in V8Proxy to V8DOMWrapper
+ https://bugs.webkit.org/show_bug.cgi?id=27107
+
+ This patch is just renaming. Code motion will occur next.
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::processingUserGesture):
+ (WebCore::createScriptObject):
+ (WebCore::ScriptController::createScriptObjectForPluginElement):
+ * bindings/v8/ScriptObject.cpp:
+ (WebCore::ScriptGlobalObject::set):
+ * bindings/v8/ScriptObjectQuarantine.cpp:
+ (WebCore::getQuarantinedScriptObject):
+ * bindings/v8/V8AbstractEventListener.cpp:
+ (WebCore::V8AbstractEventListener::handleEvent):
+ (WebCore::V8AbstractEventListener::getReceiverObject):
+ * bindings/v8/V8Collection.cpp:
+ (WebCore::toOptionsCollectionSetter):
+ * bindings/v8/V8Collection.h:
+ (WebCore::getV8Object):
+ (WebCore::getNamedPropertyOfCollection):
+ (WebCore::nodeCollectionNamedPropertyGetter):
+ (WebCore::getIndexedPropertyOfCollection):
+ (WebCore::nodeCollectionIndexedPropertyGetter):
+ (WebCore::nodeCollectionIndexedPropertyEnumerator):
+ (WebCore::collectionIndexedPropertyEnumerator):
+ (WebCore::collectionStringOrNullIndexedPropertyGetter):
+ * bindings/v8/V8DOMMap.cpp:
+ (WebCore::DOMData::handleWeakObject):
+ (WebCore::DOMData::removeObjectsFromWrapperMap):
+ * bindings/v8/V8GCController.cpp:
+ (WebCore::enumerateDOMObjectMap):
+ (WebCore::DOMObjectVisitor::visitDOMWrapper):
+ (WebCore::GCPrologueVisitor::visitDOMWrapper):
+ (WebCore::GCEpilogueVisitor::visitDOMWrapper):
+ * bindings/v8/V8Helpers.cpp:
+ (WebCore::wrapNPObject):
+ * bindings/v8/V8NodeFilterCondition.cpp:
+ (WebCore::V8NodeFilterCondition::acceptNode):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8DOMWrapper::convertSVGElementInstanceToV8Object):
+ (WebCore::V8DOMWrapper::convertSVGObjectWithContextToV8Object):
+ (WebCore::V8DOMWrapper::domObjectHasJSWrapper):
+ (WebCore::V8DOMWrapper::setJSWrapperForDOMObject):
+ (WebCore::V8DOMWrapper::setJSWrapperForActiveDOMObject):
+ (WebCore::V8DOMWrapper::setJSWrapperForDOMNode):
+ (WebCore::V8Proxy::evaluateInNewContext):
+ (WebCore::V8Proxy::getConstructor):
+ (WebCore::V8DOMWrapper::getTemplate):
+ (WebCore::V8Proxy::retrieveWindow):
+ (WebCore::V8Proxy::updateDocumentWrapperCache):
+ (WebCore::V8Proxy::clearForNavigation):
+ (WebCore::V8Proxy::installDOMWindow):
+ (WebCore::setDOMExceptionHelper):
+ (WebCore::V8DOMWrapper::convertToV8Object):
+ (WebCore::V8DOMWrapper::setHiddenWindowReference):
+ (WebCore::V8DOMWrapper::domWrapperType):
+ (WebCore::V8DOMWrapper::convertToNativeObjectImpl):
+ (WebCore::V8DOMWrapper::convertToSVGPODTypeImpl):
+ (WebCore::V8DOMWrapper::lookupDOMWrapper):
+ (WebCore::V8DOMWrapper::convertDOMWrapperToNodeHelper):
+ (WebCore::V8DOMWrapper::wrapNativeNodeFilter):
+ (WebCore::V8DOMWrapper::instantiateV8Object):
+ (WebCore::V8DOMWrapper::setDOMWrapper):
+ (WebCore::V8DOMWrapper::maybeDOMWrapper):
+ (WebCore::V8DOMWrapper::isDOMEventWrapper):
+ (WebCore::V8DOMWrapper::isWrapperOfType):
+ (WebCore::V8DOMWrapper::htmlElementType):
+ (WebCore::V8DOMWrapper::svgElementType):
+ (WebCore::V8DOMWrapper::convertEventToV8Object):
+ (WebCore::V8DOMWrapper::convertNodeToV8Object):
+ (WebCore::V8DOMWrapper::convertEventTargetToV8Object):
+ (WebCore::V8DOMWrapper::convertEventListenerToV8Object):
+ (WebCore::V8DOMWrapper::convertDOMImplementationToV8Object):
+ (WebCore::V8DOMWrapper::convertStyleSheetToV8Object):
+ (WebCore::V8DOMWrapper::convertCSSValueToV8Object):
+ (WebCore::V8DOMWrapper::convertCSSRuleToV8Object):
+ (WebCore::V8DOMWrapper::convertWindowToV8Object):
+ (WebCore::V8Proxy::bindJsObjectToWindow):
+ * bindings/v8/V8Proxy.h:
+ (WebCore::V8DOMWrapper::convertDOMWrapperToNative):
+ (WebCore::V8DOMWrapper::wrapCPointer):
+ (WebCore::V8DOMWrapper::extractCPointer):
+ (WebCore::V8DOMWrapper::convertDOMWrapperToNode):
+ (WebCore::V8DOMWrapper::convertToV8Object):
+ (WebCore::V8DOMWrapper::convertToNativeObject):
+ (WebCore::V8DOMWrapper::convertToNativeEvent):
+ (WebCore::V8DOMWrapper::extractCPointerImpl):
+ (WebCore::V8DOMWrapper::instantiateV8Object):
+ (WebCore::V8Proxy::constructDOMObject):
+ (WebCore::toV8):
+ * bindings/v8/V8SVGPODTypeWrapper.h:
+ (WebCore::V8SVGPODTypeUtil::toSVGPODType):
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ (WebCore::WorkerContextExecutionProxy::retrieve):
+ (WebCore::WorkerContextExecutionProxy::initContextIfNeeded):
+ (WebCore::WorkerContextExecutionProxy::GetConstructor):
+ (WebCore::WorkerContextExecutionProxy::ToV8Object):
+ (WebCore::WorkerContextExecutionProxy::EventToV8Object):
+ (WebCore::WorkerContextExecutionProxy::toV8):
+ * bindings/v8/custom/V8AttrCustom.cpp:
+ (WebCore::ACCESSOR_SETTER):
+ * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
+ (WebCore::NAMED_PROPERTY_GETTER):
+ (WebCore::NAMED_PROPERTY_SETTER):
+ * bindings/v8/custom/V8CanvasPixelArrayCustom.cpp:
+ (WebCore::INDEXED_PROPERTY_GETTER):
+ (WebCore::INDEXED_PROPERTY_SETTER):
+ * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
+ (WebCore::toV8):
+ (WebCore::toCanvasStyle):
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8ClientRectListCustom.cpp:
+ (WebCore::INDEXED_PROPERTY_GETTER):
+ * bindings/v8/custom/V8ClipboardCustom.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8CustomBinding.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::INDEXED_ACCESS_CHECK):
+ (WebCore::NAMED_ACCESS_CHECK):
+ (WebCore::V8Custom::GetTargetFrame):
+ * bindings/v8/custom/V8CustomSQLStatementCallback.cpp:
+ (WebCore::V8CustomSQLStatementCallback::handleEvent):
+ * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:
+ (WebCore::V8CustomSQLStatementErrorCallback::handleEvent):
+ * bindings/v8/custom/V8CustomSQLTransactionCallback.cpp:
+ (WebCore::V8CustomSQLTransactionCallback::handleEvent):
+ * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp:
+ (WebCore::V8CustomSQLTransactionErrorCallback::handleEvent):
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::V8Custom::WindowSetTimeoutImpl):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::INDEXED_PROPERTY_GETTER):
+ (WebCore::NAMED_PROPERTY_GETTER):
+ (WebCore::V8Custom::ClearTimeoutImpl):
+ (WebCore::NAMED_ACCESS_CHECK):
+ (WebCore::INDEXED_ACCESS_CHECK):
+ * bindings/v8/custom/V8DatabaseCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8DocumentCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8DocumentLocationCustom.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ * bindings/v8/custom/V8ElementCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::ACCESSOR_GETTER):
+ * bindings/v8/custom/V8EventCustom.cpp:
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::ACCESSOR_GETTER):
+ * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
+ (WebCore::getNamedItems):
+ (WebCore::getItem):
+ (WebCore::NAMED_PROPERTY_GETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+ (WebCore::NAMED_PROPERTY_GETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ (WebCore::ACCESSOR_GETTER):
+ * bindings/v8/custom/V8HTMLFormElementCustom.cpp:
+ (WebCore::INDEXED_PROPERTY_GETTER):
+ (WebCore::NAMED_PROPERTY_GETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLFrameElementCustom.cpp:
+ (WebCore::ACCESSOR_SETTER):
+ * bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp:
+ (WebCore::NAMED_PROPERTY_GETTER):
+ * bindings/v8/custom/V8HTMLIFrameElementCustom.cpp:
+ (WebCore::ACCESSOR_SETTER):
+ * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLInputElementCustom.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::INDEXED_PROPERTY_GETTER):
+ (WebCore::INDEXED_PROPERTY_SETTER):
+ * bindings/v8/custom/V8HTMLPlugInElementCustom.cpp:
+ (WebCore::NAMED_PROPERTY_GETTER):
+ (WebCore::NAMED_PROPERTY_SETTER):
+ (WebCore::INDEXED_PROPERTY_GETTER):
+ (WebCore::INDEXED_PROPERTY_SETTER):
+ * bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp:
+ (WebCore::NAMED_PROPERTY_GETTER):
+ (WebCore::INDEXED_PROPERTY_SETTER):
+ * bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ (WebCore::removeElement):
+ * bindings/v8/custom/V8InspectorControllerCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8LocationCustom.cpp:
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ (WebCore::INDEXED_ACCESS_CHECK):
+ (WebCore::NAMED_ACCESS_CHECK):
+ * bindings/v8/custom/V8MessageChannelConstructor.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8MessagePortCustom.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8NamedNodeMapCustom.cpp:
+ (WebCore::INDEXED_PROPERTY_GETTER):
+ (WebCore::NAMED_PROPERTY_GETTER):
+ * bindings/v8/custom/V8NavigatorCustom.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ * bindings/v8/custom/V8NodeCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8NodeIteratorCustom.cpp:
+ (WebCore::toV8):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8NodeListCustom.cpp:
+ (WebCore::NAMED_PROPERTY_GETTER):
+ * bindings/v8/custom/V8SQLResultSetRowListCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8SVGElementInstanceCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8SVGLengthCustom.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8SVGMatrixCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8StorageCustom.cpp:
+ (WebCore::V8Custom::v8StorageNamedPropertyEnumerator):
+ (WebCore::storageGetter):
+ (WebCore::storageSetter):
+ (WebCore::storageDeleter):
+ * bindings/v8/custom/V8StyleSheetListCustom.cpp:
+ (WebCore::NAMED_PROPERTY_GETTER):
+ * bindings/v8/custom/V8TreeWalkerCustom.cpp:
+ (WebCore::toV8):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8WorkerContextCustom.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::SetTimeoutOrInterval):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8WorkerCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp:
+ (WebCore::ACCESSOR_GETTER):
+ (WebCore::ACCESSOR_SETTER):
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8XSLTProcessorCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+
+2009-07-08 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Make sure we can click outside the slider thumb and start dragging.
+ https://bugs.webkit.org/show_bug.cgi?id=26229
+
+ Previously we were assuming that if the thumb hasn't been clicked, we
+ wouldn't issue any value change upon dragging.
+
+ We need to handle the two different cases:
+ - Clicked in the thumb, we need to make sure the cursor is always pointing
+ the same slider thumb point.
+ - Clicked outside, the cursor should always be pointing to the center of
+ the thumb.
+
+ For simplicity, we don't remember the original point of the mouse down,
+ but a vector between that point and the thumb.
+
+ * rendering/RenderSlider.cpp:
+ (WebCore::SliderThumbElement::SliderThumbElement):
+ (WebCore::SliderThumbElement::defaultEventHandler):
+ (WebCore::RenderSlider::mouseEventVectorToThumb): Utility function.
+ * rendering/RenderSlider.h:
+
+2009-07-08 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27100
+ <rdar://problem/7042621>
+
+ Don't display "loading" in the <video> controller when
+ there is no src specified.
+
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlStatusDisplayElement::update): The only
+ way to find out if we have an element is currentSrc(). networkState()
+ will always report LOADING according to the spec.
+
+2009-07-08 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ [V8] Move V8GCController functions to their own file
+ https://bugs.webkit.org/show_bug.cgi?id=27102
+
+ * bindings/v8/V8GCController.cpp: Added.
+ * bindings/v8/V8GCController.h: Added.
+ * bindings/v8/V8Proxy.cpp:
+ * bindings/v8/V8Proxy.h:
+
+2009-07-08 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Split StorageArea and StorageNamespace into an interface and implementation.
+ https://bugs.webkit.org/show_bug.cgi?id=27072
+
+ I need to split StorageNamespace and StorageArea into an interface and
+ implementation. In a later patch, I'll implement a proxy interface
+ that'll run inside the Chromium renderer process.
+
+ Additionally, fix the alphabetical ordering of files I recently added
+ in the project files.
+
+ This is a continuation of other refactoring work:
+ https://bugs.webkit.org/show_bug.cgi?id=25376
+
+ * GNUmakefile.am:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * WebCoreSources.bkl:
+ * storage/StorageArea.cpp:
+ (WebCore::StorageArea::create):
+ * storage/StorageArea.h:
+ (WebCore::StorageArea::~StorageArea):
+ * storage/StorageAreaImpl.cpp: Copied from WebCore/storage/StorageArea.cpp.
+ (WebCore::StorageAreaImpl::create):
+ (WebCore::StorageAreaImpl::~StorageAreaImpl):
+ (WebCore::StorageAreaImpl::StorageAreaImpl):
+ (WebCore::StorageAreaImpl::copy):
+ (WebCore::StorageAreaImpl::length):
+ (WebCore::StorageAreaImpl::key):
+ (WebCore::StorageAreaImpl::getItem):
+ (WebCore::StorageAreaImpl::setItem):
+ (WebCore::StorageAreaImpl::removeItem):
+ (WebCore::StorageAreaImpl::clear):
+ (WebCore::StorageAreaImpl::contains):
+ (WebCore::StorageAreaImpl::importItem):
+ (WebCore::StorageAreaImpl::securityOrigin):
+ (WebCore::StorageAreaImpl::close):
+ (WebCore::StorageAreaImpl::blockUntilImportComplete):
+ (WebCore::StorageAreaImpl::dispatchStorageEvent):
+ * storage/StorageAreaImpl.h: Copied from WebCore/storage/StorageArea.h.
+ * storage/StorageAreaSync.h:
+ * storage/StorageNamespace.cpp:
+ (WebCore::StorageNamespace::localStorageNamespace):
+ (WebCore::StorageNamespace::sessionStorageNamespace):
+ * storage/StorageNamespace.h:
+ (WebCore::StorageNamespace::~StorageNamespace):
+ * storage/StorageNamespaceImpl.cpp: Copied from WebCore/storage/StorageNamespace.cpp.
+ (WebCore::StorageNamespaceImpl::localStorageNamespace):
+ (WebCore::StorageNamespaceImpl::sessionStorageNamespace):
+ (WebCore::StorageNamespaceImpl::StorageNamespaceImpl):
+ (WebCore::StorageNamespaceImpl::~StorageNamespaceImpl):
+ (WebCore::StorageNamespaceImpl::copy):
+ (WebCore::StorageNamespaceImpl::storageArea):
+ (WebCore::StorageNamespaceImpl::close):
+ * storage/StorageNamespaceImpl.h: Copied from WebCore/storage/StorageNamespace.h.
+
+2009-07-08 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ [V8] Move garbage collector related functions from V8Proxy to V8GCController
+ https://bugs.webkit.org/show_bug.cgi?id=26967
+
+ This patch just moves the functions around in V8Proxy. We'll actually
+ move them to a separate file in another patch.
+
+ * bindings/v8/NPV8Object.cpp:
+ (freeV8NPObject):
+ * bindings/v8/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::ScheduledAction):
+ (WebCore::ScheduledAction::~ScheduledAction):
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::gcProtectJSWrapper):
+ (WebCore::ScriptController::gcUnprotectJSWrapper):
+ * bindings/v8/ScriptInstance.cpp:
+ (WebCore::V8ScriptInstance::clear):
+ (WebCore::V8ScriptInstance::set):
+ * bindings/v8/ScriptValue.h:
+ (WebCore::ScriptValue::ScriptValue):
+ (WebCore::ScriptValue::operator=):
+ (WebCore::ScriptValue::clear):
+ * bindings/v8/V8AbstractEventListener.cpp:
+ (WebCore::V8AbstractEventListener::disposeListenerObject):
+ * bindings/v8/V8LazyEventListener.cpp:
+ (WebCore::V8LazyEventListener::~V8LazyEventListener):
+ (WebCore::V8LazyEventListener::getListenerFunction):
+ (WebCore::V8LazyEventListener::getWrappedListenerFunction):
+ * bindings/v8/V8NodeFilterCondition.cpp:
+ (WebCore::V8NodeFilterCondition::V8NodeFilterCondition):
+ (WebCore::V8NodeFilterCondition::~V8NodeFilterCondition):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8GCController::registerGlobalHandle):
+ (WebCore::V8GCController::unregisterGlobalHandle):
+ (WebCore::V8GCController::gcProtect):
+ (WebCore::V8GCController::gcUnprotect):
+ (WebCore::V8Proxy::destroyGlobal):
+ (WebCore::V8Proxy::updateDocumentWrapper):
+ (WebCore::V8Proxy::clearDocumentWrapper):
+ (WebCore::V8Proxy::disposeContextHandles):
+ (WebCore::V8Proxy::initContextIfNeeded):
+ * bindings/v8/V8Proxy.h:
+ (WebCore::):
+ (WebCore::GlobalHandleInfo::GlobalHandleInfo):
+ * bindings/v8/custom/V8CustomEventListener.cpp:
+ (WebCore::V8EventListener::V8EventListener):
+
+2009-07-08 Daniel Bates <dbates@intudata.com>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26918
+
+ Prevents injection of HTML Base tag.
+
+ Tests: http/tests/security/xssAuditor/base-href-control-char.html
+ http/tests/security/xssAuditor/base-href-null-char.html
+ http/tests/security/xssAuditor/base-href-safe.html
+ http/tests/security/xssAuditor/base-href-safe2.html
+ http/tests/security/xssAuditor/base-href-scheme-relative.html
+ http/tests/security/xssAuditor/base-href.html
+
+ * html/HTMLBaseElement.cpp:
+ (WebCore::HTMLBaseElement::parseMappedAttribute):
+ (WebCore::HTMLBaseElement::process): Modified to call XSSAuditor::canSetBaseElementURL
+ to determine if it is safe to use base element URL.
+ * html/HTMLBaseElement.h: Added field m_hrefAttrValue to store unparsed base element URL.
+ * page/XSSAuditor.cpp:
+ (WebCore::XSSAuditor::canSetBaseElementURL):
+ * page/XSSAuditor.h:
+
+2009-07-08 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Upstream V8 npruntime bindings.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27094
+
+ * bindings/v8/npruntime.cpp: Upstreamed from src.chromium.org.
+ (StringKey::operator==):
+ (StringKey::StringKeyHash::hash):
+ (StringKey::StringKeyHash::equal):
+ (StringKeyHashTraits::constructDeletedValue):
+ (StringKeyHashTraits::isDeletedValue):
+ (getStringIdentifierMap):
+ (getIntIdentifierMap):
+ * bindings/v8/npruntime_impl.h: Upstreamed from src.chromium.org.
+ * bindings/v8/npruntime_internal.h: Upstreamed from src.chromium.org.
+ * bindings/v8/npruntime_priv.h: Upstreamed from src.chromium.org.
+
+2009-07-08 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Extending the PlatformFileHandle definition from PLATFORM(WIN) to
+ PLATFORM(WIN_OS)
+
+ https://bugs.webkit.org/show_bug.cgi?id=27013
+
+ * platform/FileSystem.h:
+
+2009-07-08 Daniel Bates <dbates@intudata.com>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27071
+
+ Resolves issue when HTTP parameters contain null- and non-null-control- characters.
+
+ Tests: http/tests/security/xssAuditor/anchor-url-dom-write-location-inline-event-null-char.html
+ http/tests/security/xssAuditor/embed-tag-control-char.html
+ http/tests/security/xssAuditor/embed-tag-null-char.html
+ http/tests/security/xssAuditor/embed-tag.html
+ http/tests/security/xssAuditor/link-onclick-control-char.html
+ http/tests/security/xssAuditor/link-onclick-null-char.html
+ http/tests/security/xssAuditor/object-embed-tag-control-char.html
+ http/tests/security/xssAuditor/object-embed-tag-null-char.html
+ http/tests/security/xssAuditor/object-embed-tag.html
+ http/tests/security/xssAuditor/object-tag.html
+ http/tests/security/xssAuditor/script-tag-post-control-char.html
+ http/tests/security/xssAuditor/script-tag-post-null-char.html
+ http/tests/security/xssAuditor/script-tag-with-source-control-char.html
+ http/tests/security/xssAuditor/script-tag-with-source-null-char.html
+
+ * page/XSSAuditor.cpp:
+ (WebCore::isNonNullControlCharacter): Called by XSSAuditor::decodeURL.
+ (WebCore::XSSAuditor::canEvaluate):
+ (WebCore::XSSAuditor::canCreateInlineEventListener):
+ (WebCore::XSSAuditor::canLoadObject):
+ (WebCore::XSSAuditor::decodeURL): Added parameters matchNullCharacters,
+ and matchNonNullControlCharacters.
+ (WebCore::XSSAuditor::findInRequest): Added parameters matchNullCharacters,
+ and matchNonNullControlCharacters.
+ * page/XSSAuditor.h:
+
+2009-07-08 Marc-Antoine Ruel <maruel@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add DerivesSourcesAllInOne.cpp to help with release windows compilation.
+ https://bugs.webkit.org/show_bug.cgi?id=27093
+
+ This is specific for v8, no change in behavior.
+
+ * bindings/v8/DerivedSourcesAllInOne.cpp: Added.
+
+2009-07-08 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27086
+
+ Make sure the Media controller doesn't fade in for no reason.
+ This is happening because a update() call to the controller
+ panel may reset the opacity to 1.0, given that it reloads the
+ style.
+
+ We also add a different fade in and fade out time to soften
+ the fade out effect.
+
+ No test case because this depends on how the movie is loaded.
+
+ * rendering/RenderMedia.cpp:
+ (WebCore::RenderMedia::RenderMedia):
+ (WebCore::RenderMedia::updateControls):
+ (WebCore::RenderMedia::updateControlVisibility): Simplify
+ , and make sure we stop the timer if there is no animation
+ to do.
+ (WebCore::RenderMedia::opacityAnimationTimerFired):
+ * rendering/RenderMedia.h:
+
+2009-07-08 David Kilzer <ddkilzer@apple.com>
+
+ Bug 27081: Wrap RunLoopTimerCF.cpp in PLATFORM(MAC) && HAVE(RUNLOOP_TIMER)
+
+ <https://bugs.webkit.org/show_bug.cgi?id=27081>
+
+ Reviewed by Timothy Hatcher.
+
+ * platform/cf/RunLoopTimerCF.cpp: This code is only used on
+ Mac OS X when HAVE(RUNLOOP_TIMER) is enabled, so wrap the code
+ in that macro as well.
+
+2009-07-08 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Add -[WebView _isProcessingUserGesture]
+ https://bugs.webkit.org/show_bug.cgi?id=27084
+
+ Rename FrameLoader::userGestureHint() to FrameLoader::isProcessingUserGesture()
+ for clarity.
+
+ * WebCore.base.exp: Add WebCore::FrameLoader::isProcessingUserGesture()
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::processingUserGesture):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::requestFrame):
+ (WebCore::FrameLoader::isProcessingUserGesture):
+ * loader/FrameLoader.h:
+
+2009-07-08 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed (an earlier version) by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27090
+ Remove lockBackForwardList argument from HTMLFormElement::submit()
+
+ No change in behavior, so no tests.
+
+ * bindings/js/JSHTMLFormElementCustom.cpp:
+ (WebCore::JSHTMLFormElement::submit):
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::submit):
+ * html/HTMLFormElement.h:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::submitForm):
+ (WebCore::FrameLoader::scheduleFormSubmission):
+ * loader/FrameLoader.h:
+ Don't pass lockBackForwardList around when it's known to be false.
+
+2009-07-08 Marc-Antoine Ruel <maruel@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Fix V8 idl codegen to use unique constant names
+ <https://bugs.webkit.org/show_bug.cgi?id=27089>
+
+ Embed the interface name in the global constant names so coagulating all
+ the .cc files into one compile unit works with V8 bindings.
+
+ Nothing added; Still compiles and pass tests.
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+
+2009-07-08 Brent Fulgham <bfulgham@webkit.org>
+
+ Build fix: Add missing #includes for Windows (cURL) build.
+ The <winsock2.h> and <windows.h> headers were not being
+ included in Windows cURL builds.
+
+ * platform/network/ResourceHandleInternal.h:
+ * platform/network/curl/ResourceHandleManager.h:
+
+2009-07-08 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by David Kilzer.
+
+ WebKit needs a style linting tool
+ https://bugs.webkit.org/show_bug.cgi?id=25884
+
+ Fix bunch of style issues in WebCore/rendering.
+ This patch is created to demonstrate cpplint.py.
+
+ No testcase because it's just a style fixes.
+
+ * rendering/AutoTableLayout.cpp:
+ (WebCore::AutoTableLayout::recalcColumn):
+ (WebCore::AutoTableLayout::layout):
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::placeEllipsisBox):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paintTextMatchMarker):
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlTimelineElement::defaultEventHandler):
+ * rendering/MediaControlElements.h:
+ * rendering/RenderArena.cpp:
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::startDelayUpdateScrollInfo):
+ (WebCore::RenderBlock::finishDelayUpdateScrollInfo):
+ (WebCore::RenderBlock::updateScrollInfoAfterLayout):
+ (WebCore::RenderBlock::positionNewFloats):
+ (WebCore::RenderBlock::newLine):
+ (WebCore::RenderBlock::floatBottom):
+ (WebCore::RenderBlock::leftBottom):
+ (WebCore::RenderBlock::rightBottom):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::calcReplacedWidthUsing):
+ * rendering/RenderFieldset.cpp:
+ (WebCore::RenderFieldset::layoutLegend):
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::FlexBoxIterator::FlexBoxIterator):
+ (WebCore::FlexBoxIterator::reset):
+ (WebCore::FlexBoxIterator::first):
+ (WebCore::FlexBoxIterator::next):
+ (WebCore::RenderFlexibleBox::layoutVerticalBox):
+ * rendering/RenderFrameSet.cpp:
+ (WebCore::borderStartEdgeColor):
+ * rendering/RenderFrameSet.h:
+ * rendering/RenderImage.cpp:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateVisibilityStatus):
+ (WebCore::RenderLayer::calculateClipRects):
+ (WebCore::RenderLayer::calculateRects):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::panScroll):
+ * rendering/RenderMarquee.cpp:
+ (WebCore::RenderMarquee::updateMarqueeStyle):
+ * rendering/RenderMedia.cpp:
+ (WebCore::RenderMedia::updateControls):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::drawLineForBoxSide):
+ (WebCore::RenderObject::localCaretRect):
+ * rendering/RenderSVGImage.cpp:
+ (WebCore::RenderSVGImage::adjustRectsForAspectRatio):
+ * rendering/RenderSlider.h:
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::outerBorderBottom):
+ * rendering/RenderTableCol.h:
+ * rendering/RenderTextControlSingleLine.cpp:
+ (WebCore::RenderTextControlSingleLine::itemIsSeparator):
+ * rendering/RenderThemeChromiumSkia.cpp:
+ (WebCore::RenderThemeChromiumSkia::supportsHover):
+ * rendering/RenderThemeChromiumWin.cpp:
+ (WebCore::RenderThemeChromiumWin::supportsFocusRing):
+ * rendering/SVGCharacterLayoutInfo.cpp:
+ (WebCore::SVGCharacterLayoutInfo::addStackContent):
+ * rendering/SVGCharacterLayoutInfo.h:
+ * rendering/TextControlInnerElements.h:
+ * rendering/bidi.cpp:
+ (WebCore::RenderBlock::computeHorizontalPositionsForLine):
+
+2009-07-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Reduce complexity of lifetime management in DynamicNodeList caches
+ <https://bugs.webkit.org/show_bug.cgi?id=27068>
+
+ Switch the Cache object used by DynamicNodeList into a normal
+ refcounted object rather than having a weird flag controlled
+ refcounting system, where positive refcount did not automatically
+ imply the cache object would actually still be live.
+
+ * dom/DynamicNodeList.cpp:
+ (WebCore::DynamicNodeList::DynamicNodeList):
+ (WebCore::DynamicNodeList::~DynamicNodeList):
+ (WebCore::DynamicNodeList::Caches::Caches):
+ (WebCore::DynamicNodeList::Caches::create):
+ * dom/DynamicNodeList.h:
+ * dom/Node.cpp:
+ (WebCore::Node::childNodes):
+ (WebCore::Node::getElementsByTagNameNS):
+ (WebCore::Node::getElementsByName):
+ (WebCore::Node::getElementsByClassName):
+ (WebCore::NodeListsNodeData::invalidateCaches):
+ (WebCore::NodeListsNodeData::isEmpty):
+ * dom/NodeRareData.h:
+ (WebCore::NodeListsNodeData::NodeListsNodeData):
+
+2009-07-07 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ -webkit-perspective should be a Length
+ https://bugs.webkit.org/show_bug.cgi?id=27066
+
+ -webkit-perspective should not take a magic valueless number, but should
+ be a normal Length value which responds to zooming. Treat valueless numbers
+ as pixels for backward compatibility.
+
+ Test: transforms/3d/general/perspective-units.html
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+
+2009-07-07 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27047
+
+ We need to make sure that when we reattach, we also reattach
+ the children in every MediaControlElement. Else we may end up
+ having no remaining or elapsed time.
+
+ We have to handle that, because we are using a special shadow
+ tree in the DOM, and that we are ourselves handling
+ attaching/detaching the renderer.
+
+ The strategy here is to try to implement ::attach(), and try
+ to reuse as much code as we can from the super class, including
+ children attachement.
+
+ Test: media/controls-after-reload.html
+
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlElement::styleForElement): Code factoring.
+ (WebCore::MediaControlElement::rendererIsNeeded): Code factoring.
+ (WebCore::MediaControlElement::attach): Implement attach
+ and call super class so that children are also attached.
+ (WebCore::MediaControlElement::updateStyle): Use attach()
+ (WebCore::MediaControlInputElement::styleForElement): Code factoring.
+ (WebCore::MediaControlInputElement::rendererIsNeeded): Code factoring.
+ (WebCore::MediaControlInputElement::attach): See above.
+ (WebCore::MediaControlInputElement::updateStyle): Use attach()
+ * rendering/MediaControlElements.h:
+ * rendering/RenderMedia.cpp:
+ (WebCore::RenderMedia::updateControls): Directly run attach() on
+ the m_panel, which is a root node for our shadow tree.
+
+2009-07-07 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Repaint issue after layer drops out of composited mode.
+ <https://bugs.webkit.org/show_bug.cgi?id=27022>
+
+ RenderLayers cache repaint rects in the form of m_repaintRect and m_outlineBox,
+ and expect these to stay valid from one style change to the next. These rects
+ are relative to the repaint container, so if a layer stops being composited,
+ we need to recompute them.
+
+ Test: compositing/repaint/layer-repaint-rects.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::computeRepaintRects):
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateBacking):
+
+2009-07-07 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Dave Hyatt and Darin Adler.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=26963
+ <rdar://problem/7030998> Reproducible crash at
+ FontCache::getFontData() when a custom font is used in a pseudo-style
+
+ Test: fast/css/pseudo-cache-stale.html
+
+ * dom/Element.cpp:
+ (WebCore::Element::pseudoStyleCacheIsInvalid): Added. Given the old
+ style and the new style, goes over cached pseudo-styles in the old
+ style and re-resolves the same style types off the new style. If any of
+ the new pseudo-styles is different from the currently cached
+ corresponding style, returns true. Otherwise, returns false.
+ (WebCore::Element::recalcStyle): Validate the pseudo-style cache before
+ deciding to keep the existing style.
+ * dom/Element.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::uncachedFirstLineStyle): Added this version that
+ returns an uncached first-line style based off the given style.
+ (WebCore::RenderObject::getUncachedPseudoStyle): Added the 'ownStyle'
+ parameter.
+ * rendering/RenderObject.h:
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::getPseudoStyleCache): Added. Returns the cached
+ pseudo-styles in the passed-in vector.
+ * rendering/style/RenderStyle.h:
+
+2009-07-07 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=27042
+ <rdar://problem/7010981> Incomplete painting of newly created floats
+
+ Tests: fast/repaint/float-in-new-block-with-layout-delta.html
+ fast/repaint/float-new-in-block.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::layoutBlockChildren): If the child has never been
+ laid out before, paint its overhanging floats in addition to itself.
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::FloatWithRect::FloatWithRect): Added and
+ initialized a boolean everHadLayout member.
+ * rendering/bidi.cpp:
+ (WebCore::RenderBlock::layoutInlineChildren): Paint floats that have
+ never been laid out before and did not move from (0, 0).
+
+2009-07-07 Brady Eidson <beidson@apple.com>
+
+ Contributions from both Darin Adler and Brady Eidson.
+ Reviewed by Darin Adler.
+
+ <rdar://problem/7024039> REGRESSION (r42158): Back-forward navigation does not work correctly on nytimes.com
+
+ In r42158 we lost some exclusions to making back/forward items for subframe navigations when a main frame
+ navigation was still in progress.
+
+ This patch makes things even better than it used to be by:
+ - Locking back/forward history at the time the navigation is scheduled, not after the load has committed.
+ - Locking back/forward history if *any* ancestor frame is still loading instead of just the main frame.
+
+ Test: fast/loader/subframe-navigate-during-main-frame-load.html
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::submitForm): Move out the history locking logic into a standalone function so it can be
+ used from multiple sites.
+ (WebCore::mustLockBackForwardList): Returns true if any ancestor frame is still loading.
+ (WebCore::FrameLoader::scheduleLocationChange): Respect mustLockBackForwardList() in addition to the passed in
+ lockBackForwardList flag.
+ (WebCore::FrameLoader::scheduleFormSubmission): Ditto.
+
+2009-07-07 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Upstream DOMObjectsInclude.h from src.chromium.org.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27035
+
+ * bindings/v8/DOMObjectsInclude.h: Added.
+
+2009-07-07 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by David Levin.
+
+ Relanding r45559, which was rolled back at r45574.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26857
+
+ * bindings/scripts/CodeGeneratorV8.pm: Updated a function name in auto-generated bindings.
+ * bindings/v8/V8Binding.cpp: Moved from src.chromium.org.
+ * bindings/v8/V8Binding.h: Contents moved from src.chromium.org.
+ * bindings/v8/V8LazyEventListener.cpp:
+ (WebCore::V8LazyEventListener::getListenerFunction):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::handleConsoleMessage):
+ (WebCore::V8Proxy::compileScript):
+ (WebCore::V8Proxy::sourceName):
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ (WebCore::handleConsoleMessage):
+ * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
+ (WebCore::NAMED_PROPERTY_SETTER):
+ * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8CustomXPathNSResolver.cpp:
+ (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLIFrameElementCustom.cpp:
+ (WebCore::ACCESSOR_SETTER):
+ * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
+ (WebCore::removeElement):
+ * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8WorkerContextCustom.cpp:
+ (WebCore::SetTimeoutOrInterval):
+ * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+
+2009-07-07 Gregory Hughes <gfhughesVO+webkit@gmail.com>
+
+ Reviewed by Darin Adler.
+
+ AX: Some webpages do not send AXLoadComplete
+ https://bugs.webkit.org/show_bug.cgi?id=26995
+
+ When sending the AXLayoutComplete notification it is possible
+ that the AXObjectCache was cleared, resulting in no valid
+ object to send the notification to. This fix ensures that an
+ AX object is created and cached if one does not already exist.
+
+ Not able to add a test because notifications get sent after the layout test is completed.
+
+ * dom/Document.cpp:
+ (WebCore::Document::implicitClose):
+
+2009-07-06 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27015
+
+ Make sure that the CSS properties letter-spacing, word-spacing,
+ line-height, text-transform, text-indent, text-shadow,
+ text-decoration and color do not affect the media element controls,
+ that display text.
+
+ Controls that display text are only present in when the theme
+ MediaControllerThemeQT is being used.
+
+ Test: media/controls-styling.html
+
+ * css/mediaControlsQT.css:
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlElement::updateStyle): Special case for
+ text-decoration. text-decoration can't be overriden from CSS, because
+ text-decoration is additive for historical reasons.
+
+2009-07-07 Albert Wong <ajwong@chromium.org>
+
+ Not reviewed, Chromium build fix.
+
+ Add in missing header + fix syntax issue that crept into last patch.
+ https://bugs.webkit.org/show_bug.cgi?id=27027
+
+ * rendering/RenderThemeChromiumMac.mm:
+ (WebCore::RenderThemeChromiumMac::paintMediaFullscreenButton):
+
+2009-07-07 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Make use of geometry information to decide which layers become composited.
+
+ <rdar://problem/7011947>
+ <https://bugs.webkit.org/show_bug.cgi?id=27021>
+
+ In addition to looking at painting order, also, optionally, take layer
+ overlap into account when deciding which RenderLayers need to be composited.
+
+ No testcase because DRT doesn't dump which layers are composited.
+
+ * page/FrameView.h:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::updateCompositingLayers):
+ Removed the unused CompositingUpdate parameter, and just do an early return
+ when there is no view.
+
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::rendererContentChanged):
+ (WebCore::RenderLayer::dirtyZOrderLists):
+ (WebCore::RenderLayer::dirtyNormalFlowList):
+ (WebCore::RenderLayer::styleChanged):
+ (WebCore::RenderLayer::mustOverlapCompositedLayers):
+ (WebCore::RenderLayer::setMustOverlapCompositedLayers):
+ Change "overlay" to "overlap" for consistency with the use of "overlap"
+ elsewhere.
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateAfterLayout):
+ compositingLayersNeedUpdate() renamed to compositingLayersNeedRebuild().
+
+ (WebCore::RenderLayerBacking::startAnimation):
+ (WebCore::RenderLayerBacking::startTransition):
+ Tell the compositor that we started an accelerated animation or transition.
+
+ * rendering/RenderLayerCompositor.h:
+ (WebCore::RenderLayerCompositor::compositingLayersNeedRebuild):
+ Renamed, since it's explicitly about changes in hierarchy now.
+
+ (WebCore::RenderLayerCompositor::setCompositingConsultsOverlap):
+ (WebCore::RenderLayerCompositor::compositingConsultsOverlap):
+ New getter and setter for whether compositing should take overlap into account.
+
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::RenderLayerCompositor):
+ Add m_compositingConsultsOverlap, re-order some member variables.
+
+ (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingEnabledFlag):
+ Whitespace cleanup and method rename.
+
+ (WebCore::RenderLayerCompositor::setCompositingLayersNeedRebuild):
+ Method and variable renaming.
+
+ (WebCore::RenderLayerCompositor::updateCompositingLayers):
+ Now we have to run through the layer hierarchy every time if looking
+ at overlap, because changes in layout can now alter compositing behavior.
+ We minimize work by tracking whether we actually need to change the layer
+ hierarchy via needLayerRebuild.
+
+ (WebCore::RenderLayerCompositor::updateBacking):
+ 3D transforms turn off overlap mode.
+
+ (WebCore::RenderLayerCompositor::layerWasAdded):
+ (WebCore::RenderLayerCompositor::layerWillBeRemoved):
+ Method rename.
+
+ (WebCore::RenderLayerCompositor::addToOverlapMap):
+ (WebCore::RenderLayerCompositor::overlapsCompositedLayers):
+ Utility methods to add a layer to the overlapMap (computing the absolute
+ bounding box only if we haven't already done so), and testing the map
+ entries.
+
+ (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+ If a layer would composite only because it comes after other compositing
+ layers in the painting order, then consult the overlap map to determine whether
+ it overlaps, and thus actually needs to composite.
+
+ Add layers to the map when they must be composited.
+
+ (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
+ Only do re-parenting work if the updateHierarchy flag is set.
+
+ (WebCore::RenderLayerCompositor::didStartAcceleratedAnimation):
+ When we start an accelerated transition or animation, we stop looking at
+ overlap because we can no longer guarantee correct front-to-back ordering while the
+ accelerated animation is running.
+
+ (WebCore::RenderLayerCompositor::needsToBeComposited):
+ Method renames.
+
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::setMaximalOutlineSize):
+ Add comment indicating that this could be optimized.
+
+2009-07-07 Anton Muhin <antonm@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Speed up creation of V8 wrappers for DOM nodes.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26882
+
+ This patch doesn't require new tests as it a set of refactorings
+ to speed up wrapper creation.
+
+ * bindings/v8/V8Proxy.cpp:
+ * bindings/v8/V8Proxy.h:
+
+2009-07-07 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] textarea height property works only if other property are defined
+ https://bugs.webkit.org/show_bug.cgi?id=18984
+
+ Let WebCore handle textarea's metrics instead of readjusting it RenderthemeGtk.
+
+ Test: fast/forms/textarea-metrics.html
+
+ * platform/gtk/RenderThemeGtk.cpp:
+ * platform/gtk/RenderThemeGtk.h:
+
+2009-07-07 Ben Murdoch <benm@google.com>
+
+ Reviewed by Antti Koivisto.
+
+ HTML5 Database becomes locked if a transaction is in progress when the page is refreshed.
+ https://bugs.webkit.org/show_bug.cgi?id=25711
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=25711 where web
+ storage databases could become locked until the browser is shut
+ down if the page is refreshed whilst a transaction is in progress.
+
+ Test: storage/database-lock-after-reload.html
+
+ * storage/Database.cpp:
+ (WebCore::Database::Database):
+ (WebCore::Database::close): add code to inform the database thread we've closed the database.
+ (WebCore::Database::performOpenAndVerify): add code to inform the database thread we've opened a database.
+ * storage/Database.h:
+ (WebCore::Database::opened): return true iff the underlying sqlite database has been opened but not closed.
+ * storage/DatabaseThread.cpp:
+ (WebCore::DatabaseThread::databaseThread): Before the database thread terminates, close any databases that ran transactions in this thread.
+ (WebCore::DatabaseThread::recordDatabaseOpen): Records a database that executed a transaction in this thread.
+ (WebCore::DatabaseThread::recordDatabaseClosed): Removes a database from the set of open databases.
+ * storage/DatabaseThread.h:
+ (WebCore::DatabaseThread::getThreadID): return the thread id for the database thread.
+
+2009-07-07 Jiahua Huang <jhuangjiahua@gmail.com>
+
+ Reviewed by Jan Alonzo.
+
+ [Gtk] Paste of rich text from firefox results garbled markup
+ https://bugs.webkit.org/show_bug.cgi?id=26791
+
+ Fix problem with UTF-16 clipboard pasted.
+
+ * manual-tests/gtk/paste-richtext-from-firefox.html: Added.
+ * platform/gtk/PasteboardGtk.cpp:
+ (WebCore::Pasteboard::documentFragment):
+
+2009-07-07 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Change 'Continue debug' shortcut from F5 to F8 for consistency with Firebug.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23849
+
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel):
+
+2009-07-06 Albert J. Wong <ajwong@chromium.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Update RenderThemeChromiumMac for wkDrawMediaUIPart and wkDrawMediaSlider API
+ change.
+
+ Fix compile RenderThemeChromiumMac.mm due to API changes from r45572
+ https://bugs.webkit.org/show_bug.cgi?id=27018
+
+ This is mainly an API change update to fix the chromium compile. It
+ also has a small fix of a typo in RenderThemeMac.mm.
+
+ Compilation against the head of chromium trunk passed. Since this is
+ a compile fix, that should be sufficient.
+
+ * rendering/RenderThemeChromiumMac.mm:
+ (WebCore::):
+ (WebCore::RenderThemeChromiumMac::paintMediaFullscreenButton):
+ (WebCore::RenderThemeChromiumMac::paintMediaMuteButton):
+ (WebCore::RenderThemeChromiumMac::paintMediaPlayButton):
+ (WebCore::RenderThemeChromiumMac::paintMediaSeekBackButton):
+ (WebCore::RenderThemeChromiumMac::paintMediaSeekForwardButton):
+ (WebCore::RenderThemeChromiumMac::paintMediaSliderTrack):
+ (WebCore::RenderThemeChromiumMac::paintMediaSliderThumb):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::):
+
+2009-07-06 David Kilzer <ddkilzer@apple.com>
+
+ Bug 27002: Build fix when DASHBOARD_SUPPORT is disabled with -Wunused-parameter
+
+ <https://bugs.webkit.org/show_bug.cgi?id=27002>
+
+ Reviewed by Geoff Garen.
+
+ * html/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::prepareGradientForDashboard):
+ Mark gradient as an unused parameter when DASHBOARD_SUPPORT is
+ disabled.
+
+2009-07-06 David Kilzer <ddkilzer@apple.com>
+
+ Bug 27001: Fix improper use of PassRefPtr<Node> to RefPtr<Node>
+
+ <https://bugs.webkit.org/show_bug.cgi?id=27001>
+
+ Reviewed by Geoff Garen.
+
+ PassRefPtr<> should only be used for arguments to functions that
+ take ownership of the object, or as return values from functions
+ that relinquish ownership of the object.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::increaseSelectionListLevelOrdered): Changed
+ stack-allocated PassRefPtr<Node> to RefPtr<Node> and call
+ release() on returned object.
+ (WebCore::Editor::increaseSelectionListLevelUnordered): Ditto.
+
+2009-07-06 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/7035474> Make new media controller UI default on SnowLeopard
+
+ * rendering/RenderThemeMac.mm:
+ (WebCore::mediaControllerTheme):
+ New media controller UI is enabled by default on SnowLeopard.
+
+2009-07-06 Nate Chapin <japhet@chromium.org>
+
+ Unreviewed, build fix.
+
+ Roll out r45559 to fix Chromium canary.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26857
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/v8/V8Binding.cpp: Removed.
+ * bindings/v8/V8Binding.h:
+ (WebCore::toInt32):
+ (WebCore::toWebCoreString):
+ (WebCore::fromWebCoreString):
+ (WebCore::toWebCoreStringWithNullCheck):
+ (WebCore::isUndefinedOrNull):
+ (WebCore::v8Boolean):
+ * bindings/v8/V8LazyEventListener.cpp:
+ (WebCore::V8LazyEventListener::getListenerFunction):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::handleConsoleMessage):
+ (WebCore::V8Proxy::compileScript):
+ (WebCore::V8Proxy::sourceName):
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ (WebCore::handleConsoleMessage):
+ * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
+ (WebCore::NAMED_PROPERTY_SETTER):
+ * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8CustomXPathNSResolver.cpp:
+ (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLIFrameElementCustom.cpp:
+ (WebCore::ACCESSOR_SETTER):
+ * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
+ (WebCore::removeElement):
+ * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8WorkerContextCustom.cpp:
+ (WebCore::SetTimeoutOrInterval):
+ * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+
+2009-07-06 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/7008093> Media controller can’t be used to scrub when movie is
+ narrow — track is too narrow
+
+ Do not show media controller time display elements when the a movie is too narrow.
+
+ * platform/mac/WebCoreSystemInterface.h:
+ * platform/mac/WebCoreSystemInterface.mm:
+ The 'state' parameter to wkDrawMediaUIPart is now an unsigned bitfield.
+
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlTimeDisplayElement::MediaControlTimeDisplayElement):
+ Give current time and time remaining controls a common base class.
+ (WebCore::MediaControlTimeDisplayElement::setVisible):
+ New method, hide and show the element.
+ * rendering/MediaControlElements.h:
+
+ * rendering/RenderMedia.cpp:
+ (WebCore::RenderMedia::RenderMedia):
+ Initialize m_previousVisible.
+ (WebCore::RenderMedia::layout):
+ Show/hide the time display elements as the movie width changes.
+ (WebCore::RenderMedia::createCurrentTimeDisplay):
+ (WebCore::RenderMedia::createTimeRemainingDisplay):
+ Base class is now MediaControlTimeDisplayElement, not MediaControlElement.
+ (WebCore::RenderMedia::shouldShowTimeDisplayControls):
+ New, decide if time display elements should be visible or not.
+ * rendering/RenderMedia.h:
+
+ * rendering/RenderThemeMac.mm:
+ (WebCore::):
+ (WebCore::RenderThemeMac::paintMediaFullscreenButton):
+ (WebCore::RenderThemeMac::paintMediaMuteButton):
+ (WebCore::RenderThemeMac::paintMediaPlayButton):
+ (WebCore::RenderThemeMac::paintMediaSeekBackButton):
+ (WebCore::RenderThemeMac::paintMediaSeekForwardButton):
+ (WebCore::RenderThemeMac::paintMediaSliderTrack):
+ (WebCore::RenderThemeMac::paintMediaSliderThumb):
+ (WebCore::RenderThemeMac::paintMediaRewindButton):
+ (WebCore::RenderThemeMac::paintMediaReturnToRealtimeButton):
+ (WebCore::RenderThemeMac::paintMediaControlsBackground):
+ (WebCore::RenderThemeMac::paintMediaCurrentTime):
+ (WebCore::RenderThemeMac::paintMediaTimeRemaining):
+ The 'state' parameter to wkDrawMediaUIPart is now an unsigned bitfield.
+
+2009-07-06 David Kilzer <ddkilzer@apple.com>
+
+ Bug 27000: Minor clean up to runtime_root.{cpp|h}
+
+ <https://bugs.webkit.org/show_bug.cgi?id=27000>
+
+ Reviewed by Geoff Garen.
+
+ * bridge/runtime_root.cpp: Added blank line between license and
+ the first #include statement.
+ * bridge/runtime_root.h: Added comment to #endif.
+
+2009-07-06 Roland Steiner <rolandsteiner@google.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ generalize the special height treatment for SVG (to be re-used for ruby):
+ renamed InlineBox::m_isSVG to m_hasVirtualHeight
+ renamed InlineBox::isSVG() to hasVirtualHeight()
+ renamed InlineBox::setIsSVG() to setHasVirtualHeight()
+
+ * rendering/InlineBox.cpp:
+ (WebCore::InlineBox::height):
+ * rendering/InlineBox.h:
+ (WebCore::InlineBox::InlineBox):
+ (WebCore::InlineBox::isText):
+ (WebCore::InlineBox::setIsText):
+ (WebCore::InlineBox::isSVGRootInlineBox):
+ (WebCore::InlineBox::hasVirtualHeight):
+ (WebCore::InlineBox::setHasVirtualHeight):
+ (WebCore::InlineBox::virtualHeight):
+ * rendering/RenderSVGInline.cpp:
+ (WebCore::RenderSVGInline::createFlowBox):
+ * rendering/RenderSVGInlineText.cpp:
+ (WebCore::RenderSVGInlineText::createTextBox):
+ * rendering/RenderSVGText.cpp:
+ (WebCore::RenderSVGText::createRootBox):
+ * rendering/SVGInlineFlowBox.h:
+ (WebCore::SVGInlineFlowBox::virtualHeight):
+ * rendering/SVGInlineTextBox.h:
+ (WebCore::SVGInlineTextBox::virtualHeight):
+ * rendering/SVGRootInlineBox.h:
+ (WebCore::SVGRootInlineBox::virtualHeight):
+
+2009-07-06 Alice Liu <alice.liu@apple.com>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION(r45285): focus rings are black on windows safari
+ https://bugs.webkit.org/show_bug.cgi?id=26821
+ <rdar://problem/7018252>
+
+ Add a mechanism for setting a custom focus ring color, and relocate the
+ determination of focus ring color to base class RenderTheme.
+
+ No new tests. Already-existing tests run in pixel mode would have caught this regression
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::getColorFromPrimitiveValue): Move the responsibility
+ of determining focus color to base class RenderTheme.
+ * rendering/RenderTheme.cpp:
+ (WebCore::customFocusRingColor): Added static local.
+ (WebCore::RenderTheme::setCustomFocusRingColor): Added
+ (WebCore::RenderTheme::focusRingColor): Use custom color over platform color.
+ * rendering/RenderTheme.h:
+ (WebCore::RenderTheme::platformFocusRingColor): default implementation, black color
+ * rendering/RenderThemeSafari.cpp:
+ (WebCore::RenderTheme::themeForPage): Circumstances that lead to returning the RenderThemeWin
+ are the same under which we want to use the focus ring color from SafariTheme.
+ (WebCore::RenderThemeSafari::platformFocusRingColor): Renamed from focusRingColor
+ * rendering/RenderThemeSafari.h:
+
+ Renaming focusRingColor to platformFocusRingColor in these files:
+ * rendering/RenderThemeChromiumMac.h:
+ * rendering/RenderThemeChromiumMac.mm:
+ (WebCore::RenderThemeChromiumMac::platformFocusRingColor):
+ * rendering/RenderThemeChromiumSkia.cpp:
+ (WebCore::RenderThemeChromiumSkia::platformFocusRingColor):
+ * rendering/RenderThemeChromiumSkia.h:
+ * rendering/RenderThemeMac.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::platformFocusRingColor):
+
+ Cleanup leftover from removal of WebCore::Color in r45285 in these files:
+ * WebCore.order:
+ * platform/graphics/Color.h:
+
+2009-07-06 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by David Hyatt.
+
+ Bug 15135: REGRESSION (r19843-r19850): Changing a flexbox's
+ contents makes its container scroll to the top
+ https://bugs.webkit.org/show_bug.cgi?id=15135
+
+ Delay updateing scroll bar of descendants of flexbox until their
+ positions are determined. In this way we can prevent descendants
+ of flexible boxes from changing positions of their scrollbars
+ using tentative positions.
+
+ Test: fast/flexbox/repaint-scrollbar.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::startDelayUpdateScrollInfo):
+ (WebCore::RenderBlock::finishDelayUpdateScrollInfo):
+ (WebCore::RenderBlock::updateScrollInfoAfterLayout):
+ (WebCore::RenderBlock::layoutBlock):
+ (WebCore::RenderBlock::layoutOnlyPositionedObjects):
+ * rendering/RenderBlock.h:
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::layoutHorizontalBox):
+ (WebCore::RenderFlexibleBox::layoutVerticalBox):
+
+2009-07-06 Hironori Bono <hbono@chromium.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Make unconfirmed IME text affect textarea's value.
+ This matches input and contentEditable elements as well
+ IE and Firefox.
+
+ This fixes https://bugs.webkit.org/show_bug.cgi?id=25061.
+
+ Input elements would go down this code path because it
+ would always get a null compositionNode from frame->editor().
+ Special casing compositionNodes is wrong because we explicitly
+ want unconfirmed IME input in the textarea's value (assuming we
+ want to match IE and Firefox here).
+
+ This change is originally created by Ojan Vafai <ojan@chromium.org> and
+ I just changed its manual tests with an automated test on his behalf.
+
+ Test: platform/mac/editing/input/text-control-ime-input.html
+
+ * rendering/RenderTextControl.cpp:
+ (WebCore::RenderTextControl::text):
+ (WebCore::RenderTextControl::textWithHardLineBreaks):
+
+2009-07-06 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Add the ability for wheel events to latch to a node.
+
+ * WebCore.base.exp:
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::EventHandler):
+ (WebCore::EventHandler::clear):
+ (WebCore::EventHandler::handleWheelEvent):
+ * page/EventHandler.h:
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::EventHandler::wheelEvent):
+ * platform/mac/WebCoreSystemInterface.h:
+ * platform/mac/WebCoreSystemInterface.mm:
+
+2009-07-06 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Fix a bunch of layout test crahses in Chromium caused by a bad usage of DEFINE_STATIC_LOCAL.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26997
+
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::v8ValueToWebCoreString): Use a regular static declaration instead of DEFINE_STATIC_LOCAL.
+
+2009-07-06 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ WebInspector: suggest global properties based on async evaluation.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26976
+
+ Before this change, empty string was evaluated to the global object
+ (or scope chain object) synchronously. This is now fixed and global
+ object is evaluated using the same control flow.
+
+ * inspector/front-end/Console.js:
+ (WebInspector.Console.prototype.completions):
+ (WebInspector.Console.prototype._evalInInspectedWindow):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._variablesInScope):
+
+2009-07-06 Ojan Vafai <ojan@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Fix crash when indenting in an empty table cell.
+ https://bugs.webkit.org/show_bug.cgi?id=26872
+
+ The crash is that we would call splitTreeToNode where the node
+ and the nodeToSplitTo were the same node.
+
+ Test: editing/execCommand/indent-empty-table-cell.html
+
+ * editing/CompositeEditCommand.cpp:
+ (WebCore::CompositeEditCommand::splitTreeToNode):
+ Added an assert in that node and nodeToSplitTo
+ are different nodes to make this assumption explicit.
+
+ * editing/IndentOutdentCommand.cpp:
+ (WebCore::IndentOutdentCommand::isAtUnsplittableElement):
+ (WebCore::IndentOutdentCommand::indentRegion):
+ * editing/IndentOutdentCommand.h:
+
+2009-07-06 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by David Levin.
+
+ Upstream V8Binding and update some function names.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26857
+
+ * bindings/scripts/CodeGeneratorV8.pm: Update function names in auto-generated files.
+ * bindings/v8/V8Binding.cpp: Upstreamed from src.chromium.org.
+ * bindings/v8/V8Binding.h: Upstreamed from src.chromium.org.
+ * bindings/v8/V8LazyEventListener.cpp:
+ (WebCore::V8LazyEventListener::getListenerFunction):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::handleConsoleMessage):
+ (WebCore::V8Proxy::compileScript):
+ (WebCore::V8Proxy::sourceName):
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ (WebCore::handleConsoleMessage):
+ * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
+ (WebCore::NAMED_PROPERTY_SETTER):
+ * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8CustomXPathNSResolver.cpp:
+ (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLIFrameElementCustom.cpp:
+ (WebCore::ACCESSOR_SETTER):
+ * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
+ (WebCore::removeElement):
+ * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8WorkerContextCustom.cpp:
+ (WebCore::SetTimeoutOrInterval):
+ * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+
+2009-07-06 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Jan Alonzo.
+
+ Use soup's content sniffing
+ https://bugs.webkit.org/show_bug.cgi?id=26982
+
+ Drop our hackish content sniffing code, and use the new libsoup
+ feature to do that job for us.
+
+ Testing this is in a cross-platform way is not obvious or possible
+ while we are using platform-specific code for sniffing.
+
+ * platform/network/ResourceHandleInternal.h:
+ (WebCore::ResourceHandleInternal::ResourceHandleInternal):
+ * platform/network/soup/ResourceHandleSoup.cpp:
+ (WebCore::gotHeadersCallback):
+ (WebCore::contentSniffedCallback):
+ (WebCore::gotChunkCallback):
+ (WebCore::ResourceHandle::startHttp):
+
+2009-07-05 Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION (r40499): fast/dom/cssTarget-crash.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=20342
+
+ Re-added code removed by commit r40499.
+ Without this, both Qt and Mac were crashing while running the test.
+
+ Note that this does not entirely fix the bug. It fixes the WebCore
+ crash, but the test no longer seems to work due to loader changes.
+ So this patch does not reenable the test. The test probably has to
+ be rewritten.
+
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::removedFromDocument): Re-added code to
+ set the CSS target of the document to 0.
+
+2009-07-05 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26943
+
+ When one transition finishes slightly before another the longer
+ one will fire a second time. This is because the second
+ ImplicitAnmation object is culled too early, before its final
+ RenderStyle is in place. This is done by cleanupFinishedAnimations()
+ so I got rid of that method completely and now cleanup each
+ transition or animation at the point where I am setting the final
+ style, or when I detect that the transition or animation has been
+ terminated early (which happens when you remove it from the style).
+
+ Test: transitions/extra-transition.html
+
+ * page/animation/AnimationController.cpp:
+ (WebCore::AnimationControllerPrivate::updateStyleIfNeededDispatcherFired):
+ * page/animation/CompositeAnimation.cpp:
+ (WebCore::CompositeAnimation::updateTransitions):
+ (WebCore::CompositeAnimation::updateKeyframeAnimations):
+ (WebCore::CompositeAnimation::animate):
+ * page/animation/CompositeAnimation.h:
+
+ * page/animation/AnimationBase.cpp:
+ (WebCore::AnimationBase::getTimeToNextEvent):
+ Avoid a divide by zero if m_animation->duration() is zero, which can happen
+ if the duration is changed to zero while the animation is running.
+
+2009-07-05 Simon Fraser <simon.fraser@apple.com>
+
+ Revert the previous commit because it broke the
+ animations/transition-and-animation-1.html
+ testcase.
+
+ * page/animation/AnimationBase.cpp:
+ (WebCore::AnimationBase::getTimeToNextEvent):
+ * page/animation/AnimationController.cpp:
+ (WebCore::AnimationControllerPrivate::updateStyleIfNeededDispatcherFired):
+ * page/animation/CompositeAnimation.cpp:
+ (WebCore::CompositeAnimation::updateTransitions):
+ (WebCore::CompositeAnimation::updateKeyframeAnimations):
+ (WebCore::CompositeAnimation::animate):
+ (WebCore::CompositeAnimation::cleanupFinishedAnimations):
+ * page/animation/CompositeAnimation.h:
+
+2009-07-05 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26943
+
+ When one transition finishes slightly before another the longer
+ one will fire a second time. This is because the second
+ ImplicitAnmation object is culled too early, before its final
+ RenderStyle is in place. This is done by cleanupFinishedAnimations()
+ so I got rid of that method completely and now cleanup each
+ transition or animation at the point where I am setting the final
+ style, or when I detect that the transition or animation has been
+ terminated early (which happens when you remove it from the style).
+
+ Test: transitions/extra-transition.html
+
+ * page/animation/AnimationController.cpp:
+ (WebCore::AnimationControllerPrivate::updateStyleIfNeededDispatcherFired):
+ * page/animation/CompositeAnimation.cpp:
+ (WebCore::CompositeAnimation::updateTransitions):
+ (WebCore::CompositeAnimation::updateKeyframeAnimations):
+ (WebCore::CompositeAnimation::animate):
+ * page/animation/CompositeAnimation.h:
+
+ * page/animation/AnimationBase.cpp:
+ (WebCore::AnimationBase::getTimeToNextEvent):
+ Avoid a divide by zero if m_animation->duration() is zero, which can happen
+ if the duration is changed to zero while the animation is running.
+
+2009-07-05 Lars Knoll <lars.knoll@nokia.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26843
+
+ Fix run-time crashes in JavaScriptCore with the Metrowerks compiler on Symbian.
+
+ The Metrowerks compiler on the Symbian platform moves the globally
+ defined Hashtables into read-only memory, despite one of the members
+ being mutable. This causes crashes at run-time due to write access to
+ read-only memory.
+
+ Avoid the use of const with this compiler by introducing the
+ JSC_CONST_HASHTABLE macro.
+
+ Based on idea by Norbert Leser.
+
+ * bindings/scripts/CodeGeneratorJS.pm: Use JSC_CONST_HASHTABLE for hash tables
+ define in the bindings.
+
+2009-07-05 Rob Buis <rwlbuis@gmail.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 26897 - Dynamic SVG images do not display correctly
+ https://bugs.webkit.org/show_bug.cgi?id=26897
+
+ Use repaint() to fix a rendering problem with a SVG image embedded in xhtml.
+
+ Test: svg/custom/createImageElement2.xhtml
+
+ * rendering/RenderSVGImage.cpp:
+ (WebCore::RenderSVGImage::imageChanged):
+
+2009-07-05 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Jan Alonzo.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26960
+ [Gtk] caret offset not updated when selecting text
+
+ Report the caret offset from the end of the selection so it works
+ correctly for multi-char selections too (ie, anything that is not
+ the zero width caret).
+
+ * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
+ (webkit_accessible_text_get_caret_offset):
+
+2009-07-05 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Unreviewed link fix for Qt.
+
+ Fix Qt link error by adding two new localized strings
+
+ In r45474 two new strings got added to LocalizedStrings.h add
+ the definition of them to Qt.
+
+ * platform/qt/Localizations.cpp:
+ (WebCore::mediaElementLoadingStateText):
+ (WebCore::mediaElementLiveBroadcastStateText):
+
+2009-07-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ REGRESSION (r44670-r44680): Typing is suprisingly slow in password field on reddit.com
+ https://bugs.webkit.org/show_bug.cgi?id=26959
+ rdar://problem/7029882
+
+ The code to handle iteration boundaries was malfunctioning when the boundary was
+ at the edge of a shadow tree. This happens all the time with <input> elements.
+
+ It's not immediately obvious how to make a regression test for this since the
+ symptom was a performance problem, not incorrect behavior. I'll add a test if I
+ figure out a way to make one.
+
+ * editing/TextIterator.cpp:
+ (WebCore::parentCrossingShadowBoundaries): Renamed from parentOrShadowParent.
+ (WebCore::depthCrossingShadowBoundaries): Updated for name change.
+ (WebCore::nextInPreOrderCrossingShadowBoundaries): Added.
+ (WebCore::previousInPostOrderCrossingShadowBoundaries): Added.
+ (WebCore::setUpFullyClippedStack): Updated for name change.
+ (WebCore::TextIterator::TextIterator): Updated for name change. Use
+ nextInPreOrderCrossingShadowBoundaries instead of Range::pastLastNode to fix the bug.
+ (WebCore::TextIterator::advance): Updated for name change.
+ (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
+ Tweaked formatting.
+ (WebCore::SimplifiedBackwardsTextIterator::advance): Ditto. Changed code that
+ initializes m_pastStartNode to use previousInPostOrderCrossingShadowBoundaries.
+ (WebCore::SimplifiedBackwardsTextIterator::handleNonTextNode): Tweaked formatting.
+ (WebCore::SimplifiedBackwardsTextIterator::exitNode): Ditto.
+
+2009-07-03 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Background audio stops playing when JS GC runs
+ https://bugs.webkit.org/show_bug.cgi?id=26956
+
+ Ensure we keep the Audio object around while it is playing, so that it
+ doesn't get collected.
+
+ Not testable because there's no way to know whether the audio keeps
+ playing without holding a reference to it.
+
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::isObservableThroughDOM):
+
+2009-07-02 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Jan Alonzo.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26814
+ [Gtk] Caret-moved events are not issued for the correct offset
+ when text is selected forward
+
+ Report the caret offset from the end of the selection, otherwise
+ we'll report the same offset when moving the caret while
+ modififying the selection (eg, with Shift + Right).
+
+ * editing/gtk/SelectionControllerGtk.cpp:
+ (WebCore::SelectionController::notifyAccessibilityForSelectionChange):
+
+2009-07-02 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Jan Alonzo.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26815
+ [Gtk] text-selection-changed events are not issued for the correct
+ object when the selection spans multiple objects
+
+ Get the focused node from the end of the selection, not the start,
+ so we can detect when we cross object boundaries.
+
+ * editing/gtk/SelectionControllerGtk.cpp:
+ (WebCore::SelectionController::notifyAccessibilityForSelectionChange):
+
+2009-07-02 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26947
+
+ Fix the media controls hit tests. They may lose click events.
+
+ Test cases already covered in the video-controls-zoomed tests.
+
+ Don't trust wkHitTestMediaUIPart for the tests. We are accurate enough.
+
+ * rendering/RenderThemeMac.h: Remove hitTestMediaControlPart.
+ * rendering/RenderThemeMac.mm: Remove hitTestMediaControlPart.
+
+2009-07-02 Roland Steiner <rolandsteiner@google.com>
+
+ Reviewed by Eric Seidel.
+
+ RenderBlock and RenderInline have confusingly named object creation methods:
+ RenderBlock::createRootBox/createRootInlineBox
+ RenderInline::createFlowBox/createInlineFlowBox
+ where the 2nd method in both cases just calls the first and then appends the created object.
+ I therefore renamed those methods to something IMHO more informative:
+
+ createRootBox() -> createRootInlineBox()
+ createRootInlineBox() -> createAndAppendRootInlineBox();
+ createFlowBox() -> createInlineFlowBox();
+ createInlineFlowBox() -> createAndAppendInlineFlowBox();
+
+ https://bugs.webkit.org/show_bug.cgi?id=26828
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::createRootInlineBox):
+ (WebCore::RenderBlock::createAndAppendRootInlineBox):
+ * rendering/RenderBlock.h:
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::createInlineFlowBox):
+ (WebCore::RenderInline::createAndAppendInlineFlowBox):
+ * rendering/RenderInline.h:
+ * rendering/RenderSVGInline.cpp:
+ (WebCore::RenderSVGInline::createInlineFlowBox):
+ * rendering/RenderSVGInline.h:
+ * rendering/RenderSVGText.cpp:
+ (WebCore::RenderSVGText::createRootInlineBox):
+ * rendering/RenderSVGText.h:
+ * rendering/bidi.cpp:
+ (WebCore::createInlineBoxForRenderer):
+
+2009-07-02 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ WebInspector: Fix typo in the resource panel enabler caption.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26753
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/ResourcesPanel.js:
+ (WebInspector.ResourcesPanel):
+
+2009-07-02 Erik Arvidsson <arv@chromium.org>
+
+ Reviewed by Adam Roben.
+
+ [Win] HTML5 Drag and drop, dragend is not fired when pressing Esc
+ https://bugs.webkit.org/show_bug.cgi?id=26699
+
+ * manual-tests/drag-escape.html: Added.
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::dragSourceEndedAt):
+
+2009-07-02 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26944
+
+ Make sure we support full page zoom in video controls.
+
+ This is tracked by a the video-controls-zoom test case.
+
+ * css/mediaControlsQT.css: Make sure we don't have any inherited margin.
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlElement::updateStyle): Propagate the style to the innertext.
+ * rendering/RenderThemeMac.mm: Adjust the painting rect.
+ (WebCore::getUnzoomedRectAndAdjustCurrentContext):
+ (WebCore::RenderThemeMac::paintMediaSliderTrack):
+ (WebCore::RenderThemeMac::paintMediaCurrentTime):
+ (WebCore::RenderThemeMac::paintMediaTimeRemaining):
+
+2009-07-02 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Fix the Gtk build after r45474. The localized strings should
+ have been added there.
+
+ * platform/gtk/LocalizedStringsGtk.cpp:
+ (WebCore::mediaElementLoadingStateText):
+ (WebCore::mediaElementLiveBroadcastStateText):
+
+2009-07-02 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26939
+
+ Media controller is rendered badly at http://www.mozilla.com/en-US/firefox/video/firefox-3.5.html
+
+ We fix two things:
+ - We use px instead of em, because px is used everywhere else
+ and because 0.09em hit the font size limit.
+ - We use -webkit-box instead of inline-block because in strict mode
+ inline-block has a different behavior.
+
+ Test: media/controls-strict.html
+
+ * css/mediaControlsQT.css:
+
+2009-07-02 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ TextIterator should use hasOverflowClip when checking for overflow instead of looking at the style.
+ https://bugs.webkit.org/show_bug.cgi?id=26942
+
+ * editing/TextIterator.cpp:
+ (WebCore::fullyClipsContents):
+
+2009-07-02 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dave Hyatt.
+
+ Fix for <rdar://problem/5230700>
+ Remove local .xhtml file workaround
+
+ * platform/network/mac/ResourceResponseMac.mm:
+ (WebCore::ResourceResponse::platformLazyInit): Work around is no longer necessary.
+
+2009-07-02 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Sort, add functions used by WebKit.
+
+ * WebCore.base.exp:
+
+2009-07-02 Brady Eidson <beidson@apple.com>
+
+ Rubberstamped by Sam Weinig.
+
+ More of <rdar://problem/6969425> Safari 4.0 doesn't recognize text/plain files if their extension is unknown.
+
+ * platform/network/mac/WebCoreURLResponse.mm:
+ (webNSURLResponseMIMEType): Give Tiger a chance to query the UTI machinery.
+
+2009-07-02 Adam Langley <agl@google.com>
+
+ Reviewed by Eric Seidel.
+
+ Chromium Linux: fix complex text rendering with line break characters.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26935
+
+ If the CSS white-space property is inhibiting line breaking, we might
+ find end-of-line characters rendered via the complex text path. Fonts
+ don't provide glyphs for these code points so, if we find one, we
+ simulate the space glyph being interposed in this case. Because the
+ input is variable-length per code point, we walk the input in step
+ with the output.
+
+ Covered by:
+ LayoutTests/fast/text/international/bidi-linebreak-002.html
+ LayoutTests/fast/text/international/bidi-linebreak-003.html
+ LayoutTests/fast/text/international/hindi-whitespace.html
+
+ * platform/graphics/chromium/HarfbuzzSkia.cpp:
+ (WebCore::stringToGlyphs):
+
+2009-07-02 Victor Wang <victorw@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26521
+ Expose file size to chromium.
+
+ Implement getFileSize() for Chromium.
+
+ * platform/chromium/ChromiumBridge.h:
+ * platform/chromium/FileSystemChromium.cpp:
+ (WebCore::getFileSize):
+
+2009-07-02 Nate Chapin <japhet@chromium.org>
+
+ Unreviewed, build fix.
+
+ * bindings/v8/V8SVGPODTypeWrapper.h: Lost a space in nested template argument list.
+
+2009-07-02 Simon Fraser <simon.fraser@apple.com>
+
+ Build fix: add missing #include.
+
+ * platform/mac/ThemeMac.mm:
+
+2009-07-02 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ <rdar://problem/7028682> ThemeMac::paintRadio() throws Obj-C exceptions when zoomed
+
+ Add BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS guards around code
+ that can possibly throw Objective-C exceptions when drawing Mac form controls.
+
+ * platform/mac/ThemeMac.mm:
+ (WebCore::paintCheckbox):
+ (WebCore::paintRadio):
+ (WebCore::paintButton):
+ (WebCore::ThemeMac::inflateControlPaintRect):
+
+2009-07-02 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by David Levin.
+
+ Upstream V8SVGPODTypeWrapper.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26907
+
+ * bindings/scripts/CodeGeneratorV8.pm: Update function being renamed in V8SVGPODTypeWrapper.h.
+ * bindings/v8/V8SVGPODTypeWrapper.h: Upstreamed from src.chromium.org.
+
+2009-07-02 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Adds an abstraction layer between the DB classes and the file
+ system, which allows us to add our own logic for storing, opening,
+ deleting, etc. databases.
+
+ The patch was tested using the tests in WebCore/storage.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26054
+
+ * GNUmakefile.am:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/sql/SQLiteDatabase.cpp:
+ (WebCore::SQLiteDatabase::open): Delegating the job of opening DB files to SQLiteFileSystem to allow use of custom VFSs.
+ * platform/sql/SQLiteFileSystem.cpp: Added.
+ * platform/sql/SQLiteFileSystem.h: Added.
+ * platform/win/FileSystemWin.cpp:
+ (WebCore::directoryName): Implemented.
+ * storage/Database.cpp:
+ (WebCore::Database::databaseSize): The code that returns the size of a DB file moved to SQLiteFileSystem.
+ * storage/DatabaseTracker.cpp:
+ (WebCore::DatabaseTracker::DatabaseTracker): Added the ability to register a custom SQLite VFS.
+ (WebCore::DatabaseTracker::trackerDatabasePath): DB file-related operations moved to SQLiteFileSystem.
+ (WebCore::DatabaseTracker::openTrackerDatabase): DB file-related operations moved to SQLiteFileSystem.
+ (WebCore::DatabaseTracker::originPath): DB file-related operations moved to SQLiteFileSystem.
+ (WebCore::DatabaseTracker::fullPathForDatabase): DB file-related operations moved to SQLiteFileSystem.
+ (WebCore::DatabaseTracker::usageForDatabase): DB file-related operations moved to SQLiteFileSystem.
+ (WebCore::DatabaseTracker::deleteOrigin): DB file-related operations moved to SQLiteFileSystem.
+ (WebCore::DatabaseTracker::deleteDatabaseFile): DB file-related operations moved to SQLiteFileSystem.
+ * storage/OriginUsageRecord.cpp:
+ (WebCore::OriginUsageRecord::diskUsage): DB file-related operations moved to SQLiteFileSystem.
+
+2009-07-02 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Always clip replaced elements to border radii.
+ https://bugs.webkit.org/show_bug.cgi?id=26933
+
+ Make sure to always clip replaced elements to border radii, even when overflow is visible.
+ Stop defaulting those elements to overflow:hidden in the UA sheet, since it is now no longer
+ necessary.
+
+ Covered by existing tests (since the UA default changing keeps the behavior exactly the same).
+
+ * css/html.css:
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::paint):
+ * rendering/RenderWidget.cpp:
+ (WebCore::RenderWidget::paint):
+
+2009-07-02 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Simon Fraser.
+
+ convertFromScrollbarToContainingView and friends should be in ScrollView
+ https://bugs.webkit.org/show_bug.cgi?id=26929
+
+ This is breaking Chromium's build because PopupMenuChromium inherits
+ from ScrollView, but these functions are pure virtual in it. I could
+ put it directly in PopupMenuChromium, but that seems a bit silly since
+ the functions are fairly generic.
+
+ Passes existing layout tests.
+
+ * page/FrameView.cpp: Remove the 4 functions Hyatt just added
+ (IntRect WebCore::FrameView::convertFromScrollbarToContainingView):
+ (IntRect WebCore::FrameView::convertFromContainingViewToScrollBar):
+ (IntPoint WebCore::FrameView::convertFromScrollbarToContainingView):
+ (IntPoint WebCore::FrameView::convertFromContainingViewToScrollBar):
+ * page/FrameView.h: ditto
+ * platform/ScrollView.cpp: Move the 4 functions from FrameView here
+ (IntRect WebCore::ScrollView::convertFromScrollbarToContainingView):
+ (IntRect WebCore::ScrollView::convertFromContainingViewToScrollBar):
+ (IntPoint WebCore::ScrollView::convertFromScrollbarToContainingView):
+ (IntPoint WebCore::ScrollView::convertFromContainingViewToScrollBar):
+ * platform/ScrollView.h: ditto
+
+2009-07-02 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Fix https://bugs.webkit.org/show_bug.cgi?id=26088 - TransparencyWin
+ doesn't handle errors well at all; revise it to fail silently
+ (drawing nothing), and bulletproof FontChromiumWin to handle the
+ failure accordingly.
+
+ Tests: fast/text/text-large-negative-letter-spacing-with-opacity.html
+ fast/text/text-letter-spacing.html
+
+ * platform/graphics/chromium/FontChromiumWin.cpp:
+ (WebCore::TransparencyAwareFontPainter::TransparencyAwareFontPainter::initializeForGDI):
+ (WebCore::TransparencyAwareFontPainter::TransparencyAwareFontPainter::~TransparencyAwareFontPainter):
+ (WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::TransparencyAwareGlyphPainter):
+ (WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::~TransparencyAwareGlyphPainter):
+ (WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::drawGlyphs):
+ (WebCore::Font::drawGlyphs):
+ (WebCore::Font::drawComplexText):
+ * platform/graphics/chromium/TransparencyWin.cpp:
+ (WebCore::TransparencyWin::TransparencyWin):
+ (WebCore::TransparencyWin::setupLayerForNoLayer):
+ (WebCore::TransparencyWin::setupLayerForOpaqueCompositeLayer):
+ (WebCore::TransparencyWin::setupLayerForWhiteLayer):
+ (WebCore::TransparencyWin::setupTransformForKeepTransform):
+ (WebCore::TransparencyWin::setupTransformForScaleTransform):
+ (WebCore::TransparencyWin::initializeNewContext):
+ (WebCore::TransparencyWin::compositeOpaqueComposite):
+ (WebCore::TransparencyWin::compositeTextComposite):
+ (WebCore::TransparencyWin::makeLayerOpaque):
+ * platform/graphics/chromium/TransparencyWin.h:
+ (WebCore::TransparencyWin::platformContext):
+
+2009-07-02 Eric Carlson <eric.carlson@apple.com>
+
+ Change #import to #include to fix non-ObjC builds.
+
+ * rendering/MediaControlElements.cpp:
+
+2009-07-02 Anders Carlsson <andersca@apple.com>
+
+ Build fix.
+
+ * platform/network/mac/WebCoreURLResponse.mm:
+ (mimeTypeFromUTITree):
+
+2009-07-02 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Fix for bug 22119, clicks in the scrollbars of transformed content don't work. Add new
+ conversion methods for going across parent/child widget boundaries that can be implemented
+ by the FrameView and ScrollbarClient to be transform-aware.
+
+ Test cases added in platform/mac/fast/forms and platform/mac/fast/overflow.
+
+ * WebCore.base.exp:
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleMouseMoveEvent):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::convertFromScrollbarToContainingView):
+ (WebCore::FrameView::convertFromContainingViewToScrollbar):
+ (WebCore::FrameView::convertFromRenderer):
+ (WebCore::FrameView::convertToRenderer):
+ (WebCore::FrameView::convertToContainingView):
+ (WebCore::FrameView::convertFromContainingView):
+ * page/FrameView.h:
+ * platform/ScrollView.h:
+ * platform/Scrollbar.cpp:
+ (WebCore::Scrollbar::convertToContainingView):
+ (WebCore::Scrollbar::convertFromContainingView):
+ * platform/Scrollbar.h:
+ * platform/ScrollbarClient.h:
+ (WebCore::ScrollbarClient::convertFromScrollbarToContainingView):
+ (WebCore::ScrollbarClient::convertFromContainingViewToScrollbar):
+ * platform/Widget.cpp:
+ (WebCore::Widget::convertFromContainingWindow):
+ (WebCore::Widget::convertToContainingWindow):
+ (WebCore::Widget::convertFromRootToContainingWindow):
+ (WebCore::Widget::convertFromContainingWindowToRoot):
+ (WebCore::Widget::convertToContainingView):
+ (WebCore::Widget::convertFromContainingView):
+ * platform/Widget.h:
+ * platform/graphics/IntPoint.h:
+ (WebCore::IntPoint::move):
+ * platform/mac/WidgetMac.mm:
+ (WebCore::Widget::convertFromRootToContainingWindow):
+ (WebCore::Widget::convertFromContainingWindowToRoot):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::isPointInOverflowControl):
+ * rendering/RenderDataGrid.cpp:
+ (WebCore::RenderDataGrid::convertFromScrollbarToContainingView):
+ (WebCore::RenderDataGrid::convertFromContainingViewToScrollbar):
+ * rendering/RenderDataGrid.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::convertFromScrollbarToContainingView):
+ (WebCore::RenderLayer::convertFromContainingViewToScrollbar):
+ (WebCore::RenderLayer::scrollbarOffset):
+ (WebCore::RenderLayer::hitTestOverflowControls):
+ * rendering/RenderLayer.h:
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::isPointInOverflowControl):
+ (WebCore::RenderListBox::convertFromScrollbarToContainingView):
+ (WebCore::RenderListBox::convertFromContainingViewToScrollbar):
+ * rendering/RenderListBox.h:
+
+2009-07-02 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Dave Hyatt and Simon Fraser.
+
+ - fix <rdar://problem/6933052> SPOD playing video in a div with a box
+ shadow
+
+ Test: fast/box-shadow/transform-fringing.html
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintBoxShadow): Clip out the
+ box even if it has an opaque background, but in that case, inset the
+ clip path by 1 pixel, to avoid antialiasing artifacts.
+ Do not inset the clip rect by 1 pixel if the CTM is purely a
+ translation.
+ Move the shadow-casting path away in the non-rounded-rect case (it
+ was already being done in the rounded-rect case), to avoid a black
+ fringe when the CTM is not purely a translation.
+
+2009-07-02 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/6969425> Safari 4.0 doesn't recognize text/plain files if their extension is unknown.
+
+ Walk the CoreTypes UTI tree for extensions with unknown MIME types, using the first MIME type found.
+
+ For many types of text files (such as source code files) this ends up being text/plain.
+
+ * platform/network/mac/ResourceHandleMac.mm:
+ (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Tweak the logging output.
+
+ * platform/network/mac/WebCoreURLResponse.h:
+ * platform/network/mac/WebCoreURLResponse.mm:
+ (mimeTypeFromUTITree):
+ (webNSURLResponseMIMEType): Use mimeTypeFromUTITree() to find a UTI-based MIME type for this file's extension.
+ (-[NSURLResponse _webcore_reportedMIMEType]): Return the actual MIME type that CFNetwork gave us.
+
+2009-07-02 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/6518119>
+
+ Add a rewind button and hide the timeline for live broadcasts when
+ in MediaUI mode.
+
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Add the new pseudo element.
+
+ * css/CSSSelector.cpp:
+ (WebCore::CSSSelector::extractPseudoType): Ditto.
+ * css/CSSSelector.h:
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Ditto.
+
+ * css/CSSValueKeywords.in: Ditto.
+ * css/mediaControls.css: Ditto.
+ * css/mediaControlsQT.css: Ditto.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::rewind): New.
+ (WebCore::HTMLMediaElement::returnToRealTime): New.
+ (WebCore::HTMLMediaElement::isStreaming): New.
+ * html/HTMLMediaElement.h:
+
+ * page/mac/WebCoreViewFactory.h: Declare mediaElementLoadingStateText and mediaElementLiveBroadcastStateText.
+
+ * platform/LocalizedStrings.h: Add localized media state messages.
+
+ * platform/ThemeTypes.h: Add the new pseudo element.
+
+ * platform/mac/LocalizedStringsMac.mm:
+ (WebCore::mediaElementLoadingStateText): Add localized media state.
+ (WebCore::mediaElementLiveBroadcastStateText): Ditto.
+
+ * platform/mac/WebCoreSystemInterface.h: Change BOOL param wkDrawMediaUIPart to an int to support
+ multiple states.
+ * platform/mac/WebCoreSystemInterface.mm: Ditto.
+
+ * rendering/MediaControlElements.cpp:
+ (WebCore::MediaControlElement::MediaControlElement): Deal with new elements.
+ (WebCore::MediaControlElement::attachToParent): Ditto.
+ (WebCore::MediaControlElement::update): Ditto.
+ (WebCore::MediaControlElement::updateStyle): Ditto.
+ (WebCore::MediaControlTimelineContainerElement::MediaControlTimelineContainerElement): Ditto.
+ (WebCore::MediaControlTimelineContainerElement::rendererIsNeeded): Ditto.
+ (WebCore::MediaControlStatusDisplayElement::MediaControlStatusDisplayElement): Ditto.
+ (WebCore::MediaControlStatusDisplayElement::update): Ditto.
+ (WebCore::MediaControlStatusDisplayElement::rendererIsNeeded): Ditto.
+ (WebCore::MediaControlInputElement::MediaControlInputElement): Ditto.
+ (WebCore::MediaControlInputElement::attachToParent): Ditto.
+ (WebCore::MediaControlInputElement::updateStyle): Ditto.
+ (WebCore::MediaControlRewindButtonElement::MediaControlRewindButtonElement): Ditto.
+ (WebCore::MediaControlRewindButtonElement::defaultEventHandler): Ditto.
+ (WebCore::MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement): Ditto.
+ (WebCore::MediaControlReturnToRealtimeButtonElement::defaultEventHandler): Ditto.
+ (WebCore::MediaControlReturnToRealtimeButtonElement::rendererIsNeeded): Ditto.
+ (WebCore::MediaControlTimelineElement::defaultEventHandler): Ditto.
+ (WebCore::MediaControlTimelineElement::update): Ditto.
+ (WebCore::MediaControlFullscreenButtonElement::rendererIsNeeded): Ditto.
+ * rendering/MediaControlElements.h: Ditto.
+
+ * rendering/RenderMedia.cpp:
+ (WebCore::RenderMedia::styleDidChange): Deal with the new elements.
+ (WebCore::RenderMedia::createPanel): Ditto.
+ (WebCore::RenderMedia::createRewindButton): Ditto.
+ (WebCore::RenderMedia::createReturnToRealtimeButton): Ditto.
+ (WebCore::RenderMedia::createStatusDisplay): Ditto.
+ (WebCore::RenderMedia::createTimelineContainer): Ditto.
+ (WebCore::RenderMedia::createCurrentTimeDisplay): Ditto.
+ (WebCore::RenderMedia::createTimeRemainingDisplay): Ditto.
+ (WebCore::RenderMedia::updateControls): Ditto.
+ (WebCore::RenderMedia::forwardEvent): Ditto.
+ * rendering/RenderMedia.h:
+
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::paint): Deal with the new elements.
+
+ * rendering/RenderTheme.h:
+ (WebCore::RenderTheme::paintMediaRewindButton): Deal with the new elements.
+ (WebCore::RenderTheme::paintMediaReturnToRealtimeButton): Ditto.
+ (WebCore::RenderTheme::paintMediaControlsBackground): Ditto.
+
+ * rendering/RenderThemeMac.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::paintMediaRewindButton): Deal with the new elements.
+ (WebCore::RenderThemeMac::paintMediaReturnToRealtimeButton): Ditto.
+ (WebCore::RenderThemeMac::paintMediaControlsBackground): Ditto.
+
+ * rendering/style/RenderStyleConstants.h: Add constants for the new elements.
+
+2009-07-01 John Abd-El-Malek <jam@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Small refactoring of MessagePortChannel so that PlatformMessagePortChannel
+ may be defined at the WebKit layer.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26905
+
+ * dom/MessageChannel.cpp:
+ (WebCore::MessageChannel::MessageChannel):
+ * dom/MessagePortChannel.cpp:
+ * dom/MessagePortChannel.h:
+ * dom/default/PlatformMessagePortChannel.cpp:
+ (WebCore::MessagePortChannel::createChannel):
+ (WebCore::MessagePortChannel::create):
+ (WebCore::MessagePortChannel::MessagePortChannel):
+ (WebCore::MessagePortChannel::~MessagePortChannel):
+
+2009-07-01 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ <video> fails to show on http://camendesign.com/code/video_for_everybody
+ <rdar://problem/7026010>
+ https://bugs.webkit.org/show_bug.cgi?id=26919
+
+ Fix an issue introduced in r44961. In that revision we changed to only update
+ compositing layer geometry when all siblings had been laid out (i.e. we pushed
+ the updates one level down). However, that left out the root layer, so this
+ fix ensures that the root layer geometry gets updated at the end.
+
+ Test: compositing/geometry/root-layer-update.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateAfterLayout):
+
+2009-07-01 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein
+
+ <rdar://problem/7026010> <video> fails to show on http://camendesign.com/code/video_for_everybody
+
+ First part of fix: when outline width changes, don't to a synchronous
+ layer update right away, but just set the flag to say that compositing
+ layers need updating. The synchronous layer update left the layer geometries
+ out of whack when it happened in the middle of layout (e.g. when inside ::first-letter).
+
+ Test: compositing/geometry/outline-change.html
+
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::setMaximalOutlineSize):
+
+2009-07-01 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26842
+ Build fix when ENABLE_DATABASE is off
+
+ Move Database.h into ENABLE(DATABASE) guard so toggling ENABLE_DATABASE
+ off does not break builds.
+
+ * bindings/js/ScriptObjectQuarantine.cpp:
+
+2009-07-01 Daniel Bates <dbates@intudata.com>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26899
+
+ Modified XSSAuditor::decodeURL to only remove null characters so that
+ it is consistent with the behavior of HTMLTokenizer and prevents
+ injected scripts that contain control characters.
+
+ Tests: http/tests/security/xssAuditor/script-tag-control-char.html
+ http/tests/security/xssAuditor/script-tag-null-char.html
+
+ * page/XSSAuditor.cpp:
+ (WebCore::XSSAuditor::decodeURL): Modified to only remove null characters.
+ * page/XSSAuditor.h: Reverted naming of third argument of method XSSAuditor::decodeURL
+ from allowControlCharacters back to allowNullCharacters.
+ * platform/network/ResourceResponseBase.cpp: Reverted back to rev #45003.
+ (WebCore::isControlCharacter):
+ * platform/network/ResourceResponseBase.h: Reverted back to rev #45003.
+
+2009-07-01 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ - supported keyboard shortcuts compatible with Firebug in Scripts Debugger:
+ F5, Ctrl+/ (win,lin), Command+/ (mac) - continue
+ F10, Ctrl+' (win, lin), Command+' (mac) - step over
+ F11, Ctrl+; (win, lin), Command+; (mac) - step into
+ Shift+F11, Ctrl+Shift+; (win, lin), Command+Shift+; (mac) - step out
+
+ - added call stack navigation shortcuts:
+ Ctrl+. - next call frame
+ Ctrl+, - previouse call frame
+
+ https://bugs.webkit.org/show_bug.cgi?id=23849
+
+ * inspector/front-end/CallStackSidebarPane.js:
+ (WebInspector.CallStackSidebarPane):
+ (WebInspector.CallStackSidebarPane.prototype.handleKeyEvent):
+ (WebInspector.CallStackSidebarPane.prototype._selectNextCallFrameOnStack):
+ (WebInspector.CallStackSidebarPane.prototype._selectPreviousCallFrameOnStack):
+ (WebInspector.CallStackSidebarPane.prototype._selectedPlacardByIndex):
+ (WebInspector.CallStackSidebarPane.prototype._selectedCallFrameIndex):
+ * inspector/front-end/KeyboardShortcut.js: Added.
+ (WebInspector.KeyboardShortcut):
+ (WebInspector.KeyboardShortcut.makeKey):
+ (WebInspector.KeyboardShortcut.makeKeyFromEvent):
+ (WebInspector.KeyboardShortcut.makeKeyFromCodeAndModifiers_):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel):
+ (WebInspector.ScriptsPanel.prototype.handleKeyEvent):
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/inspector.html:
+
+2009-07-01 Daniel Erat <derat@google.com>
+
+ Reviewed by David Levin.
+
+ Chromium Linux: Move the scrollbar thumb on middle-click.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26910
+ http://code.google.com/p/chromium/issues/detail?id=11976
+
+ Tested by building Chrome and checking that the scrollbar moves as expected.
+
+ * platform/chromium/ScrollbarThemeChromium.cpp:
+ * platform/chromium/ScrollbarThemeChromium.h:
+ * platform/chromium/ScrollbarThemeChromiumLinux.cpp:
+ * platform/chromium/ScrollbarThemeChromiumLinux.h:
+ * platform/chromium/ScrollbarThemeChromiumWin.cpp:
+ * platform/chromium/ScrollbarThemeChromiumWin.h:
+
+2009-07-01 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add a preference/setting to toggle whether content sniffing is enabled for file URLs.
+
+ * WebCore.base.exp:
+
+ * page/Settings.cpp:
+ (WebCore::Settings::setLocalFileContentSniffingEnabled):
+ * page/Settings.h:
+ (WebCore::Settings::localFileContentSniffingEnabled):
+
+ * platform/network/mac/ResourceHandleMac.mm:
+ (WebCore::ResourceHandle::start):
+ (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
+
+2009-07-01 Chris Fleizach <cfleizach@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 26909: aria-label needs to be supported
+ https://bugs.webkit.org/show_bug.cgi?id=26909
+
+ Test: accessibility/aria-label.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::accessibilityDescription):
+ * html/HTMLAttributeNames.in:
+
+2009-07-01 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ More datagrid columns work. Make sure columns cache both a style for the column header as well
+ as a style for the column background (behind the cells).
+
+ Hook up to CSSStyleSelector methods for obtaining the pseudo styles for columns (stubbed out and
+ unimplemented).
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::pseudoStyleForDataGridColumn):
+ (WebCore::CSSStyleSelector::pseudoStyleForDataGridColumnHeader):
+ * css/CSSStyleSelector.h:
+ * html/DataGridColumn.h:
+ (WebCore::DataGridColumn::setColumnList):
+ (WebCore::DataGridColumn::columnStyle):
+ (WebCore::DataGridColumn::setColumnStyle):
+ (WebCore::DataGridColumn::headerStyle):
+ (WebCore::DataGridColumn::setHeaderStyle):
+ * rendering/RenderDataGrid.cpp:
+ (WebCore::RenderDataGrid::recalcStyleForColumn):
+ (WebCore::RenderDataGrid::columnStyle):
+ (WebCore::RenderDataGrid::headerStyle):
+ (WebCore::RenderDataGrid::paintColumnHeaders):
+ * rendering/RenderDataGrid.h:
+
+2009-07-01 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/7009870> After <audio> movie finishes playing, Pause button fails to change
+ back to Play button
+
+ Grab onto the current time when QTKit "ended" notification fires and use it as
+ duration from that point on as QuickTime sometimes refuses to play all the way to
+ the time it reports for duration and buffered. HTMLMediaElement assumes that there
+ more to play in this situation and tries to restart playback, endlessly.
+
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+ Rename m_duration to m_reportedDuration. Declare m_cachedDuration.
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
+ Rename m_duration to m_reportedDuration. Initialize m_cachedDuration.
+ (WebCore::MediaPlayerPrivate::duration):
+ Return m_cachedDuration once it has been set.
+ (WebCore::MediaPlayerPrivate::updateStates):
+ Rename m_duration to m_reportedDuration.
+ (WebCore::MediaPlayerPrivate::didEnd):
+ Set m_cachedDuration to currentTime().
+
+2009-07-01 Chris Fleizach <cfleizach@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Bug 26900: AX: Manual spell check with Command-; does not bring up suggestions
+ https://bugs.webkit.org/show_bug.cgi?id=26900
+
+ Editable web areas should have a clickpoint that uses where the selection is.
+
+ Test: accessibility/editable-webarea-context-menu-point.html
+
+ * accessibility/AccessibilityObject.h:
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::clickPoint):
+ * accessibility/AccessibilityRenderObject.h:
+ * accessibility/mac/AccessibilityObjectWrapper.mm:
+ (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
+
+2009-07-01 David Levin <levin@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Remove unused code in SVGTransformList and SVGTransformDistance
+ <https://bugs.webkit.org/show_bug.cgi?id=26891>
+
+ * svg/SVGTransformDistance.cpp:
+ (WebCore::SVGTransformDistance::SVGTransformDistance):
+ * svg/SVGTransformList.cpp:
+ * svg/SVGTransformList.h:
+
+2009-07-01 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Begin stubbing out functions for layout, painting and style/geometry caching on columns. Not enough
+ is implemented for this to do much of anything yet, but it should help keep patch sizes down. :)
+
+ * html/DataGridColumn.cpp:
+ (WebCore::DataGridColumn::columnChanged):
+ * html/DataGridColumn.h:
+ (WebCore::DataGridColumn::setId):
+ (WebCore::DataGridColumn::setLabel):
+ (WebCore::DataGridColumn::setType):
+ (WebCore::DataGridColumn::setSortable):
+ (WebCore::DataGridColumn::setSortDirection):
+ (WebCore::DataGridColumn::setColumnList):
+ (WebCore::DataGridColumn::style):
+ (WebCore::DataGridColumn::setStyle):
+ (WebCore::DataGridColumn::rect):
+ (WebCore::DataGridColumn::setRect):
+ * html/DataGridColumnList.cpp:
+ (WebCore::DataGridColumnList::DataGridColumnList):
+ (WebCore::DataGridColumnList::setDataGridNeedsLayout):
+ (WebCore::DataGridColumnList::add):
+ (WebCore::DataGridColumnList::remove):
+ (WebCore::DataGridColumnList::move):
+ (WebCore::DataGridColumnList::clear):
+ (WebCore::DataGridColumnList::primaryColumnChanged):
+ * html/DataGridColumnList.h:
+ (WebCore::DataGridColumnList::create):
+ (WebCore::DataGridColumnList::dataGrid):
+ (WebCore::DataGridColumnList::clearDataGrid):
+ * html/HTMLDataGridColElement.cpp:
+ (WebCore::HTMLDataGridColElement::HTMLDataGridColElement):
+ (WebCore::HTMLDataGridColElement::findDataGridAncestor):
+ (WebCore::HTMLDataGridColElement::insertedIntoTree):
+ (WebCore::HTMLDataGridColElement::removedFromTree):
+ * html/HTMLDataGridColElement.h:
+ (WebCore::HTMLDataGridColElement::dataGrid):
+ * html/HTMLDataGridElement.cpp:
+ (WebCore::HTMLDataGridElement::HTMLDataGridElement):
+ (WebCore::HTMLDataGridElement::~HTMLDataGridElement):
+ * rendering/RenderDataGrid.cpp:
+ (WebCore::RenderDataGrid::styleDidChange):
+ (WebCore::RenderDataGrid::recalcStyleForColumns):
+ (WebCore::RenderDataGrid::recalcStyleForColumn):
+ (WebCore::RenderDataGrid::styleForColumn):
+ (WebCore::RenderDataGrid::layout):
+ (WebCore::RenderDataGrid::layoutColumns):
+ (WebCore::RenderDataGrid::paintColumnHeaders):
+ (WebCore::RenderDataGrid::paintColumnHeader):
+ * rendering/RenderDataGrid.h:
+ (WebCore::RenderDataGrid::renderName):
+ (WebCore::RenderDataGrid::canHaveChildren):
+
+2009-07-01 Daniel Bates <dbates@intudata.com>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26807
+
+ Fixes this address by checking whether frame->document()->decoder() is null.
+
+ * page/XSSAuditor.cpp:
+ (WebCore::XSSAuditor::findInRequest):
+
+2009-07-01 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Fixes: https://bugs.webkit.org/show_bug.cgi?id=26885
+
+ Correctly reset history length to '0', not '1'. Old relict from early WML days.
+ Add some new WML testcases covering the use of history length (by onenterforward event handling)
+
+ Tests: wml/onenterforward-event.html
+ wml/onenterforward-inline-event.html
+ wml/ontimer-event.html
+
+ * wml/WMLPageState.cpp:
+ (WebCore::WMLPageState::reset):
+
+2009-07-01 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Make sure setting attributes on dcol elements properly updates the corresponding DataGridColumn object.
+
+ Added new test in fast/dom/HTMLDataGridElement.
+
+ * html/HTMLDataGridColElement.cpp:
+ (WebCore::HTMLDataGridColElement::parseMappedAttribute):
+ * html/HTMLDataGridColElement.h:
+
+2009-07-01 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ <rdar://problem/6998524> REGRESSION (r44474): Form text field has focus ring, looks focused,
+ even though the field is not actually focused for keyboard input
+
+ Add the concept of whether or not the Page is focused by adding a boolean to the focusController. This allows the
+ focused frame and focused node to both be cached and changed programmatically even when the Page itself doesn't
+ actually happen to have focus at that time.
+
+ * WebCore.base.exp:
+ * page/FocusController.cpp:
+ (WebCore::FocusController::FocusController):
+ (WebCore::FocusController::setFocusedFrame):
+ (WebCore::FocusController::setFocused):
+ (WebCore::FocusController::setActive):
+ * page/FocusController.h:
+ (WebCore::FocusController::isFocused):
+
+2009-07-01 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Move some API headers from WebCore.pro to headers.pri so that they
+ get installed when running make install from the build directory.
+
+ * WebCore.pro:
+
+2009-07-01 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Rubber-stamped by Ariya Hidayat.
+
+ Ran WebKitTools/Scripts/generate-qt-inspector-resource to update the
+ qrc file with new png files from the web inspector.
+
+ * inspector/front-end/WebKit.qrc:
+
+2009-06-30 Mark Rowe <mrowe@apple.com>
+
+ Land some code that has a hope of compiling.
+
+ * platform/graphics/cg/ImageSourceCG.cpp:
+ (WebCore::imageSourceOptions):
+
+2009-06-30 Stephanie Lewis <slewis@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Flip back on block caching. Throwing away block data, while
+ a perceived memory win, is a performance hit in cases where we
+ are repainting large images (i.e. backgrounds) frequently
+ (i.e. a flash video playing on top).
+ <rdar://problem/6933515> REGRESSION(L-SL): Large JPEG images are
+ decoded on drawing, slowing down painting of sites that frequently
+ repaint e.g. because of Flash (pandora.com, Starcraft 2)
+
+ * platform/graphics/cg/ImageSourceCG.cpp:
+ (WebCore::imageSourceOptions):
+
+2009-06-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - Rename html4.css to html.css, since we target HTML5 now
+ https://bugs.webkit.org/show_bug.cgi?id=26873
+
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSStyleSelector.cpp:
+ (WebCore::loadFullDefaultStyle):
+ * css/html.css: Copied from css/html4.css.
+ * css/html4.css: Removed.
+ * css/themeWin.css:
+ * platform/Theme.h:
+ * platform/qt/RenderThemeQt.cpp:
+ (WebCore::RenderThemeQt::adjustMenuListButtonStyle):
+ * rendering/RenderTheme.h:
+
+2009-06-30 Zan Dobersek <zandobersek@gmail.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Drag and drop support
+ https://bugs.webkit.org/show_bug.cgi?id=23642
+
+ Define DragImageRef as GdkPixbuf and implement essential
+ functions which manipulate drag images.
+
+ * platform/DragImage.h:
+ * platform/gtk/DragImageGtk.cpp:
+ (WebCore::dragImageSize):
+ (WebCore::deleteDragImage):
+ (WebCore::scaleDragImage):
+ (WebCore::createDragImageFromImage):
+
+2009-06-30 Maxime Simon <simon.maxime@gmail.com>
+
+ Reviewed by Eric Seidel.
+
+ StorageNamespace.cpp build issue
+ https://bugs.webkit.org/show_bug.cgi?id=26859
+
+ Moved #endif //ENABLE(DOM_STORAGE) position
+ so that the build doesn't fail.
+ The namespace WebCore was started after the #if ENABLE(DOM_STORAGE)
+ but closed after the #endif.
+
+ * storage/StorageNamespace.cpp:
+
+2009-06-30 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/7020825> HTMLMediaElement should not assume seeking is only possible in
+ buffered time ranges
+
+ * html/HTMLMediaElement.cpp:
+ Don't ASSERT if the network state goes to Idle when when the ready state is
+ HaveEnoughData or higher, it is perfectly legal.
+ (WebCore::HTMLMediaElement::setReadyState):
+ Don't clear m_seeking after posting a 'seeking' event.
+
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivate::seek):
+ Do nothing when asked to seek to the same time we are already seeking to. Check requested
+ seek time against maxTimeSeekable, not maxTimeLoaded.
+ (WebCore::MediaPlayerPrivate::doSeek):
+ Don't bother stopping a movie that isn't playing. Minor cleanup to make the code more readable.
+ (WebCore::MediaPlayerPrivate::seekTimerFired):
+ Check requested seek time against maxTimeSeekable, not maxTimeLoaded.
+ (WebCore::MediaPlayerPrivate::updateStates):
+ A streaming movie has as much data as it needs once it reaches "playable", so
+ set the ready state to HaveFutureData. A movie with metadata doesn't drop back
+ to "have nothing" when seeking. A streaming movie doesn't use the network when paused.
+ (WebCore::MediaPlayerPrivate::timeChanged):
+ It may not be possible to seek to a specific time in a streamed movie but when seeking
+ in a streaming movie QuickTime sets the time to closest time possible and posts a
+ timechanged notification, so update m_seekTo so we can detect when the seek completes.
+
+2009-06-30 Steve Falkenburg <sfalken@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=26860
+
+ Reviewed by Sam Weinig.
+
+ Blacklist Yahoo Application State plug-in for versions prior to 1.0.0.6.
+ Earlier versions cause corruption crashes.
+
+ * plugins/win/PluginPackageWin.cpp:
+ (WebCore::PluginPackage::isPluginBlacklisted):
+
+2009-06-30 Dean Jackson <dino@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/7005207> <video> in canvas broken with ACCEL_COMPOSITING
+
+ Fix drawImage of video in CanvasRenderingContext2D when
+ accelerated compositing is enabled. This is done by
+ adding a new paint method to HTMLVideoElement that
+ is only called from canvas, which will create the software
+ renderer if necessary, but otherwise calls the regular
+ paint method. Meanwhile, add logic to the software video
+ renderer so that it can be created without calling repaint
+ every time it sees a new frame.
+
+ * html/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::drawImage):
+ * html/HTMLVideoElement.cpp:
+ (WebCore::HTMLVideoElement::paintCurrentFrameInContext):
+ * html/HTMLVideoElement.h:
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::paintCurrentFrameInContext):
+ * platform/graphics/MediaPlayer.h:
+ * platform/graphics/MediaPlayerPrivate.h:
+ (WebCore::MediaPlayerPrivateInterface::paintCurrentFrameInContext):
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivate::createQTMovie):
+ (WebCore::MediaPlayerPrivate::createQTVideoRenderer):
+ (WebCore::MediaPlayerPrivate::currentRenderingMode):
+ (WebCore::MediaPlayerPrivate::setUpVideoRendering):
+ (WebCore::MediaPlayerPrivate::tearDownVideoRendering):
+ (WebCore::MediaPlayerPrivate::paintCurrentFrameInContext):
+
+2009-06-30 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26858
+
+ Get <dcol> elements reflected into the datagrid's column list. Make sure columns get added/removed
+ properly. (Attribute changes are still not caught. That is coming in a separate patch.)
+
+ Added fast/dom/HTMLDataGridElement/DataGridColumns-dom.html
+
+ * html/DataGridColumn.h:
+ (WebCore::DataGridColumn::create):
+ (WebCore::DataGridColumn::setColumnList):
+ (WebCore::DataGridColumn::DataGridColumn):
+ * html/DataGridColumnList.cpp:
+ (WebCore::DataGridColumnList::add):
+ (WebCore::DataGridColumnList::remove):
+ (WebCore::DataGridColumnList::clear):
+ * html/DataGridColumnList.h:
+ * html/HTMLDataGridColElement.cpp:
+ (WebCore::HTMLDataGridColElement::HTMLDataGridColElement):
+ (WebCore::HTMLDataGridColElement::findDatagridAncestor):
+ (WebCore::HTMLDataGridColElement::ensureColumn):
+ (WebCore::HTMLDataGridColElement::insertedIntoTree):
+ (WebCore::HTMLDataGridColElement::removedFromTree):
+ (WebCore::HTMLDataGridColElement::sortable):
+ (WebCore::HTMLDataGridColElement::setSortable):
+ * html/HTMLDataGridColElement.h:
+ (WebCore::HTMLDataGridColElement::column):
+ (WebCore::HTMLDataGridColElement::setColumn):
+ (WebCore::HTMLDataGridColElement::datagrid):
+ * html/HTMLDataGridElement.cpp:
+ (WebCore::HTMLDataGridElement::setDataSource):
+ (WebCore::HTMLDataGridElement::dataSource):
+
+2009-06-30 Jeremy Orlow (jorlow@chromium.org)
+
+ Reviewed by David Levin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26852
+
+ Fix some minor build issues in the v8 bindings.
+
+ * bindings/v8/custom/V8StorageCustom.cpp:
+ (WebCore::V8Custom::v8StorageNamedPropertyEnumerator):
+ (WebCore::storageGetter):
+ (WebCore::storageSetter):
+ (WebCore::storageDeleter):
+ * storage/StorageArea.cpp:
+
+2009-06-30 Adam Langley <agl@google.com>
+
+ Reviewed by Eric Seidel.
+
+ Chromium Linux: use different fonts for each script run.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26853
+
+ Previously, when rendering complex text, we picked a single font which
+ could render all the glyphs needed for the run. However, this meant
+ that sometimes lines were rendered with, for example, [LATIN, THAI,
+ LATIN] and we could end up with a different font for the Latin parts
+ than for lines without Thai in them.
+
+ With this patch, we pick a font for each script run.
+
+ This change is covered by existing layout tests.
+
+ * platform/graphics/chromium/FontLinux.cpp:
+ (WebCore::Font::drawGlyphs):
+ (WebCore::TextRunWalker::TextRunWalker):
+ (WebCore::TextRunWalker::~TextRunWalker):
+ (WebCore::TextRunWalker::nextScriptRun):
+ (WebCore::TextRunWalker::fontPlatformDataForScriptRun):
+ (WebCore::TextRunWalker::setupFontForScriptRun):
+ (WebCore::TextRunWalker::allocHarfbuzzFont):
+ (WebCore::setupForTextPainting):
+ (WebCore::Font::drawComplexText):
+ (WebCore::Font::floatWidthForComplexText):
+ (WebCore::Font::offsetForPositionForComplexText):
+ (WebCore::Font::selectionRectForComplexText):
+ * platform/graphics/chromium/FontPlatformDataLinux.cpp:
+ (WebCore::FontPlatformData::setupPaint):
+
+2009-06-30 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dave Hyatt, Dan Bernstein.
+
+ <rdar://problem/6191676> Redraw issues scrolling overflow:scroll div with compositing
+
+ There are two parts to this fix. First, if a compositing layer has overflow clipping
+ or a mask, then the compositing layer does not need to be sized to encompass all
+ non-composited children.
+
+ Second, when scrolling, we have to back up to the compositing ancestor and have
+ it reposition descendant compositing layers, because overflow doesn't follow
+ the z-order tree.
+
+ Test: compositing/overflow/overflow-scroll.html
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::layout):
+ Pass the UpdateCompositingLayers flag when updating layers after layout, so that
+ we can reposition compositing layers if we're not about to do a layer rebuild.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateLayerPositions):
+ Only update compositing layers if the flag is set.
+
+ (WebCore::RenderLayer::scrollToOffset):
+ Do compositing layer updates from the compositing ancestor in one fell swoop.
+
+ * rendering/RenderLayer.h:
+ Replace the unused FullUpdate flag with one that allows us to specify whether
+ compositing layers should be updated.
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateAfterLayout):
+ * rendering/RenderLayerBacking.h:
+ New param that we can pass to updateCompositingDescendantGeometry to control
+ whether the update goes deep.
+
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::calculateCompositedBounds):
+ We can return earlier if this is not a self-painting layer.
+ If the layer has overflow clip or a mask, then the composited bounds are just the
+ local bounds, excluding descendants.
+
+ (WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):
+ * rendering/RenderLayerCompositor.h:
+ Renamed from updateCompositingChildrenGeometry, and added a flag that allows
+ us to do a deep update.
+
+2009-06-30 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26764
+ Uncaught NOT_FOUND_ERR: DOMException 8 loading empty text file
+
+ Test: fast/parser/empty-text-resource.html
+
+ * loader/TextDocument.cpp: (WebCore::TextTokenizer::finish): Create document tree if it
+ hasn't been created yet.
+
+2009-06-30 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Renamed scrollbarUnderPoint to scrollbarAtPoint.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::hitTestResultAtPoint):
+ (WebCore::EventHandler::handleMousePressEvent):
+ (WebCore::EventHandler::handleMouseMoveEvent):
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::scrollbarAtPoint):
+ * platform/ScrollView.h:
+ * platform/chromium/PopupMenuChromium.cpp:
+ (WebCore::PopupListBox::handleMouseDownEvent):
+ (WebCore::PopupListBox::handleMouseMoveEvent):
+
+2009-06-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/6960286> CrashTracer: [REGRESSION] 1120 crashes in Safari at com.apple.WebCore WebCore::JSLazyEventListener::parseCode const + 62
+
+ <select> elements and other elements the produce popups can keep their popups
+ live across a page load. If this occurs and the <select> element has an
+ onchange handler it is possible to get into a state where we try to execute
+ JS on a page that no longer has an execution context.
+
+ * bindings/js/JSLazyEventListener.cpp:
+ (WebCore::JSLazyEventListener::parseCode):
+ Be paranoid and add a null check, but assert as well because we shouldn't
+ actually get to this point.
+ * rendering/RenderMenuList.cpp:
+ (WebCore::RenderMenuList::valueChanged):
+
+2009-06-30 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=25435>
+
+ Added support for sending MessagePorts to/from Workers via postMessage().
+
+ * bindings/js/JSWorkerContextCustom.cpp:
+ (WebCore::JSWorkerContext::messageChannel):
+ Exposes MessageChannel constructor WorkerContext.
+ * bindings/js/JSWorkerCustom.cpp:
+ * bindings/v8/custom/V8MessageChannelConstructor.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ Now correctly handles being instantiated from within a Worker.
+ * platform/CrossThreadCopier.h:
+ (WebCore::GenericWorkerTaskTraits<PassOwnPtr>):
+ Added support for passing PassOwnPtr as argument to GenericWorkerTask
+ * workers/GenericWorkerTask.h:
+ (WebCore::):
+ * workers/Worker.cpp:
+ (WebCore::Worker::postMessage):
+ Now handles disentangling/entangling MessagePorts sent to/from via postMessage.
+ (WebCore::Worker::dispatchMessage):
+ * workers/Worker.h:
+ * workers/Worker.idl:
+ Added an optional MessagePort argument to postMessage()
+ * workers/WorkerContext.cpp:
+ (WebCore::WorkerContext::hasPendingActivity):
+ Workers now report pending activity whenever there are remotely entangled ports.
+ (WebCore::WorkerContext::postMessage):
+ Now handles disentangling/entangling MessagePorts sent to/from via postMessage.
+ (WebCore::WorkerContext::dispatchMessage):
+ * workers/WorkerContext.h:
+ * workers/WorkerContext.idl:
+ Added an optional MessagePort argument to postMessage()
+ * workers/WorkerContextProxy.h:
+ * workers/WorkerMessagingProxy.cpp:
+ Updated messaging infrastructure to transport an optional MessagePort/MessagePortChannel.
+ (WebCore::MessageWorkerContextTask::create):
+ (WebCore::MessageWorkerContextTask::MessageWorkerContextTask):
+ (WebCore::MessageWorkerContextTask::performTask):
+ (WebCore::MessageWorkerTask::create):
+ (WebCore::MessageWorkerTask::MessageWorkerTask):
+ (WebCore::MessageWorkerTask::performTask):
+ (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
+ (WebCore::WorkerMessagingProxy::postMessageToWorkerContext):
+ * workers/WorkerMessagingProxy.h:
+ Added additional postMessage() API that accepts a MessagePort
+ * workers/WorkerObjectProxy.h:
+ Added additional postMessage() API that accepts a MessagePort
+
+2009-06-30 Adam Langley <agl@google.com>
+
+ Reviewed by Eric Seidel.
+
+ Chromium: Add complex text support on Linux.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25068
+
+ This patch adds complex text support on Linux using Harfbuzz. It's not
+ the fastest code possible: some caching of font tables will certainly
+ be required. However, it's probably the simplest code that works.
+
+ This will require checking in new baselines in the Chromium tree for
+ those layout tests which now pass.
+
+ * platform/graphics/chromium/FontLinux.cpp:
+ (WebCore::Font::drawGlyphs):
+ (WebCore::truncateFixedPointToInteger):
+ (WebCore::TextRunWalker::TextRunWalker):
+ (WebCore::TextRunWalker::~TextRunWalker):
+ (WebCore::TextRunWalker::reset):
+ (WebCore::TextRunWalker::setXOffsetToZero):
+ (WebCore::TextRunWalker::rtl):
+ (WebCore::TextRunWalker::setBackwardsIteration):
+ (WebCore::TextRunWalker::nextScriptRun):
+ (WebCore::TextRunWalker::glyphs):
+ (WebCore::TextRunWalker::length):
+ (WebCore::TextRunWalker::xPositions):
+ (WebCore::TextRunWalker::advances):
+ (WebCore::TextRunWalker::width):
+ (WebCore::TextRunWalker::logClusters):
+ (WebCore::TextRunWalker::numCodePoints):
+ (WebCore::TextRunWalker::widthOfFullRun):
+ (WebCore::TextRunWalker::allocHarfbuzzFont):
+ (WebCore::TextRunWalker::deleteGlyphArrays):
+ (WebCore::TextRunWalker::createGlyphArrays):
+ (WebCore::TextRunWalker::expandGlyphArrays):
+ (WebCore::TextRunWalker::shapeGlyphs):
+ (WebCore::TextRunWalker::setGlyphXPositions):
+ (WebCore::setupForTextPainting):
+ (WebCore::fontPlatformDataForTextRun):
+ (WebCore::Font::drawComplexText):
+ (WebCore::Font::floatWidthForComplexText):
+ (WebCore::glyphIndexForXPositionInScriptRun):
+ (WebCore::Font::offsetForPositionForComplexText):
+ (WebCore::Font::selectionRectForComplexText):
+ * platform/graphics/chromium/HarfbuzzSkia.cpp: Added.
+ (WebCore::SkiaScalarToHarfbuzzFixed):
+ (WebCore::stringToGlyphs):
+ (WebCore::glyphsToAdvances):
+ (WebCore::canRender):
+ (WebCore::getOutlinePoint):
+ (WebCore::getGlyphMetrics):
+ (WebCore::getFontMetric):
+ (WebCore::harfbuzzSkiaGetTable):
+
+2009-06-30 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/7019799> Slow loading MediaDocument can fall back to plug-in unnecessarily
+
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivate::updateStates):
+ Always fall back to a plug-in if m_hasUnsupportedTracks is set.
+ (WebCore::MediaPlayerPrivate::disableUnsupportedTracks):
+ Set m_hasUnsupportedTracks if we disable a track.
+
+2009-06-30 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Fix inverted if/else that's causing a layout test in src.chromium.org to fail.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26820
+
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::GCPrologueVisitor::visitDOMWrapper): if (port2), not if (!port2).
+
+2009-06-30 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ - fix <rdar://problem/6946611> REGRESSION (r30673): Shade10:" D_Snap
+ to Grid" window is clipping
+
+ Added an app-specific quirk to revert the behavior of <link> elements
+ to the way it was before r30673, namely that if the rel attribute
+ is not "stylesheet" but the type attribute contains "text/css", the
+ link behaves as a stylesheet link.
+
+ * WebCore.base.exp: Exported setTreatsAnyTextCSSLinkAsStylesheet().
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::process): Check
+ Settings::treatsAnyTextCSSLinkAsStylesheet() and if true, allow a
+ style sheet link if the type contains "text/css".
+ * page/Settings.cpp:
+ (WebCore::Settings::Settings):
+ Initialize m_treatsAnyTextCSSLinkAsStylesheet.
+ (WebCore::Settings::setTreatsAnyTextCSSLinkAsStylesheet): Added.
+ * page/Settings.h:
+ (WebCore::Settings::treatsAnyTextCSSLinkAsStylesheet): Added.
+
+2009-06-30 Adrien Nader <camaradetux@gmail.com>
+
+ Reviewed by Xan Lopez.
+
+ Fix typo in GNUMakefile.am: it reads WebCOre instead of WebCore.
+
+ * GNUmakefile.am:
+
+2009-06-30 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Xan Lopez.
+
+ [Gtk] Turn on ENABLE_DATAGRID so we can run the layout tests.
+
+ * GNUmakefile.am:
+
+2009-06-30 Raju Kunnath <raju.kunnath@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=26752>
+
+ [Qt] Windows release build issue with Qt4.5 due to -GL flag on msvc2005 and msvc2008.
+
+ * WebCore.pro: Removed -GL compiler option for win32-msvc2005|win32-msvc2008.
+
+2009-06-30 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Jan Alonzo.
+
+ Initialize member variables in the right order. Fixes compiler
+ warning.
+
+ * platform/image-decoders/bmp/BMPImageReader.cpp:
+ (WebCore::BMPImageReader::BMPImageReader):
+
+2009-06-29 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by David Levin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26831
+ Fix compiler warning in WorkerLoaderProxy.h
+
+ Forward declaration of a class within a class is not allowed,
+ since the compiler can't know if the declaration is legal at that
+ point. This gives the following compiler warning:
+
+ ../../WebCore/workers/WorkerLoaderProxy.h:40: warning: declaration
+ "class WebCore::ScriptExecutionContext::Task" does not declare
+ anything
+
+ Include the full ScriptExecutionHeader header instead.
+
+ * workers/WorkerLoaderProxy.h:
+
+2009-06-29 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Jan Alonzo.
+
+ Remove unused function.
+
+ * plugins/gtk/PluginPackageGtk.cpp:
+
+2009-06-29 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Change RenderLayer::updateLayerPositions() to use a bitmask instead of two
+ boolean arguments. FullUpdate is unused at present, but will be used soon.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::layout):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateLayerPositions):
+ (WebCore::RenderLayer::scrollToOffset):
+ * rendering/RenderLayer.h:
+ (WebCore::RenderLayer::):
+
+2009-06-29 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Fix one more bad merge in V8Proxy.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26819
+
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::setDOMException): setDOMExceptionHelper() instead of convertToV8Object().
+
+2009-06-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Remove more unused scons support.
+
+ * SConstruct: Removed.
+
+2009-06-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dave Hyatt.
+
+ Fix some incorrect create functions.
+
+ * html/DataGridColumn.h:
+ (WebCore::DataGridColumn::create):
+ * html/DataGridColumnList.h:
+ (WebCore::DataGridColumnList::create):
+
+2009-06-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dave Hyatt.
+
+ Remove initialize method from DataGridDataSource and add
+ DOMDataGridDataSource.
+
+ * GNUmakefile.am:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * WebCoreSources.bkl:
+ * bindings/js/JSDataGridDataSource.cpp:
+ * bindings/js/JSDataGridDataSource.h:
+ * bindings/js/JSHTMLDataGridElementCustom.cpp:
+ (WebCore::JSHTMLDataGridElement::setDataSource):
+ * html/DOMDataGridDataSource.cpp: Added.
+ (WebCore::DOMDataGridDataSource::DOMDataGridDataSource):
+ (WebCore::DOMDataGridDataSource::~DOMDataGridDataSource):
+ * html/DOMDataGridDataSource.h: Added.
+ (WebCore::DOMDataGridDataSource::create):
+ (WebCore::DOMDataGridDataSource::isDOMDataGridDataSource):
+ (WebCore::asDOMDataGridDataSource):
+ * html/DataGridDataSource.h:
+ (WebCore::DataGridDataSource::isDOMDataGridDataSource):
+ (WebCore::DataGridDataSource::isJSDataGridDataSource):
+ * html/HTMLDataGridElement.cpp:
+ (WebCore::HTMLDataGridElement::HTMLDataGridElement):
+ (WebCore::HTMLDataGridElement::setDataSource):
+ (WebCore::HTMLDataGridElement::dataSource):
+ * html/HTMLDataGridElement.h:
+
+2009-06-29 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Fix a couple of bad merge items from my previous V8Proxy patch.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26813
+
+ * bindings/v8/V8Collection.h:
+ (WebCore::nodeCollectionNamedPropertyGetter): Fix a bad function name that slipped through.
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::setDOMException): Fix a bad merge that caused a couple of lines of extraneous, breaking code to get in.
+
+2009-06-29 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser <simon.fraser@apple.com>.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26706
+
+ Fixed crash due to dereference of m_toStyle
+
+ * page/animation/ImplicitAnimation.cpp:
+ (WebCore::ImplicitAnimation::isTargetPropertyEqual):
+
+2009-06-29 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/7014813> Ask media engine if a movie is streamed or downloaded.
+
+ * WebCore.base.exp:
+ Export _wkQTMovieGetType
+
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::hasSingleSecurityOrigin):
+ Move to keep with other non-callback functions.
+ (WebCore::MediaPlayer::movieLoadType):
+ New, returns the movie type.
+ * platform/graphics/MediaPlayer.h:
+ Declare MovieLoadType enum and movieLoadType method.
+
+ * platform/graphics/MediaPlayerPrivate.h:
+ (WebCore::MediaPlayerPrivateInterface::movieLoadType):
+ Default implementation of movieLoadType
+
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivate::createQTMovie):
+ Don't base m_isStreaming on protocol, there are other types of streaming movies.
+ (WebCore::MediaPlayerPrivate::maxTimeBuffered):
+ Don't assume all streams are unbuffered.
+ (WebCore::MediaPlayerPrivate::updateStates):
+ Update m_isStreaming once we have metadata.
+ (WebCore::MediaPlayerPrivate::disableUnsupportedTracks):
+ Tracks that are disabled to begin with shouldn't be included in m_enabledTrackCount.
+ (WebCore::MediaPlayerPrivate::movieLoadType):
+ New, return movie type.
+
+ * platform/mac/WebCoreSystemInterface.h:
+ * platform/mac/WebCoreSystemInterface.mm:
+ Add wkQTMovieGetType.
+
+2009-06-29 Alice Liu <alice.liu@apple.com>
+
+ Fixed <rdar://problem/6930280> Reproducible crash at USA Today photo gallery
+
+ Reviewed by Anders Carlsson.
+
+ No test added because the crash requires a flash plugin
+
+ * plugins/win/PluginMessageThrottlerWin.cpp:
+ Rely on the hWnd of the plugin to tell us whether the PluginView has
+ been deleted during execution of its wndProc.
+ (WebCore::PluginMessageThrottlerWin::messageThrottleTimerFired):
+
+2009-06-29 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by David Levin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26811
+ [Chromium] Remove a flag and functions used to enable workers in runtime.
+
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ * bindings/v8/WorkerContextExecutionProxy.h:
+
+2009-06-29 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ <rdar://problem/6976712> Text antialiasing problems when rendering into compositing layers.
+
+ Improve the appearance of text in compositing layers by making use of
+ CA's layer geometry flipping, rather that doing it ourselves with a flip
+ transform. This allows CG to use font autohinting in the layer text.
+
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::setGeometryOrientation):
+ (WebCore::GraphicsLayer::geometryOrientation):
+ New methods to set whether this layer uses flipped geometry.
+
+ * platform/graphics/mac/GraphicsLayerCA.h:
+ * platform/graphics/mac/GraphicsLayerCA.mm:
+ (WebCore::GraphicsLayerCA::setGeometryOrientation):
+ (WebCore::GraphicsLayerCA::geometryOrientation):
+ Subclass in order to call into CA
+
+ (WebCore::GraphicsLayerCA::setContentsLayer):
+ Now that CA is doing the geometry flipping, we no longer need to flip the content
+ layers for image and video manually
+
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::ensureRootPlatformLayer):
+ Turn on flipping on the root layer.
+
+2009-06-29 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Reviewed by Adam Treat.
+
+ Fixes: https://bugs.webkit.org/show_bug.cgi?id=26246
+
+ Implement most WML specific <select> element features.
+ Add 'iname' / 'ivalue' support and support variable references.
+
+ Add two tests covering most select/variable related functionality.
+ Needs more tests when adding full 'iname' / 'ivalue' support (used in conjuction with onpick).
+
+ Tests: http/tests/wml/post-data-to-server.html
+ wml/select-element-variables.html
+
+ * dom/SelectElement.cpp:
+ (WebCore::SelectElement::optionCount): Refactored from HTMLSelectElement::length() for use within HTML & WML.
+ * dom/SelectElement.h:
+ * html/HTMLSelectElement.cpp:
+ (WebCore::HTMLSelectElement::length): Use new SelectElement::optionCount() function. (no functional changes for HTML).
+ * wml/WMLCardElement.cpp:
+ (WebCore::WMLCardElement::handleIntrinsicEventIfNeeded): Activated commented code taking care of WMLSelectElement initialization.
+ * wml/WMLSelectElement.cpp: Add a bunch of new code handling WML specific feature processing.
+ (WebCore::WMLSelectElement::title):
+ (WebCore::WMLSelectElement::formControlName):
+ (WebCore::WMLSelectElement::defaultEventHandler):
+ (WebCore::WMLSelectElement::selectInitialOptions):
+ (WebCore::WMLSelectElement::calculateDefaultOptionIndices):
+ (WebCore::WMLSelectElement::selectDefaultOptions):
+ (WebCore::WMLSelectElement::initializeVariables):
+ (WebCore::WMLSelectElement::updateVariables):
+ (WebCore::WMLSelectElement::parseIndexValueString):
+ (WebCore::WMLSelectElement::valueStringToOptionIndices):
+ (WebCore::WMLSelectElement::optionIndicesToValueString):
+ (WebCore::WMLSelectElement::optionIndicesToString):
+ (WebCore::WMLSelectElement::name):
+ (WebCore::WMLSelectElement::value):
+ (WebCore::WMLSelectElement::iname):
+ (WebCore::WMLSelectElement::ivalue):
+ * wml/WMLSelectElement.h:
+
+2009-06-29 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Put <datagrid> behind an ifdef.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * bindings/js/JSDataGridColumnListCustom.cpp:
+ * bindings/js/JSDataGridDataSource.cpp:
+ * bindings/js/JSDataGridDataSource.h:
+ * bindings/js/JSHTMLDataGridElementCustom.cpp:
+ * html/DataGridColumn.cpp:
+ * html/DataGridColumn.h:
+ * html/DataGridColumn.idl:
+ * html/DataGridColumnList.cpp:
+ * html/DataGridColumnList.h:
+ * html/DataGridColumnList.idl:
+ * html/DataGridDataSource.h:
+ * html/HTMLDataGridCellElement.cpp:
+ * html/HTMLDataGridCellElement.h:
+ * html/HTMLDataGridCellElement.idl:
+ * html/HTMLDataGridColElement.cpp:
+ * html/HTMLDataGridColElement.h:
+ * html/HTMLDataGridColElement.idl:
+ * html/HTMLDataGridElement.cpp:
+ * html/HTMLDataGridElement.h:
+ * html/HTMLDataGridElement.idl:
+ * html/HTMLDataGridRowElement.cpp:
+ * html/HTMLDataGridRowElement.h:
+ * html/HTMLDataGridRowElement.idl:
+ * html/HTMLTagNames.in:
+ * page/DOMWindow.idl:
+ * rendering/RenderDataGrid.cpp:
+ * rendering/RenderDataGrid.h:
+
+2009-06-29 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat and Adam Roben.
+
+ Fix compilation with MINGW. Ported MSVC inline assembly to
+ GNU inline assembly. Also fixed casting errors where gcc
+ refused to cast a pointer-to-function to a pointer-to-object,
+ without an intermediate cast to a non-pointer type.
+
+ * plugins/win/PluginViewWin.cpp:
+ (WebCore::PluginView::hookedBeginPaint):
+ (WebCore::PluginView::hookedEndPaint):
+ (WebCore::hook):
+ (WebCore::setUpOffscreenPaintingHooks):
+
2009-06-26 John Sullivan <sullivan@apple.com>
Added Speech submenu to context menu on Mac when there's a non-editable selection
diff --git a/src/3rdparty/webkit/WebCore/DerivedSources.cpp b/src/3rdparty/webkit/WebCore/DerivedSources.cpp
index 3075a4b..69cc3e3 100644
--- a/src/3rdparty/webkit/WebCore/DerivedSources.cpp
+++ b/src/3rdparty/webkit/WebCore/DerivedSources.cpp
@@ -317,6 +317,7 @@
#include "JSTimeRanges.cpp"
#include "JSTreeWalker.cpp"
#include "JSUIEvent.cpp"
+#include "JSValidityState.cpp"
#include "JSVoidCallback.cpp"
#include "JSWebKitAnimationEvent.cpp"
#include "JSWebKitCSSKeyframeRule.cpp"
diff --git a/src/3rdparty/webkit/WebCore/WebCore.gypi b/src/3rdparty/webkit/WebCore/WebCore.gypi
new file mode 100644
index 0000000..d96da86
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/WebCore.gypi
@@ -0,0 +1,3334 @@
+{
+ 'variables': {
+ 'webcore_files': [
+
+ #IDL files
+ 'css/CSSCharsetRule.idl',
+ 'css/CSSFontFaceRule.idl',
+ 'css/CSSImportRule.idl',
+ 'css/CSSMediaRule.idl',
+ 'css/CSSPageRule.idl',
+ 'css/CSSPrimitiveValue.idl',
+ 'css/CSSRule.idl',
+ 'css/CSSRuleList.idl',
+ 'css/CSSStyleDeclaration.idl',
+ 'css/CSSStyleRule.idl',
+ 'css/CSSStyleSheet.idl',
+ 'css/CSSUnknownRule.idl',
+ 'css/CSSValue.idl',
+ 'css/CSSValueList.idl',
+ 'css/CSSVariablesDeclaration.idl',
+ 'css/CSSVariablesRule.idl',
+ 'css/Counter.idl',
+ 'css/MediaList.idl',
+ 'css/RGBColor.idl',
+ 'css/Rect.idl',
+ 'css/StyleSheet.idl',
+ 'css/StyleSheetList.idl',
+ 'css/WebKitCSSKeyframeRule.idl',
+ 'css/WebKitCSSKeyframesRule.idl',
+ 'css/WebKitCSSMatrix.idl',
+ 'css/WebKitCSSTransformValue.idl',
+ 'dom/Attr.idl',
+ 'dom/CDATASection.idl',
+ 'dom/CharacterData.idl',
+ 'dom/ClientRect.idl',
+ 'dom/ClientRectList.idl',
+ 'dom/Clipboard.idl',
+ 'dom/Comment.idl',
+ 'dom/DOMCoreException.idl',
+ 'dom/DOMImplementation.idl',
+ 'dom/Document.idl',
+ 'dom/DocumentFragment.idl',
+ 'dom/DocumentType.idl',
+ 'dom/Element.idl',
+ 'dom/Entity.idl',
+ 'dom/EntityReference.idl',
+ 'dom/Event.idl',
+ 'dom/EventException.idl',
+ 'dom/EventListener.idl',
+ 'dom/EventTarget.idl',
+ 'dom/KeyboardEvent.idl',
+ 'dom/MessageChannel.idl',
+ 'dom/MessageEvent.idl',
+ 'dom/MessagePort.idl',
+ 'dom/MouseEvent.idl',
+ 'dom/MutationEvent.idl',
+ 'dom/NamedNodeMap.idl',
+ 'dom/Node.idl',
+ 'dom/NodeFilter.idl',
+ 'dom/NodeIterator.idl',
+ 'dom/NodeList.idl',
+ 'dom/Notation.idl',
+ 'dom/OverflowEvent.idl',
+ 'dom/ProcessingInstruction.idl',
+ 'dom/ProgressEvent.idl',
+ 'dom/Range.idl',
+ 'dom/RangeException.idl',
+ 'dom/Text.idl',
+ 'dom/TextEvent.idl',
+ 'dom/TreeWalker.idl',
+ 'dom/UIEvent.idl',
+ 'dom/WebKitAnimationEvent.idl',
+ 'dom/WebKitTransitionEvent.idl',
+ 'dom/WheelEvent.idl',
+ 'html/CanvasGradient.idl',
+ 'html/CanvasPattern.idl',
+ 'html/CanvasPixelArray.idl',
+ 'html/CanvasRenderingContext2D.idl',
+ 'html/DataGridColumn.idl',
+ 'html/DataGridColumnList.idl',
+ 'html/File.idl',
+ 'html/FileList.idl',
+ 'html/HTMLAnchorElement.idl',
+ 'html/HTMLAppletElement.idl',
+ 'html/HTMLAreaElement.idl',
+ 'html/HTMLAudioElement.idl',
+ 'html/HTMLBRElement.idl',
+ 'html/HTMLBaseElement.idl',
+ 'html/HTMLBaseFontElement.idl',
+ 'html/HTMLBlockquoteElement.idl',
+ 'html/HTMLBodyElement.idl',
+ 'html/HTMLButtonElement.idl',
+ 'html/HTMLCanvasElement.idl',
+ 'html/HTMLCollection.idl',
+ 'html/HTMLDListElement.idl',
+ 'html/HTMLDataGridCellElement.idl',
+ 'html/HTMLDataGridColElement.idl',
+ 'html/HTMLDataGridElement.idl',
+ 'html/HTMLDataGridRowElement.idl',
+ 'html/HTMLDirectoryElement.idl',
+ 'html/HTMLDivElement.idl',
+ 'html/HTMLDocument.idl',
+ 'html/HTMLElement.idl',
+ 'html/HTMLEmbedElement.idl',
+ 'html/HTMLFieldSetElement.idl',
+ 'html/HTMLFontElement.idl',
+ 'html/HTMLFormElement.idl',
+ 'html/HTMLFrameElement.idl',
+ 'html/HTMLFrameSetElement.idl',
+ 'html/HTMLHRElement.idl',
+ 'html/HTMLHeadElement.idl',
+ 'html/HTMLHeadingElement.idl',
+ 'html/HTMLHtmlElement.idl',
+ 'html/HTMLIFrameElement.idl',
+ 'html/HTMLImageElement.idl',
+ 'html/HTMLInputElement.idl',
+ 'html/HTMLIsIndexElement.idl',
+ 'html/HTMLLIElement.idl',
+ 'html/HTMLLabelElement.idl',
+ 'html/HTMLLegendElement.idl',
+ 'html/HTMLLinkElement.idl',
+ 'html/HTMLMapElement.idl',
+ 'html/HTMLMarqueeElement.idl',
+ 'html/HTMLMediaElement.idl',
+ 'html/HTMLMenuElement.idl',
+ 'html/HTMLMetaElement.idl',
+ 'html/HTMLModElement.idl',
+ 'html/HTMLOListElement.idl',
+ 'html/HTMLObjectElement.idl',
+ 'html/HTMLOptGroupElement.idl',
+ 'html/HTMLOptionElement.idl',
+ 'html/HTMLOptionsCollection.idl',
+ 'html/HTMLParagraphElement.idl',
+ 'html/HTMLParamElement.idl',
+ 'html/HTMLPreElement.idl',
+ 'html/HTMLQuoteElement.idl',
+ 'html/HTMLScriptElement.idl',
+ 'html/HTMLSelectElement.idl',
+ 'html/HTMLSourceElement.idl',
+ 'html/HTMLStyleElement.idl',
+ 'html/HTMLTableCaptionElement.idl',
+ 'html/HTMLTableCellElement.idl',
+ 'html/HTMLTableColElement.idl',
+ 'html/HTMLTableElement.idl',
+ 'html/HTMLTableRowElement.idl',
+ 'html/HTMLTableSectionElement.idl',
+ 'html/HTMLTextAreaElement.idl',
+ 'html/HTMLTitleElement.idl',
+ 'html/HTMLUListElement.idl',
+ 'html/HTMLVideoElement.idl',
+ 'html/ImageData.idl',
+ 'html/MediaError.idl',
+ 'html/TextMetrics.idl',
+ 'html/TimeRanges.idl',
+ 'html/ValidityState.idl',
+ 'html/VoidCallback.idl',
+ 'inspector/InspectorController.idl',
+ 'inspector/JavaScriptCallFrame.idl',
+ 'loader/appcache/DOMApplicationCache.idl',
+ 'page/AbstractView.idl',
+ 'page/BarInfo.idl',
+ 'page/Console.idl',
+ 'page/DOMSelection.idl',
+ 'page/DOMWindow.idl',
+ 'page/Geolocation.idl',
+ 'page/Geoposition.idl',
+ 'page/History.idl',
+ 'page/Location.idl',
+ 'page/Navigator.idl',
+ 'page/PositionCallback.idl',
+ 'page/PositionError.idl',
+ 'page/PositionErrorCallback.idl',
+ 'page/Screen.idl',
+ 'page/WebKitPoint.idl',
+ 'page/WorkerNavigator.idl',
+ 'plugins/MimeType.idl',
+ 'plugins/MimeTypeArray.idl',
+ 'plugins/Plugin.idl',
+ 'plugins/PluginArray.idl',
+ 'storage/Database.idl',
+ 'storage/SQLError.idl',
+ 'storage/SQLResultSet.idl',
+ 'storage/SQLResultSetRowList.idl',
+ 'storage/SQLTransaction.idl',
+ 'storage/Storage.idl',
+ 'storage/StorageEvent.idl',
+ 'svg/ElementTimeControl.idl',
+ 'svg/SVGAElement.idl',
+ 'svg/SVGAltGlyphElement.idl',
+ 'svg/SVGAngle.idl',
+ 'svg/SVGAnimateColorElement.idl',
+ 'svg/SVGAnimateElement.idl',
+ 'svg/SVGAnimateTransformElement.idl',
+ 'svg/SVGAnimatedAngle.idl',
+ 'svg/SVGAnimatedBoolean.idl',
+ 'svg/SVGAnimatedEnumeration.idl',
+ 'svg/SVGAnimatedInteger.idl',
+ 'svg/SVGAnimatedLength.idl',
+ 'svg/SVGAnimatedLengthList.idl',
+ 'svg/SVGAnimatedNumber.idl',
+ 'svg/SVGAnimatedNumberList.idl',
+ 'svg/SVGAnimatedPathData.idl',
+ 'svg/SVGAnimatedPoints.idl',
+ 'svg/SVGAnimatedPreserveAspectRatio.idl',
+ 'svg/SVGAnimatedRect.idl',
+ 'svg/SVGAnimatedString.idl',
+ 'svg/SVGAnimatedTransformList.idl',
+ 'svg/SVGAnimationElement.idl',
+ 'svg/SVGCircleElement.idl',
+ 'svg/SVGClipPathElement.idl',
+ 'svg/SVGColor.idl',
+ 'svg/SVGComponentTransferFunctionElement.idl',
+ 'svg/SVGCursorElement.idl',
+ 'svg/SVGDefinitionSrcElement.idl',
+ 'svg/SVGDefsElement.idl',
+ 'svg/SVGDescElement.idl',
+ 'svg/SVGDocument.idl',
+ 'svg/SVGElement.idl',
+ 'svg/SVGElementInstance.idl',
+ 'svg/SVGElementInstanceList.idl',
+ 'svg/SVGEllipseElement.idl',
+ 'svg/SVGException.idl',
+ 'svg/SVGExternalResourcesRequired.idl',
+ 'svg/SVGFEBlendElement.idl',
+ 'svg/SVGFEColorMatrixElement.idl',
+ 'svg/SVGFEComponentTransferElement.idl',
+ 'svg/SVGFECompositeElement.idl',
+ 'svg/SVGFEDiffuseLightingElement.idl',
+ 'svg/SVGFEDisplacementMapElement.idl',
+ 'svg/SVGFEDistantLightElement.idl',
+ 'svg/SVGFEFloodElement.idl',
+ 'svg/SVGFEFuncAElement.idl',
+ 'svg/SVGFEFuncBElement.idl',
+ 'svg/SVGFEFuncGElement.idl',
+ 'svg/SVGFEFuncRElement.idl',
+ 'svg/SVGFEGaussianBlurElement.idl',
+ 'svg/SVGFEImageElement.idl',
+ 'svg/SVGFEMergeElement.idl',
+ 'svg/SVGFEMergeNodeElement.idl',
+ 'svg/SVGFEOffsetElement.idl',
+ 'svg/SVGFEPointLightElement.idl',
+ 'svg/SVGFESpecularLightingElement.idl',
+ 'svg/SVGFESpotLightElement.idl',
+ 'svg/SVGFETileElement.idl',
+ 'svg/SVGFETurbulenceElement.idl',
+ 'svg/SVGFilterElement.idl',
+ 'svg/SVGFilterPrimitiveStandardAttributes.idl',
+ 'svg/SVGFitToViewBox.idl',
+ 'svg/SVGFontElement.idl',
+ 'svg/SVGFontFaceElement.idl',
+ 'svg/SVGFontFaceFormatElement.idl',
+ 'svg/SVGFontFaceNameElement.idl',
+ 'svg/SVGFontFaceSrcElement.idl',
+ 'svg/SVGFontFaceUriElement.idl',
+ 'svg/SVGForeignObjectElement.idl',
+ 'svg/SVGGElement.idl',
+ 'svg/SVGGlyphElement.idl',
+ 'svg/SVGGradientElement.idl',
+ 'svg/SVGHKernElement.idl',
+ 'svg/SVGImageElement.idl',
+ 'svg/SVGLangSpace.idl',
+ 'svg/SVGLength.idl',
+ 'svg/SVGLengthList.idl',
+ 'svg/SVGLineElement.idl',
+ 'svg/SVGLinearGradientElement.idl',
+ 'svg/SVGLocatable.idl',
+ 'svg/SVGMarkerElement.idl',
+ 'svg/SVGMaskElement.idl',
+ 'svg/SVGMatrix.idl',
+ 'svg/SVGMetadataElement.idl',
+ 'svg/SVGMissingGlyphElement.idl',
+ 'svg/SVGNumber.idl',
+ 'svg/SVGNumberList.idl',
+ 'svg/SVGPaint.idl',
+ 'svg/SVGPathElement.idl',
+ 'svg/SVGPathSeg.idl',
+ 'svg/SVGPathSegArcAbs.idl',
+ 'svg/SVGPathSegArcRel.idl',
+ 'svg/SVGPathSegClosePath.idl',
+ 'svg/SVGPathSegCurvetoCubicAbs.idl',
+ 'svg/SVGPathSegCurvetoCubicRel.idl',
+ 'svg/SVGPathSegCurvetoCubicSmoothAbs.idl',
+ 'svg/SVGPathSegCurvetoCubicSmoothRel.idl',
+ 'svg/SVGPathSegCurvetoQuadraticAbs.idl',
+ 'svg/SVGPathSegCurvetoQuadraticRel.idl',
+ 'svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl',
+ 'svg/SVGPathSegCurvetoQuadraticSmoothRel.idl',
+ 'svg/SVGPathSegLinetoAbs.idl',
+ 'svg/SVGPathSegLinetoHorizontalAbs.idl',
+ 'svg/SVGPathSegLinetoHorizontalRel.idl',
+ 'svg/SVGPathSegLinetoRel.idl',
+ 'svg/SVGPathSegLinetoVerticalAbs.idl',
+ 'svg/SVGPathSegLinetoVerticalRel.idl',
+ 'svg/SVGPathSegList.idl',
+ 'svg/SVGPathSegMovetoAbs.idl',
+ 'svg/SVGPathSegMovetoRel.idl',
+ 'svg/SVGPatternElement.idl',
+ 'svg/SVGPoint.idl',
+ 'svg/SVGPointList.idl',
+ 'svg/SVGPolygonElement.idl',
+ 'svg/SVGPolylineElement.idl',
+ 'svg/SVGPreserveAspectRatio.idl',
+ 'svg/SVGRadialGradientElement.idl',
+ 'svg/SVGRect.idl',
+ 'svg/SVGRectElement.idl',
+ 'svg/SVGRenderingIntent.idl',
+ 'svg/SVGSVGElement.idl',
+ 'svg/SVGScriptElement.idl',
+ 'svg/SVGSetElement.idl',
+ 'svg/SVGStopElement.idl',
+ 'svg/SVGStringList.idl',
+ 'svg/SVGStylable.idl',
+ 'svg/SVGStyleElement.idl',
+ 'svg/SVGSwitchElement.idl',
+ 'svg/SVGSymbolElement.idl',
+ 'svg/SVGTRefElement.idl',
+ 'svg/SVGTSpanElement.idl',
+ 'svg/SVGTests.idl',
+ 'svg/SVGTextContentElement.idl',
+ 'svg/SVGTextElement.idl',
+ 'svg/SVGTextPathElement.idl',
+ 'svg/SVGTextPositioningElement.idl',
+ 'svg/SVGTitleElement.idl',
+ 'svg/SVGTransform.idl',
+ 'svg/SVGTransformList.idl',
+ 'svg/SVGTransformable.idl',
+ 'svg/SVGURIReference.idl',
+ 'svg/SVGUnitTypes.idl',
+ 'svg/SVGUseElement.idl',
+ 'svg/SVGViewElement.idl',
+ 'svg/SVGViewSpec.idl',
+ 'svg/SVGZoomAndPan.idl',
+ 'svg/SVGZoomEvent.idl',
+ 'workers/AbstractWorker.idl',
+ 'workers/SharedWorker.idl',
+ 'workers/Worker.idl',
+ 'workers/WorkerContext.idl',
+ 'workers/WorkerLocation.idl',
+ 'xml/DOMParser.idl',
+ 'xml/XMLHttpRequest.idl',
+ 'xml/XMLHttpRequestException.idl',
+ 'xml/XMLHttpRequestProgressEvent.idl',
+ 'xml/XMLHttpRequestUpload.idl',
+ 'xml/XMLSerializer.idl',
+ 'xml/XPathEvaluator.idl',
+ 'xml/XPathException.idl',
+ 'xml/XPathExpression.idl',
+ 'xml/XPathNSResolver.idl',
+ 'xml/XPathResult.idl',
+ 'xml/XSLTProcessor.idl',
+
+ # Source/Header Files
+ 'accessibility/AXObjectCache.cpp',
+ 'accessibility/AXObjectCache.h',
+ 'accessibility/AccessibilityARIAGrid.cpp',
+ 'accessibility/AccessibilityARIAGrid.h',
+ 'accessibility/AccessibilityARIAGridCell.cpp',
+ 'accessibility/AccessibilityARIAGridCell.h',
+ 'accessibility/AccessibilityARIAGridRow.cpp',
+ 'accessibility/AccessibilityARIAGridRow.h',
+ 'accessibility/AccessibilityImageMapLink.cpp',
+ 'accessibility/AccessibilityImageMapLink.h',
+ 'accessibility/AccessibilityList.cpp',
+ 'accessibility/AccessibilityList.h',
+ 'accessibility/AccessibilityListBox.cpp',
+ 'accessibility/AccessibilityListBox.h',
+ 'accessibility/AccessibilityListBoxOption.cpp',
+ 'accessibility/AccessibilityListBoxOption.h',
+ 'accessibility/AccessibilityObject.cpp',
+ 'accessibility/AccessibilityObject.h',
+ 'accessibility/AccessibilityRenderObject.cpp',
+ 'accessibility/AccessibilityRenderObject.h',
+ 'accessibility/AccessibilityTable.cpp',
+ 'accessibility/AccessibilityTable.h',
+ 'accessibility/AccessibilityTableCell.cpp',
+ 'accessibility/AccessibilityTableCell.h',
+ 'accessibility/AccessibilityTableColumn.cpp',
+ 'accessibility/AccessibilityTableColumn.h',
+ 'accessibility/AccessibilityTableHeaderContainer.cpp',
+ 'accessibility/AccessibilityTableHeaderContainer.h',
+ 'accessibility/AccessibilityTableRow.cpp',
+ 'accessibility/AccessibilityTableRow.h',
+ 'accessibility/chromium/AXObjectCacheChromium.cpp',
+ 'accessibility/chromium/AccessibilityObjectChromium.cpp',
+ 'accessibility/chromium/AccessibilityObjectWrapper.h',
+ 'accessibility/gtk/AXObjectCacheAtk.cpp',
+ 'accessibility/gtk/AccessibilityObjectAtk.cpp',
+ 'accessibility/gtk/AccessibilityObjectWrapperAtk.cpp',
+ 'accessibility/gtk/AccessibilityObjectWrapperAtk.h',
+ 'accessibility/qt/AccessibilityObjectQt.cpp',
+ 'accessibility/mac/AXObjectCacheMac.mm',
+ 'accessibility/mac/AccessibilityObjectMac.mm',
+ 'accessibility/mac/AccessibilityObjectWrapper.h',
+ 'accessibility/mac/AccessibilityObjectWrapper.mm',
+ 'accessibility/win/AXObjectCacheWin.cpp',
+ 'accessibility/win/AccessibilityObjectWin.cpp',
+ 'accessibility/win/AccessibilityObjectWrapperWin.h',
+ 'accessibility/wx/AccessibilityObjectWx.cpp',
+ 'bindings/js/CachedScriptSourceProvider.h',
+ 'bindings/js/GCController.cpp',
+ 'bindings/js/GCController.h',
+ 'bindings/js/JSAttrCustom.cpp',
+ 'bindings/js/JSAudioConstructor.cpp',
+ 'bindings/js/JSAudioConstructor.h',
+ 'bindings/js/JSCanvasRenderingContext2DCustom.cpp',
+ 'bindings/js/JSCDATASectionCustom.cpp',
+ 'bindings/js/JSClipboardCustom.cpp',
+ 'bindings/js/JSConsoleCustom.cpp',
+ 'bindings/js/JSCoordinatesCustom.cpp',
+ 'bindings/js/JSCSSRuleCustom.cpp',
+ 'bindings/js/JSCSSStyleDeclarationCustom.cpp',
+ 'bindings/js/JSCSSStyleDeclarationCustom.h',
+ 'bindings/js/JSCSSValueCustom.cpp',
+ 'bindings/js/JSCustomPositionCallback.cpp',
+ 'bindings/js/JSCustomPositionCallback.h',
+ 'bindings/js/JSCustomPositionErrorCallback.cpp',
+ 'bindings/js/JSCustomPositionErrorCallback.h',
+ 'bindings/js/JSCustomSQLStatementCallback.cpp',
+ 'bindings/js/JSCustomSQLStatementCallback.h',
+ 'bindings/js/JSCustomSQLStatementErrorCallback.cpp',
+ 'bindings/js/JSCustomSQLStatementErrorCallback.h',
+ 'bindings/js/JSCustomSQLTransactionCallback.cpp',
+ 'bindings/js/JSCustomSQLTransactionCallback.h',
+ 'bindings/js/JSCustomSQLTransactionErrorCallback.cpp',
+ 'bindings/js/JSCustomSQLTransactionErrorCallback.h',
+ 'bindings/js/JSCustomVoidCallback.cpp',
+ 'bindings/js/JSCustomVoidCallback.h',
+ 'bindings/js/JSCustomXPathNSResolver.cpp',
+ 'bindings/js/JSCustomXPathNSResolver.h',
+ 'bindings/js/JSDatabaseCustom.cpp',
+ 'bindings/js/JSDataGridColumnListCustom.cpp',
+ 'bindings/js/JSDataGridDataSource.cpp',
+ 'bindings/js/JSDataGridDataSource.h',
+ 'bindings/js/JSDocumentCustom.cpp',
+ 'bindings/js/JSDocumentFragmentCustom.cpp',
+ 'bindings/js/JSDOMApplicationCacheCustom.cpp',
+ 'bindings/js/JSDOMBinding.cpp',
+ 'bindings/js/JSDOMBinding.h',
+ 'bindings/js/JSDOMGlobalObject.cpp',
+ 'bindings/js/JSDOMGlobalObject.h',
+ 'bindings/js/JSDOMWindowBase.cpp',
+ 'bindings/js/JSDOMWindowBase.h',
+ 'bindings/js/JSDOMWindowCustom.cpp',
+ 'bindings/js/JSDOMWindowCustom.h',
+ 'bindings/js/JSDOMWindowShell.cpp',
+ 'bindings/js/JSDOMWindowShell.h',
+ 'bindings/js/JSElementCustom.cpp',
+ 'bindings/js/JSEventCustom.cpp',
+ 'bindings/js/JSEventListener.cpp',
+ 'bindings/js/JSEventListener.h',
+ 'bindings/js/JSEventTarget.cpp',
+ 'bindings/js/JSEventTarget.h',
+ 'bindings/js/JSGeolocationCustom.cpp',
+ 'bindings/js/JSHistoryCustom.cpp',
+ 'bindings/js/JSHistoryCustom.h',
+ 'bindings/js/JSHTMLAllCollection.cpp',
+ 'bindings/js/JSHTMLAllCollection.h',
+ 'bindings/js/JSHTMLAppletElementCustom.cpp',
+ 'bindings/js/JSHTMLAppletElementCustom.h',
+ 'bindings/js/JSHTMLCollectionCustom.cpp',
+ 'bindings/js/JSHTMLDataGridElementCustom.cpp',
+ 'bindings/js/JSHTMLDocumentCustom.cpp',
+ 'bindings/js/JSHTMLElementCustom.cpp',
+ 'bindings/js/JSHTMLEmbedElementCustom.cpp',
+ 'bindings/js/JSHTMLEmbedElementCustom.h',
+ 'bindings/js/JSHTMLFormElementCustom.cpp',
+ 'bindings/js/JSHTMLFrameElementCustom.cpp',
+ 'bindings/js/JSHTMLFrameSetElementCustom.cpp',
+ 'bindings/js/JSHTMLIFrameElementCustom.cpp',
+ 'bindings/js/JSHTMLInputElementCustom.cpp',
+ 'bindings/js/JSHTMLInputElementCustom.h',
+ 'bindings/js/JSHTMLObjectElementCustom.cpp',
+ 'bindings/js/JSHTMLObjectElementCustom.h',
+ 'bindings/js/JSHTMLOptionsCollectionCustom.cpp',
+ 'bindings/js/JSHTMLSelectElementCustom.cpp',
+ 'bindings/js/JSHTMLSelectElementCustom.h',
+ 'bindings/js/JSImageConstructor.cpp',
+ 'bindings/js/JSImageConstructor.h',
+ 'bindings/js/JSImageDataCustom.cpp',
+ 'bindings/js/JSInspectedObjectWrapper.cpp',
+ 'bindings/js/JSInspectedObjectWrapper.h',
+ 'bindings/js/JSInspectorCallbackWrapper.cpp',
+ 'bindings/js/JSInspectorCallbackWrapper.h',
+ 'bindings/js/JSInspectorControllerCustom.cpp',
+ 'bindings/js/JSJavaScriptCallFrameCustom.cpp',
+ 'bindings/js/JSLazyEventListener.cpp',
+ 'bindings/js/JSLazyEventListener.h',
+ 'bindings/js/JSLocationCustom.cpp',
+ 'bindings/js/JSLocationCustom.h',
+ 'bindings/js/JSMessageChannelConstructor.cpp',
+ 'bindings/js/JSMessageChannelConstructor.h',
+ 'bindings/js/JSMessageChannelCustom.cpp',
+ 'bindings/js/JSMessagePortCustom.cpp',
+ 'bindings/js/JSMimeTypeArrayCustom.cpp',
+ 'bindings/js/JSNamedNodeMapCustom.cpp',
+ 'bindings/js/JSNamedNodesCollection.cpp',
+ 'bindings/js/JSNamedNodesCollection.h',
+ 'bindings/js/JSNavigatorCustom.cpp',
+ 'bindings/js/JSNodeCustom.cpp',
+ 'bindings/js/JSNodeFilterCondition.cpp',
+ 'bindings/js/JSNodeFilterCondition.h',
+ 'bindings/js/JSNodeFilterCustom.cpp',
+ 'bindings/js/JSNodeIteratorCustom.cpp',
+ 'bindings/js/JSNodeListCustom.cpp',
+ 'bindings/js/JSOptionConstructor.cpp',
+ 'bindings/js/JSOptionConstructor.h',
+ 'bindings/js/JSPluginArrayCustom.cpp',
+ 'bindings/js/JSPluginCustom.cpp',
+ 'bindings/js/JSPluginElementFunctions.cpp',
+ 'bindings/js/JSPluginElementFunctions.h',
+ 'bindings/js/JSQuarantinedObjectWrapper.cpp',
+ 'bindings/js/JSQuarantinedObjectWrapper.h',
+ 'bindings/js/JSRGBColor.cpp',
+ 'bindings/js/JSRGBColor.h',
+ 'bindings/js/JSSQLResultSetRowListCustom.cpp',
+ 'bindings/js/JSSQLTransactionCustom.cpp',
+ 'bindings/js/JSStorageCustom.cpp',
+ 'bindings/js/JSStorageCustom.h',
+ 'bindings/js/JSStyleSheetCustom.cpp',
+ 'bindings/js/JSStyleSheetListCustom.cpp',
+ 'bindings/js/JSSVGElementInstanceCustom.cpp',
+ 'bindings/js/JSSVGLengthCustom.cpp',
+ 'bindings/js/JSSVGMatrixCustom.cpp',
+ 'bindings/js/JSSVGPathSegCustom.cpp',
+ 'bindings/js/JSSVGPathSegListCustom.cpp',
+ 'bindings/js/JSSVGPODTypeWrapper.h',
+ 'bindings/js/JSSVGPointListCustom.cpp',
+ 'bindings/js/JSSVGTransformListCustom.cpp',
+ 'bindings/js/JSTextCustom.cpp',
+ 'bindings/js/JSTreeWalkerCustom.cpp',
+ 'bindings/js/JSWebKitCSSMatrixConstructor.cpp',
+ 'bindings/js/JSWebKitCSSMatrixConstructor.h',
+ 'bindings/js/JSWebKitPointConstructor.cpp',
+ 'bindings/js/JSWebKitPointConstructor.h',
+ 'bindings/js/JSWorkerConstructor.cpp',
+ 'bindings/js/JSWorkerConstructor.h',
+ 'bindings/js/JSWorkerContextBase.cpp',
+ 'bindings/js/JSWorkerContextBase.h',
+ 'bindings/js/JSWorkerContextCustom.cpp',
+ 'bindings/js/JSWorkerCustom.cpp',
+ 'bindings/js/JSXMLHttpRequestConstructor.cpp',
+ 'bindings/js/JSXMLHttpRequestConstructor.h',
+ 'bindings/js/JSXMLHttpRequestCustom.cpp',
+ 'bindings/js/JSXMLHttpRequestUploadCustom.cpp',
+ 'bindings/js/JSXSLTProcessorConstructor.cpp',
+ 'bindings/js/JSXSLTProcessorConstructor.h',
+ 'bindings/js/JSXSLTProcessorCustom.cpp',
+ 'bindings/js/ScheduledAction.cpp',
+ 'bindings/js/ScheduledAction.h',
+ 'bindings/js/ScriptCachedFrameData.cpp',
+ 'bindings/js/ScriptCachedFrameData.h',
+ 'bindings/js/ScriptCallFrame.cpp',
+ 'bindings/js/ScriptCallFrame.h',
+ 'bindings/js/ScriptCallStack.cpp',
+ 'bindings/js/ScriptCallStack.h',
+ 'bindings/js/ScriptController.cpp',
+ 'bindings/js/ScriptController.h',
+ 'bindings/js/ScriptControllerGtk.cpp',
+ 'bindings/js/ScriptControllerMac.mm',
+ 'bindings/js/ScriptControllerQt.cpp',
+ 'bindings/js/ScriptControllerWin.cpp',
+ 'bindings/js/ScriptControllerWx.cpp',
+ 'bindings/js/ScriptEventListener.cpp',
+ 'bindings/js/ScriptEventListener.h',
+ 'bindings/js/ScriptFunctionCall.cpp',
+ 'bindings/js/ScriptFunctionCall.h',
+ 'bindings/js/ScriptInstance.h',
+ 'bindings/js/ScriptObject.cpp',
+ 'bindings/js/ScriptObject.h',
+ 'bindings/js/ScriptObjectQuarantine.cpp',
+ 'bindings/js/ScriptObjectQuarantine.h',
+ 'bindings/js/ScriptSourceCode.h',
+ 'bindings/js/ScriptState.cpp',
+ 'bindings/js/ScriptState.h',
+ 'bindings/js/ScriptString.h',
+ 'bindings/js/ScriptValue.cpp',
+ 'bindings/js/ScriptValue.h',
+ 'bindings/js/StringSourceProvider.h',
+ 'bindings/js/WorkerScriptController.cpp',
+ 'bindings/js/WorkerScriptController.h',
+ 'bindings/v8/custom/V8AbstractWorkerCustom.cpp',
+ 'bindings/v8/custom/V8AttrCustom.cpp',
+ 'bindings/v8/custom/V8CanvasPixelArrayCustom.cpp',
+ 'bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp',
+ 'bindings/v8/custom/V8ClientRectListCustom.cpp',
+ 'bindings/v8/custom/V8ClipboardCustom.cpp',
+ 'bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp',
+ 'bindings/v8/custom/V8CustomBinding.cpp',
+ 'bindings/v8/custom/V8CustomBinding.h',
+ 'bindings/v8/custom/V8CustomEventListener.cpp',
+ 'bindings/v8/custom/V8CustomEventListener.h',
+ 'bindings/v8/custom/V8CustomSQLStatementCallback.cpp',
+ 'bindings/v8/custom/V8CustomSQLStatementCallback.h',
+ 'bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp',
+ 'bindings/v8/custom/V8CustomSQLStatementErrorCallback.h',
+ 'bindings/v8/custom/V8CustomSQLTransactionCallback.cpp',
+ 'bindings/v8/custom/V8CustomSQLTransactionCallback.h',
+ 'bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp',
+ 'bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h',
+ 'bindings/v8/custom/V8CustomVoidCallback.cpp',
+ 'bindings/v8/custom/V8CustomVoidCallback.h',
+ 'bindings/v8/custom/V8CustomXPathNSResolver.cpp',
+ 'bindings/v8/custom/V8CustomXPathNSResolver.h',
+ 'bindings/v8/custom/V8DatabaseCustom.cpp',
+ 'bindings/v8/custom/V8DocumentLocationCustom.cpp',
+ 'bindings/v8/custom/V8DOMParserConstructor.cpp',
+ 'bindings/v8/custom/V8DOMWindowCustom.cpp',
+ 'bindings/v8/custom/V8DocumentCustom.cpp',
+ 'bindings/v8/custom/V8ElementCustom.cpp',
+ 'bindings/v8/custom/V8EventCustom.cpp',
+ 'bindings/v8/custom/V8HTMLAudioElementConstructor.cpp',
+ 'bindings/v8/custom/V8HTMLCanvasElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLCollectionCustom.cpp',
+ 'bindings/v8/custom/V8HTMLDataGridElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLDocumentCustom.cpp',
+ 'bindings/v8/custom/V8HTMLFormElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLFrameElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLIFrameElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLImageElementConstructor.cpp',
+ 'bindings/v8/custom/V8HTMLInputElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLOptionElementConstructor.cpp',
+ 'bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp',
+ 'bindings/v8/custom/V8HTMLPlugInElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp',
+ 'bindings/v8/custom/V8HTMLSelectElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLSelectElementCustom.h',
+ 'bindings/v8/custom/V8InspectorControllerCustom.cpp',
+ 'bindings/v8/custom/V8LocationCustom.cpp',
+ 'bindings/v8/custom/V8MessageChannelConstructor.cpp',
+ 'bindings/v8/custom/V8MessagePortCustom.cpp',
+ 'bindings/v8/custom/V8NamedNodeMapCustom.cpp',
+ 'bindings/v8/custom/V8NamedNodesCollection.cpp',
+ 'bindings/v8/custom/V8NamedNodesCollection.h',
+ 'bindings/v8/custom/V8NavigatorCustom.cpp',
+ 'bindings/v8/custom/V8NodeCustom.cpp',
+ 'bindings/v8/custom/V8NodeFilterCustom.cpp',
+ 'bindings/v8/custom/V8NodeIteratorCustom.cpp',
+ 'bindings/v8/custom/V8NodeListCustom.cpp',
+ 'bindings/v8/custom/V8SQLResultSetRowListCustom.cpp',
+ 'bindings/v8/custom/V8SQLTransactionCustom.cpp',
+ 'bindings/v8/custom/V8SVGElementInstanceCustom.cpp',
+ 'bindings/v8/custom/V8SVGLengthCustom.cpp',
+ 'bindings/v8/custom/V8SVGMatrixCustom.cpp',
+ 'bindings/v8/custom/V8SharedWorkerCustom.cpp',
+ 'bindings/v8/custom/V8StyleSheetListCustom.cpp',
+ 'bindings/v8/custom/V8TreeWalkerCustom.cpp',
+ 'bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp',
+ 'bindings/v8/custom/V8WebKitPointConstructor.cpp',
+ 'bindings/v8/custom/V8WorkerContextCustom.cpp',
+ 'bindings/v8/custom/V8WorkerCustom.cpp',
+ 'bindings/v8/custom/V8XMLHttpRequestConstructor.cpp',
+ 'bindings/v8/custom/V8XMLHttpRequestCustom.cpp',
+ 'bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp',
+ 'bindings/v8/custom/V8XMLSerializerConstructor.cpp',
+ 'bindings/v8/custom/V8XPathEvaluatorConstructor.cpp',
+ 'bindings/v8/custom/V8XSLTProcessorCustom.cpp',
+ 'bindings/v8/ScheduledAction.cpp',
+ 'bindings/v8/ScheduledAction.h',
+ 'bindings/v8/ScriptCachedFrameData.h',
+ 'bindings/v8/ScriptCallFrame.cpp',
+ 'bindings/v8/ScriptCallFrame.h',
+ 'bindings/v8/ScriptCallStack.cpp',
+ 'bindings/v8/ScriptCallStack.h',
+ 'bindings/v8/ScriptController.cpp',
+ 'bindings/v8/ScriptController.h',
+ 'bindings/v8/ScriptEventListener.cpp',
+ 'bindings/v8/ScriptEventListener.h',
+ 'bindings/v8/ScriptFunctionCall.cpp',
+ 'bindings/v8/ScriptFunctionCall.h',
+ 'bindings/v8/ScriptInstance.cpp',
+ 'bindings/v8/ScriptInstance.h',
+ 'bindings/v8/ScriptObject.cpp',
+ 'bindings/v8/ScriptObject.h',
+ 'bindings/v8/ScriptObjectQuarantine.cpp',
+ 'bindings/v8/ScriptObjectQuarantine.h',
+ 'bindings/v8/ScriptScope.cpp',
+ 'bindings/v8/ScriptScope.h',
+ 'bindings/v8/ScriptSourceCode.h',
+ 'bindings/v8/ScriptState.h',
+ 'bindings/v8/ScriptState.cpp',
+ 'bindings/v8/ScriptString.h',
+ 'bindings/v8/ScriptValue.cpp',
+ 'bindings/v8/ScriptValue.h',
+ 'bindings/v8/V8AbstractEventListener.cpp',
+ 'bindings/v8/V8AbstractEventListener.h',
+ 'bindings/v8/V8Binding.cpp',
+ 'bindings/v8/V8Binding.h',
+ 'bindings/v8/V8Collection.cpp',
+ 'bindings/v8/V8Collection.h',
+ 'bindings/v8/V8DOMMap.cpp',
+ 'bindings/v8/V8DOMMap.h',
+ 'bindings/v8/V8EventListenerList.cpp',
+ 'bindings/v8/V8EventListenerList.h',
+ 'bindings/v8/V8Helpers.cpp',
+ 'bindings/v8/V8Helpers.h',
+ 'bindings/v8/V8Index.cpp',
+ 'bindings/v8/V8Index.h',
+ 'bindings/v8/V8IsolatedWorld.cpp',
+ 'bindings/v8/V8IsolatedWorld.h',
+ 'bindings/v8/V8LazyEventListener.cpp',
+ 'bindings/v8/V8LazyEventListener.h',
+ 'bindings/v8/V8NodeFilterCondition.cpp',
+ 'bindings/v8/V8NodeFilterCondition.h',
+ 'bindings/v8/V8ObjectEventListener.cpp',
+ 'bindings/v8/V8ObjectEventListener.h',
+ 'bindings/v8/V8Proxy.cpp',
+ 'bindings/v8/V8Proxy.h',
+ 'bindings/v8/V8SVGPODTypeWrapper.h',
+ 'bindings/v8/V8Utilities.cpp',
+ 'bindings/v8/V8Utilities.h',
+ 'bindings/v8/V8WorkerContextEventListener.cpp',
+ 'bindings/v8/V8WorkerContextEventListener.h',
+ 'bindings/v8/V8WorkerContextObjectEventListener.cpp',
+ 'bindings/v8/V8WorkerContextObjectEventListener.h',
+ 'bindings/v8/WorkerContextExecutionProxy.h',
+ 'bindings/v8/WorkerContextExecutionProxy.cpp',
+ 'bindings/v8/WorkerScriptController.h',
+ 'bindings/v8/WorkerScriptController.cpp',
+ 'css/CSSBorderImageValue.cpp',
+ 'css/CSSBorderImageValue.h',
+ 'css/CSSCanvasValue.cpp',
+ 'css/CSSCanvasValue.h',
+ 'css/CSSCharsetRule.cpp',
+ 'css/CSSCharsetRule.h',
+ 'css/CSSComputedStyleDeclaration.cpp',
+ 'css/CSSComputedStyleDeclaration.h',
+ 'css/CSSCursorImageValue.cpp',
+ 'css/CSSCursorImageValue.h',
+ 'css/CSSFontFace.cpp',
+ 'css/CSSFontFace.h',
+ 'css/CSSFontFaceRule.cpp',
+ 'css/CSSFontFaceRule.h',
+ 'css/CSSFontFaceSource.cpp',
+ 'css/CSSFontFaceSource.h',
+ 'css/CSSFontFaceSrcValue.cpp',
+ 'css/CSSFontFaceSrcValue.h',
+ 'css/CSSFontSelector.cpp',
+ 'css/CSSFontSelector.h',
+ 'css/CSSFunctionValue.cpp',
+ 'css/CSSFunctionValue.h',
+ 'css/CSSGradientValue.cpp',
+ 'css/CSSGradientValue.h',
+ 'css/CSSHelper.cpp',
+ 'css/CSSHelper.h',
+ 'css/CSSImageGeneratorValue.cpp',
+ 'css/CSSImageGeneratorValue.h',
+ 'css/CSSImageValue.cpp',
+ 'css/CSSImageValue.h',
+ 'css/CSSImportRule.cpp',
+ 'css/CSSImportRule.h',
+ 'css/CSSInheritedValue.cpp',
+ 'css/CSSInheritedValue.h',
+ 'css/CSSInitialValue.cpp',
+ 'css/CSSInitialValue.h',
+ 'css/CSSMediaRule.cpp',
+ 'css/CSSMediaRule.h',
+ 'css/CSSMutableStyleDeclaration.cpp',
+ 'css/CSSMutableStyleDeclaration.h',
+ 'css/CSSNamespace.h',
+ 'css/CSSPageRule.cpp',
+ 'css/CSSPageRule.h',
+ 'css/CSSParser.cpp',
+ 'css/CSSParser.h',
+ 'css/CSSParserValues.cpp',
+ 'css/CSSParserValues.h',
+ 'css/CSSPrimitiveValue.cpp',
+ 'css/CSSPrimitiveValue.h',
+ 'css/CSSPrimitiveValueMappings.h',
+ 'css/CSSProperty.cpp',
+ 'css/CSSProperty.h',
+ 'css/CSSPropertyLonghand.cpp',
+ 'css/CSSPropertyLonghand.h',
+ 'css/CSSQuirkPrimitiveValue.h',
+ 'css/CSSReflectValue.cpp',
+ 'css/CSSReflectValue.h',
+ 'css/CSSReflectionDirection.h',
+ 'css/CSSRule.cpp',
+ 'css/CSSRule.h',
+ 'css/CSSRuleList.cpp',
+ 'css/CSSRuleList.h',
+ 'css/CSSSegmentedFontFace.cpp',
+ 'css/CSSSegmentedFontFace.h',
+ 'css/CSSSelector.cpp',
+ 'css/CSSSelector.h',
+ 'css/CSSSelectorList.cpp',
+ 'css/CSSSelectorList.h',
+ 'css/CSSStyleDeclaration.cpp',
+ 'css/CSSStyleDeclaration.h',
+ 'css/CSSStyleRule.cpp',
+ 'css/CSSStyleRule.h',
+ 'css/CSSStyleSelector.cpp',
+ 'css/CSSStyleSelector.h',
+ 'css/CSSStyleSheet.cpp',
+ 'css/CSSStyleSheet.h',
+ 'css/CSSTimingFunctionValue.cpp',
+ 'css/CSSTimingFunctionValue.h',
+ 'css/CSSUnicodeRangeValue.cpp',
+ 'css/CSSUnicodeRangeValue.h',
+ 'css/CSSUnknownRule.h',
+ 'css/CSSValue.h',
+ 'css/CSSValueList.cpp',
+ 'css/CSSValueList.h',
+ 'css/CSSVariableDependentValue.cpp',
+ 'css/CSSVariableDependentValue.h',
+ 'css/CSSVariablesDeclaration.cpp',
+ 'css/CSSVariablesDeclaration.h',
+ 'css/CSSVariablesRule.cpp',
+ 'css/CSSVariablesRule.h',
+ 'css/Counter.h',
+ 'css/DashboardRegion.h',
+ 'css/FontFamilyValue.cpp',
+ 'css/FontFamilyValue.h',
+ 'css/FontValue.cpp',
+ 'css/FontValue.h',
+ 'css/MediaFeatureNames.cpp',
+ 'css/MediaFeatureNames.h',
+ 'css/MediaList.cpp',
+ 'css/MediaList.h',
+ 'css/MediaQuery.cpp',
+ 'css/MediaQuery.h',
+ 'css/MediaQueryEvaluator.cpp',
+ 'css/MediaQueryEvaluator.h',
+ 'css/MediaQueryExp.cpp',
+ 'css/MediaQueryExp.h',
+ 'css/Pair.h',
+ 'css/Rect.h',
+ 'css/SVGCSSComputedStyleDeclaration.cpp',
+ 'css/SVGCSSParser.cpp',
+ 'css/SVGCSSStyleSelector.cpp',
+ 'css/ShadowValue.cpp',
+ 'css/ShadowValue.h',
+ 'css/StyleBase.cpp',
+ 'css/StyleBase.h',
+ 'css/StyleList.cpp',
+ 'css/StyleList.h',
+ 'css/StyleSheet.cpp',
+ 'css/StyleSheet.h',
+ 'css/StyleSheetList.cpp',
+ 'css/StyleSheetList.h',
+ 'css/WebKitCSSKeyframeRule.cpp',
+ 'css/WebKitCSSKeyframeRule.h',
+ 'css/WebKitCSSKeyframesRule.cpp',
+ 'css/WebKitCSSKeyframesRule.h',
+ 'css/WebKitCSSMatrix.cpp',
+ 'css/WebKitCSSMatrix.h',
+ 'css/WebKitCSSTransformValue.cpp',
+ 'css/WebKitCSSTransformValue.h',
+ 'dom/default/PlatformMessagePortChannel.cpp',
+ 'dom/default/PlatformMessagePortChannel.h',
+ 'dom/ActiveDOMObject.cpp',
+ 'dom/ActiveDOMObject.h',
+ 'dom/Attr.cpp',
+ 'dom/Attr.h',
+ 'dom/Attribute.cpp',
+ 'dom/Attribute.h',
+ 'dom/BeforeTextInsertedEvent.cpp',
+ 'dom/BeforeTextInsertedEvent.h',
+ 'dom/BeforeUnloadEvent.cpp',
+ 'dom/BeforeUnloadEvent.h',
+ 'dom/CDATASection.cpp',
+ 'dom/CDATASection.h',
+ 'dom/CSSMappedAttributeDeclaration.cpp',
+ 'dom/CSSMappedAttributeDeclaration.h',
+ 'dom/CharacterData.cpp',
+ 'dom/CharacterData.h',
+ 'dom/CheckedRadioButtons.cpp',
+ 'dom/CheckedRadioButtons.h',
+ 'dom/ChildNodeList.cpp',
+ 'dom/ChildNodeList.h',
+ 'dom/ClassNames.cpp',
+ 'dom/ClassNames.h',
+ 'dom/ClassNodeList.cpp',
+ 'dom/ClassNodeList.h',
+ 'dom/ClientRect.cpp',
+ 'dom/ClientRect.h',
+ 'dom/ClientRectList.cpp',
+ 'dom/ClientRectList.h',
+ 'dom/Clipboard.cpp',
+ 'dom/Clipboard.h',
+ 'dom/ClipboardAccessPolicy.h',
+ 'dom/ClipboardEvent.cpp',
+ 'dom/ClipboardEvent.h',
+ 'dom/Comment.cpp',
+ 'dom/Comment.h',
+ 'dom/ContainerNode.cpp',
+ 'dom/ContainerNode.h',
+ 'dom/ContainerNodeAlgorithms.h',
+ 'dom/DOMCoreException.h',
+ 'dom/DOMImplementation.cpp',
+ 'dom/DOMImplementation.h',
+ 'dom/DocPtr.h',
+ 'dom/Document.cpp',
+ 'dom/Document.h',
+ 'dom/DocumentFragment.cpp',
+ 'dom/DocumentFragment.h',
+ 'dom/DocumentMarker.h',
+ 'dom/DocumentType.cpp',
+ 'dom/DocumentType.h',
+ 'dom/DynamicNodeList.cpp',
+ 'dom/DynamicNodeList.h',
+ 'dom/EditingText.cpp',
+ 'dom/EditingText.h',
+ 'dom/Element.cpp',
+ 'dom/Element.h',
+ 'dom/ElementRareData.h',
+ 'dom/Entity.cpp',
+ 'dom/Entity.h',
+ 'dom/EntityReference.cpp',
+ 'dom/EntityReference.h',
+ 'dom/Event.cpp',
+ 'dom/Event.h',
+ 'dom/EventException.h',
+ 'dom/EventListener.h',
+ 'dom/EventNames.cpp',
+ 'dom/EventNames.h',
+ 'dom/EventTarget.cpp',
+ 'dom/EventTarget.h',
+ 'dom/ExceptionBase.cpp',
+ 'dom/ExceptionBase.h',
+ 'dom/ExceptionCode.cpp',
+ 'dom/ExceptionCode.h',
+ 'dom/InputElement.cpp',
+ 'dom/InputElement.h',
+ 'dom/KeyboardEvent.cpp',
+ 'dom/KeyboardEvent.h',
+ 'dom/MappedAttribute.cpp',
+ 'dom/MappedAttribute.h',
+ 'dom/MappedAttributeEntry.h',
+ 'dom/MessageChannel.cpp',
+ 'dom/MessageChannel.h',
+ 'dom/MessageEvent.cpp',
+ 'dom/MessageEvent.h',
+ 'dom/MessagePort.cpp',
+ 'dom/MessagePort.h',
+ 'dom/MessagePortChannel.cpp',
+ 'dom/MessagePortChannel.h',
+ 'dom/MouseEvent.cpp',
+ 'dom/MouseEvent.h',
+ 'dom/MouseRelatedEvent.cpp',
+ 'dom/MouseRelatedEvent.h',
+ 'dom/MutationEvent.cpp',
+ 'dom/MutationEvent.h',
+ 'dom/NameNodeList.cpp',
+ 'dom/NameNodeList.h',
+ 'dom/NamedAttrMap.cpp',
+ 'dom/NamedAttrMap.h',
+ 'dom/NamedMappedAttrMap.cpp',
+ 'dom/NamedMappedAttrMap.h',
+ 'dom/NamedNodeMap.h',
+ 'dom/Node.cpp',
+ 'dom/Node.h',
+ 'dom/NodeFilter.cpp',
+ 'dom/NodeFilter.h',
+ 'dom/NodeFilterCondition.cpp',
+ 'dom/NodeFilterCondition.h',
+ 'dom/NodeIterator.cpp',
+ 'dom/NodeIterator.h',
+ 'dom/NodeList.h',
+ 'dom/NodeRareData.h',
+ 'dom/NodeRenderStyle.h',
+ 'dom/NodeWithIndex.h',
+ 'dom/Notation.cpp',
+ 'dom/Notation.h',
+ 'dom/OptionElement.cpp',
+ 'dom/OptionElement.h',
+ 'dom/OptionGroupElement.cpp',
+ 'dom/OptionGroupElement.h',
+ 'dom/OverflowEvent.cpp',
+ 'dom/OverflowEvent.h',
+ 'dom/Position.cpp',
+ 'dom/Position.h',
+ 'dom/PositionIterator.cpp',
+ 'dom/PositionIterator.h',
+ 'dom/ProcessingInstruction.cpp',
+ 'dom/ProcessingInstruction.h',
+ 'dom/ProgressEvent.cpp',
+ 'dom/ProgressEvent.h',
+ 'dom/QualifiedName.cpp',
+ 'dom/QualifiedName.h',
+ 'dom/Range.cpp',
+ 'dom/Range.h',
+ 'dom/RangeBoundaryPoint.h',
+ 'dom/RangeException.h',
+ 'dom/RegisteredEventListener.cpp',
+ 'dom/RegisteredEventListener.h',
+ 'dom/ScriptElement.cpp',
+ 'dom/ScriptElement.h',
+ 'dom/ScriptExecutionContext.cpp',
+ 'dom/ScriptExecutionContext.h',
+ 'dom/SelectElement.cpp',
+ 'dom/SelectElement.h',
+ 'dom/SelectorNodeList.cpp',
+ 'dom/SelectorNodeList.h',
+ 'dom/StaticNodeList.cpp',
+ 'dom/StaticNodeList.h',
+ 'dom/StaticStringList.cpp',
+ 'dom/StaticStringList.h',
+ 'dom/StyleElement.cpp',
+ 'dom/StyleElement.h',
+ 'dom/StyledElement.cpp',
+ 'dom/StyledElement.h',
+ 'dom/TagNodeList.cpp',
+ 'dom/TagNodeList.h',
+ 'dom/Text.cpp',
+ 'dom/Text.h',
+ 'dom/TextEvent.cpp',
+ 'dom/TextEvent.h',
+ 'dom/Tokenizer.h',
+ 'dom/Traversal.cpp',
+ 'dom/Traversal.h',
+ 'dom/TreeWalker.cpp',
+ 'dom/TreeWalker.h',
+ 'dom/UIEvent.cpp',
+ 'dom/UIEvent.h',
+ 'dom/UIEventWithKeyState.cpp',
+ 'dom/UIEventWithKeyState.h',
+ 'dom/WebKitAnimationEvent.cpp',
+ 'dom/WebKitAnimationEvent.h',
+ 'dom/WebKitTransitionEvent.cpp',
+ 'dom/WebKitTransitionEvent.h',
+ 'dom/WheelEvent.cpp',
+ 'dom/WheelEvent.h',
+ 'dom/XMLTokenizer.cpp',
+ 'dom/XMLTokenizer.h',
+ 'dom/XMLTokenizerLibxml2.cpp',
+ 'dom/XMLTokenizerScope.cpp',
+ 'dom/XMLTokenizerScope.h',
+ 'dom/XMLTokenizerQt.cpp',
+ 'editing/android/EditorAndroid.cpp',
+ 'editing/chromium/EditorChromium.cpp',
+ 'editing/mac/EditorMac.mm',
+ 'editing/mac/SelectionControllerMac.mm',
+ 'editing/qt/EditorQt.cpp',
+ 'editing/wx/EditorWx.cpp',
+ 'editing/AppendNodeCommand.cpp',
+ 'editing/AppendNodeCommand.h',
+ 'editing/ApplyStyleCommand.cpp',
+ 'editing/ApplyStyleCommand.h',
+ 'editing/BreakBlockquoteCommand.cpp',
+ 'editing/BreakBlockquoteCommand.h',
+ 'editing/CompositeEditCommand.cpp',
+ 'editing/CompositeEditCommand.h',
+ 'editing/CreateLinkCommand.cpp',
+ 'editing/CreateLinkCommand.h',
+ 'editing/DeleteButton.cpp',
+ 'editing/DeleteButton.h',
+ 'editing/DeleteButtonController.cpp',
+ 'editing/DeleteButtonController.h',
+ 'editing/DeleteFromTextNodeCommand.cpp',
+ 'editing/DeleteFromTextNodeCommand.h',
+ 'editing/DeleteSelectionCommand.cpp',
+ 'editing/DeleteSelectionCommand.h',
+ 'editing/EditAction.h',
+ 'editing/EditCommand.cpp',
+ 'editing/EditCommand.h',
+ 'editing/Editor.cpp',
+ 'editing/Editor.h',
+ 'editing/EditorCommand.cpp',
+ 'editing/EditorDeleteAction.h',
+ 'editing/EditorInsertAction.h',
+ 'editing/FormatBlockCommand.cpp',
+ 'editing/FormatBlockCommand.h',
+ 'editing/HTMLInterchange.cpp',
+ 'editing/HTMLInterchange.h',
+ 'editing/IndentOutdentCommand.cpp',
+ 'editing/IndentOutdentCommand.h',
+ 'editing/InsertIntoTextNodeCommand.cpp',
+ 'editing/InsertIntoTextNodeCommand.h',
+ 'editing/InsertLineBreakCommand.cpp',
+ 'editing/InsertLineBreakCommand.h',
+ 'editing/InsertListCommand.cpp',
+ 'editing/InsertListCommand.h',
+ 'editing/InsertNodeBeforeCommand.cpp',
+ 'editing/InsertNodeBeforeCommand.h',
+ 'editing/InsertParagraphSeparatorCommand.cpp',
+ 'editing/InsertParagraphSeparatorCommand.h',
+ 'editing/InsertTextCommand.cpp',
+ 'editing/InsertTextCommand.h',
+ 'editing/JoinTextNodesCommand.cpp',
+ 'editing/JoinTextNodesCommand.h',
+ 'editing/MergeIdenticalElementsCommand.cpp',
+ 'editing/MergeIdenticalElementsCommand.h',
+ 'editing/ModifySelectionListLevel.cpp',
+ 'editing/ModifySelectionListLevel.h',
+ 'editing/MoveSelectionCommand.cpp',
+ 'editing/MoveSelectionCommand.h',
+ 'editing/RemoveCSSPropertyCommand.cpp',
+ 'editing/RemoveCSSPropertyCommand.h',
+ 'editing/RemoveFormatCommand.cpp',
+ 'editing/RemoveFormatCommand.h',
+ 'editing/RemoveNodeCommand.cpp',
+ 'editing/RemoveNodeCommand.h',
+ 'editing/RemoveNodePreservingChildrenCommand.cpp',
+ 'editing/RemoveNodePreservingChildrenCommand.h',
+ 'editing/ReplaceNodeWithSpanCommand.cpp',
+ 'editing/ReplaceNodeWithSpanCommand.h',
+ 'editing/ReplaceSelectionCommand.cpp',
+ 'editing/ReplaceSelectionCommand.h',
+ 'editing/SelectionController.cpp',
+ 'editing/SelectionController.h',
+ 'editing/SetNodeAttributeCommand.cpp',
+ 'editing/SetNodeAttributeCommand.h',
+ 'editing/SmartReplace.cpp',
+ 'editing/SmartReplace.h',
+ 'editing/SmartReplaceCF.cpp',
+ 'editing/SmartReplaceICU.cpp',
+ 'editing/SplitElementCommand.cpp',
+ 'editing/SplitElementCommand.h',
+ 'editing/SplitTextNodeCommand.cpp',
+ 'editing/SplitTextNodeCommand.h',
+ 'editing/SplitTextNodeContainingElementCommand.cpp',
+ 'editing/SplitTextNodeContainingElementCommand.h',
+ 'editing/TextAffinity.h',
+ 'editing/TextGranularity.h',
+ 'editing/TextIterator.cpp',
+ 'editing/TextIterator.h',
+ 'editing/TypingCommand.cpp',
+ 'editing/TypingCommand.h',
+ 'editing/UnlinkCommand.cpp',
+ 'editing/UnlinkCommand.h',
+ 'editing/VisiblePosition.cpp',
+ 'editing/VisiblePosition.h',
+ 'editing/VisibleSelection.cpp',
+ 'editing/VisibleSelection.h',
+ 'editing/WrapContentsInDummySpanCommand.cpp',
+ 'editing/WrapContentsInDummySpanCommand.h',
+ 'editing/htmlediting.cpp',
+ 'editing/htmlediting.h',
+ 'editing/markup.cpp',
+ 'editing/markup.h',
+ 'editing/visible_units.cpp',
+ 'editing/visible_units.h',
+ 'history/mac/HistoryItemMac.mm',
+ 'history/BackForwardList.cpp',
+ 'history/BackForwardList.h',
+ 'history/BackForwardListChromium.cpp',
+ 'history/CachedFrame.cpp',
+ 'history/CachedFrame.h',
+ 'history/CachedFramePlatformData.h',
+ 'history/CachedPage.cpp',
+ 'history/CachedPage.h',
+ 'history/HistoryItem.cpp',
+ 'history/HistoryItem.h',
+ 'history/PageCache.cpp',
+ 'history/PageCache.h',
+ 'html/CanvasGradient.cpp',
+ 'html/CanvasGradient.h',
+ 'html/CanvasPattern.cpp',
+ 'html/CanvasPattern.h',
+ 'html/CanvasPixelArray.cpp',
+ 'html/CanvasPixelArray.h',
+ 'html/CanvasRenderingContext2D.cpp',
+ 'html/CanvasRenderingContext2D.h',
+ 'html/CanvasStyle.cpp',
+ 'html/CanvasStyle.h',
+ 'html/CollectionCache.cpp',
+ 'html/CollectionCache.h',
+ 'html/CollectionType.h',
+ 'html/DataGridColumn.cpp',
+ 'html/DataGridColumn.h',
+ 'html/DOMDataGridDataSource.cpp',
+ 'html/DOMDataGridDataSource.h',
+ 'html/DataGridColumnList.cpp',
+ 'html/DataGridColumnList.h',
+ 'html/File.cpp',
+ 'html/File.h',
+ 'html/FileList.cpp',
+ 'html/FileList.h',
+ 'html/FormDataList.cpp',
+ 'html/FormDataList.h',
+ 'html/HTMLAnchorElement.cpp',
+ 'html/HTMLAnchorElement.h',
+ 'html/HTMLAppletElement.cpp',
+ 'html/HTMLAppletElement.h',
+ 'html/HTMLAreaElement.cpp',
+ 'html/HTMLAreaElement.h',
+ 'html/HTMLAudioElement.cpp',
+ 'html/HTMLAudioElement.h',
+ 'html/HTMLBRElement.cpp',
+ 'html/HTMLBRElement.h',
+ 'html/HTMLBaseElement.cpp',
+ 'html/HTMLBaseElement.h',
+ 'html/HTMLBaseFontElement.cpp',
+ 'html/HTMLBaseFontElement.h',
+ 'html/HTMLBlockquoteElement.cpp',
+ 'html/HTMLBlockquoteElement.h',
+ 'html/HTMLBodyElement.cpp',
+ 'html/HTMLBodyElement.h',
+ 'html/HTMLButtonElement.cpp',
+ 'html/HTMLButtonElement.h',
+ 'html/HTMLCanvasElement.cpp',
+ 'html/HTMLCanvasElement.h',
+ 'html/HTMLCollection.cpp',
+ 'html/HTMLCollection.h',
+ 'html/HTMLDListElement.cpp',
+ 'html/HTMLDListElement.h',
+ 'html/HTMLDataGridCellElement.cpp',
+ 'html/HTMLDataGridCellElement.h',
+ 'html/HTMLDataGridColElement.cpp',
+ 'html/HTMLDataGridColElement.h',
+ 'html/HTMLDataGridElement.cpp',
+ 'html/HTMLDataGridElement.h',
+ 'html/HTMLDataGridRowElement.cpp',
+ 'html/HTMLDataGridRowElement.h',
+ 'html/HTMLDirectoryElement.cpp',
+ 'html/HTMLDirectoryElement.h',
+ 'html/HTMLDivElement.cpp',
+ 'html/HTMLDivElement.h',
+ 'html/HTMLDocument.cpp',
+ 'html/HTMLDocument.h',
+ 'html/HTMLElement.cpp',
+ 'html/HTMLElement.h',
+ 'html/HTMLEmbedElement.cpp',
+ 'html/HTMLEmbedElement.h',
+ 'html/HTMLFieldSetElement.cpp',
+ 'html/HTMLFieldSetElement.h',
+ 'html/HTMLFontElement.cpp',
+ 'html/HTMLFontElement.h',
+ 'html/HTMLFormCollection.cpp',
+ 'html/HTMLFormCollection.h',
+ 'html/HTMLFormControlElement.cpp',
+ 'html/HTMLFormControlElement.h',
+ 'html/HTMLFormElement.cpp',
+ 'html/HTMLFormElement.h',
+ 'html/HTMLFrameElement.cpp',
+ 'html/HTMLFrameElement.h',
+ 'html/HTMLFrameElementBase.cpp',
+ 'html/HTMLFrameElementBase.h',
+ 'html/HTMLFrameOwnerElement.cpp',
+ 'html/HTMLFrameOwnerElement.h',
+ 'html/HTMLFrameSetElement.cpp',
+ 'html/HTMLFrameSetElement.h',
+ 'html/HTMLHRElement.cpp',
+ 'html/HTMLHRElement.h',
+ 'html/HTMLHeadElement.cpp',
+ 'html/HTMLHeadElement.h',
+ 'html/HTMLHeadingElement.cpp',
+ 'html/HTMLHeadingElement.h',
+ 'html/HTMLHtmlElement.cpp',
+ 'html/HTMLHtmlElement.h',
+ 'html/HTMLIFrameElement.cpp',
+ 'html/HTMLIFrameElement.h',
+ 'html/HTMLImageElement.cpp',
+ 'html/HTMLImageElement.h',
+ 'html/HTMLImageLoader.cpp',
+ 'html/HTMLImageLoader.h',
+ 'html/HTMLInputElement.cpp',
+ 'html/HTMLInputElement.h',
+ 'html/HTMLIsIndexElement.cpp',
+ 'html/HTMLIsIndexElement.h',
+ 'html/HTMLKeygenElement.cpp',
+ 'html/HTMLKeygenElement.h',
+ 'html/HTMLLIElement.cpp',
+ 'html/HTMLLIElement.h',
+ 'html/HTMLLabelElement.cpp',
+ 'html/HTMLLabelElement.h',
+ 'html/HTMLLegendElement.cpp',
+ 'html/HTMLLegendElement.h',
+ 'html/HTMLLinkElement.cpp',
+ 'html/HTMLLinkElement.h',
+ 'html/HTMLMapElement.cpp',
+ 'html/HTMLMapElement.h',
+ 'html/HTMLMarqueeElement.cpp',
+ 'html/HTMLMarqueeElement.h',
+ 'html/HTMLMediaElement.cpp',
+ 'html/HTMLMediaElement.h',
+ 'html/HTMLMenuElement.cpp',
+ 'html/HTMLMenuElement.h',
+ 'html/HTMLMetaElement.cpp',
+ 'html/HTMLMetaElement.h',
+ 'html/HTMLModElement.cpp',
+ 'html/HTMLModElement.h',
+ 'html/HTMLNameCollection.cpp',
+ 'html/HTMLNameCollection.h',
+ 'html/HTMLOListElement.cpp',
+ 'html/HTMLOListElement.h',
+ 'html/HTMLObjectElement.cpp',
+ 'html/HTMLObjectElement.h',
+ 'html/HTMLOptGroupElement.cpp',
+ 'html/HTMLOptGroupElement.h',
+ 'html/HTMLOptionElement.cpp',
+ 'html/HTMLOptionElement.h',
+ 'html/HTMLOptionsCollection.cpp',
+ 'html/HTMLOptionsCollection.h',
+ 'html/HTMLParagraphElement.cpp',
+ 'html/HTMLParagraphElement.h',
+ 'html/HTMLParamElement.cpp',
+ 'html/HTMLParamElement.h',
+ 'html/HTMLParser.cpp',
+ 'html/HTMLParser.h',
+ 'html/HTMLParserErrorCodes.cpp',
+ 'html/HTMLParserErrorCodes.h',
+ 'html/HTMLPlugInElement.cpp',
+ 'html/HTMLPlugInElement.h',
+ 'html/HTMLPlugInImageElement.cpp',
+ 'html/HTMLPlugInImageElement.h',
+ 'html/HTMLPreElement.cpp',
+ 'html/HTMLPreElement.h',
+ 'html/HTMLQuoteElement.cpp',
+ 'html/HTMLQuoteElement.h',
+ 'html/HTMLScriptElement.cpp',
+ 'html/HTMLScriptElement.h',
+ 'html/HTMLSelectElement.cpp',
+ 'html/HTMLSelectElement.h',
+ 'html/HTMLSourceElement.cpp',
+ 'html/HTMLSourceElement.h',
+ 'html/HTMLStyleElement.cpp',
+ 'html/HTMLStyleElement.h',
+ 'html/HTMLTableCaptionElement.cpp',
+ 'html/HTMLTableCaptionElement.h',
+ 'html/HTMLTableCellElement.cpp',
+ 'html/HTMLTableCellElement.h',
+ 'html/HTMLTableColElement.cpp',
+ 'html/HTMLTableColElement.h',
+ 'html/HTMLTableElement.cpp',
+ 'html/HTMLTableElement.h',
+ 'html/HTMLTablePartElement.cpp',
+ 'html/HTMLTablePartElement.h',
+ 'html/HTMLTableRowElement.cpp',
+ 'html/HTMLTableRowElement.h',
+ 'html/HTMLTableRowsCollection.cpp',
+ 'html/HTMLTableRowsCollection.h',
+ 'html/HTMLTableSectionElement.cpp',
+ 'html/HTMLTableSectionElement.h',
+ 'html/HTMLTextAreaElement.cpp',
+ 'html/HTMLTextAreaElement.h',
+ 'html/HTMLTitleElement.cpp',
+ 'html/HTMLTitleElement.h',
+ 'html/HTMLTokenizer.cpp',
+ 'html/HTMLTokenizer.h',
+ 'html/HTMLUListElement.cpp',
+ 'html/HTMLUListElement.h',
+ 'html/HTMLVideoElement.cpp',
+ 'html/HTMLVideoElement.h',
+ 'html/HTMLViewSourceDocument.cpp',
+ 'html/HTMLViewSourceDocument.h',
+ 'html/ImageData.cpp',
+ 'html/ImageData.h',
+ 'html/MediaError.h',
+ 'html/PreloadScanner.cpp',
+ 'html/PreloadScanner.h',
+ 'html/TextMetrics.h',
+ 'html/TimeRanges.cpp',
+ 'html/TimeRanges.h',
+ 'html/ValidityState.cpp',
+ 'html/ValidityState.h',
+ 'html/VoidCallback.h',
+ 'inspector/InspectorClient.h',
+ 'inspector/ConsoleMessage.cpp',
+ 'inspector/ConsoleMessage.h',
+ 'inspector/InspectorController.cpp',
+ 'inspector/InspectorController.h',
+ 'inspector/InspectorDatabaseResource.cpp',
+ 'inspector/InspectorDatabaseResource.h',
+ 'inspector/InspectorDOMStorageResource.cpp',
+ 'inspector/InspectorDOMStorageResource.h',
+ 'inspector/InspectorFrontend.cpp',
+ 'inspector/InspectorFrontend.h',
+ 'inspector/InspectorJSONObject.cpp',
+ 'inspector/InspectorJSONObject.h',
+ 'inspector/InspectorResource.cpp',
+ 'inspector/InspectorResource.h',
+ 'inspector/JavaScriptCallFrame.cpp',
+ 'inspector/JavaScriptCallFrame.h',
+ 'inspector/JavaScriptDebugListener.h',
+ 'inspector/JavaScriptDebugServer.cpp',
+ 'inspector/JavaScriptDebugServer.h',
+ 'inspector/JavaScriptProfile.cpp',
+ 'inspector/JavaScriptProfile.h',
+ 'inspector/JavaScriptProfileNode.cpp',
+ 'inspector/JavaScriptProfileNode.h',
+ 'loader/appcache/ApplicationCache.cpp',
+ 'loader/appcache/ApplicationCache.h',
+ 'loader/appcache/ApplicationCacheGroup.cpp',
+ 'loader/appcache/ApplicationCacheGroup.h',
+ 'loader/appcache/ApplicationCacheResource.cpp',
+ 'loader/appcache/ApplicationCacheResource.h',
+ 'loader/appcache/ApplicationCacheStorage.cpp',
+ 'loader/appcache/ApplicationCacheStorage.h',
+ 'loader/appcache/DOMApplicationCache.cpp',
+ 'loader/appcache/DOMApplicationCache.h',
+ 'loader/appcache/ManifestParser.cpp',
+ 'loader/appcache/ManifestParser.h',
+ 'loader/archive/cf/LegacyWebArchive.cpp',
+ 'loader/archive/cf/LegacyWebArchive.h',
+ 'loader/archive/cf/LegacyWebArchiveMac.mm',
+ 'loader/archive/Archive.h',
+ 'loader/archive/ArchiveFactory.cpp',
+ 'loader/archive/ArchiveFactory.h',
+ 'loader/archive/ArchiveResource.cpp',
+ 'loader/archive/ArchiveResource.h',
+ 'loader/archive/ArchiveResourceCollection.cpp',
+ 'loader/archive/ArchiveResourceCollection.h',
+ 'loader/icon/IconDatabase.cpp',
+ 'loader/icon/IconDatabase.h',
+ 'loader/icon/IconDatabaseClient.h',
+ 'loader/icon/IconDatabaseNone.cpp',
+ 'loader/icon/IconFetcher.cpp',
+ 'loader/icon/IconFetcher.h',
+ 'loader/icon/IconLoader.cpp',
+ 'loader/icon/IconLoader.h',
+ 'loader/icon/IconRecord.cpp',
+ 'loader/icon/IconRecord.h',
+ 'loader/icon/PageURLRecord.cpp',
+ 'loader/icon/PageURLRecord.h',
+ 'loader/mac/DocumentLoaderMac.cpp',
+ 'loader/mac/LoaderNSURLExtras.h',
+ 'loader/mac/LoaderNSURLExtras.mm',
+ 'loader/mac/ResourceLoaderMac.mm',
+ 'loader/win/DocumentLoaderWin.cpp',
+ 'loader/win/FrameLoaderWin.cpp',
+ 'loader/Cache.cpp',
+ 'loader/Cache.h',
+ 'loader/CachePolicy.h',
+ 'loader/CachedCSSStyleSheet.cpp',
+ 'loader/CachedCSSStyleSheet.h',
+ 'loader/CachedFont.cpp',
+ 'loader/CachedFont.h',
+ 'loader/CachedImage.cpp',
+ 'loader/CachedImage.h',
+ 'loader/CachedResource.cpp',
+ 'loader/CachedResource.h',
+ 'loader/CachedResourceClient.h',
+ 'loader/CachedResourceClientWalker.cpp',
+ 'loader/CachedResourceClientWalker.h',
+ 'loader/CachedResourceHandle.cpp',
+ 'loader/CachedResourceHandle.h',
+ 'loader/CachedScript.cpp',
+ 'loader/CachedScript.h',
+ 'loader/CachedXBLDocument.cpp',
+ 'loader/CachedXBLDocument.h',
+ 'loader/CachedXSLStyleSheet.cpp',
+ 'loader/CachedXSLStyleSheet.h',
+ 'loader/CrossOriginAccessControl.cpp',
+ 'loader/CrossOriginAccessControl.h',
+ 'loader/CrossOriginPreflightResultCache.cpp',
+ 'loader/CrossOriginPreflightResultCache.h',
+ 'loader/DocLoader.cpp',
+ 'loader/DocLoader.h',
+ 'loader/DocumentLoader.cpp',
+ 'loader/DocumentLoader.h',
+ 'loader/DocumentThreadableLoader.cpp',
+ 'loader/DocumentThreadableLoader.h',
+ 'loader/EmptyClients.h',
+ 'loader/FTPDirectoryDocument.cpp',
+ 'loader/FTPDirectoryDocument.h',
+ 'loader/FTPDirectoryParser.cpp',
+ 'loader/FTPDirectoryParser.h',
+ 'loader/FormState.cpp',
+ 'loader/FormState.h',
+ 'loader/FrameLoader.cpp',
+ 'loader/FrameLoader.h',
+ 'loader/FrameLoaderClient.h',
+ 'loader/FrameLoaderTypes.h',
+ 'loader/ImageDocument.cpp',
+ 'loader/ImageDocument.h',
+ 'loader/ImageLoader.cpp',
+ 'loader/ImageLoader.h',
+ 'loader/MainResourceLoader.cpp',
+ 'loader/MainResourceLoader.h',
+ 'loader/MediaDocument.cpp',
+ 'loader/MediaDocument.h',
+ 'loader/NavigationAction.cpp',
+ 'loader/NavigationAction.h',
+ 'loader/NetscapePlugInStreamLoader.cpp',
+ 'loader/NetscapePlugInStreamLoader.h',
+ 'loader/PluginDocument.cpp',
+ 'loader/PluginDocument.h',
+ 'loader/ProgressTracker.cpp',
+ 'loader/ProgressTracker.h',
+ 'loader/Request.cpp',
+ 'loader/Request.h',
+ 'loader/ResourceLoader.cpp',
+ 'loader/ResourceLoader.h',
+ 'loader/SubresourceLoader.cpp',
+ 'loader/SubresourceLoader.h',
+ 'loader/SubresourceLoaderClient.h',
+ 'loader/SubstituteData.h',
+ 'loader/SubstituteResource.h',
+ 'loader/TextDocument.cpp',
+ 'loader/TextDocument.h',
+ 'loader/TextResourceDecoder.cpp',
+ 'loader/TextResourceDecoder.h',
+ 'loader/ThreadableLoader.cpp',
+ 'loader/ThreadableLoader.h',
+ 'loader/ThreadableLoaderClient.h',
+ 'loader/ThreadableLoaderClientWrapper.h',
+ 'loader/UserStyleSheetLoader.cpp',
+ 'loader/UserStyleSheetLoader.h',
+ 'loader/WorkerThreadableLoader.cpp',
+ 'loader/WorkerThreadableLoader.h',
+ 'loader/loader.cpp',
+ 'loader/loader.h',
+ 'page/animation/AnimationBase.cpp',
+ 'page/animation/AnimationBase.h',
+ 'page/animation/AnimationController.cpp',
+ 'page/animation/AnimationController.h',
+ 'page/animation/AnimationControllerPrivate.h',
+ 'page/animation/CompositeAnimation.cpp',
+ 'page/animation/CompositeAnimation.h',
+ 'page/animation/ImplicitAnimation.cpp',
+ 'page/animation/ImplicitAnimation.h',
+ 'page/animation/KeyframeAnimation.cpp',
+ 'page/animation/KeyframeAnimation.h',
+ 'page/chromium/ChromeClientChromium.h',
+ 'page/chromium/DragControllerChromium.cpp',
+ 'page/chromium/EventHandlerChromium.cpp',
+ 'page/chromium/FrameChromium.cpp',
+ 'page/chromium/FrameChromium.h',
+ 'page/gtk/DragControllerGtk.cpp',
+ 'page/gtk/EventHandlerGtk.cpp',
+ 'page/gtk/FrameGtk.cpp',
+ 'page/mac/ChromeMac.mm',
+ 'page/mac/DragControllerMac.mm',
+ 'page/mac/EventHandlerMac.mm',
+ 'page/mac/FrameMac.mm',
+ 'page/mac/PageMac.cpp',
+ 'page/mac/WebCoreFrameView.h',
+ 'page/mac/WebCoreKeyboardUIMode.h',
+ 'page/mac/WebCoreViewFactory.h',
+ 'page/mac/WebCoreViewFactory.m',
+ 'page/mac/WebDashboardRegion.h',
+ 'page/mac/WebDashboardRegion.m',
+ 'page/qt/DragControllerQt.cpp',
+ 'page/qt/EventHandlerQt.cpp',
+ 'page/qt/FrameQt.cpp',
+ 'page/win/DragControllerWin.cpp',
+ 'page/win/EventHandlerWin.cpp',
+ 'page/win/FrameCGWin.cpp',
+ 'page/win/FrameCairoWin.cpp',
+ 'page/win/FrameWin.cpp',
+ 'page/win/FrameWin.h',
+ 'page/win/PageWin.cpp',
+ 'page/wx/DragControllerWx.cpp',
+ 'page/wx/EventHandlerWx.cpp',
+ 'page/BarInfo.cpp',
+ 'page/BarInfo.h',
+ 'page/Chrome.cpp',
+ 'page/Chrome.h',
+ 'page/ChromeClient.h',
+ 'page/Console.cpp',
+ 'page/Console.h',
+ 'page/ContextMenuClient.h',
+ 'page/ContextMenuController.cpp',
+ 'page/ContextMenuController.h',
+ 'page/Coordinates.cpp',
+ 'page/DOMSelection.cpp',
+ 'page/DOMSelection.h',
+ 'page/DOMTimer.cpp',
+ 'page/DOMTimer.h',
+ 'page/DOMWindow.cpp',
+ 'page/DOMWindow.h',
+ 'page/DragActions.h',
+ 'page/DragClient.h',
+ 'page/DragController.cpp',
+ 'page/DragController.h',
+ 'page/EditorClient.h',
+ 'page/EventHandler.cpp',
+ 'page/EventHandler.h',
+ 'page/FocusController.cpp',
+ 'page/FocusController.h',
+ 'page/FocusDirection.h',
+ 'page/Frame.cpp',
+ 'page/Frame.h',
+ 'page/FrameLoadRequest.h',
+ 'page/FrameTree.cpp',
+ 'page/FrameTree.h',
+ 'page/FrameView.cpp',
+ 'page/FrameView.h',
+ 'page/Geolocation.cpp',
+ 'page/Geolocation.h',
+ 'page/Geoposition.cpp',
+ 'page/Geoposition.h',
+ 'page/History.cpp',
+ 'page/History.h',
+ 'page/Location.cpp',
+ 'page/Location.h',
+ 'page/MouseEventWithHitTestResults.cpp',
+ 'page/MouseEventWithHitTestResults.h',
+ 'page/Navigator.cpp',
+ 'page/Navigator.h',
+ 'page/NavigatorBase.cpp',
+ 'page/NavigatorBase.h',
+ 'page/Page.cpp',
+ 'page/Page.h',
+ 'page/PageGroup.cpp',
+ 'page/PageGroup.h',
+ 'page/PageGroupLoadDeferrer.cpp',
+ 'page/PageGroupLoadDeferrer.h',
+ 'page/PositionCallback.h',
+ 'page/PositionError.h',
+ 'page/PositionErrorCallback.h',
+ 'page/PositionOptions.h',
+ 'page/PrintContext.cpp',
+ 'page/PrintContext.h',
+ 'page/Screen.cpp',
+ 'page/Screen.h',
+ 'page/SecurityOrigin.cpp',
+ 'page/SecurityOrigin.h',
+ 'page/SecurityOriginHash.h',
+ 'page/Settings.cpp',
+ 'page/Settings.h',
+ 'page/WebKitPoint.h',
+ 'page/WindowFeatures.cpp',
+ 'page/WindowFeatures.h',
+ 'page/WorkerNavigator.cpp',
+ 'page/WorkerNavigator.h',
+ 'page/XSSAuditor.cpp',
+ 'page/XSSAuditor.h',
+ 'platform/animation/Animation.cpp',
+ 'platform/animation/Animation.h',
+ 'platform/animation/AnimationList.cpp',
+ 'platform/animation/AnimationList.h',
+ 'platform/animation/TimingFunction.h',
+ 'platform/cf/FileSystemCF.cpp',
+ 'platform/cf/KURLCFNet.cpp',
+ 'platform/cf/SchedulePair.cpp',
+ 'platform/cf/SchedulePair.h',
+ 'platform/cf/SharedBufferCF.cpp',
+ 'platform/chromium/ChromiumBridge.h',
+ 'platform/chromium/ChromiumDataObject.cpp',
+ 'platform/chromium/ChromiumDataObject.h',
+ 'platform/chromium/ClipboardChromium.cpp',
+ 'platform/chromium/ClipboardChromium.h',
+ 'platform/chromium/ClipboardChromiumLinux.cpp',
+ 'platform/chromium/ClipboardChromiumMac.cpp',
+ 'platform/chromium/ClipboardChromiumWin.cpp',
+ 'platform/chromium/ClipboardUtilitiesChromium.cpp',
+ 'platform/chromium/ClipboardUtilitiesChromium.h',
+ 'platform/chromium/ContextMenuChromium.cpp',
+ 'platform/chromium/ContextMenuItemChromium.cpp',
+ 'platform/chromium/CursorChromium.cpp',
+ 'platform/chromium/DragDataChromium.cpp',
+ 'platform/chromium/DragDataRef.h',
+ 'platform/chromium/DragImageChromium.cpp',
+ 'platform/chromium/DragImageRef.h',
+ 'platform/chromium/FileChooserChromium.cpp',
+ 'platform/chromium/FileSystemChromium.cpp',
+ 'platform/chromium/FileSystemChromiumLinux.cpp',
+ 'platform/chromium/FileSystemChromiumMac.mm',
+ 'platform/chromium/FileSystemChromiumWin.cpp',
+ 'platform/chromium/FramelessScrollView.cpp',
+ 'platform/chromium/FramelessScrollView.h',
+ 'platform/chromium/FramelessScrollViewClient.h',
+ 'platform/chromium/KeyCodeConversion.h',
+ 'platform/chromium/KeyCodeConversionGtk.cpp',
+ 'platform/chromium/KeyboardCodesPosix.h',
+ 'platform/chromium/KeyboardCodesWin.h',
+ 'platform/chromium/Language.cpp',
+ 'platform/chromium/LinkHashChromium.cpp',
+ 'platform/chromium/MimeTypeRegistryChromium.cpp',
+ 'platform/chromium/PasteboardChromium.cpp',
+ 'platform/chromium/PasteboardPrivate.h',
+ 'platform/chromium/PlatformCursor.h',
+ 'platform/chromium/PlatformKeyboardEventChromium.cpp',
+ 'platform/chromium/PlatformScreenChromium.cpp',
+ 'platform/chromium/PlatformWidget.h',
+ 'platform/chromium/PopupMenuChromium.cpp',
+ 'platform/chromium/PopupMenuChromium.h',
+ 'platform/chromium/PopupMenuPrivate.h',
+ 'platform/chromium/SSLKeyGeneratorChromium.cpp',
+ 'platform/chromium/ScrollbarThemeChromium.cpp',
+ 'platform/chromium/ScrollbarThemeChromium.h',
+ 'platform/chromium/ScrollbarThemeChromiumLinux.cpp',
+ 'platform/chromium/ScrollbarThemeChromiumWin.cpp',
+ 'platform/chromium/SearchPopupMenuChromium.cpp',
+ 'platform/chromium/SharedTimerChromium.cpp',
+ 'platform/chromium/SoundChromiumPosix.cpp',
+ 'platform/chromium/SoundChromiumWin.cpp',
+ 'platform/chromium/SuddenTerminationChromium.cpp',
+ 'platform/chromium/SystemTimeChromium.cpp',
+ 'platform/chromium/TemporaryLinkStubs.cpp',
+ 'platform/chromium/WidgetChromium.cpp',
+ 'platform/chromium/WindowsVersion.cpp',
+ 'platform/chromium/WindowsVersion.h',
+ 'platform/graphics/cairo/CairoPath.h',
+ 'platform/graphics/cairo/FontCairo.cpp',
+ 'platform/graphics/cairo/GradientCairo.cpp',
+ 'platform/graphics/cairo/GraphicsContextCairo.cpp',
+ 'platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h',
+ 'platform/graphics/cairo/ImageBufferCairo.cpp',
+ 'platform/graphics/cairo/ImageBufferData.h',
+ 'platform/graphics/cairo/ImageCairo.cpp',
+ 'platform/graphics/cairo/ImageSourceCairo.cpp',
+ 'platform/graphics/cairo/PathCairo.cpp',
+ 'platform/graphics/cairo/PatternCairo.cpp',
+ 'platform/graphics/cairo/TransformationMatrixCairo.cpp',
+ 'platform/graphics/cg/ColorCG.cpp',
+ 'platform/graphics/cg/FloatPointCG.cpp',
+ 'platform/graphics/cg/FloatRectCG.cpp',
+ 'platform/graphics/cg/FloatSizeCG.cpp',
+ 'platform/graphics/cg/GradientCG.cpp',
+ 'platform/graphics/cg/GraphicsContextCG.cpp',
+ 'platform/graphics/cg/GraphicsContextPlatformPrivateCG.h',
+ 'platform/graphics/cg/ImageBufferCG.cpp',
+ 'platform/graphics/cg/ImageBufferData.h',
+ 'platform/graphics/cg/ImageCG.cpp',
+ 'platform/graphics/cg/ImageSourceCG.cpp',
+ 'platform/graphics/cg/ImageSourceCG.h',
+ 'platform/graphics/cg/ImageSourceCGMac.mm',
+ 'platform/graphics/cg/ImageSourceCGWin.cpp',
+ 'platform/graphics/cg/IntPointCG.cpp',
+ 'platform/graphics/cg/IntRectCG.cpp',
+ 'platform/graphics/cg/IntSizeCG.cpp',
+ 'platform/graphics/cg/PDFDocumentImage.cpp',
+ 'platform/graphics/cg/PDFDocumentImage.h',
+ 'platform/graphics/cg/PathCG.cpp',
+ 'platform/graphics/cg/PatternCG.cpp',
+ 'platform/graphics/cg/TransformationMatrixCG.cpp',
+ 'platform/graphics/chromium/FontCacheChromiumWin.cpp',
+ 'platform/graphics/chromium/FontCacheLinux.cpp',
+ 'platform/graphics/chromium/FontChromiumWin.cpp',
+ 'platform/graphics/chromium/FontCustomPlatformData.cpp',
+ 'platform/graphics/chromium/FontCustomPlatformData.h',
+ 'platform/graphics/chromium/FontLinux.cpp',
+ 'platform/graphics/chromium/FontPlatformData.h',
+ 'platform/graphics/chromium/FontPlatformDataChromiumWin.cpp',
+ 'platform/graphics/chromium/FontPlatformDataChromiumWin.h',
+ 'platform/graphics/chromium/FontPlatformDataLinux.cpp',
+ 'platform/graphics/chromium/FontPlatformDataLinux.h',
+ 'platform/graphics/chromium/FontUtilsChromiumWin.cpp',
+ 'platform/graphics/chromium/FontUtilsChromiumWin.h',
+ 'platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp',
+ 'platform/graphics/chromium/GlyphPageTreeNodeLinux.cpp',
+ 'platform/graphics/chromium/IconChromiumLinux.cpp',
+ 'platform/graphics/chromium/IconChromiumMac.cpp',
+ 'platform/graphics/chromium/IconChromiumWin.cpp',
+ 'platform/graphics/chromium/ImageBufferData.h',
+ 'platform/graphics/chromium/ImageChromiumMac.mm',
+ 'platform/graphics/chromium/MediaPlayerPrivateChromium.h',
+ 'platform/graphics/chromium/PlatformIcon.h',
+ 'platform/graphics/chromium/SimpleFontDataChromiumWin.cpp',
+ 'platform/graphics/chromium/SimpleFontDataLinux.cpp',
+ 'platform/graphics/chromium/TransparencyWin.cpp',
+ 'platform/graphics/chromium/TransparencyWin.h',
+ 'platform/graphics/chromium/UniscribeHelper.cpp',
+ 'platform/graphics/chromium/UniscribeHelper.h',
+ 'platform/graphics/chromium/UniscribeHelperTextRun.cpp',
+ 'platform/graphics/chromium/UniscribeHelperTextRun.h',
+ 'platform/graphics/filters/FEBlend.cpp',
+ 'platform/graphics/filters/FEBlend.h',
+ 'platform/graphics/filters/FEColorMatrix.cpp',
+ 'platform/graphics/filters/FEColorMatrix.h',
+ 'platform/graphics/filters/FEComponentTransfer.cpp',
+ 'platform/graphics/filters/FEComponentTransfer.h',
+ 'platform/graphics/filters/FEComposite.cpp',
+ 'platform/graphics/filters/FEComposite.h',
+ 'platform/graphics/filters/SourceAlpha.cpp',
+ 'platform/graphics/filters/SourceAlpha.h',
+ 'platform/graphics/filters/SourceGraphic.cpp',
+ 'platform/graphics/filters/SourceGraphic.h',
+ 'platform/graphics/gtk/ColorGtk.cpp',
+ 'platform/graphics/gtk/FontCacheGtk.cpp',
+ 'platform/graphics/gtk/FontCustomPlatformData.cpp',
+ 'platform/graphics/gtk/FontCustomPlatformData.h',
+ 'platform/graphics/gtk/FontCustomPlatformDataPango.cpp',
+ 'platform/graphics/gtk/FontGtk.cpp',
+ 'platform/graphics/gtk/FontPlatformData.h',
+ 'platform/graphics/gtk/FontPlatformDataGtk.cpp',
+ 'platform/graphics/gtk/FontPlatformDataPango.cpp',
+ 'platform/graphics/gtk/GlyphPageTreeNodeGtk.cpp',
+ 'platform/graphics/gtk/GlyphPageTreeNodePango.cpp',
+ 'platform/graphics/gtk/IconGtk.cpp',
+ 'platform/graphics/gtk/ImageGtk.cpp',
+ 'platform/graphics/gtk/IntPointGtk.cpp',
+ 'platform/graphics/gtk/IntRectGtk.cpp',
+ 'platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp',
+ 'platform/graphics/gtk/MediaPlayerPrivateGStreamer.h',
+ 'platform/graphics/gtk/SimpleFontDataGtk.cpp',
+ 'platform/graphics/gtk/SimpleFontDataPango.cpp',
+ 'platform/graphics/gtk/VideoSinkGStreamer.cpp',
+ 'platform/graphics/gtk/VideoSinkGStreamer.h',
+ 'platform/graphics/mac/ColorMac.h',
+ 'platform/graphics/mac/ColorMac.mm',
+ 'platform/graphics/mac/CoreTextController.cpp',
+ 'platform/graphics/mac/CoreTextController.h',
+ 'platform/graphics/mac/FloatPointMac.mm',
+ 'platform/graphics/mac/FloatRectMac.mm',
+ 'platform/graphics/mac/FloatSizeMac.mm',
+ 'platform/graphics/mac/FontCacheMac.mm',
+ 'platform/graphics/mac/FontCustomPlatformData.cpp',
+ 'platform/graphics/mac/FontCustomPlatformData.h',
+ 'platform/graphics/mac/FontMac.mm',
+ 'platform/graphics/mac/FontMacATSUI.mm',
+ 'platform/graphics/mac/FontMacCoreText.cpp',
+ 'platform/graphics/mac/FontPlatformData.h',
+ 'platform/graphics/mac/FontPlatformDataMac.mm',
+ 'platform/graphics/mac/GlyphPageTreeNodeMac.cpp',
+ 'platform/graphics/mac/GraphicsContextMac.mm',
+ 'platform/graphics/mac/GraphicsLayerCA.h',
+ 'platform/graphics/mac/GraphicsLayerCA.mm',
+ 'platform/graphics/mac/IconMac.mm',
+ 'platform/graphics/mac/ImageMac.mm',
+ 'platform/graphics/mac/IntPointMac.mm',
+ 'platform/graphics/mac/IntRectMac.mm',
+ 'platform/graphics/mac/IntSizeMac.mm',
+ 'platform/graphics/mac/MediaPlayerPrivateQTKit.h',
+ 'platform/graphics/mac/MediaPlayerPrivateQTKit.mm',
+ 'platform/graphics/mac/MediaPlayerProxy.h',
+ 'platform/graphics/mac/SimpleFontDataMac.mm',
+ 'platform/graphics/mac/WebLayer.h',
+ 'platform/graphics/mac/WebLayer.mm',
+ 'platform/graphics/mac/WebTiledLayer.h',
+ 'platform/graphics/mac/WebTiledLayer.mm',
+ 'platform/graphics/MediaPlayer.cpp',
+ 'platform/graphics/opentype/OpenTypeUtilities.cpp',
+ 'platform/graphics/opentype/OpenTypeUtilities.h',
+ 'platform/graphics/qt/ColorQt.cpp',
+ 'platform/graphics/qt/FloatPointQt.cpp',
+ 'platform/graphics/qt/FloatRectQt.cpp',
+ 'platform/graphics/qt/FontCacheQt.cpp',
+ 'platform/graphics/qt/FontCustomPlatformData.cpp',
+ 'platform/graphics/qt/FontCustomPlatformData.h',
+ 'platform/graphics/qt/FontFallbackListQt.cpp',
+ 'platform/graphics/qt/FontPlatformData.h',
+ 'platform/graphics/qt/FontPlatformDataQt.cpp',
+ 'platform/graphics/qt/FontQt.cpp',
+ 'platform/graphics/qt/FontQt43.cpp',
+ 'platform/graphics/qt/GlyphPageTreeNodeQt.cpp',
+ 'platform/graphics/qt/GradientQt.cpp',
+ 'platform/graphics/qt/GraphicsContextQt.cpp',
+ 'platform/graphics/qt/IconQt.cpp',
+ 'platform/graphics/qt/ImageBufferData.h',
+ 'platform/graphics/qt/ImageBufferQt.cpp',
+ 'platform/graphics/qt/ImageDecoderQt.cpp',
+ 'platform/graphics/qt/ImageDecoderQt.h',
+ 'platform/graphics/qt/ImageQt.cpp',
+ 'platform/graphics/qt/ImageSourceQt.cpp',
+ 'platform/graphics/qt/IntPointQt.cpp',
+ 'platform/graphics/qt/IntRectQt.cpp',
+ 'platform/graphics/qt/IntSizeQt.cpp',
+ 'platform/graphics/qt/MediaPlayerPrivatePhonon.cpp',
+ 'platform/graphics/qt/MediaPlayerPrivatePhonon.h',
+ 'platform/graphics/qt/PathQt.cpp',
+ 'platform/graphics/qt/PatternQt.cpp',
+ 'platform/graphics/qt/SimpleFontDataQt.cpp',
+ 'platform/graphics/qt/StillImageQt.cpp',
+ 'platform/graphics/qt/StillImageQt.h',
+ 'platform/graphics/qt/TransformationMatrixQt.cpp',
+ 'platform/graphics/skia/BitmapImageSingleFrameSkia.h',
+ 'platform/graphics/skia/FloatPointSkia.cpp',
+ 'platform/graphics/skia/FloatRectSkia.cpp',
+ 'platform/graphics/skia/GradientSkia.cpp',
+ 'platform/graphics/skia/GraphicsContextPlatformPrivate.h',
+ 'platform/graphics/skia/GraphicsContextSkia.cpp',
+ 'platform/graphics/skia/ImageBufferSkia.cpp',
+ 'platform/graphics/skia/ImageSkia.cpp',
+ 'platform/graphics/skia/ImageSourceSkia.cpp',
+ 'platform/graphics/skia/ImageSourceSkia.h',
+ 'platform/graphics/skia/IntPointSkia.cpp',
+ 'platform/graphics/skia/IntRectSkia.cpp',
+ 'platform/graphics/skia/NativeImageSkia.cpp',
+ 'platform/graphics/skia/NativeImageSkia.h',
+ 'platform/graphics/skia/PathSkia.cpp',
+ 'platform/graphics/skia/PatternSkia.cpp',
+ 'platform/graphics/skia/PlatformContextSkia.cpp',
+ 'platform/graphics/skia/PlatformContextSkia.h',
+ 'platform/graphics/skia/PlatformGraphics.h',
+ 'platform/graphics/skia/SkiaFontWin.cpp',
+ 'platform/graphics/skia/SkiaFontWin.h',
+ 'platform/graphics/skia/SkiaUtils.cpp',
+ 'platform/graphics/skia/SkiaUtils.h',
+ 'platform/graphics/skia/TransformationMatrixSkia.cpp',
+ 'platform/graphics/transforms/IdentityTransformOperation.h',
+ 'platform/graphics/transforms/Matrix3DTransformOperation.cpp',
+ 'platform/graphics/transforms/Matrix3DTransformOperation.h',
+ 'platform/graphics/transforms/MatrixTransformOperation.cpp',
+ 'platform/graphics/transforms/MatrixTransformOperation.h',
+ 'platform/graphics/transforms/PerspectiveTransformOperation.cpp',
+ 'platform/graphics/transforms/PerspectiveTransformOperation.h',
+ 'platform/graphics/transforms/RotateTransformOperation.cpp',
+ 'platform/graphics/transforms/RotateTransformOperation.h',
+ 'platform/graphics/transforms/ScaleTransformOperation.cpp',
+ 'platform/graphics/transforms/ScaleTransformOperation.h',
+ 'platform/graphics/transforms/SkewTransformOperation.cpp',
+ 'platform/graphics/transforms/SkewTransformOperation.h',
+ 'platform/graphics/transforms/TransformOperation.h',
+ 'platform/graphics/transforms/TransformOperations.cpp',
+ 'platform/graphics/transforms/TransformOperations.h',
+ 'platform/graphics/transforms/TransformationMatrix.cpp',
+ 'platform/graphics/transforms/TransformationMatrix.h',
+ 'platform/graphics/transforms/TranslateTransformOperation.cpp',
+ 'platform/graphics/transforms/TranslateTransformOperation.h',
+ 'platform/graphics/win/ColorSafari.cpp',
+ 'platform/graphics/win/FontCGWin.cpp',
+ 'platform/graphics/win/FontCacheWin.cpp',
+ 'platform/graphics/win/FontCustomPlatformData.cpp',
+ 'platform/graphics/win/FontCustomPlatformData.h',
+ 'platform/graphics/win/FontCustomPlatformDataCairo.cpp',
+ 'platform/graphics/win/FontCustomPlatformDataCairo.h',
+ 'platform/graphics/win/FontDatabase.cpp',
+ 'platform/graphics/win/FontDatabase.h',
+ 'platform/graphics/win/FontPlatformData.h',
+ 'platform/graphics/win/FontPlatformDataCGWin.cpp',
+ 'platform/graphics/win/FontPlatformDataCairoWin.cpp',
+ 'platform/graphics/win/FontPlatformDataWin.cpp',
+ 'platform/graphics/win/FontWin.cpp',
+ 'platform/graphics/win/GlyphPageTreeNodeCGWin.cpp',
+ 'platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp',
+ 'platform/graphics/win/GraphicsContextCGWin.cpp',
+ 'platform/graphics/win/GraphicsContextCairoWin.cpp',
+ 'platform/graphics/win/GraphicsContextWin.cpp',
+ 'platform/graphics/win/IconWin.cpp',
+ 'platform/graphics/win/ImageCGWin.cpp',
+ 'platform/graphics/win/ImageCairoWin.cpp',
+ 'platform/graphics/win/ImageWin.cpp',
+ 'platform/graphics/win/IntPointWin.cpp',
+ 'platform/graphics/win/IntRectWin.cpp',
+ 'platform/graphics/win/IntSizeWin.cpp',
+ 'platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp',
+ 'platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h',
+ 'platform/graphics/win/QTMovieWin.cpp',
+ 'platform/graphics/win/QTMovieWin.h',
+ 'platform/graphics/win/QTMovieWinTimer.cpp',
+ 'platform/graphics/win/QTMovieWinTimer.h',
+ 'platform/graphics/win/SimpleFontDataCGWin.cpp',
+ 'platform/graphics/win/SimpleFontDataCairoWin.cpp',
+ 'platform/graphics/win/SimpleFontDataWin.cpp',
+ 'platform/graphics/win/UniscribeController.cpp',
+ 'platform/graphics/win/UniscribeController.h',
+ 'platform/graphics/wx/ColorWx.cpp',
+ 'platform/graphics/wx/FloatRectWx.cpp',
+ 'platform/graphics/wx/FontCacheWx.cpp',
+ 'platform/graphics/wx/FontPlatformData.h',
+ 'platform/graphics/wx/FontPlatformDataWx.cpp',
+ 'platform/graphics/wx/FontWx.cpp',
+ 'platform/graphics/wx/GlyphMapWx.cpp',
+ 'platform/graphics/wx/GradientWx.cpp',
+ 'platform/graphics/wx/GraphicsContextWx.cpp',
+ 'platform/graphics/wx/ImageBufferData.h',
+ 'platform/graphics/wx/ImageBufferWx.cpp',
+ 'platform/graphics/wx/ImageSourceWx.cpp',
+ 'platform/graphics/wx/ImageWx.cpp',
+ 'platform/graphics/wx/IntPointWx.cpp',
+ 'platform/graphics/wx/IntRectWx.cpp',
+ 'platform/graphics/wx/PathWx.cpp',
+ 'platform/graphics/wx/PenWx.cpp',
+ 'platform/graphics/wx/SimpleFontDataWx.cpp',
+ 'platform/graphics/wx/TransformationMatrixWx.cpp',
+ 'platform/graphics/BitmapImage.cpp',
+ 'platform/graphics/BitmapImage.h',
+ 'platform/graphics/Color.cpp',
+ 'platform/graphics/Color.h',
+ 'platform/graphics/DashArray.h',
+ 'platform/graphics/FloatPoint.cpp',
+ 'platform/graphics/FloatPoint.h',
+ 'platform/graphics/FloatPoint3D.cpp',
+ 'platform/graphics/FloatPoint3D.h',
+ 'platform/graphics/FloatQuad.cpp',
+ 'platform/graphics/FloatQuad.h',
+ 'platform/graphics/FloatRect.cpp',
+ 'platform/graphics/FloatRect.h',
+ 'platform/graphics/FloatSize.cpp',
+ 'platform/graphics/FloatSize.h',
+ 'platform/graphics/Font.cpp',
+ 'platform/graphics/Font.h',
+ 'platform/graphics/FontCache.cpp',
+ 'platform/graphics/FontCache.h',
+ 'platform/graphics/FontData.cpp',
+ 'platform/graphics/FontData.h',
+ 'platform/graphics/FontDescription.cpp',
+ 'platform/graphics/FontDescription.h',
+ 'platform/graphics/FontFallbackList.cpp',
+ 'platform/graphics/FontFallbackList.h',
+ 'platform/graphics/FontFamily.cpp',
+ 'platform/graphics/FontFamily.h',
+ 'platform/graphics/FontFastPath.cpp',
+ 'platform/graphics/FontRenderingMode.h',
+ 'platform/graphics/FontSelector.h',
+ 'platform/graphics/FontTraitsMask.h',
+ 'platform/graphics/GeneratedImage.cpp',
+ 'platform/graphics/GeneratedImage.h',
+ 'platform/graphics/Generator.h',
+ 'platform/graphics/GlyphBuffer.h',
+ 'platform/graphics/GlyphPageTreeNode.cpp',
+ 'platform/graphics/GlyphPageTreeNode.h',
+ 'platform/graphics/GlyphWidthMap.cpp',
+ 'platform/graphics/GlyphWidthMap.h',
+ 'platform/graphics/Gradient.cpp',
+ 'platform/graphics/Gradient.h',
+ 'platform/graphics/GraphicsContext.cpp',
+ 'platform/graphics/GraphicsContext.h',
+ 'platform/graphics/GraphicsContextPrivate.h',
+ 'platform/graphics/GraphicsLayer.cpp',
+ 'platform/graphics/GraphicsLayer.h',
+ 'platform/graphics/GraphicsLayerClient.h',
+ 'platform/graphics/GraphicsTypes.cpp',
+ 'platform/graphics/GraphicsTypes.h',
+ 'platform/graphics/Icon.h',
+ 'platform/graphics/Image.cpp',
+ 'platform/graphics/Image.h',
+ 'platform/graphics/ImageBuffer.h',
+ 'platform/graphics/ImageObserver.h',
+ 'platform/graphics/ImageSource.h',
+ 'platform/graphics/IntPoint.h',
+ 'platform/graphics/IntRect.cpp',
+ 'platform/graphics/IntRect.h',
+ 'platform/graphics/IntSize.h',
+ 'platform/graphics/IntSizeHash.h',
+ 'platform/graphics/MediaPlayer.cpp',
+ 'platform/graphics/MediaPlayer.h',
+ 'platform/graphics/MediaPlayerPrivate.h',
+ 'platform/graphics/Path.cpp',
+ 'platform/graphics/Path.h',
+ 'platform/graphics/PathTraversalState.cpp',
+ 'platform/graphics/PathTraversalState.h',
+ 'platform/graphics/Pattern.cpp',
+ 'platform/graphics/Pattern.h',
+ 'platform/graphics/Pen.cpp',
+ 'platform/graphics/Pen.h',
+ 'platform/graphics/SegmentedFontData.cpp',
+ 'platform/graphics/SegmentedFontData.h',
+ 'platform/graphics/SimpleFontData.cpp',
+ 'platform/graphics/SimpleFontData.h',
+ 'platform/graphics/StringTruncator.cpp',
+ 'platform/graphics/StringTruncator.h',
+ 'platform/graphics/StrokeStyleApplier.h',
+ 'platform/graphics/TextRun.h',
+ 'platform/graphics/UnitBezier.h',
+ 'platform/graphics/WidthIterator.cpp',
+ 'platform/graphics/WidthIterator.h',
+ 'platform/gtk/ClipboardGtk.cpp',
+ 'platform/gtk/ClipboardGtk.h',
+ 'platform/gtk/ContextMenuGtk.cpp',
+ 'platform/gtk/ContextMenuItemGtk.cpp',
+ 'platform/gtk/CursorGtk.cpp',
+ 'platform/gtk/CursorGtk.h',
+ 'platform/gtk/DragDataGtk.cpp',
+ 'platform/gtk/DragImageGtk.cpp',
+ 'platform/gtk/EventLoopGtk.cpp',
+ 'platform/gtk/FileChooserGtk.cpp',
+ 'platform/gtk/FileSystemGtk.cpp',
+ 'platform/gtk/GeolocationServiceGtk.cpp',
+ 'platform/gtk/GeolocationServiceGtk.h',
+ 'platform/gtk/KURLGtk.cpp',
+ 'platform/gtk/KeyEventGtk.cpp',
+ 'platform/gtk/KeyboardCodes.h',
+ 'platform/gtk/Language.cpp',
+ 'platform/gtk/LocalizedStringsGtk.cpp',
+ 'platform/gtk/LoggingGtk.cpp',
+ 'platform/gtk/MIMETypeRegistryGtk.cpp',
+ 'platform/gtk/MouseEventGtk.cpp',
+ 'platform/gtk/PasteboardGtk.cpp',
+ 'platform/gtk/PasteboardHelper.h',
+ 'platform/gtk/PlatformScreenGtk.cpp',
+ 'platform/gtk/PopupMenuGtk.cpp',
+ 'platform/gtk/RenderThemeGtk.cpp',
+ 'platform/gtk/RenderThemeGtk.h',
+ 'platform/gtk/ScrollViewGtk.cpp',
+ 'platform/gtk/ScrollbarGtk.cpp',
+ 'platform/gtk/ScrollbarGtk.h',
+ 'platform/gtk/ScrollbarThemeGtk.cpp',
+ 'platform/gtk/ScrollbarThemeGtk.h',
+ 'platform/gtk/SearchPopupMenuGtk.cpp',
+ 'platform/gtk/SharedBufferGtk.cpp',
+ 'platform/gtk/SharedTimerGtk.cpp',
+ 'platform/gtk/SoundGtk.cpp',
+ 'platform/gtk/TemporaryLinkStubs.cpp',
+ 'platform/gtk/WheelEventGtk.cpp',
+ 'platform/gtk/WidgetGtk.cpp',
+ 'platform/gtk/gtkdrawing.h',
+ 'platform/gtk/guriescape.h',
+ 'platform/image-decoders/ImageDecoder.h',
+ 'platform/image-decoders/bmp/BMPImageDecoder.cpp',
+ 'platform/image-decoders/bmp/BMPImageDecoder.h',
+ 'platform/image-decoders/bmp/BMPImageReader.cpp',
+ 'platform/image-decoders/bmp/BMPImageReader.h',
+ 'platform/image-decoders/gif/GIFImageDecoder.cpp',
+ 'platform/image-decoders/gif/GIFImageDecoder.h',
+ 'platform/image-decoders/gif/GIFImageReader.cpp',
+ 'platform/image-decoders/gif/GIFImageReader.h',
+ 'platform/image-decoders/ico/ICOImageDecoder.cpp',
+ 'platform/image-decoders/ico/ICOImageDecoder.h',
+ 'platform/image-decoders/jpeg/JPEGImageDecoder.cpp',
+ 'platform/image-decoders/jpeg/JPEGImageDecoder.h',
+ 'platform/image-decoders/png/PNGImageDecoder.cpp',
+ 'platform/image-decoders/png/PNGImageDecoder.h',
+ 'platform/image-decoders/xbm/XBMImageDecoder.cpp',
+ 'platform/image-decoders/xbm/XBMImageDecoder.h',
+ 'platform/image-decoders/zlib/crc32.h',
+ 'platform/image-decoders/zlib/deflate.h',
+ 'platform/image-decoders/zlib/inffast.h',
+ 'platform/image-decoders/zlib/inffixed.h',
+ 'platform/image-decoders/zlib/inflate.h',
+ 'platform/image-decoders/zlib/inftrees.h',
+ 'platform/image-decoders/zlib/mozzconf.h',
+ 'platform/image-decoders/zlib/trees.h',
+ 'platform/image-decoders/zlib/zconf.h',
+ 'platform/image-decoders/zlib/zlib.h',
+ 'platform/image-decoders/zlib/zutil.h',
+ 'platform/image-decoders/skia/ImageDecoderSkia.cpp',
+ 'platform/image-encoders/skia/PNGImageEncoder.cpp',
+ 'platform/image-encoders/skia/PNGImageEncoder.h',
+ 'platform/mac/AutodrainedPool.mm',
+ 'platform/mac/BlockExceptions.h',
+ 'platform/mac/BlockExceptions.mm',
+ 'platform/mac/ClipboardMac.h',
+ 'platform/mac/ClipboardMac.mm',
+ 'platform/mac/ContextMenuItemMac.mm',
+ 'platform/mac/ContextMenuMac.mm',
+ 'platform/mac/CookieJar.mm',
+ 'platform/mac/CursorMac.mm',
+ 'platform/mac/DragDataMac.mm',
+ 'platform/mac/DragImageMac.mm',
+ 'platform/mac/EventLoopMac.mm',
+ 'platform/mac/FileChooserMac.mm',
+ 'platform/mac/FileSystemMac.mm',
+ 'platform/mac/FoundationExtras.h',
+ 'platform/mac/KURLMac.mm',
+ 'platform/mac/KeyEventMac.mm',
+ 'platform/mac/Language.mm',
+ 'platform/mac/LocalCurrentGraphicsContext.h',
+ 'platform/mac/LocalCurrentGraphicsContext.mm',
+ 'platform/mac/LocalizedStringsMac.mm',
+ 'platform/mac/LoggingMac.mm',
+ 'platform/mac/MIMETypeRegistryMac.mm',
+ 'platform/mac/PasteboardHelper.h',
+ 'platform/mac/PasteboardMac.mm',
+ 'platform/mac/PlatformMouseEventMac.mm',
+ 'platform/mac/PlatformScreenMac.mm',
+ 'platform/mac/PopupMenuMac.mm',
+ 'platform/mac/PurgeableBufferMac.cpp',
+ 'platform/mac/SSLKeyGeneratorMac.mm',
+ 'platform/mac/SchedulePairMac.mm',
+ 'platform/mac/ScrollViewMac.mm',
+ 'platform/mac/ScrollbarThemeMac.h',
+ 'platform/mac/ScrollbarThemeMac.mm',
+ 'platform/mac/SearchPopupMenuMac.mm',
+ 'platform/mac/SharedBufferMac.mm',
+ 'platform/mac/SharedTimerMac.mm',
+ 'platform/mac/SoftLinking.h',
+ 'platform/mac/SoundMac.mm',
+ 'platform/mac/SystemTimeMac.cpp',
+ 'platform/mac/ThemeMac.h',
+ 'platform/mac/ThemeMac.mm',
+ 'platform/mac/ThreadCheck.mm',
+ 'platform/mac/WebCoreKeyGenerator.h',
+ 'platform/mac/WebCoreKeyGenerator.m',
+ 'platform/mac/WebCoreNSStringExtras.h',
+ 'platform/mac/WebCoreNSStringExtras.mm',
+ 'platform/mac/WebCoreObjCExtras.h',
+ 'platform/mac/WebCoreObjCExtras.mm',
+ 'platform/mac/WebCoreSystemInterface.h',
+ 'platform/mac/WebCoreSystemInterface.mm',
+ 'platform/mac/WebCoreView.h',
+ 'platform/mac/WebCoreView.m',
+ 'platform/mac/WebFontCache.h',
+ 'platform/mac/WebFontCache.mm',
+ 'platform/mac/WheelEventMac.mm',
+ 'platform/mac/WidgetMac.mm',
+ 'platform/network/cf/AuthenticationCF.cpp',
+ 'platform/network/cf/AuthenticationCF.h',
+ 'platform/network/cf/AuthenticationChallenge.h',
+ 'platform/network/cf/DNSCFNet.cpp',
+ 'platform/network/cf/FormDataStreamCFNet.cpp',
+ 'platform/network/cf/FormDataStreamCFNet.h',
+ 'platform/network/cf/ResourceError.h',
+ 'platform/network/cf/ResourceErrorCF.cpp',
+ 'platform/network/cf/ResourceHandleCFNet.cpp',
+ 'platform/network/cf/ResourceRequest.h',
+ 'platform/network/cf/ResourceRequestCFNet.cpp',
+ 'platform/network/cf/ResourceRequestCFNet.h',
+ 'platform/network/cf/ResourceResponse.h',
+ 'platform/network/cf/ResourceResponseCFNet.cpp',
+ 'platform/network/cf/ResourceResponseCFNet.h',
+ 'platform/network/chromium/AuthenticationChallenge.h',
+ 'platform/network/chromium/AuthenticationChallengeChromium.cpp',
+ 'platform/network/chromium/CookieJarChromium.cpp',
+ 'platform/network/chromium/DNSChromium.cpp',
+ 'platform/network/chromium/NetworkStateNotifierChromium.cpp',
+ 'platform/network/chromium/NetworkStateNotifierPrivate.h',
+ 'platform/network/chromium/ResourceError.h',
+ 'platform/network/chromium/ResourceRequest.h',
+ 'platform/network/chromium/ResourceResponse.h',
+ 'platform/network/curl/AuthenticationChallenge.h',
+ 'platform/network/curl/CookieJarCurl.cpp',
+ 'platform/network/curl/DNSCurl.cpp',
+ 'platform/network/curl/FormDataStreamCurl.cpp',
+ 'platform/network/curl/FormDataStreamCurl.h',
+ 'platform/network/curl/ResourceError.h',
+ 'platform/network/curl/ResourceHandleCurl.cpp',
+ 'platform/network/curl/ResourceHandleManager.cpp',
+ 'platform/network/curl/ResourceHandleManager.h',
+ 'platform/network/curl/ResourceRequest.h',
+ 'platform/network/curl/ResourceResponse.h',
+ 'platform/network/mac/AuthenticationChallenge.h',
+ 'platform/network/mac/AuthenticationMac.h',
+ 'platform/network/mac/AuthenticationMac.mm',
+ 'platform/network/mac/FormDataStreamMac.h',
+ 'platform/network/mac/FormDataStreamMac.mm',
+ 'platform/network/mac/NetworkStateNotifierMac.cpp',
+ 'platform/network/mac/ResourceError.h',
+ 'platform/network/mac/ResourceErrorMac.mm',
+ 'platform/network/mac/ResourceHandleMac.mm',
+ 'platform/network/mac/ResourceRequest.h',
+ 'platform/network/mac/ResourceRequestMac.mm',
+ 'platform/network/mac/ResourceResponse.h',
+ 'platform/network/mac/ResourceResponseMac.mm',
+ 'platform/network/mac/WebCoreURLResponse.h',
+ 'platform/network/mac/WebCoreURLResponse.mm',
+ 'platform/network/qt/AuthenticationChallenge.h',
+ 'platform/network/qt/QNetworkReplyHandler.cpp',
+ 'platform/network/qt/QNetworkReplyHandler.h',
+ 'platform/network/qt/ResourceError.h',
+ 'platform/network/qt/ResourceHandleQt.cpp',
+ 'platform/network/qt/ResourceRequest.h',
+ 'platform/network/qt/ResourceRequestQt.cpp',
+ 'platform/network/qt/ResourceResponse.h',
+ 'platform/network/soup/AuthenticationChallenge.h',
+ 'platform/network/soup/CookieJarSoup.cpp',
+ 'platform/network/soup/CookieJarSoup.h',
+ 'platform/network/soup/DNSSoup.cpp',
+ 'platform/network/soup/ResourceError.h',
+ 'platform/network/soup/ResourceHandleSoup.cpp',
+ 'platform/network/soup/ResourceRequest.h',
+ 'platform/network/soup/ResourceResponse.h',
+ 'platform/network/soup/webkit-soup-auth-dialog.c',
+ 'platform/network/soup/webkit-soup-auth-dialog.h',
+ 'platform/network/win/CookieJarCFNetWin.cpp',
+ 'platform/network/win/CookieJarWin.cpp',
+ 'platform/network/win/CookieStorageWin.cpp',
+ 'platform/network/win/CookieStorageWin.h',
+ 'platform/network/win/NetworkStateNotifierWin.cpp',
+ 'platform/network/win/ResourceHandleWin.cpp',
+ 'platform/network/win/ResourceHandleWin.h',
+ 'platform/network/AuthenticationChallengeBase.cpp',
+ 'platform/network/AuthenticationChallengeBase.h',
+ 'platform/network/Credential.cpp',
+ 'platform/network/Credential.h',
+ 'platform/network/DNS.h',
+ 'platform/network/FormData.cpp',
+ 'platform/network/FormData.h',
+ 'platform/network/FormDataBuilder.cpp',
+ 'platform/network/FormDataBuilder.h',
+ 'platform/network/HTTPHeaderMap.cpp',
+ 'platform/network/HTTPHeaderMap.h',
+ 'platform/network/HTTPParsers.cpp',
+ 'platform/network/HTTPParsers.h',
+ 'platform/network/NetworkStateNotifier.cpp',
+ 'platform/network/NetworkStateNotifier.h',
+ 'platform/network/ProtectionSpace.cpp',
+ 'platform/network/ProtectionSpace.h',
+ 'platform/network/ResourceErrorBase.cpp',
+ 'platform/network/ResourceErrorBase.h',
+ 'platform/network/ResourceHandleClient.h',
+ 'platform/network/ResourceHandleInternal.h',
+ 'platform/network/ResourceRequestBase.cpp',
+ 'platform/network/ResourceRequestBase.h',
+ 'platform/network/ResourceResponseBase.cpp',
+ 'platform/network/ResourceResponseBase.h',
+ 'platform/posix/FileSystemPOSIX.cpp',
+ 'platform/qt/ClipboardQt.cpp',
+ 'platform/qt/ClipboardQt.h',
+ 'platform/qt/ContextMenuItemQt.cpp',
+ 'platform/qt/ContextMenuQt.cpp',
+ 'platform/qt/CookieJarQt.cpp',
+ 'platform/qt/CursorQt.cpp',
+ 'platform/qt/DragDataQt.cpp',
+ 'platform/qt/DragImageQt.cpp',
+ 'platform/qt/EventLoopQt.cpp',
+ 'platform/qt/FileChooserQt.cpp',
+ 'platform/qt/FileSystemQt.cpp',
+ 'platform/qt/KURLQt.cpp',
+ 'platform/qt/KeyboardCodes.h',
+ 'platform/qt/Localizations.cpp',
+ 'platform/qt/LoggingQt.cpp',
+ 'platform/qt/MIMETypeRegistryQt.cpp',
+ 'platform/qt/MenuEventProxy.h',
+ 'platform/qt/PasteboardQt.cpp',
+ 'platform/qt/PlatformKeyboardEventQt.cpp',
+ 'platform/qt/PlatformMouseEventQt.cpp',
+ 'platform/qt/PlatformScreenQt.cpp',
+ 'platform/qt/PopupMenuQt.cpp',
+ 'platform/qt/QWebPopup.cpp',
+ 'platform/qt/QWebPopup.h',
+ 'platform/qt/RenderThemeQt.cpp',
+ 'platform/qt/RenderThemeQt.h',
+ 'platform/qt/ScreenQt.cpp',
+ 'platform/qt/ScrollViewQt.cpp',
+ 'platform/qt/ScrollbarQt.cpp',
+ 'platform/qt/ScrollbarThemeQt.cpp',
+ 'platform/qt/ScrollbarThemeQt.h',
+ 'platform/qt/SearchPopupMenuQt.cpp',
+ 'platform/qt/SharedBufferQt.cpp',
+ 'platform/qt/SharedTimerQt.cpp',
+ 'platform/qt/SoundQt.cpp',
+ 'platform/qt/TemporaryLinkStubs.cpp',
+ 'platform/qt/WheelEventQt.cpp',
+ 'platform/qt/WidgetQt.cpp',
+ 'platform/sql/SQLValue.cpp',
+ 'platform/sql/SQLValue.h',
+ 'platform/sql/SQLiteAuthorizer.cpp',
+ 'platform/sql/SQLiteDatabase.cpp',
+ 'platform/sql/SQLiteDatabase.h',
+ 'platform/sql/SQLiteFileSystem.h',
+ 'platform/sql/SQLiteFileSystem.cpp',
+ 'platform/sql/SQLiteStatement.cpp',
+ 'platform/sql/SQLiteStatement.h',
+ 'platform/sql/SQLiteTransaction.cpp',
+ 'platform/sql/SQLiteTransaction.h',
+ 'platform/symbian/FloatPointSymbian.cpp',
+ 'platform/symbian/FloatRectSymbian.cpp',
+ 'platform/symbian/IntPointSymbian.cpp',
+ 'platform/symbian/IntRectSymbian.cpp',
+ 'platform/symbian/IntSizeSymbian.cpp',
+ 'platform/text/cf/StringCF.cpp',
+ 'platform/text/cf/StringImplCF.cpp',
+ 'platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp',
+ 'platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp',
+ 'platform/text/mac/CharsetData.h',
+ 'platform/text/mac/ShapeArabic.c',
+ 'platform/text/mac/ShapeArabic.h',
+ 'platform/text/mac/StringImplMac.mm',
+ 'platform/text/mac/StringMac.mm',
+ 'platform/text/mac/TextBoundaries.mm',
+ 'platform/text/mac/TextBreakIteratorInternalICUMac.mm',
+ 'platform/text/mac/TextCodecMac.cpp',
+ 'platform/text/mac/TextCodecMac.h',
+ 'platform/text/qt/StringQt.cpp',
+ 'platform/text/qt/TextBoundaries.cpp',
+ 'platform/text/qt/TextBreakIteratorQt.cpp',
+ 'platform/text/qt/TextCodecQt.cpp',
+ 'platform/text/qt/TextCodecQt.h',
+ 'platform/text/symbian/StringImplSymbian.cpp',
+ 'platform/text/symbian/StringSymbian.cpp',
+ 'platform/text/win/TextBreakIteratorInternalICUWin.cpp',
+ 'platform/text/wx/StringWx.cpp',
+ 'platform/text/AtomicString.cpp',
+ 'platform/text/AtomicString.h',
+ 'platform/text/AtomicStringHash.h',
+ 'platform/text/AtomicStringImpl.h',
+ 'platform/text/Base64.cpp',
+ 'platform/text/Base64.h',
+ 'platform/text/BidiContext.cpp',
+ 'platform/text/BidiContext.h',
+ 'platform/text/BidiResolver.h',
+ 'platform/text/CString.cpp',
+ 'platform/text/CString.h',
+ 'platform/text/CharacterNames.h',
+ 'platform/text/ParserUtilities.h',
+ 'platform/text/PlatformString.h',
+ 'platform/text/RegularExpression.cpp',
+ 'platform/text/RegularExpression.h',
+ 'platform/text/SegmentedString.cpp',
+ 'platform/text/SegmentedString.h',
+ 'platform/text/String.cpp',
+ 'platform/text/StringBuffer.h',
+ 'platform/text/StringBuilder.cpp',
+ 'platform/text/StringBuilder.h',
+ 'platform/text/StringHash.h',
+ 'platform/text/StringImpl.cpp',
+ 'platform/text/StringImpl.h',
+ 'platform/text/TextBoundaries.h',
+ 'platform/text/TextBoundariesICU.cpp',
+ 'platform/text/TextBreakIterator.h',
+ 'platform/text/TextBreakIteratorICU.cpp',
+ 'platform/text/TextBreakIteratorInternalICU.h',
+ 'platform/text/TextCodec.cpp',
+ 'platform/text/TextCodec.h',
+ 'platform/text/TextCodecICU.cpp',
+ 'platform/text/TextCodecICU.h',
+ 'platform/text/TextCodecLatin1.cpp',
+ 'platform/text/TextCodecLatin1.h',
+ 'platform/text/TextCodecUTF16.cpp',
+ 'platform/text/TextCodecUTF16.h',
+ 'platform/text/TextCodecUserDefined.cpp',
+ 'platform/text/TextCodecUserDefined.h',
+ 'platform/text/TextDirection.h',
+ 'platform/text/TextEncoding.cpp',
+ 'platform/text/TextEncoding.h',
+ 'platform/text/TextEncodingDetector.h',
+ 'platform/text/TextEncodingDetectorICU.cpp',
+ 'platform/text/TextEncodingRegistry.cpp',
+ 'platform/text/TextEncodingRegistry.h',
+ 'platform/text/TextStream.cpp',
+ 'platform/text/TextStream.h',
+ 'platform/text/UnicodeRange.cpp',
+ 'platform/text/UnicodeRange.h',
+ 'platform/win/BString.cpp',
+ 'platform/win/BString.h',
+ 'platform/win/COMPtr.h',
+ 'platform/win/ClipboardUtilitiesWin.cpp',
+ 'platform/win/ClipboardUtilitiesWin.h',
+ 'platform/win/ClipboardWin.cpp',
+ 'platform/win/ClipboardWin.h',
+ 'platform/win/ContextMenuItemWin.cpp',
+ 'platform/win/ContextMenuWin.cpp',
+ 'platform/win/CursorWin.cpp',
+ 'platform/win/DragDataWin.cpp',
+ 'platform/win/DragImageCGWin.cpp',
+ 'platform/win/DragImageCairoWin.cpp',
+ 'platform/win/DragImageWin.cpp',
+ 'platform/win/EditorWin.cpp',
+ 'platform/win/EventLoopWin.cpp',
+ 'platform/win/FileChooserWin.cpp',
+ 'platform/win/FileSystemWin.cpp',
+ 'platform/win/GDIObjectCounter.cpp',
+ 'platform/win/GDIObjectCounter.h',
+ 'platform/win/KeyEventWin.cpp',
+ 'platform/win/Language.cpp',
+ 'platform/win/LoggingWin.cpp',
+ 'platform/win/MIMETypeRegistryWin.cpp',
+ 'platform/win/PasteboardWin.cpp',
+ 'platform/win/PlatformMouseEventWin.cpp',
+ 'platform/win/PlatformScreenWin.cpp',
+ 'platform/win/PlatformScrollBar.h',
+ 'platform/win/PlatformScrollBarWin.cpp',
+ 'platform/win/PopupMenuWin.cpp',
+ 'platform/win/ScrollbarThemeSafari.cpp',
+ 'platform/win/ScrollbarThemeSafari.h',
+ 'platform/win/ScrollbarThemeWin.cpp',
+ 'platform/win/ScrollbarThemeWin.h',
+ 'platform/win/SearchPopupMenuWin.cpp',
+ 'platform/win/SharedBufferWin.cpp',
+ 'platform/win/SharedTimerWin.cpp',
+ 'platform/win/SoftLinking.h',
+ 'platform/win/SoundWin.cpp',
+ 'platform/win/SystemTimeWin.cpp',
+ 'platform/win/TemporaryLinkStubs.cpp',
+ 'platform/win/WCDataObject.cpp',
+ 'platform/win/WCDataObject.h',
+ 'platform/win/WebCoreTextRenderer.cpp',
+ 'platform/win/WebCoreTextRenderer.h',
+ 'platform/win/WheelEventWin.cpp',
+ 'platform/win/WidgetWin.cpp',
+ 'platform/win/WindowMessageBroadcaster.cpp',
+ 'platform/win/WindowMessageBroadcaster.h',
+ 'platform/win/WindowMessageListener.h',
+ 'platform/wx/wxcode/gtk/fontprops.cpp',
+ 'platform/wx/wxcode/gtk/non-kerned-drawing.cpp',
+ 'platform/wx/wxcode/mac/carbon/fontprops.cpp',
+ 'platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp',
+ 'platform/wx/wxcode/win/fontprops.cpp',
+ 'platform/wx/wxcode/win/non-kerned-drawing.cpp',
+ 'platform/wx/wxcode/fontprops.cpp',
+ 'platform/wx/wxcode/fontprops.h',
+ 'platform/wx/wxcode/non-kerned-drawing.h',
+ 'platform/wx/ClipboardWx.cpp',
+ 'platform/wx/ClipboardWx.h',
+ 'platform/wx/ContextMenuItemWx.cpp',
+ 'platform/wx/ContextMenuWx.cpp',
+ 'platform/wx/CursorWx.cpp',
+ 'platform/wx/DragDataWx.cpp',
+ 'platform/wx/DragImageWx.cpp',
+ 'platform/wx/EventLoopWx.cpp',
+ 'platform/wx/FileSystemWx.cpp',
+ 'platform/wx/KeyEventWin.cpp',
+ 'platform/wx/KeyboardCodes.h',
+ 'platform/wx/KeyboardEventWx.cpp',
+ 'platform/wx/LocalizedStringsWx.cpp',
+ 'platform/wx/LoggingWx.cpp',
+ 'platform/wx/MimeTypeRegistryWx.cpp',
+ 'platform/wx/MouseEventWx.cpp',
+ 'platform/wx/MouseWheelEventWx.cpp',
+ 'platform/wx/PasteboardWx.cpp',
+ 'platform/wx/PopupMenuWx.cpp',
+ 'platform/wx/RenderThemeWx.cpp',
+ 'platform/wx/ScreenWx.cpp',
+ 'platform/wx/ScrollViewWx.cpp',
+ 'platform/wx/SharedTimerWx.cpp',
+ 'platform/wx/SoundWx.cpp',
+ 'platform/wx/TemporaryLinkStubs.cpp',
+ 'platform/wx/WidgetWx.cpp',
+ 'platform/Arena.cpp',
+ 'platform/Arena.h',
+ 'platform/AutodrainedPool.h',
+ 'platform/ContentType.cpp',
+ 'platform/ContentType.h',
+ 'platform/ContextMenu.cpp',
+ 'platform/ContextMenu.h',
+ 'platform/ContextMenuItem.h',
+ 'platform/CookieJar.h',
+ 'platform/CrossThreadCopier.h',
+ 'platform/CrossThreadCopier.cpp',
+ 'platform/Cursor.h',
+ 'platform/DeprecatedPtrList.h',
+ 'platform/DeprecatedPtrListImpl.cpp',
+ 'platform/DeprecatedPtrListImpl.h',
+ 'platform/DragData.cpp',
+ 'platform/DragData.h',
+ 'platform/DragImage.cpp',
+ 'platform/DragImage.h',
+ 'platform/EventLoop.h',
+ 'platform/FileChooser.cpp',
+ 'platform/FileChooser.h',
+ 'platform/FileSystem.h',
+ 'platform/FloatConversion.h',
+ 'platform/GeolocationService.cpp',
+ 'platform/GeolocationService.h',
+ 'platform/HostWindow.h',
+ 'platform/KeyboardCodes.h',
+ 'platform/KURL.cpp',
+ 'platform/KURL.h',
+ 'platform/KURLGoogle.cpp',
+ 'platform/KURLGooglePrivate.h',
+ 'platform/KURLHash.h',
+ 'platform/Language.h',
+ 'platform/Length.cpp',
+ 'platform/Length.h',
+ 'platform/LengthBox.h',
+ 'platform/LengthSize.h',
+ 'platform/LinkHash.cpp',
+ 'platform/LinkHash.h',
+ 'platform/LocalizedStrings.h',
+ 'platform/Logging.cpp',
+ 'platform/Logging.h',
+ 'platform/MIMETypeRegistry.cpp',
+ 'platform/MIMETypeRegistry.h',
+ 'platform/NotImplemented.h',
+ 'platform/Pasteboard.h',
+ 'platform/PlatformKeyboardEvent.h',
+ 'platform/PlatformMenuDescription.h',
+ 'platform/PlatformMouseEvent.h',
+ 'platform/PlatformScreen.h',
+ 'platform/PlatformWheelEvent.h',
+ 'platform/PopupMenu.h',
+ 'platform/PopupMenuClient.h',
+ 'platform/PopupMenuStyle.h',
+ 'platform/PurgeableBuffer.h',
+ 'platform/SSLKeyGenerator.h',
+ 'platform/ScrollTypes.h',
+ 'platform/ScrollView.cpp',
+ 'platform/ScrollView.h',
+ 'platform/Scrollbar.cpp',
+ 'platform/Scrollbar.h',
+ 'platform/ScrollbarClient.h',
+ 'platform/ScrollbarTheme.h',
+ 'platform/ScrollbarThemeComposite.cpp',
+ 'platform/ScrollbarThemeComposite.h',
+ 'platform/SearchPopupMenu.h',
+ 'platform/SharedBuffer.cpp',
+ 'platform/SharedBuffer.h',
+ 'platform/SharedTimer.h',
+ 'platform/Sound.h',
+ 'platform/StaticConstructors.h',
+ 'platform/SystemTime.h',
+ 'platform/Theme.cpp',
+ 'platform/Theme.h',
+ 'platform/ThemeTypes.h',
+ 'platform/ThreadCheck.h',
+ 'platform/ThreadGlobalData.cpp',
+ 'platform/ThreadGlobalData.h',
+ 'platform/ThreadTimers.cpp',
+ 'platform/ThreadTimers.h',
+ 'platform/Timer.cpp',
+ 'platform/Timer.h',
+ 'platform/TreeShared.h',
+ 'platform/Widget.cpp',
+ 'platform/Widget.h',
+ 'plugins/chromium/PluginDataChromium.cpp',
+ 'plugins/gtk/PluginDataGtk.cpp',
+ 'plugins/gtk/PluginPackageGtk.cpp',
+ 'plugins/gtk/PluginViewGtk.cpp',
+ 'plugins/gtk/gtk2xtbin.h',
+ 'plugins/gtk/xembed.h',
+ 'plugins/mac/PluginDataMac.mm',
+ 'plugins/mac/PluginPackageMac.cpp',
+ 'plugins/mac/PluginViewMac.cpp',
+ 'plugins/qt/PluginDataQt.cpp',
+ 'plugins/qt/PluginPackageQt.cpp',
+ 'plugins/qt/PluginViewQt.cpp',
+ 'plugins/win/PluginDataWin.cpp',
+ 'plugins/win/PluginDatabaseWin.cpp',
+ 'plugins/win/PluginMessageThrottlerWin.cpp',
+ 'plugins/win/PluginMessageThrottlerWin.h',
+ 'plugins/win/PluginPackageWin.cpp',
+ 'plugins/win/PluginViewWin.cpp',
+ 'plugins/wx/PluginDataWx.cpp',
+ 'plugins/wx/PluginPackageWx.cpp',
+ 'plugins/wx/PluginViewWx.cpp',
+ 'plugins/MimeType.cpp',
+ 'plugins/MimeType.h',
+ 'plugins/MimeTypeArray.cpp',
+ 'plugins/MimeTypeArray.h',
+ 'plugins/Plugin.cpp',
+ 'plugins/Plugin.h',
+ 'plugins/PluginArray.cpp',
+ 'plugins/PluginArray.h',
+ 'plugins/PluginData.cpp',
+ 'plugins/PluginData.h',
+ 'plugins/PluginDatabase.cpp',
+ 'plugins/PluginDatabase.h',
+ 'plugins/PluginDebug.h',
+ 'plugins/PluginInfoStore.cpp',
+ 'plugins/PluginInfoStore.h',
+ 'plugins/PluginMainThreadScheduler.cpp',
+ 'plugins/PluginMainThreadScheduler.h',
+ 'plugins/PluginPackage.cpp',
+ 'plugins/PluginPackage.h',
+ 'plugins/PluginQuirkSet.h',
+ 'plugins/PluginStream.cpp',
+ 'plugins/PluginStream.h',
+ 'plugins/PluginView.cpp',
+ 'plugins/PluginView.h',
+ 'plugins/npapi.cpp',
+ 'plugins/npfunctions.h',
+ 'rendering/style/BindingURI.cpp',
+ 'rendering/style/BindingURI.h',
+ 'rendering/style/BorderData.h',
+ 'rendering/style/BorderValue.h',
+ 'rendering/style/CollapsedBorderValue.h',
+ 'rendering/style/ContentData.cpp',
+ 'rendering/style/ContentData.h',
+ 'rendering/style/CounterContent.h',
+ 'rendering/style/CounterDirectives.cpp',
+ 'rendering/style/CounterDirectives.h',
+ 'rendering/style/CursorData.h',
+ 'rendering/style/CursorList.h',
+ 'rendering/style/DataRef.h',
+ 'rendering/style/FillLayer.cpp',
+ 'rendering/style/FillLayer.h',
+ 'rendering/style/KeyframeList.cpp',
+ 'rendering/style/KeyframeList.h',
+ 'rendering/style/NinePieceImage.cpp',
+ 'rendering/style/NinePieceImage.h',
+ 'rendering/style/OutlineValue.h',
+ 'rendering/style/RenderStyle.cpp',
+ 'rendering/style/RenderStyle.h',
+ 'rendering/style/RenderStyleConstants.h',
+ 'rendering/style/SVGRenderStyle.cpp',
+ 'rendering/style/SVGRenderStyle.h',
+ 'rendering/style/SVGRenderStyleDefs.cpp',
+ 'rendering/style/SVGRenderStyleDefs.h',
+ 'rendering/style/ShadowData.cpp',
+ 'rendering/style/ShadowData.h',
+ 'rendering/style/StyleBackgroundData.cpp',
+ 'rendering/style/StyleBackgroundData.h',
+ 'rendering/style/StyleBoxData.cpp',
+ 'rendering/style/StyleBoxData.h',
+ 'rendering/style/StyleCachedImage.cpp',
+ 'rendering/style/StyleCachedImage.h',
+ 'rendering/style/StyleDashboardRegion.h',
+ 'rendering/style/StyleFlexibleBoxData.cpp',
+ 'rendering/style/StyleFlexibleBoxData.h',
+ 'rendering/style/StyleGeneratedImage.cpp',
+ 'rendering/style/StyleGeneratedImage.h',
+ 'rendering/style/StyleImage.h',
+ 'rendering/style/StyleInheritedData.cpp',
+ 'rendering/style/StyleInheritedData.h',
+ 'rendering/style/StyleMarqueeData.cpp',
+ 'rendering/style/StyleMarqueeData.h',
+ 'rendering/style/StyleMultiColData.cpp',
+ 'rendering/style/StyleMultiColData.h',
+ 'rendering/style/StyleRareInheritedData.cpp',
+ 'rendering/style/StyleRareInheritedData.h',
+ 'rendering/style/StyleRareNonInheritedData.cpp',
+ 'rendering/style/StyleRareNonInheritedData.h',
+ 'rendering/style/StyleReflection.h',
+ 'rendering/style/StyleSurroundData.cpp',
+ 'rendering/style/StyleSurroundData.h',
+ 'rendering/style/StyleTransformData.cpp',
+ 'rendering/style/StyleTransformData.h',
+ 'rendering/style/StyleVisualData.cpp',
+ 'rendering/style/StyleVisualData.h',
+ 'rendering/AutoTableLayout.cpp',
+ 'rendering/AutoTableLayout.h',
+ 'rendering/CounterNode.cpp',
+ 'rendering/CounterNode.h',
+ 'rendering/EllipsisBox.cpp',
+ 'rendering/EllipsisBox.h',
+ 'rendering/FixedTableLayout.cpp',
+ 'rendering/FixedTableLayout.h',
+ 'rendering/GapRects.h',
+ 'rendering/HitTestRequest.h',
+ 'rendering/HitTestResult.cpp',
+ 'rendering/HitTestResult.h',
+ 'rendering/InlineBox.cpp',
+ 'rendering/InlineBox.h',
+ 'rendering/InlineFlowBox.cpp',
+ 'rendering/InlineFlowBox.h',
+ 'rendering/InlineRunBox.h',
+ 'rendering/InlineTextBox.cpp',
+ 'rendering/InlineTextBox.h',
+ 'rendering/LayoutState.cpp',
+ 'rendering/LayoutState.h',
+ 'rendering/MediaControlElements.cpp',
+ 'rendering/MediaControlElements.h',
+ 'rendering/PointerEventsHitRules.cpp',
+ 'rendering/PointerEventsHitRules.h',
+ 'rendering/RenderApplet.cpp',
+ 'rendering/RenderApplet.h',
+ 'rendering/RenderArena.cpp',
+ 'rendering/RenderArena.h',
+ 'rendering/RenderBR.cpp',
+ 'rendering/RenderBR.h',
+ 'rendering/RenderBlock.cpp',
+ 'rendering/RenderBlock.h',
+ 'rendering/RenderBlockLineLayout.cpp',
+ 'rendering/RenderBox.cpp',
+ 'rendering/RenderBox.h',
+ 'rendering/RenderBoxModelObject.cpp',
+ 'rendering/RenderBoxModelObject.h',
+ 'rendering/RenderButton.cpp',
+ 'rendering/RenderButton.h',
+ 'rendering/RenderCounter.cpp',
+ 'rendering/RenderCounter.h',
+ 'rendering/RenderDataGrid.cpp',
+ 'rendering/RenderDataGrid.h',
+ 'rendering/RenderFieldset.cpp',
+ 'rendering/RenderFieldset.h',
+ 'rendering/RenderFileUploadControl.cpp',
+ 'rendering/RenderFileUploadControl.h',
+ 'rendering/RenderFlexibleBox.cpp',
+ 'rendering/RenderFlexibleBox.h',
+ 'rendering/RenderForeignObject.cpp',
+ 'rendering/RenderForeignObject.h',
+ 'rendering/RenderFrame.cpp',
+ 'rendering/RenderFrame.h',
+ 'rendering/RenderFrameSet.cpp',
+ 'rendering/RenderFrameSet.h',
+ 'rendering/RenderHTMLCanvas.cpp',
+ 'rendering/RenderHTMLCanvas.h',
+ 'rendering/RenderImage.cpp',
+ 'rendering/RenderImage.h',
+ 'rendering/RenderImageGeneratedContent.cpp',
+ 'rendering/RenderImageGeneratedContent.h',
+ 'rendering/RenderInline.cpp',
+ 'rendering/RenderInline.h',
+ 'rendering/RenderLayer.cpp',
+ 'rendering/RenderLayer.h',
+ 'rendering/RenderLayerBacking.cpp',
+ 'rendering/RenderLayerBacking.h',
+ 'rendering/RenderLayerCompositor.cpp',
+ 'rendering/RenderLayerCompositor.h',
+ 'rendering/RenderLineBoxList.cpp',
+ 'rendering/RenderLineBoxList.h',
+ 'rendering/RenderListBox.cpp',
+ 'rendering/RenderListBox.h',
+ 'rendering/RenderListItem.cpp',
+ 'rendering/RenderListItem.h',
+ 'rendering/RenderListMarker.cpp',
+ 'rendering/RenderListMarker.h',
+ 'rendering/RenderMarquee.cpp',
+ 'rendering/RenderMarquee.h',
+ 'rendering/RenderMedia.cpp',
+ 'rendering/RenderMedia.h',
+ 'rendering/RenderMenuList.cpp',
+ 'rendering/RenderMenuList.h',
+ 'rendering/RenderObject.cpp',
+ 'rendering/RenderObject.h',
+ 'rendering/RenderObjectChildList.cpp',
+ 'rendering/RenderObjectChildList.h',
+ 'rendering/RenderPart.cpp',
+ 'rendering/RenderPart.h',
+ 'rendering/RenderPartObject.cpp',
+ 'rendering/RenderPartObject.h',
+ 'rendering/RenderPath.cpp',
+ 'rendering/RenderPath.h',
+ 'rendering/RenderReplaced.cpp',
+ 'rendering/RenderReplaced.h',
+ 'rendering/RenderReplica.cpp',
+ 'rendering/RenderReplica.h',
+ 'rendering/RenderSVGBlock.cpp',
+ 'rendering/RenderSVGBlock.h',
+ 'rendering/RenderSVGContainer.cpp',
+ 'rendering/RenderSVGContainer.h',
+ 'rendering/RenderSVGGradientStop.cpp',
+ 'rendering/RenderSVGGradientStop.h',
+ 'rendering/RenderSVGHiddenContainer.cpp',
+ 'rendering/RenderSVGHiddenContainer.h',
+ 'rendering/RenderSVGImage.cpp',
+ 'rendering/RenderSVGImage.h',
+ 'rendering/RenderSVGInline.cpp',
+ 'rendering/RenderSVGInline.h',
+ 'rendering/RenderSVGInlineText.cpp',
+ 'rendering/RenderSVGInlineText.h',
+ 'rendering/RenderSVGModelObject.cpp',
+ 'rendering/RenderSVGModelObject.h',
+ 'rendering/RenderSVGRoot.cpp',
+ 'rendering/RenderSVGRoot.h',
+ 'rendering/RenderSVGTSpan.cpp',
+ 'rendering/RenderSVGTSpan.h',
+ 'rendering/RenderSVGText.cpp',
+ 'rendering/RenderSVGText.h',
+ 'rendering/RenderSVGTextPath.cpp',
+ 'rendering/RenderSVGTextPath.h',
+ 'rendering/RenderSVGTransformableContainer.cpp',
+ 'rendering/RenderSVGTransformableContainer.h',
+ 'rendering/RenderSVGViewportContainer.cpp',
+ 'rendering/RenderSVGViewportContainer.h',
+ 'rendering/RenderScrollbar.cpp',
+ 'rendering/RenderScrollbar.h',
+ 'rendering/RenderScrollbarPart.cpp',
+ 'rendering/RenderScrollbarPart.h',
+ 'rendering/RenderScrollbarTheme.cpp',
+ 'rendering/RenderScrollbarTheme.h',
+ 'rendering/RenderSelectionInfo.h',
+ 'rendering/RenderSlider.cpp',
+ 'rendering/RenderSlider.h',
+ 'rendering/RenderTable.cpp',
+ 'rendering/RenderTable.h',
+ 'rendering/RenderTableCell.cpp',
+ 'rendering/RenderTableCell.h',
+ 'rendering/RenderTableCol.cpp',
+ 'rendering/RenderTableCol.h',
+ 'rendering/RenderTableRow.cpp',
+ 'rendering/RenderTableRow.h',
+ 'rendering/RenderTableSection.cpp',
+ 'rendering/RenderTableSection.h',
+ 'rendering/RenderText.cpp',
+ 'rendering/RenderText.h',
+ 'rendering/RenderTextControl.cpp',
+ 'rendering/RenderTextControl.h',
+ 'rendering/RenderTextControlMultiLine.cpp',
+ 'rendering/RenderTextControlMultiLine.h',
+ 'rendering/RenderTextControlSingleLine.cpp',
+ 'rendering/RenderTextControlSingleLine.h',
+ 'rendering/RenderTextFragment.cpp',
+ 'rendering/RenderTextFragment.h',
+ 'rendering/RenderTheme.cpp',
+ 'rendering/RenderTheme.h',
+ 'rendering/RenderThemeChromiumSkia.cpp',
+ 'rendering/RenderThemeChromiumSkia.h',
+ 'rendering/RenderThemeChromiumLinux.cpp',
+ 'rendering/RenderThemeChromiumLinux.h',
+ 'rendering/RenderThemeChromiumMac.h',
+ 'rendering/RenderThemeChromiumMac.mm',
+ 'rendering/RenderThemeChromiumWin.cpp',
+ 'rendering/RenderThemeChromiumWin.h',
+ 'rendering/RenderThemeMac.h',
+ 'rendering/RenderThemeMac.mm',
+ 'rendering/RenderThemeSafari.cpp',
+ 'rendering/RenderThemeSafari.h',
+ 'rendering/RenderThemeWin.cpp',
+ 'rendering/RenderThemeWin.h',
+ 'rendering/RenderTreeAsText.cpp',
+ 'rendering/RenderTreeAsText.h',
+ 'rendering/RenderVideo.cpp',
+ 'rendering/RenderVideo.h',
+ 'rendering/RenderView.cpp',
+ 'rendering/RenderView.h',
+ 'rendering/RenderWidget.cpp',
+ 'rendering/RenderWidget.h',
+ 'rendering/RenderWordBreak.cpp',
+ 'rendering/RenderWordBreak.h',
+ 'rendering/RootInlineBox.cpp',
+ 'rendering/RootInlineBox.h',
+ 'rendering/ScrollBehavior.cpp',
+ 'rendering/ScrollBehavior.h',
+ 'rendering/SVGCharacterLayoutInfo.cpp',
+ 'rendering/SVGCharacterLayoutInfo.h',
+ 'rendering/SVGInlineFlowBox.cpp',
+ 'rendering/SVGInlineFlowBox.h',
+ 'rendering/SVGInlineTextBox.cpp',
+ 'rendering/SVGInlineTextBox.h',
+ 'rendering/SVGRenderSupport.cpp',
+ 'rendering/SVGRenderSupport.h',
+ 'rendering/SVGRenderTreeAsText.cpp',
+ 'rendering/SVGRenderTreeAsText.h',
+ 'rendering/SVGRootInlineBox.cpp',
+ 'rendering/SVGRootInlineBox.h',
+ 'rendering/TableLayout.h',
+ 'rendering/TextControlInnerElements.cpp',
+ 'rendering/TextControlInnerElements.h',
+ 'rendering/TransformState.cpp',
+ 'rendering/TransformState.h',
+ 'rendering/break_lines.cpp',
+ 'rendering/break_lines.h',
+ 'storage/ChangeVersionWrapper.cpp',
+ 'storage/ChangeVersionWrapper.h',
+ 'storage/Database.cpp',
+ 'storage/Database.h',
+ 'storage/DatabaseAuthorizer.cpp',
+ 'storage/DatabaseAuthorizer.h',
+ 'storage/DatabaseDetails.h',
+ 'storage/DatabaseTask.cpp',
+ 'storage/DatabaseTask.h',
+ 'storage/DatabaseThread.cpp',
+ 'storage/DatabaseThread.h',
+ 'storage/DatabaseTracker.cpp',
+ 'storage/DatabaseTracker.h',
+ 'storage/DatabaseTrackerClient.h',
+ 'storage/LocalStorage.cpp',
+ 'storage/LocalStorage.h',
+ 'storage/LocalStorageArea.cpp',
+ 'storage/LocalStorageArea.h',
+ 'storage/LocalStorageTask.cpp',
+ 'storage/LocalStorageTask.h',
+ 'storage/LocalStorageThread.cpp',
+ 'storage/LocalStorageThread.h',
+ 'storage/OriginQuotaManager.cpp',
+ 'storage/OriginQuotaManager.h',
+ 'storage/OriginUsageRecord.cpp',
+ 'storage/OriginUsageRecord.h',
+ 'storage/SQLError.h',
+ 'storage/SQLResultSet.cpp',
+ 'storage/SQLResultSet.h',
+ 'storage/SQLResultSetRowList.cpp',
+ 'storage/SQLResultSetRowList.h',
+ 'storage/SQLStatement.cpp',
+ 'storage/SQLStatement.h',
+ 'storage/SQLStatementCallback.h',
+ 'storage/SQLStatementErrorCallback.h',
+ 'storage/SQLTransaction.cpp',
+ 'storage/SQLTransaction.h',
+ 'storage/SQLTransactionCallback.h',
+ 'storage/SQLTransactionErrorCallback.h',
+ 'storage/SessionStorage.cpp',
+ 'storage/SessionStorage.h',
+ 'storage/SessionStorageArea.cpp',
+ 'storage/SessionStorageArea.h',
+ 'storage/Storage.cpp',
+ 'storage/Storage.h',
+ 'storage/StorageArea.cpp',
+ 'storage/StorageArea.h',
+ 'storage/StorageEvent.cpp',
+ 'storage/StorageEvent.h',
+ 'storage/StorageMap.cpp',
+ 'storage/StorageMap.h',
+ 'svg/animation/SMILTime.cpp',
+ 'svg/animation/SMILTime.h',
+ 'svg/animation/SMILTimeContainer.cpp',
+ 'svg/animation/SMILTimeContainer.h',
+ 'svg/animation/SVGSMILElement.cpp',
+ 'svg/animation/SVGSMILElement.h',
+ 'svg/graphics/filters/SVGDistantLightSource.h',
+ 'svg/graphics/filters/SVGFEConvolveMatrix.cpp',
+ 'svg/graphics/filters/SVGFEConvolveMatrix.h',
+ 'svg/graphics/filters/SVGFEDiffuseLighting.cpp',
+ 'svg/graphics/filters/SVGFEDiffuseLighting.h',
+ 'svg/graphics/filters/SVGFEDisplacementMap.cpp',
+ 'svg/graphics/filters/SVGFEDisplacementMap.h',
+ 'svg/graphics/filters/SVGFEFlood.cpp',
+ 'svg/graphics/filters/SVGFEFlood.h',
+ 'svg/graphics/filters/SVGFEGaussianBlur.cpp',
+ 'svg/graphics/filters/SVGFEGaussianBlur.h',
+ 'svg/graphics/filters/SVGFEImage.cpp',
+ 'svg/graphics/filters/SVGFEImage.h',
+ 'svg/graphics/filters/SVGFEMerge.cpp',
+ 'svg/graphics/filters/SVGFEMerge.h',
+ 'svg/graphics/filters/SVGFEMorphology.cpp',
+ 'svg/graphics/filters/SVGFEMorphology.h',
+ 'svg/graphics/filters/SVGFEOffset.cpp',
+ 'svg/graphics/filters/SVGFEOffset.h',
+ 'svg/graphics/filters/SVGFESpecularLighting.cpp',
+ 'svg/graphics/filters/SVGFESpecularLighting.h',
+ 'svg/graphics/filters/SVGFETile.cpp',
+ 'svg/graphics/filters/SVGFETile.h',
+ 'svg/graphics/filters/SVGFETurbulence.cpp',
+ 'svg/graphics/filters/SVGFETurbulence.h',
+ 'svg/graphics/filters/SVGFilterEffect.cpp',
+ 'svg/graphics/filters/SVGFilterEffect.h',
+ 'svg/graphics/filters/SVGLightSource.cpp',
+ 'svg/graphics/filters/SVGLightSource.h',
+ 'svg/graphics/filters/SVGPointLightSource.h',
+ 'svg/graphics/filters/SVGSpotLightSource.h',
+ 'svg/graphics/SVGImage.cpp',
+ 'svg/graphics/SVGImage.h',
+ 'svg/graphics/SVGPaintServer.cpp',
+ 'svg/graphics/SVGPaintServer.h',
+ 'svg/graphics/SVGPaintServerGradient.cpp',
+ 'svg/graphics/SVGPaintServerGradient.h',
+ 'svg/graphics/SVGPaintServerLinearGradient.cpp',
+ 'svg/graphics/SVGPaintServerLinearGradient.h',
+ 'svg/graphics/SVGPaintServerPattern.cpp',
+ 'svg/graphics/SVGPaintServerPattern.h',
+ 'svg/graphics/SVGPaintServerRadialGradient.cpp',
+ 'svg/graphics/SVGPaintServerRadialGradient.h',
+ 'svg/graphics/SVGPaintServerSolid.cpp',
+ 'svg/graphics/SVGPaintServerSolid.h',
+ 'svg/graphics/SVGResource.cpp',
+ 'svg/graphics/SVGResource.h',
+ 'svg/graphics/SVGResourceClipper.cpp',
+ 'svg/graphics/SVGResourceClipper.h',
+ 'svg/graphics/SVGResourceFilter.cpp',
+ 'svg/graphics/SVGResourceFilter.h',
+ 'svg/graphics/SVGResourceListener.h',
+ 'svg/graphics/SVGResourceMarker.cpp',
+ 'svg/graphics/SVGResourceMarker.h',
+ 'svg/graphics/SVGResourceMasker.cpp',
+ 'svg/graphics/SVGResourceMasker.h',
+ 'svg/ColorDistance.cpp',
+ 'svg/ColorDistance.h',
+ 'svg/ElementTimeControl.h',
+ 'svg/Filter.cpp',
+ 'svg/Filter.h',
+ 'svg/FilterBuilder.h',
+ 'svg/FilterBuilder.cpp',
+ 'svg/FilterEffect.cpp',
+ 'svg/FilterEffect.h',
+ 'svg/GradientAttributes.h',
+ 'svg/LinearGradientAttributes.h',
+ 'svg/PatternAttributes.h',
+ 'svg/RadialGradientAttributes.h',
+ 'svg/SVGAElement.cpp',
+ 'svg/SVGAElement.h',
+ 'svg/SVGAllInOne.cpp',
+ 'svg/SVGAltGlyphElement.cpp',
+ 'svg/SVGAltGlyphElement.h',
+ 'svg/SVGAngle.cpp',
+ 'svg/SVGAngle.h',
+ 'svg/SVGAnimateColorElement.cpp',
+ 'svg/SVGAnimateColorElement.h',
+ 'svg/SVGAnimateElement.cpp',
+ 'svg/SVGAnimateElement.h',
+ 'svg/SVGAnimateMotionElement.cpp',
+ 'svg/SVGAnimateMotionElement.h',
+ 'svg/SVGAnimateTransformElement.cpp',
+ 'svg/SVGAnimateTransformElement.h',
+ 'svg/SVGAnimatedPathData.cpp',
+ 'svg/SVGAnimatedPathData.h',
+ 'svg/SVGAnimatedPoints.cpp',
+ 'svg/SVGAnimatedPoints.h',
+ 'svg/SVGAnimatedProperty.h',
+ 'svg/SVGAnimatedTemplate.h',
+ 'svg/SVGAnimationElement.cpp',
+ 'svg/SVGAnimationElement.h',
+ 'svg/SVGCircleElement.cpp',
+ 'svg/SVGCircleElement.h',
+ 'svg/SVGClipPathElement.cpp',
+ 'svg/SVGClipPathElement.h',
+ 'svg/SVGColor.cpp',
+ 'svg/SVGColor.h',
+ 'svg/SVGComponentTransferFunctionElement.cpp',
+ 'svg/SVGComponentTransferFunctionElement.h',
+ 'svg/SVGCursorElement.cpp',
+ 'svg/SVGCursorElement.h',
+ 'svg/SVGDefinitionSrcElement.cpp',
+ 'svg/SVGDefinitionSrcElement.h',
+ 'svg/SVGDefsElement.cpp',
+ 'svg/SVGDefsElement.h',
+ 'svg/SVGDescElement.cpp',
+ 'svg/SVGDescElement.h',
+ 'svg/SVGDocument.cpp',
+ 'svg/SVGDocument.h',
+ 'svg/SVGDocumentExtensions.cpp',
+ 'svg/SVGDocumentExtensions.h',
+ 'svg/SVGElement.cpp',
+ 'svg/SVGElement.h',
+ 'svg/SVGElementInstance.cpp',
+ 'svg/SVGElementInstance.h',
+ 'svg/SVGElementInstanceList.cpp',
+ 'svg/SVGElementInstanceList.h',
+ 'svg/SVGEllipseElement.cpp',
+ 'svg/SVGEllipseElement.h',
+ 'svg/SVGException.h',
+ 'svg/SVGExternalResourcesRequired.cpp',
+ 'svg/SVGExternalResourcesRequired.h',
+ 'svg/SVGFEBlendElement.cpp',
+ 'svg/SVGFEBlendElement.h',
+ 'svg/SVGFEColorMatrixElement.cpp',
+ 'svg/SVGFEColorMatrixElement.h',
+ 'svg/SVGFEComponentTransferElement.cpp',
+ 'svg/SVGFEComponentTransferElement.h',
+ 'svg/SVGFECompositeElement.cpp',
+ 'svg/SVGFECompositeElement.h',
+ 'svg/SVGFEDiffuseLightingElement.cpp',
+ 'svg/SVGFEDiffuseLightingElement.h',
+ 'svg/SVGFEDisplacementMapElement.cpp',
+ 'svg/SVGFEDisplacementMapElement.h',
+ 'svg/SVGFEDistantLightElement.cpp',
+ 'svg/SVGFEDistantLightElement.h',
+ 'svg/SVGFEFloodElement.cpp',
+ 'svg/SVGFEFloodElement.h',
+ 'svg/SVGFEFuncAElement.cpp',
+ 'svg/SVGFEFuncAElement.h',
+ 'svg/SVGFEFuncBElement.cpp',
+ 'svg/SVGFEFuncBElement.h',
+ 'svg/SVGFEFuncGElement.cpp',
+ 'svg/SVGFEFuncGElement.h',
+ 'svg/SVGFEFuncRElement.cpp',
+ 'svg/SVGFEFuncRElement.h',
+ 'svg/SVGFEGaussianBlurElement.cpp',
+ 'svg/SVGFEGaussianBlurElement.h',
+ 'svg/SVGFEImageElement.cpp',
+ 'svg/SVGFEImageElement.h',
+ 'svg/SVGFELightElement.cpp',
+ 'svg/SVGFELightElement.h',
+ 'svg/SVGFEMergeElement.cpp',
+ 'svg/SVGFEMergeElement.h',
+ 'svg/SVGFEMergeNodeElement.cpp',
+ 'svg/SVGFEMergeNodeElement.h',
+ 'svg/SVGFEOffsetElement.cpp',
+ 'svg/SVGFEOffsetElement.h',
+ 'svg/SVGFEPointLightElement.cpp',
+ 'svg/SVGFEPointLightElement.h',
+ 'svg/SVGFESpecularLightingElement.cpp',
+ 'svg/SVGFESpecularLightingElement.h',
+ 'svg/SVGFESpotLightElement.cpp',
+ 'svg/SVGFESpotLightElement.h',
+ 'svg/SVGFETileElement.cpp',
+ 'svg/SVGFETileElement.h',
+ 'svg/SVGFETurbulenceElement.cpp',
+ 'svg/SVGFETurbulenceElement.h',
+ 'svg/SVGFilterElement.cpp',
+ 'svg/SVGFilterElement.h',
+ 'svg/SVGFilterPrimitiveStandardAttributes.cpp',
+ 'svg/SVGFilterPrimitiveStandardAttributes.h',
+ 'svg/SVGFitToViewBox.cpp',
+ 'svg/SVGFitToViewBox.h',
+ 'svg/SVGFont.cpp',
+ 'svg/SVGFontData.cpp',
+ 'svg/SVGFontData.h',
+ 'svg/SVGFontElement.cpp',
+ 'svg/SVGFontElement.h',
+ 'svg/SVGFontFaceElement.cpp',
+ 'svg/SVGFontFaceElement.h',
+ 'svg/SVGFontFaceFormatElement.cpp',
+ 'svg/SVGFontFaceFormatElement.h',
+ 'svg/SVGFontFaceNameElement.cpp',
+ 'svg/SVGFontFaceNameElement.h',
+ 'svg/SVGFontFaceSrcElement.cpp',
+ 'svg/SVGFontFaceSrcElement.h',
+ 'svg/SVGFontFaceUriElement.cpp',
+ 'svg/SVGFontFaceUriElement.h',
+ 'svg/SVGForeignObjectElement.cpp',
+ 'svg/SVGForeignObjectElement.h',
+ 'svg/SVGGElement.cpp',
+ 'svg/SVGGElement.h',
+ 'svg/SVGGlyphElement.cpp',
+ 'svg/SVGGlyphElement.h',
+ 'svg/SVGGlyphMap.h',
+ 'svg/SVGGradientElement.cpp',
+ 'svg/SVGGradientElement.h',
+ 'svg/SVGHKernElement.cpp',
+ 'svg/SVGHKernElement.h',
+ 'svg/SVGImageElement.cpp',
+ 'svg/SVGImageElement.h',
+ 'svg/SVGImageLoader.cpp',
+ 'svg/SVGImageLoader.h',
+ 'svg/SVGLangSpace.cpp',
+ 'svg/SVGLangSpace.h',
+ 'svg/SVGLength.cpp',
+ 'svg/SVGLength.h',
+ 'svg/SVGLengthList.cpp',
+ 'svg/SVGLengthList.h',
+ 'svg/SVGLineElement.cpp',
+ 'svg/SVGLineElement.h',
+ 'svg/SVGLinearGradientElement.cpp',
+ 'svg/SVGLinearGradientElement.h',
+ 'svg/SVGList.h',
+ 'svg/SVGListTraits.h',
+ 'svg/SVGLocatable.cpp',
+ 'svg/SVGLocatable.h',
+ 'svg/SVGMPathElement.cpp',
+ 'svg/SVGMPathElement.h',
+ 'svg/SVGMarkerElement.cpp',
+ 'svg/SVGMarkerElement.h',
+ 'svg/SVGMaskElement.cpp',
+ 'svg/SVGMaskElement.h',
+ 'svg/SVGMetadataElement.cpp',
+ 'svg/SVGMetadataElement.h',
+ 'svg/SVGMissingGlyphElement.cpp',
+ 'svg/SVGMissingGlyphElement.h',
+ 'svg/SVGNumberList.cpp',
+ 'svg/SVGNumberList.h',
+ 'svg/SVGPaint.cpp',
+ 'svg/SVGPaint.h',
+ 'svg/SVGParserUtilities.cpp',
+ 'svg/SVGParserUtilities.h',
+ 'svg/SVGPathElement.cpp',
+ 'svg/SVGPathElement.h',
+ 'svg/SVGPathSeg.h',
+ 'svg/SVGPathSegArc.cpp',
+ 'svg/SVGPathSegArc.h',
+ 'svg/SVGPathSegClosePath.cpp',
+ 'svg/SVGPathSegClosePath.h',
+ 'svg/SVGPathSegCurvetoCubic.cpp',
+ 'svg/SVGPathSegCurvetoCubic.h',
+ 'svg/SVGPathSegCurvetoCubicSmooth.cpp',
+ 'svg/SVGPathSegCurvetoCubicSmooth.h',
+ 'svg/SVGPathSegCurvetoQuadratic.cpp',
+ 'svg/SVGPathSegCurvetoQuadratic.h',
+ 'svg/SVGPathSegCurvetoQuadraticSmooth.cpp',
+ 'svg/SVGPathSegCurvetoQuadraticSmooth.h',
+ 'svg/SVGPathSegLineto.cpp',
+ 'svg/SVGPathSegLineto.h',
+ 'svg/SVGPathSegLinetoHorizontal.cpp',
+ 'svg/SVGPathSegLinetoHorizontal.h',
+ 'svg/SVGPathSegLinetoVertical.cpp',
+ 'svg/SVGPathSegLinetoVertical.h',
+ 'svg/SVGPathSegList.cpp',
+ 'svg/SVGPathSegList.h',
+ 'svg/SVGPathSegMoveto.cpp',
+ 'svg/SVGPathSegMoveto.h',
+ 'svg/SVGPatternElement.cpp',
+ 'svg/SVGPatternElement.h',
+ 'svg/SVGPointList.cpp',
+ 'svg/SVGPointList.h',
+ 'svg/SVGPolyElement.cpp',
+ 'svg/SVGPolyElement.h',
+ 'svg/SVGPolygonElement.cpp',
+ 'svg/SVGPolygonElement.h',
+ 'svg/SVGPolylineElement.cpp',
+ 'svg/SVGPolylineElement.h',
+ 'svg/SVGPreserveAspectRatio.cpp',
+ 'svg/SVGPreserveAspectRatio.h',
+ 'svg/SVGRadialGradientElement.cpp',
+ 'svg/SVGRadialGradientElement.h',
+ 'svg/SVGRectElement.cpp',
+ 'svg/SVGRectElement.h',
+ 'svg/SVGRenderingIntent.h',
+ 'svg/SVGSVGElement.cpp',
+ 'svg/SVGSVGElement.h',
+ 'svg/SVGScriptElement.cpp',
+ 'svg/SVGScriptElement.h',
+ 'svg/SVGSetElement.cpp',
+ 'svg/SVGSetElement.h',
+ 'svg/SVGStopElement.cpp',
+ 'svg/SVGStopElement.h',
+ 'svg/SVGStringList.cpp',
+ 'svg/SVGStringList.h',
+ 'svg/SVGStylable.cpp',
+ 'svg/SVGStylable.h',
+ 'svg/SVGStyleElement.cpp',
+ 'svg/SVGStyleElement.h',
+ 'svg/SVGStyledElement.cpp',
+ 'svg/SVGStyledElement.h',
+ 'svg/SVGStyledLocatableElement.cpp',
+ 'svg/SVGStyledLocatableElement.h',
+ 'svg/SVGStyledTransformableElement.cpp',
+ 'svg/SVGStyledTransformableElement.h',
+ 'svg/SVGSwitchElement.cpp',
+ 'svg/SVGSwitchElement.h',
+ 'svg/SVGSymbolElement.cpp',
+ 'svg/SVGSymbolElement.h',
+ 'svg/SVGTRefElement.cpp',
+ 'svg/SVGTRefElement.h',
+ 'svg/SVGTSpanElement.cpp',
+ 'svg/SVGTSpanElement.h',
+ 'svg/SVGTests.cpp',
+ 'svg/SVGTests.h',
+ 'svg/SVGTextContentElement.cpp',
+ 'svg/SVGTextContentElement.h',
+ 'svg/SVGTextElement.cpp',
+ 'svg/SVGTextElement.h',
+ 'svg/SVGTextPathElement.cpp',
+ 'svg/SVGTextPathElement.h',
+ 'svg/SVGTextPositioningElement.cpp',
+ 'svg/SVGTextPositioningElement.h',
+ 'svg/SVGTitleElement.cpp',
+ 'svg/SVGTitleElement.h',
+ 'svg/SVGTransform.cpp',
+ 'svg/SVGTransform.h',
+ 'svg/SVGTransformDistance.cpp',
+ 'svg/SVGTransformDistance.h',
+ 'svg/SVGTransformList.cpp',
+ 'svg/SVGTransformList.h',
+ 'svg/SVGTransformable.cpp',
+ 'svg/SVGTransformable.h',
+ 'svg/SVGURIReference.cpp',
+ 'svg/SVGURIReference.h',
+ 'svg/SVGUnitTypes.h',
+ 'svg/SVGUseElement.cpp',
+ 'svg/SVGUseElement.h',
+ 'svg/SVGViewElement.cpp',
+ 'svg/SVGViewElement.h',
+ 'svg/SVGViewSpec.cpp',
+ 'svg/SVGViewSpec.h',
+ 'svg/SVGZoomAndPan.cpp',
+ 'svg/SVGZoomAndPan.h',
+ 'svg/SVGZoomEvent.cpp',
+ 'svg/SVGZoomEvent.h',
+ 'svg/SynchronizableTypeWrapper.h',
+ 'workers/AbstractWorker.cpp',
+ 'workers/AbstractWorker.h',
+ 'workers/GenericWorkerTask.h',
+ 'workers/SharedWorker.cpp',
+ 'workers/SharedWorker.h',
+ 'workers/Worker.cpp',
+ 'workers/Worker.h',
+ 'workers/WorkerContext.cpp',
+ 'workers/WorkerContext.h',
+ 'workers/WorkerContextProxy.h',
+ 'workers/WorkerLoaderProxy.h',
+ 'workers/WorkerLocation.cpp',
+ 'workers/WorkerLocation.h',
+ 'workers/WorkerMessagingProxy.cpp',
+ 'workers/WorkerMessagingProxy.h',
+ 'workers/WorkerObjectProxy.h',
+ 'workers/WorkerRunLoop.cpp',
+ 'workers/WorkerRunLoop.h',
+ 'workers/WorkerScriptLoader.cpp',
+ 'workers/WorkerScriptLoader.h',
+ 'workers/WorkerScriptLoaderClient.h',
+ 'workers/WorkerThread.cpp',
+ 'workers/WorkerThread.h',
+ 'xml/DOMParser.cpp',
+ 'xml/DOMParser.h',
+ 'xml/NativeXPathNSResolver.cpp',
+ 'xml/NativeXPathNSResolver.h',
+ 'xml/XMLHttpRequest.cpp',
+ 'xml/XMLHttpRequest.h',
+ 'xml/XMLHttpRequestException.h',
+ 'xml/XMLHttpRequestProgressEvent.h',
+ 'xml/XMLHttpRequestUpload.cpp',
+ 'xml/XMLHttpRequestUpload.h',
+ 'xml/XMLSerializer.cpp',
+ 'xml/XMLSerializer.h',
+ 'xml/XPathEvaluator.cpp',
+ 'xml/XPathEvaluator.h',
+ 'xml/XPathException.h',
+ 'xml/XPathExpression.cpp',
+ 'xml/XPathExpression.h',
+ 'xml/XPathExpressionNode.cpp',
+ 'xml/XPathExpressionNode.h',
+ 'xml/XPathFunctions.cpp',
+ 'xml/XPathFunctions.h',
+ 'xml/XPathNSResolver.cpp',
+ 'xml/XPathNSResolver.h',
+ 'xml/XPathNamespace.cpp',
+ 'xml/XPathNamespace.h',
+ 'xml/XPathNodeSet.cpp',
+ 'xml/XPathNodeSet.h',
+ 'xml/XPathParser.cpp',
+ 'xml/XPathParser.h',
+ 'xml/XPathPath.cpp',
+ 'xml/XPathPath.h',
+ 'xml/XPathPredicate.cpp',
+ 'xml/XPathPredicate.h',
+ 'xml/XPathResult.cpp',
+ 'xml/XPathResult.h',
+ 'xml/XPathStep.cpp',
+ 'xml/XPathStep.h',
+ 'xml/XPathUtil.cpp',
+ 'xml/XPathUtil.h',
+ 'xml/XPathValue.cpp',
+ 'xml/XPathValue.h',
+ 'xml/XPathVariableReference.cpp',
+ 'xml/XPathVariableReference.h',
+ 'xml/XSLImportRule.cpp',
+ 'xml/XSLImportRule.h',
+ 'xml/XSLStyleSheet.cpp',
+ 'xml/XSLStyleSheet.h',
+ 'xml/XSLTExtensions.cpp',
+ 'xml/XSLTExtensions.h',
+ 'xml/XSLTProcessor.cpp',
+ 'xml/XSLTProcessor.h',
+ 'xml/XSLTUnicodeSort.cpp',
+ 'xml/XSLTUnicodeSort.h',
+ ],
+ }
+}
diff --git a/src/3rdparty/webkit/WebCore/WebCore.order b/src/3rdparty/webkit/WebCore/WebCore.order
index ddce440..31b178c 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.order
+++ b/src/3rdparty/webkit/WebCore/WebCore.order
@@ -3793,7 +3793,6 @@ __ZN7WebCore7UIEventD0Ev
__ZN7WebCore5EventD2Ev
__ZN7WebCore13ContainerNode8setFocusEb
__ZN7WebCore4Node8setFocusEb
-__ZN7WebCore14focusRingColorEv
+[WebCoreControlTintObserver controlTintDidChange]
__ZN7WebCore26usesTestModeFocusRingColorEv
__ZNK7WebCore14SVGRenderStyle17inheritedNotEqualEPKS0_
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index 486c9d0..b0b0290 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -41,7 +41,7 @@ CONFIG -= warn_on
# Disable a few warnings on Windows. The warnings are also
# disabled in WebKitLibraries/win/tools/vsprops/common.vsprops
-win32-*: QMAKE_CXXFLAGS += -wd4291 -wd4344
+!win32-g++:win32-*: QMAKE_CXXFLAGS += -wd4291 -wd4344
unix:!mac:*-g++*:QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
unix:!mac:*-g++*:QMAKE_LFLAGS += -Wl,--gc-sections
@@ -58,6 +58,12 @@ freebsd-*: DEFINES += HAVE_PTHREAD_NP_H
DEFINES += BUILD_WEBKIT
+# Remove whole program optimizations due to miscompilations
+win32-msvc2005|win32-msvc2008:{
+ QMAKE_CFLAGS_RELEASE -= -GL
+ QMAKE_CXXFLAGS_RELEASE -= -GL
+}
+
win32-*: DEFINES += _HAS_TR1=0
wince* {
# DEFINES += ENABLE_SVG=0 ENABLE_XPATH=0 ENABLE_XBL=0 \
@@ -100,6 +106,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) {
!contains(DEFINES, ENABLE_OFFLINE_WEB_APPLICATIONS=.): DEFINES += ENABLE_OFFLINE_WEB_APPLICATIONS=1
!contains(DEFINES, ENABLE_DOM_STORAGE=.): DEFINES += ENABLE_DOM_STORAGE=1
!contains(DEFINES, ENABLE_ICONDATABASE=.): DEFINES += ENABLE_ICONDATABASE=1
+!contains(DEFINES, ENABLE_CHANNEL_MESSAGING=.): DEFINES += ENABLE_CHANNEL_MESSAGING=1
# turn on SQLITE support if any of the dependent features are turned on
!contains(DEFINES, ENABLE_SQLITE=.) {
@@ -116,6 +123,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) {
!contains(DEFINES, ENABLE_XSLT=.): DEFINES += ENABLE_XSLT=0
#!contains(DEFINES, ENABLE_XBL=.): DEFINES += ENABLE_XBL=1
!contains(DEFINES, ENABLE_WML=.): DEFINES += ENABLE_WML=0
+!contains(DEFINES, ENABLE_SHARED_WORKERS=.): DEFINES += ENABLE_SHARED_WORKERS=0
!contains(DEFINES, ENABLE_WORKERS=.): DEFINES += ENABLE_WORKERS=1
!contains(DEFINES, ENABLE_XHTMLMP=.): DEFINES += ENABLE_XHTMLMP=0
@@ -246,7 +254,7 @@ SVGCSSPROPERTIES = $$PWD/css/SVGCSSPropertyNames.in
SVGCSSVALUES = $$PWD/css/SVGCSSValueKeywords.in
STYLESHEETS_EMBED = \
- $$PWD/css/html4.css \
+ $$PWD/css/html.css \
$$PWD/css/quirks.css \
$$PWD/css/svg.css \
$$PWD/css/view-source.css \
@@ -404,6 +412,7 @@ IDL_BINDINGS += \
html/ImageData.idl \
html/MediaError.idl \
html/TextMetrics.idl \
+ html/ValidityState.idl \
html/VoidCallback.idl \
inspector/InspectorController.idl \
page/BarInfo.idl \
@@ -748,6 +757,7 @@ SOURCES += \
html/CollectionCache.cpp \
html/DataGridColumn.cpp \
html/DataGridColumnList.cpp \
+ html/DOMDataGridDataSource.cpp \
html/File.cpp \
html/FileList.cpp \
html/FormDataList.cpp \
@@ -833,6 +843,7 @@ SOURCES += \
html/HTMLViewSourceDocument.cpp \
html/ImageData.cpp \
html/PreloadScanner.cpp \
+ html/ValidityState.cpp \
inspector/ConsoleMessage.cpp \
inspector/InspectorDatabaseResource.cpp \
inspector/InspectorDOMStorageResource.cpp \
@@ -1012,7 +1023,6 @@ SOURCES += \
plugins/PluginStream.cpp \
plugins/PluginView.cpp \
rendering/AutoTableLayout.cpp \
- rendering/bidi.cpp \
rendering/break_lines.cpp \
rendering/CounterNode.cpp \
rendering/EllipsisBox.cpp \
@@ -1025,6 +1035,7 @@ SOURCES += \
rendering/RenderApplet.cpp \
rendering/RenderArena.cpp \
rendering/RenderBlock.cpp \
+ rendering/RenderBlockLineLayout.cpp \
rendering/RenderBox.cpp \
rendering/RenderBoxModelObject.cpp \
rendering/RenderBR.cpp \
@@ -1106,7 +1117,6 @@ SOURCES += \
HEADERS += \
$$PWD/platform/graphics/qt/StillImageQt.h \
$$PWD/platform/qt/QWebPopup.h \
- $$PWD/../WebKit/qt/Api/qwebpluginfactory.h \
$$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \
$$PWD/platform/network/qt/QNetworkReplyHandler.h \
$$PWD/rendering/style/CursorData.h \
@@ -1114,9 +1124,7 @@ HEADERS += \
$$PWD/rendering/style/StyleInheritedData.h \
$$PWD/rendering/style/StyleRareInheritedData.h \
$$PWD/rendering/style/StyleRareNonInheritedData.h \
- $$PWD/rendering/style/StyleReflection.h \
- $$PWD/../WebKit/qt/Api/qwebsecurityorigin.h \
- $$PWD/../WebKit/qt/Api/qwebdatabase.h
+ $$PWD/rendering/style/StyleReflection.h
SOURCES += \
@@ -1293,6 +1301,10 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) {
plugins/PluginViewNone.cpp
}
+contains(DEFINES, ENABLE_CHANNEL_MESSAGING=1) {
+ FEATURE_DEFINES_JAVASCRIPT += ENABLE_CHANNEL_MESSAGING=1
+}
+
contains(DEFINES, ENABLE_DASHBOARD_SUPPORT=0) {
DASHBOARDSUPPORTCSSPROPERTIES -= $$PWD/css/DashboardSupportCSSPropertyNames.in
}
@@ -1322,6 +1334,7 @@ contains(DEFINES, ENABLE_SQLITE=1) {
SOURCES += \
platform/sql/SQLiteAuthorizer.cpp \
platform/sql/SQLiteDatabase.cpp \
+ platform/sql/SQLiteFileSystem.cpp \
platform/sql/SQLiteStatement.cpp \
platform/sql/SQLiteTransaction.cpp \
platform/sql/SQLValue.cpp \
@@ -1368,10 +1381,12 @@ contains(DEFINES, ENABLE_DOM_STORAGE=1) {
storage/LocalStorageThread.h \
storage/Storage.h \
storage/StorageArea.h \
+ storage/StorageAreaImpl.h \
storage/StorageAreaSync.h \
storage/StorageEvent.h \
storage/StorageMap.h \
storage/StorageNamespace.h \
+ storage/StorageNamespaceImpl.h \
storage/StorageSyncManager.h
SOURCES += \
@@ -1380,10 +1395,12 @@ contains(DEFINES, ENABLE_DOM_STORAGE=1) {
storage/LocalStorageThread.cpp \
storage/Storage.cpp \
storage/StorageArea.cpp \
+ storage/StorageAreaImpl.cpp \
storage/StorageAreaSync.cpp \
storage/StorageEvent.cpp \
storage/StorageMap.cpp \
storage/StorageNamespace.cpp \
+ storage/StorageNamespaceImpl.cpp \
storage/StorageSyncManager.cpp
IDL_BINDINGS += \
@@ -1427,6 +1444,21 @@ contains(DEFINES, ENABLE_WORKERS=1) {
workers/WorkerScriptLoader.cpp
}
+contains(DEFINES, SHARED_WORKERS=1) {
+ FEATURE_DEFINES_JAVASCRIPT += ENABLE_SHARED_WORKERS=1
+
+ IDL_BINDINGS += \
+ workers/AbstractWorker.idl \
+ workers/SharedWorker.idl
+
+ SOURCES += \
+ bindings/js/JSAbstractWorkerCustom.cpp \
+ bindings/js/JSSharedWorkerConstructor.cpp \
+ bindings/js/JSSharedWorkerCustom.cpp \
+ workers/AbstractWorker.cpp \
+ workers/SharedWorker.cpp
+}
+
contains(DEFINES, ENABLE_VIDEO=1) {
FEATURE_DEFINES_JAVASCRIPT += ENABLE_VIDEO=1
@@ -2168,8 +2200,6 @@ HEADERS += $$WEBKIT_API_HEADERS
target.path = $$[QT_INSTALL_LIBS]
headers.files = $$WEBKIT_API_HEADERS
headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit
- prf.files = $$PWD/../WebKit/qt/Api/qtwebkit.prf
- prf.path = $$[QT_INSTALL_PREFIX]/mkspecs/features
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
@@ -2182,7 +2212,7 @@ HEADERS += $$WEBKIT_API_HEADERS
}
- INSTALLS += target headers prf
+ INSTALLS += target headers
unix {
CONFIG += create_pc create_prl
diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h
index 8939092..22a7f99 100644
--- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h
+++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h
@@ -151,7 +151,8 @@ enum AccessibilityRole {
ListBoxOptionRole,
TableHeaderContainerRole,
DefinitionListTermRole,
- DefinitionListDefinitionRole
+ DefinitionListDefinitionRole,
+ AnnotationRole
};
struct VisiblePositionRange {
@@ -285,7 +286,7 @@ public:
virtual IntRect boundingBoxRect() const;
virtual IntRect elementRect() const;
virtual IntSize size() const;
- IntPoint clickPoint() const;
+ virtual IntPoint clickPoint() const;
virtual KURL url() const;
virtual PlainTextRange selectedTextRange() const;
diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp
index 9c10267..7d2ddc5 100644
--- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -966,6 +966,10 @@ String AccessibilityRenderObject::accessibilityDescription() const
if (!m_renderer)
return String();
+ String ariaLabel = getAttribute(aria_labelAttr).string();
+ if (!ariaLabel.isEmpty())
+ return ariaLabel;
+
String ariaDescription = ariaDescribedByAttribute();
if (!ariaDescription.isEmpty())
return ariaDescription;
@@ -1063,6 +1067,21 @@ IntSize AccessibilityRenderObject::size() const
return rect.size();
}
+IntPoint AccessibilityRenderObject::clickPoint() const
+{
+ // use the default position unless this is an editable web area, in which case we use the selection bounds.
+ if (!isWebArea() || isReadOnly())
+ return AccessibilityObject::clickPoint();
+
+ VisibleSelection visSelection = selection();
+ VisiblePositionRange range = VisiblePositionRange(visSelection.visibleStart(), visSelection.visibleEnd());
+ IntRect bounds = boundsForVisiblePositionRange(range);
+#if PLATFORM(MAC)
+ bounds.setLocation(m_renderer->document()->view()->screenToContents(bounds.location()));
+#endif
+ return IntPoint(bounds.x() + (bounds.width() / 2), bounds.y() - (bounds.height() / 2));
+}
+
AccessibilityObject* AccessibilityRenderObject::internalLinkElement() const
{
Element* element = anchorElement();
@@ -1290,13 +1309,13 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const
return false;
}
- // check for one-dimensional image
- RenderImage* image = toRenderImage(m_renderer);
- if (image->height() <= 1 || image->width() <= 1)
- return true;
-
- // check whether rendered image was stretched from one-dimensional file image
if (isNativeImage()) {
+ // check for one-dimensional image
+ RenderImage* image = toRenderImage(m_renderer);
+ if (image->height() <= 1 || image->width() <= 1)
+ return true;
+
+ // check whether rendered image was stretched from one-dimensional file image
if (image->cachedImage()) {
IntSize imageSize = image->cachedImage()->imageSize(image->view()->zoomFactor());
return imageSize.height() <= 1 || imageSize.width() <= 1;
@@ -2154,12 +2173,13 @@ AccessibilityObject* AccessibilityRenderObject::observableObject() const
typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap;
-struct RoleEntry {
- String ariaRole;
- AccessibilityRole webcoreRole;
-};
static const ARIARoleMap& createARIARoleMap()
{
+ struct RoleEntry {
+ String ariaRole;
+ AccessibilityRole webcoreRole;
+ };
+
const RoleEntry roles[] = {
{ "button", ButtonRole },
{ "checkbox", CheckBoxRole },
@@ -2184,7 +2204,8 @@ static const ARIARoleMap& createARIARoleMap()
{ "range", SliderRole },
{ "slider", SliderRole },
{ "spinbutton", ProgressIndicatorRole },
- { "textbox", TextAreaRole }
+ { "textbox", TextAreaRole },
+ { "toolbar", ToolbarRole }
};
ARIARoleMap& roleMap = *new ARIARoleMap;
@@ -2304,6 +2325,9 @@ AccessibilityRole AccessibilityRenderObject::roleValue() const
if (node && node->hasTagName(dtTag))
return DefinitionListTermRole;
+ if (node && (node->hasTagName(rpTag) || node->hasTagName(rtTag)))
+ return AnnotationRole;
+
if (m_renderer->isBlockFlow() || (node && node->hasTagName(labelTag)))
return GroupRole;
diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h
index 4fa325f..4f8e247 100644
--- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h
+++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h
@@ -147,6 +147,7 @@ public:
virtual IntRect boundingBoxRect() const;
virtual IntRect elementRect() const;
virtual IntSize size() const;
+ virtual IntPoint clickPoint() const;
void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
RenderObject* renderer() const { return m_renderer; }
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
new file mode 100644
index 0000000..82e06e3
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "JSAbstractWorker.h"
+
+#include "AbstractWorker.h"
+#include "JSDOMGlobalObject.h"
+#include "JSEventListener.h"
+#include "JSEventTarget.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSAbstractWorker::mark()
+{
+ DOMObject::mark();
+
+ markIfNotNull(m_impl->onerror());
+
+ typedef AbstractWorker::EventListenersMap EventListenersMap;
+ typedef AbstractWorker::ListenerVector ListenerVector;
+ EventListenersMap& eventListeners = m_impl->eventListeners();
+ for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) {
+ for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter)
+ (*vecIter)->markJSFunction();
+ }
+}
+
+JSValue JSAbstractWorker::addEventListener(ExecState* exec, const ArgList& args)
+{
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
+ if (!globalObject)
+ return jsUndefined();
+ RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(1));
+ if (!listener)
+ return jsUndefined();
+ impl()->addEventListener(args.at(0).toString(exec), listener.release(), args.at(2).toBoolean(exec));
+ return jsUndefined();
+}
+
+JSValue JSAbstractWorker::removeEventListener(ExecState* exec, const ArgList& args)
+{
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
+ if (!globalObject)
+ return jsUndefined();
+ JSEventListener* listener = globalObject->findJSEventListener(args.at(1));
+ if (!listener)
+ return jsUndefined();
+ impl()->removeEventListener(args.at(0).toString(exec), listener, args.at(2).toBoolean(exec));
+ return jsUndefined();
+}
+
+JSValue toJS(ExecState* exec, AbstractWorker* baseObject)
+{
+ // Just call the JSEventTarget implementation of toJS(), which already differentiates between the different implementations.
+ return toJS(exec, static_cast<EventTarget*>(baseObject));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
index 6361e70..ffe8cf5 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
@@ -84,7 +84,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
callType = m_customResolver->getCallData(callData);
if (callType == CallTypeNone) {
// FIXME: Pass actual line number and source URL.
- m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String());
+ m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String());
return String();
}
function = m_customResolver;
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp
index 55f0e91..81d59fb 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp
@@ -32,6 +32,7 @@
#include "EventException.h"
#include "ExceptionCode.h"
#include "Frame.h"
+#include "HTMLAudioElement.h"
#include "HTMLImageElement.h"
#include "HTMLScriptElement.h"
#include "HTMLNames.h"
@@ -288,6 +289,10 @@ static inline bool isObservableThroughDOM(JSNode* jsNode)
return true;
if (node->hasTagName(scriptTag) && !static_cast<HTMLScriptElement*>(node)->haveFiredLoadEvent())
return true;
+#if ENABLE(VIDEO)
+ if (node->hasTagName(audioTag) && !static_cast<HTMLAudioElement*>(node)->paused())
+ return true;
+#endif
}
return false;
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h
index 1378c91..e3fd417 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h
@@ -86,8 +86,9 @@ namespace WebCore {
return structure;
return cacheDOMStructure(globalObject, WrapperClass::createStructure(WrapperClass::createPrototype(exec, globalObject)), &WrapperClass::s_info);
}
- template<class WrapperClass> inline JSC::Structure* getDOMStructure(JSC::ExecState* exec)
+ template<class WrapperClass> inline JSC::Structure* deprecatedGetDOMStructure(JSC::ExecState* exec)
{
+ // FIXME: This function is wrong. It uses the wrong global object for creating the prototype structure.
return getDOMStructure<WrapperClass>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()));
}
template<class WrapperClass> inline JSC::JSObject* getDOMPrototype(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject)
@@ -99,7 +100,8 @@ namespace WebCore {
{
ASSERT(object);
ASSERT(!getCachedDOMObjectWrapper(exec->globalData(), object));
- WrapperClass* wrapper = new (exec) WrapperClass(getDOMStructure<WrapperClass>(exec), object);
+ // FIXME: new (exec) could use a different globalData than the globalData this wrapper is cached on.
+ WrapperClass* wrapper = new (exec) WrapperClass(deprecatedGetDOMStructure<WrapperClass>(exec), object);
cacheDOMObjectWrapper(exec->globalData(), object, wrapper);
return wrapper;
}
@@ -118,7 +120,7 @@ namespace WebCore {
{
ASSERT(object);
ASSERT(!getCachedDOMObjectWrapper(exec->globalData(), object));
- WrapperClass* wrapper = new (exec) WrapperClass(getDOMStructure<WrapperClass>(exec), object, context);
+ WrapperClass* wrapper = new (exec) WrapperClass(deprecatedGetDOMStructure<WrapperClass>(exec), object, context);
cacheDOMObjectWrapper(exec->globalData(), object, wrapper);
return wrapper;
}
@@ -137,7 +139,9 @@ namespace WebCore {
{
ASSERT(node);
ASSERT(!getCachedDOMNodeWrapper(node->document(), node));
- WrapperClass* wrapper = new (exec) WrapperClass(getDOMStructure<WrapperClass>(exec), node);
+ WrapperClass* wrapper = new (exec) WrapperClass(deprecatedGetDOMStructure<WrapperClass>(exec), node);
+ // FIXME: The entire function can be removed, once we fix caching.
+ // This function is a one-off hack to make Nodes cache in the right global object.
cacheDOMNodeWrapper(node->document(), node, wrapper);
return wrapper;
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp
index 0eefebe..0f419ba 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -99,7 +99,7 @@ void JSDOMWindowBase::printErrorMessage(const String& message) const
if (settings->privateBrowsingEnabled())
return;
- impl()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, 1, String()); // FIXME: provide a real line number and source URL.
+ impl()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); // FIXME: provide a real line number and source URL.
}
ExecState* JSDOMWindowBase::globalExec()
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 22013eb..c095bf2 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -45,6 +45,7 @@
#include "JSMessageChannelConstructor.h"
#include "JSMessagePort.h"
#include "JSOptionConstructor.h"
+#include "JSSharedWorkerConstructor.h"
#include "JSWebKitCSSMatrixConstructor.h"
#include "JSWebKitPointConstructor.h"
#include "JSWorkerConstructor.h"
@@ -476,6 +477,13 @@ JSValue JSDOMWindow::worker(ExecState* exec) const
}
#endif
+#if ENABLE(SHARED_WORKERS)
+JSValue JSDOMWindow::sharedWorker(ExecState* exec) const
+{
+ return getDOMConstructor<JSSharedWorkerConstructor>(exec, this);
+}
+#endif
+
// Custom functions
// Helper for window.open() and window.showModalDialog()
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridColumnListCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridColumnListCustom.cpp
index af49df4..c7ffcde 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridColumnListCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridColumnListCustom.cpp
@@ -24,6 +24,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "JSDataGridColumnList.h"
#include "AtomicString.h"
@@ -47,3 +50,5 @@ JSValue JSDataGridColumnList::nameGetter(ExecState* exec, const Identifier& prop
}
} // namespace WebCore
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.cpp
index e75b10b..02b4214 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.cpp
@@ -24,6 +24,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "JSDataGridDataSource.h"
#include "Document.h"
@@ -47,34 +50,6 @@ JSDataGridDataSource::~JSDataGridDataSource()
{
}
-void JSDataGridDataSource::initialize(HTMLDataGridElement* datagrid)
-{
- if (!m_frame->script()->isEnabled())
- return;
-
- JSLock lock(false);
- RefPtr<JSDataGridDataSource> protect(this);
-
- ExecState* exec = m_frame->script()->globalObject()->globalExec();
-
- if (!jsDataSource().isObject())
- return;
-
- JSValue initializeFunction = jsDataSource().get(exec, Identifier(exec, "initialize"));
- CallData callData;
- CallType callType = initializeFunction.getCallData(callData);
- if (callType == CallTypeNone)
- return;
-
- MarkedArgumentBuffer args;
- args.append(toJS(exec, datagrid));
-
- JSDOMWindowBase::commonJSGlobalData()->timeoutChecker.start();
- call(exec, initializeFunction, callType, callData, m_dataSource, args);
- JSDOMWindowBase::commonJSGlobalData()->timeoutChecker.stop();
-
- if (exec->hadException())
- reportCurrentException(exec);
-}
-
} // namespace WebCore
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.h
index 2537b00..077ef8f 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.h
@@ -26,6 +26,8 @@
#ifndef JSDataGridDataSource_h
#define JSDataGridDataSource_h
+#if ENABLE(DATAGRID)
+
#include "DataGridDataSource.h"
#include <runtime/JSValue.h>
#include <runtime/Protect.h>
@@ -49,8 +51,6 @@ public:
virtual bool isJSDataGridDataSource() const { return true; }
JSC::JSValue jsDataSource() const { return m_dataSource.get(); }
- virtual void initialize(HTMLDataGridElement*);
-
private:
JSDataGridDataSource(JSC::JSValue, Frame*);
@@ -72,4 +72,5 @@ inline const JSDataGridDataSource* asJSDataGridDataSource(const DataGridDataSour
} // namespace WebCore
+#endif // ENABLE(DATAGRID)
#endif // JSDataGridDataSource_h
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.cpp
index 2058098..875e904 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.cpp
@@ -56,6 +56,11 @@
#include "WorkerContext.h"
#endif
+#if ENABLE(SHARED_WORKERS)
+#include "JSSharedWorker.h"
+#include "SharedWorker.h"
+#endif
+
using namespace JSC;
namespace WebCore {
@@ -101,6 +106,11 @@ JSValue toJS(ExecState* exec, EventTarget* target)
return toJSDOMGlobalObject(workerContext);
#endif
+#if ENABLE(SHARED_WORKERS)
+ if (SharedWorker* sharedWorker = target->toSharedWorker())
+ return toJS(exec, sharedWorker);
+#endif
+
ASSERT_NOT_REACHED();
return jsNull();
}
@@ -132,6 +142,10 @@ EventTarget* toEventTarget(JSC::JSValue value)
CONVERT_TO_EVENT_TARGET(WorkerContext)
#endif
+#if ENABLE(SHARED_WORKERS)
+ CONVERT_TO_EVENT_TARGET(SharedWorker)
+#endif
+
return 0;
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDataGridElementCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDataGridElementCustom.cpp
index 5aa0904..a30f5e4 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDataGridElementCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDataGridElementCustom.cpp
@@ -24,6 +24,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "JSHTMLDataGridElement.h"
#include "Document.h"
@@ -44,7 +47,14 @@ JSValue JSHTMLDataGridElement::dataSource(ExecState*) const
void JSHTMLDataGridElement::setDataSource(ExecState*, JSValue value)
{
+ if (value.isNull()) {
+ static_cast<HTMLDataGridElement*>(impl())->setDataSource(0);
+ return;
+ }
+
static_cast<HTMLDataGridElement*>(impl())->setDataSource(JSDataGridDataSource::create(value, impl()->document()->frame()));
}
} // namespace WebCore
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFormElementCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFormElementCustom.cpp
index 8bf543c..e5b428a 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFormElementCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFormElementCustom.cpp
@@ -62,7 +62,7 @@ JSValue JSHTMLFormElement::submit(ExecState* exec, const ArgList&)
Frame* activeFrame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!activeFrame)
return jsUndefined();
- static_cast<HTMLFormElement*>(impl())->submit(0, false, !activeFrame->script()->anyPageIsProcessingUserGesture(), false);
+ static_cast<HTMLFormElement*>(impl())->submit(0, false, !activeFrame->script()->anyPageIsProcessingUserGesture());
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp
index f7c74ae..8913243 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp
@@ -77,7 +77,11 @@ void JSLazyEventListener::parseCode() const
if (m_parsed)
return;
- if (m_globalObject->scriptExecutionContext()->isDocument()) {
+ ScriptExecutionContext* executionContext = m_globalObject->scriptExecutionContext();
+ ASSERT(executionContext);
+ if (!executionContext)
+ return;
+ if (executionContext->isDocument()) {
JSDOMWindow* window = static_cast<JSDOMWindow*>(m_globalObject);
Frame* frame = window->impl()->frame();
if (!frame)
@@ -93,7 +97,7 @@ void JSLazyEventListener::parseCode() const
ExecState* exec = m_globalObject->globalExec();
MarkedArgumentBuffer args;
- UString sourceURL(m_globalObject->scriptExecutionContext()->url().string());
+ UString sourceURL(executionContext->url().string());
args.append(jsNontrivialString(exec, m_eventParameterName));
args.append(jsString(exec, m_code));
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.cpp
index 93a8937..af1995b 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.cpp
@@ -43,7 +43,9 @@ const ClassInfo JSNamedNodesCollection::s_info = { "Collection", 0, 0, 0 };
// for constructs like document.forms.<name>[1],
// so it shouldn't be a problem that it's storing all the nodes (with the same name). (David)
JSNamedNodesCollection::JSNamedNodesCollection(ExecState* exec, const Vector<RefPtr<Node> >& nodes)
- : DOMObject(getDOMStructure<JSNamedNodesCollection>(exec))
+ // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+ // we should use the global object from the nodes.
+ : DOMObject(deprecatedGetDOMStructure<JSNamedNodesCollection>(exec))
, m_nodes(new Vector<RefPtr<Node> >(nodes))
{
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSRGBColor.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSRGBColor.cpp
index f7c87e2..c430d5f 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSRGBColor.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSRGBColor.cpp
@@ -49,7 +49,9 @@ ASSERT_CLASS_FITS_IN_CELL(JSRGBColor);
const ClassInfo JSRGBColor::s_info = { "RGBColor", 0, &JSRGBColorTable, 0 };
JSRGBColor::JSRGBColor(ExecState* exec, unsigned color)
- : DOMObject(getDOMStructure<JSRGBColor>(exec))
+ // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+ // This will be fixed when JSRGBColor wraps css/RGBColor instead of being custom.
+ : DOMObject(deprecatedGetDOMStructure<JSRGBColor>(exec))
, m_color(color)
{
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp
new file mode 100644
index 0000000..ead17dd
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "JSSharedWorkerConstructor.h"
+
+#include "JSDOMWindowCustom.h"
+#include "JSSharedWorker.h"
+#include "SharedWorker.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+const ClassInfo JSSharedWorkerConstructor::s_info = { "SharedWorkerConstructor", 0, 0, 0 };
+
+JSSharedWorkerConstructor::JSSharedWorkerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
+ : DOMObject(JSSharedWorkerConstructor::createStructure(globalObject->objectPrototype()))
+{
+ putDirect(exec->propertyNames().prototype, JSSharedWorkerPrototype::self(exec, globalObject), None);
+ // Host functions have a length property describing the number of expected arguments.
+ putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
+}
+
+static JSObject* constructSharedWorker(ExecState* exec, JSObject*, const ArgList& args)
+{
+ if (args.size() < 2)
+ return throwError(exec, SyntaxError, "Not enough arguments");
+
+ UString scriptURL = args.at(0).toString(exec);
+ UString name = args.at(1).toString(exec);
+ if (exec->hadException())
+ return 0;
+
+ ScriptExecutionContext* context = static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject())->scriptExecutionContext();
+ ExceptionCode ec = 0;
+ RefPtr<SharedWorker> worker = SharedWorker::create(scriptURL, name, context, ec);
+ setDOMException(exec, ec);
+
+ // FIXME: toJS() creates an object whose prototype is derived from lexicalGlobalScope, which is incorrect (Bug 27088)
+ return asObject(toJS(exec, worker.release()));
+}
+
+ConstructType JSSharedWorkerConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructSharedWorker;
+ return ConstructTypeHost;
+}
+
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.h b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.h
new file mode 100644
index 0000000..be8b2b4
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#ifndef JSSharedWorkerConstructor_h
+#define JSSharedWorkerConstructor_h
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "JSDOMBinding.h"
+
+namespace WebCore {
+
+ class JSSharedWorkerConstructor : public DOMObject {
+ public:
+ JSSharedWorkerConstructor(JSC::ExecState*, JSDOMGlobalObject*);
+
+ static const JSC::ClassInfo s_info;
+
+ private:
+ virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
+
+ virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
+
+#endif // JSSharedWorkerConstructor_h
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp
new file mode 100644
index 0000000..8553298
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "JSSharedWorker.h"
+
+#include "JSDOMGlobalObject.h"
+#include "SharedWorker.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSSharedWorker::mark()
+{
+ Base::mark();
+
+ if (MessagePort* port = impl()->port()) {
+ DOMObject* wrapper = getCachedDOMObjectWrapper(*Heap::heap(this)->globalData(), port);
+ if (wrapper && !wrapper->marked())
+ wrapper->mark();
+ }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp
index 14bbe19..06475f9 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp
@@ -30,7 +30,10 @@
#include "JSWorkerContext.h"
#include "JSDOMBinding.h"
+#include "JSDOMGlobalObject.h"
#include "JSEventListener.h"
+#include "JSMessageChannelConstructor.h"
+#include "JSMessagePort.h"
#include "JSWorkerLocation.h"
#include "JSWorkerNavigator.h"
#include "JSXMLHttpRequestConstructor.h"
@@ -138,6 +141,14 @@ JSValue JSWorkerContext::setInterval(ExecState* exec, const ArgList& args)
return jsNumber(exec, impl()->setInterval(action, delay));
}
+
+#if ENABLE(CHANNEL_MESSAGING)
+JSValue JSWorkerContext::messageChannel(ExecState* exec) const
+{
+ return getDOMConstructor<JSMessageChannelConstructor>(exec, this);
+}
+#endif
+
} // namespace WebCore
#endif // ENABLE(WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerCustom.cpp
index f4d3033..9707519 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerCustom.cpp
@@ -31,6 +31,7 @@
#include "JSDOMGlobalObject.h"
#include "JSEventListener.h"
+#include "JSMessagePort.h"
#include "Worker.h"
using namespace JSC;
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp
index 3e59df9..442205e 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp
@@ -81,7 +81,15 @@ ScriptController::~ScriptController()
ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
{
- if (!m_XSSAuditor->canEvaluate(sourceCode.source())) {
+ const SourceCode& jsSourceCode = sourceCode.jsSourceCode();
+ String sourceURL = jsSourceCode.provider()->url();
+
+ if (sourceURL.isNull() && !m_XSSAuditor->canEvaluateJavaScriptURL(sourceCode.source())) {
+ // This JavaScript URL is not safe to be evaluated.
+ return JSValue();
+ }
+
+ if (!sourceURL.isNull() && !m_XSSAuditor->canEvaluate(sourceCode.source())) {
// This script is not safe to be evaluated.
return JSValue();
}
@@ -89,8 +97,6 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
// evaluate code. Returns the JS return value or 0
// if there was none, an error occured or the type couldn't be converted.
- const SourceCode& jsSourceCode = sourceCode.jsSourceCode();
-
initScriptIfNeeded();
// inlineCode is true for <a href="javascript:doSomething()">
// and false for <script>doSomething()</script>. Check if it has the
@@ -98,7 +104,6 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
// See smart window.open policy for where this is used.
ExecState* exec = m_windowShell->window()->globalExec();
const String* savedSourceURL = m_sourceURL;
- String sourceURL = jsSourceCode.provider()->url();
m_sourceURL = &sourceURL;
JSLock lock(false);
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp
index 13e180a..ab392bc 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp
@@ -31,7 +31,6 @@
#include "config.h"
#include "ScriptObjectQuarantine.h"
-#include "Database.h"
#include "Document.h"
#include "Frame.h"
#include "JSDOMBinding.h"
@@ -43,6 +42,7 @@
#include <runtime/JSLock.h>
#if ENABLE(DATABASE)
+#include "Database.h"
#include "JSDatabase.h"
#endif
diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 4f9aa1a..dbcffff 100644
--- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -140,14 +140,6 @@ sub AvoidInclusionOfType
return 0;
}
-sub UsesManualToJSImplementation
-{
- my $type = shift;
-
- return 1 if $type eq "Node" or $type eq "Document" or $type eq "HTMLCollection" or $type eq "SVGPathSeg" or $type eq "StyleSheet" or $type eq "CSSRule" or $type eq "CSSValue" or $type eq "Event" or $type eq "ImageData" or $type eq "Element" or $type eq "Text" or $type eq "SVGElementInstance";
- return 0;
-}
-
sub IndexGetterReturnsStrings
{
my $type = shift;
@@ -629,7 +621,7 @@ sub GenerateHeader
push(@headerContent, "}\n\n");
}
- if (!$hasParent || $dataNode->extendedAttributes->{"GenerateToJS"}) {
+ if (!$hasParent || $dataNode->extendedAttributes->{"GenerateToJS"} || $dataNode->extendedAttributes->{"CustomToJS"}) {
if ($podType) {
push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSSVGPODTypeWrapper<$podType>*, SVGElement* context);\n");
} elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
@@ -1505,7 +1497,7 @@ sub GenerateImplementation
}
}
- if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateToJS"}) and !UsesManualToJSImplementation($implClassName)) {
+ if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateToJS"}) and !$dataNode->extendedAttributes->{"CustomToJS"}) {
if ($podType) {
push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSSVGPODTypeWrapper<$podType>* object, SVGElement* context)\n");
} elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
@@ -1910,7 +1902,7 @@ tableSizeLoop:
push(@implContent, "};\n\n");
my $perfectSizeMask = $perfectSize - 1;
my $compactSizeMask = $numEntries - 1;
- push(@implContent, "static const HashTable $name =\n");
+ push(@implContent, "static JSC_CONST_HASHTABLE HashTable $name =\n");
push(@implContent, "#if ENABLE(PERFECT_HASH_SIZE)\n");
push(@implContent, " { $perfectSizeMask, $nameEntries, 0 };\n");
push(@implContent, "#else\n");
diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 088668e..cdadf81 100644
--- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -234,7 +234,7 @@ sub AddClassForwardIfNeeded
sub GetImplementationFileName
{
my $iface = shift;
- return "HTMLCollection.h" if $iface eq "UndetectableHTMLCollection";
+ return "HTMLCollection.h" if $iface eq "HTMLAllCollection";
return "Event.h" if $iface eq "DOMTimeStamp";
return "NamedAttrMap.h" if $iface eq "NamedNodeMap";
return "NameNodeList.h" if $iface eq "NodeList";
@@ -346,12 +346,12 @@ sub HolderToNative
if (IsNodeSubType($dataNode)) {
push(@implContentDecls, <<END);
- $implClassName* imp = V8Proxy::convertDOMWrapperToNode<$implClassName>(holder);
+ $implClassName* imp = V8DOMWrapper::convertDOMWrapperToNode<$implClassName>(holder);
END
} else {
push(@implContentDecls, <<END);
- $implClassName* imp = V8Proxy::convertToNativeObject<$implClassName>(V8ClassIndex::$classIndex, holder);
+ $implClassName* imp = V8DOMWrapper::convertToNativeObject<$implClassName>(V8ClassIndex::$classIndex, holder);
END
}
@@ -381,7 +381,7 @@ sub GenerateDomainSafeFunctionGetter
INC_STATS(\"DOM.$implClassName.$funcName._get\");
static v8::Persistent<v8::FunctionTemplate> private_template =
v8::Persistent<v8::FunctionTemplate>::New($newTemplateString);
- v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
@@ -421,7 +421,7 @@ END
if ($classIndex eq "DOMWINDOW") {
push(@implContentDecls, <<END);
- DOMWindow* window = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
+ DOMWindow* window = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
Frame* frame = window->frame();
if (frame) {
// Get the proxy corresponding to the DOMWindow if possible to
@@ -500,7 +500,7 @@ END
if ($isPodType) {
push(@implContentDecls, <<END);
- V8SVGPODTypeWrapper<$implClassName>* imp_wrapper = V8Proxy::convertToNativeObject<V8SVGPODTypeWrapper<$implClassName> >(V8ClassIndex::$classIndex, info.Holder());
+ V8SVGPODTypeWrapper<$implClassName>* imp_wrapper = V8DOMWrapper::convertToNativeObject<V8SVGPODTypeWrapper<$implClassName> >(V8ClassIndex::$classIndex, info.Holder());
$implClassName imp_instance = *imp_wrapper;
END
if ($getterStringUsesImp) {
@@ -512,7 +512,7 @@ END
} elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8DisallowShadowing"}) {
# perform lookup first
push(@implContentDecls, <<END);
- v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
if (holder.IsEmpty()) return v8::Undefined();
END
HolderToNative($dataNode, $implClassName, $classIndex);
@@ -562,7 +562,7 @@ END
$getterString = "imp_instance";
}
if ($nativeType eq "String") {
- $getterString = "ToString($getterString)";
+ $getterString = "toString($getterString)";
}
my $result;
@@ -624,9 +624,9 @@ END
if ($attrIsPodType) {
my $classIndex = uc($attrType);
- push(@implContentDecls, " return V8Proxy::convertToV8Object(V8ClassIndex::$classIndex, wrapper);\n");
+ push(@implContentDecls, " return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper);\n");
} else {
- push(@implContentDecls, " return ".NativeToJSValue($attribute->signature, $result).";\n");
+ push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, " ").";\n");
}
push(@implContentDecls, " }\n\n"); # end of getter
@@ -674,14 +674,14 @@ sub GenerateNormalAttrSetter
if ($isPodType) {
$implClassName = GetNativeType($implClassName);
$implIncludes{"V8SVGPODTypeWrapper.h"} = 1;
- push(@implContentDecls, " V8SVGPODTypeWrapper<$implClassName>* wrapper = V8Proxy::convertToNativeObject<V8SVGPODTypeWrapper<$implClassName> >(V8ClassIndex::$classIndex, info.Holder());\n");
+ push(@implContentDecls, " V8SVGPODTypeWrapper<$implClassName>* wrapper = V8DOMWrapper::convertToNativeObject<V8SVGPODTypeWrapper<$implClassName> >(V8ClassIndex::$classIndex, info.Holder());\n");
push(@implContentDecls, " $implClassName imp_instance = *wrapper;\n");
push(@implContentDecls, " $implClassName* imp = &imp_instance;\n");
} elsif ($attrExt->{"v8OnProto"}) {
# perform lookup first
push(@implContentDecls, <<END);
- v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
if (holder.IsEmpty()) return v8::Undefined();
END
HolderToNative($dataNode, $implClassName, $classIndex);
@@ -795,7 +795,7 @@ sub GenerateFunctionCallback
if (IsPodType($implClassName)) {
my $nativeClassName = GetNativeType($implClassName);
- push(@implContentDecls, " V8SVGPODTypeWrapper<$nativeClassName>* imp_wrapper = V8Proxy::convertToNativeObject<V8SVGPODTypeWrapper<$nativeClassName> >(V8ClassIndex::$classIndex, args.Holder());\n");
+ push(@implContentDecls, " V8SVGPODTypeWrapper<$nativeClassName>* imp_wrapper = V8DOMWrapper::convertToNativeObject<V8SVGPODTypeWrapper<$nativeClassName> >(V8ClassIndex::$classIndex, args.Holder());\n");
push(@implContentDecls, " $nativeClassName imp_instance = *imp_wrapper;\n");
push(@implContentDecls, " $nativeClassName* imp = &imp_instance;\n");
} else {
@@ -1053,7 +1053,7 @@ sub GenerateImplementation
push(@implFixedHeader,
"#include \"config.h\"\n" .
"#include \"V8Proxy.h\"\n" .
- "#include \"v8_binding.h\"\n\n" .
+ "#include \"V8Binding.h\"\n\n" .
"#undef LOG\n\n");
my $conditionalString;
@@ -1174,7 +1174,7 @@ sub GenerateImplementation
my $has_attributes = 0;
if (@$attributes) {
$has_attributes = 1;
- push(@implContent, "static const BatchedAttribute attrs[] = {\n");
+ push(@implContent, "static const BatchedAttribute ${interfaceName}_attrs[] = {\n");
GenerateBatchedAttributeData($interfaceName, $attributes);
push(@implContent, "};\n");
}
@@ -1183,7 +1183,7 @@ sub GenerateImplementation
my $has_constants = 0;
if (@{$dataNode->constants}) {
$has_constants = 1;
- push(@implContent, "static const BatchedConstant consts[] = {\n");
+ push(@implContent, "static const BatchedConstant ${interfaceName}_consts[] = {\n");
}
foreach my $constant (@{$dataNode->constants}) {
my $name = $constant->name;
@@ -1234,7 +1234,7 @@ END
# Set up our attributes if we have them
if ($has_attributes) {
push(@implContent, <<END);
- batchConfigureAttributes(instance, proto, attrs, sizeof(attrs)/sizeof(*attrs));
+ batchConfigureAttributes(instance, proto, ${interfaceName}_attrs, sizeof(${interfaceName}_attrs)/sizeof(*${interfaceName}_attrs));
END
}
@@ -1319,7 +1319,7 @@ END
if ($parent eq "EventTarget") { next; }
$implIncludes{"V8${parent}.h"} = 1;
my $parentClassIndex = uc($codeGenerator->StripModule($parent));
- push(@implContent, " desc->Inherit(V8Proxy::getTemplate(V8ClassIndex::${parentClassIndex}));\n");
+ push(@implContent, " desc->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::${parentClassIndex}));\n");
last;
}
@@ -1328,7 +1328,7 @@ END
if ($has_constants) {
push(@implContent, <<END);
- batchConfigureConstants(desc, proto, consts, sizeof(consts)/sizeof(*consts));
+ batchConfigureConstants(desc, proto, ${interfaceName}_consts, sizeof(${interfaceName}_consts)/sizeof(*${interfaceName}_consts));
END
}
@@ -1482,7 +1482,7 @@ sub GenerateFunctionCallString()
}
$result .= $indent . "if (success)\n";
$result .= $indent . " " .
- "return V8Proxy::convertNodeToV8Object($nodeToReturn);\n";
+ "return V8DOMWrapper::convertNodeToV8Object($nodeToReturn);\n";
$result .= $indent . "return v8::Null();\n";
return $result;
} elsif ($returnType eq "void") {
@@ -1547,9 +1547,9 @@ sub GenerateFunctionCallString()
if ($returnsPodType) {
my $classIndex = uc($returnType);
- $result .= $indent . "return V8Proxy::convertToV8Object(V8ClassIndex::$classIndex, wrapper);\n";
+ $result .= $indent . "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper);\n";
} else {
- $result .= $indent . "return " . NativeToJSValue($function->signature, $return) . ";\n";
+ $result .= $indent . ReturnNativeToJSValue($function->signature, $return, $indent) . ";\n";
}
return $result;
@@ -1560,7 +1560,7 @@ sub GenerateFunctionCallString()
sub GetClassName
{
my $type = shift;
- return "HTMLCollection" if $type eq "UndetectableHTMLCollection";
+ return "HTMLCollection" if $type eq "HTMLAllCollection";
return $type;
}
@@ -1799,19 +1799,19 @@ sub JSValueToNative
return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $type eq "double";
return "$value->NumberValue()" if $type eq "SVGNumber";
- return "ToInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short" or $type eq "long";
+ return "toInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short" or $type eq "long";
return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow";
return "static_cast<SVGPaint::SVGPaintType>($value->ToInt32()->Int32Value())" if $type eq "SVGPaintType";
- return "ToWebCoreString($value)" if $type eq "AtomicString" or $type eq "DOMUserData";
+ return "toWebCoreString($value)" if $type eq "AtomicString" or $type eq "DOMUserData";
if ($type eq "DOMString") {
- return "valueToStringWithNullCheck($value)" if $signature->extendedAttributes->{"ConvertNullToNullString"};
- return "valueToStringWithNullOrUndefinedCheck($value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"};
- return "ToWebCoreString($value)";
+ return "toWebCoreStringWithNullCheck($value)" if $signature->extendedAttributes->{"ConvertNullToNullString"};
+ return "toWebCoreStringWithNullOrUndefinedCheck($value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"};
+ return "toWebCoreString($value)";
}
if ($type eq "NodeFilter") {
- return "V8Proxy::wrapNativeNodeFilter($value)";
+ return "V8DOMWrapper::wrapNativeNodeFilter($value)";
}
if ($type eq "SVGRect") {
@@ -1828,7 +1828,7 @@ sub JSValueToNative
$implIncludes{"V8Node.h"} = 1;
# EventTarget is not in DOM hierarchy, but all Nodes are EventTarget.
- return "V8Node::HasInstance($value) ? V8Proxy::convertDOMWrapperToNode<Node>($value) : 0";
+ return "V8Node::HasInstance($value) ? V8DOMWrapper::convertDOMWrapperToNode<Node>($value) : 0";
}
AddIncludesForType($type);
@@ -1839,7 +1839,7 @@ sub JSValueToNative
# Perform type checks on the parameter, if it is expected Node type,
# return NULL.
- return "V8${type}::HasInstance($value) ? V8Proxy::convertDOMWrapperToNode<${type}>($value) : 0";
+ return "V8${type}::HasInstance($value) ? V8DOMWrapper::convertDOMWrapperToNode<${type}>($value) : 0";
} else {
# TODO: Temporary to avoid Window name conflict.
my $classIndex = uc($type);
@@ -1851,14 +1851,14 @@ sub JSValueToNative
my $nativeType = GetNativeType($type);
$implIncludes{"V8SVGPODTypeWrapper.h"} = 1;
- return "V8SVGPODTypeUtil::ToSVGPODType<${nativeType}>(V8ClassIndex::${classIndex}, $value${maybeOkParam})"
+ return "V8SVGPODTypeUtil::toSVGPODType<${nativeType}>(V8ClassIndex::${classIndex}, $value${maybeOkParam})"
}
$implIncludes{"V8${type}.h"} = 1;
# Perform type checks on the parameter, if it is expected Node type,
# return NULL.
- return "V8${type}::HasInstance($value) ? V8Proxy::convertToNativeObject<${implClassName}>(V8ClassIndex::${classIndex}, $value) : 0";
+ return "V8${type}::HasInstance($value) ? V8DOMWrapper::convertToNativeObject<${implClassName}>(V8ClassIndex::${classIndex}, $value) : 0";
}
}
@@ -1976,33 +1976,34 @@ sub IsDOMNodeType
}
-sub NativeToJSValue
+sub ReturnNativeToJSValue
{
my $signature = shift;
my $value = shift;
+ my $indent = shift;
my $type = $codeGenerator->StripModule($signature->type);
my $className= "V8$type";
- return "v8::Date::New(static_cast<double>($value))" if $type eq "DOMTimeStamp";
- return "$value ? v8::True() : v8::False()" if $type eq "boolean";
- return "v8::Undefined()" if $type eq "void";
+ return "return v8::Date::New(static_cast<double>($value))" if $type eq "DOMTimeStamp";
+ return "return $value ? v8::True() : v8::False()" if $type eq "boolean";
+ return "return v8::Undefined()" if $type eq "void";
# For all the types where we use 'int' as the representation type,
# we use Integer::New which has a fast Smi conversion check.
- return "v8::Integer::New($value)" if GetNativeType($type) eq "int";
+ return "return v8::Integer::New($value)" if GetNativeType($type) eq "int";
- return "v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType";
+ return "return v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType";
if ($codeGenerator->IsStringType($type)) {
my $conv = $signature->extendedAttributes->{"ConvertNullStringTo"};
if (defined $conv) {
- return "v8StringOrNull($value)" if $conv eq "Null";
- return "v8StringOrUndefined($value)" if $conv eq "Undefined";
- return "v8StringOrFalse($value)" if $conv eq "False";
+ return "return v8StringOrNull($value)" if $conv eq "Null";
+ return "return v8StringOrUndefined($value)" if $conv eq "Undefined";
+ return "return v8StringOrFalse($value)" if $conv eq "False";
die "Unknown value for ConvertNullStringTo extended attribute";
}
- return "v8String($value)";
+ return "return v8String($value)";
}
# V8 specific.
@@ -2012,30 +2013,32 @@ sub NativeToJSValue
# special case for non-DOM node interfaces
if (IsDOMNodeType($type)) {
- return "V8Proxy::convertNodeToV8Object($value)";
+ return "return V8DOMWrapper::convertNodeToV8Object($value)";
}
if ($type eq "EventTarget" or $type eq "SVGElementInstance") {
- return "V8Proxy::convertEventTargetToV8Object($value)";
+ return "return V8DOMWrapper::convertEventTargetToV8Object($value)";
}
if ($type eq "Event") {
- return "V8Proxy::convertEventToV8Object($value)";
+ return "return V8DOMWrapper::convertEventToV8Object($value)";
}
if ($type eq "EventListener") {
- return "V8Proxy::convertEventListenerToV8Object($value)";
+ return "return V8DOMWrapper::convertEventListenerToV8Object($value)";
}
if ($type eq "RGBColor") {
- return "V8Proxy::convertToV8Object(V8ClassIndex::RGBCOLOR, new RGBColor($value))";
+ my $construct = "RefPtr<RGBColor> rgbcolor = RGBColor::create($value);\n";
+ my $convert = "V8DOMWrapper::convertToV8Object(V8ClassIndex::RGBCOLOR, WTF::getPtr(rgbcolor))";
+ return $construct . $indent . "return " . $convert;
}
if ($type eq "WorkerContext" or $type eq "WorkerLocation" or $type eq "WorkerNavigator") {
$implIncludes{"WorkerContextExecutionProxy.h"} = 1;
my $classIndex = uc($type);
- return "WorkerContextExecutionProxy::ToV8Object(V8ClassIndex::$classIndex, $value)";
+ return "return WorkerContextExecutionProxy::ToV8Object(V8ClassIndex::$classIndex, $value)";
}
else {
@@ -2047,7 +2050,7 @@ sub NativeToJSValue
$value = GenerateSVGStaticPodTypeWrapper($type, $value);
}
- return "V8Proxy::convertToV8Object(V8ClassIndex::$classIndex, $value)";
+ return "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, $value)";
}
}
diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp
index 60cf16f..3ea8bcf 100644
--- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp
@@ -74,7 +74,7 @@ private:
const ClassInfo QtRuntimeObjectImp::s_info = { "QtRuntimeObject", &RuntimeObjectImp::s_info, 0, 0 };
QtRuntimeObjectImp::QtRuntimeObjectImp(ExecState* exec, PassRefPtr<Instance> instance)
- : RuntimeObjectImp(exec, WebCore::getDOMStructure<QtRuntimeObjectImp>(exec), instance)
+ : RuntimeObjectImp(exec, WebCore::deprecatedGetDOMStructure<QtRuntimeObjectImp>(exec), instance)
{
}
diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp
index 161e570..aabd677 100644
--- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp
@@ -907,7 +907,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con
const ClassInfo QtRuntimeMethod::s_info = { "QtRuntimeMethod", 0, 0, 0 };
QtRuntimeMethod::QtRuntimeMethod(QtRuntimeMethodData* dd, ExecState* exec, const Identifier& ident, PassRefPtr<QtInstance> inst)
- : InternalFunction(&exec->globalData(), getDOMStructure<QtRuntimeMethod>(exec), ident)
+ : InternalFunction(&exec->globalData(), deprecatedGetDOMStructure<QtRuntimeMethod>(exec), ident)
, d_ptr(dd)
{
QW_D(QtRuntimeMethod);
diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp
index fead83a..2849822 100644
--- a/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp
@@ -36,9 +36,11 @@ namespace JSC {
const ClassInfo RuntimeArray::s_info = { "RuntimeArray", &JSArray::info, 0, 0 };
-RuntimeArray::RuntimeArray(ExecState* exec, Bindings::Array* a)
- : JSObject(getDOMStructure<RuntimeArray>(exec))
- , _array(a)
+RuntimeArray::RuntimeArray(ExecState* exec, Bindings::Array* array)
+ // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+ // We need to pass in the right global object for "array".
+ : JSObject(deprecatedGetDOMStructure<RuntimeArray>(exec))
+ , _array(array)
{
}
diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_method.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_method.cpp
index 30a3581..0af0af5 100644
--- a/src/3rdparty/webkit/WebCore/bridge/runtime_method.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/runtime_method.cpp
@@ -41,8 +41,11 @@ ASSERT_CLASS_FITS_IN_CELL(RuntimeMethod);
const ClassInfo RuntimeMethod::s_info = { "RuntimeMethod", 0, 0, 0 };
-RuntimeMethod::RuntimeMethod(ExecState* exec, const Identifier& ident, Bindings::MethodList& m)
- : InternalFunction(&exec->globalData(), getDOMStructure<RuntimeMethod>(exec), ident)
+RuntimeMethod::RuntimeMethod(ExecState* exec, const Identifier& ident, Bindings::MethodList& m)
+ // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+ // exec-globalData() is also likely wrong.
+ // Callers will need to pass in the right global object corresponding to this native object "m".
+ : InternalFunction(&exec->globalData(), deprecatedGetDOMStructure<RuntimeMethod>(exec), ident)
, _methodList(new MethodList(m))
{
}
diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp
index 79afd3f..385f914 100644
--- a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp
@@ -41,7 +41,9 @@ using namespace Bindings;
const ClassInfo RuntimeObjectImp::s_info = { "RuntimeObject", 0, 0, 0 };
RuntimeObjectImp::RuntimeObjectImp(ExecState* exec, PassRefPtr<Instance> i)
- : JSObject(getDOMStructure<RuntimeObjectImp>(exec))
+ // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+ // We need to pass in the right global object for "i".
+ : JSObject(deprecatedGetDOMStructure<RuntimeObjectImp>(exec))
, instance(i)
{
instance->rootObject()->addRuntimeObject(this);
diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_root.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_root.cpp
index 8e00fd5..0e9bf74 100644
--- a/src/3rdparty/webkit/WebCore/bridge/runtime_root.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/runtime_root.cpp
@@ -22,6 +22,7 @@
* (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 "runtime_root.h"
diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_root.h b/src/3rdparty/webkit/WebCore/bridge/runtime_root.h
index 0d6fdbd..eacbb57 100644
--- a/src/3rdparty/webkit/WebCore/bridge/runtime_root.h
+++ b/src/3rdparty/webkit/WebCore/bridge/runtime_root.h
@@ -86,4 +86,4 @@ private:
} // namespace JSC
-#endif
+#endif // RUNTIME_ROOT_H_
diff --git a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp
index 2e8f3bb..b49b646 100644
--- a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp
+++ b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp
@@ -347,7 +347,7 @@ bool CSSParser::parseMediaQuery(MediaList* queries, const String& string)
m_mediaQuery = 0;
// can't use { because tokenizer state switches from mediaquery to initial state when it sees { token.
// instead insert one " " (which is WHITESPACE in CSSGrammar.y)
- setupParser ("@-webkit-mediaquery ", string, "} ");
+ setupParser("@-webkit-mediaquery ", string, "} ");
cssyyparse(this);
bool ok = false;
@@ -408,7 +408,7 @@ bool CSSParser::validUnit(CSSParserValue* value, Units unitflags, bool strict)
return false;
bool b = false;
- switch(value->unit) {
+ switch (value->unit) {
case CSSPrimitiveValue::CSS_NUMBER:
b = (unitflags & FNumber);
if (!b && ((unitflags & (FLength | FAngle | FTime)) && (value->fValue == 0 || !strict))) {
@@ -1049,7 +1049,7 @@ bool CSSParser::parseValue(int propId, bool important)
} else {
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
bool is_valid = true;
- while(is_valid && value) {
+ while (is_valid && value) {
switch (value->id) {
case CSSValueBlink:
break;
@@ -1317,7 +1317,8 @@ bool CSSParser::parseValue(int propId, bool important)
if (id == CSSValueNone)
valid_primitive = true;
else {
- if (validUnit(value, FNumber|FNonNeg, m_strict)) {
+ // Accepting valueless numbers is a quirk of the -webkit prefixed version of the property.
+ if (validUnit(value, FNumber|FLength|FNonNeg, m_strict)) {
RefPtr<CSSValue> val = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
if (val) {
addProperty(propId, val.release(), important);
@@ -2576,7 +2577,7 @@ bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result)
#define DASHBOARD_REGION_NUM_PARAMETERS 6
#define DASHBOARD_REGION_SHORT_NUM_PARAMETERS 2
-static CSSParserValue* skipCommaInDashboardRegion (CSSParserValueList *args)
+static CSSParserValue* skipCommaInDashboardRegion(CSSParserValueList *args)
{
if (args->size() == (DASHBOARD_REGION_NUM_PARAMETERS*2-1) ||
args->size() == (DASHBOARD_REGION_SHORT_NUM_PARAMETERS*2-1)) {
@@ -2631,7 +2632,7 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
int numArgs = args->size();
if ((numArgs != DASHBOARD_REGION_NUM_PARAMETERS && numArgs != (DASHBOARD_REGION_NUM_PARAMETERS*2-1)) &&
- (numArgs != DASHBOARD_REGION_SHORT_NUM_PARAMETERS && numArgs != (DASHBOARD_REGION_SHORT_NUM_PARAMETERS*2-1))){
+ (numArgs != DASHBOARD_REGION_SHORT_NUM_PARAMETERS && numArgs != (DASHBOARD_REGION_SHORT_NUM_PARAMETERS*2-1))) {
valid = false;
break;
}
@@ -2647,7 +2648,7 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
// Second arg is a type.
arg = args->next();
- arg = skipCommaInDashboardRegion (args);
+ arg = skipCommaInDashboardRegion(args);
if (arg->unit != CSSPrimitiveValue::CSS_IDENT) {
valid = false;
break;
@@ -2677,7 +2678,7 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
int i;
for (i = 0; i < 4; i++) {
arg = args->next();
- arg = skipCommaInDashboardRegion (args);
+ arg = skipCommaInDashboardRegion(args);
valid = arg->id == CSSValueAuto || validUnit(arg, FLength, m_strict);
if (!valid)
@@ -3438,7 +3439,8 @@ struct ShadowParseContext {
bool allowLength() { return allowX || allowY || allowBlur; }
- void commitValue() {
+ void commitValue()
+ {
// Handle the ,, case gracefully by doing nothing.
if (x || y || blur || color) {
if (!values)
@@ -3454,7 +3456,8 @@ struct ShadowParseContext {
allowY = allowBlur = false;
}
- void commitLength(CSSParserValue* v) {
+ void commitLength(CSSParserValue* v)
+ {
RefPtr<CSSPrimitiveValue> val = CSSPrimitiveValue::create(v->fValue, (CSSPrimitiveValue::UnitTypes)v->unit);
if (allowX) {
@@ -3471,7 +3474,8 @@ struct ShadowParseContext {
}
}
- void commitColor(PassRefPtr<CSSPrimitiveValue> val) {
+ void commitColor(PassRefPtr<CSSPrimitiveValue> val)
+ {
color = val;
allowColor = false;
if (allowX)
@@ -3603,8 +3607,7 @@ bool CSSParser::parseReflect(int propId, bool important)
return true;
}
-struct BorderImageParseContext
-{
+struct BorderImageParseContext {
BorderImageParseContext()
: m_allowBreak(false)
, m_allowNumber(false)
@@ -3626,7 +3629,8 @@ struct BorderImageParseContext
bool allowRule() const { return m_allowRule; }
void commitImage(PassRefPtr<CSSValue> image) { m_image = image; m_allowNumber = true; }
- void commitNumber(CSSParserValue* v) {
+ void commitNumber(CSSParserValue* v)
+ {
PassRefPtr<CSSPrimitiveValue> val = CSSPrimitiveValue::create(v->fValue, (CSSPrimitiveValue::UnitTypes)v->unit);
if (!m_top)
m_top = val;
@@ -3643,7 +3647,8 @@ struct BorderImageParseContext
m_allowNumber = !m_left;
}
void commitSlash() { m_allowBreak = m_allowSlash = m_allowNumber = false; m_allowWidth = true; }
- void commitWidth(CSSParserValue* val) {
+ void commitWidth(CSSParserValue* val)
+ {
if (!m_borderTop)
m_borderTop = val;
else if (!m_borderRight)
@@ -3658,14 +3663,16 @@ struct BorderImageParseContext
m_allowBreak = m_allowRule = true;
m_allowWidth = !m_borderLeft;
}
- void commitRule(int keyword) {
+ void commitRule(int keyword)
+ {
if (!m_horizontalRule)
m_horizontalRule = keyword;
else if (!m_verticalRule)
m_verticalRule = keyword;
m_allowRule = !m_verticalRule;
}
- PassRefPtr<CSSValue> commitBorderImage(CSSParser* p, bool important) {
+ PassRefPtr<CSSValue> commitBorderImage(CSSParser* p, bool important)
+ {
// We need to clone and repeat values for any omissions.
if (!m_right) {
m_right = CSSPrimitiveValue::create(m_top->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_top->primitiveType());
@@ -4291,7 +4298,7 @@ int CSSParser::lex(void* yylvalWithoutType)
int length;
UChar* t = text(&length);
- switch(token) {
+ switch (token) {
case WHITESPACE:
case SGML_CD:
case INCLUDES:
@@ -4374,7 +4381,7 @@ UChar* CSSParser::text(int *length)
{
UChar* start = yytext;
int l = yyleng;
- switch(yyTok) {
+ switch (yyTok) {
case STRING:
l--;
/* nobreak */
diff --git a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h
index fd1d203..1dd2a2d 100644
--- a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h
+++ b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h
@@ -215,14 +215,20 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
case MediaSeekForwardButtonPart:
m_value.ident = CSSValueMediaSeekForwardButton;
break;
+ case MediaRewindButtonPart:
+ m_value.ident = CSSValueMediaRewindButton;
+ break;
+ case MediaReturnToRealtimeButtonPart:
+ m_value.ident = CSSValueMediaReturnToRealtimeButton;
+ break;
case MediaSliderPart:
m_value.ident = CSSValueMediaSlider;
break;
case MediaSliderThumbPart:
m_value.ident = CSSValueMediaSliderthumb;
break;
- case MediaTimelineContainerPart:
- m_value.ident = CSSValueMediaTimelineContainer;
+ case MediaControlsBackgroundPart:
+ m_value.ident = CSSValueMediaControlsBackground;
break;
case MediaCurrentTimePart:
m_value.ident = CSSValueMediaCurrentTimeDisplay;
diff --git a/src/3rdparty/webkit/WebCore/css/CSSRule.idl b/src/3rdparty/webkit/WebCore/css/CSSRule.idl
index f13f293..bc57e55 100644
--- a/src/3rdparty/webkit/WebCore/css/CSSRule.idl
+++ b/src/3rdparty/webkit/WebCore/css/CSSRule.idl
@@ -22,6 +22,7 @@ module css {
// Introduced in DOM Level 2:
interface [
+ CustomToJS,
GenerateConstructor,
Polymorphic,
InterfaceUUID=548139b4-31ab-4978-b1d5-cfcfdfbaea0e,
diff --git a/src/3rdparty/webkit/WebCore/css/CSSSelector.cpp b/src/3rdparty/webkit/WebCore/css/CSSSelector.cpp
index 17fbd64..5429c16 100644
--- a/src/3rdparty/webkit/WebCore/css/CSSSelector.cpp
+++ b/src/3rdparty/webkit/WebCore/css/CSSSelector.cpp
@@ -107,6 +107,9 @@ void CSSSelector::extractPseudoType() const
DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeline, ("-webkit-media-controls-timeline"));
DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekBackButton, ("-webkit-media-controls-seek-back-button"));
DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekForwardButton, ("-webkit-media-controls-seek-forward-button"));
+ DEFINE_STATIC_LOCAL(AtomicString, mediaControlsRewindButton, ("-webkit-media-controls-rewind-button"));
+ DEFINE_STATIC_LOCAL(AtomicString, mediaControlsReturnToRealtimeButton, ("-webkit-media-controls-return-to-realtime-button"));
+ DEFINE_STATIC_LOCAL(AtomicString, mediaControlsStatusDisplay, ("-webkit-media-controls-status-display"));
DEFINE_STATIC_LOCAL(AtomicString, mediaControlsFullscreenButton, ("-webkit-media-controls-fullscreen-button"));
DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimelineContainer, ("-webkit-media-controls-timeline-container"));
DEFINE_STATIC_LOCAL(AtomicString, mediaControlsCurrentTimeDisplay, ("-webkit-media-controls-current-time-display"));
@@ -236,6 +239,15 @@ void CSSSelector::extractPseudoType() const
} else if (m_value == mediaControlsSeekForwardButton) {
m_pseudoType = PseudoMediaControlsSeekForwardButton;
element = true;
+ } else if (m_value == mediaControlsRewindButton) {
+ m_pseudoType = PseudoMediaControlsRewindButton;
+ element = true;
+ } else if (m_value == mediaControlsReturnToRealtimeButton) {
+ m_pseudoType = PseudoMediaControlsReturnToRealtimeButton;
+ element = true;
+ } else if (m_value == mediaControlsStatusDisplay) {
+ m_pseudoType = PseudoMediaControlsStatusDisplay;
+ element = true;
} else if (m_value == mediaControlsFullscreenButton) {
m_pseudoType = PseudoMediaControlsFullscreenButton;
element = true;
diff --git a/src/3rdparty/webkit/WebCore/css/CSSSelector.h b/src/3rdparty/webkit/WebCore/css/CSSSelector.h
index 728c34d..b24f057 100644
--- a/src/3rdparty/webkit/WebCore/css/CSSSelector.h
+++ b/src/3rdparty/webkit/WebCore/css/CSSSelector.h
@@ -173,6 +173,9 @@ namespace WebCore {
PseudoMediaControlsTimeline,
PseudoMediaControlsSeekBackButton,
PseudoMediaControlsSeekForwardButton,
+ PseudoMediaControlsRewindButton,
+ PseudoMediaControlsReturnToRealtimeButton,
+ PseudoMediaControlsStatusDisplay,
PseudoMediaControlsFullscreenButton
};
diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp
index ce4c343..d782d38 100644
--- a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp
+++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp
@@ -526,7 +526,7 @@ static void loadFullDefaultStyle()
}
// Strict-mode rules.
- String defaultRules = String(html4UserAgentStyleSheet, sizeof(html4UserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet();
+ String defaultRules = String(htmlUserAgentStyleSheet, sizeof(htmlUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet();
CSSStyleSheet* defaultSheet = parseUASheet(defaultRules);
defaultStyle->addRulesFromSheet(defaultSheet, screenEval());
defaultPrintStyle->addRulesFromSheet(defaultSheet, printEval());
@@ -1405,6 +1405,22 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
return m_style.release();
}
+#if ENABLE(DATAGRID)
+
+PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForDataGridColumn(DataGridColumn*, RenderStyle*)
+{
+ // FIXME: Implement
+ return 0;
+}
+
+PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForDataGridColumnHeader(DataGridColumn*, RenderStyle*)
+{
+ // FIXME: Implement
+ return 0;
+}
+
+#endif
+
static void addIntrinsicMargins(RenderStyle* style)
{
// Intrinsic margin value.
@@ -2481,6 +2497,15 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
case CSSSelector::PseudoMediaControlsSeekForwardButton:
dynamicPseudo = MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
return true;
+ case CSSSelector::PseudoMediaControlsRewindButton:
+ dynamicPseudo = MEDIA_CONTROLS_REWIND_BUTTON;
+ return true;
+ case CSSSelector::PseudoMediaControlsReturnToRealtimeButton:
+ dynamicPseudo = MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON;
+ return true;
+ case CSSSelector::PseudoMediaControlsStatusDisplay:
+ dynamicPseudo = MEDIA_CONTROLS_STATUS_DISPLAY;
+ return true;
case CSSSelector::PseudoMediaControlsFullscreenButton:
dynamicPseudo = MEDIA_CONTROLS_FULLSCREEN_BUTTON;
return true;
@@ -3413,7 +3438,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
}
int width = 0;
- if (primitiveValue && primitiveValue->getIdent() == CSSValueNormal){
+ if (primitiveValue && primitiveValue->getIdent() == CSSValueNormal) {
width = 0;
} else {
if (!primitiveValue)
@@ -4931,7 +4956,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
int type = primitiveValue->primitiveType();
if (CSSPrimitiveValue::isUnitTypeLength(type))
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
- else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
+ else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
l = Length(primitiveValue->getDoubleValue(), Percent);
else
return;
@@ -4961,10 +4986,17 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
m_style->setPerspective(0);
return;
}
-
- if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
+
+ float perspectiveValue;
+ int type = primitiveValue->primitiveType();
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
+ perspectiveValue = static_cast<float>(primitiveValue->computeLengthIntForLength(style(), zoomFactor));
+ else if (type == CSSPrimitiveValue::CSS_NUMBER) {
+ // For backward compatibility, treat valueless numbers as px.
+ perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLengthFloat(style(), zoomFactor);
+ } else
return;
- float perspectiveValue = static_cast<float>(primitiveValue->getDoubleValue());
+
if (perspectiveValue >= 0.0f)
m_style->setPerspective(perspectiveValue);
return;
@@ -4994,7 +5026,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
int type = primitiveValue->primitiveType();
if (CSSPrimitiveValue::isUnitTypeLength(type))
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
- else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
+ else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
l = Length(primitiveValue->getDoubleValue(), Percent);
else
return;
@@ -5718,7 +5750,7 @@ Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValue* primitiveV
} else if (ident == CSSValueWebkitActivelink)
col = m_element->document()->activeLinkColor();
else if (ident == CSSValueWebkitFocusRingColor)
- col = RenderTheme::defaultTheme()->focusRingColor();
+ col = RenderTheme::focusRingColor();
else if (ident == CSSValueCurrentcolor)
col = m_style->color();
else
diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h
index 8dd36d7..c9df876 100644
--- a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h
+++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h
@@ -50,6 +50,7 @@ class CSSStyleSheet;
class CSSValue;
class CSSVariableDependentValue;
class CSSVariablesRule;
+class DataGridColumn;
class Document;
class Element;
class Frame;
@@ -89,6 +90,12 @@ public:
PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0);
+#if ENABLE(DATAGRID)
+ // Datagrid style computation (uses unique pseudo elements and structures)
+ PassRefPtr<RenderStyle> pseudoStyleForDataGridColumn(DataGridColumn*, RenderStyle* parentStyle);
+ PassRefPtr<RenderStyle> pseudoStyleForDataGridColumnHeader(DataGridColumn*, RenderStyle* parentStyle);
+#endif
+
private:
RenderStyle* locateSharedStyle();
Node* locateCousinList(Element* parent, unsigned depth = 1);
diff --git a/src/3rdparty/webkit/WebCore/css/CSSValue.idl b/src/3rdparty/webkit/WebCore/css/CSSValue.idl
index 875d12e..ee82b0c 100644
--- a/src/3rdparty/webkit/WebCore/css/CSSValue.idl
+++ b/src/3rdparty/webkit/WebCore/css/CSSValue.idl
@@ -21,6 +21,7 @@
module css {
interface [
+ CustomToJS,
GenerateConstructor,
Polymorphic,
InterfaceUUID=9fd62a7b-539d-4500-bd6c-ec075abbc404,
diff --git a/src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in b/src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in
index 698dffe..dac7567 100644
--- a/src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in
+++ b/src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in
@@ -504,9 +504,11 @@ media-mute-button
media-play-button
media-seek-back-button
media-seek-forward-button
+media-rewind-button
+media-return-to-realtime-button
media-slider
media-sliderthumb
-media-timeline-container
+media-controls-background
media-current-time-display
media-time-remaining-display
menulist
diff --git a/src/3rdparty/webkit/WebCore/css/MediaList.cpp b/src/3rdparty/webkit/WebCore/css/MediaList.cpp
index 452345f..85cf590 100644
--- a/src/3rdparty/webkit/WebCore/css/MediaList.cpp
+++ b/src/3rdparty/webkit/WebCore/css/MediaList.cpp
@@ -139,7 +139,7 @@ void MediaList::deleteMedium(const String& oldMedium, ExceptionCode& ec)
ec = NOT_FOUND_ERR;
if (oldQuery) {
- for(size_t i = 0; i < m_queries.size(); ++i) {
+ for (size_t i = 0; i < m_queries.size(); ++i) {
MediaQuery* a = m_queries[i];
if (*a == *oldQuery) {
m_queries.remove(i);
diff --git a/src/3rdparty/webkit/WebCore/css/MediaQuery.h b/src/3rdparty/webkit/WebCore/css/MediaQuery.h
index 0aa0da1..ff22d9a 100644
--- a/src/3rdparty/webkit/WebCore/css/MediaQuery.h
+++ b/src/3rdparty/webkit/WebCore/css/MediaQuery.h
@@ -34,8 +34,7 @@
namespace WebCore {
class MediaQueryExp;
-class MediaQuery
-{
+class MediaQuery {
public:
enum Restrictor {
Only, Not, None
diff --git a/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp b/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp
index c641dfd..16af981 100644
--- a/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp
+++ b/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp
@@ -162,7 +162,7 @@ bool MediaQueryEvaluator::eval(const MediaList* mediaList, CSSStyleSelector* sty
static bool parseAspectRatio(CSSValue* value, int& h, int& v)
{
- if (value->isValueList()){
+ if (value->isValueList()) {
CSSValueList* valueList = static_cast<CSSValueList*>(value);
if (valueList->length() == 3) {
CSSValue* i0 = valueList->itemWithoutBoundsCheck(0);
diff --git a/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h b/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h
index 5ae8fec..404504b 100644
--- a/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h
+++ b/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h
@@ -49,8 +49,7 @@ class MediaQueryExp;
* the device characteristics are not known. This can be used to prune the loading
* of stylesheets to only those which are probable to match.
*/
-class MediaQueryEvaluator
-{
+class MediaQueryEvaluator {
public:
/** Creates evaluator which evaluates only simple media queries
* Evaluator returns true for "all", and returns value of \mediaFeatureResult
diff --git a/src/3rdparty/webkit/WebCore/css/MediaQueryExp.h b/src/3rdparty/webkit/WebCore/css/MediaQueryExp.h
index 3036d04..5ff4af3 100644
--- a/src/3rdparty/webkit/WebCore/css/MediaQueryExp.h
+++ b/src/3rdparty/webkit/WebCore/css/MediaQueryExp.h
@@ -36,8 +36,7 @@
namespace WebCore {
class CSSParserValueList;
-class MediaQueryExp
-{
+class MediaQueryExp {
public:
MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueList* values);
~MediaQueryExp();
@@ -46,7 +45,8 @@ public:
CSSValue* value() const { return m_value.get(); }
- bool operator==(const MediaQueryExp& other) const {
+ bool operator==(const MediaQueryExp& other) const
+ {
return (other.m_mediaFeature == m_mediaFeature)
&& ((!other.m_value && !m_value)
|| (other.m_value && m_value && other.m_value->cssText() == m_value->cssText()));
diff --git a/src/3rdparty/webkit/WebCore/css/StyleSheet.idl b/src/3rdparty/webkit/WebCore/css/StyleSheet.idl
index 3a26f20..e4f4090 100644
--- a/src/3rdparty/webkit/WebCore/css/StyleSheet.idl
+++ b/src/3rdparty/webkit/WebCore/css/StyleSheet.idl
@@ -23,6 +23,7 @@ module stylesheets {
// Introduced in DOM Level 2:
interface [
CustomMarkFunction,
+ CustomToJS,
GenerateConstructor,
Polymorphic,
InterfaceUUID=2bd2db5f-aaab-4422-96a0-e05455313f35,
diff --git a/src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.h b/src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.h
index 67ba113..56bf76b 100644
--- a/src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.h
+++ b/src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.h
@@ -149,7 +149,7 @@ protected:
WebKitCSSMatrix();
WebKitCSSMatrix(const WebKitCSSMatrix&);
WebKitCSSMatrix(const TransformationMatrix&);
- WebKitCSSMatrix(const String&, ExceptionCode& );
+ WebKitCSSMatrix(const String&, ExceptionCode&);
TransformationMatrix m_matrix;
};
diff --git a/src/3rdparty/webkit/WebCore/css/html4.css b/src/3rdparty/webkit/WebCore/css/html.css
index dc1f608..8dad349 100644
--- a/src/3rdparty/webkit/WebCore/css/html4.css
+++ b/src/3rdparty/webkit/WebCore/css/html.css
@@ -610,8 +610,4 @@ iframe {
border: 2px inset
}
-img, input[type=image], video, iframe, object, embed, applet {
- overflow: hidden; /* Default to overflow:hidden so that border-radius clipping works on the foreground of these elements. */
-}
-
/* noscript is handled internally, as it depends on settings */
diff --git a/src/3rdparty/webkit/WebCore/css/mediaControls.css b/src/3rdparty/webkit/WebCore/css/mediaControls.css
index 668458c..f9694f8 100644
--- a/src/3rdparty/webkit/WebCore/css/mediaControls.css
+++ b/src/3rdparty/webkit/WebCore/css/mediaControls.css
@@ -32,6 +32,7 @@ audio {
audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
display: -webkit-box;
-webkit-box-orient: horizontal;
+ -webkit-box-align: center;
-webkit-user-select: none;
position: absolute;
bottom: 0;
@@ -61,7 +62,7 @@ audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-bu
}
audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container {
- -webkit-appearance: media-timeline-container;
+ -webkit-appearance: media-controls-background;
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-align: center;
@@ -102,6 +103,16 @@ audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls
}
audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
+ -webkit-appearance: media-fullscreen-button;
+ display: -webkit-box;
+ width: 16px;
+ height: 16px;
+}
+
+audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button {
display: none;
}
+audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button {
+ display: none;
+}
diff --git a/src/3rdparty/webkit/WebCore/css/mediaControlsQT.css b/src/3rdparty/webkit/WebCore/css/mediaControlsQT.css
index 900dcf2..a9b7a5f 100644
--- a/src/3rdparty/webkit/WebCore/css/mediaControlsQT.css
+++ b/src/3rdparty/webkit/WebCore/css/mediaControlsQT.css
@@ -31,6 +31,7 @@ audio {
audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
/* In mediaControls.css */
+ -webkit-appearance: media-controls-background;
height: 25px;
}
@@ -39,50 +40,83 @@ video:-webkit-full-page-media::-webkit-media-controls-panel {
}
audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
- -webkit-box-ordinal-group: 2; /* At the end of the controller bar */
- width: 30px;
- height: 25px;
+ -webkit-box-ordinal-group: 2; /* Before the fullscreen button */
+ width: 15px;
+ height: 14px;
+ margin-left: 2px;
+ margin-right: 8px;
}
audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
- width: 30px;
- height: 25px;
+ width: 16px;
+ height: 16px;
+ margin-left: 6px;
+ margin-right: 1px;
}
audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container {
- height: 25px;
+ -webkit-appearance: none;
+ -webkit-box-orient: horizontal;
+ -webkit-box-align: center;
+ -webkit-box-pack: center;
+ -webkit-box-flex: 1;
+ text-align: right;
+ height: auto;
}
audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display {
- -webkit-appearance: media-current-time-display;
-webkit-user-select: none;
- display: inline-block;
+ display: -webkit-box;
+ -webkit-box-flex: 0;
+ -webkit-box-pack: center;
+ -webkit-box-align: center;
cursor: default;
font: -webkit-small-control;
- font-size: .09em;
- text-align: center;
+ font-size: 9px;
overflow: hidden;
- line-height: 13px;
- height: 14px;
+ height: 13px;
width: 45px;
+ color: white;
+ text-shadow: black 0px 1px 1px;
+
+ letter-spacing: normal;
+ word-spacing: normal;
+ line-height: normal;
+ text-transform: none;
+ text-indent: 0;
+ text-decoration: none;
}
audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display {
- -webkit-appearance: media-time-remaining-display;
-webkit-user-select: none;
- display: inline-block;
+ display: -webkit-box;
+ -webkit-box-flex: 0;
+ -webkit-box-pack: center;
+ -webkit-box-align: center;
cursor: default;
font: -webkit-small-control;
- font-size: .09em;
- text-align: center;
+ font-size: 9px;
overflow: hidden;
- line-height: 13px;
- height: 14px;
+ height: 13px;
width: 45px;
+ color: white;
+ text-shadow: black 0px 1px 1px;
+
+ letter-spacing: normal;
+ word-spacing: normal;
+ line-height: normal;
+ text-transform: none;
+ text-indent: 0;
+ text-decoration: none;
}
audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
+ display: -webkit-box;
+ -webkit-box-flex: 1;
height: 13px;
+ padding: 0px;
+ margin: 0px;
+ margin-top: 4px;
}
audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button {
@@ -96,5 +130,50 @@ audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls
}
audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
+ width: 16px;
+ height: 16px;
+ margin-left: 7px;
+ margin-right: 7px;
+ -webkit-box-ordinal-group: 3; /* At the very end */
+}
+
+audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button {
+ display: -webkit-box;
+ -webkit-appearance: media-rewind-button;
+ width: 18px;
+ height: 18px;
+ margin-bottom: 1px;
+ margin-left: 6px;
+ margin-right: 2px;
+}
+
+audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button {
display: none;
+ -webkit-appearance: media-return-to-realtime-button;
+ width: 16px;
+ height: 11px;
+ margin-left: 6px;
+ margin-right: 2px;
+}
+
+audio::-webkit-media-controls-status-display, video::-webkit-media-controls-status-display {
+ -webkit-user-select: none;
+ cursor: default;
+ display: -webkit-box;
+ -webkit-box-flex: 1;
+ font: -webkit-small-control;
+ color: white;
+ font-size: 10px;
+ line-height: 13px;
+ overflow: hidden;
+ text-shadow: black 0px 1px 1px;
+ margin-left: 10px;
+ margin-right: 10px;
+
+ letter-spacing: normal;
+ word-spacing: normal;
+ line-height: normal;
+ text-transform: none;
+ text-indent: 0;
+ text-decoration: none;
}
diff --git a/src/3rdparty/webkit/WebCore/css/themeWin.css b/src/3rdparty/webkit/WebCore/css/themeWin.css
index 421fed0..a0170ac 100644
--- a/src/3rdparty/webkit/WebCore/css/themeWin.css
+++ b/src/3rdparty/webkit/WebCore/css/themeWin.css
@@ -29,7 +29,7 @@
*/
/* These styles override the default styling for HTML elements as defined in
- WebCore/css/html4.css. So far we have used this file exclusively for
+ WebCore/css/html.css. So far we have used this file exclusively for
making our form elements match Firefox's. */
input:not([type]),
diff --git a/src/3rdparty/webkit/WebCore/dom/Comment.h b/src/3rdparty/webkit/WebCore/dom/Comment.h
index f5f1810..d00ba62 100644
--- a/src/3rdparty/webkit/WebCore/dom/Comment.h
+++ b/src/3rdparty/webkit/WebCore/dom/Comment.h
@@ -29,8 +29,7 @@
namespace WebCore {
-class Comment : public CharacterData
-{
+class Comment : public CharacterData {
public:
Comment(Document*, const String &_text);
Comment(Document*);
diff --git a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp
index 20cc7a3..2d79156 100644
--- a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp
@@ -600,6 +600,8 @@ void ContainerNode::insertedIntoDocument()
void ContainerNode::removedFromDocument()
{
Node::removedFromDocument();
+ if (document()->cssTarget() == this)
+ document()->setCSSTarget(0);
setInDocument(false);
removedFromTree(false);
for (Node* child = m_firstChild; child; child = child->nextSibling())
diff --git a/src/3rdparty/webkit/WebCore/dom/Document.cpp b/src/3rdparty/webkit/WebCore/dom/Document.cpp
index 3d01c80..3ee00ad 100644
--- a/src/3rdparty/webkit/WebCore/dom/Document.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/Document.cpp
@@ -1663,7 +1663,8 @@ void Document::implicitClose()
}
frame()->loader()->checkCallImplicitClose();
-
+ RenderObject* renderObject = renderer();
+
// We used to force a synchronous display and flush here. This really isn't
// necessary and can in fact be actively harmful if pages are loading at a rate of > 60fps
// (if your platform is syncing flushes and limiting them to 60fps).
@@ -1672,13 +1673,18 @@ void Document::implicitClose()
updateStyleIfNeeded();
// Always do a layout after loading if needed.
- if (view() && renderer() && (!renderer()->firstChild() || renderer()->needsLayout()))
+ if (view() && renderObject && (!renderObject->firstChild() || renderObject->needsLayout()))
view()->layout();
}
#if PLATFORM(MAC)
- if (f && renderer() && this == topDocument() && AXObjectCache::accessibilityEnabled())
- axObjectCache()->postNotification(renderer(), "AXLoadComplete", true);
+ if (f && renderObject && this == topDocument() && AXObjectCache::accessibilityEnabled())
+ // The AX cache may have been cleared at this point, but we need to make sure it contains an
+ // AX object to send the notification to. getOrCreate will make sure that an valid AX object
+ // exists in the cache (we ignore the return value because we don't need it here). This is
+ // only safe to call when a layout is not in progress, so it can not be used in postNotification.
+ axObjectCache()->getOrCreate(renderObject);
+ axObjectCache()->postNotification(renderObject, "AXLoadComplete", true);
#endif
#if ENABLE(SVG)
@@ -2598,7 +2604,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode)
else
view()->setFocus();
}
- }
+ }
#if PLATFORM(MAC) && !PLATFORM(CHROMIUM)
if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnabled())
@@ -4354,19 +4360,19 @@ void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl)
void Document::reportException(const String& errorMessage, int lineNumber, const String& sourceURL)
{
if (DOMWindow* window = domWindow())
- window->console()->addMessage(JSMessageSource, ErrorMessageLevel, errorMessage, lineNumber, sourceURL);
+ window->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, errorMessage, lineNumber, sourceURL);
}
-void Document::addMessage(MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+void Document::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
{
switch (destination) {
case InspectorControllerDestination:
if (page())
- page()->inspectorController()->addMessageToConsole(source, level, message, lineNumber, sourceURL);
+ page()->inspectorController()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL);
return;
case ConsoleDestination:
if (DOMWindow* window = domWindow())
- window->console()->addMessage(source, level, message, lineNumber, sourceURL);
+ window->console()->addMessage(source, type, level, message, lineNumber, sourceURL);
return;
}
ASSERT_NOT_REACHED();
diff --git a/src/3rdparty/webkit/WebCore/dom/Document.h b/src/3rdparty/webkit/WebCore/dom/Document.h
index 92865f4..82f0455 100644
--- a/src/3rdparty/webkit/WebCore/dom/Document.h
+++ b/src/3rdparty/webkit/WebCore/dom/Document.h
@@ -224,7 +224,7 @@ public:
}
virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&);
- PassRefPtr<DocumentFragment> createDocumentFragment ();
+ PassRefPtr<DocumentFragment> createDocumentFragment();
PassRefPtr<Text> createTextNode(const String& data);
PassRefPtr<Comment> createComment(const String& data);
PassRefPtr<CDATASection> createCDATASection(const String& data, ExceptionCode&);
@@ -403,7 +403,7 @@ public:
PassRefPtr<CSSStyleDeclaration> createCSSStyleDeclaration();
PassRefPtr<EditingText> createEditingTextNode(const String&);
- virtual void recalcStyle( StyleChange = NoChange );
+ virtual void recalcStyle(StyleChange = NoChange);
virtual void updateStyleIfNeeded();
void updateLayout();
void updateLayoutIgnorePendingStylesheets();
@@ -787,7 +787,7 @@ public:
void parseDNSPrefetchControlHeader(const String&);
virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
- virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+ virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
virtual void scriptImported(unsigned long, const String&);
virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously.
@@ -990,7 +990,7 @@ public:
void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; }
bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; }
bool hasDashboardRegions () const { return m_hasDashboardRegions; }
- void setHasDashboardRegions (bool f) { m_hasDashboardRegions = f; }
+ void setHasDashboardRegions(bool f) { m_hasDashboardRegions = f; }
const Vector<DashboardRegionValue>& dashboardRegions() const;
void setDashboardRegions(const Vector<DashboardRegionValue>&);
#endif
diff --git a/src/3rdparty/webkit/WebCore/dom/Document.idl b/src/3rdparty/webkit/WebCore/dom/Document.idl
index ac6dd0e..ad41057 100644
--- a/src/3rdparty/webkit/WebCore/dom/Document.idl
+++ b/src/3rdparty/webkit/WebCore/dom/Document.idl
@@ -21,8 +21,8 @@
module core {
interface [
+ CustomToJS,
GenerateConstructor,
- GenerateToJS,
GenerateNativeConverter,
CustomMarkFunction,
InlineGetOwnPropertySlot,
diff --git a/src/3rdparty/webkit/WebCore/dom/DocumentFragment.cpp b/src/3rdparty/webkit/WebCore/dom/DocumentFragment.cpp
index 40be64d..7a6174f 100644
--- a/src/3rdparty/webkit/WebCore/dom/DocumentFragment.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/DocumentFragment.cpp
@@ -34,7 +34,7 @@ DocumentFragment::DocumentFragment(Document *doc) : ContainerNode(doc)
String DocumentFragment::nodeName() const
{
- return "#document-fragment";
+ return "#document-fragment";
}
Node::NodeType DocumentFragment::nodeType() const
diff --git a/src/3rdparty/webkit/WebCore/dom/DocumentFragment.h b/src/3rdparty/webkit/WebCore/dom/DocumentFragment.h
index 33a62be..46d8ecd 100644
--- a/src/3rdparty/webkit/WebCore/dom/DocumentFragment.h
+++ b/src/3rdparty/webkit/WebCore/dom/DocumentFragment.h
@@ -30,8 +30,7 @@
namespace WebCore {
-class DocumentFragment : public ContainerNode
-{
+class DocumentFragment : public ContainerNode {
public:
DocumentFragment(Document*);
diff --git a/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp b/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp
index eeb9833..892a5e7 100644
--- a/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp
@@ -30,7 +30,7 @@ namespace WebCore {
DynamicNodeList::DynamicNodeList(PassRefPtr<Node> rootNode)
: m_rootNode(rootNode)
- , m_caches(new Caches)
+ , m_caches(Caches::create())
, m_ownsCaches(true)
{
m_rootNode->registerDynamicNodeList(this);
@@ -42,16 +42,11 @@ DynamicNodeList::DynamicNodeList(PassRefPtr<Node> rootNode, DynamicNodeList::Cac
, m_ownsCaches(false)
{
m_rootNode->registerDynamicNodeList(this);
- ++caches->refCount;
}
DynamicNodeList::~DynamicNodeList()
{
m_rootNode->unregisterDynamicNodeList(this);
- if (m_ownsCaches)
- delete m_caches;
- else
- --m_caches->refCount;
}
unsigned DynamicNodeList::length() const
@@ -158,10 +153,14 @@ DynamicNodeList::Caches::Caches()
: lastItem(0)
, isLengthCacheValid(false)
, isItemCacheValid(false)
- , refCount(0)
{
}
+PassRefPtr<DynamicNodeList::Caches> DynamicNodeList::Caches::create()
+{
+ return adoptRef(new Caches());
+}
+
void DynamicNodeList::Caches::reset()
{
lastItem = 0;
diff --git a/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.h b/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.h
index ee9832d..f97c38f 100644
--- a/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.h
+++ b/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.h
@@ -37,8 +37,8 @@ namespace WebCore {
class DynamicNodeList : public NodeList {
public:
- struct Caches {
- Caches();
+ struct Caches : RefCounted<Caches> {
+ static PassRefPtr<Caches> create();
void reset();
unsigned cachedLength;
@@ -46,7 +46,8 @@ namespace WebCore {
unsigned lastItemOffset;
bool isLengthCacheValid : 1;
bool isItemCacheValid : 1;
- unsigned refCount;
+ protected:
+ Caches();
};
virtual ~DynamicNodeList();
@@ -68,7 +69,7 @@ namespace WebCore {
virtual bool nodeMatches(Element*) const = 0;
RefPtr<Node> m_rootNode;
- mutable Caches* m_caches;
+ mutable RefPtr<Caches> m_caches;
bool m_ownsCaches;
private:
diff --git a/src/3rdparty/webkit/WebCore/dom/EditingText.h b/src/3rdparty/webkit/WebCore/dom/EditingText.h
index 3dcd8c1..e114786 100644
--- a/src/3rdparty/webkit/WebCore/dom/EditingText.h
+++ b/src/3rdparty/webkit/WebCore/dom/EditingText.h
@@ -29,8 +29,7 @@
namespace WebCore {
-class EditingText : public Text
-{
+class EditingText : public Text {
public:
EditingText(Document *impl, const String &text);
EditingText(Document *impl);
diff --git a/src/3rdparty/webkit/WebCore/dom/Element.cpp b/src/3rdparty/webkit/WebCore/dom/Element.cpp
index d858888..0e6c245 100644
--- a/src/3rdparty/webkit/WebCore/dom/Element.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/Element.cpp
@@ -761,6 +761,34 @@ void Element::detach()
ContainerNode::detach();
}
+bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle)
+{
+ ASSERT(currentStyle = renderStyle());
+
+ if (!renderer() || !currentStyle)
+ return false;
+
+ RenderStyle::PseudoStyleCache pseudoStyleCache;
+ currentStyle->getPseudoStyleCache(pseudoStyleCache);
+ size_t cacheSize = pseudoStyleCache.size();
+ for (size_t i = 0; i < cacheSize; ++i) {
+ RefPtr<RenderStyle> newPseudoStyle;
+ PseudoId pseudoId = pseudoStyleCache[i]->styleType();
+ if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
+ newPseudoStyle = renderer()->uncachedFirstLineStyle(newStyle);
+ else
+ newPseudoStyle = renderer()->getUncachedPseudoStyle(pseudoId, newStyle, newStyle);
+
+ if (*newPseudoStyle != *pseudoStyleCache[i]) {
+ if (pseudoId < FIRST_INTERNAL_PSEUDOID)
+ newStyle->setHasPseudoStyle(pseudoId);
+ newStyle->addCachedPseudoStyle(newPseudoStyle);
+ return true;
+ }
+ }
+ return false;
+}
+
void Element::recalcStyle(StyleChange change)
{
RenderStyle* currentStyle = renderStyle();
@@ -811,7 +839,7 @@ void Element::recalcStyle(StyleChange change)
newStyle->setChildrenAffectedByDirectAdjacentRules();
}
- if (ch != NoChange) {
+ if (ch != NoChange || pseudoStyleCacheIsInvalid(currentStyle, newStyle.get())) {
setRenderStyle(newStyle);
} else if (needsStyleRecalc() && (styleChangeType() != AnimationStyleChange) && (document()->usesSiblingRules() || document()->usesDescendantRules())) {
// Although no change occurred, we use the new style so that the cousin style sharing code won't get
@@ -981,7 +1009,7 @@ void Element::dispatchAttrAdditionEvent(Attribute*)
return;
ExceptionCode ec = 0;
dispatchEvent(new MutationEvent(DOMAttrModifiedEvent, true, false, attr, attr->value(),
- attr->value(),document()->attrName(attr->id()), MutationEvent::ADDITION), ec);
+ attr->value(), document()->attrName(attr->id()), MutationEvent::ADDITION), ec);
#endif
}
diff --git a/src/3rdparty/webkit/WebCore/dom/Element.h b/src/3rdparty/webkit/WebCore/dom/Element.h
index dfa2c0e..b0bbeb3 100644
--- a/src/3rdparty/webkit/WebCore/dom/Element.h
+++ b/src/3rdparty/webkit/WebCore/dom/Element.h
@@ -170,6 +170,8 @@ public:
virtual void formatForDebugger(char* buffer, unsigned length) const;
#endif
+ bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle);
+
String innerText() const;
String outerText() const;
diff --git a/src/3rdparty/webkit/WebCore/dom/Event.idl b/src/3rdparty/webkit/WebCore/dom/Event.idl
index 5ac9e0c..75b6b5f 100644
--- a/src/3rdparty/webkit/WebCore/dom/Event.idl
+++ b/src/3rdparty/webkit/WebCore/dom/Event.idl
@@ -22,6 +22,7 @@ module events {
// Introduced in DOM Level 2:
interface [
+ CustomToJS,
GenerateConstructor,
NoStaticTables,
Polymorphic,
diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp
index 06cea07..437f5ba 100644
--- a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp
@@ -95,6 +95,13 @@ WorkerContext* EventTarget::toWorkerContext()
}
#endif
+#if ENABLE(SHARED_WORKERS)
+SharedWorker* EventTarget::toSharedWorker()
+{
+ return 0;
+}
+#endif
+
#ifndef NDEBUG
void forbidEventDispatch()
{
diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.h b/src/3rdparty/webkit/WebCore/dom/EventTarget.h
index 662902e..73a32e3 100644
--- a/src/3rdparty/webkit/WebCore/dom/EventTarget.h
+++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.h
@@ -36,6 +36,7 @@
namespace WebCore {
+ class AbstractWorker;
class AtomicString;
class DOMApplicationCache;
class DOMWindow;
@@ -45,6 +46,7 @@ namespace WebCore {
class Node;
class SVGElementInstance;
class ScriptExecutionContext;
+ class SharedWorker;
class Worker;
class WorkerContext;
class XMLHttpRequest;
@@ -70,6 +72,10 @@ namespace WebCore {
virtual WorkerContext* toWorkerContext();
#endif
+#if ENABLE(SHARED_WORKERS)
+ virtual SharedWorker* toSharedWorker();
+#endif
+
virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) = 0;
diff --git a/src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl b/src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl
new file mode 100644
index 0000000..dee365f
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008, 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+module html {
+
+ // This interface is used for undetectable HTMLCollections.
+ // An undetectable HTMLCollection behaves like an HTMLCollection
+ // when used, but the 'typeof' operator returns undefined and
+ // ToBoolean returns false.
+ interface HTMLAllCollection : HTMLCollection {
+ };
+
+}
diff --git a/src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp b/src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp
index ac0a4ab..73c016f 100644
--- a/src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp
@@ -28,7 +28,7 @@
#include "MessageChannel.h"
#include "MessagePort.h"
-#include "PlatformMessagePortChannel.h"
+#include "MessagePortChannel.h"
namespace WebCore {
@@ -36,7 +36,7 @@ MessageChannel::MessageChannel(ScriptExecutionContext* context)
: m_port1(MessagePort::create(*context))
, m_port2(MessagePort::create(*context))
{
- PlatformMessagePortChannel::createChannel(m_port1.get(), m_port2.get());
+ MessagePortChannel::createChannel(m_port1.get(), m_port2.get());
}
MessageChannel::~MessageChannel()
diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp
index 768d4f4..05134c0 100644
--- a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp
@@ -30,14 +30,8 @@
#include "config.h"
#include "MessagePortChannel.h"
-#include "PlatformMessagePortChannel.h"
-
namespace WebCore {
-PassOwnPtr<MessagePortChannel> MessagePortChannel::create(PassRefPtr<PlatformMessagePortChannel> channel)
-{
- return new MessagePortChannel(channel);
-}
PassOwnPtr<MessagePortChannel::EventData> MessagePortChannel::EventData::create(const String& message, PassOwnPtr<MessagePortChannel> channel)
{
@@ -50,15 +44,4 @@ MessagePortChannel::EventData::EventData(const String& message, PassOwnPtr<Messa
{
}
-MessagePortChannel::MessagePortChannel(PassRefPtr<PlatformMessagePortChannel> channel)
- : m_channel(channel)
-{
-}
-
-MessagePortChannel::~MessagePortChannel()
-{
- // Make sure we close our platform channel when the base is freed, to keep the channel objects from leaking.
- m_channel->close();
-}
-
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h
index 15b3d16..3841020 100644
--- a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h
+++ b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h
@@ -50,6 +50,8 @@ namespace WebCore {
// It acts as a wrapper around the platform-dependent PlatformMessagePortChannel implementation which ensures that the platform-dependent close() method is invoked before destruction.
class MessagePortChannel : Noncopyable {
public:
+ static void createChannel(PassRefPtr<MessagePort>, PassRefPtr<MessagePort>);
+
// Creates a new wrapper for the passed channel.
static PassOwnPtr<MessagePortChannel> create(PassRefPtr<PlatformMessagePortChannel>);
diff --git a/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp b/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp
index f3e9bb2..fe631c8 100644
--- a/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp
@@ -164,7 +164,7 @@ PassRefPtr<Node> NamedNodeMap::removeNamedItem(const QualifiedName& name, Except
return r.release();
}
-PassRefPtr<Node> NamedNodeMap::item (unsigned index) const
+PassRefPtr<Node> NamedNodeMap::item(unsigned index) const
{
if (index >= length())
return 0;
diff --git a/src/3rdparty/webkit/WebCore/dom/Node.cpp b/src/3rdparty/webkit/WebCore/dom/Node.cpp
index 3ddf4c0..192462d 100644
--- a/src/3rdparty/webkit/WebCore/dom/Node.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/Node.cpp
@@ -495,7 +495,7 @@ void Node::setTabIndexExplicitly(short i)
String Node::nodeValue() const
{
- return String();
+ return String();
}
void Node::setNodeValue(const String& /*nodeValue*/, ExceptionCode& ec)
@@ -517,7 +517,7 @@ PassRefPtr<NodeList> Node::childNodes()
document()->addNodeListCache();
}
- return ChildNodeList::create(this, &data->nodeLists()->m_childNodeListCaches);
+ return ChildNodeList::create(this, data->nodeLists()->m_childNodeListCaches.get());
}
Node *Node::lastDescendant() const
@@ -777,7 +777,7 @@ unsigned Node::nodeIndex() const
{
Node *_tempNode = previousSibling();
unsigned count=0;
- for( count=0; _tempNode; count++ )
+ for ( count=0; _tempNode; count++ )
_tempNode = _tempNode->previousSibling();
return count;
}
@@ -1500,9 +1500,9 @@ PassRefPtr<NodeList> Node::getElementsByTagNameNS(const AtomicString& namespaceU
pair<NodeListsNodeData::TagCacheMap::iterator, bool> result = data->nodeLists()->m_tagNodeListCaches.add(QualifiedName(nullAtom, localNameAtom, namespaceURI), 0);
if (result.second)
- result.first->second = new DynamicNodeList::Caches;
+ result.first->second = DynamicNodeList::Caches::create();
- return TagNodeList::create(this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localNameAtom, result.first->second);
+ return TagNodeList::create(this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localNameAtom, result.first->second.get());
}
PassRefPtr<NodeList> Node::getElementsByName(const String& elementName)
@@ -1515,9 +1515,9 @@ PassRefPtr<NodeList> Node::getElementsByName(const String& elementName)
pair<NodeListsNodeData::CacheMap::iterator, bool> result = data->nodeLists()->m_nameNodeListCaches.add(elementName, 0);
if (result.second)
- result.first->second = new DynamicNodeList::Caches;
+ result.first->second = DynamicNodeList::Caches::create();
- return NameNodeList::create(this, elementName, result.first->second);
+ return NameNodeList::create(this, elementName, result.first->second.get());
}
PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames)
@@ -1530,9 +1530,9 @@ PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames)
pair<NodeListsNodeData::CacheMap::iterator, bool> result = data->nodeLists()->m_classNodeListCaches.add(classNames, 0);
if (result.second)
- result.first->second = new DynamicNodeList::Caches;
+ result.first->second = DynamicNodeList::Caches::create();
- return ClassNodeList::create(this, classNames, result.first->second);
+ return ClassNodeList::create(this, classNames, result.first->second.get());
}
template <typename Functor>
@@ -2185,7 +2185,7 @@ void Node::formatForDebugger(char* buffer, unsigned length) const
void NodeListsNodeData::invalidateCaches()
{
- m_childNodeListCaches.reset();
+ m_childNodeListCaches->reset();
TagCacheMap::const_iterator tagCachesEnd = m_tagNodeListCaches.end();
for (TagCacheMap::const_iterator it = m_tagNodeListCaches.begin(); it != tagCachesEnd; ++it)
it->second->reset();
@@ -2208,24 +2208,24 @@ bool NodeListsNodeData::isEmpty() const
if (!m_listsWithCaches.isEmpty())
return false;
- if (m_childNodeListCaches.refCount)
+ if (m_childNodeListCaches->refCount())
return false;
TagCacheMap::const_iterator tagCachesEnd = m_tagNodeListCaches.end();
for (TagCacheMap::const_iterator it = m_tagNodeListCaches.begin(); it != tagCachesEnd; ++it) {
- if (it->second->refCount)
+ if (it->second->refCount())
return false;
}
CacheMap::const_iterator classCachesEnd = m_classNodeListCaches.end();
for (CacheMap::const_iterator it = m_classNodeListCaches.begin(); it != classCachesEnd; ++it) {
- if (it->second->refCount)
+ if (it->second->refCount())
return false;
}
CacheMap::const_iterator nameCachesEnd = m_nameNodeListCaches.end();
for (CacheMap::const_iterator it = m_nameNodeListCaches.begin(); it != nameCachesEnd; ++it) {
- if (it->second->refCount)
+ if (it->second->refCount())
return false;
}
diff --git a/src/3rdparty/webkit/WebCore/dom/Node.idl b/src/3rdparty/webkit/WebCore/dom/Node.idl
index bcfb226..1e31aea 100644
--- a/src/3rdparty/webkit/WebCore/dom/Node.idl
+++ b/src/3rdparty/webkit/WebCore/dom/Node.idl
@@ -23,9 +23,9 @@ module core {
interface [
CustomMarkFunction,
CustomPushEventHandlerScope,
+ CustomToJS,
GenerateConstructor,
GenerateNativeConverter,
- GenerateToJS,
InlineGetOwnPropertySlot,
Polymorphic,
InterfaceUUID=84BA0D7A-7E3E-4a7b-B6FB-7653E8FB54ED,
diff --git a/src/3rdparty/webkit/WebCore/dom/NodeRareData.h b/src/3rdparty/webkit/WebCore/dom/NodeRareData.h
index ae0e516..7740344 100644
--- a/src/3rdparty/webkit/WebCore/dom/NodeRareData.h
+++ b/src/3rdparty/webkit/WebCore/dom/NodeRareData.h
@@ -37,24 +37,18 @@ struct NodeListsNodeData {
typedef HashSet<DynamicNodeList*> NodeListSet;
NodeListSet m_listsWithCaches;
- DynamicNodeList::Caches m_childNodeListCaches;
+ RefPtr<DynamicNodeList::Caches> m_childNodeListCaches;
- typedef HashMap<String, DynamicNodeList::Caches*> CacheMap;
+ typedef HashMap<String, RefPtr<DynamicNodeList::Caches> > CacheMap;
CacheMap m_classNodeListCaches;
CacheMap m_nameNodeListCaches;
- typedef HashMap<QualifiedName, DynamicNodeList::Caches*> TagCacheMap;
+ typedef HashMap<QualifiedName, RefPtr<DynamicNodeList::Caches> > TagCacheMap;
TagCacheMap m_tagNodeListCaches;
- static PassOwnPtr<NodeListsNodeData> create() {
- return new NodeListsNodeData;
- }
-
- ~NodeListsNodeData()
+ static PassOwnPtr<NodeListsNodeData> create()
{
- deleteAllValues(m_classNodeListCaches);
- deleteAllValues(m_nameNodeListCaches);
- deleteAllValues(m_tagNodeListCaches);
+ return new NodeListsNodeData;
}
void invalidateCaches();
@@ -62,7 +56,10 @@ struct NodeListsNodeData {
bool isEmpty() const;
private:
- NodeListsNodeData() { }
+ NodeListsNodeData()
+ : m_childNodeListCaches(DynamicNodeList::Caches::create())
+ {
+ }
};
class NodeRareData {
diff --git a/src/3rdparty/webkit/WebCore/dom/Notation.h b/src/3rdparty/webkit/WebCore/dom/Notation.h
index 6f5bf3f..2bd5363 100644
--- a/src/3rdparty/webkit/WebCore/dom/Notation.h
+++ b/src/3rdparty/webkit/WebCore/dom/Notation.h
@@ -29,8 +29,7 @@
namespace WebCore {
-class Notation : public ContainerNode
-{
+class Notation : public ContainerNode {
public:
Notation(Document*);
Notation(Document*, const String& name, const String& publicId, const String& systemId);
diff --git a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h
index 3f42ed4..d133019 100644
--- a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h
+++ b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h
@@ -33,8 +33,7 @@ namespace WebCore {
class StyleSheet;
class CSSStyleSheet;
-class ProcessingInstruction : public ContainerNode, private CachedResourceClient
-{
+class ProcessingInstruction : public ContainerNode, private CachedResourceClient {
public:
ProcessingInstruction(Document*);
ProcessingInstruction(Document*, const String& target, const String& data);
diff --git a/src/3rdparty/webkit/WebCore/dom/Range.cpp b/src/3rdparty/webkit/WebCore/dom/Range.cpp
index 4fb1164..e7fd8a2 100644
--- a/src/3rdparty/webkit/WebCore/dom/Range.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/Range.cpp
@@ -725,7 +725,7 @@ PassRefPtr<DocumentFragment> Range::processContents(ActionType action, Exception
for (; leftParent != commonRoot; leftParent = leftParent->parentNode()) {
if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) {
RefPtr<Node> leftContentsParent = leftParent->cloneNode(false);
- leftContentsParent->appendChild(leftContents,ec);
+ leftContentsParent->appendChild(leftContents, ec);
leftContents = leftContentsParent;
}
@@ -733,11 +733,11 @@ PassRefPtr<DocumentFragment> Range::processContents(ActionType action, Exception
for (; n; n = next) {
next = n->nextSibling();
if (action == EXTRACT_CONTENTS)
- leftContents->appendChild(n,ec); // will remove n from leftParent
+ leftContents->appendChild(n, ec); // will remove n from leftParent
else if (action == CLONE_CONTENTS)
- leftContents->appendChild(n->cloneNode(true),ec);
+ leftContents->appendChild(n->cloneNode(true), ec);
else
- leftParent->removeChild(n,ec);
+ leftParent->removeChild(n, ec);
}
n = leftParent->nextSibling();
}
@@ -795,7 +795,7 @@ PassRefPtr<DocumentFragment> Range::processContents(ActionType action, Exception
for (; rightParent != commonRoot; rightParent = rightParent->parentNode()) {
if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) {
RefPtr<Node> rightContentsParent = rightParent->cloneNode(false);
- rightContentsParent->appendChild(rightContents,ec);
+ rightContentsParent->appendChild(rightContents, ec);
rightContents = rightContentsParent;
}
Node* prev;
diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h
index 7b2f36a..3f8febc 100644
--- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h
+++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h
@@ -64,7 +64,7 @@ namespace WebCore {
SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
- virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0;
+ virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0;
virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString) = 0;
virtual void scriptImported(unsigned long, const String&) = 0;
diff --git a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp
index 1831f3a..7552c56 100644
--- a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp
@@ -867,6 +867,19 @@ void SelectElement::accessKeySetSelectedIndex(SelectElementData& data, Element*
scrollToSelection(data, element);
}
+unsigned SelectElement::optionCount(const SelectElementData& data, const Element* element)
+{
+ unsigned options = 0;
+
+ const Vector<Element*>& items = data.listItems(element);
+ for (unsigned i = 0; i < items.size(); ++i) {
+ if (isOptionElement(items[i]))
+ ++options;
+ }
+
+ return options;
+}
+
// SelectElementData
SelectElementData::SelectElementData()
: m_multiple(false)
diff --git a/src/3rdparty/webkit/WebCore/dom/SelectElement.h b/src/3rdparty/webkit/WebCore/dom/SelectElement.h
index 29187ae..4cc76a0 100644
--- a/src/3rdparty/webkit/WebCore/dom/SelectElement.h
+++ b/src/3rdparty/webkit/WebCore/dom/SelectElement.h
@@ -95,7 +95,8 @@ protected:
static void typeAheadFind(SelectElementData&, Element*, KeyboardEvent*);
static void insertedIntoTree(SelectElementData&, Element*);
static void accessKeySetSelectedIndex(SelectElementData&, Element*, int index);
-
+ static unsigned optionCount(const SelectElementData&, const Element*);
+
private:
static void menuListDefaultEventHandler(SelectElementData&, Element*, Event*, HTMLFormElement*);
static void listBoxDefaultEventHandler(SelectElementData&, Element*, Event*, HTMLFormElement*);
diff --git a/src/3rdparty/webkit/WebCore/dom/StyledElement.cpp b/src/3rdparty/webkit/WebCore/dom/StyledElement.cpp
index 8ddfd31..c22ecf9 100644
--- a/src/3rdparty/webkit/WebCore/dom/StyledElement.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/StyledElement.cpp
@@ -280,10 +280,11 @@ CSSStyleDeclaration* StyledElement::style()
return getInlineStyleDecl();
}
-static inline int toHex(UChar c) {
+static inline int toHex(UChar c)
+{
return ((c >= '0' && c <= '9') ? (c - '0')
: ((c >= 'a' && c <= 'f') ? (c - 'a' + 10)
- : (( c >= 'A' && c <= 'F') ? (c - 'A' + 10)
+ : ((c >= 'A' && c <= 'F') ? (c - 'A' + 10)
: -1)));
}
diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp
index 4098eaa..95f63e9 100644
--- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp
@@ -195,7 +195,8 @@ private:
};
struct PendingStartElementNSCallback : public PendingCallback {
- virtual ~PendingStartElementNSCallback() {
+ virtual ~PendingStartElementNSCallback()
+ {
xmlFree(xmlLocalName);
xmlFree(xmlPrefix);
xmlFree(xmlURI);
@@ -208,7 +209,8 @@ private:
xmlFree(attributes);
}
- virtual void call(XMLTokenizer* tokenizer) {
+ virtual void call(XMLTokenizer* tokenizer)
+ {
tokenizer->startElementNs(xmlLocalName, xmlPrefix, xmlURI,
nb_namespaces, const_cast<const xmlChar**>(namespaces),
nb_attributes, nb_defaulted, const_cast<const xmlChar**>(attributes));
@@ -312,7 +314,7 @@ private:
struct PendingErrorCallback: public PendingCallback {
virtual ~PendingErrorCallback()
{
- free (message);
+ free(message);
}
virtual void call(XMLTokenizer* tokenizer)
@@ -344,7 +346,8 @@ class OffsetBuffer {
public:
OffsetBuffer(const Vector<char>& b) : m_buffer(b), m_currentOffset(0) { }
- int readOutBytes(char* outputBuffer, unsigned askedToRead) {
+ int readOutBytes(char* outputBuffer, unsigned askedToRead)
+ {
unsigned bytesLeft = m_buffer.size() - m_currentOffset;
unsigned lenToCopy = min(askedToRead, bytesLeft);
if (lenToCopy) {
@@ -668,7 +671,7 @@ typedef struct _xmlSAX2Namespace xmlSAX2Namespace;
static inline void handleElementNamespaces(Element* newElement, const xmlChar** libxmlNamespaces, int nb_namespaces, ExceptionCode& ec)
{
xmlSAX2Namespace* namespaces = reinterpret_cast<xmlSAX2Namespace*>(libxmlNamespaces);
- for(int i = 0; i < nb_namespaces; i++) {
+ for (int i = 0; i < nb_namespaces; i++) {
String namespaceQName = "xmlns";
String namespaceURI = toString(namespaces[i].uri);
if (namespaces[i].prefix)
@@ -691,7 +694,7 @@ typedef struct _xmlSAX2Attributes xmlSAX2Attributes;
static inline void handleElementAttributes(Element* newElement, const xmlChar** libxmlAttributes, int nb_attributes, ExceptionCode& ec)
{
xmlSAX2Attributes* attributes = reinterpret_cast<xmlSAX2Attributes*>(libxmlAttributes);
- for(int i = 0; i < nb_attributes; i++) {
+ for (int i = 0; i < nb_attributes; i++) {
String attrLocalName = toString(attributes[i].localname);
int valueLength = (int) (attributes[i].end - attributes[i].value);
String attrValue = toString(attributes[i].value, valueLength);
@@ -1407,7 +1410,7 @@ static void attributesStartElementNsHandler(void* closure, const xmlChar* xmlLoc
state->gotAttributes = true;
xmlSAX2Attributes* attributes = reinterpret_cast<xmlSAX2Attributes*>(libxmlAttributes);
- for(int i = 0; i < nb_attributes; i++) {
+ for (int i = 0; i < nb_attributes; i++) {
String attrLocalName = toString(attributes[i].localname);
int valueLength = (int) (attributes[i].end - attributes[i].value);
String attrValue = toString(attributes[i].value, valueLength);
diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp
index 3173708..16c637f 100644
--- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp
@@ -66,8 +66,7 @@ using namespace std;
namespace WebCore {
#if QT_VERSION >= 0x040400
-class EntityResolver : public QXmlStreamEntityResolver
-{
+class EntityResolver : public QXmlStreamEntityResolver {
virtual QString resolveUndeclaredEntity(const QString &name);
};
@@ -354,7 +353,7 @@ static void attributesStartElementNsHandler(AttributeParseState* state, const QX
state->gotAttributes = true;
- for(int i = 0; i < attrs.count(); i++) {
+ for (int i = 0; i < attrs.count(); i++) {
const QXmlStreamAttribute& attr = attrs[i];
String attrLocalName = attr.name();
String attrValue = attr.value();
@@ -540,7 +539,7 @@ void XMLTokenizer::parseStartElement()
String prefix = prefixFromQName(m_stream.qualifiedName().toString());
if (m_parsingFragment && uri.isNull()) {
- Q_ASSERT (prefix.isNull());
+ Q_ASSERT(prefix.isNull());
uri = m_defaultNamespaceURI;
}
diff --git a/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp b/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp
index 80ab7c8..d668703 100644
--- a/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp
@@ -37,6 +37,27 @@
namespace WebCore {
// MessagePortChannel implementations - just delegate to the PlatformMessagePortChannel.
+void MessagePortChannel::createChannel(PassRefPtr<MessagePort> port1, PassRefPtr<MessagePort> port2)
+{
+ PlatformMessagePortChannel::createChannel(port1, port2);
+}
+
+PassOwnPtr<MessagePortChannel> MessagePortChannel::create(PassRefPtr<PlatformMessagePortChannel> channel)
+{
+ return new MessagePortChannel(channel);
+}
+
+MessagePortChannel::MessagePortChannel(PassRefPtr<PlatformMessagePortChannel> channel)
+ : m_channel(channel)
+{
+}
+
+MessagePortChannel::~MessagePortChannel()
+{
+ // Make sure we close our platform channel when the base is freed, to keep the channel objects from leaking.
+ m_channel->close();
+}
+
bool MessagePortChannel::entangleIfOpen(MessagePort* port)
{
return m_channel->entangleIfOpen(port);
diff --git a/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp b/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp
index 8d0312b..998a1e2 100644
--- a/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp
@@ -787,7 +787,7 @@ void ApplyStyleCommand::applyInlineStyle(CSSMutableStyleDeclaration *style)
styleWithoutEmbedding->removeProperty(CSSPropertyUnicodeBidi);
styleWithoutEmbedding->removeProperty(CSSPropertyDirection);
removeInlineStyle(styleWithoutEmbedding, removeStart, end);
- } else
+ } else
removeInlineStyle(style, removeStart, end);
start = startPosition();
@@ -857,7 +857,7 @@ void ApplyStyleCommand::applyInlineStyle(CSSMutableStyleDeclaration *style)
styleWithoutEmbedding->removeProperty(CSSPropertyUnicodeBidi);
styleWithoutEmbedding->removeProperty(CSSPropertyDirection);
applyInlineStyleToRange(styleWithoutEmbedding.get(), start, end);
- } else
+ } else
applyInlineStyleToRange(style, start, end);
// Remove dummy style spans created by splitting text elements.
diff --git a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp
index 8e4f950..9737e92 100644
--- a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp
@@ -1041,6 +1041,8 @@ Position CompositeEditCommand::positionAvoidingSpecialElementBoundary(const Posi
// to determine if the split is necessary. Returns the last split node.
PassRefPtr<Node> CompositeEditCommand::splitTreeToNode(Node* start, Node* end, bool splitAncestor)
{
+ ASSERT(start != end);
+
RefPtr<Node> node;
for (node = start; node && node->parent() != end; node = node->parent()) {
VisiblePosition positionInParent(Position(node->parent(), 0), DOWNSTREAM);
diff --git a/src/3rdparty/webkit/WebCore/editing/DeleteSelectionCommand.cpp b/src/3rdparty/webkit/WebCore/editing/DeleteSelectionCommand.cpp
index 5a0d8fc..284f073 100644
--- a/src/3rdparty/webkit/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/DeleteSelectionCommand.cpp
@@ -365,7 +365,7 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node)
updateLayout();
RenderObject *r = node->renderer();
if (r && r->isTableCell() && static_cast<RenderTableCell*>(r)->contentHeight() <= 0)
- insertBlockPlaceholder(Position(node,0));
+ insertBlockPlaceholder(Position(node, 0));
return;
}
diff --git a/src/3rdparty/webkit/WebCore/editing/Editor.cpp b/src/3rdparty/webkit/WebCore/editing/Editor.cpp
index 2ad5cce..b62ded7 100644
--- a/src/3rdparty/webkit/WebCore/editing/Editor.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/Editor.cpp
@@ -655,9 +655,9 @@ PassRefPtr<Node> Editor::increaseSelectionListLevelOrdered()
if (!canEditRichly() || m_frame->selection()->isNone())
return 0;
- PassRefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevelOrdered(m_frame->document());
+ RefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevelOrdered(m_frame->document());
revealSelectionAfterEditingOperation();
- return newList;
+ return newList.release();
}
PassRefPtr<Node> Editor::increaseSelectionListLevelUnordered()
@@ -665,9 +665,9 @@ PassRefPtr<Node> Editor::increaseSelectionListLevelUnordered()
if (!canEditRichly() || m_frame->selection()->isNone())
return 0;
- PassRefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevelUnordered(m_frame->document());
+ RefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevelUnordered(m_frame->document());
revealSelectionAfterEditingOperation();
- return newList;
+ return newList.release();
}
void Editor::decreaseSelectionListLevel()
@@ -1066,9 +1066,9 @@ void Editor::paste()
void Editor::pasteAsPlainText()
{
- if (!canPaste())
+ if (!canPaste())
return;
- pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
+ pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
}
void Editor::performDelete()
diff --git a/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp b/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp
index ab62c09..5a189d4 100644
--- a/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp
@@ -1247,9 +1247,10 @@ static String valueForeColor(Frame* frame, Event*)
// Map of functions
-struct CommandEntry { const char* name; EditorInternalCommand command; };
static const CommandMap& createCommandMap()
{
+ struct CommandEntry { const char* name; EditorInternalCommand command; };
+
static const CommandEntry commands[] = {
{ "AlignCenter", { executeJustifyCenter, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "AlignJustified", { executeJustifyFull, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
diff --git a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp
index 3922367..890cff2 100644
--- a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp
@@ -163,6 +163,12 @@ void IndentOutdentCommand::indentIntoBlockquote(const VisiblePosition& endOfCurr
moveParagraph(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, VisiblePosition(Position(insertionPoint, 0)), true);
}
+bool IndentOutdentCommand::isAtUnsplittableElement(const Position& pos) const
+{
+ Node* node = pos.node();
+ return node == editableRootForPosition(pos) || node == enclosingNodeOfType(pos, &isTableCell);
+}
+
void IndentOutdentCommand::indentRegion()
{
VisibleSelection selection = selectionForParagraphIteration(endingSelection());
@@ -174,10 +180,10 @@ void IndentOutdentCommand::indentRegion()
ASSERT(!startOfSelection.isNull());
ASSERT(!endOfSelection.isNull());
- // Special case empty root editable elements because there's nothing to split
+ // Special case empty unsplittable elements because there's nothing to split
// and there's nothing to move.
Position start = startOfSelection.deepEquivalent().downstream();
- if (start.node() == editableRootForPosition(start)) {
+ if (isAtUnsplittableElement(start)) {
RefPtr<Element> blockquote = createIndentBlockquoteElement(document());
insertNodeAt(blockquote, start);
RefPtr<Element> placeholder = createBreakElement(document());
diff --git a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h
index 419f832f..a10b89d 100644
--- a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h
+++ b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h
@@ -46,6 +46,9 @@ private:
virtual void doApply();
virtual EditAction editingAction() const { return m_typeOfAction == Indent ? EditActionIndent : EditActionOutdent; }
+ // FIXME: Does this belong in htmlediting.cpp?
+ bool isAtUnsplittableElement(const Position&) const;
+
void indentRegion();
void outdentRegion();
void outdentParagraph();
diff --git a/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp b/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp
index 9bb68ad..54f09cd 100644
--- a/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp
@@ -250,7 +250,8 @@ void SelectionController::willBeModified(EAlteration alter, EDirection direction
}
}
-TextDirection SelectionController::directionOfEnclosingBlock() {
+TextDirection SelectionController::directionOfEnclosingBlock()
+{
Node* n = m_sel.extent().node();
Node* enclosingBlockNode = enclosingBlock(n);
if (!enclosingBlockNode)
diff --git a/src/3rdparty/webkit/WebCore/editing/SmartReplaceICU.cpp b/src/3rdparty/webkit/WebCore/editing/SmartReplaceICU.cpp
index 18be647..9acd350 100644
--- a/src/3rdparty/webkit/WebCore/editing/SmartReplaceICU.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/SmartReplaceICU.cpp
@@ -37,7 +37,8 @@
namespace WebCore {
-static void addAllCodePoints(USet* smartSet, const String& string) {
+static void addAllCodePoints(USet* smartSet, const String& string)
+{
const UChar* characters = string.characters();
for (size_t i = 0; i < string.length(); i++)
uset_add(smartSet, characters[i]);
diff --git a/src/3rdparty/webkit/WebCore/editing/TextIterator.cpp b/src/3rdparty/webkit/WebCore/editing/TextIterator.cpp
index aee34df..a1b3bc5 100644
--- a/src/3rdparty/webkit/WebCore/editing/TextIterator.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/TextIterator.cpp
@@ -42,6 +42,7 @@
#include "visible_units.h"
#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+#include "TextBreakIteratorInternalICU.h"
#include <unicode/usearch.h>
#endif
@@ -143,7 +144,7 @@ unsigned BitStack::size() const
// --------
-static inline Node* parentOrShadowParent(Node* node)
+static inline Node* parentCrossingShadowBoundaries(Node* node)
{
if (Node* parent = node->parentNode())
return parent;
@@ -155,20 +156,50 @@ static inline Node* parentOrShadowParent(Node* node)
static unsigned depthCrossingShadowBoundaries(Node* node)
{
unsigned depth = 0;
- for (Node* parent = parentOrShadowParent(node); parent; parent = parentOrShadowParent(parent))
+ for (Node* parent = parentCrossingShadowBoundaries(node); parent; parent = parentCrossingShadowBoundaries(parent))
++depth;
return depth;
}
#endif
+// This function is like Range::pastLastNode, except for the fact that it can climb up out of shadow trees.
+static Node* nextInPreOrderCrossingShadowBoundaries(Node* rangeEndContainer, int rangeEndOffset)
+{
+ if (!rangeEndContainer)
+ return 0;
+ if (rangeEndOffset >= 0 && !rangeEndContainer->offsetInCharacters()) {
+ if (Node* next = rangeEndContainer->childNode(rangeEndOffset))
+ return next;
+ }
+ for (Node* node = rangeEndContainer; node; node = parentCrossingShadowBoundaries(node)) {
+ if (Node* next = node->nextSibling())
+ return next;
+ }
+ return 0;
+}
+
+static Node* previousInPostOrderCrossingShadowBoundaries(Node* rangeStartContainer, int rangeStartOffset)
+{
+ if (!rangeStartContainer)
+ return 0;
+ if (rangeStartOffset > 0 && !rangeStartContainer->offsetInCharacters()) {
+ if (Node* previous = rangeStartContainer->childNode(rangeStartOffset - 1))
+ return previous;
+ }
+ for (Node* node = rangeStartContainer; node; node = parentCrossingShadowBoundaries(node)) {
+ if (Node* previous = node->previousSibling())
+ return previous;
+ }
+ return 0;
+}
+
+// --------
+
static inline bool fullyClipsContents(Node* node)
{
RenderObject* renderer = node->renderer();
- if (!renderer || !renderer->isBox())
- return false;
- RenderStyle* style = renderer->style();
- if (style->overflowX() == OVISIBLE && style->overflowY() == OVISIBLE)
+ if (!renderer || !renderer->isBox() || !renderer->hasOverflowClip())
return false;
return toRenderBox(renderer)->size().isEmpty();
}
@@ -195,7 +226,7 @@ static void setUpFullyClippedStack(BitStack& stack, Node* node)
{
// Put the nodes in a vector so we can iterate in reverse order.
Vector<Node*, 100> ancestry;
- for (Node* parent = parentOrShadowParent(node); parent; parent = parentOrShadowParent(parent))
+ for (Node* parent = parentCrossingShadowBoundaries(node); parent; parent = parentCrossingShadowBoundaries(parent))
ancestry.append(parent);
// Call pushFullyClippedState on each node starting with the earliest ancestor.
@@ -265,7 +296,7 @@ TextIterator::TextIterator(const Range* r, bool emitCharactersBetweenAllVisibleP
m_handledChildren = false;
// calculate first out of bounds node
- m_pastEndNode = r->pastLastNode();
+ m_pastEndNode = nextInPreOrderCrossingShadowBoundaries(endContainer, endOffset);
// initialize node processing state
m_needAnotherNewline = false;
@@ -352,14 +383,14 @@ void TextIterator::advance()
next = m_node->nextSibling();
if (!next) {
bool pastEnd = m_node->traverseNextNode() == m_pastEndNode;
- Node* parentNode = parentOrShadowParent(m_node);
+ Node* parentNode = parentCrossingShadowBoundaries(m_node);
while (!next && parentNode) {
if ((pastEnd && parentNode == m_endContainer) || m_endContainer->isDescendantOf(parentNode))
return;
bool haveRenderer = m_node->renderer();
m_node = parentNode;
m_fullyClippedStack.pop();
- parentNode = parentOrShadowParent(m_node);
+ parentNode = parentCrossingShadowBoundaries(m_node);
if (haveRenderer)
exitNode();
if (m_positionNode) {
@@ -883,14 +914,14 @@ Node* TextIterator::node() const
// --------
-SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator() : m_positionNode(0)
+SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator()
+ : m_positionNode(0)
{
}
SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range* r)
+ : m_positionNode(0)
{
- m_positionNode = 0;
-
if (!r)
return;
@@ -932,15 +963,8 @@ SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range* r)
m_lastTextNode = 0;
m_lastCharacter = '\n';
-
- if (startOffset == 0 || !startNode->firstChild()) {
- m_pastStartNode = startNode->previousSibling();
- while (!m_pastStartNode && startNode->parentNode()) {
- startNode = startNode->parentNode();
- m_pastStartNode = startNode->previousSibling();
- }
- } else
- m_pastStartNode = startNode->childNode(startOffset - 1);
+
+ m_pastStartNode = previousInPostOrderCrossingShadowBoundaries(startNode, startOffset);
advance();
}
@@ -987,7 +1011,7 @@ void SimplifiedBackwardsTextIterator::advance()
// Exit all other containers.
next = m_node->previousSibling();
while (!next) {
- Node* parentNode = parentOrShadowParent(m_node);
+ Node* parentNode = parentCrossingShadowBoundaries(m_node);
if (!parentNode)
break;
m_node = parentNode;
@@ -1053,26 +1077,22 @@ bool SimplifiedBackwardsTextIterator::handleNonTextNode()
{
// We can use a linefeed in place of a tab because this simple iterator is only used to
// find boundaries, not actual content. A linefeed breaks words, sentences, and paragraphs.
- if (shouldEmitNewlineForNode(m_node) ||
- shouldEmitNewlineAfterNode(m_node) ||
- shouldEmitTabBeforeNode(m_node)) {
+ if (shouldEmitNewlineForNode(m_node) || shouldEmitNewlineAfterNode(m_node) || shouldEmitTabBeforeNode(m_node)) {
unsigned index = m_node->nodeIndex();
- // The start of this emitted range is wrong, ensuring correctness would require
- // VisiblePositions and so would be slow. previousBoundary expects this.
+ // The start of this emitted range is wrong. Ensuring correctness would require
+ // VisiblePositions and so would be slow. previousBoundary expects this.
emitCharacter('\n', m_node->parentNode(), index + 1, index + 1);
}
-
return true;
}
void SimplifiedBackwardsTextIterator::exitNode()
{
- if (shouldEmitNewlineForNode(m_node) ||
- shouldEmitNewlineBeforeNode(m_node) ||
- shouldEmitTabBeforeNode(m_node))
- // The start of this emitted range is wrong, ensuring correctness would require
- // VisiblePositions and so would be slow. previousBoundary expects this.
+ if (shouldEmitNewlineForNode(m_node) || shouldEmitNewlineBeforeNode(m_node) || shouldEmitTabBeforeNode(m_node)) {
+ // The start of this emitted range is wrong. Ensuring correctness would require
+ // VisiblePositions and so would be slow. previousBoundary expects this.
emitCharacter('\n', m_node, 0, 0);
+ }
}
void SimplifiedBackwardsTextIterator::emitCharacter(UChar c, Node* node, int startOffset, int endOffset)
@@ -1386,13 +1406,9 @@ static UStringSearch* createSearcher()
// Provide a non-empty pattern and non-empty text so usearch_open will not fail,
// but it doesn't matter exactly what it is, since we don't perform any searches
// without setting both the pattern and the text.
-
- // Pass empty string for the locale for now to get the Unicode Collation Algorithm,
- // rather than something locale-specific.
-
UErrorCode status = U_ZERO_ERROR;
- UStringSearch* searcher = usearch_open(&newlineCharacter, 1, &newlineCharacter, 1, "", 0, &status);
- ASSERT(status == U_ZERO_ERROR);
+ UStringSearch* searcher = usearch_open(&newlineCharacter, 1, &newlineCharacter, 1, currentSearchLocaleID(), 0, &status);
+ ASSERT(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING);
return searcher;
}
diff --git a/src/3rdparty/webkit/WebCore/editing/gtk/SelectionControllerGtk.cpp b/src/3rdparty/webkit/WebCore/editing/gtk/SelectionControllerGtk.cpp
index c21c45a..f3bd4bc 100644
--- a/src/3rdparty/webkit/WebCore/editing/gtk/SelectionControllerGtk.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/gtk/SelectionControllerGtk.cpp
@@ -30,11 +30,11 @@ namespace WebCore {
void SelectionController::notifyAccessibilityForSelectionChange()
{
if (AXObjectCache::accessibilityEnabled() && m_sel.start().isNotNull() && m_sel.end().isNotNull()) {
- RenderObject* focusedNode = m_sel.start().node()->renderer();
+ RenderObject* focusedNode = m_sel.end().node()->renderer();
AccessibilityObject* accessibilityObject = m_frame->document()->axObjectCache()->getOrCreate(focusedNode);
AtkObject* wrapper = accessibilityObject->wrapper();
if (ATK_IS_TEXT(wrapper)) {
- g_signal_emit_by_name(wrapper, "text-caret-moved", m_sel.start().computeOffsetInContainerNode());
+ g_signal_emit_by_name(wrapper, "text-caret-moved", m_sel.end().computeOffsetInContainerNode());
if (m_sel.isRange())
g_signal_emit_by_name(wrapper, "text-selection-changed");
diff --git a/src/3rdparty/webkit/WebCore/generated/ArrayPrototype.lut.h b/src/3rdparty/webkit/WebCore/generated/ArrayPrototype.lut.h
index da67f2e..d3d7d36 100644
--- a/src/3rdparty/webkit/WebCore/generated/ArrayPrototype.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/ArrayPrototype.lut.h
@@ -29,6 +29,6 @@ static const struct HashTableValue arrayTableValues[22] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable arrayTable =
+extern JSC_CONST_HASHTABLE HashTable arrayTable =
{ 65, 63, arrayTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp
index 4c85bee..1c2da06 100644
--- a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -47,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -55,159 +54,28 @@
/* Pure parsers. */
#define YYPURE 1
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
/* Using locations. */
#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */
-#define yyparse cssyyparse
-#define yylex cssyylex
-#define yyerror cssyyerror
-#define yylval cssyylval
-#define yychar cssyychar
-#define yydebug cssyydebug
-#define yynerrs cssyynerrs
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- TOKEN_EOF = 0,
- LOWEST_PREC = 258,
- UNIMPORTANT_TOK = 259,
- WHITESPACE = 260,
- SGML_CD = 261,
- INCLUDES = 262,
- DASHMATCH = 263,
- BEGINSWITH = 264,
- ENDSWITH = 265,
- CONTAINS = 266,
- STRING = 267,
- IDENT = 268,
- NTH = 269,
- HEX = 270,
- IDSEL = 271,
- IMPORT_SYM = 272,
- PAGE_SYM = 273,
- MEDIA_SYM = 274,
- FONT_FACE_SYM = 275,
- CHARSET_SYM = 276,
- NAMESPACE_SYM = 277,
- WEBKIT_RULE_SYM = 278,
- WEBKIT_DECLS_SYM = 279,
- WEBKIT_KEYFRAME_RULE_SYM = 280,
- WEBKIT_KEYFRAMES_SYM = 281,
- WEBKIT_VALUE_SYM = 282,
- WEBKIT_MEDIAQUERY_SYM = 283,
- WEBKIT_SELECTOR_SYM = 284,
- WEBKIT_VARIABLES_SYM = 285,
- WEBKIT_DEFINE_SYM = 286,
- VARIABLES_FOR = 287,
- WEBKIT_VARIABLES_DECLS_SYM = 288,
- ATKEYWORD = 289,
- IMPORTANT_SYM = 290,
- MEDIA_ONLY = 291,
- MEDIA_NOT = 292,
- MEDIA_AND = 293,
- QEMS = 294,
- EMS = 295,
- EXS = 296,
- PXS = 297,
- CMS = 298,
- MMS = 299,
- INS = 300,
- PTS = 301,
- PCS = 302,
- DEGS = 303,
- RADS = 304,
- GRADS = 305,
- TURNS = 306,
- MSECS = 307,
- SECS = 308,
- HERZ = 309,
- KHERZ = 310,
- DIMEN = 311,
- PERCENTAGE = 312,
- FLOATTOKEN = 313,
- INTEGER = 314,
- URI = 315,
- FUNCTION = 316,
- NOTFUNCTION = 317,
- UNICODERANGE = 318,
- VARCALL = 319
- };
-#endif
-/* Tokens. */
-#define TOKEN_EOF 0
-#define LOWEST_PREC 258
-#define UNIMPORTANT_TOK 259
-#define WHITESPACE 260
-#define SGML_CD 261
-#define INCLUDES 262
-#define DASHMATCH 263
-#define BEGINSWITH 264
-#define ENDSWITH 265
-#define CONTAINS 266
-#define STRING 267
-#define IDENT 268
-#define NTH 269
-#define HEX 270
-#define IDSEL 271
-#define IMPORT_SYM 272
-#define PAGE_SYM 273
-#define MEDIA_SYM 274
-#define FONT_FACE_SYM 275
-#define CHARSET_SYM 276
-#define NAMESPACE_SYM 277
-#define WEBKIT_RULE_SYM 278
-#define WEBKIT_DECLS_SYM 279
-#define WEBKIT_KEYFRAME_RULE_SYM 280
-#define WEBKIT_KEYFRAMES_SYM 281
-#define WEBKIT_VALUE_SYM 282
-#define WEBKIT_MEDIAQUERY_SYM 283
-#define WEBKIT_SELECTOR_SYM 284
-#define WEBKIT_VARIABLES_SYM 285
-#define WEBKIT_DEFINE_SYM 286
-#define VARIABLES_FOR 287
-#define WEBKIT_VARIABLES_DECLS_SYM 288
-#define ATKEYWORD 289
-#define IMPORTANT_SYM 290
-#define MEDIA_ONLY 291
-#define MEDIA_NOT 292
-#define MEDIA_AND 293
-#define QEMS 294
-#define EMS 295
-#define EXS 296
-#define PXS 297
-#define CMS 298
-#define MMS 299
-#define INS 300
-#define PTS 301
-#define PCS 302
-#define DEGS 303
-#define RADS 304
-#define GRADS 305
-#define TURNS 306
-#define MSECS 307
-#define SECS 308
-#define HERZ 309
-#define KHERZ 310
-#define DIMEN 311
-#define PERCENTAGE 312
-#define FLOATTOKEN 313
-#define INTEGER 314
-#define URI 315
-#define FUNCTION 316
-#define NOTFUNCTION 317
-#define UNICODERANGE 318
-#define VARCALL 319
-
-
+#define yyparse cssyyparse
+#define yylex cssyylex
+#define yyerror cssyyerror
+#define yylval cssyylval
+#define yychar cssyychar
+#define yydebug cssyydebug
+#define yynerrs cssyynerrs
/* Copy the first part of user declarations. */
+
+/* Line 189 of yacc.c */
#line 1 "../css/CSSGrammar.y"
@@ -264,6 +132,9 @@ using namespace HTMLNames;
+/* Line 189 of yacc.c */
+#line 137 "WebCore/tmp/../generated/CSSGrammar.tab.c"
+
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -282,10 +153,88 @@ using namespace HTMLNames;
# define YYTOKEN_TABLE 0
#endif
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ TOKEN_EOF = 0,
+ LOWEST_PREC = 258,
+ UNIMPORTANT_TOK = 259,
+ WHITESPACE = 260,
+ SGML_CD = 261,
+ INCLUDES = 262,
+ DASHMATCH = 263,
+ BEGINSWITH = 264,
+ ENDSWITH = 265,
+ CONTAINS = 266,
+ STRING = 267,
+ IDENT = 268,
+ NTH = 269,
+ HEX = 270,
+ IDSEL = 271,
+ IMPORT_SYM = 272,
+ PAGE_SYM = 273,
+ MEDIA_SYM = 274,
+ FONT_FACE_SYM = 275,
+ CHARSET_SYM = 276,
+ NAMESPACE_SYM = 277,
+ WEBKIT_RULE_SYM = 278,
+ WEBKIT_DECLS_SYM = 279,
+ WEBKIT_KEYFRAME_RULE_SYM = 280,
+ WEBKIT_KEYFRAMES_SYM = 281,
+ WEBKIT_VALUE_SYM = 282,
+ WEBKIT_MEDIAQUERY_SYM = 283,
+ WEBKIT_SELECTOR_SYM = 284,
+ WEBKIT_VARIABLES_SYM = 285,
+ WEBKIT_DEFINE_SYM = 286,
+ VARIABLES_FOR = 287,
+ WEBKIT_VARIABLES_DECLS_SYM = 288,
+ ATKEYWORD = 289,
+ IMPORTANT_SYM = 290,
+ MEDIA_ONLY = 291,
+ MEDIA_NOT = 292,
+ MEDIA_AND = 293,
+ QEMS = 294,
+ EMS = 295,
+ EXS = 296,
+ PXS = 297,
+ CMS = 298,
+ MMS = 299,
+ INS = 300,
+ PTS = 301,
+ PCS = 302,
+ DEGS = 303,
+ RADS = 304,
+ GRADS = 305,
+ TURNS = 306,
+ MSECS = 307,
+ SECS = 308,
+ HERZ = 309,
+ KHERZ = 310,
+ DIMEN = 311,
+ PERCENTAGE = 312,
+ FLOATTOKEN = 313,
+ INTEGER = 314,
+ URI = 315,
+ FUNCTION = 316,
+ NOTFUNCTION = 317,
+ UNICODERANGE = 318,
+ VARCALL = 319
+ };
+#endif
+
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 58 "../css/CSSGrammar.y"
{
+
+/* Line 214 of yacc.c */
+#line 58 "../css/CSSGrammar.y"
+
bool boolean;
char character;
int integer;
@@ -307,18 +256,21 @@ typedef union YYSTYPE
WebKitCSSKeyframeRule* keyframeRule;
WebKitCSSKeyframesRule* keyframesRule;
float val;
-}
-/* Line 187 of yacc.c. */
-#line 313 "WebCore/tmp/../generated/CSSGrammar.tab.c"
- YYSTYPE;
+
+
+
+/* Line 214 of yacc.c */
+#line 264 "WebCore/tmp/../generated/CSSGrammar.tab.c"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
-
/* Copy the second part of user declarations. */
+
+/* Line 264 of yacc.c */
#line 82 "../css/CSSGrammar.y"
@@ -334,8 +286,8 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
-/* Line 216 of yacc.c. */
-#line 339 "WebCore/tmp/../generated/CSSGrammar.tab.c"
+/* Line 264 of yacc.c */
+#line 291 "WebCore/tmp/../generated/CSSGrammar.tab.c"
#ifdef short
# undef short
@@ -410,14 +362,14 @@ typedef short int yytype_int16;
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
-YYID (int i)
+YYID (int yyi)
#else
static int
-YYID (i)
- int i;
+YYID (yyi)
+ int yyi;
#endif
{
- return i;
+ return yyi;
}
#endif
@@ -498,9 +450,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- };
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -534,12 +486,12 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
@@ -1558,17 +1510,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
-yy_stack_print (bottom, top)
- yytype_int16 *bottom;
- yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
- for (; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
YYFPRINTF (stderr, "\n");
}
@@ -1602,11 +1557,11 @@ yy_reduce_print (yyvsp, yyrule)
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
- fprintf (stderr, " $%d = ", yyi + 1);
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
- fprintf (stderr, "\n");
+ YYFPRINTF (stderr, "\n");
}
}
@@ -1886,10 +1841,8 @@ yydestruct (yymsg, yytype, yyvaluep)
break;
}
}
-
/* Prevent warnings from -Wmissing-prototypes. */
-
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
@@ -1908,10 +1861,9 @@ int yyparse ();
-
-/*----------.
-| yyparse. |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse. |
+`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1935,74 +1887,75 @@ yyparse ()
#endif
#endif
{
- /* The look-ahead symbol. */
+/* The lookahead symbol. */
int yychar;
-/* The semantic value of the look-ahead symbol. */
+/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-/* Number of syntax errors so far. */
-int yynerrs;
+ /* Number of syntax errors so far. */
+ int yynerrs;
- int yystate;
- int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
+ /* The stacks and their tools:
+ `yyss': related to states.
+ `yyvs': related to semantic values.
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss = yyssa;
- yytype_int16 *yyssp;
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
-
-
-
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
- YYSIZE_T yystacksize = YYINITDEPTH;
+ YYSIZE_T yystacksize;
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
+ yytoken = 0;
+ yyss = yyssa;
+ yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
+
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
+ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
-
yyssp = yyss;
yyvsp = yyvs;
@@ -2032,7 +1985,6 @@ int yynerrs;
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
-
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
@@ -2040,7 +1992,6 @@ int yynerrs;
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
-
&yystacksize);
yyss = yyss1;
@@ -2063,9 +2014,8 @@ int yynerrs;
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
@@ -2076,7 +2026,6 @@ int yynerrs;
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
-
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
@@ -2086,6 +2035,9 @@ int yynerrs;
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
goto yybackup;
/*-----------.
@@ -2094,16 +2046,16 @@ int yynerrs;
yybackup:
/* Do appropriate processing given the current state. Read a
- look-ahead token if we need one and don't already have one. */
+ lookahead token if we need one and don't already have one. */
- /* First try to decide what to do without reference to look-ahead token. */
+ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
- /* Not known => get a look-ahead token if don't already have one. */
+ /* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
@@ -2135,20 +2087,16 @@ yybackup:
goto yyreduce;
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
- /* Shift the look-ahead token. */
+ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
- /* Discard the shifted token unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
@@ -2188,6 +2136,8 @@ yyreduce:
switch (yyn)
{
case 12:
+
+/* Line 1455 of yacc.c */
#line 282 "../css/CSSGrammar.y"
{
static_cast<CSSParser*>(parser)->m_rule = (yyvsp[(4) - (6)].rule);
@@ -2195,6 +2145,8 @@ yyreduce:
break;
case 13:
+
+/* Line 1455 of yacc.c */
#line 288 "../css/CSSGrammar.y"
{
static_cast<CSSParser*>(parser)->m_keyframe = (yyvsp[(4) - (6)].keyframeRule);
@@ -2202,6 +2154,8 @@ yyreduce:
break;
case 14:
+
+/* Line 1455 of yacc.c */
#line 294 "../css/CSSGrammar.y"
{
/* can be empty */
@@ -2209,6 +2163,8 @@ yyreduce:
break;
case 15:
+
+/* Line 1455 of yacc.c */
#line 300 "../css/CSSGrammar.y"
{
/* can be empty */
@@ -2216,6 +2172,8 @@ yyreduce:
break;
case 16:
+
+/* Line 1455 of yacc.c */
#line 306 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2231,6 +2189,8 @@ yyreduce:
break;
case 17:
+
+/* Line 1455 of yacc.c */
#line 320 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2239,6 +2199,8 @@ yyreduce:
break;
case 18:
+
+/* Line 1455 of yacc.c */
#line 327 "../css/CSSGrammar.y"
{
if ((yyvsp[(4) - (5)].selectorList)) {
@@ -2250,12 +2212,16 @@ yyreduce:
break;
case 25:
+
+/* Line 1455 of yacc.c */
#line 349 "../css/CSSGrammar.y"
{
;}
break;
case 28:
+
+/* Line 1455 of yacc.c */
#line 359 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2266,18 +2232,24 @@ yyreduce:
break;
case 29:
+
+/* Line 1455 of yacc.c */
#line 365 "../css/CSSGrammar.y"
{
;}
break;
case 30:
+
+/* Line 1455 of yacc.c */
#line 367 "../css/CSSGrammar.y"
{
;}
break;
case 32:
+
+/* Line 1455 of yacc.c */
#line 373 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2287,12 +2259,16 @@ yyreduce:
break;
case 33:
+
+/* Line 1455 of yacc.c */
#line 378 "../css/CSSGrammar.y"
{
;}
break;
case 35:
+
+/* Line 1455 of yacc.c */
#line 384 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2302,6 +2278,8 @@ yyreduce:
break;
case 39:
+
+/* Line 1455 of yacc.c */
#line 398 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2311,11 +2289,15 @@ yyreduce:
break;
case 49:
+
+/* Line 1455 of yacc.c */
#line 421 "../css/CSSGrammar.y"
{ (yyval.ruleList) = 0; ;}
break;
case 50:
+
+/* Line 1455 of yacc.c */
#line 422 "../css/CSSGrammar.y"
{
(yyval.ruleList) = (yyvsp[(1) - (3)].ruleList);
@@ -2328,6 +2310,8 @@ yyreduce:
break;
case 60:
+
+/* Line 1455 of yacc.c */
#line 449 "../css/CSSGrammar.y"
{
(yyval.rule) = static_cast<CSSParser*>(parser)->createImportRule((yyvsp[(3) - (6)].string), (yyvsp[(5) - (6)].mediaList));
@@ -2335,6 +2319,8 @@ yyreduce:
break;
case 61:
+
+/* Line 1455 of yacc.c */
#line 452 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -2342,6 +2328,8 @@ yyreduce:
break;
case 62:
+
+/* Line 1455 of yacc.c */
#line 455 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -2349,6 +2337,8 @@ yyreduce:
break;
case 63:
+
+/* Line 1455 of yacc.c */
#line 458 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -2356,6 +2346,8 @@ yyreduce:
break;
case 64:
+
+/* Line 1455 of yacc.c */
#line 464 "../css/CSSGrammar.y"
{
(yyval.rule) = static_cast<CSSParser*>(parser)->createVariablesRule((yyvsp[(3) - (7)].mediaList), true);
@@ -2363,6 +2355,8 @@ yyreduce:
break;
case 65:
+
+/* Line 1455 of yacc.c */
#line 468 "../css/CSSGrammar.y"
{
(yyval.rule) = static_cast<CSSParser*>(parser)->createVariablesRule((yyvsp[(3) - (7)].mediaList), false);
@@ -2370,6 +2364,8 @@ yyreduce:
break;
case 66:
+
+/* Line 1455 of yacc.c */
#line 474 "../css/CSSGrammar.y"
{
(yyval.mediaList) = static_cast<CSSParser*>(parser)->createMediaList();
@@ -2377,6 +2373,8 @@ yyreduce:
break;
case 67:
+
+/* Line 1455 of yacc.c */
#line 478 "../css/CSSGrammar.y"
{
(yyval.mediaList) = (yyvsp[(3) - (3)].mediaList);
@@ -2384,6 +2382,8 @@ yyreduce:
break;
case 68:
+
+/* Line 1455 of yacc.c */
#line 484 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (1)].boolean);
@@ -2391,6 +2391,8 @@ yyreduce:
break;
case 69:
+
+/* Line 1455 of yacc.c */
#line 487 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (2)].boolean);
@@ -2400,6 +2402,8 @@ yyreduce:
break;
case 70:
+
+/* Line 1455 of yacc.c */
#line 492 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (1)].boolean);
@@ -2407,6 +2411,8 @@ yyreduce:
break;
case 71:
+
+/* Line 1455 of yacc.c */
#line 495 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -2414,6 +2420,8 @@ yyreduce:
break;
case 72:
+
+/* Line 1455 of yacc.c */
#line 498 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -2421,6 +2429,8 @@ yyreduce:
break;
case 73:
+
+/* Line 1455 of yacc.c */
#line 501 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (2)].boolean);
@@ -2428,6 +2438,8 @@ yyreduce:
break;
case 74:
+
+/* Line 1455 of yacc.c */
#line 507 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (3)].boolean);
@@ -2435,6 +2447,8 @@ yyreduce:
break;
case 75:
+
+/* Line 1455 of yacc.c */
#line 510 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -2442,6 +2456,8 @@ yyreduce:
break;
case 76:
+
+/* Line 1455 of yacc.c */
#line 513 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -2449,6 +2465,8 @@ yyreduce:
break;
case 77:
+
+/* Line 1455 of yacc.c */
#line 516 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -2456,6 +2474,8 @@ yyreduce:
break;
case 78:
+
+/* Line 1455 of yacc.c */
#line 519 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (4)].boolean);
@@ -2465,6 +2485,8 @@ yyreduce:
break;
case 79:
+
+/* Line 1455 of yacc.c */
#line 524 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (4)].boolean);
@@ -2472,6 +2494,8 @@ yyreduce:
break;
case 80:
+
+/* Line 1455 of yacc.c */
#line 527 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (6)].boolean);
@@ -2479,6 +2503,8 @@ yyreduce:
break;
case 81:
+
+/* Line 1455 of yacc.c */
#line 533 "../css/CSSGrammar.y"
{
(yyval.boolean) = static_cast<CSSParser*>(parser)->addVariable((yyvsp[(1) - (4)].string), (yyvsp[(4) - (4)].valueList));
@@ -2486,6 +2512,8 @@ yyreduce:
break;
case 82:
+
+/* Line 1455 of yacc.c */
#line 537 "../css/CSSGrammar.y"
{
(yyval.boolean) = static_cast<CSSParser*>(parser)->addVariableDeclarationBlock((yyvsp[(1) - (7)].string));
@@ -2493,6 +2521,8 @@ yyreduce:
break;
case 83:
+
+/* Line 1455 of yacc.c */
#line 541 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -2500,6 +2530,8 @@ yyreduce:
break;
case 84:
+
+/* Line 1455 of yacc.c */
#line 545 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -2507,6 +2539,8 @@ yyreduce:
break;
case 85:
+
+/* Line 1455 of yacc.c */
#line 549 "../css/CSSGrammar.y"
{
/* @variables { varname: } Just reduce away this variable with no value. */
@@ -2515,6 +2549,8 @@ yyreduce:
break;
case 86:
+
+/* Line 1455 of yacc.c */
#line 554 "../css/CSSGrammar.y"
{
/* if we come across rules with invalid values like this case: @variables { varname: *; }, just discard the property/value pair */
@@ -2523,6 +2559,8 @@ yyreduce:
break;
case 87:
+
+/* Line 1455 of yacc.c */
#line 561 "../css/CSSGrammar.y"
{
(yyval.string) = (yyvsp[(1) - (2)].string);
@@ -2530,6 +2568,8 @@ yyreduce:
break;
case 88:
+
+/* Line 1455 of yacc.c */
#line 567 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2539,16 +2579,22 @@ yyreduce:
break;
case 91:
+
+/* Line 1455 of yacc.c */
#line 577 "../css/CSSGrammar.y"
{ (yyval.string).characters = 0; ;}
break;
case 92:
+
+/* Line 1455 of yacc.c */
#line 578 "../css/CSSGrammar.y"
{ (yyval.string) = (yyvsp[(1) - (2)].string); ;}
break;
case 95:
+
+/* Line 1455 of yacc.c */
#line 587 "../css/CSSGrammar.y"
{
(yyval.string) = (yyvsp[(1) - (2)].string);
@@ -2556,6 +2602,8 @@ yyreduce:
break;
case 96:
+
+/* Line 1455 of yacc.c */
#line 593 "../css/CSSGrammar.y"
{
(yyval.valueList) = 0;
@@ -2563,6 +2611,8 @@ yyreduce:
break;
case 97:
+
+/* Line 1455 of yacc.c */
#line 596 "../css/CSSGrammar.y"
{
(yyval.valueList) = (yyvsp[(3) - (4)].valueList);
@@ -2570,6 +2620,8 @@ yyreduce:
break;
case 98:
+
+/* Line 1455 of yacc.c */
#line 602 "../css/CSSGrammar.y"
{
(yyvsp[(3) - (7)].string).lower();
@@ -2578,6 +2630,8 @@ yyreduce:
break;
case 99:
+
+/* Line 1455 of yacc.c */
#line 609 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2587,6 +2641,8 @@ yyreduce:
break;
case 100:
+
+/* Line 1455 of yacc.c */
#line 614 "../css/CSSGrammar.y"
{
(yyval.mediaQueryExpList) = (yyvsp[(1) - (5)].mediaQueryExpList);
@@ -2595,6 +2651,8 @@ yyreduce:
break;
case 101:
+
+/* Line 1455 of yacc.c */
#line 621 "../css/CSSGrammar.y"
{
(yyval.mediaQueryExpList) = static_cast<CSSParser*>(parser)->createFloatingMediaQueryExpList();
@@ -2602,6 +2660,8 @@ yyreduce:
break;
case 102:
+
+/* Line 1455 of yacc.c */
#line 624 "../css/CSSGrammar.y"
{
(yyval.mediaQueryExpList) = (yyvsp[(3) - (3)].mediaQueryExpList);
@@ -2609,6 +2669,8 @@ yyreduce:
break;
case 103:
+
+/* Line 1455 of yacc.c */
#line 630 "../css/CSSGrammar.y"
{
(yyval.mediaQueryRestrictor) = MediaQuery::None;
@@ -2616,6 +2678,8 @@ yyreduce:
break;
case 104:
+
+/* Line 1455 of yacc.c */
#line 633 "../css/CSSGrammar.y"
{
(yyval.mediaQueryRestrictor) = MediaQuery::Only;
@@ -2623,6 +2687,8 @@ yyreduce:
break;
case 105:
+
+/* Line 1455 of yacc.c */
#line 636 "../css/CSSGrammar.y"
{
(yyval.mediaQueryRestrictor) = MediaQuery::Not;
@@ -2630,6 +2696,8 @@ yyreduce:
break;
case 106:
+
+/* Line 1455 of yacc.c */
#line 642 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2638,6 +2706,8 @@ yyreduce:
break;
case 107:
+
+/* Line 1455 of yacc.c */
#line 647 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2647,6 +2717,8 @@ yyreduce:
break;
case 108:
+
+/* Line 1455 of yacc.c */
#line 655 "../css/CSSGrammar.y"
{
(yyval.mediaList) = static_cast<CSSParser*>(parser)->createMediaList();
@@ -2654,6 +2726,8 @@ yyreduce:
break;
case 110:
+
+/* Line 1455 of yacc.c */
#line 662 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2663,6 +2737,8 @@ yyreduce:
break;
case 111:
+
+/* Line 1455 of yacc.c */
#line 667 "../css/CSSGrammar.y"
{
(yyval.mediaList) = (yyvsp[(1) - (4)].mediaList);
@@ -2672,6 +2748,8 @@ yyreduce:
break;
case 112:
+
+/* Line 1455 of yacc.c */
#line 672 "../css/CSSGrammar.y"
{
(yyval.mediaList) = 0;
@@ -2679,6 +2757,8 @@ yyreduce:
break;
case 113:
+
+/* Line 1455 of yacc.c */
#line 678 "../css/CSSGrammar.y"
{
(yyval.rule) = static_cast<CSSParser*>(parser)->createMediaRule((yyvsp[(3) - (7)].mediaList), (yyvsp[(6) - (7)].ruleList));
@@ -2686,6 +2766,8 @@ yyreduce:
break;
case 114:
+
+/* Line 1455 of yacc.c */
#line 681 "../css/CSSGrammar.y"
{
(yyval.rule) = static_cast<CSSParser*>(parser)->createMediaRule(0, (yyvsp[(5) - (6)].ruleList));
@@ -2693,6 +2775,8 @@ yyreduce:
break;
case 115:
+
+/* Line 1455 of yacc.c */
#line 687 "../css/CSSGrammar.y"
{
(yyval.string) = (yyvsp[(1) - (2)].string);
@@ -2700,6 +2784,8 @@ yyreduce:
break;
case 116:
+
+/* Line 1455 of yacc.c */
#line 693 "../css/CSSGrammar.y"
{
(yyval.rule) = (yyvsp[(7) - (8)].keyframesRule);
@@ -2708,11 +2794,15 @@ yyreduce:
break;
case 119:
+
+/* Line 1455 of yacc.c */
#line 705 "../css/CSSGrammar.y"
{ (yyval.keyframesRule) = static_cast<CSSParser*>(parser)->createKeyframesRule(); ;}
break;
case 120:
+
+/* Line 1455 of yacc.c */
#line 706 "../css/CSSGrammar.y"
{
(yyval.keyframesRule) = (yyvsp[(1) - (3)].keyframesRule);
@@ -2722,6 +2812,8 @@ yyreduce:
break;
case 121:
+
+/* Line 1455 of yacc.c */
#line 714 "../css/CSSGrammar.y"
{
(yyval.keyframeRule) = static_cast<CSSParser*>(parser)->createKeyframeRule((yyvsp[(1) - (6)].valueList));
@@ -2729,6 +2821,8 @@ yyreduce:
break;
case 122:
+
+/* Line 1455 of yacc.c */
#line 720 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2738,6 +2832,8 @@ yyreduce:
break;
case 123:
+
+/* Line 1455 of yacc.c */
#line 725 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2748,11 +2844,15 @@ yyreduce:
break;
case 124:
+
+/* Line 1455 of yacc.c */
#line 734 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).isInt = false; (yyval.value).fValue = (yyvsp[(1) - (1)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; ;}
break;
case 125:
+
+/* Line 1455 of yacc.c */
#line 735 "../css/CSSGrammar.y"
{
(yyval.value).id = 0; (yyval.value).isInt = false; (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER;
@@ -2767,6 +2867,8 @@ yyreduce:
break;
case 126:
+
+/* Line 1455 of yacc.c */
#line 759 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -2774,6 +2876,8 @@ yyreduce:
break;
case 127:
+
+/* Line 1455 of yacc.c */
#line 762 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -2781,6 +2885,8 @@ yyreduce:
break;
case 128:
+
+/* Line 1455 of yacc.c */
#line 769 "../css/CSSGrammar.y"
{
(yyval.rule) = static_cast<CSSParser*>(parser)->createFontFaceRule();
@@ -2788,6 +2894,8 @@ yyreduce:
break;
case 129:
+
+/* Line 1455 of yacc.c */
#line 772 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -2795,6 +2903,8 @@ yyreduce:
break;
case 130:
+
+/* Line 1455 of yacc.c */
#line 775 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -2802,31 +2912,43 @@ yyreduce:
break;
case 131:
+
+/* Line 1455 of yacc.c */
#line 781 "../css/CSSGrammar.y"
{ (yyval.relation) = CSSSelector::DirectAdjacent; ;}
break;
case 132:
+
+/* Line 1455 of yacc.c */
#line 782 "../css/CSSGrammar.y"
{ (yyval.relation) = CSSSelector::IndirectAdjacent; ;}
break;
case 133:
+
+/* Line 1455 of yacc.c */
#line 783 "../css/CSSGrammar.y"
{ (yyval.relation) = CSSSelector::Child; ;}
break;
case 134:
+
+/* Line 1455 of yacc.c */
#line 787 "../css/CSSGrammar.y"
{ (yyval.integer) = -1; ;}
break;
case 135:
+
+/* Line 1455 of yacc.c */
#line 788 "../css/CSSGrammar.y"
{ (yyval.integer) = 1; ;}
break;
case 136:
+
+/* Line 1455 of yacc.c */
#line 792 "../css/CSSGrammar.y"
{
(yyval.rule) = static_cast<CSSParser*>(parser)->createStyleRule((yyvsp[(1) - (5)].selectorList));
@@ -2834,6 +2956,8 @@ yyreduce:
break;
case 137:
+
+/* Line 1455 of yacc.c */
#line 798 "../css/CSSGrammar.y"
{
if ((yyvsp[(1) - (1)].selector)) {
@@ -2847,6 +2971,8 @@ yyreduce:
break;
case 138:
+
+/* Line 1455 of yacc.c */
#line 807 "../css/CSSGrammar.y"
{
if ((yyvsp[(1) - (4)].selectorList) && (yyvsp[(4) - (4)].selector)) {
@@ -2859,6 +2985,8 @@ yyreduce:
break;
case 139:
+
+/* Line 1455 of yacc.c */
#line 815 "../css/CSSGrammar.y"
{
(yyval.selectorList) = 0;
@@ -2866,6 +2994,8 @@ yyreduce:
break;
case 140:
+
+/* Line 1455 of yacc.c */
#line 821 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(1) - (2)].selector);
@@ -2873,6 +3003,8 @@ yyreduce:
break;
case 141:
+
+/* Line 1455 of yacc.c */
#line 827 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(1) - (1)].selector);
@@ -2880,6 +3012,8 @@ yyreduce:
break;
case 142:
+
+/* Line 1455 of yacc.c */
#line 831 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(1) - (1)].selector);
@@ -2887,6 +3021,8 @@ yyreduce:
break;
case 143:
+
+/* Line 1455 of yacc.c */
#line 835 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(2) - (2)].selector);
@@ -2906,6 +3042,8 @@ yyreduce:
break;
case 144:
+
+/* Line 1455 of yacc.c */
#line 850 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(3) - (3)].selector);
@@ -2930,6 +3068,8 @@ yyreduce:
break;
case 145:
+
+/* Line 1455 of yacc.c */
#line 870 "../css/CSSGrammar.y"
{
(yyval.selector) = 0;
@@ -2937,21 +3077,29 @@ yyreduce:
break;
case 146:
+
+/* Line 1455 of yacc.c */
#line 876 "../css/CSSGrammar.y"
{ (yyval.string).characters = 0; (yyval.string).length = 0; ;}
break;
case 147:
+
+/* Line 1455 of yacc.c */
#line 877 "../css/CSSGrammar.y"
{ static UChar star = '*'; (yyval.string).characters = &star; (yyval.string).length = 1; ;}
break;
case 148:
+
+/* Line 1455 of yacc.c */
#line 878 "../css/CSSGrammar.y"
{ (yyval.string) = (yyvsp[(1) - (2)].string); ;}
break;
case 149:
+
+/* Line 1455 of yacc.c */
#line 882 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -2961,6 +3109,8 @@ yyreduce:
break;
case 150:
+
+/* Line 1455 of yacc.c */
#line 887 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(2) - (2)].selector);
@@ -2972,6 +3122,8 @@ yyreduce:
break;
case 151:
+
+/* Line 1455 of yacc.c */
#line 894 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(1) - (1)].selector);
@@ -2982,6 +3134,8 @@ yyreduce:
break;
case 152:
+
+/* Line 1455 of yacc.c */
#line 900 "../css/CSSGrammar.y"
{
AtomicString namespacePrefix = (yyvsp[(1) - (2)].string);
@@ -2996,6 +3150,8 @@ yyreduce:
break;
case 153:
+
+/* Line 1455 of yacc.c */
#line 910 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(3) - (3)].selector);
@@ -3012,6 +3168,8 @@ yyreduce:
break;
case 154:
+
+/* Line 1455 of yacc.c */
#line 922 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(2) - (2)].selector);
@@ -3026,6 +3184,8 @@ yyreduce:
break;
case 155:
+
+/* Line 1455 of yacc.c */
#line 935 "../css/CSSGrammar.y"
{
CSSParserString& str = (yyvsp[(1) - (1)].string);
@@ -3038,6 +3198,8 @@ yyreduce:
break;
case 156:
+
+/* Line 1455 of yacc.c */
#line 943 "../css/CSSGrammar.y"
{
static UChar star = '*';
@@ -3047,6 +3209,8 @@ yyreduce:
break;
case 157:
+
+/* Line 1455 of yacc.c */
#line 951 "../css/CSSGrammar.y"
{
(yyval.selector) = (yyvsp[(1) - (1)].selector);
@@ -3054,6 +3218,8 @@ yyreduce:
break;
case 158:
+
+/* Line 1455 of yacc.c */
#line 954 "../css/CSSGrammar.y"
{
if (!(yyvsp[(2) - (2)].selector))
@@ -3071,6 +3237,8 @@ yyreduce:
break;
case 159:
+
+/* Line 1455 of yacc.c */
#line 967 "../css/CSSGrammar.y"
{
(yyval.selector) = 0;
@@ -3078,6 +3246,8 @@ yyreduce:
break;
case 160:
+
+/* Line 1455 of yacc.c */
#line 973 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -3090,6 +3260,8 @@ yyreduce:
break;
case 161:
+
+/* Line 1455 of yacc.c */
#line 981 "../css/CSSGrammar.y"
{
if ((yyvsp[(1) - (1)].string).characters[0] >= '0' && (yyvsp[(1) - (1)].string).characters[0] <= '9') {
@@ -3106,6 +3278,8 @@ yyreduce:
break;
case 165:
+
+/* Line 1455 of yacc.c */
#line 999 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -3118,6 +3292,8 @@ yyreduce:
break;
case 166:
+
+/* Line 1455 of yacc.c */
#line 1010 "../css/CSSGrammar.y"
{
CSSParserString& str = (yyvsp[(1) - (2)].string);
@@ -3130,6 +3306,8 @@ yyreduce:
break;
case 167:
+
+/* Line 1455 of yacc.c */
#line 1021 "../css/CSSGrammar.y"
{
(yyval.selector) = static_cast<CSSParser*>(parser)->createFloatingSelector();
@@ -3139,6 +3317,8 @@ yyreduce:
break;
case 168:
+
+/* Line 1455 of yacc.c */
#line 1026 "../css/CSSGrammar.y"
{
(yyval.selector) = static_cast<CSSParser*>(parser)->createFloatingSelector();
@@ -3149,6 +3329,8 @@ yyreduce:
break;
case 169:
+
+/* Line 1455 of yacc.c */
#line 1032 "../css/CSSGrammar.y"
{
AtomicString namespacePrefix = (yyvsp[(3) - (5)].string);
@@ -3161,6 +3343,8 @@ yyreduce:
break;
case 170:
+
+/* Line 1455 of yacc.c */
#line 1040 "../css/CSSGrammar.y"
{
AtomicString namespacePrefix = (yyvsp[(3) - (9)].string);
@@ -3174,6 +3358,8 @@ yyreduce:
break;
case 171:
+
+/* Line 1455 of yacc.c */
#line 1052 "../css/CSSGrammar.y"
{
(yyval.integer) = CSSSelector::Exact;
@@ -3181,6 +3367,8 @@ yyreduce:
break;
case 172:
+
+/* Line 1455 of yacc.c */
#line 1055 "../css/CSSGrammar.y"
{
(yyval.integer) = CSSSelector::List;
@@ -3188,6 +3376,8 @@ yyreduce:
break;
case 173:
+
+/* Line 1455 of yacc.c */
#line 1058 "../css/CSSGrammar.y"
{
(yyval.integer) = CSSSelector::Hyphen;
@@ -3195,6 +3385,8 @@ yyreduce:
break;
case 174:
+
+/* Line 1455 of yacc.c */
#line 1061 "../css/CSSGrammar.y"
{
(yyval.integer) = CSSSelector::Begin;
@@ -3202,6 +3394,8 @@ yyreduce:
break;
case 175:
+
+/* Line 1455 of yacc.c */
#line 1064 "../css/CSSGrammar.y"
{
(yyval.integer) = CSSSelector::End;
@@ -3209,6 +3403,8 @@ yyreduce:
break;
case 176:
+
+/* Line 1455 of yacc.c */
#line 1067 "../css/CSSGrammar.y"
{
(yyval.integer) = CSSSelector::Contain;
@@ -3216,6 +3412,8 @@ yyreduce:
break;
case 179:
+
+/* Line 1455 of yacc.c */
#line 1078 "../css/CSSGrammar.y"
{
(yyval.selector) = static_cast<CSSParser*>(parser)->createFloatingSelector();
@@ -3250,6 +3448,8 @@ yyreduce:
break;
case 180:
+
+/* Line 1455 of yacc.c */
#line 1108 "../css/CSSGrammar.y"
{
(yyval.selector) = static_cast<CSSParser*>(parser)->createFloatingSelector();
@@ -3273,6 +3473,8 @@ yyreduce:
break;
case 181:
+
+/* Line 1455 of yacc.c */
#line 1128 "../css/CSSGrammar.y"
{
CSSParser *p = static_cast<CSSParser*>(parser);
@@ -3294,6 +3496,8 @@ yyreduce:
break;
case 182:
+
+/* Line 1455 of yacc.c */
#line 1146 "../css/CSSGrammar.y"
{
CSSParser *p = static_cast<CSSParser*>(parser);
@@ -3315,6 +3519,8 @@ yyreduce:
break;
case 183:
+
+/* Line 1455 of yacc.c */
#line 1164 "../css/CSSGrammar.y"
{
CSSParser *p = static_cast<CSSParser*>(parser);
@@ -3337,6 +3543,8 @@ yyreduce:
break;
case 184:
+
+/* Line 1455 of yacc.c */
#line 1183 "../css/CSSGrammar.y"
{
if (!(yyvsp[(4) - (6)].selector) || (yyvsp[(4) - (6)].selector)->simpleSelector() || (yyvsp[(4) - (6)].selector)->tagHistory())
@@ -3353,6 +3561,8 @@ yyreduce:
break;
case 185:
+
+/* Line 1455 of yacc.c */
#line 1198 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (1)].boolean);
@@ -3360,6 +3570,8 @@ yyreduce:
break;
case 186:
+
+/* Line 1455 of yacc.c */
#line 1201 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (2)].boolean);
@@ -3369,6 +3581,8 @@ yyreduce:
break;
case 187:
+
+/* Line 1455 of yacc.c */
#line 1206 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (1)].boolean);
@@ -3376,6 +3590,8 @@ yyreduce:
break;
case 188:
+
+/* Line 1455 of yacc.c */
#line 1209 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -3383,6 +3599,8 @@ yyreduce:
break;
case 189:
+
+/* Line 1455 of yacc.c */
#line 1212 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -3390,6 +3608,8 @@ yyreduce:
break;
case 190:
+
+/* Line 1455 of yacc.c */
#line 1215 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (2)].boolean);
@@ -3397,6 +3617,8 @@ yyreduce:
break;
case 191:
+
+/* Line 1455 of yacc.c */
#line 1218 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (2)].boolean);
@@ -3404,6 +3626,8 @@ yyreduce:
break;
case 192:
+
+/* Line 1455 of yacc.c */
#line 1224 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (3)].boolean);
@@ -3411,6 +3635,8 @@ yyreduce:
break;
case 193:
+
+/* Line 1455 of yacc.c */
#line 1227 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -3418,6 +3644,8 @@ yyreduce:
break;
case 194:
+
+/* Line 1455 of yacc.c */
#line 1230 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -3425,6 +3653,8 @@ yyreduce:
break;
case 195:
+
+/* Line 1455 of yacc.c */
#line 1233 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -3432,6 +3662,8 @@ yyreduce:
break;
case 196:
+
+/* Line 1455 of yacc.c */
#line 1236 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (4)].boolean);
@@ -3441,6 +3673,8 @@ yyreduce:
break;
case 197:
+
+/* Line 1455 of yacc.c */
#line 1241 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (4)].boolean);
@@ -3448,6 +3682,8 @@ yyreduce:
break;
case 198:
+
+/* Line 1455 of yacc.c */
#line 1244 "../css/CSSGrammar.y"
{
(yyval.boolean) = (yyvsp[(1) - (6)].boolean);
@@ -3455,6 +3691,8 @@ yyreduce:
break;
case 199:
+
+/* Line 1455 of yacc.c */
#line 1250 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -3472,6 +3710,8 @@ yyreduce:
break;
case 200:
+
+/* Line 1455 of yacc.c */
#line 1264 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -3487,6 +3727,8 @@ yyreduce:
break;
case 201:
+
+/* Line 1455 of yacc.c */
#line 1276 "../css/CSSGrammar.y"
{
(yyval.boolean) = false;
@@ -3494,6 +3736,8 @@ yyreduce:
break;
case 202:
+
+/* Line 1455 of yacc.c */
#line 1280 "../css/CSSGrammar.y"
{
/* The default movable type template has letter-spacing: .none; Handle this by looking for
@@ -3504,6 +3748,8 @@ yyreduce:
break;
case 203:
+
+/* Line 1455 of yacc.c */
#line 1287 "../css/CSSGrammar.y"
{
/* When we encounter something like p {color: red !important fail;} we should drop the declaration */
@@ -3512,6 +3758,8 @@ yyreduce:
break;
case 204:
+
+/* Line 1455 of yacc.c */
#line 1292 "../css/CSSGrammar.y"
{
/* Handle this case: div { text-align: center; !important } Just reduce away the stray !important. */
@@ -3520,6 +3768,8 @@ yyreduce:
break;
case 205:
+
+/* Line 1455 of yacc.c */
#line 1297 "../css/CSSGrammar.y"
{
/* div { font-family: } Just reduce away this property with no value. */
@@ -3528,6 +3778,8 @@ yyreduce:
break;
case 206:
+
+/* Line 1455 of yacc.c */
#line 1302 "../css/CSSGrammar.y"
{
/* if we come across rules with invalid values like this case: p { weight: *; }, just discard the rule */
@@ -3536,6 +3788,8 @@ yyreduce:
break;
case 207:
+
+/* Line 1455 of yacc.c */
#line 1307 "../css/CSSGrammar.y"
{
/* if we come across: div { color{;color:maroon} }, ignore everything within curly brackets */
@@ -3544,6 +3798,8 @@ yyreduce:
break;
case 208:
+
+/* Line 1455 of yacc.c */
#line 1314 "../css/CSSGrammar.y"
{
(yyval.integer) = cssPropertyID((yyvsp[(1) - (2)].string));
@@ -3551,16 +3807,22 @@ yyreduce:
break;
case 209:
+
+/* Line 1455 of yacc.c */
#line 1320 "../css/CSSGrammar.y"
{ (yyval.boolean) = true; ;}
break;
case 210:
+
+/* Line 1455 of yacc.c */
#line 1321 "../css/CSSGrammar.y"
{ (yyval.boolean) = false; ;}
break;
case 211:
+
+/* Line 1455 of yacc.c */
#line 1325 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -3570,6 +3832,8 @@ yyreduce:
break;
case 212:
+
+/* Line 1455 of yacc.c */
#line 1330 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -3588,6 +3852,8 @@ yyreduce:
break;
case 213:
+
+/* Line 1455 of yacc.c */
#line 1344 "../css/CSSGrammar.y"
{
(yyval.valueList) = 0;
@@ -3595,6 +3861,8 @@ yyreduce:
break;
case 214:
+
+/* Line 1455 of yacc.c */
#line 1350 "../css/CSSGrammar.y"
{
(yyval.character) = '/';
@@ -3602,6 +3870,8 @@ yyreduce:
break;
case 215:
+
+/* Line 1455 of yacc.c */
#line 1353 "../css/CSSGrammar.y"
{
(yyval.character) = ',';
@@ -3609,6 +3879,8 @@ yyreduce:
break;
case 216:
+
+/* Line 1455 of yacc.c */
#line 1356 "../css/CSSGrammar.y"
{
(yyval.character) = 0;
@@ -3616,21 +3888,29 @@ yyreduce:
break;
case 217:
+
+/* Line 1455 of yacc.c */
#line 1362 "../css/CSSGrammar.y"
{ (yyval.value) = (yyvsp[(1) - (1)].value); ;}
break;
case 218:
+
+/* Line 1455 of yacc.c */
#line 1363 "../css/CSSGrammar.y"
{ (yyval.value) = (yyvsp[(2) - (2)].value); (yyval.value).fValue *= (yyvsp[(1) - (2)].integer); ;}
break;
case 219:
+
+/* Line 1455 of yacc.c */
#line 1364 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_STRING; ;}
break;
case 220:
+
+/* Line 1455 of yacc.c */
#line 1365 "../css/CSSGrammar.y"
{
(yyval.value).id = cssValueKeywordID((yyvsp[(1) - (2)].string));
@@ -3640,36 +3920,50 @@ yyreduce:
break;
case 221:
+
+/* Line 1455 of yacc.c */
#line 1371 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION; ;}
break;
case 222:
+
+/* Line 1455 of yacc.c */
#line 1372 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).string = (yyvsp[(2) - (3)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION; ;}
break;
case 223:
+
+/* Line 1455 of yacc.c */
#line 1373 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_URI; ;}
break;
case 224:
+
+/* Line 1455 of yacc.c */
#line 1374 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; ;}
break;
case 225:
+
+/* Line 1455 of yacc.c */
#line 1375 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (1)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; ;}
break;
case 226:
+
+/* Line 1455 of yacc.c */
#line 1376 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).string = CSSParserString(); (yyval.value).unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; ;}
break;
case 227:
+
+/* Line 1455 of yacc.c */
#line 1378 "../css/CSSGrammar.y"
{
(yyval.value) = (yyvsp[(1) - (1)].value);
@@ -3677,6 +3971,8 @@ yyreduce:
break;
case 228:
+
+/* Line 1455 of yacc.c */
#line 1381 "../css/CSSGrammar.y"
{
(yyval.value) = (yyvsp[(1) - (2)].value);
@@ -3684,6 +3980,8 @@ yyreduce:
break;
case 229:
+
+/* Line 1455 of yacc.c */
#line 1384 "../css/CSSGrammar.y"
{ /* Handle width: %; */
(yyval.value).id = 0; (yyval.value).unit = 0;
@@ -3691,106 +3989,148 @@ yyreduce:
break;
case 230:
+
+/* Line 1455 of yacc.c */
#line 1390 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).isInt = true; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; ;}
break;
case 231:
+
+/* Line 1455 of yacc.c */
#line 1391 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).isInt = false; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; ;}
break;
case 232:
+
+/* Line 1455 of yacc.c */
#line 1392 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PERCENTAGE; ;}
break;
case 233:
+
+/* Line 1455 of yacc.c */
#line 1393 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PX; ;}
break;
case 234:
+
+/* Line 1455 of yacc.c */
#line 1394 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_CM; ;}
break;
case 235:
+
+/* Line 1455 of yacc.c */
#line 1395 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_MM; ;}
break;
case 236:
+
+/* Line 1455 of yacc.c */
#line 1396 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_IN; ;}
break;
case 237:
+
+/* Line 1455 of yacc.c */
#line 1397 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PT; ;}
break;
case 238:
+
+/* Line 1455 of yacc.c */
#line 1398 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PC; ;}
break;
case 239:
+
+/* Line 1455 of yacc.c */
#line 1399 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_DEG; ;}
break;
case 240:
+
+/* Line 1455 of yacc.c */
#line 1400 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_RAD; ;}
break;
case 241:
+
+/* Line 1455 of yacc.c */
#line 1401 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_GRAD; ;}
break;
case 242:
+
+/* Line 1455 of yacc.c */
#line 1402 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_TURN; ;}
break;
case 243:
+
+/* Line 1455 of yacc.c */
#line 1403 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_MS; ;}
break;
case 244:
+
+/* Line 1455 of yacc.c */
#line 1404 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_S; ;}
break;
case 245:
+
+/* Line 1455 of yacc.c */
#line 1405 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_HZ; ;}
break;
case 246:
+
+/* Line 1455 of yacc.c */
#line 1406 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_KHZ; ;}
break;
case 247:
+
+/* Line 1455 of yacc.c */
#line 1407 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_EMS; ;}
break;
case 248:
+
+/* Line 1455 of yacc.c */
#line 1408 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSParserValue::Q_EMS; ;}
break;
case 249:
+
+/* Line 1455 of yacc.c */
#line 1409 "../css/CSSGrammar.y"
{ (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_EXS; ;}
break;
case 250:
+
+/* Line 1455 of yacc.c */
#line 1413 "../css/CSSGrammar.y"
{
(yyval.value).id = 0;
@@ -3800,6 +4140,8 @@ yyreduce:
break;
case 251:
+
+/* Line 1455 of yacc.c */
#line 1421 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -3813,6 +4155,8 @@ yyreduce:
break;
case 252:
+
+/* Line 1455 of yacc.c */
#line 1430 "../css/CSSGrammar.y"
{
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -3826,16 +4170,22 @@ yyreduce:
break;
case 253:
+
+/* Line 1455 of yacc.c */
#line 1446 "../css/CSSGrammar.y"
{ (yyval.string) = (yyvsp[(1) - (2)].string); ;}
break;
case 254:
+
+/* Line 1455 of yacc.c */
#line 1447 "../css/CSSGrammar.y"
{ (yyval.string) = (yyvsp[(1) - (2)].string); ;}
break;
case 255:
+
+/* Line 1455 of yacc.c */
#line 1454 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -3843,6 +4193,8 @@ yyreduce:
break;
case 256:
+
+/* Line 1455 of yacc.c */
#line 1457 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -3850,6 +4202,8 @@ yyreduce:
break;
case 257:
+
+/* Line 1455 of yacc.c */
#line 1463 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -3857,6 +4211,8 @@ yyreduce:
break;
case 258:
+
+/* Line 1455 of yacc.c */
#line 1466 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -3864,6 +4220,8 @@ yyreduce:
break;
case 261:
+
+/* Line 1455 of yacc.c */
#line 1477 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -3871,6 +4229,8 @@ yyreduce:
break;
case 262:
+
+/* Line 1455 of yacc.c */
#line 1483 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -3878,6 +4238,8 @@ yyreduce:
break;
case 263:
+
+/* Line 1455 of yacc.c */
#line 1489 "../css/CSSGrammar.y"
{
(yyval.rule) = 0;
@@ -3885,8 +4247,9 @@ yyreduce:
break;
-/* Line 1267 of yacc.c. */
-#line 3890 "WebCore/tmp/../generated/CSSGrammar.tab.c"
+
+/* Line 1455 of yacc.c */
+#line 4253 "WebCore/tmp/../generated/CSSGrammar.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -3897,7 +4260,6 @@ yyreduce:
*++yyvsp = yyval;
-
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -3962,7 +4324,7 @@ yyerrlab:
if (yyerrstatus == 3)
{
- /* If just tried and failed to reuse look-ahead token after an
+ /* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
@@ -3979,7 +4341,7 @@ yyerrlab:
}
}
- /* Else will try to reuse look-ahead token after shifting the error
+ /* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
@@ -4036,9 +4398,6 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
*++yyvsp = yylval;
@@ -4063,7 +4422,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -4074,7 +4433,7 @@ yyexhaustedlab:
#endif
yyreturn:
- if (yychar != YYEOF && yychar != YYEMPTY)
+ if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
/* Do not reclaim the symbols of the rule which action triggered
@@ -4100,6 +4459,8 @@ yyreturn:
}
+
+/* Line 1675 of yacc.c */
#line 1516 "../css/CSSGrammar.y"
diff --git a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h
index 61ba1f5..4223680 100644
--- a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h
+++ b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h
@@ -1,26 +1,25 @@
#ifndef CSSGRAMMAR_H
#define CSSGRAMMAR_H
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -31,10 +30,11 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -106,78 +106,16 @@
VARCALL = 319
};
#endif
-/* Tokens. */
-#define TOKEN_EOF 0
-#define LOWEST_PREC 258
-#define UNIMPORTANT_TOK 259
-#define WHITESPACE 260
-#define SGML_CD 261
-#define INCLUDES 262
-#define DASHMATCH 263
-#define BEGINSWITH 264
-#define ENDSWITH 265
-#define CONTAINS 266
-#define STRING 267
-#define IDENT 268
-#define NTH 269
-#define HEX 270
-#define IDSEL 271
-#define IMPORT_SYM 272
-#define PAGE_SYM 273
-#define MEDIA_SYM 274
-#define FONT_FACE_SYM 275
-#define CHARSET_SYM 276
-#define NAMESPACE_SYM 277
-#define WEBKIT_RULE_SYM 278
-#define WEBKIT_DECLS_SYM 279
-#define WEBKIT_KEYFRAME_RULE_SYM 280
-#define WEBKIT_KEYFRAMES_SYM 281
-#define WEBKIT_VALUE_SYM 282
-#define WEBKIT_MEDIAQUERY_SYM 283
-#define WEBKIT_SELECTOR_SYM 284
-#define WEBKIT_VARIABLES_SYM 285
-#define WEBKIT_DEFINE_SYM 286
-#define VARIABLES_FOR 287
-#define WEBKIT_VARIABLES_DECLS_SYM 288
-#define ATKEYWORD 289
-#define IMPORTANT_SYM 290
-#define MEDIA_ONLY 291
-#define MEDIA_NOT 292
-#define MEDIA_AND 293
-#define QEMS 294
-#define EMS 295
-#define EXS 296
-#define PXS 297
-#define CMS 298
-#define MMS 299
-#define INS 300
-#define PTS 301
-#define PCS 302
-#define DEGS 303
-#define RADS 304
-#define GRADS 305
-#define TURNS 306
-#define MSECS 307
-#define SECS 308
-#define HERZ 309
-#define KHERZ 310
-#define DIMEN 311
-#define PERCENTAGE 312
-#define FLOATTOKEN 313
-#define INTEGER 314
-#define URI 315
-#define FUNCTION 316
-#define NOTFUNCTION 317
-#define UNICODERANGE 318
-#define VARCALL 319
-
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 58 "../css/CSSGrammar.y"
{
+
+/* Line 1676 of yacc.c */
+#line 58 "../css/CSSGrammar.y"
+
bool boolean;
char character;
int integer;
@@ -199,15 +137,18 @@ typedef union YYSTYPE
WebKitCSSKeyframeRule* keyframeRule;
WebKitCSSKeyframesRule* keyframesRule;
float val;
-}
-/* Line 1489 of yacc.c. */
-#line 203 "WebCore/tmp/../generated/CSSGrammar.tab.h"
- YYSTYPE;
+
+
+
+/* Line 1676 of yacc.c */
+#line 143 "WebCore/tmp/../generated/CSSGrammar.tab.h"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
+
#endif
diff --git a/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c b/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c
index e84ca9e..6362110 100644
--- a/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c
+++ b/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c
@@ -84,6 +84,9 @@ hash_val (register const char *str, register unsigned int len)
switch (len)
{
default:
+ hval += asso_values[(unsigned char)str[30]];
+ /*FALLTHROUGH*/
+ case 30:
hval += asso_values[(unsigned char)str[29]];
/*FALLTHROUGH*/
case 29:
@@ -188,9 +191,9 @@ findValue (register const char *str, register unsigned int len)
{
enum
{
- TOTAL_KEYWORDS = 537,
+ TOTAL_KEYWORDS = 539,
MIN_WORD_LENGTH = 2,
- MAX_WORD_LENGTH = 30,
+ MAX_WORD_LENGTH = 31,
MIN_HASH_VALUE = 0,
MAX_HASH_VALUE = 8751
};
@@ -203,7 +206,7 @@ findValue (register const char *str, register unsigned int len)
{"300", CSSValue300},
#line 287 "CSSValueKeywords.gperf"
{"end", CSSValueEnd},
-#line 545 "CSSValueKeywords.gperf"
+#line 547 "CSSValueKeywords.gperf"
{"lr", CSSValueLr},
#line 48 "CSSValueKeywords.gperf"
{"900", CSSValue900},
@@ -211,7 +214,7 @@ findValue (register const char *str, register unsigned int len)
{"hide", CSSValueHide},
#line 47 "CSSValueKeywords.gperf"
{"800", CSSValue800},
-#line 369 "CSSValueKeywords.gperf"
+#line 371 "CSSValueKeywords.gperf"
{"lines", CSSValueLines},
#line 46 "CSSValueKeywords.gperf"
{"700", CSSValue700},
@@ -229,23 +232,23 @@ findValue (register const char *str, register unsigned int len)
{"circle", CSSValueCircle},
#line 43 "CSSValueKeywords.gperf"
{"400", CSSValue400},
-#line 463 "CSSValueKeywords.gperf"
+#line 465 "CSSValueKeywords.gperf"
{"linen", CSSValueLinen},
#line 41 "CSSValueKeywords.gperf"
{"200", CSSValue200},
-#line 479 "CSSValueKeywords.gperf"
+#line 481 "CSSValueKeywords.gperf"
{"oldlace", CSSValueOldlace},
#line 252 "CSSValueKeywords.gperf"
{"cross", CSSValueCross},
-#line 400 "CSSValueKeywords.gperf"
+#line 402 "CSSValueKeywords.gperf"
{"coral", CSSValueCoral},
#line 312 "CSSValueKeywords.gperf"
{"clip", CSSValueClip},
#line 13 "CSSValueKeywords.gperf"
{"none", CSSValueNone},
-#line 403 "CSSValueKeywords.gperf"
+#line 405 "CSSValueKeywords.gperf"
{"crimson", CSSValueCrimson},
-#line 547 "CSSValueKeywords.gperf"
+#line 549 "CSSValueKeywords.gperf"
{"tb", CSSValueTb},
#line 251 "CSSValueKeywords.gperf"
{"crop", CSSValueCrop},
@@ -255,7 +258,7 @@ findValue (register const char *str, register unsigned int len)
{"inline", CSSValueInline},
#line 176 "CSSValueKeywords.gperf"
{"armenian", CSSValueArmenian},
-#line 367 "CSSValueKeywords.gperf"
+#line 369 "CSSValueKeywords.gperf"
{"logical", CSSValueLogical},
#line 241 "CSSValueKeywords.gperf"
{"collapse", CSSValueCollapse},
@@ -271,13 +274,13 @@ findValue (register const char *str, register unsigned int len)
{"initial", CSSValueInitial},
#line 215 "CSSValueKeywords.gperf"
{"e-resize", CSSValueEResize},
-#line 546 "CSSValueKeywords.gperf"
+#line 548 "CSSValueKeywords.gperf"
{"rl", CSSValueRl},
#line 221 "CSSValueKeywords.gperf"
{"s-resize", CSSValueSResize},
-#line 375 "CSSValueKeywords.gperf"
+#line 377 "CSSValueKeywords.gperf"
{"linear", CSSValueLinear},
-#line 505 "CSSValueKeywords.gperf"
+#line 507 "CSSValueKeywords.gperf"
{"snow", CSSValueSnow},
#line 205 "CSSValueKeywords.gperf"
{"move", CSSValueMove},
@@ -287,29 +290,29 @@ findValue (register const char *str, register unsigned int len)
{"slow", CSSValueSlow},
#line 218 "CSSValueKeywords.gperf"
{"n-resize", CSSValueNResize},
-#line 509 "CSSValueKeywords.gperf"
+#line 511 "CSSValueKeywords.gperf"
{"thistle", CSSValueThistle},
-#line 455 "CSSValueKeywords.gperf"
+#line 457 "CSSValueKeywords.gperf"
{"lightsalmon", CSSValueLightsalmon},
-#line 399 "CSSValueKeywords.gperf"
+#line 401 "CSSValueKeywords.gperf"
{"chocolate", CSSValueChocolate},
#line 279 "CSSValueKeywords.gperf"
{"show", CSSValueShow},
#line 257 "CSSValueKeywords.gperf"
{"higher", CSSValueHigher},
-#line 520 "CSSValueKeywords.gperf"
+#line 522 "CSSValueKeywords.gperf"
{"srgb", CSSValueSrgb},
#line 187 "CSSValueKeywords.gperf"
{"compact", CSSValueCompact},
#line 309 "CSSValueKeywords.gperf"
{"ignore", CSSValueIgnore},
-#line 510 "CSSValueKeywords.gperf"
+#line 512 "CSSValueKeywords.gperf"
{"tomato", CSSValueTomato},
#line 90 "CSSValueKeywords.gperf"
{"white", CSSValueWhite},
#line 51 "CSSValueKeywords.gperf"
{"small", CSSValueSmall},
-#line 362 "CSSValueKeywords.gperf"
+#line 364 "CSSValueKeywords.gperf"
{"content", CSSValueContent},
#line 285 "CSSValueKeywords.gperf"
{"stretch", CSSValueStretch},
@@ -317,15 +320,15 @@ findValue (register const char *str, register unsigned int len)
{"maroon", CSSValueMaroon},
#line 293 "CSSValueKeywords.gperf"
{"single", CSSValueSingle},
-#line 374 "CSSValueKeywords.gperf"
+#line 376 "CSSValueKeywords.gperf"
{"ease", CSSValueEase},
#line 155 "CSSValueKeywords.gperf"
{"right", CSSValueRight},
-#line 496 "CSSValueKeywords.gperf"
+#line 498 "CSSValueKeywords.gperf"
{"salmon", CSSValueSalmon},
-#line 508 "CSSValueKeywords.gperf"
+#line 510 "CSSValueKeywords.gperf"
{"tan", CSSValueTan},
-#line 544 "CSSValueKeywords.gperf"
+#line 546 "CSSValueKeywords.gperf"
{"tb-rl", CSSValueTbRl},
#line 39 "CSSValueKeywords.gperf"
{"lighter", CSSValueLighter},
@@ -333,39 +336,39 @@ findValue (register const char *str, register unsigned int len)
{"crosshair", CSSValueCrosshair},
#line 59 "CSSValueKeywords.gperf"
{"wider", CSSValueWider},
-#line 351 "CSSValueKeywords.gperf"
+#line 353 "CSSValueKeywords.gperf"
{"caret", CSSValueCaret},
#line 189 "CSSValueKeywords.gperf"
{"table", CSSValueTable},
#line 332 "CSSValueKeywords.gperf"
{"listitem", CSSValueListitem},
-#line 475 "CSSValueKeywords.gperf"
+#line 477 "CSSValueKeywords.gperf"
{"mintcream", CSSValueMintcream},
#line 222 "CSSValueKeywords.gperf"
{"w-resize", CSSValueWResize},
-#line 542 "CSSValueKeywords.gperf"
+#line 544 "CSSValueKeywords.gperf"
{"lr-tb", CSSValueLrTb},
#line 179 "CSSValueKeywords.gperf"
{"hiragana", CSSValueHiragana},
#line 236 "CSSValueKeywords.gperf"
{"rtl", CSSValueRtl},
-#line 527 "CSSValueKeywords.gperf"
+#line 529 "CSSValueKeywords.gperf"
{"miter", CSSValueMiter},
-#line 448 "CSSValueKeywords.gperf"
+#line 450 "CSSValueKeywords.gperf"
{"lightcoral", CSSValueLightcoral},
-#line 440 "CSSValueKeywords.gperf"
+#line 442 "CSSValueKeywords.gperf"
{"indigo", CSSValueIndigo},
#line 243 "CSSValueKeywords.gperf"
{"absolute", CSSValueAbsolute},
#line 289 "CSSValueKeywords.gperf"
{"horizontal", CSSValueHorizontal},
-#line 404 "CSSValueKeywords.gperf"
+#line 406 "CSSValueKeywords.gperf"
{"cyan", CSSValueCyan},
#line 11 "CSSValueKeywords.gperf"
{"inherit", CSSValueInherit},
-#line 464 "CSSValueKeywords.gperf"
+#line 466 "CSSValueKeywords.gperf"
{"magenta", CSSValueMagenta},
-#line 516 "CSSValueKeywords.gperf"
+#line 518 "CSSValueKeywords.gperf"
{"nonzero", CSSValueNonzero},
#line 204 "CSSValueKeywords.gperf"
{"pointer", CSSValuePointer},
@@ -373,7 +376,7 @@ findValue (register const char *str, register unsigned int len)
{"underline", CSSValueUnderline},
#line 130 "CSSValueKeywords.gperf"
{"no-repeat", CSSValueNoRepeat},
-#line 387 "CSSValueKeywords.gperf"
+#line 389 "CSSValueKeywords.gperf"
{"aliceblue", CSSValueAliceblue},
#line 112 "CSSValueKeywords.gperf"
{"match", CSSValueMatch},
@@ -385,13 +388,13 @@ findValue (register const char *str, register unsigned int len)
{"ridge", CSSValueRidge},
#line 57 "CSSValueKeywords.gperf"
{"smaller", CSSValueSmaller},
-#line 395 "CSSValueKeywords.gperf"
+#line 397 "CSSValueKeywords.gperf"
{"brown", CSSValueBrown},
#line 230 "CSSValueKeywords.gperf"
{"wait", CSSValueWait},
#line 258 "CSSValueKeywords.gperf"
{"invert", CSSValueInvert},
-#line 540 "CSSValueKeywords.gperf"
+#line 542 "CSSValueKeywords.gperf"
{"no-change", CSSValueNoChange},
#line 32 "CSSValueKeywords.gperf"
{"italic", CSSValueItalic},
@@ -409,17 +412,17 @@ findValue (register const char *str, register unsigned int len)
{"intrinsic", CSSValueIntrinsic},
#line 317 "CSSValueKeywords.gperf"
{"wave", CSSValueWave},
-#line 501 "CSSValueKeywords.gperf"
+#line 503 "CSSValueKeywords.gperf"
{"skyblue", CSSValueSkyblue},
#line 302 "CSSValueKeywords.gperf"
{"infinite", CSSValueInfinite},
#line 280 "CSSValueKeywords.gperf"
{"static", CSSValueStatic},
-#line 462 "CSSValueKeywords.gperf"
+#line 464 "CSSValueKeywords.gperf"
{"limegreen", CSSValueLimegreen},
-#line 543 "CSSValueKeywords.gperf"
+#line 545 "CSSValueKeywords.gperf"
{"rl-tb", CSSValueRlTb},
-#line 447 "CSSValueKeywords.gperf"
+#line 449 "CSSValueKeywords.gperf"
{"lightblue", CSSValueLightblue},
#line 85 "CSSValueKeywords.gperf"
{"orange", CSSValueOrange},
@@ -429,23 +432,23 @@ findValue (register const char *str, register unsigned int len)
{"progress", CSSValueProgress},
#line 318 "CSSValueKeywords.gperf"
{"continuous", CSSValueContinuous},
-#line 385 "CSSValueKeywords.gperf"
+#line 387 "CSSValueKeywords.gperf"
{"fill", CSSValueFill},
#line 144 "CSSValueKeywords.gperf"
{"baseline", CSSValueBaseline},
-#line 538 "CSSValueKeywords.gperf"
+#line 540 "CSSValueKeywords.gperf"
{"mathematical", CSSValueMathematical},
#line 207 "CSSValueKeywords.gperf"
{"cell", CSSValueCell},
#line 273 "CSSValueKeywords.gperf"
{"pre", CSSValuePre},
-#line 452 "CSSValueKeywords.gperf"
+#line 454 "CSSValueKeywords.gperf"
{"lightgreen", CSSValueLightgreen},
-#line 460 "CSSValueKeywords.gperf"
+#line 462 "CSSValueKeywords.gperf"
{"lightsteelblue", CSSValueLightsteelblue},
-#line 456 "CSSValueKeywords.gperf"
+#line 458 "CSSValueKeywords.gperf"
{"lightseagreen", CSSValueLightseagreen},
-#line 500 "CSSValueKeywords.gperf"
+#line 502 "CSSValueKeywords.gperf"
{"sienna", CSSValueSienna},
#line 286 "CSSValueKeywords.gperf"
{"start", CSSValueStart},
@@ -465,11 +468,11 @@ findValue (register const char *str, register unsigned int len)
{"transparent", CSSValueTransparent},
#line 14 "CSSValueKeywords.gperf"
{"hidden", CSSValueHidden},
-#line 397 "CSSValueKeywords.gperf"
+#line 399 "CSSValueKeywords.gperf"
{"cadetblue", CSSValueCadetblue},
-#line 478 "CSSValueKeywords.gperf"
+#line 480 "CSSValueKeywords.gperf"
{"navajowhite", CSSValueNavajowhite},
-#line 502 "CSSValueKeywords.gperf"
+#line 504 "CSSValueKeywords.gperf"
{"slateblue", CSSValueSlateblue},
#line 308 "CSSValueKeywords.gperf"
{"element", CSSValueElement},
@@ -477,11 +480,11 @@ findValue (register const char *str, register unsigned int len)
{"level", CSSValueLevel},
#line 87 "CSSValueKeywords.gperf"
{"red", CSSValueRed},
-#line 494 "CSSValueKeywords.gperf"
+#line 496 "CSSValueKeywords.gperf"
{"royalblue", CSSValueRoyalblue},
#line 163 "CSSValueKeywords.gperf"
{"disc", CSSValueDisc},
-#line 433 "CSSValueKeywords.gperf"
+#line 435 "CSSValueKeywords.gperf"
{"ghostwhite", CSSValueGhostwhite},
#line 25 "CSSValueKeywords.gperf"
{"menu", CSSValueMenu},
@@ -491,37 +494,37 @@ findValue (register const char *str, register unsigned int len)
{"icon", CSSValueIcon},
#line 60 "CSSValueKeywords.gperf"
{"narrower", CSSValueNarrower},
-#line 484 "CSSValueKeywords.gperf"
+#line 486 "CSSValueKeywords.gperf"
{"palegreen", CSSValuePalegreen},
-#line 489 "CSSValueKeywords.gperf"
+#line 491 "CSSValueKeywords.gperf"
{"peru", CSSValuePeru},
#line 131 "CSSValueKeywords.gperf"
{"clear", CSSValueClear},
#line 52 "CSSValueKeywords.gperf"
{"medium", CSSValueMedium},
-#line 477 "CSSValueKeywords.gperf"
+#line 479 "CSSValueKeywords.gperf"
{"moccasin", CSSValueMoccasin},
#line 162 "CSSValueKeywords.gperf"
{"inside", CSSValueInside},
-#line 499 "CSSValueKeywords.gperf"
+#line 501 "CSSValueKeywords.gperf"
{"seashell", CSSValueSeashell},
-#line 513 "CSSValueKeywords.gperf"
+#line 515 "CSSValueKeywords.gperf"
{"wheat", CSSValueWheat},
#line 150 "CSSValueKeywords.gperf"
{"top", CSSValueTop},
#line 156 "CSSValueKeywords.gperf"
{"center", CSSValueCenter},
-#line 474 "CSSValueKeywords.gperf"
+#line 476 "CSSValueKeywords.gperf"
{"midnightblue", CSSValueMidnightblue},
-#line 532 "CSSValueKeywords.gperf"
+#line 534 "CSSValueKeywords.gperf"
{"central", CSSValueCentral},
#line 298 "CSSValueKeywords.gperf"
{"up", CSSValueUp},
-#line 521 "CSSValueKeywords.gperf"
+#line 523 "CSSValueKeywords.gperf"
{"linearrgb", CSSValueLinearrgb},
-#line 537 "CSSValueKeywords.gperf"
+#line 539 "CSSValueKeywords.gperf"
{"hanging", CSSValueHanging},
-#line 398 "CSSValueKeywords.gperf"
+#line 400 "CSSValueKeywords.gperf"
{"chartreuse", CSSValueChartreuse},
#line 80 "CSSValueKeywords.gperf"
{"green", CSSValueGreen},
@@ -529,13 +532,13 @@ findValue (register const char *str, register unsigned int len)
{"teal", CSSValueTeal},
#line 245 "CSSValueKeywords.gperf"
{"avoid", CSSValueAvoid},
-#line 372 "CSSValueKeywords.gperf"
+#line 374 "CSSValueKeywords.gperf"
{"flat", CSSValueFlat},
-#line 343 "CSSValueKeywords.gperf"
+#line 345 "CSSValueKeywords.gperf"
{"menulist", CSSValueMenulist},
#line 255 "CSSValueKeywords.gperf"
{"hand", CSSValueHand},
-#line 380 "CSSValueKeywords.gperf"
+#line 382 "CSSValueKeywords.gperf"
{"reset", CSSValueReset},
#line 175 "CSSValueKeywords.gperf"
{"hebrew", CSSValueHebrew},
@@ -545,11 +548,11 @@ findValue (register const char *str, register unsigned int len)
{"bold", CSSValueBold},
#line 154 "CSSValueKeywords.gperf"
{"left", CSSValueLeft},
-#line 528 "CSSValueKeywords.gperf"
+#line 530 "CSSValueKeywords.gperf"
{"bevel", CSSValueBevel},
-#line 439 "CSSValueKeywords.gperf"
+#line 441 "CSSValueKeywords.gperf"
{"indianred", CSSValueIndianred},
-#line 432 "CSSValueKeywords.gperf"
+#line 434 "CSSValueKeywords.gperf"
{"gainsboro", CSSValueGainsboro},
#line 322 "CSSValueKeywords.gperf"
{"space", CSSValueSpace},
@@ -567,17 +570,17 @@ findValue (register const char *str, register unsigned int len)
{"window", CSSValueWindow},
#line 271 "CSSValueKeywords.gperf"
{"overline", CSSValueOverline},
-#line 434 "CSSValueKeywords.gperf"
+#line 436 "CSSValueKeywords.gperf"
{"gold", CSSValueGold},
#line 211 "CSSValueKeywords.gperf"
{"no-drop", CSSValueNoDrop},
-#line 524 "CSSValueKeywords.gperf"
+#line 526 "CSSValueKeywords.gperf"
{"crispedges", CSSValueCrispedges},
-#line 384 "CSSValueKeywords.gperf"
+#line 386 "CSSValueKeywords.gperf"
{"painted", CSSValuePainted},
-#line 490 "CSSValueKeywords.gperf"
+#line 492 "CSSValueKeywords.gperf"
{"pink", CSSValuePink},
-#line 391 "CSSValueKeywords.gperf"
+#line 393 "CSSValueKeywords.gperf"
{"beige", CSSValueBeige},
#line 141 "CSSValueKeywords.gperf"
{"xor", CSSValueXor},
@@ -591,7 +594,7 @@ findValue (register const char *str, register unsigned int len)
{"mix", CSSValueMix},
#line 114 "CSSValueKeywords.gperf"
{"scrollbar", CSSValueScrollbar},
-#line 361 "CSSValueKeywords.gperf"
+#line 363 "CSSValueKeywords.gperf"
{"border", CSSValueBorder},
#line 38 "CSSValueKeywords.gperf"
{"bolder", CSSValueBolder},
@@ -599,41 +602,41 @@ findValue (register const char *str, register unsigned int len)
{"caption", CSSValueCaption},
#line 242 "CSSValueKeywords.gperf"
{"above", CSSValueAbove},
-#line 430 "CSSValueKeywords.gperf"
+#line 432 "CSSValueKeywords.gperf"
{"floralwhite", CSSValueFloralwhite},
-#line 507 "CSSValueKeywords.gperf"
+#line 509 "CSSValueKeywords.gperf"
{"steelblue", CSSValueSteelblue},
-#line 536 "CSSValueKeywords.gperf"
+#line 538 "CSSValueKeywords.gperf"
{"alphabetic", CSSValueAlphabetic},
#line 281 "CSSValueKeywords.gperf"
{"thick", CSSValueThick},
-#line 491 "CSSValueKeywords.gperf"
+#line 493 "CSSValueKeywords.gperf"
{"plum", CSSValuePlum},
-#line 402 "CSSValueKeywords.gperf"
+#line 404 "CSSValueKeywords.gperf"
{"cornsilk", CSSValueCornsilk},
#line 86 "CSSValueKeywords.gperf"
{"purple", CSSValuePurple},
-#line 386 "CSSValueKeywords.gperf"
+#line 388 "CSSValueKeywords.gperf"
{"stroke", CSSValueStroke},
#line 50 "CSSValueKeywords.gperf"
{"x-small", CSSValueXSmall},
#line 69 "CSSValueKeywords.gperf"
{"serif", CSSValueSerif},
-#line 392 "CSSValueKeywords.gperf"
+#line 394 "CSSValueKeywords.gperf"
{"bisque", CSSValueBisque},
-#line 466 "CSSValueKeywords.gperf"
+#line 468 "CSSValueKeywords.gperf"
{"mediumblue", CSSValueMediumblue},
-#line 431 "CSSValueKeywords.gperf"
+#line 433 "CSSValueKeywords.gperf"
{"forestgreen", CSSValueForestgreen},
-#line 535 "CSSValueKeywords.gperf"
+#line 537 "CSSValueKeywords.gperf"
{"ideographic", CSSValueIdeographic},
-#line 512 "CSSValueKeywords.gperf"
+#line 514 "CSSValueKeywords.gperf"
{"violet", CSSValueViolet},
#line 201 "CSSValueKeywords.gperf"
{"auto", CSSValueAuto},
-#line 390 "CSSValueKeywords.gperf"
+#line 392 "CSSValueKeywords.gperf"
{"azure", CSSValueAzure},
-#line 443 "CSSValueKeywords.gperf"
+#line 445 "CSSValueKeywords.gperf"
{"lavender", CSSValueLavender},
#line 75 "CSSValueKeywords.gperf"
{"aqua", CSSValueAqua},
@@ -641,23 +644,23 @@ findValue (register const char *str, register unsigned int len)
{"lower", CSSValueLower},
#line 237 "CSSValueKeywords.gperf"
{"capitalize", CSSValueCapitalize},
-#line 468 "CSSValueKeywords.gperf"
+#line 470 "CSSValueKeywords.gperf"
{"mediumpurple", CSSValueMediumpurple},
#line 88 "CSSValueKeywords.gperf"
{"silver", CSSValueSilver},
-#line 454 "CSSValueKeywords.gperf"
+#line 456 "CSSValueKeywords.gperf"
{"lightpink", CSSValueLightpink},
#line 297 "CSSValueKeywords.gperf"
{"ahead", CSSValueAhead},
-#line 363 "CSSValueKeywords.gperf"
+#line 365 "CSSValueKeywords.gperf"
{"padding", CSSValuePadding},
-#line 449 "CSSValueKeywords.gperf"
+#line 451 "CSSValueKeywords.gperf"
{"lightcyan", CSSValueLightcyan},
#line 248 "CSSValueKeywords.gperf"
{"blink", CSSValueBlink},
#line 239 "CSSValueKeywords.gperf"
{"lowercase", CSSValueLowercase},
-#line 498 "CSSValueKeywords.gperf"
+#line 500 "CSSValueKeywords.gperf"
{"seagreen", CSSValueSeagreen},
#line 294 "CSSValueKeywords.gperf"
{"multiple", CSSValueMultiple},
@@ -665,41 +668,41 @@ findValue (register const char *str, register unsigned int len)
{"blue", CSSValueBlue},
#line 184 "CSSValueKeywords.gperf"
{"block", CSSValueBlock},
-#line 469 "CSSValueKeywords.gperf"
+#line 471 "CSSValueKeywords.gperf"
{"mediumseagreen", CSSValueMediumseagreen},
-#line 470 "CSSValueKeywords.gperf"
+#line 472 "CSSValueKeywords.gperf"
{"mediumslateblue", CSSValueMediumslateblue},
-#line 514 "CSSValueKeywords.gperf"
+#line 516 "CSSValueKeywords.gperf"
{"whitesmoke", CSSValueWhitesmoke},
#line 18 "CSSValueKeywords.gperf"
{"outset", CSSValueOutset},
-#line 368 "CSSValueKeywords.gperf"
+#line 370 "CSSValueKeywords.gperf"
{"visual", CSSValueVisual},
#line 268 "CSSValueKeywords.gperf"
{"nowrap", CSSValueNowrap},
#line 232 "CSSValueKeywords.gperf"
{"all-scroll", CSSValueAllScroll},
-#line 438 "CSSValueKeywords.gperf"
+#line 440 "CSSValueKeywords.gperf"
{"hotpink", CSSValueHotpink},
#line 116 "CSSValueKeywords.gperf"
{"threedface", CSSValueThreedface},
-#line 481 "CSSValueKeywords.gperf"
+#line 483 "CSSValueKeywords.gperf"
{"orangered", CSSValueOrangered},
-#line 482 "CSSValueKeywords.gperf"
+#line 484 "CSSValueKeywords.gperf"
{"orchid", CSSValueOrchid},
#line 223 "CSSValueKeywords.gperf"
{"ew-resize", CSSValueEwResize},
#line 220 "CSSValueKeywords.gperf"
{"sw-resize", CSSValueSwResize},
-#line 388 "CSSValueKeywords.gperf"
+#line 390 "CSSValueKeywords.gperf"
{"antiquewhite", CSSValueAntiquewhite},
-#line 461 "CSSValueKeywords.gperf"
+#line 463 "CSSValueKeywords.gperf"
{"lightyellow", CSSValueLightyellow},
#line 16 "CSSValueKeywords.gperf"
{"groove", CSSValueGroove},
#line 185 "CSSValueKeywords.gperf"
{"list-item", CSSValueListItem},
-#line 401 "CSSValueKeywords.gperf"
+#line 403 "CSSValueKeywords.gperf"
{"cornflowerblue", CSSValueCornflowerblue},
#line 217 "CSSValueKeywords.gperf"
{"nw-resize", CSSValueNwResize},
@@ -717,35 +720,35 @@ findValue (register const char *str, register unsigned int len)
{"listbox", CSSValueListbox},
#line 197 "CSSValueKeywords.gperf"
{"table-cell", CSSValueTableCell},
-#line 376 "CSSValueKeywords.gperf"
+#line 378 "CSSValueKeywords.gperf"
{"ease-in", CSSValueEaseIn},
-#line 476 "CSSValueKeywords.gperf"
+#line 478 "CSSValueKeywords.gperf"
{"mistyrose", CSSValueMistyrose},
#line 83 "CSSValueKeywords.gperf"
{"navy", CSSValueNavy},
#line 76 "CSSValueKeywords.gperf"
{"black", CSSValueBlack},
-#line 495 "CSSValueKeywords.gperf"
+#line 497 "CSSValueKeywords.gperf"
{"saddlebrown", CSSValueSaddlebrown},
-#line 441 "CSSValueKeywords.gperf"
+#line 443 "CSSValueKeywords.gperf"
{"ivory", CSSValueIvory},
#line 227 "CSSValueKeywords.gperf"
{"col-resize", CSSValueColResize},
-#line 389 "CSSValueKeywords.gperf"
+#line 391 "CSSValueKeywords.gperf"
{"aquamarine", CSSValueAquamarine},
#line 54 "CSSValueKeywords.gperf"
{"x-large", CSSValueXLarge},
-#line 526 "CSSValueKeywords.gperf"
+#line 528 "CSSValueKeywords.gperf"
{"butt", CSSValueButt},
#line 111 "CSSValueKeywords.gperf"
{"infotext", CSSValueInfotext},
#line 190 "CSSValueKeywords.gperf"
{"inline-table", CSSValueInlineTable},
-#line 428 "CSSValueKeywords.gperf"
+#line 430 "CSSValueKeywords.gperf"
{"dodgerblue", CSSValueDodgerblue},
#line 127 "CSSValueKeywords.gperf"
{"repeat", CSSValueRepeat},
-#line 506 "CSSValueKeywords.gperf"
+#line 508 "CSSValueKeywords.gperf"
{"springgreen", CSSValueSpringgreen},
#line 278 "CSSValueKeywords.gperf"
{"separate", CSSValueSeparate},
@@ -765,33 +768,33 @@ findValue (register const char *str, register unsigned int len)
{"dotted", CSSValueDotted},
#line 124 "CSSValueKeywords.gperf"
{"currentcolor", CSSValueCurrentcolor},
-#line 525 "CSSValueKeywords.gperf"
+#line 527 "CSSValueKeywords.gperf"
{"geometricprecision", CSSValueGeometricprecision},
#line 295 "CSSValueKeywords.gperf"
{"forwards", CSSValueForwards},
-#line 519 "CSSValueKeywords.gperf"
+#line 521 "CSSValueKeywords.gperf"
{"new", CSSValueNew},
-#line 370 "CSSValueKeywords.gperf"
+#line 372 "CSSValueKeywords.gperf"
{"running", CSSValueRunning},
#line 119 "CSSValueKeywords.gperf"
{"threedshadow", CSSValueThreedshadow},
#line 20 "CSSValueKeywords.gperf"
{"dashed", CSSValueDashed},
-#line 377 "CSSValueKeywords.gperf"
+#line 379 "CSSValueKeywords.gperf"
{"ease-out", CSSValueEaseOut},
#line 198 "CSSValueKeywords.gperf"
{"table-caption", CSSValueTableCaption},
-#line 485 "CSSValueKeywords.gperf"
+#line 487 "CSSValueKeywords.gperf"
{"paleturquoise", CSSValuePaleturquoise},
-#line 379 "CSSValueKeywords.gperf"
+#line 381 "CSSValueKeywords.gperf"
{"document", CSSValueDocument},
#line 196 "CSSValueKeywords.gperf"
{"table-column", CSSValueTableColumn},
-#line 444 "CSSValueKeywords.gperf"
+#line 446 "CSSValueKeywords.gperf"
{"lavenderblush", CSSValueLavenderblush},
-#line 453 "CSSValueKeywords.gperf"
+#line 455 "CSSValueKeywords.gperf"
{"lightgrey", CSSValueLightgrey},
-#line 451 "CSSValueKeywords.gperf"
+#line 453 "CSSValueKeywords.gperf"
{"lightgray", CSSValueLightgray},
#line 181 "CSSValueKeywords.gperf"
{"hiragana-iroha", CSSValueHiraganaIroha},
@@ -799,7 +802,7 @@ findValue (register const char *str, register unsigned int len)
{"highlighttext", CSSValueHighlighttext},
#line 108 "CSSValueKeywords.gperf"
{"inactivecaption", CSSValueInactivecaption},
-#line 467 "CSSValueKeywords.gperf"
+#line 469 "CSSValueKeywords.gperf"
{"mediumorchid", CSSValueMediumorchid},
#line 194 "CSSValueKeywords.gperf"
{"table-row", CSSValueTableRow},
@@ -807,25 +810,25 @@ findValue (register const char *str, register unsigned int len)
{"windowframe", CSSValueWindowframe},
#line 299 "CSSValueKeywords.gperf"
{"down", CSSValueDown},
-#line 518 "CSSValueKeywords.gperf"
+#line 520 "CSSValueKeywords.gperf"
{"accumulate", CSSValueAccumulate},
#line 203 "CSSValueKeywords.gperf"
{"default", CSSValueDefault},
-#line 445 "CSSValueKeywords.gperf"
+#line 447 "CSSValueKeywords.gperf"
{"lawngreen", CSSValueLawngreen},
#line 262 "CSSValueKeywords.gperf"
{"loud", CSSValueLoud},
#line 274 "CSSValueKeywords.gperf"
{"pre-line", CSSValuePreLine},
-#line 459 "CSSValueKeywords.gperf"
+#line 461 "CSSValueKeywords.gperf"
{"lightslategrey", CSSValueLightslategrey},
-#line 458 "CSSValueKeywords.gperf"
+#line 460 "CSSValueKeywords.gperf"
{"lightslategray", CSSValueLightslategray},
#line 290 "CSSValueKeywords.gperf"
{"vertical", CSSValueVertical},
#line 238 "CSSValueKeywords.gperf"
{"uppercase", CSSValueUppercase},
-#line 522 "CSSValueKeywords.gperf"
+#line 524 "CSSValueKeywords.gperf"
{"optimizespeed", CSSValueOptimizespeed},
#line 229 "CSSValueKeywords.gperf"
{"text", CSSValueText},
@@ -835,17 +838,17 @@ findValue (register const char *str, register unsigned int len)
{"line-through", CSSValueLineThrough},
#line 132 "CSSValueKeywords.gperf"
{"copy", CSSValueCopy},
-#line 504 "CSSValueKeywords.gperf"
+#line 506 "CSSValueKeywords.gperf"
{"slategrey", CSSValueSlategrey},
-#line 503 "CSSValueKeywords.gperf"
+#line 505 "CSSValueKeywords.gperf"
{"slategray", CSSValueSlategray},
-#line 435 "CSSValueKeywords.gperf"
+#line 437 "CSSValueKeywords.gperf"
{"goldenrod", CSSValueGoldenrod},
-#line 471 "CSSValueKeywords.gperf"
+#line 473 "CSSValueKeywords.gperf"
{"mediumspringgreen", CSSValueMediumspringgreen},
-#line 446 "CSSValueKeywords.gperf"
+#line 448 "CSSValueKeywords.gperf"
{"lemonchiffon", CSSValueLemonchiffon},
-#line 393 "CSSValueKeywords.gperf"
+#line 395 "CSSValueKeywords.gperf"
{"blanchedalmond", CSSValueBlanchedalmond},
#line 125 "CSSValueKeywords.gperf"
{"grey", CSSValueGrey},
@@ -855,57 +858,57 @@ findValue (register const char *str, register unsigned int len)
{"decimal", CSSValueDecimal},
#line 113 "CSSValueKeywords.gperf"
{"menutext", CSSValueMenutext},
-#line 437 "CSSValueKeywords.gperf"
+#line 439 "CSSValueKeywords.gperf"
{"honeydew", CSSValueHoneydew},
#line 276 "CSSValueKeywords.gperf"
{"relative", CSSValueRelative},
#line 147 "CSSValueKeywords.gperf"
{"super", CSSValueSuper},
-#line 417 "CSSValueKeywords.gperf"
+#line 419 "CSSValueKeywords.gperf"
{"darksalmon", CSSValueDarksalmon},
-#line 360 "CSSValueKeywords.gperf"
+#line 362 "CSSValueKeywords.gperf"
{"round", CSSValueRound},
#line 72 "CSSValueKeywords.gperf"
{"fantasy", CSSValueFantasy},
-#line 465 "CSSValueKeywords.gperf"
+#line 467 "CSSValueKeywords.gperf"
{"mediumaquamarine", CSSValueMediumaquamarine},
-#line 493 "CSSValueKeywords.gperf"
+#line 495 "CSSValueKeywords.gperf"
{"rosybrown", CSSValueRosybrown},
-#line 371 "CSSValueKeywords.gperf"
+#line 373 "CSSValueKeywords.gperf"
{"paused", CSSValuePaused},
#line 22 "CSSValueKeywords.gperf"
{"double", CSSValueDouble},
#line 270 "CSSValueKeywords.gperf"
{"overlay", CSSValueOverlay},
-#line 358 "CSSValueKeywords.gperf"
+#line 360 "CSSValueKeywords.gperf"
{"textarea", CSSValueTextarea},
-#line 429 "CSSValueKeywords.gperf"
+#line 431 "CSSValueKeywords.gperf"
{"firebrick", CSSValueFirebrick},
-#line 382 "CSSValueKeywords.gperf"
+#line 384 "CSSValueKeywords.gperf"
{"visiblefill", CSSValueVisiblefill},
-#line 517 "CSSValueKeywords.gperf"
+#line 519 "CSSValueKeywords.gperf"
{"evenodd", CSSValueEvenodd},
#line 118 "CSSValueKeywords.gperf"
{"threedlightshadow", CSSValueThreedlightshadow},
#line 275 "CSSValueKeywords.gperf"
{"pre-wrap", CSSValuePreWrap},
-#line 511 "CSSValueKeywords.gperf"
+#line 513 "CSSValueKeywords.gperf"
{"turquoise", CSSValueTurquoise},
#line 70 "CSSValueKeywords.gperf"
{"sans-serif", CSSValueSansSerif},
#line 31 "CSSValueKeywords.gperf"
{"status-bar", CSSValueStatusBar},
-#line 483 "CSSValueKeywords.gperf"
+#line 485 "CSSValueKeywords.gperf"
{"palegoldenrod", CSSValuePalegoldenrod},
#line 244 "CSSValueKeywords.gperf"
{"always", CSSValueAlways},
-#line 436 "CSSValueKeywords.gperf"
+#line 438 "CSSValueKeywords.gperf"
{"greenyellow", CSSValueGreenyellow},
#line 250 "CSSValueKeywords.gperf"
{"close-quote", CSSValueCloseQuote},
-#line 480 "CSSValueKeywords.gperf"
+#line 482 "CSSValueKeywords.gperf"
{"olivedrab", CSSValueOlivedrab},
-#line 541 "CSSValueKeywords.gperf"
+#line 543 "CSSValueKeywords.gperf"
{"reset-size", CSSValueResetSize},
#line 212 "CSSValueKeywords.gperf"
{"not-allowed", CSSValueNotAllowed},
@@ -915,7 +918,7 @@ findValue (register const char *str, register unsigned int len)
{"buttonface", CSSValueButtonface},
#line 122 "CSSValueKeywords.gperf"
{"windowtext", CSSValueWindowtext},
-#line 472 "CSSValueKeywords.gperf"
+#line 474 "CSSValueKeywords.gperf"
{"mediumturquoise", CSSValueMediumturquoise},
#line 49 "CSSValueKeywords.gperf"
{"xx-small", CSSValueXxSmall},
@@ -923,53 +926,53 @@ findValue (register const char *str, register unsigned int len)
{"cursive", CSSValueCursive},
#line 266 "CSSValueKeywords.gperf"
{"no-close-quote", CSSValueNoCloseQuote},
-#line 427 "CSSValueKeywords.gperf"
+#line 429 "CSSValueKeywords.gperf"
{"dimgrey", CSSValueDimgrey},
-#line 426 "CSSValueKeywords.gperf"
+#line 428 "CSSValueKeywords.gperf"
{"dimgray", CSSValueDimgray},
-#line 488 "CSSValueKeywords.gperf"
+#line 490 "CSSValueKeywords.gperf"
{"peachpuff", CSSValuePeachpuff},
#line 225 "CSSValueKeywords.gperf"
{"nesw-resize", CSSValueNeswResize},
#line 267 "CSSValueKeywords.gperf"
{"no-open-quote", CSSValueNoOpenQuote},
-#line 539 "CSSValueKeywords.gperf"
+#line 541 "CSSValueKeywords.gperf"
{"use-script", CSSValueUseScript},
-#line 405 "CSSValueKeywords.gperf"
+#line 407 "CSSValueKeywords.gperf"
{"darkblue", CSSValueDarkblue},
#line 291 "CSSValueKeywords.gperf"
{"inline-axis", CSSValueInlineAxis},
-#line 352 "CSSValueKeywords.gperf"
+#line 354 "CSSValueKeywords.gperf"
{"searchfield", CSSValueSearchfield},
-#line 381 "CSSValueKeywords.gperf"
+#line 383 "CSSValueKeywords.gperf"
{"visiblepainted", CSSValueVisiblepainted},
#line 254 "CSSValueKeywords.gperf"
{"fixed", CSSValueFixed},
-#line 442 "CSSValueKeywords.gperf"
+#line 444 "CSSValueKeywords.gperf"
{"khaki", CSSValueKhaki},
-#line 412 "CSSValueKeywords.gperf"
+#line 414 "CSSValueKeywords.gperf"
{"darkmagenta", CSSValueDarkmagenta},
#line 103 "CSSValueKeywords.gperf"
{"captiontext", CSSValueCaptiontext},
-#line 515 "CSSValueKeywords.gperf"
+#line 517 "CSSValueKeywords.gperf"
{"yellowgreen", CSSValueYellowgreen},
-#line 486 "CSSValueKeywords.gperf"
+#line 488 "CSSValueKeywords.gperf"
{"palevioletred", CSSValuePalevioletred},
-#line 487 "CSSValueKeywords.gperf"
+#line 489 "CSSValueKeywords.gperf"
{"papayawhip", CSSValuePapayawhip},
-#line 492 "CSSValueKeywords.gperf"
+#line 494 "CSSValueKeywords.gperf"
{"powderblue", CSSValuePowderblue},
#line 78 "CSSValueKeywords.gperf"
{"fuchsia", CSSValueFuchsia},
-#line 409 "CSSValueKeywords.gperf"
+#line 411 "CSSValueKeywords.gperf"
{"darkgreen", CSSValueDarkgreen},
#line 100 "CSSValueKeywords.gperf"
{"buttonhighlight", CSSValueButtonhighlight},
-#line 418 "CSSValueKeywords.gperf"
+#line 420 "CSSValueKeywords.gperf"
{"darkseagreen", CSSValueDarkseagreen},
-#line 419 "CSSValueKeywords.gperf"
+#line 421 "CSSValueKeywords.gperf"
{"darkslateblue", CSSValueDarkslateblue},
-#line 414 "CSSValueKeywords.gperf"
+#line 416 "CSSValueKeywords.gperf"
{"darkorange", CSSValueDarkorange},
#line 186 "CSSValueKeywords.gperf"
{"run-in", CSSValueRunIn},
@@ -979,7 +982,7 @@ findValue (register const char *str, register unsigned int len)
{"buttonshadow", CSSValueButtonshadow},
#line 180 "CSSValueKeywords.gperf"
{"katakana", CSSValueKatakana},
-#line 347 "CSSValueKeywords.gperf"
+#line 349 "CSSValueKeywords.gperf"
{"slider-horizontal", CSSValueSliderHorizontal},
#line 134 "CSSValueKeywords.gperf"
{"source-in", CSSValueSourceIn},
@@ -987,41 +990,41 @@ findValue (register const char *str, register unsigned int len)
{"inline-block", CSSValueInlineBlock},
#line 172 "CSSValueKeywords.gperf"
{"lower-latin", CSSValueLowerLatin},
-#line 394 "CSSValueKeywords.gperf"
+#line 396 "CSSValueKeywords.gperf"
{"blueviolet", CSSValueBlueviolet},
#line 136 "CSSValueKeywords.gperf"
{"source-atop", CSSValueSourceAtop},
#line 226 "CSSValueKeywords.gperf"
{"nwse-resize", CSSValueNwseResize},
-#line 497 "CSSValueKeywords.gperf"
+#line 499 "CSSValueKeywords.gperf"
{"sandybrown", CSSValueSandybrown},
#line 208 "CSSValueKeywords.gperf"
{"context-menu", CSSValueContextMenu},
#line 168 "CSSValueKeywords.gperf"
{"lower-roman", CSSValueLowerRoman},
-#line 344 "CSSValueKeywords.gperf"
+#line 346 "CSSValueKeywords.gperf"
{"menulist-button", CSSValueMenulistButton},
#line 319 "CSSValueKeywords.gperf"
{"skip-white-space", CSSValueSkipWhiteSpace},
#line 55 "CSSValueKeywords.gperf"
{"xx-large", CSSValueXxLarge},
-#line 338 "CSSValueKeywords.gperf"
+#line 340 "CSSValueKeywords.gperf"
{"media-slider", CSSValueMediaSlider},
-#line 366 "CSSValueKeywords.gperf"
+#line 368 "CSSValueKeywords.gperf"
{"content-box", CSSValueContentBox},
-#line 457 "CSSValueKeywords.gperf"
+#line 459 "CSSValueKeywords.gperf"
{"lightskyblue", CSSValueLightskyblue},
#line 315 "CSSValueKeywords.gperf"
{"dot-dash", CSSValueDotDash},
-#line 531 "CSSValueKeywords.gperf"
+#line 533 "CSSValueKeywords.gperf"
{"after-edge", CSSValueAfterEdge},
#line 135 "CSSValueKeywords.gperf"
{"source-out", CSSValueSourceOut},
#line 228 "CSSValueKeywords.gperf"
{"row-resize", CSSValueRowResize},
-#line 383 "CSSValueKeywords.gperf"
+#line 385 "CSSValueKeywords.gperf"
{"visiblestroke", CSSValueVisiblestroke},
-#line 416 "CSSValueKeywords.gperf"
+#line 418 "CSSValueKeywords.gperf"
{"darkred", CSSValueDarkred},
#line 107 "CSSValueKeywords.gperf"
{"inactiveborder", CSSValueInactiveborder},
@@ -1029,15 +1032,15 @@ findValue (register const char *str, register unsigned int len)
{"buttontext", CSSValueButtontext},
#line 104 "CSSValueKeywords.gperf"
{"graytext", CSSValueGraytext},
-#line 378 "CSSValueKeywords.gperf"
+#line 380 "CSSValueKeywords.gperf"
{"ease-in-out", CSSValueEaseInOut},
#line 138 "CSSValueKeywords.gperf"
{"destination-in", CSSValueDestinationIn},
-#line 415 "CSSValueKeywords.gperf"
+#line 417 "CSSValueKeywords.gperf"
{"darkorchid", CSSValueDarkorchid},
#line 143 "CSSValueKeywords.gperf"
{"plus-lighter", CSSValuePlusLighter},
-#line 473 "CSSValueKeywords.gperf"
+#line 475 "CSSValueKeywords.gperf"
{"mediumvioletred", CSSValueMediumvioletred},
#line 97 "CSSValueKeywords.gperf"
{"appworkspace", CSSValueAppworkspace},
@@ -1051,7 +1054,7 @@ findValue (register const char *str, register unsigned int len)
{"push-button", CSSValuePushButton},
#line 320 "CSSValueKeywords.gperf"
{"break-all", CSSValueBreakAll},
-#line 529 "CSSValueKeywords.gperf"
+#line 531 "CSSValueKeywords.gperf"
{"optimizelegibility", CSSValueOptimizelegibility},
#line 109 "CSSValueKeywords.gperf"
{"inactivecaptiontext", CSSValueInactivecaptiontext},
@@ -1059,15 +1062,15 @@ findValue (register const char *str, register unsigned int len)
{"justify", CSSValueJustify},
#line 173 "CSSValueKeywords.gperf"
{"upper-alpha", CSSValueUpperAlpha},
-#line 349 "CSSValueKeywords.gperf"
+#line 351 "CSSValueKeywords.gperf"
{"sliderthumb-horizontal", CSSValueSliderthumbHorizontal},
-#line 424 "CSSValueKeywords.gperf"
+#line 426 "CSSValueKeywords.gperf"
{"deeppink", CSSValueDeeppink},
#line 139 "CSSValueKeywords.gperf"
{"destination-out", CSSValueDestinationOut},
#line 61 "CSSValueKeywords.gperf"
{"ultra-condensed", CSSValueUltraCondensed},
-#line 406 "CSSValueKeywords.gperf"
+#line 408 "CSSValueKeywords.gperf"
{"darkcyan", CSSValueDarkcyan},
#line 174 "CSSValueKeywords.gperf"
{"upper-latin", CSSValueUpperLatin},
@@ -1075,15 +1078,15 @@ findValue (register const char *str, register unsigned int len)
{"text-top", CSSValueTextTop},
#line 296 "CSSValueKeywords.gperf"
{"backwards", CSSValueBackwards},
-#line 423 "CSSValueKeywords.gperf"
+#line 425 "CSSValueKeywords.gperf"
{"darkviolet", CSSValueDarkviolet},
-#line 357 "CSSValueKeywords.gperf"
+#line 359 "CSSValueKeywords.gperf"
{"textfield", CSSValueTextfield},
#line 169 "CSSValueKeywords.gperf"
{"upper-roman", CSSValueUpperRoman},
#line 327 "CSSValueKeywords.gperf"
{"square-button", CSSValueSquareButton},
-#line 339 "CSSValueKeywords.gperf"
+#line 341 "CSSValueKeywords.gperf"
{"media-sliderthumb", CSSValueMediaSliderthumb},
#line 64 "CSSValueKeywords.gperf"
{"semi-condensed", CSSValueSemiCondensed},
@@ -1095,21 +1098,21 @@ findValue (register const char *str, register unsigned int len)
{"read-write", CSSValueReadWrite},
#line 95 "CSSValueKeywords.gperf"
{"activeborder", CSSValueActiveborder},
-#line 345 "CSSValueKeywords.gperf"
+#line 347 "CSSValueKeywords.gperf"
{"menulist-text", CSSValueMenulistText},
-#line 396 "CSSValueKeywords.gperf"
+#line 398 "CSSValueKeywords.gperf"
{"burlywood", CSSValueBurlywood},
-#line 523 "CSSValueKeywords.gperf"
+#line 525 "CSSValueKeywords.gperf"
{"optimizequality", CSSValueOptimizequality},
-#line 450 "CSSValueKeywords.gperf"
+#line 452 "CSSValueKeywords.gperf"
{"lightgoldenrodyellow", CSSValueLightgoldenrodyellow},
-#line 422 "CSSValueKeywords.gperf"
+#line 424 "CSSValueKeywords.gperf"
{"darkturquoise", CSSValueDarkturquoise},
-#line 530 "CSSValueKeywords.gperf"
+#line 532 "CSSValueKeywords.gperf"
{"before-edge", CSSValueBeforeEdge},
#line 26 "CSSValueKeywords.gperf"
{"message-box", CSSValueMessageBox},
-#line 348 "CSSValueKeywords.gperf"
+#line 350 "CSSValueKeywords.gperf"
{"slider-vertical", CSSValueSliderVertical},
#line 149 "CSSValueKeywords.gperf"
{"text-bottom", CSSValueTextBottom},
@@ -1119,15 +1122,13 @@ findValue (register const char *str, register unsigned int len)
{"cjk-ideographic", CSSValueCjkIdeographic},
#line 98 "CSSValueKeywords.gperf"
{"background", CSSValueBackground},
-#line 410 "CSSValueKeywords.gperf"
+#line 412 "CSSValueKeywords.gperf"
{"darkgrey", CSSValueDarkgrey},
#line 195 "CSSValueKeywords.gperf"
{"table-column-group", CSSValueTableColumnGroup},
-#line 408 "CSSValueKeywords.gperf"
+#line 410 "CSSValueKeywords.gperf"
{"darkgray", CSSValueDarkgray},
-#line 340 "CSSValueKeywords.gperf"
- {"media-timeline-container", CSSValueMediaTimelineContainer},
-#line 365 "CSSValueKeywords.gperf"
+#line 367 "CSSValueKeywords.gperf"
{"border-box", CSSValueBorderBox},
#line 330 "CSSValueKeywords.gperf"
{"default-button", CSSValueDefaultButton},
@@ -1137,17 +1138,17 @@ findValue (register const char *str, register unsigned int len)
{"bidi-override", CSSValueBidiOverride},
#line 115 "CSSValueKeywords.gperf"
{"threeddarkshadow", CSSValueThreeddarkshadow},
-#line 413 "CSSValueKeywords.gperf"
+#line 415 "CSSValueKeywords.gperf"
{"darkolivegreen", CSSValueDarkolivegreen},
#line 191 "CSSValueKeywords.gperf"
{"table-row-group", CSSValueTableRowGroup},
-#line 421 "CSSValueKeywords.gperf"
+#line 423 "CSSValueKeywords.gperf"
{"darkslategrey", CSSValueDarkslategrey},
-#line 420 "CSSValueKeywords.gperf"
+#line 422 "CSSValueKeywords.gperf"
{"darkslategray", CSSValueDarkslategray},
-#line 364 "CSSValueKeywords.gperf"
+#line 366 "CSSValueKeywords.gperf"
{"padding-box", CSSValuePaddingBox},
-#line 373 "CSSValueKeywords.gperf"
+#line 375 "CSSValueKeywords.gperf"
{"preserve-3d", CSSValuePreserve3d},
#line 133 "CSSValueKeywords.gperf"
{"source-over", CSSValueSourceOver},
@@ -1155,7 +1156,7 @@ findValue (register const char *str, register unsigned int len)
{"repeat-x", CSSValueRepeatX},
#line 334 "CSSValueKeywords.gperf"
{"media-mute-button", CSSValueMediaMuteButton},
-#line 407 "CSSValueKeywords.gperf"
+#line 409 "CSSValueKeywords.gperf"
{"darkgoldenrod", CSSValueDarkgoldenrod},
#line 129 "CSSValueKeywords.gperf"
{"repeat-y", CSSValueRepeatY},
@@ -1165,7 +1166,7 @@ findValue (register const char *str, register unsigned int len)
{"lower-greek", CSSValueLowerGreek},
#line 305 "CSSValueKeywords.gperf"
{"read-only", CSSValueReadOnly},
-#line 350 "CSSValueKeywords.gperf"
+#line 352 "CSSValueKeywords.gperf"
{"sliderthumb-vertical", CSSValueSliderthumbVertical},
#line 321 "CSSValueKeywords.gperf"
{"break-word", CSSValueBreakWord},
@@ -1173,7 +1174,7 @@ findValue (register const char *str, register unsigned int len)
{"extra-condensed", CSSValueExtraCondensed},
#line 329 "CSSValueKeywords.gperf"
{"button-bevel", CSSValueButtonBevel},
-#line 411 "CSSValueKeywords.gperf"
+#line 413 "CSSValueKeywords.gperf"
{"darkkhaki", CSSValueDarkkhaki},
#line 137 "CSSValueKeywords.gperf"
{"destination-over", CSSValueDestinationOver},
@@ -1189,13 +1190,15 @@ findValue (register const char *str, register unsigned int len)
{"semi-expanded", CSSValueSemiExpanded},
#line 142 "CSSValueKeywords.gperf"
{"plus-darker", CSSValuePlusDarker},
-#line 425 "CSSValueKeywords.gperf"
+#line 427 "CSSValueKeywords.gperf"
{"deepskyblue", CSSValueDeepskyblue},
#line 333 "CSSValueKeywords.gperf"
{"media-fullscreen-button", CSSValueMediaFullscreenButton},
-#line 353 "CSSValueKeywords.gperf"
+#line 355 "CSSValueKeywords.gperf"
{"searchfield-decoration", CSSValueSearchfieldDecoration},
-#line 346 "CSSValueKeywords.gperf"
+#line 338 "CSSValueKeywords.gperf"
+ {"media-rewind-button", CSSValueMediaRewindButton},
+#line 348 "CSSValueKeywords.gperf"
{"menulist-textfield", CSSValueMenulistTextfield},
#line 316 "CSSValueKeywords.gperf"
{"dot-dot-dash", CSSValueDotDotDash},
@@ -1203,9 +1206,9 @@ findValue (register const char *str, register unsigned int len)
{"media-play-button", CSSValueMediaPlayButton},
#line 67 "CSSValueKeywords.gperf"
{"extra-expanded", CSSValueExtraExpanded},
-#line 356 "CSSValueKeywords.gperf"
+#line 358 "CSSValueKeywords.gperf"
{"searchfield-cancel-button", CSSValueSearchfieldCancelButton},
-#line 359 "CSSValueKeywords.gperf"
+#line 361 "CSSValueKeywords.gperf"
{"caps-lock-indicator", CSSValueCapsLockIndicator},
#line 153 "CSSValueKeywords.gperf"
{"-webkit-auto", CSSValueWebkitAuto},
@@ -1215,21 +1218,23 @@ findValue (register const char *str, register unsigned int len)
{"decimal-leading-zero", CSSValueDecimalLeadingZero},
#line 30 "CSSValueKeywords.gperf"
{"-webkit-control", CSSValueWebkitControl},
-#line 355 "CSSValueKeywords.gperf"
+#line 357 "CSSValueKeywords.gperf"
{"searchfield-results-button", CSSValueSearchfieldResultsButton},
#line 284 "CSSValueKeywords.gperf"
{"-webkit-nowrap", CSSValueWebkitNowrap},
#line 159 "CSSValueKeywords.gperf"
{"-webkit-right", CSSValueWebkitRight},
-#line 534 "CSSValueKeywords.gperf"
+#line 342 "CSSValueKeywords.gperf"
+ {"media-controls-background", CSSValueMediaControlsBackground},
+#line 536 "CSSValueKeywords.gperf"
{"text-after-edge", CSSValueTextAfterEdge},
#line 158 "CSSValueKeywords.gperf"
{"-webkit-left", CSSValueWebkitLeft},
#line 233 "CSSValueKeywords.gperf"
{"-webkit-grab", CSSValueWebkitGrab},
-#line 533 "CSSValueKeywords.gperf"
+#line 535 "CSSValueKeywords.gperf"
{"text-before-edge", CSSValueTextBeforeEdge},
-#line 354 "CSSValueKeywords.gperf"
+#line 356 "CSSValueKeywords.gperf"
{"searchfield-results-decoration", CSSValueSearchfieldResultsDecoration},
#line 93 "CSSValueKeywords.gperf"
{"-webkit-link", CSSValueWebkitLink},
@@ -1243,14 +1248,16 @@ findValue (register const char *str, register unsigned int len)
{"-webkit-grabbing", CSSValueWebkitGrabbing},
#line 213 "CSSValueKeywords.gperf"
{"-webkit-zoom-in", CSSValueWebkitZoomIn},
-#line 342 "CSSValueKeywords.gperf"
+#line 344 "CSSValueKeywords.gperf"
{"media-time-remaining-display", CSSValueMediaTimeRemainingDisplay},
-#line 341 "CSSValueKeywords.gperf"
+#line 343 "CSSValueKeywords.gperf"
{"media-current-time-display", CSSValueMediaCurrentTimeDisplay},
#line 29 "CSSValueKeywords.gperf"
{"-webkit-small-control", CSSValueWebkitSmallControl},
#line 214 "CSSValueKeywords.gperf"
{"-webkit-zoom-out", CSSValueWebkitZoomOut},
+#line 339 "CSSValueKeywords.gperf"
+ {"media-return-to-realtime-button", CSSValueMediaReturnToRealtimeButton},
#line 28 "CSSValueKeywords.gperf"
{"-webkit-mini-control", CSSValueWebkitMiniControl},
#line 336 "CSSValueKeywords.gperf"
@@ -1584,72 +1591,71 @@ findValue (register const char *str, register unsigned int len)
-1, -1, 458, -1, -1, -1, -1, 459, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 460, 461, -1, -1, -1, 462, 463, -1, -1,
- 464, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 465, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 466, -1, -1, -1, -1, -1, -1, -1, -1,
- 467, 468, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 469, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 470, -1, -1, -1,
- -1, -1, 471, -1, -1, -1, -1, -1, -1, -1,
+ 464, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 465, -1, -1, -1, -1, -1, -1, -1, -1,
+ 466, 467, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 468, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 472, -1, -1, -1, -1, 473, -1, -1,
+ -1, -1, -1, -1, -1, -1, 469, -1, -1, -1,
+ -1, -1, 470, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 471, -1, -1, -1, -1, 472, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 474, -1, -1, -1, 475, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 473, -1, -1, -1, 474, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 476, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 477, -1, -1, -1, 478, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 475, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 476, -1, -1, -1, 477, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 479, 480, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 478, 479, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 481, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 482, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 480, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 481, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 483, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 484, -1, -1,
+ -1, -1, -1, -1, -1, -1, 482, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 485, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 483, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 484, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 486, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 485, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 487, -1, -1, -1, -1,
- -1, 488, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 489, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 486, -1, -1, -1, -1,
+ -1, 487, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 488, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 490, -1, -1, -1, -1,
- -1, 491, 492, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 489, -1, -1, -1, -1,
+ -1, 490, 491, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 493, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 492, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 494, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 493, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1657,26 +1663,27 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 495, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 494, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 496, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 495, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 497, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 498, -1, -1, -1, -1, -1, -1, -1, -1,
+ 496, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 497, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 498, -1, -1, -1, -1, -1, -1, -1, -1,
499, 500, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1789,14 +1796,14 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 511, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 511, -1, -1, -1, 512, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 512, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 513, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 513, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 514, -1, -1, -1, -1, -1, -1, -1, -1,
+ 514, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 515, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1806,10 +1813,10 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 515, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 516, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 516, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 517, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1832,7 +1839,7 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 517, 518, -1, -1, -1,
+ -1, -1, -1, -1, -1, 518, 519, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1842,46 +1849,46 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 519, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 520, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 520, -1, 521, -1, -1,
+ -1, -1, -1, -1, -1, 521, -1, 522, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 522, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 523, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 523, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 524, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 524, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 525, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 525, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 526, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 526, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 527, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 528, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 527, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 529, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 528, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 530, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1911,7 +1918,7 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 529, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 531, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1926,7 +1933,7 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 530, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 532, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1942,7 +1949,7 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 531, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 533, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1958,7 +1965,7 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 532, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 534, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1976,7 +1983,7 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 533, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 535, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1984,7 +1991,7 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 534, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 536, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -2065,7 +2072,7 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 535, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 537, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -2150,7 +2157,7 @@ findValue (register const char *str, register unsigned int len)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 536
+ -1, 538
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -2172,7 +2179,7 @@ findValue (register const char *str, register unsigned int len)
}
return 0;
}
-#line 548 "CSSValueKeywords.gperf"
+#line 550 "CSSValueKeywords.gperf"
static const char * const valueList[] = {
"",
@@ -2503,9 +2510,11 @@ static const char * const valueList[] = {
"media-play-button",
"media-seek-back-button",
"media-seek-forward-button",
+"media-rewind-button",
+"media-return-to-realtime-button",
"media-slider",
"media-sliderthumb",
-"media-timeline-container",
+"media-controls-background",
"media-current-time-display",
"media-time-remaining-display",
"menulist",
diff --git a/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.h b/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.h
index 8b6c669..b8f83c4 100644
--- a/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.h
+++ b/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.h
@@ -331,218 +331,220 @@ const int CSSValueMediaMuteButton = 324;
const int CSSValueMediaPlayButton = 325;
const int CSSValueMediaSeekBackButton = 326;
const int CSSValueMediaSeekForwardButton = 327;
-const int CSSValueMediaSlider = 328;
-const int CSSValueMediaSliderthumb = 329;
-const int CSSValueMediaTimelineContainer = 330;
-const int CSSValueMediaCurrentTimeDisplay = 331;
-const int CSSValueMediaTimeRemainingDisplay = 332;
-const int CSSValueMenulist = 333;
-const int CSSValueMenulistButton = 334;
-const int CSSValueMenulistText = 335;
-const int CSSValueMenulistTextfield = 336;
-const int CSSValueSliderHorizontal = 337;
-const int CSSValueSliderVertical = 338;
-const int CSSValueSliderthumbHorizontal = 339;
-const int CSSValueSliderthumbVertical = 340;
-const int CSSValueCaret = 341;
-const int CSSValueSearchfield = 342;
-const int CSSValueSearchfieldDecoration = 343;
-const int CSSValueSearchfieldResultsDecoration = 344;
-const int CSSValueSearchfieldResultsButton = 345;
-const int CSSValueSearchfieldCancelButton = 346;
-const int CSSValueTextfield = 347;
-const int CSSValueTextarea = 348;
-const int CSSValueCapsLockIndicator = 349;
-const int CSSValueRound = 350;
-const int CSSValueBorder = 351;
-const int CSSValueContent = 352;
-const int CSSValuePadding = 353;
-const int CSSValuePaddingBox = 354;
-const int CSSValueBorderBox = 355;
-const int CSSValueContentBox = 356;
-const int CSSValueLogical = 357;
-const int CSSValueVisual = 358;
-const int CSSValueLines = 359;
-const int CSSValueRunning = 360;
-const int CSSValuePaused = 361;
-const int CSSValueFlat = 362;
-const int CSSValuePreserve3d = 363;
-const int CSSValueEase = 364;
-const int CSSValueLinear = 365;
-const int CSSValueEaseIn = 366;
-const int CSSValueEaseOut = 367;
-const int CSSValueEaseInOut = 368;
-const int CSSValueDocument = 369;
-const int CSSValueReset = 370;
-const int CSSValueVisiblepainted = 371;
-const int CSSValueVisiblefill = 372;
-const int CSSValueVisiblestroke = 373;
-const int CSSValuePainted = 374;
-const int CSSValueFill = 375;
-const int CSSValueStroke = 376;
-const int CSSValueAliceblue = 377;
-const int CSSValueAntiquewhite = 378;
-const int CSSValueAquamarine = 379;
-const int CSSValueAzure = 380;
-const int CSSValueBeige = 381;
-const int CSSValueBisque = 382;
-const int CSSValueBlanchedalmond = 383;
-const int CSSValueBlueviolet = 384;
-const int CSSValueBrown = 385;
-const int CSSValueBurlywood = 386;
-const int CSSValueCadetblue = 387;
-const int CSSValueChartreuse = 388;
-const int CSSValueChocolate = 389;
-const int CSSValueCoral = 390;
-const int CSSValueCornflowerblue = 391;
-const int CSSValueCornsilk = 392;
-const int CSSValueCrimson = 393;
-const int CSSValueCyan = 394;
-const int CSSValueDarkblue = 395;
-const int CSSValueDarkcyan = 396;
-const int CSSValueDarkgoldenrod = 397;
-const int CSSValueDarkgray = 398;
-const int CSSValueDarkgreen = 399;
-const int CSSValueDarkgrey = 400;
-const int CSSValueDarkkhaki = 401;
-const int CSSValueDarkmagenta = 402;
-const int CSSValueDarkolivegreen = 403;
-const int CSSValueDarkorange = 404;
-const int CSSValueDarkorchid = 405;
-const int CSSValueDarkred = 406;
-const int CSSValueDarksalmon = 407;
-const int CSSValueDarkseagreen = 408;
-const int CSSValueDarkslateblue = 409;
-const int CSSValueDarkslategray = 410;
-const int CSSValueDarkslategrey = 411;
-const int CSSValueDarkturquoise = 412;
-const int CSSValueDarkviolet = 413;
-const int CSSValueDeeppink = 414;
-const int CSSValueDeepskyblue = 415;
-const int CSSValueDimgray = 416;
-const int CSSValueDimgrey = 417;
-const int CSSValueDodgerblue = 418;
-const int CSSValueFirebrick = 419;
-const int CSSValueFloralwhite = 420;
-const int CSSValueForestgreen = 421;
-const int CSSValueGainsboro = 422;
-const int CSSValueGhostwhite = 423;
-const int CSSValueGold = 424;
-const int CSSValueGoldenrod = 425;
-const int CSSValueGreenyellow = 426;
-const int CSSValueHoneydew = 427;
-const int CSSValueHotpink = 428;
-const int CSSValueIndianred = 429;
-const int CSSValueIndigo = 430;
-const int CSSValueIvory = 431;
-const int CSSValueKhaki = 432;
-const int CSSValueLavender = 433;
-const int CSSValueLavenderblush = 434;
-const int CSSValueLawngreen = 435;
-const int CSSValueLemonchiffon = 436;
-const int CSSValueLightblue = 437;
-const int CSSValueLightcoral = 438;
-const int CSSValueLightcyan = 439;
-const int CSSValueLightgoldenrodyellow = 440;
-const int CSSValueLightgray = 441;
-const int CSSValueLightgreen = 442;
-const int CSSValueLightgrey = 443;
-const int CSSValueLightpink = 444;
-const int CSSValueLightsalmon = 445;
-const int CSSValueLightseagreen = 446;
-const int CSSValueLightskyblue = 447;
-const int CSSValueLightslategray = 448;
-const int CSSValueLightslategrey = 449;
-const int CSSValueLightsteelblue = 450;
-const int CSSValueLightyellow = 451;
-const int CSSValueLimegreen = 452;
-const int CSSValueLinen = 453;
-const int CSSValueMagenta = 454;
-const int CSSValueMediumaquamarine = 455;
-const int CSSValueMediumblue = 456;
-const int CSSValueMediumorchid = 457;
-const int CSSValueMediumpurple = 458;
-const int CSSValueMediumseagreen = 459;
-const int CSSValueMediumslateblue = 460;
-const int CSSValueMediumspringgreen = 461;
-const int CSSValueMediumturquoise = 462;
-const int CSSValueMediumvioletred = 463;
-const int CSSValueMidnightblue = 464;
-const int CSSValueMintcream = 465;
-const int CSSValueMistyrose = 466;
-const int CSSValueMoccasin = 467;
-const int CSSValueNavajowhite = 468;
-const int CSSValueOldlace = 469;
-const int CSSValueOlivedrab = 470;
-const int CSSValueOrangered = 471;
-const int CSSValueOrchid = 472;
-const int CSSValuePalegoldenrod = 473;
-const int CSSValuePalegreen = 474;
-const int CSSValuePaleturquoise = 475;
-const int CSSValuePalevioletred = 476;
-const int CSSValuePapayawhip = 477;
-const int CSSValuePeachpuff = 478;
-const int CSSValuePeru = 479;
-const int CSSValuePink = 480;
-const int CSSValuePlum = 481;
-const int CSSValuePowderblue = 482;
-const int CSSValueRosybrown = 483;
-const int CSSValueRoyalblue = 484;
-const int CSSValueSaddlebrown = 485;
-const int CSSValueSalmon = 486;
-const int CSSValueSandybrown = 487;
-const int CSSValueSeagreen = 488;
-const int CSSValueSeashell = 489;
-const int CSSValueSienna = 490;
-const int CSSValueSkyblue = 491;
-const int CSSValueSlateblue = 492;
-const int CSSValueSlategray = 493;
-const int CSSValueSlategrey = 494;
-const int CSSValueSnow = 495;
-const int CSSValueSpringgreen = 496;
-const int CSSValueSteelblue = 497;
-const int CSSValueTan = 498;
-const int CSSValueThistle = 499;
-const int CSSValueTomato = 500;
-const int CSSValueTurquoise = 501;
-const int CSSValueViolet = 502;
-const int CSSValueWheat = 503;
-const int CSSValueWhitesmoke = 504;
-const int CSSValueYellowgreen = 505;
-const int CSSValueNonzero = 506;
-const int CSSValueEvenodd = 507;
-const int CSSValueAccumulate = 508;
-const int CSSValueNew = 509;
-const int CSSValueSrgb = 510;
-const int CSSValueLinearrgb = 511;
-const int CSSValueOptimizespeed = 512;
-const int CSSValueOptimizequality = 513;
-const int CSSValueCrispedges = 514;
-const int CSSValueGeometricprecision = 515;
-const int CSSValueButt = 516;
-const int CSSValueMiter = 517;
-const int CSSValueBevel = 518;
-const int CSSValueOptimizelegibility = 519;
-const int CSSValueBeforeEdge = 520;
-const int CSSValueAfterEdge = 521;
-const int CSSValueCentral = 522;
-const int CSSValueTextBeforeEdge = 523;
-const int CSSValueTextAfterEdge = 524;
-const int CSSValueIdeographic = 525;
-const int CSSValueAlphabetic = 526;
-const int CSSValueHanging = 527;
-const int CSSValueMathematical = 528;
-const int CSSValueUseScript = 529;
-const int CSSValueNoChange = 530;
-const int CSSValueResetSize = 531;
-const int CSSValueLrTb = 532;
-const int CSSValueRlTb = 533;
-const int CSSValueTbRl = 534;
-const int CSSValueLr = 535;
-const int CSSValueRl = 536;
-const int CSSValueTb = 537;
-const int numCSSValueKeywords = 538;
-const size_t maxCSSValueKeywordLength = 30;
+const int CSSValueMediaRewindButton = 328;
+const int CSSValueMediaReturnToRealtimeButton = 329;
+const int CSSValueMediaSlider = 330;
+const int CSSValueMediaSliderthumb = 331;
+const int CSSValueMediaControlsBackground = 332;
+const int CSSValueMediaCurrentTimeDisplay = 333;
+const int CSSValueMediaTimeRemainingDisplay = 334;
+const int CSSValueMenulist = 335;
+const int CSSValueMenulistButton = 336;
+const int CSSValueMenulistText = 337;
+const int CSSValueMenulistTextfield = 338;
+const int CSSValueSliderHorizontal = 339;
+const int CSSValueSliderVertical = 340;
+const int CSSValueSliderthumbHorizontal = 341;
+const int CSSValueSliderthumbVertical = 342;
+const int CSSValueCaret = 343;
+const int CSSValueSearchfield = 344;
+const int CSSValueSearchfieldDecoration = 345;
+const int CSSValueSearchfieldResultsDecoration = 346;
+const int CSSValueSearchfieldResultsButton = 347;
+const int CSSValueSearchfieldCancelButton = 348;
+const int CSSValueTextfield = 349;
+const int CSSValueTextarea = 350;
+const int CSSValueCapsLockIndicator = 351;
+const int CSSValueRound = 352;
+const int CSSValueBorder = 353;
+const int CSSValueContent = 354;
+const int CSSValuePadding = 355;
+const int CSSValuePaddingBox = 356;
+const int CSSValueBorderBox = 357;
+const int CSSValueContentBox = 358;
+const int CSSValueLogical = 359;
+const int CSSValueVisual = 360;
+const int CSSValueLines = 361;
+const int CSSValueRunning = 362;
+const int CSSValuePaused = 363;
+const int CSSValueFlat = 364;
+const int CSSValuePreserve3d = 365;
+const int CSSValueEase = 366;
+const int CSSValueLinear = 367;
+const int CSSValueEaseIn = 368;
+const int CSSValueEaseOut = 369;
+const int CSSValueEaseInOut = 370;
+const int CSSValueDocument = 371;
+const int CSSValueReset = 372;
+const int CSSValueVisiblepainted = 373;
+const int CSSValueVisiblefill = 374;
+const int CSSValueVisiblestroke = 375;
+const int CSSValuePainted = 376;
+const int CSSValueFill = 377;
+const int CSSValueStroke = 378;
+const int CSSValueAliceblue = 379;
+const int CSSValueAntiquewhite = 380;
+const int CSSValueAquamarine = 381;
+const int CSSValueAzure = 382;
+const int CSSValueBeige = 383;
+const int CSSValueBisque = 384;
+const int CSSValueBlanchedalmond = 385;
+const int CSSValueBlueviolet = 386;
+const int CSSValueBrown = 387;
+const int CSSValueBurlywood = 388;
+const int CSSValueCadetblue = 389;
+const int CSSValueChartreuse = 390;
+const int CSSValueChocolate = 391;
+const int CSSValueCoral = 392;
+const int CSSValueCornflowerblue = 393;
+const int CSSValueCornsilk = 394;
+const int CSSValueCrimson = 395;
+const int CSSValueCyan = 396;
+const int CSSValueDarkblue = 397;
+const int CSSValueDarkcyan = 398;
+const int CSSValueDarkgoldenrod = 399;
+const int CSSValueDarkgray = 400;
+const int CSSValueDarkgreen = 401;
+const int CSSValueDarkgrey = 402;
+const int CSSValueDarkkhaki = 403;
+const int CSSValueDarkmagenta = 404;
+const int CSSValueDarkolivegreen = 405;
+const int CSSValueDarkorange = 406;
+const int CSSValueDarkorchid = 407;
+const int CSSValueDarkred = 408;
+const int CSSValueDarksalmon = 409;
+const int CSSValueDarkseagreen = 410;
+const int CSSValueDarkslateblue = 411;
+const int CSSValueDarkslategray = 412;
+const int CSSValueDarkslategrey = 413;
+const int CSSValueDarkturquoise = 414;
+const int CSSValueDarkviolet = 415;
+const int CSSValueDeeppink = 416;
+const int CSSValueDeepskyblue = 417;
+const int CSSValueDimgray = 418;
+const int CSSValueDimgrey = 419;
+const int CSSValueDodgerblue = 420;
+const int CSSValueFirebrick = 421;
+const int CSSValueFloralwhite = 422;
+const int CSSValueForestgreen = 423;
+const int CSSValueGainsboro = 424;
+const int CSSValueGhostwhite = 425;
+const int CSSValueGold = 426;
+const int CSSValueGoldenrod = 427;
+const int CSSValueGreenyellow = 428;
+const int CSSValueHoneydew = 429;
+const int CSSValueHotpink = 430;
+const int CSSValueIndianred = 431;
+const int CSSValueIndigo = 432;
+const int CSSValueIvory = 433;
+const int CSSValueKhaki = 434;
+const int CSSValueLavender = 435;
+const int CSSValueLavenderblush = 436;
+const int CSSValueLawngreen = 437;
+const int CSSValueLemonchiffon = 438;
+const int CSSValueLightblue = 439;
+const int CSSValueLightcoral = 440;
+const int CSSValueLightcyan = 441;
+const int CSSValueLightgoldenrodyellow = 442;
+const int CSSValueLightgray = 443;
+const int CSSValueLightgreen = 444;
+const int CSSValueLightgrey = 445;
+const int CSSValueLightpink = 446;
+const int CSSValueLightsalmon = 447;
+const int CSSValueLightseagreen = 448;
+const int CSSValueLightskyblue = 449;
+const int CSSValueLightslategray = 450;
+const int CSSValueLightslategrey = 451;
+const int CSSValueLightsteelblue = 452;
+const int CSSValueLightyellow = 453;
+const int CSSValueLimegreen = 454;
+const int CSSValueLinen = 455;
+const int CSSValueMagenta = 456;
+const int CSSValueMediumaquamarine = 457;
+const int CSSValueMediumblue = 458;
+const int CSSValueMediumorchid = 459;
+const int CSSValueMediumpurple = 460;
+const int CSSValueMediumseagreen = 461;
+const int CSSValueMediumslateblue = 462;
+const int CSSValueMediumspringgreen = 463;
+const int CSSValueMediumturquoise = 464;
+const int CSSValueMediumvioletred = 465;
+const int CSSValueMidnightblue = 466;
+const int CSSValueMintcream = 467;
+const int CSSValueMistyrose = 468;
+const int CSSValueMoccasin = 469;
+const int CSSValueNavajowhite = 470;
+const int CSSValueOldlace = 471;
+const int CSSValueOlivedrab = 472;
+const int CSSValueOrangered = 473;
+const int CSSValueOrchid = 474;
+const int CSSValuePalegoldenrod = 475;
+const int CSSValuePalegreen = 476;
+const int CSSValuePaleturquoise = 477;
+const int CSSValuePalevioletred = 478;
+const int CSSValuePapayawhip = 479;
+const int CSSValuePeachpuff = 480;
+const int CSSValuePeru = 481;
+const int CSSValuePink = 482;
+const int CSSValuePlum = 483;
+const int CSSValuePowderblue = 484;
+const int CSSValueRosybrown = 485;
+const int CSSValueRoyalblue = 486;
+const int CSSValueSaddlebrown = 487;
+const int CSSValueSalmon = 488;
+const int CSSValueSandybrown = 489;
+const int CSSValueSeagreen = 490;
+const int CSSValueSeashell = 491;
+const int CSSValueSienna = 492;
+const int CSSValueSkyblue = 493;
+const int CSSValueSlateblue = 494;
+const int CSSValueSlategray = 495;
+const int CSSValueSlategrey = 496;
+const int CSSValueSnow = 497;
+const int CSSValueSpringgreen = 498;
+const int CSSValueSteelblue = 499;
+const int CSSValueTan = 500;
+const int CSSValueThistle = 501;
+const int CSSValueTomato = 502;
+const int CSSValueTurquoise = 503;
+const int CSSValueViolet = 504;
+const int CSSValueWheat = 505;
+const int CSSValueWhitesmoke = 506;
+const int CSSValueYellowgreen = 507;
+const int CSSValueNonzero = 508;
+const int CSSValueEvenodd = 509;
+const int CSSValueAccumulate = 510;
+const int CSSValueNew = 511;
+const int CSSValueSrgb = 512;
+const int CSSValueLinearrgb = 513;
+const int CSSValueOptimizespeed = 514;
+const int CSSValueOptimizequality = 515;
+const int CSSValueCrispedges = 516;
+const int CSSValueGeometricprecision = 517;
+const int CSSValueButt = 518;
+const int CSSValueMiter = 519;
+const int CSSValueBevel = 520;
+const int CSSValueOptimizelegibility = 521;
+const int CSSValueBeforeEdge = 522;
+const int CSSValueAfterEdge = 523;
+const int CSSValueCentral = 524;
+const int CSSValueTextBeforeEdge = 525;
+const int CSSValueTextAfterEdge = 526;
+const int CSSValueIdeographic = 527;
+const int CSSValueAlphabetic = 528;
+const int CSSValueHanging = 529;
+const int CSSValueMathematical = 530;
+const int CSSValueUseScript = 531;
+const int CSSValueNoChange = 532;
+const int CSSValueResetSize = 533;
+const int CSSValueLrTb = 534;
+const int CSSValueRlTb = 535;
+const int CSSValueTbRl = 536;
+const int CSSValueLr = 537;
+const int CSSValueRl = 538;
+const int CSSValueTb = 539;
+const int numCSSValueKeywords = 540;
+const size_t maxCSSValueKeywordLength = 31;
const char* getValueName(unsigned short id);
diff --git a/src/3rdparty/webkit/WebCore/generated/DatePrototype.lut.h b/src/3rdparty/webkit/WebCore/generated/DatePrototype.lut.h
index 3016f9e..507cf91 100644
--- a/src/3rdparty/webkit/WebCore/generated/DatePrototype.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/DatePrototype.lut.h
@@ -54,6 +54,6 @@ static const struct HashTableValue dateTableValues[47] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable dateTable =
+extern JSC_CONST_HASHTABLE HashTable dateTable =
{ 134, 127, dateTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/Grammar.cpp b/src/3rdparty/webkit/WebCore/generated/Grammar.cpp
index 4ad3078..d1a7a80 100644
--- a/src/3rdparty/webkit/WebCore/generated/Grammar.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/Grammar.cpp
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -47,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -55,159 +54,28 @@
/* Pure parsers. */
#define YYPURE 1
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
/* Using locations. */
#define YYLSP_NEEDED 1
/* Substitute the variable and function names. */
-#define yyparse jscyyparse
-#define yylex jscyylex
-#define yyerror jscyyerror
-#define yylval jscyylval
-#define yychar jscyychar
-#define yydebug jscyydebug
-#define yynerrs jscyynerrs
-#define yylloc jscyylloc
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- NULLTOKEN = 258,
- TRUETOKEN = 259,
- FALSETOKEN = 260,
- BREAK = 261,
- CASE = 262,
- DEFAULT = 263,
- FOR = 264,
- NEW = 265,
- VAR = 266,
- CONSTTOKEN = 267,
- CONTINUE = 268,
- FUNCTION = 269,
- RETURN = 270,
- VOIDTOKEN = 271,
- DELETETOKEN = 272,
- IF = 273,
- THISTOKEN = 274,
- DO = 275,
- WHILE = 276,
- INTOKEN = 277,
- INSTANCEOF = 278,
- TYPEOF = 279,
- SWITCH = 280,
- WITH = 281,
- RESERVED = 282,
- THROW = 283,
- TRY = 284,
- CATCH = 285,
- FINALLY = 286,
- DEBUGGER = 287,
- IF_WITHOUT_ELSE = 288,
- ELSE = 289,
- EQEQ = 290,
- NE = 291,
- STREQ = 292,
- STRNEQ = 293,
- LE = 294,
- GE = 295,
- OR = 296,
- AND = 297,
- PLUSPLUS = 298,
- MINUSMINUS = 299,
- LSHIFT = 300,
- RSHIFT = 301,
- URSHIFT = 302,
- PLUSEQUAL = 303,
- MINUSEQUAL = 304,
- MULTEQUAL = 305,
- DIVEQUAL = 306,
- LSHIFTEQUAL = 307,
- RSHIFTEQUAL = 308,
- URSHIFTEQUAL = 309,
- ANDEQUAL = 310,
- MODEQUAL = 311,
- XOREQUAL = 312,
- OREQUAL = 313,
- OPENBRACE = 314,
- CLOSEBRACE = 315,
- NUMBER = 316,
- IDENT = 317,
- STRING = 318,
- AUTOPLUSPLUS = 319,
- AUTOMINUSMINUS = 320
- };
-#endif
-/* Tokens. */
-#define NULLTOKEN 258
-#define TRUETOKEN 259
-#define FALSETOKEN 260
-#define BREAK 261
-#define CASE 262
-#define DEFAULT 263
-#define FOR 264
-#define NEW 265
-#define VAR 266
-#define CONSTTOKEN 267
-#define CONTINUE 268
-#define FUNCTION 269
-#define RETURN 270
-#define VOIDTOKEN 271
-#define DELETETOKEN 272
-#define IF 273
-#define THISTOKEN 274
-#define DO 275
-#define WHILE 276
-#define INTOKEN 277
-#define INSTANCEOF 278
-#define TYPEOF 279
-#define SWITCH 280
-#define WITH 281
-#define RESERVED 282
-#define THROW 283
-#define TRY 284
-#define CATCH 285
-#define FINALLY 286
-#define DEBUGGER 287
-#define IF_WITHOUT_ELSE 288
-#define ELSE 289
-#define EQEQ 290
-#define NE 291
-#define STREQ 292
-#define STRNEQ 293
-#define LE 294
-#define GE 295
-#define OR 296
-#define AND 297
-#define PLUSPLUS 298
-#define MINUSMINUS 299
-#define LSHIFT 300
-#define RSHIFT 301
-#define URSHIFT 302
-#define PLUSEQUAL 303
-#define MINUSEQUAL 304
-#define MULTEQUAL 305
-#define DIVEQUAL 306
-#define LSHIFTEQUAL 307
-#define RSHIFTEQUAL 308
-#define URSHIFTEQUAL 309
-#define ANDEQUAL 310
-#define MODEQUAL 311
-#define XOREQUAL 312
-#define OREQUAL 313
-#define OPENBRACE 314
-#define CLOSEBRACE 315
-#define NUMBER 316
-#define IDENT 317
-#define STRING 318
-#define AUTOPLUSPLUS 319
-#define AUTOMINUSMINUS 320
-
-
-
+#define yyparse jscyyparse
+#define yylex jscyylex
+#define yyerror jscyyerror
+#define yylval jscyylval
+#define yychar jscyychar
+#define yydebug jscyydebug
+#define yynerrs jscyynerrs
+#define yylloc jscyylloc
/* Copy the first part of user declarations. */
+
+/* Line 189 of yacc.c */
#line 3 "../../JavaScriptCore/parser/Grammar.y"
@@ -363,6 +231,9 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<D
+/* Line 189 of yacc.c */
+#line 236 "WebCore/tmp/../generated/Grammar.tab.c"
+
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -381,10 +252,88 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<D
# define YYTOKEN_TABLE 0
#endif
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ NULLTOKEN = 258,
+ TRUETOKEN = 259,
+ FALSETOKEN = 260,
+ BREAK = 261,
+ CASE = 262,
+ DEFAULT = 263,
+ FOR = 264,
+ NEW = 265,
+ VAR = 266,
+ CONSTTOKEN = 267,
+ CONTINUE = 268,
+ FUNCTION = 269,
+ RETURN = 270,
+ VOIDTOKEN = 271,
+ DELETETOKEN = 272,
+ IF = 273,
+ THISTOKEN = 274,
+ DO = 275,
+ WHILE = 276,
+ INTOKEN = 277,
+ INSTANCEOF = 278,
+ TYPEOF = 279,
+ SWITCH = 280,
+ WITH = 281,
+ RESERVED = 282,
+ THROW = 283,
+ TRY = 284,
+ CATCH = 285,
+ FINALLY = 286,
+ DEBUGGER = 287,
+ IF_WITHOUT_ELSE = 288,
+ ELSE = 289,
+ EQEQ = 290,
+ NE = 291,
+ STREQ = 292,
+ STRNEQ = 293,
+ LE = 294,
+ GE = 295,
+ OR = 296,
+ AND = 297,
+ PLUSPLUS = 298,
+ MINUSMINUS = 299,
+ LSHIFT = 300,
+ RSHIFT = 301,
+ URSHIFT = 302,
+ PLUSEQUAL = 303,
+ MINUSEQUAL = 304,
+ MULTEQUAL = 305,
+ DIVEQUAL = 306,
+ LSHIFTEQUAL = 307,
+ RSHIFTEQUAL = 308,
+ URSHIFTEQUAL = 309,
+ ANDEQUAL = 310,
+ MODEQUAL = 311,
+ XOREQUAL = 312,
+ OREQUAL = 313,
+ OPENBRACE = 314,
+ CLOSEBRACE = 315,
+ NUMBER = 316,
+ IDENT = 317,
+ STRING = 318,
+ AUTOPLUSPLUS = 319,
+ AUTOMINUSMINUS = 320
+ };
+#endif
+
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 157 "../../JavaScriptCore/parser/Grammar.y"
{
+
+/* Line 214 of yacc.c */
+#line 157 "../../JavaScriptCore/parser/Grammar.y"
+
int intValue;
double doubleValue;
Identifier* ident;
@@ -414,13 +363,15 @@ typedef union YYSTYPE
ParameterListInfo parameterList;
Operator op;
-}
-/* Line 187 of yacc.c. */
-#line 420 "WebCore/tmp/../generated/Grammar.tab.c"
- YYSTYPE;
+
+
+
+/* Line 214 of yacc.c */
+#line 371 "WebCore/tmp/../generated/Grammar.tab.c"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
@@ -440,8 +391,8 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
-/* Line 216 of yacc.c. */
-#line 445 "WebCore/tmp/../generated/Grammar.tab.c"
+/* Line 264 of yacc.c */
+#line 396 "WebCore/tmp/../generated/Grammar.tab.c"
#ifdef short
# undef short
@@ -516,14 +467,14 @@ typedef short int yytype_int16;
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
-YYID (int i)
+YYID (int yyi)
#else
static int
-YYID (i)
- int i;
+YYID (yyi)
+ int yyi;
#endif
{
- return i;
+ return yyi;
}
#endif
@@ -605,9 +556,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- YYLTYPE yyls;
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+ YYLTYPE yyls_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
@@ -642,12 +593,12 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
@@ -2361,17 +2312,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
-yy_stack_print (bottom, top)
- yytype_int16 *bottom;
- yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
- for (; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
YYFPRINTF (stderr, "\n");
}
@@ -2406,11 +2360,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule)
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
- fprintf (stderr, " $%d = ", yyi + 1);
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
, &(yylsp[(yyi + 1) - (yynrhs)]) );
- fprintf (stderr, "\n");
+ YYFPRINTF (stderr, "\n");
}
}
@@ -2692,10 +2646,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp)
break;
}
}
-
/* Prevent warnings from -Wmissing-prototypes. */
-
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
@@ -2714,10 +2666,9 @@ int yyparse ();
-
-/*----------.
-| yyparse. |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse. |
+`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -2741,88 +2692,97 @@ yyparse ()
#endif
#endif
{
- /* The look-ahead symbol. */
+/* The lookahead symbol. */
int yychar;
-/* The semantic value of the look-ahead symbol. */
+/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-/* Number of syntax errors so far. */
-int yynerrs;
-/* Location data for the look-ahead symbol. */
+/* Location data for the lookahead symbol. */
YYLTYPE yylloc;
- int yystate;
- int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
+ /* Number of syntax errors so far. */
+ int yynerrs;
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
+ /* The stacks and their tools:
+ `yyss': related to states.
+ `yyvs': related to semantic values.
+ `yyls': related to locations.
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss = yyssa;
- yytype_int16 *yyssp;
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
- /* The location stack. */
- YYLTYPE yylsa[YYINITDEPTH];
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
- /* The locations where the error started and ended. */
- YYLTYPE yyerror_range[2];
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+ /* The location stack. */
+ YYLTYPE yylsa[YYINITDEPTH];
+ YYLTYPE *yyls;
+ YYLTYPE *yylsp;
+
+ /* The locations where the error started and ended. */
+ YYLTYPE yyerror_range[2];
- YYSIZE_T yystacksize = YYINITDEPTH;
+ YYSIZE_T yystacksize;
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
YYLTYPE yyloc;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
+ yytoken = 0;
+ yyss = yyssa;
+ yyvs = yyvsa;
+ yyls = yylsa;
+ yystacksize = YYINITDEPTH;
+
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
+ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
-
yyssp = yyss;
yyvsp = yyvs;
yylsp = yyls;
+
#if YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1;
- yylloc.first_column = yylloc.last_column = 0;
+ yylloc.first_column = yylloc.last_column = 1;
#endif
goto yysetstate;
@@ -2861,6 +2821,7 @@ YYLTYPE yylloc;
&yyvs1, yysize * sizeof (*yyvsp),
&yyls1, yysize * sizeof (*yylsp),
&yystacksize);
+
yyls = yyls1;
yyss = yyss1;
yyvs = yyvs1;
@@ -2882,9 +2843,9 @@ YYLTYPE yylloc;
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
- YYSTACK_RELOCATE (yyls);
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
@@ -2905,6 +2866,9 @@ YYLTYPE yylloc;
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
goto yybackup;
/*-----------.
@@ -2913,16 +2877,16 @@ YYLTYPE yylloc;
yybackup:
/* Do appropriate processing given the current state. Read a
- look-ahead token if we need one and don't already have one. */
+ lookahead token if we need one and don't already have one. */
- /* First try to decide what to do without reference to look-ahead token. */
+ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
- /* Not known => get a look-ahead token if don't already have one. */
+ /* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
@@ -2954,20 +2918,16 @@ yybackup:
goto yyreduce;
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
- /* Shift the look-ahead token. */
+ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
- /* Discard the shifted token unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
@@ -3008,31 +2968,43 @@ yyreduce:
switch (yyn)
{
case 2:
+
+/* Line 1455 of yacc.c */
#line 290 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NullNode(GLOBAL_DATA), 0, 1); ;}
break;
case 3:
+
+/* Line 1455 of yacc.c */
#line 291 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, true), 0, 1); ;}
break;
case 4:
+
+/* Line 1455 of yacc.c */
#line 292 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, false), 0, 1); ;}
break;
case 5:
+
+/* Line 1455 of yacc.c */
#line 293 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, (yyvsp[(1) - (1)].doubleValue)), 0, 1); ;}
break;
case 6:
+
+/* Line 1455 of yacc.c */
#line 294 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)), 0, 1); ;}
break;
case 7:
+
+/* Line 1455 of yacc.c */
#line 295 "../../JavaScriptCore/parser/Grammar.y"
{
Lexer& l = *LEXER;
@@ -3046,6 +3018,8 @@ yyreduce:
break;
case 8:
+
+/* Line 1455 of yacc.c */
#line 304 "../../JavaScriptCore/parser/Grammar.y"
{
Lexer& l = *LEXER;
@@ -3059,26 +3033,36 @@ yyreduce:
break;
case 9:
+
+/* Line 1455 of yacc.c */
#line 316 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 10:
+
+/* Line 1455 of yacc.c */
#line 317 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 11:
+
+/* Line 1455 of yacc.c */
#line 318 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from((yyvsp[(1) - (3)].doubleValue))), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 12:
+
+/* Line 1455 of yacc.c */
#line 319 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.propertyNode) = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (7)].ident), *(yyvsp[(2) - (7)].ident), 0, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); if (!(yyval.propertyNode).m_node) YYABORT; ;}
break;
case 13:
+
+/* Line 1455 of yacc.c */
#line 321 "../../JavaScriptCore/parser/Grammar.y"
{
(yyval.propertyNode) = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (8)].ident), *(yyvsp[(2) - (8)].ident), (yyvsp[(4) - (8)].parameterList).m_node.head, (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line)), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0);
@@ -3091,6 +3075,8 @@ yyreduce:
break;
case 14:
+
+/* Line 1455 of yacc.c */
#line 332 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.propertyList).m_node.head = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].propertyNode).m_node);
(yyval.propertyList).m_node.tail = (yyval.propertyList).m_node.head;
@@ -3099,6 +3085,8 @@ yyreduce:
break;
case 15:
+
+/* Line 1455 of yacc.c */
#line 336 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.propertyList).m_node.head = (yyvsp[(1) - (3)].propertyList).m_node.head;
(yyval.propertyList).m_node.tail = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, (yyvsp[(3) - (3)].propertyNode).m_node, (yyvsp[(1) - (3)].propertyList).m_node.tail);
@@ -3107,51 +3095,71 @@ yyreduce:
break;
case 17:
+
+/* Line 1455 of yacc.c */
#line 344 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA), 0, 0); ;}
break;
case 18:
+
+/* Line 1455 of yacc.c */
#line 345 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (3)].propertyList).m_node.head), (yyvsp[(2) - (3)].propertyList).m_features, (yyvsp[(2) - (3)].propertyList).m_numConstants); ;}
break;
case 19:
+
+/* Line 1455 of yacc.c */
#line 347 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (4)].propertyList).m_node.head), (yyvsp[(2) - (4)].propertyList).m_features, (yyvsp[(2) - (4)].propertyList).m_numConstants); ;}
break;
case 20:
+
+/* Line 1455 of yacc.c */
#line 351 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ThisNode(GLOBAL_DATA), ThisFeature, 0); ;}
break;
case 23:
+
+/* Line 1455 of yacc.c */
#line 354 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), (yylsp[(1) - (1)]).first_column), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;}
break;
case 24:
+
+/* Line 1455 of yacc.c */
#line 355 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = (yyvsp[(2) - (3)].expressionNode); ;}
break;
case 25:
+
+/* Line 1455 of yacc.c */
#line 359 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].intValue)), 0, (yyvsp[(2) - (3)].intValue) ? 1 : 0); ;}
break;
case 26:
+
+/* Line 1455 of yacc.c */
#line 360 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].elementList).m_node.head), (yyvsp[(2) - (3)].elementList).m_features, (yyvsp[(2) - (3)].elementList).m_numConstants); ;}
break;
case 27:
+
+/* Line 1455 of yacc.c */
#line 361 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, (yyvsp[(4) - (5)].intValue), (yyvsp[(2) - (5)].elementList).m_node.head), (yyvsp[(2) - (5)].elementList).m_features, (yyvsp[(4) - (5)].intValue) ? (yyvsp[(2) - (5)].elementList).m_numConstants + 1 : (yyvsp[(2) - (5)].elementList).m_numConstants); ;}
break;
case 28:
+
+/* Line 1455 of yacc.c */
#line 365 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.elementList).m_node.head = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].intValue), (yyvsp[(2) - (2)].expressionNode).m_node);
(yyval.elementList).m_node.tail = (yyval.elementList).m_node.head;
@@ -3160,6 +3168,8 @@ yyreduce:
break;
case 29:
+
+/* Line 1455 of yacc.c */
#line 370 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.elementList).m_node.head = (yyvsp[(1) - (4)].elementList).m_node.head;
(yyval.elementList).m_node.tail = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, (yyvsp[(1) - (4)].elementList).m_node.tail, (yyvsp[(3) - (4)].intValue), (yyvsp[(4) - (4)].expressionNode).m_node);
@@ -3168,26 +3178,36 @@ yyreduce:
break;
case 30:
+
+/* Line 1455 of yacc.c */
#line 377 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.intValue) = 0; ;}
break;
case 32:
+
+/* Line 1455 of yacc.c */
#line 382 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.intValue) = 1; ;}
break;
case 33:
+
+/* Line 1455 of yacc.c */
#line 383 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.intValue) = (yyvsp[(1) - (2)].intValue) + 1; ;}
break;
case 35:
+
+/* Line 1455 of yacc.c */
#line 388 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>((yyvsp[(1) - (1)].funcExprNode).m_node, (yyvsp[(1) - (1)].funcExprNode).m_features, (yyvsp[(1) - (1)].funcExprNode).m_numConstants); ;}
break;
case 36:
+
+/* Line 1455 of yacc.c */
#line 389 "../../JavaScriptCore/parser/Grammar.y"
{ BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
@@ -3196,6 +3216,8 @@ yyreduce:
break;
case 37:
+
+/* Line 1455 of yacc.c */
#line 393 "../../JavaScriptCore/parser/Grammar.y"
{ DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3204,6 +3226,8 @@ yyreduce:
break;
case 38:
+
+/* Line 1455 of yacc.c */
#line 397 "../../JavaScriptCore/parser/Grammar.y"
{ NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3212,6 +3236,8 @@ yyreduce:
break;
case 40:
+
+/* Line 1455 of yacc.c */
#line 405 "../../JavaScriptCore/parser/Grammar.y"
{ BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
@@ -3220,6 +3246,8 @@ yyreduce:
break;
case 41:
+
+/* Line 1455 of yacc.c */
#line 409 "../../JavaScriptCore/parser/Grammar.y"
{ DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3228,6 +3256,8 @@ yyreduce:
break;
case 42:
+
+/* Line 1455 of yacc.c */
#line 413 "../../JavaScriptCore/parser/Grammar.y"
{ NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3236,6 +3266,8 @@ yyreduce:
break;
case 44:
+
+/* Line 1455 of yacc.c */
#line 421 "../../JavaScriptCore/parser/Grammar.y"
{ NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column);
@@ -3244,6 +3276,8 @@ yyreduce:
break;
case 46:
+
+/* Line 1455 of yacc.c */
#line 429 "../../JavaScriptCore/parser/Grammar.y"
{ NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column);
@@ -3252,16 +3286,22 @@ yyreduce:
break;
case 47:
+
+/* Line 1455 of yacc.c */
#line 436 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
break;
case 48:
+
+/* Line 1455 of yacc.c */
#line 437 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
break;
case 49:
+
+/* Line 1455 of yacc.c */
#line 438 "../../JavaScriptCore/parser/Grammar.y"
{ BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
@@ -3270,6 +3310,8 @@ yyreduce:
break;
case 50:
+
+/* Line 1455 of yacc.c */
#line 442 "../../JavaScriptCore/parser/Grammar.y"
{ DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3277,16 +3319,22 @@ yyreduce:
break;
case 51:
+
+/* Line 1455 of yacc.c */
#line 448 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
break;
case 52:
+
+/* Line 1455 of yacc.c */
#line 449 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
break;
case 53:
+
+/* Line 1455 of yacc.c */
#line 450 "../../JavaScriptCore/parser/Grammar.y"
{ BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
@@ -3295,6 +3343,8 @@ yyreduce:
break;
case 54:
+
+/* Line 1455 of yacc.c */
#line 454 "../../JavaScriptCore/parser/Grammar.y"
{ DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
@@ -3303,16 +3353,22 @@ yyreduce:
break;
case 55:
+
+/* Line 1455 of yacc.c */
#line 461 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.argumentsNode) = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA), 0, 0); ;}
break;
case 56:
+
+/* Line 1455 of yacc.c */
#line 462 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.argumentsNode) = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA, (yyvsp[(2) - (3)].argumentList).m_node.head), (yyvsp[(2) - (3)].argumentList).m_features, (yyvsp[(2) - (3)].argumentList).m_numConstants); ;}
break;
case 57:
+
+/* Line 1455 of yacc.c */
#line 466 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.argumentList).m_node.head = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].expressionNode).m_node);
(yyval.argumentList).m_node.tail = (yyval.argumentList).m_node.head;
@@ -3321,6 +3377,8 @@ yyreduce:
break;
case 58:
+
+/* Line 1455 of yacc.c */
#line 470 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.argumentList).m_node.head = (yyvsp[(1) - (3)].argumentList).m_node.head;
(yyval.argumentList).m_node.tail = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (3)].argumentList).m_node.tail, (yyvsp[(3) - (3)].expressionNode).m_node);
@@ -3329,181 +3387,253 @@ yyreduce:
break;
case 64:
+
+/* Line 1455 of yacc.c */
#line 488 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
break;
case 65:
+
+/* Line 1455 of yacc.c */
#line 489 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
break;
case 67:
+
+/* Line 1455 of yacc.c */
#line 494 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
break;
case 68:
+
+/* Line 1455 of yacc.c */
#line 495 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
break;
case 69:
+
+/* Line 1455 of yacc.c */
#line 499 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDeleteNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 70:
+
+/* Line 1455 of yacc.c */
#line 500 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) VoidNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants + 1); ;}
break;
case 71:
+
+/* Line 1455 of yacc.c */
#line 501 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 72:
+
+/* Line 1455 of yacc.c */
#line 502 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 73:
+
+/* Line 1455 of yacc.c */
#line 503 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 74:
+
+/* Line 1455 of yacc.c */
#line 504 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 75:
+
+/* Line 1455 of yacc.c */
#line 505 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 76:
+
+/* Line 1455 of yacc.c */
#line 506 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 77:
+
+/* Line 1455 of yacc.c */
#line 507 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 78:
+
+/* Line 1455 of yacc.c */
#line 508 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeBitwiseNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 79:
+
+/* Line 1455 of yacc.c */
#line 509 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 85:
+
+/* Line 1455 of yacc.c */
#line 523 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 86:
+
+/* Line 1455 of yacc.c */
#line 524 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 87:
+
+/* Line 1455 of yacc.c */
#line 525 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 89:
+
+/* Line 1455 of yacc.c */
#line 531 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 90:
+
+/* Line 1455 of yacc.c */
#line 533 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 91:
+
+/* Line 1455 of yacc.c */
#line 535 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 93:
+
+/* Line 1455 of yacc.c */
#line 540 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 94:
+
+/* Line 1455 of yacc.c */
#line 541 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 96:
+
+/* Line 1455 of yacc.c */
#line 547 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 97:
+
+/* Line 1455 of yacc.c */
#line 549 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 99:
+
+/* Line 1455 of yacc.c */
#line 554 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 100:
+
+/* Line 1455 of yacc.c */
#line 555 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 101:
+
+/* Line 1455 of yacc.c */
#line 556 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 103:
+
+/* Line 1455 of yacc.c */
#line 561 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 104:
+
+/* Line 1455 of yacc.c */
#line 562 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 105:
+
+/* Line 1455 of yacc.c */
#line 563 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 107:
+
+/* Line 1455 of yacc.c */
#line 568 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 108:
+
+/* Line 1455 of yacc.c */
#line 569 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 109:
+
+/* Line 1455 of yacc.c */
#line 570 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 110:
+
+/* Line 1455 of yacc.c */
#line 571 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 111:
+
+/* Line 1455 of yacc.c */
#line 572 "../../JavaScriptCore/parser/Grammar.y"
{ InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3511,6 +3641,8 @@ yyreduce:
break;
case 112:
+
+/* Line 1455 of yacc.c */
#line 575 "../../JavaScriptCore/parser/Grammar.y"
{ InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3518,26 +3650,36 @@ yyreduce:
break;
case 114:
+
+/* Line 1455 of yacc.c */
#line 582 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 115:
+
+/* Line 1455 of yacc.c */
#line 583 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 116:
+
+/* Line 1455 of yacc.c */
#line 584 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 117:
+
+/* Line 1455 of yacc.c */
#line 585 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 118:
+
+/* Line 1455 of yacc.c */
#line 587 "../../JavaScriptCore/parser/Grammar.y"
{ InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3545,26 +3687,36 @@ yyreduce:
break;
case 120:
+
+/* Line 1455 of yacc.c */
#line 594 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 121:
+
+/* Line 1455 of yacc.c */
#line 595 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 122:
+
+/* Line 1455 of yacc.c */
#line 596 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 123:
+
+/* Line 1455 of yacc.c */
#line 597 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 124:
+
+/* Line 1455 of yacc.c */
#line 599 "../../JavaScriptCore/parser/Grammar.y"
{ InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3572,6 +3724,8 @@ yyreduce:
break;
case 125:
+
+/* Line 1455 of yacc.c */
#line 603 "../../JavaScriptCore/parser/Grammar.y"
{ InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
@@ -3579,156 +3733,218 @@ yyreduce:
break;
case 127:
+
+/* Line 1455 of yacc.c */
#line 610 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 128:
+
+/* Line 1455 of yacc.c */
#line 611 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 129:
+
+/* Line 1455 of yacc.c */
#line 612 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 130:
+
+/* Line 1455 of yacc.c */
#line 613 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 132:
+
+/* Line 1455 of yacc.c */
#line 619 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 133:
+
+/* Line 1455 of yacc.c */
#line 621 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 134:
+
+/* Line 1455 of yacc.c */
#line 623 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 135:
+
+/* Line 1455 of yacc.c */
#line 625 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 137:
+
+/* Line 1455 of yacc.c */
#line 631 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 138:
+
+/* Line 1455 of yacc.c */
#line 632 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 139:
+
+/* Line 1455 of yacc.c */
#line 634 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 140:
+
+/* Line 1455 of yacc.c */
#line 636 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 142:
+
+/* Line 1455 of yacc.c */
#line 641 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 144:
+
+/* Line 1455 of yacc.c */
#line 647 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 146:
+
+/* Line 1455 of yacc.c */
#line 652 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 148:
+
+/* Line 1455 of yacc.c */
#line 657 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 150:
+
+/* Line 1455 of yacc.c */
#line 663 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 152:
+
+/* Line 1455 of yacc.c */
#line 669 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 154:
+
+/* Line 1455 of yacc.c */
#line 674 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 156:
+
+/* Line 1455 of yacc.c */
#line 680 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 158:
+
+/* Line 1455 of yacc.c */
#line 686 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 160:
+
+/* Line 1455 of yacc.c */
#line 691 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 162:
+
+/* Line 1455 of yacc.c */
#line 697 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 164:
+
+/* Line 1455 of yacc.c */
#line 703 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 166:
+
+/* Line 1455 of yacc.c */
#line 708 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 168:
+
+/* Line 1455 of yacc.c */
#line 714 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 170:
+
+/* Line 1455 of yacc.c */
#line 719 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 172:
+
+/* Line 1455 of yacc.c */
#line 725 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;}
break;
case 174:
+
+/* Line 1455 of yacc.c */
#line 731 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;}
break;
case 176:
+
+/* Line 1455 of yacc.c */
#line 737 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;}
break;
case 178:
+
+/* Line 1455 of yacc.c */
#line 743 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature,
(yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants);
@@ -3736,6 +3952,8 @@ yyreduce:
break;
case 180:
+
+/* Line 1455 of yacc.c */
#line 751 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature,
(yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants);
@@ -3743,6 +3961,8 @@ yyreduce:
break;
case 182:
+
+/* Line 1455 of yacc.c */
#line 759 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature,
(yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants);
@@ -3750,99 +3970,137 @@ yyreduce:
break;
case 183:
+
+/* Line 1455 of yacc.c */
#line 765 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpEqual; ;}
break;
case 184:
+
+/* Line 1455 of yacc.c */
#line 766 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpPlusEq; ;}
break;
case 185:
+
+/* Line 1455 of yacc.c */
#line 767 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpMinusEq; ;}
break;
case 186:
+
+/* Line 1455 of yacc.c */
#line 768 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpMultEq; ;}
break;
case 187:
+
+/* Line 1455 of yacc.c */
#line 769 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpDivEq; ;}
break;
case 188:
+
+/* Line 1455 of yacc.c */
#line 770 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpLShift; ;}
break;
case 189:
+
+/* Line 1455 of yacc.c */
#line 771 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpRShift; ;}
break;
case 190:
+
+/* Line 1455 of yacc.c */
#line 772 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpURShift; ;}
break;
case 191:
+
+/* Line 1455 of yacc.c */
#line 773 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpAndEq; ;}
break;
case 192:
+
+/* Line 1455 of yacc.c */
#line 774 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpXOrEq; ;}
break;
case 193:
+
+/* Line 1455 of yacc.c */
#line 775 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpOrEq; ;}
break;
case 194:
+
+/* Line 1455 of yacc.c */
#line 776 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.op) = OpModEq; ;}
break;
case 196:
+
+/* Line 1455 of yacc.c */
#line 781 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 198:
+
+/* Line 1455 of yacc.c */
#line 786 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 200:
+
+/* Line 1455 of yacc.c */
#line 791 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
break;
case 218:
+
+/* Line 1455 of yacc.c */
#line 815 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
break;
case 219:
+
+/* Line 1455 of yacc.c */
#line 817 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].sourceElements).m_node), (yyvsp[(2) - (3)].sourceElements).m_varDeclarations, (yyvsp[(2) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (3)].sourceElements).m_features, (yyvsp[(2) - (3)].sourceElements).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
break;
case 220:
+
+/* Line 1455 of yacc.c */
#line 822 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
break;
case 221:
+
+/* Line 1455 of yacc.c */
#line 824 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)]));
@@ -3850,6 +4108,8 @@ yyreduce:
break;
case 222:
+
+/* Line 1455 of yacc.c */
#line 830 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.varDeclList).m_node = 0;
(yyval.varDeclList).m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
@@ -3861,6 +4121,8 @@ yyreduce:
break;
case 223:
+
+/* Line 1455 of yacc.c */
#line 837 "../../JavaScriptCore/parser/Grammar.y"
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column);
@@ -3874,6 +4136,8 @@ yyreduce:
break;
case 224:
+
+/* Line 1455 of yacc.c */
#line 847 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node;
(yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations;
@@ -3885,6 +4149,8 @@ yyreduce:
break;
case 225:
+
+/* Line 1455 of yacc.c */
#line 855 "../../JavaScriptCore/parser/Grammar.y"
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column);
@@ -3898,6 +4164,8 @@ yyreduce:
break;
case 226:
+
+/* Line 1455 of yacc.c */
#line 867 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.varDeclList).m_node = 0;
(yyval.varDeclList).m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
@@ -3909,6 +4177,8 @@ yyreduce:
break;
case 227:
+
+/* Line 1455 of yacc.c */
#line 874 "../../JavaScriptCore/parser/Grammar.y"
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column);
@@ -3922,6 +4192,8 @@ yyreduce:
break;
case 228:
+
+/* Line 1455 of yacc.c */
#line 884 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node;
(yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations;
@@ -3933,6 +4205,8 @@ yyreduce:
break;
case 229:
+
+/* Line 1455 of yacc.c */
#line 892 "../../JavaScriptCore/parser/Grammar.y"
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature);
SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column);
@@ -3946,18 +4220,24 @@ yyreduce:
break;
case 230:
+
+/* Line 1455 of yacc.c */
#line 904 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
break;
case 231:
+
+/* Line 1455 of yacc.c */
#line 907 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;}
break;
case 232:
+
+/* Line 1455 of yacc.c */
#line 912 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.constDeclList).m_node.head = (yyvsp[(1) - (1)].constDeclNode).m_node;
(yyval.constDeclList).m_node.tail = (yyval.constDeclList).m_node.head;
@@ -3970,6 +4250,8 @@ yyreduce:
break;
case 233:
+
+/* Line 1455 of yacc.c */
#line 921 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.constDeclList).m_node.head = (yyvsp[(1) - (3)].constDeclList).m_node.head;
(yyvsp[(1) - (3)].constDeclList).m_node.tail->m_next = (yyvsp[(3) - (3)].constDeclNode).m_node;
@@ -3982,49 +4264,67 @@ yyreduce:
break;
case 234:
+
+/* Line 1455 of yacc.c */
#line 932 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.constDeclNode) = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), 0), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;}
break;
case 235:
+
+/* Line 1455 of yacc.c */
#line 933 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.constDeclNode) = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node), ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
break;
case 236:
+
+/* Line 1455 of yacc.c */
#line 937 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;}
break;
case 237:
+
+/* Line 1455 of yacc.c */
#line 941 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;}
break;
case 238:
+
+/* Line 1455 of yacc.c */
#line 945 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); ;}
break;
case 239:
+
+/* Line 1455 of yacc.c */
#line 949 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
break;
case 240:
+
+/* Line 1455 of yacc.c */
#line 951 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;}
break;
case 241:
+
+/* Line 1455 of yacc.c */
#line 957 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;}
break;
case 242:
+
+/* Line 1455 of yacc.c */
#line 960 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].statementNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node),
mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations),
@@ -4035,24 +4335,32 @@ yyreduce:
break;
case 243:
+
+/* Line 1455 of yacc.c */
#line 969 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;}
break;
case 244:
+
+/* Line 1455 of yacc.c */
#line 971 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;}
break;
case 245:
+
+/* Line 1455 of yacc.c */
#line 973 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WhileNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;}
break;
case 246:
+
+/* Line 1455 of yacc.c */
#line 976 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, (yyvsp[(3) - (9)].expressionNode).m_node, (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, false), (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations,
(yyvsp[(3) - (9)].expressionNode).m_features | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features,
@@ -4062,6 +4370,8 @@ yyreduce:
break;
case 247:
+
+/* Line 1455 of yacc.c */
#line 982 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, (yyvsp[(4) - (10)].varDeclList).m_node, (yyvsp[(6) - (10)].expressionNode).m_node, (yyvsp[(8) - (10)].expressionNode).m_node, (yyvsp[(10) - (10)].statementNode).m_node, true),
mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_varDeclarations, (yyvsp[(10) - (10)].statementNode).m_varDeclarations),
@@ -4072,6 +4382,8 @@ yyreduce:
break;
case 248:
+
+/* Line 1455 of yacc.c */
#line 989 "../../JavaScriptCore/parser/Grammar.y"
{
ForInNode* node = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node);
@@ -4084,6 +4396,8 @@ yyreduce:
break;
case 249:
+
+/* Line 1455 of yacc.c */
#line 998 "../../JavaScriptCore/parser/Grammar.y"
{ ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (8)].ident), 0, (yyvsp[(6) - (8)].expressionNode).m_node, (yyvsp[(8) - (8)].statementNode).m_node, (yylsp[(5) - (8)]).first_column, (yylsp[(5) - (8)]).first_column - (yylsp[(4) - (8)]).first_column, (yylsp[(6) - (8)]).last_column - (yylsp[(5) - (8)]).first_column);
SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (8)]).first_column, (yylsp[(5) - (8)]).first_column + 1, (yylsp[(6) - (8)]).last_column);
@@ -4093,6 +4407,8 @@ yyreduce:
break;
case 250:
+
+/* Line 1455 of yacc.c */
#line 1004 "../../JavaScriptCore/parser/Grammar.y"
{ ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (9)].ident), (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, (yylsp[(5) - (9)]).first_column, (yylsp[(5) - (9)]).first_column - (yylsp[(4) - (9)]).first_column, (yylsp[(5) - (9)]).last_column - (yylsp[(5) - (9)]).first_column);
SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (9)]).first_column, (yylsp[(6) - (9)]).first_column + 1, (yylsp[(7) - (9)]).last_column);
@@ -4104,16 +4420,22 @@ yyreduce:
break;
case 251:
+
+/* Line 1455 of yacc.c */
#line 1014 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(0, 0, 0); ;}
break;
case 253:
+
+/* Line 1455 of yacc.c */
#line 1019 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(0, 0, 0); ;}
break;
case 255:
+
+/* Line 1455 of yacc.c */
#line 1024 "../../JavaScriptCore/parser/Grammar.y"
{ ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4122,6 +4444,8 @@ yyreduce:
break;
case 256:
+
+/* Line 1455 of yacc.c */
#line 1028 "../../JavaScriptCore/parser/Grammar.y"
{ ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4130,6 +4454,8 @@ yyreduce:
break;
case 257:
+
+/* Line 1455 of yacc.c */
#line 1032 "../../JavaScriptCore/parser/Grammar.y"
{ ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4138,6 +4464,8 @@ yyreduce:
break;
case 258:
+
+/* Line 1455 of yacc.c */
#line 1036 "../../JavaScriptCore/parser/Grammar.y"
{ ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4146,6 +4474,8 @@ yyreduce:
break;
case 259:
+
+/* Line 1455 of yacc.c */
#line 1043 "../../JavaScriptCore/parser/Grammar.y"
{ BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4153,6 +4483,8 @@ yyreduce:
break;
case 260:
+
+/* Line 1455 of yacc.c */
#line 1046 "../../JavaScriptCore/parser/Grammar.y"
{ BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4160,6 +4492,8 @@ yyreduce:
break;
case 261:
+
+/* Line 1455 of yacc.c */
#line 1049 "../../JavaScriptCore/parser/Grammar.y"
{ BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4167,6 +4501,8 @@ yyreduce:
break;
case 262:
+
+/* Line 1455 of yacc.c */
#line 1052 "../../JavaScriptCore/parser/Grammar.y"
{ BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4174,6 +4510,8 @@ yyreduce:
break;
case 263:
+
+/* Line 1455 of yacc.c */
#line 1058 "../../JavaScriptCore/parser/Grammar.y"
{ ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4181,6 +4519,8 @@ yyreduce:
break;
case 264:
+
+/* Line 1455 of yacc.c */
#line 1061 "../../JavaScriptCore/parser/Grammar.y"
{ ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
@@ -4188,6 +4528,8 @@ yyreduce:
break;
case 265:
+
+/* Line 1455 of yacc.c */
#line 1064 "../../JavaScriptCore/parser/Grammar.y"
{ ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4195,6 +4537,8 @@ yyreduce:
break;
case 266:
+
+/* Line 1455 of yacc.c */
#line 1067 "../../JavaScriptCore/parser/Grammar.y"
{ ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4202,6 +4546,8 @@ yyreduce:
break;
case 267:
+
+/* Line 1455 of yacc.c */
#line 1073 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WithNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node, (yylsp[(3) - (5)]).last_column, (yylsp[(3) - (5)]).last_column - (yylsp[(3) - (5)]).first_column),
(yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features | WithFeature, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants);
@@ -4209,6 +4555,8 @@ yyreduce:
break;
case 268:
+
+/* Line 1455 of yacc.c */
#line 1079 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) SwitchNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].caseBlockNode).m_node), (yyvsp[(5) - (5)].caseBlockNode).m_varDeclarations, (yyvsp[(5) - (5)].caseBlockNode).m_funcDeclarations,
(yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].caseBlockNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].caseBlockNode).m_numConstants);
@@ -4216,11 +4564,15 @@ yyreduce:
break;
case 269:
+
+/* Line 1455 of yacc.c */
#line 1085 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.caseBlockNode) = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].clauseList).m_node.head, 0, 0), (yyvsp[(2) - (3)].clauseList).m_varDeclarations, (yyvsp[(2) - (3)].clauseList).m_funcDeclarations, (yyvsp[(2) - (3)].clauseList).m_features, (yyvsp[(2) - (3)].clauseList).m_numConstants); ;}
break;
case 270:
+
+/* Line 1455 of yacc.c */
#line 1087 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.caseBlockNode) = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (5)].clauseList).m_node.head, (yyvsp[(3) - (5)].caseClauseNode).m_node, (yyvsp[(4) - (5)].clauseList).m_node.head),
mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_varDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_varDeclarations), (yyvsp[(4) - (5)].clauseList).m_varDeclarations),
@@ -4230,11 +4582,15 @@ yyreduce:
break;
case 271:
+
+/* Line 1455 of yacc.c */
#line 1095 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.clauseList).m_node.head = 0; (yyval.clauseList).m_node.tail = 0; (yyval.clauseList).m_varDeclarations = 0; (yyval.clauseList).m_funcDeclarations = 0; (yyval.clauseList).m_features = 0; (yyval.clauseList).m_numConstants = 0; ;}
break;
case 273:
+
+/* Line 1455 of yacc.c */
#line 1100 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.clauseList).m_node.head = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].caseClauseNode).m_node);
(yyval.clauseList).m_node.tail = (yyval.clauseList).m_node.head;
@@ -4245,6 +4601,8 @@ yyreduce:
break;
case 274:
+
+/* Line 1455 of yacc.c */
#line 1106 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.clauseList).m_node.head = (yyvsp[(1) - (2)].clauseList).m_node.head;
(yyval.clauseList).m_node.tail = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (2)].clauseList).m_node.tail, (yyvsp[(2) - (2)].caseClauseNode).m_node);
@@ -4256,26 +4614,36 @@ yyreduce:
break;
case 275:
+
+/* Line 1455 of yacc.c */
#line 1116 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node), 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); ;}
break;
case 276:
+
+/* Line 1455 of yacc.c */
#line 1117 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].sourceElements).m_node), (yyvsp[(4) - (4)].sourceElements).m_varDeclarations, (yyvsp[(4) - (4)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (4)].expressionNode).m_features | (yyvsp[(4) - (4)].sourceElements).m_features, (yyvsp[(2) - (4)].expressionNode).m_numConstants + (yyvsp[(4) - (4)].sourceElements).m_numConstants); ;}
break;
case 277:
+
+/* Line 1455 of yacc.c */
#line 1121 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); ;}
break;
case 278:
+
+/* Line 1455 of yacc.c */
#line 1122 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0, (yyvsp[(3) - (3)].sourceElements).m_node), (yyvsp[(3) - (3)].sourceElements).m_varDeclarations, (yyvsp[(3) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(3) - (3)].sourceElements).m_features, (yyvsp[(3) - (3)].sourceElements).m_numConstants); ;}
break;
case 279:
+
+/* Line 1455 of yacc.c */
#line 1126 "../../JavaScriptCore/parser/Grammar.y"
{ LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].statementNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4283,6 +4651,8 @@ yyreduce:
break;
case 280:
+
+/* Line 1455 of yacc.c */
#line 1132 "../../JavaScriptCore/parser/Grammar.y"
{ ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4291,6 +4661,8 @@ yyreduce:
break;
case 281:
+
+/* Line 1455 of yacc.c */
#line 1136 "../../JavaScriptCore/parser/Grammar.y"
{ ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
@@ -4299,6 +4671,8 @@ yyreduce:
break;
case 282:
+
+/* Line 1455 of yacc.c */
#line 1143 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, (yyvsp[(2) - (4)].statementNode).m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, (yyvsp[(4) - (4)].statementNode).m_node),
mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_varDeclarations, (yyvsp[(4) - (4)].statementNode).m_varDeclarations),
@@ -4309,6 +4683,8 @@ yyreduce:
break;
case 283:
+
+/* Line 1455 of yacc.c */
#line 1149 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, *(yyvsp[(5) - (7)].ident), ((yyvsp[(7) - (7)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (7)].statementNode).m_node, 0),
mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations),
@@ -4319,6 +4695,8 @@ yyreduce:
break;
case 284:
+
+/* Line 1455 of yacc.c */
#line 1156 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, (yyvsp[(2) - (9)].statementNode).m_node, *(yyvsp[(5) - (9)].ident), ((yyvsp[(7) - (9)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (9)].statementNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node),
mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_varDeclarations, (yyvsp[(7) - (9)].statementNode).m_varDeclarations), (yyvsp[(9) - (9)].statementNode).m_varDeclarations),
@@ -4329,23 +4707,31 @@ yyreduce:
break;
case 285:
+
+/* Line 1455 of yacc.c */
#line 1165 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
break;
case 286:
+
+/* Line 1455 of yacc.c */
#line 1167 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;}
break;
case 287:
+
+/* Line 1455 of yacc.c */
#line 1172 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*(yyvsp[(2) - (7)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); (yyval.statementNode).m_funcDeclarations->data.append(static_cast<FuncDeclNode*>((yyval.statementNode).m_node)); ;}
break;
case 288:
+
+/* Line 1455 of yacc.c */
#line 1174 "../../JavaScriptCore/parser/Grammar.y"
{
(yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*(yyvsp[(2) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0);
@@ -4357,11 +4743,15 @@ yyreduce:
break;
case 289:
+
+/* Line 1455 of yacc.c */
#line 1184 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(5) - (6)].functionBodyNode), LEXER->sourceCode((yyvsp[(4) - (6)].intValue), (yyvsp[(6) - (6)].intValue), (yylsp[(4) - (6)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(5) - (6)].functionBodyNode), (yylsp[(4) - (6)]), (yylsp[(6) - (6)])); ;}
break;
case 290:
+
+/* Line 1455 of yacc.c */
#line 1186 "../../JavaScriptCore/parser/Grammar.y"
{
(yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line), (yyvsp[(3) - (7)].parameterList).m_node.head), (yyvsp[(3) - (7)].parameterList).m_features | ClosureFeature, 0);
@@ -4372,11 +4762,15 @@ yyreduce:
break;
case 291:
+
+/* Line 1455 of yacc.c */
#line 1192 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); ;}
break;
case 292:
+
+/* Line 1455 of yacc.c */
#line 1194 "../../JavaScriptCore/parser/Grammar.y"
{
(yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0);
@@ -4387,6 +4781,8 @@ yyreduce:
break;
case 293:
+
+/* Line 1455 of yacc.c */
#line 1203 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.parameterList).m_node.head = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident));
(yyval.parameterList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
@@ -4394,6 +4790,8 @@ yyreduce:
break;
case 294:
+
+/* Line 1455 of yacc.c */
#line 1206 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.parameterList).m_node.head = (yyvsp[(1) - (3)].parameterList).m_node.head;
(yyval.parameterList).m_features = (yyvsp[(1) - (3)].parameterList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
@@ -4401,27 +4799,37 @@ yyreduce:
break;
case 295:
+
+/* Line 1455 of yacc.c */
#line 1212 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;}
break;
case 296:
+
+/* Line 1455 of yacc.c */
#line 1213 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;}
break;
case 297:
+
+/* Line 1455 of yacc.c */
#line 1217 "../../JavaScriptCore/parser/Grammar.y"
{ GLOBAL_DATA->parser->didFinishParsing(new (GLOBAL_DATA) SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, (yylsp[(0) - (0)]).last_line, 0); ;}
break;
case 298:
+
+/* Line 1455 of yacc.c */
#line 1218 "../../JavaScriptCore/parser/Grammar.y"
{ GLOBAL_DATA->parser->didFinishParsing((yyvsp[(1) - (1)].sourceElements).m_node, (yyvsp[(1) - (1)].sourceElements).m_varDeclarations, (yyvsp[(1) - (1)].sourceElements).m_funcDeclarations, (yyvsp[(1) - (1)].sourceElements).m_features,
(yylsp[(1) - (1)]).last_line, (yyvsp[(1) - (1)].sourceElements).m_numConstants); ;}
break;
case 299:
+
+/* Line 1455 of yacc.c */
#line 1223 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.sourceElements).m_node = new (GLOBAL_DATA) SourceElements(GLOBAL_DATA);
(yyval.sourceElements).m_node->append((yyvsp[(1) - (1)].statementNode).m_node);
@@ -4433,6 +4841,8 @@ yyreduce:
break;
case 300:
+
+/* Line 1455 of yacc.c */
#line 1230 "../../JavaScriptCore/parser/Grammar.y"
{ (yyval.sourceElements).m_node->append((yyvsp[(2) - (2)].statementNode).m_node);
(yyval.sourceElements).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_varDeclarations, (yyvsp[(2) - (2)].statementNode).m_varDeclarations);
@@ -4443,188 +4853,261 @@ yyreduce:
break;
case 304:
+
+/* Line 1455 of yacc.c */
#line 1244 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 305:
+
+/* Line 1455 of yacc.c */
#line 1245 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 306:
+
+/* Line 1455 of yacc.c */
#line 1246 "../../JavaScriptCore/parser/Grammar.y"
{ Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;}
break;
case 307:
+
+/* Line 1455 of yacc.c */
#line 1247 "../../JavaScriptCore/parser/Grammar.y"
{ Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;}
break;
case 308:
+
+/* Line 1455 of yacc.c */
#line 1251 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 309:
+
+/* Line 1455 of yacc.c */
#line 1252 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 310:
+
+/* Line 1455 of yacc.c */
#line 1253 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 311:
+
+/* Line 1455 of yacc.c */
#line 1254 "../../JavaScriptCore/parser/Grammar.y"
{ if (*(yyvsp[(1) - (7)].ident) != "get" && *(yyvsp[(1) - (7)].ident) != "set") YYABORT; ;}
break;
case 312:
+
+/* Line 1455 of yacc.c */
#line 1255 "../../JavaScriptCore/parser/Grammar.y"
{ if (*(yyvsp[(1) - (8)].ident) != "get" && *(yyvsp[(1) - (8)].ident) != "set") YYABORT; ;}
break;
case 316:
+
+/* Line 1455 of yacc.c */
#line 1265 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 317:
+
+/* Line 1455 of yacc.c */
#line 1266 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 318:
+
+/* Line 1455 of yacc.c */
#line 1268 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 322:
+
+/* Line 1455 of yacc.c */
#line 1275 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 517:
+
+/* Line 1455 of yacc.c */
#line 1643 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 518:
+
+/* Line 1455 of yacc.c */
#line 1644 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 520:
+
+/* Line 1455 of yacc.c */
#line 1649 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 521:
+
+/* Line 1455 of yacc.c */
#line 1653 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 522:
+
+/* Line 1455 of yacc.c */
#line 1654 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 525:
+
+/* Line 1455 of yacc.c */
#line 1660 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 526:
+
+/* Line 1455 of yacc.c */
#line 1661 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 530:
+
+/* Line 1455 of yacc.c */
#line 1668 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 533:
+
+/* Line 1455 of yacc.c */
#line 1677 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 534:
+
+/* Line 1455 of yacc.c */
#line 1678 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 539:
+
+/* Line 1455 of yacc.c */
#line 1695 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 555:
+
+/* Line 1455 of yacc.c */
#line 1726 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 557:
+
+/* Line 1455 of yacc.c */
#line 1728 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 559:
+
+/* Line 1455 of yacc.c */
#line 1733 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 561:
+
+/* Line 1455 of yacc.c */
#line 1735 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 563:
+
+/* Line 1455 of yacc.c */
#line 1740 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 565:
+
+/* Line 1455 of yacc.c */
#line 1742 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 568:
+
+/* Line 1455 of yacc.c */
#line 1754 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 569:
+
+/* Line 1455 of yacc.c */
#line 1755 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 578:
+
+/* Line 1455 of yacc.c */
#line 1779 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
case 580:
+
+/* Line 1455 of yacc.c */
#line 1784 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 585:
+
+/* Line 1455 of yacc.c */
#line 1795 "../../JavaScriptCore/parser/Grammar.y"
{ AUTO_SEMICOLON; ;}
break;
case 592:
+
+/* Line 1455 of yacc.c */
#line 1811 "../../JavaScriptCore/parser/Grammar.y"
{ ;}
break;
-/* Line 1267 of yacc.c. */
-#line 4628 "WebCore/tmp/../generated/Grammar.tab.c"
+
+/* Line 1455 of yacc.c */
+#line 5111 "WebCore/tmp/../generated/Grammar.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -4700,7 +5183,7 @@ yyerrlab:
if (yyerrstatus == 3)
{
- /* If just tried and failed to reuse look-ahead token after an
+ /* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
@@ -4717,7 +5200,7 @@ yyerrlab:
}
}
- /* Else will try to reuse look-ahead token after shifting the error
+ /* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
@@ -4775,14 +5258,11 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
*++yyvsp = yylval;
yyerror_range[1] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
- the look-ahead. YYLOC is available though. */
+ the lookahead. YYLOC is available though. */
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
*++yylsp = yyloc;
@@ -4807,7 +5287,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -4818,7 +5298,7 @@ yyexhaustedlab:
#endif
yyreturn:
- if (yychar != YYEOF && yychar != YYEMPTY)
+ if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, &yylloc);
/* Do not reclaim the symbols of the rule which action triggered
@@ -4844,6 +5324,8 @@ yyreturn:
}
+
+/* Line 1675 of yacc.c */
#line 1827 "../../JavaScriptCore/parser/Grammar.y"
diff --git a/src/3rdparty/webkit/WebCore/generated/Grammar.h b/src/3rdparty/webkit/WebCore/generated/Grammar.h
index 4188cd8..34b0b37 100644
--- a/src/3rdparty/webkit/WebCore/generated/Grammar.h
+++ b/src/3rdparty/webkit/WebCore/generated/Grammar.h
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -29,10 +28,11 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -104,78 +104,16 @@
AUTOMINUSMINUS = 320
};
#endif
-/* Tokens. */
-#define NULLTOKEN 258
-#define TRUETOKEN 259
-#define FALSETOKEN 260
-#define BREAK 261
-#define CASE 262
-#define DEFAULT 263
-#define FOR 264
-#define NEW 265
-#define VAR 266
-#define CONSTTOKEN 267
-#define CONTINUE 268
-#define FUNCTION 269
-#define RETURN 270
-#define VOIDTOKEN 271
-#define DELETETOKEN 272
-#define IF 273
-#define THISTOKEN 274
-#define DO 275
-#define WHILE 276
-#define INTOKEN 277
-#define INSTANCEOF 278
-#define TYPEOF 279
-#define SWITCH 280
-#define WITH 281
-#define RESERVED 282
-#define THROW 283
-#define TRY 284
-#define CATCH 285
-#define FINALLY 286
-#define DEBUGGER 287
-#define IF_WITHOUT_ELSE 288
-#define ELSE 289
-#define EQEQ 290
-#define NE 291
-#define STREQ 292
-#define STRNEQ 293
-#define LE 294
-#define GE 295
-#define OR 296
-#define AND 297
-#define PLUSPLUS 298
-#define MINUSMINUS 299
-#define LSHIFT 300
-#define RSHIFT 301
-#define URSHIFT 302
-#define PLUSEQUAL 303
-#define MINUSEQUAL 304
-#define MULTEQUAL 305
-#define DIVEQUAL 306
-#define LSHIFTEQUAL 307
-#define RSHIFTEQUAL 308
-#define URSHIFTEQUAL 309
-#define ANDEQUAL 310
-#define MODEQUAL 311
-#define XOREQUAL 312
-#define OREQUAL 313
-#define OPENBRACE 314
-#define CLOSEBRACE 315
-#define NUMBER 316
-#define IDENT 317
-#define STRING 318
-#define AUTOPLUSPLUS 319
-#define AUTOMINUSMINUS 320
-
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 157 "../../JavaScriptCore/parser/Grammar.y"
{
+
+/* Line 1676 of yacc.c */
+#line 157 "../../JavaScriptCore/parser/Grammar.y"
+
int intValue;
double doubleValue;
Identifier* ident;
@@ -205,13 +143,15 @@ typedef union YYSTYPE
ParameterListInfo parameterList;
Operator op;
-}
-/* Line 1489 of yacc.c. */
-#line 211 "WebCore/tmp/../generated/Grammar.tab.h"
- YYSTYPE;
+
+
+
+/* Line 1676 of yacc.c */
+#line 151 "WebCore/tmp/../generated/Grammar.tab.h"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
@@ -230,3 +170,4 @@ typedef struct YYLTYPE
#endif
+
diff --git a/src/3rdparty/webkit/WebCore/generated/HTMLElementFactory.cpp b/src/3rdparty/webkit/WebCore/generated/HTMLElementFactory.cpp
index d14bc93..4a8430c 100644
--- a/src/3rdparty/webkit/WebCore/generated/HTMLElementFactory.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/HTMLElementFactory.cpp
@@ -184,21 +184,33 @@ static PassRefPtr<HTMLElement> tablecolConstructor(const QualifiedName& tagName,
return new HTMLTableColElement(tagName, doc);
}
+#if ENABLE(DATAGRID)
+
static PassRefPtr<HTMLElement> datagridConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool)
{
return new HTMLDataGridElement(tagName, doc);
}
+#endif
+
+#if ENABLE(DATAGRID)
+
static PassRefPtr<HTMLElement> datagridcellConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool)
{
return new HTMLDataGridCellElement(tagName, doc);
}
+#endif
+
+#if ENABLE(DATAGRID)
+
static PassRefPtr<HTMLElement> datagridcolConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool)
{
return new HTMLDataGridColElement(tagName, doc);
}
+#endif
+
static PassRefPtr<HTMLElement> modConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool)
{
return new HTMLModElement(tagName, doc);
@@ -219,11 +231,15 @@ static PassRefPtr<HTMLElement> dlistConstructor(const QualifiedName& tagName, Do
return new HTMLDListElement(tagName, doc);
}
+#if ENABLE(DATAGRID)
+
static PassRefPtr<HTMLElement> datagridrowConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool)
{
return new HTMLDataGridRowElement(tagName, doc);
}
+#endif
+
static PassRefPtr<HTMLElement> embedConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool)
{
return new HTMLEmbedElement(tagName, doc);
@@ -486,14 +502,26 @@ static inline void createFunctionMapIfNecessary()
addTag(captionTag, tablecaptionConstructor);
addTag(colTag, tablecolConstructor);
addTag(colgroupTag, tablecolConstructor);
+#if ENABLE(DATAGRID)
addTag(datagridTag, datagridConstructor);
+#endif
+
+#if ENABLE(DATAGRID)
addTag(dcellTag, datagridcellConstructor);
+#endif
+
+#if ENABLE(DATAGRID)
addTag(dcolTag, datagridcolConstructor);
+#endif
+
addTag(delTag, modConstructor);
addTag(dirTag, directoryConstructor);
addTag(divTag, divConstructor);
addTag(dlTag, dlistConstructor);
+#if ENABLE(DATAGRID)
addTag(drowTag, datagridrowConstructor);
+#endif
+
addTag(embedTag, embedConstructor);
addTag(fieldsetTag, fieldsetConstructor);
addTag(fontTag, fontConstructor);
diff --git a/src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp b/src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp
index 4e23159..f40ae05 100644
--- a/src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp
@@ -128,6 +128,9 @@ DEFINE_GLOBAL(QualifiedName, paramTag, nullAtom, "param", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, plaintextTag, nullAtom, "plaintext", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, preTag, nullAtom, "pre", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, qTag, nullAtom, "q", xhtmlNamespaceURI);
+DEFINE_GLOBAL(QualifiedName, rpTag, nullAtom, "rp", xhtmlNamespaceURI);
+DEFINE_GLOBAL(QualifiedName, rtTag, nullAtom, "rt", xhtmlNamespaceURI);
+DEFINE_GLOBAL(QualifiedName, rubyTag, nullAtom, "ruby", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, sTag, nullAtom, "s", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, sampTag, nullAtom, "samp", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, scriptTag, nullAtom, "script", xhtmlNamespaceURI);
@@ -244,6 +247,9 @@ WebCore::QualifiedName** getHTMLTags(size_t* size)
(WebCore::QualifiedName*)&plaintextTag,
(WebCore::QualifiedName*)&preTag,
(WebCore::QualifiedName*)&qTag,
+ (WebCore::QualifiedName*)&rpTag,
+ (WebCore::QualifiedName*)&rtTag,
+ (WebCore::QualifiedName*)&rubyTag,
(WebCore::QualifiedName*)&sTag,
(WebCore::QualifiedName*)&sampTag,
(WebCore::QualifiedName*)&scriptTag,
@@ -273,7 +279,7 @@ WebCore::QualifiedName** getHTMLTags(size_t* size)
(WebCore::QualifiedName*)&wbrTag,
(WebCore::QualifiedName*)&xmpTag,
};
- *size = 111;
+ *size = 114;
return HTMLTags;
}
@@ -292,6 +298,7 @@ DEFINE_GLOBAL(QualifiedName, aria_checkedAttr, nullAtom, "aria_checked", xhtmlNa
DEFINE_GLOBAL(QualifiedName, aria_describedbyAttr, nullAtom, "aria_describedby", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, aria_disabledAttr, nullAtom, "aria_disabled", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, aria_hiddenAttr, nullAtom, "aria_hidden", xhtmlNamespaceURI);
+DEFINE_GLOBAL(QualifiedName, aria_labelAttr, nullAtom, "aria_label", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, aria_labeledbyAttr, nullAtom, "aria_labeledby", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, aria_labelledbyAttr, nullAtom, "aria_labelledby", xhtmlNamespaceURI);
DEFINE_GLOBAL(QualifiedName, aria_levelAttr, nullAtom, "aria_level", xhtmlNamespaceURI);
@@ -529,6 +536,7 @@ WebCore::QualifiedName** getHTMLAttrs(size_t* size)
(WebCore::QualifiedName*)&aria_describedbyAttr,
(WebCore::QualifiedName*)&aria_disabledAttr,
(WebCore::QualifiedName*)&aria_hiddenAttr,
+ (WebCore::QualifiedName*)&aria_labelAttr,
(WebCore::QualifiedName*)&aria_labeledbyAttr,
(WebCore::QualifiedName*)&aria_labelledbyAttr,
(WebCore::QualifiedName*)&aria_levelAttr,
@@ -748,7 +756,7 @@ WebCore::QualifiedName** getHTMLAttrs(size_t* size)
(WebCore::QualifiedName*)&widthAttr,
(WebCore::QualifiedName*)&wrapAttr,
};
- *size = 232;
+ *size = 233;
return HTMLAttr;
}
@@ -856,6 +864,9 @@ void init()
const char *plaintextTagString = "plaintext";
const char *preTagString = "pre";
const char *qTagString = "q";
+ const char *rpTagString = "rp";
+ const char *rtTagString = "rt";
+ const char *rubyTagString = "ruby";
const char *sTagString = "s";
const char *sampTagString = "samp";
const char *scriptTagString = "script";
@@ -967,6 +978,9 @@ void init()
new ((void*)&plaintextTag) QualifiedName(nullAtom, plaintextTagString, xhtmlNS);
new ((void*)&preTag) QualifiedName(nullAtom, preTagString, xhtmlNS);
new ((void*)&qTag) QualifiedName(nullAtom, qTagString, xhtmlNS);
+ new ((void*)&rpTag) QualifiedName(nullAtom, rpTagString, xhtmlNS);
+ new ((void*)&rtTag) QualifiedName(nullAtom, rtTagString, xhtmlNS);
+ new ((void*)&rubyTag) QualifiedName(nullAtom, rubyTagString, xhtmlNS);
new ((void*)&sTag) QualifiedName(nullAtom, sTagString, xhtmlNS);
new ((void*)&sampTag) QualifiedName(nullAtom, sampTagString, xhtmlNS);
new ((void*)&scriptTag) QualifiedName(nullAtom, scriptTagString, xhtmlNS);
@@ -1010,6 +1024,7 @@ void init()
const char *aria_describedbyAttrString = "aria-describedby";
const char *aria_disabledAttrString = "aria-disabled";
const char *aria_hiddenAttrString = "aria-hidden";
+ const char *aria_labelAttrString = "aria-label";
const char *aria_labeledbyAttrString = "aria-labeledby";
const char *aria_labelledbyAttrString = "aria-labelledby";
const char *aria_levelAttrString = "aria-level";
@@ -1241,6 +1256,7 @@ void init()
new ((void*)&aria_describedbyAttr) QualifiedName(nullAtom, aria_describedbyAttrString, nullAtom);
new ((void*)&aria_disabledAttr) QualifiedName(nullAtom, aria_disabledAttrString, nullAtom);
new ((void*)&aria_hiddenAttr) QualifiedName(nullAtom, aria_hiddenAttrString, nullAtom);
+ new ((void*)&aria_labelAttr) QualifiedName(nullAtom, aria_labelAttrString, nullAtom);
new ((void*)&aria_labeledbyAttr) QualifiedName(nullAtom, aria_labeledbyAttrString, nullAtom);
new ((void*)&aria_labelledbyAttr) QualifiedName(nullAtom, aria_labelledbyAttrString, nullAtom);
new ((void*)&aria_levelAttr) QualifiedName(nullAtom, aria_levelAttrString, nullAtom);
diff --git a/src/3rdparty/webkit/WebCore/generated/HTMLNames.h b/src/3rdparty/webkit/WebCore/generated/HTMLNames.h
index fba6088..3de4fc5 100644
--- a/src/3rdparty/webkit/WebCore/generated/HTMLNames.h
+++ b/src/3rdparty/webkit/WebCore/generated/HTMLNames.h
@@ -124,6 +124,9 @@ extern const WebCore::QualifiedName paramTag;
extern const WebCore::QualifiedName plaintextTag;
extern const WebCore::QualifiedName preTag;
extern const WebCore::QualifiedName qTag;
+extern const WebCore::QualifiedName rpTag;
+extern const WebCore::QualifiedName rtTag;
+extern const WebCore::QualifiedName rubyTag;
extern const WebCore::QualifiedName sTag;
extern const WebCore::QualifiedName sampTag;
extern const WebCore::QualifiedName scriptTag;
@@ -167,6 +170,7 @@ extern const WebCore::QualifiedName aria_checkedAttr;
extern const WebCore::QualifiedName aria_describedbyAttr;
extern const WebCore::QualifiedName aria_disabledAttr;
extern const WebCore::QualifiedName aria_hiddenAttr;
+extern const WebCore::QualifiedName aria_labelAttr;
extern const WebCore::QualifiedName aria_labeledbyAttr;
extern const WebCore::QualifiedName aria_labelledbyAttr;
extern const WebCore::QualifiedName aria_levelAttr;
diff --git a/src/3rdparty/webkit/WebCore/generated/JSAttr.cpp b/src/3rdparty/webkit/WebCore/generated/JSAttr.cpp
index bf9bea5..4659189 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSAttr.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSAttr.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSAttrTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSAttrTable =
+static JSC_CONST_HASHTABLE HashTable JSAttrTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSAttrTableValues, 0 };
#else
@@ -63,7 +63,7 @@ static const HashTableValue JSAttrConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSAttrConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSAttrConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSAttrConstructorTableValues, 0 };
#else
@@ -101,7 +101,7 @@ static const HashTableValue JSAttrPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSAttrPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSAttrPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSAttrPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp b/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp
index 25aede5..2b5afda 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp
@@ -38,7 +38,7 @@ static const HashTableValue JSBarInfoTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSBarInfoTable =
+static JSC_CONST_HASHTABLE HashTable JSBarInfoTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSBarInfoTableValues, 0 };
#else
@@ -52,7 +52,7 @@ static const HashTableValue JSBarInfoPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSBarInfoPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSBarInfoPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSBarInfoPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCDATASection.cpp b/src/3rdparty/webkit/WebCore/generated/JSCDATASection.cpp
index f89540d..51f543f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCDATASection.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCDATASection.cpp
@@ -38,7 +38,7 @@ static const HashTableValue JSCDATASectionTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCDATASectionTable =
+static JSC_CONST_HASHTABLE HashTable JSCDATASectionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCDATASectionTableValues, 0 };
#else
@@ -52,7 +52,7 @@ static const HashTableValue JSCDATASectionConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCDATASectionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCDATASectionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCDATASectionConstructorTableValues, 0 };
#else
@@ -90,7 +90,7 @@ static const HashTableValue JSCDATASectionPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCDATASectionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCDATASectionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCDATASectionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSCharsetRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSCharsetRule.cpp
index 15cabbf..70a61d5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSCharsetRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSCharsetRule.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSCSSCharsetRuleTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSCharsetRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSCharsetRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSCSSCharsetRuleTableValues, 0 };
#else
@@ -54,7 +54,7 @@ static const HashTableValue JSCSSCharsetRuleConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSCharsetRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSCharsetRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSCharsetRuleConstructorTableValues, 0 };
#else
@@ -92,7 +92,7 @@ static const HashTableValue JSCSSCharsetRulePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSCharsetRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSCharsetRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSCharsetRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSFontFaceRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSFontFaceRule.cpp
index ab3b3a5..13c119e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSFontFaceRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSFontFaceRule.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSCSSFontFaceRuleTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSFontFaceRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSFontFaceRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSCSSFontFaceRuleTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSCSSFontFaceRuleConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSFontFaceRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSFontFaceRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSFontFaceRuleConstructorTableValues, 0 };
#else
@@ -94,7 +94,7 @@ static const HashTableValue JSCSSFontFaceRulePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSFontFaceRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSFontFaceRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSFontFaceRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSImportRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSImportRule.cpp
index 4dc5151..45d5d60 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSImportRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSImportRule.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSCSSImportRuleTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSImportRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSImportRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSCSSImportRuleTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSCSSImportRuleConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSImportRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSImportRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSImportRuleConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSCSSImportRulePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSImportRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSImportRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSImportRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSMediaRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSMediaRule.cpp
index 35589af..3e13a69 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSMediaRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSMediaRule.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSCSSMediaRuleTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSMediaRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSMediaRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSCSSMediaRuleTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSCSSMediaRuleConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSMediaRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSMediaRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSMediaRuleConstructorTableValues, 0 };
#else
@@ -100,7 +100,7 @@ static const HashTableValue JSCSSMediaRulePrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSMediaRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSMediaRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSCSSMediaRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSPageRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSPageRule.cpp
index 6869a49..c02abbd 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSPageRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSPageRule.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSCSSPageRuleTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSPageRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSPageRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSCSSPageRuleTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSCSSPageRuleConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSPageRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSPageRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSPageRuleConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSCSSPageRulePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSPageRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSPageRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSPageRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSPrimitiveValue.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSPrimitiveValue.cpp
index 61a39ec..5d81a44 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSPrimitiveValue.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSPrimitiveValue.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSCSSPrimitiveValueTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSPrimitiveValueTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSPrimitiveValueTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSCSSPrimitiveValueTableValues, 0 };
#else
@@ -88,7 +88,7 @@ static const HashTableValue JSCSSPrimitiveValueConstructorTableValues[27] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSPrimitiveValueConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSPrimitiveValueConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 8191, JSCSSPrimitiveValueConstructorTableValues, 0 };
#else
@@ -159,7 +159,7 @@ static const HashTableValue JSCSSPrimitiveValuePrototypeTableValues[34] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSPrimitiveValuePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSPrimitiveValuePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 8191, JSCSSPrimitiveValuePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp
index 31a4dc3..3aac528 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSCSSRuleTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSCSSRuleTableValues, 0 };
#else
@@ -71,7 +71,7 @@ static const HashTableValue JSCSSRuleConstructorTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSCSSRuleConstructorTableValues, 0 };
#else
@@ -119,7 +119,7 @@ static const HashTableValue JSCSSRulePrototypeTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSCSSRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp
index 19e9d14..6188091 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSCSSRuleListTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSRuleListTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSRuleListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSCSSRuleListTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSCSSRuleListConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSRuleListConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSRuleListConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSRuleListConstructorTableValues, 0 };
#else
@@ -97,7 +97,7 @@ static const HashTableValue JSCSSRuleListPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSRuleListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSRuleListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSRuleListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp
index cf7ceed..c437238 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp
@@ -51,7 +51,7 @@ static const HashTableValue JSCSSStyleDeclarationTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSStyleDeclarationTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSStyleDeclarationTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSCSSStyleDeclarationTableValues, 0 };
#else
@@ -65,7 +65,7 @@ static const HashTableValue JSCSSStyleDeclarationConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSStyleDeclarationConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSStyleDeclarationConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSStyleDeclarationConstructorTableValues, 0 };
#else
@@ -111,7 +111,7 @@ static const HashTableValue JSCSSStyleDeclarationPrototypeTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSStyleDeclarationPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSStyleDeclarationPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSCSSStyleDeclarationPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleRule.cpp
index 1d92b22..a9f69a2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleRule.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSCSSStyleRuleTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSStyleRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSStyleRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSCSSStyleRuleTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSCSSStyleRuleConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSStyleRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSStyleRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSStyleRuleConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSCSSStyleRulePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSStyleRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSStyleRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSStyleRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleSheet.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleSheet.cpp
index f697203..c1cc446 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleSheet.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleSheet.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSCSSStyleSheetTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSStyleSheetTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSStyleSheetTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSCSSStyleSheetTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSCSSStyleSheetConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSStyleSheetConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSStyleSheetConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSStyleSheetConstructorTableValues, 0 };
#else
@@ -103,7 +103,7 @@ static const HashTableValue JSCSSStyleSheetPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSStyleSheetPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSStyleSheetPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSCSSStyleSheetPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp
index 87aff14..a402304 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSCSSValueTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSValueTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSValueTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSCSSValueTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSCSSValueConstructorTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSValueConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSValueConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSCSSValueConstructorTableValues, 0 };
#else
@@ -102,7 +102,7 @@ static const HashTableValue JSCSSValuePrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSValuePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSValuePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSCSSValuePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSValueList.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSValueList.cpp
index 98721ec..7322385 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSValueList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSValueList.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSCSSValueListTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSValueListTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSValueListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSCSSValueListTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSCSSValueListConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSValueListConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSValueListConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSValueListConstructorTableValues, 0 };
#else
@@ -97,7 +97,7 @@ static const HashTableValue JSCSSValueListPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSValueListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSValueListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSValueListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp
index 3c8c75a..4aa1770 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSCSSVariablesDeclarationTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSVariablesDeclarationTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSVariablesDeclarationTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSCSSVariablesDeclarationTableValues, 0 };
#else
@@ -62,7 +62,7 @@ static const HashTableValue JSCSSVariablesDeclarationConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSVariablesDeclarationConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSVariablesDeclarationConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSVariablesDeclarationConstructorTableValues, 0 };
#else
@@ -104,7 +104,7 @@ static const HashTableValue JSCSSVariablesDeclarationPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSVariablesDeclarationPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSVariablesDeclarationPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSCSSVariablesDeclarationPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesRule.cpp
index ed3050d..f28aaed 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesRule.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSCSSVariablesRuleTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSVariablesRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSVariablesRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSCSSVariablesRuleTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSCSSVariablesRuleConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSVariablesRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSVariablesRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSVariablesRuleConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSCSSVariablesRulePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCSSVariablesRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCSSVariablesRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCSSVariablesRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp
index 7801622..79db6e0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSCanvasGradientPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCanvasGradientPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCanvasGradientPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCanvasGradientPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp
index 14dc535..c443a9c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp
@@ -37,7 +37,7 @@ static const HashTableValue JSCanvasPatternPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCanvasPatternPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCanvasPatternPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCanvasPatternPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext2D.cpp
index 2f318c1..fd54b4f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext2D.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext2D.cpp
@@ -69,7 +69,7 @@ static const HashTableValue JSCanvasRenderingContext2DTableValues[18] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCanvasRenderingContext2DTable =
+static JSC_CONST_HASHTABLE HashTable JSCanvasRenderingContext2DTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 8191, JSCanvasRenderingContext2DTableValues, 0 };
#else
@@ -83,7 +83,7 @@ static const HashTableValue JSCanvasRenderingContext2DConstructorTableValues[1]
{ 0, 0, 0, 0 }
};
-static const HashTable JSCanvasRenderingContext2DConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCanvasRenderingContext2DConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCanvasRenderingContext2DConstructorTableValues, 0 };
#else
@@ -165,7 +165,7 @@ static const HashTableValue JSCanvasRenderingContext2DPrototypeTableValues[45] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCanvasRenderingContext2DPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCanvasRenderingContext2DPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 4095, JSCanvasRenderingContext2DPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCharacterData.cpp b/src/3rdparty/webkit/WebCore/generated/JSCharacterData.cpp
index a860721..a2d10e4 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCharacterData.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCharacterData.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSCharacterDataTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCharacterDataTable =
+static JSC_CONST_HASHTABLE HashTable JSCharacterDataTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSCharacterDataTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSCharacterDataConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCharacterDataConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCharacterDataConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCharacterDataConstructorTableValues, 0 };
#else
@@ -102,7 +102,7 @@ static const HashTableValue JSCharacterDataPrototypeTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCharacterDataPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCharacterDataPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSCharacterDataPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp
index 4db0efb..aea6ac5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSClientRectTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSClientRectTable =
+static JSC_CONST_HASHTABLE HashTable JSClientRectTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSClientRectTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSClientRectConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSClientRectConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSClientRectConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSClientRectConstructorTableValues, 0 };
#else
@@ -97,7 +97,7 @@ static const HashTableValue JSClientRectPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSClientRectPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSClientRectPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSClientRectPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp b/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp
index 97eff69..854daa3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSClientRectListTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSClientRectListTable =
+static JSC_CONST_HASHTABLE HashTable JSClientRectListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSClientRectListTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSClientRectListConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSClientRectListConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSClientRectListConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSClientRectListConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSClientRectListPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSClientRectListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSClientRectListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSClientRectListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp b/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp
index 19c40b7..7306d2a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSClipboardTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSClipboardTable =
+static JSC_CONST_HASHTABLE HashTable JSClipboardTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSClipboardTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSClipboardConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSClipboardConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSClipboardConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSClipboardConstructorTableValues, 0 };
#else
@@ -102,7 +102,7 @@ static const HashTableValue JSClipboardPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSClipboardPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSClipboardPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSClipboardPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSComment.cpp b/src/3rdparty/webkit/WebCore/generated/JSComment.cpp
index 7905094..6666541 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSComment.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSComment.cpp
@@ -38,7 +38,7 @@ static const HashTableValue JSCommentTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCommentTable =
+static JSC_CONST_HASHTABLE HashTable JSCommentTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCommentTableValues, 0 };
#else
@@ -52,7 +52,7 @@ static const HashTableValue JSCommentConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCommentConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCommentConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCommentConstructorTableValues, 0 };
#else
@@ -90,7 +90,7 @@ static const HashTableValue JSCommentPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCommentPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCommentPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCommentPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp b/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp
index 24e5ef3..2b223a2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSConsoleTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSConsoleTable =
+static JSC_CONST_HASHTABLE HashTable JSConsoleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSConsoleTableValues, 0 };
#else
@@ -70,7 +70,7 @@ static const HashTableValue JSConsolePrototypeTableValues[17] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSConsolePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSConsolePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSConsolePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp b/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp
index 0db560b..eafee51 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSCoordinatesTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCoordinatesTable =
+static JSC_CONST_HASHTABLE HashTable JSCoordinatesTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSCoordinatesTableValues, 0 };
#else
@@ -63,7 +63,7 @@ static const HashTableValue JSCoordinatesPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCoordinatesPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCoordinatesPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCoordinatesPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp b/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp
index 03a3eb3..b3a834f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSCounterTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCounterTable =
+static JSC_CONST_HASHTABLE HashTable JSCounterTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSCounterTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSCounterConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCounterConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSCounterConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCounterConstructorTableValues, 0 };
#else
@@ -95,7 +95,7 @@ static const HashTableValue JSCounterPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSCounterPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSCounterPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSCounterPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp
index 0d7202b..e9d43ee 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp
@@ -57,7 +57,7 @@ static const HashTableValue JSDOMApplicationCacheTableValues[10] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMApplicationCacheTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMApplicationCacheTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSDOMApplicationCacheTableValues, 0 };
#else
@@ -82,7 +82,7 @@ static const HashTableValue JSDOMApplicationCachePrototypeTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMApplicationCachePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMApplicationCachePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSDOMApplicationCachePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp
index 3b45220..2241182 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSDOMCoreExceptionTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMCoreExceptionTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMCoreExceptionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSDOMCoreExceptionTableValues, 0 };
#else
@@ -81,7 +81,7 @@ static const HashTableValue JSDOMCoreExceptionConstructorTableValues[23] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMCoreExceptionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMCoreExceptionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSDOMCoreExceptionConstructorTableValues, 0 };
#else
@@ -142,7 +142,7 @@ static const HashTableValue JSDOMCoreExceptionPrototypeTableValues[24] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMCoreExceptionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMCoreExceptionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSDOMCoreExceptionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp
index 1e2f950..9b5787c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSDOMImplementationTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMImplementationTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMImplementationTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDOMImplementationTableValues, 0 };
#else
@@ -62,7 +62,7 @@ static const HashTableValue JSDOMImplementationConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMImplementationConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMImplementationConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDOMImplementationConstructorTableValues, 0 };
#else
@@ -105,7 +105,7 @@ static const HashTableValue JSDOMImplementationPrototypeTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMImplementationPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMImplementationPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSDOMImplementationPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp
index ffb4f70..ac05d7d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSDOMParserTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMParserTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMParserTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDOMParserTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSDOMParserConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMParserConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMParserConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDOMParserConstructorTableValues, 0 };
#else
@@ -104,7 +104,7 @@ static const HashTableValue JSDOMParserPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMParserPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMParserPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDOMParserPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp
index 422c410..b0a249d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp
@@ -56,7 +56,7 @@ static const HashTableValue JSDOMSelectionTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMSelectionTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMSelectionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSDOMSelectionTableValues, 0 };
#else
@@ -85,7 +85,7 @@ static const HashTableValue JSDOMSelectionPrototypeTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMSelectionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMSelectionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSDOMSelectionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp
index d9c3ed9..6ac4749 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp
@@ -94,6 +94,7 @@
#include "JSHTMLCanvasElement.h"
#include "JSHTMLCollection.h"
#include "JSHTMLDListElement.h"
+#include "JSHTMLDataGridCellElement.h"
#include "JSHTMLDataGridColElement.h"
#include "JSHTMLDataGridElement.h"
#include "JSHTMLDirectoryElement.h"
@@ -148,7 +149,9 @@
#include "JSKeyboardEvent.h"
#include "JSMediaError.h"
#include "JSMediaList.h"
+#include "JSMessageChannel.h"
#include "JSMessageEvent.h"
+#include "JSMessagePort.h"
#include "JSMimeType.h"
#include "JSMimeTypeArray.h"
#include "JSMouseEvent.h"
@@ -225,7 +228,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSDOMWindow);
/* Hash table */
-static const HashTableValue JSDOMWindowTableValues[272] =
+static const HashTableValue JSDOMWindowTableValues[275] =
{
{ "screen", DontDelete|ReadOnly, (intptr_t)jsDOMWindowScreen, (intptr_t)0 },
{ "history", DontDelete|ReadOnly, (intptr_t)jsDOMWindowHistory, (intptr_t)0 },
@@ -385,8 +388,15 @@ static const HashTableValue JSDOMWindowTableValues[272] =
{ "HTMLBodyElement", DontDelete, (intptr_t)jsDOMWindowHTMLBodyElementConstructor, (intptr_t)setJSDOMWindowHTMLBodyElementConstructor },
{ "HTMLButtonElement", DontDelete, (intptr_t)jsDOMWindowHTMLButtonElementConstructor, (intptr_t)setJSDOMWindowHTMLButtonElementConstructor },
{ "HTMLCanvasElement", DontDelete, (intptr_t)jsDOMWindowHTMLCanvasElementConstructor, (intptr_t)setJSDOMWindowHTMLCanvasElementConstructor },
+#if ENABLE(DATAGRID)
{ "HTMLDataGridElement", DontDelete, (intptr_t)jsDOMWindowHTMLDataGridElementConstructor, (intptr_t)setJSDOMWindowHTMLDataGridElementConstructor },
+#endif
+#if ENABLE(DATAGRID)
+ { "HTMLDataGridCellElement", DontDelete, (intptr_t)jsDOMWindowHTMLDataGridCellElementConstructor, (intptr_t)setJSDOMWindowHTMLDataGridCellElementConstructor },
+#endif
+#if ENABLE(DATAGRID)
{ "HTMLDataGridColElement", DontDelete, (intptr_t)jsDOMWindowHTMLDataGridColElementConstructor, (intptr_t)setJSDOMWindowHTMLDataGridColElementConstructor },
+#endif
{ "HTMLDListElement", DontDelete, (intptr_t)jsDOMWindowHTMLDListElementConstructor, (intptr_t)setJSDOMWindowHTMLDListElementConstructor },
{ "HTMLDirectoryElement", DontDelete, (intptr_t)jsDOMWindowHTMLDirectoryElementConstructor, (intptr_t)setJSDOMWindowHTMLDirectoryElementConstructor },
{ "HTMLDivElement", DontDelete, (intptr_t)jsDOMWindowHTMLDivElementConstructor, (intptr_t)setJSDOMWindowHTMLDivElementConstructor },
@@ -467,6 +477,8 @@ static const HashTableValue JSDOMWindowTableValues[272] =
{ "XMLHttpRequest", DontDelete, (intptr_t)jsDOMWindowXMLHttpRequestConstructor, (intptr_t)setJSDOMWindowXMLHttpRequestConstructor },
{ "XMLHttpRequestUpload", DontDelete, (intptr_t)jsDOMWindowXMLHttpRequestUploadConstructor, (intptr_t)setJSDOMWindowXMLHttpRequestUploadConstructor },
{ "XMLHttpRequestException", DontDelete, (intptr_t)jsDOMWindowXMLHttpRequestExceptionConstructor, (intptr_t)setJSDOMWindowXMLHttpRequestExceptionConstructor },
+ { "MessagePort", DontDelete, (intptr_t)jsDOMWindowMessagePortConstructor, (intptr_t)setJSDOMWindowMessagePortConstructor },
+ { "MessageChannel", DontDelete, (intptr_t)jsDOMWindowMessageChannelConstructor, (intptr_t)setJSDOMWindowMessageChannelConstructor },
{ "Worker", DontDelete, (intptr_t)jsDOMWindowWorkerConstructor, (intptr_t)setJSDOMWindowWorkerConstructor },
{ "Plugin", DontDelete, (intptr_t)jsDOMWindowPluginConstructor, (intptr_t)setJSDOMWindowPluginConstructor },
{ "PluginArray", DontDelete, (intptr_t)jsDOMWindowPluginArrayConstructor, (intptr_t)setJSDOMWindowPluginArrayConstructor },
@@ -511,7 +523,7 @@ static const HashTableValue JSDOMWindowTableValues[272] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMWindowTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMWindowTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 32767, JSDOMWindowTableValues, 0 };
#else
@@ -561,7 +573,7 @@ static const HashTableValue JSDOMWindowPrototypeTableValues[37] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDOMWindowPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDOMWindowPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSDOMWindowPrototypeTableValues, 0 };
#else
@@ -2182,6 +2194,7 @@ JSValue jsDOMWindowHTMLCanvasElementConstructor(ExecState* exec, const Identifie
return JSHTMLCanvasElement::getConstructor(exec);
}
+#if ENABLE(DATAGRID)
JSValue jsDOMWindowHTMLDataGridElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
if (!static_cast<JSDOMWindow*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
@@ -2189,7 +2202,19 @@ JSValue jsDOMWindowHTMLDataGridElementConstructor(ExecState* exec, const Identif
UNUSED_PARAM(slot);
return JSHTMLDataGridElement::getConstructor(exec);
}
+#endif
+
+#if ENABLE(DATAGRID)
+JSValue jsDOMWindowHTMLDataGridCellElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ if (!static_cast<JSDOMWindow*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
+ return jsUndefined();
+ UNUSED_PARAM(slot);
+ return JSHTMLDataGridCellElement::getConstructor(exec);
+}
+#endif
+#if ENABLE(DATAGRID)
JSValue jsDOMWindowHTMLDataGridColElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
if (!static_cast<JSDOMWindow*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
@@ -2197,6 +2222,7 @@ JSValue jsDOMWindowHTMLDataGridColElementConstructor(ExecState* exec, const Iden
UNUSED_PARAM(slot);
return JSHTMLDataGridColElement::getConstructor(exec);
}
+#endif
JSValue jsDOMWindowHTMLDListElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
@@ -2833,6 +2859,21 @@ JSValue jsDOMWindowXMLHttpRequestExceptionConstructor(ExecState* exec, const Ide
return JSXMLHttpRequestException::getConstructor(exec);
}
+JSValue jsDOMWindowMessagePortConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ if (!static_cast<JSDOMWindow*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
+ return jsUndefined();
+ UNUSED_PARAM(slot);
+ return JSMessagePort::getConstructor(exec);
+}
+
+JSValue jsDOMWindowMessageChannelConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ if (!static_cast<JSDOMWindow*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
+ return jsUndefined();
+ return static_cast<JSDOMWindow*>(asObject(slot.slotBase()))->messageChannel(exec);
+}
+
JSValue jsDOMWindowWorkerConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
if (!static_cast<JSDOMWindow*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
@@ -4386,6 +4427,14 @@ void setJSDOMWindowHTMLDataGridElementConstructor(ExecState* exec, JSObject* thi
static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "HTMLDataGridElement"), value);
}
+void setJSDOMWindowHTMLDataGridCellElementConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec))
+ return;
+ // Shadowing a built-in constructor
+ static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "HTMLDataGridCellElement"), value);
+}
+
void setJSDOMWindowHTMLDataGridColElementConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
{
if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec))
@@ -5034,6 +5083,22 @@ void setJSDOMWindowXMLHttpRequestExceptionConstructor(ExecState* exec, JSObject*
static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "XMLHttpRequestException"), value);
}
+void setJSDOMWindowMessagePortConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec))
+ return;
+ // Shadowing a built-in constructor
+ static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "MessagePort"), value);
+}
+
+void setJSDOMWindowMessageChannelConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec))
+ return;
+ // Shadowing a built-in constructor
+ static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "MessageChannel"), value);
+}
+
void setJSDOMWindowWorkerConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
{
if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec))
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h
index 869e598..073eff7 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h
@@ -66,6 +66,7 @@ public:
JSC::JSValue webKitCSSMatrix(JSC::ExecState*) const;
JSC::JSValue webKitPoint(JSC::ExecState*) const;
JSC::JSValue xmlHttpRequest(JSC::ExecState*) const;
+ JSC::JSValue messageChannel(JSC::ExecState*) const;
JSC::JSValue worker(JSC::ExecState*) const;
JSC::JSValue audio(JSC::ExecState*) const;
@@ -447,6 +448,8 @@ JSC::JSValue jsDOMWindowHTMLCanvasElementConstructor(JSC::ExecState*, const JSC:
void setJSDOMWindowHTMLCanvasElementConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsDOMWindowHTMLDataGridElementConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSDOMWindowHTMLDataGridElementConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsDOMWindowHTMLDataGridCellElementConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+void setJSDOMWindowHTMLDataGridCellElementConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsDOMWindowHTMLDataGridColElementConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSDOMWindowHTMLDataGridColElementConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsDOMWindowHTMLDListElementConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
@@ -609,6 +612,10 @@ JSC::JSValue jsDOMWindowXMLHttpRequestUploadConstructor(JSC::ExecState*, const J
void setJSDOMWindowXMLHttpRequestUploadConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsDOMWindowXMLHttpRequestExceptionConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSDOMWindowXMLHttpRequestExceptionConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsDOMWindowMessagePortConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+void setJSDOMWindowMessagePortConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsDOMWindowMessageChannelConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+void setJSDOMWindowMessageChannelConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsDOMWindowWorkerConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSDOMWindowWorkerConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsDOMWindowPluginConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp
index 105b916..9559fb5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp
@@ -19,6 +19,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "JSDataGridColumn.h"
#include "DataGridColumn.h"
@@ -47,7 +50,7 @@ static const HashTableValue JSDataGridColumnTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDataGridColumnTable =
+static JSC_CONST_HASHTABLE HashTable JSDataGridColumnTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSDataGridColumnTableValues, 0 };
#else
@@ -67,7 +70,7 @@ static const HashTableValue JSDataGridColumnConstructorTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDataGridColumnConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSDataGridColumnConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSDataGridColumnConstructorTableValues, 0 };
#else
@@ -111,7 +114,7 @@ static const HashTableValue JSDataGridColumnPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDataGridColumnPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDataGridColumnPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSDataGridColumnPrototypeTableValues, 0 };
#else
@@ -287,3 +290,5 @@ DataGridColumn* toDataGridColumn(JSC::JSValue value)
}
}
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.h b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.h
index 331ad9d..a85b988 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.h
@@ -21,6 +21,8 @@
#ifndef JSDataGridColumn_h
#define JSDataGridColumn_h
+#if ENABLE(DATAGRID)
+
#include "JSDOMBinding.h"
#include <runtime/JSGlobalObject.h>
#include <runtime/ObjectPrototype.h>
@@ -95,4 +97,6 @@ JSC::JSValue jsDataGridColumnSORC_DESCENDING(JSC::ExecState*, const JSC::Identif
} // namespace WebCore
+#endif // ENABLE(DATAGRID)
+
#endif
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp
index 276878e..3c0eb8d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp
@@ -19,6 +19,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "JSDataGridColumnList.h"
#include "AtomicString.h"
@@ -48,7 +51,7 @@ static const HashTableValue JSDataGridColumnListTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDataGridColumnListTable =
+static JSC_CONST_HASHTABLE HashTable JSDataGridColumnListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSDataGridColumnListTableValues, 0 };
#else
@@ -62,7 +65,7 @@ static const HashTableValue JSDataGridColumnListConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDataGridColumnListConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSDataGridColumnListConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDataGridColumnListConstructorTableValues, 0 };
#else
@@ -105,7 +108,7 @@ static const HashTableValue JSDataGridColumnListPrototypeTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDataGridColumnListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDataGridColumnListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSDataGridColumnListPrototypeTableValues, 0 };
#else
@@ -299,3 +302,5 @@ DataGridColumnList* toDataGridColumnList(JSC::JSValue value)
}
}
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.h b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.h
index 879daf9..b76ffd5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.h
@@ -21,6 +21,8 @@
#ifndef JSDataGridColumnList_h
#define JSDataGridColumnList_h
+#if ENABLE(DATAGRID)
+
#include "JSDOMBinding.h"
#include <runtime/JSGlobalObject.h>
#include <runtime/ObjectPrototype.h>
@@ -90,4 +92,6 @@ JSC::JSValue jsDataGridColumnListConstructor(JSC::ExecState*, const JSC::Identif
} // namespace WebCore
+#endif // ENABLE(DATAGRID)
+
#endif
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp b/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp
index 490b081..894f93c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSDatabaseTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDatabaseTable =
+static JSC_CONST_HASHTABLE HashTable JSDatabaseTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDatabaseTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSDatabasePrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDatabasePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDatabasePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSDatabasePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp b/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp
index 2c59f13..ce7b850 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp
@@ -169,7 +169,7 @@ static const HashTableValue JSDocumentTableValues[69] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDocumentTable =
+static JSC_CONST_HASHTABLE HashTable JSDocumentTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSDocumentTableValues, 0 };
#else
@@ -183,7 +183,7 @@ static const HashTableValue JSDocumentConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDocumentConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSDocumentConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDocumentConstructorTableValues, 0 };
#else
@@ -257,7 +257,7 @@ static const HashTableValue JSDocumentPrototypeTableValues[37] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDocumentPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDocumentPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSDocumentPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDocumentFragment.cpp b/src/3rdparty/webkit/WebCore/generated/JSDocumentFragment.cpp
index 865efd2..05deb3c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDocumentFragment.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDocumentFragment.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSDocumentFragmentTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDocumentFragmentTable =
+static JSC_CONST_HASHTABLE HashTable JSDocumentFragmentTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDocumentFragmentTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSDocumentFragmentConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDocumentFragmentConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSDocumentFragmentConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDocumentFragmentConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSDocumentFragmentPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDocumentFragmentPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDocumentFragmentPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSDocumentFragmentPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDocumentType.cpp b/src/3rdparty/webkit/WebCore/generated/JSDocumentType.cpp
index 43e7a8c..361e62f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDocumentType.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDocumentType.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSDocumentTypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDocumentTypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDocumentTypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSDocumentTypeTableValues, 0 };
#else
@@ -62,7 +62,7 @@ static const HashTableValue JSDocumentTypeConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDocumentTypeConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSDocumentTypeConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDocumentTypeConstructorTableValues, 0 };
#else
@@ -100,7 +100,7 @@ static const HashTableValue JSDocumentTypePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSDocumentTypePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSDocumentTypePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSDocumentTypePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSElement.cpp
index afa1d93..a4d2409 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSElement.cpp
@@ -117,7 +117,7 @@ static const HashTableValue JSElementTableValues[60] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSElementTable =
+static JSC_CONST_HASHTABLE HashTable JSElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 8191, JSElementTableValues, 0 };
#else
@@ -131,7 +131,7 @@ static const HashTableValue JSElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSElementConstructorTableValues, 0 };
#else
@@ -196,7 +196,7 @@ static const HashTableValue JSElementPrototypeTableValues[28] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSEntity.cpp b/src/3rdparty/webkit/WebCore/generated/JSEntity.cpp
index be4eed5..4b354b0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSEntity.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSEntity.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSEntityTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEntityTable =
+static JSC_CONST_HASHTABLE HashTable JSEntityTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSEntityTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSEntityConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEntityConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSEntityConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSEntityConstructorTableValues, 0 };
#else
@@ -94,7 +94,7 @@ static const HashTableValue JSEntityPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEntityPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSEntityPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSEntityPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSEntityReference.cpp b/src/3rdparty/webkit/WebCore/generated/JSEntityReference.cpp
index dc12c48..1d6b6ff 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSEntityReference.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSEntityReference.cpp
@@ -38,7 +38,7 @@ static const HashTableValue JSEntityReferenceTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEntityReferenceTable =
+static JSC_CONST_HASHTABLE HashTable JSEntityReferenceTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSEntityReferenceTableValues, 0 };
#else
@@ -52,7 +52,7 @@ static const HashTableValue JSEntityReferenceConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEntityReferenceConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSEntityReferenceConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSEntityReferenceConstructorTableValues, 0 };
#else
@@ -90,7 +90,7 @@ static const HashTableValue JSEntityReferencePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEntityReferencePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSEntityReferencePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSEntityReferencePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp
index f00e179..550db25 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp
@@ -55,7 +55,7 @@ static const HashTableValue JSEventTableValues[13] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEventTable =
+static JSC_CONST_HASHTABLE HashTable JSEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSEventTableValues, 0 };
#else
@@ -88,7 +88,7 @@ static const HashTableValue JSEventConstructorTableValues[20] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 8191, JSEventConstructorTableValues, 0 };
#else
@@ -148,7 +148,7 @@ static const HashTableValue JSEventPrototypeTableValues[23] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 8191, JSEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp b/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp
index 2adb70a..1c39ced 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSEventExceptionTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEventExceptionTable =
+static JSC_CONST_HASHTABLE HashTable JSEventExceptionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSEventExceptionTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSEventExceptionConstructorTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEventExceptionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSEventExceptionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSEventExceptionConstructorTableValues, 0 };
#else
@@ -100,7 +100,7 @@ static const HashTableValue JSEventExceptionPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSEventExceptionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSEventExceptionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSEventExceptionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSFile.cpp b/src/3rdparty/webkit/WebCore/generated/JSFile.cpp
index d25dfc6..923e24b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSFile.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSFile.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSFileTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSFileTable =
+static JSC_CONST_HASHTABLE HashTable JSFileTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSFileTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSFileConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSFileConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSFileConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSFileConstructorTableValues, 0 };
#else
@@ -95,7 +95,7 @@ static const HashTableValue JSFilePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSFilePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSFilePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSFilePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp b/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp
index cd165c1..9d14098 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSFileListTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSFileListTable =
+static JSC_CONST_HASHTABLE HashTable JSFileListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSFileListTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSFileListConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSFileListConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSFileListConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSFileListConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSFileListPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSFileListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSFileListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSFileListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp
index a75348b..104d781 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSGeolocationTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSGeolocationTable =
+static JSC_CONST_HASHTABLE HashTable JSGeolocationTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSGeolocationTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSGeolocationPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSGeolocationPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSGeolocationPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSGeolocationPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp b/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp
index 35399cf..b872171 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSGeopositionTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSGeopositionTable =
+static JSC_CONST_HASHTABLE HashTable JSGeopositionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSGeopositionTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSGeopositionPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSGeopositionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSGeopositionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSGeopositionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLAnchorElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLAnchorElement.cpp
index c422551..a9bbfca 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLAnchorElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLAnchorElement.cpp
@@ -60,7 +60,7 @@ static const HashTableValue JSHTMLAnchorElementTableValues[21] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAnchorElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAnchorElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSHTMLAnchorElementTableValues, 0 };
#else
@@ -74,7 +74,7 @@ static const HashTableValue JSHTMLAnchorElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAnchorElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAnchorElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLAnchorElementConstructorTableValues, 0 };
#else
@@ -113,7 +113,7 @@ static const HashTableValue JSHTMLAnchorElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAnchorElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAnchorElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLAnchorElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLAppletElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLAppletElement.cpp
index 787c2c7..4fe98d6 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLAppletElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLAppletElement.cpp
@@ -53,7 +53,7 @@ static const HashTableValue JSHTMLAppletElementTableValues[13] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAppletElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAppletElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLAppletElementTableValues, 0 };
#else
@@ -67,7 +67,7 @@ static const HashTableValue JSHTMLAppletElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAppletElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAppletElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLAppletElementConstructorTableValues, 0 };
#else
@@ -105,7 +105,7 @@ static const HashTableValue JSHTMLAppletElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAppletElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAppletElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLAppletElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLAreaElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLAreaElement.cpp
index 1d40591..f78a54b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLAreaElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLAreaElement.cpp
@@ -54,7 +54,7 @@ static const HashTableValue JSHTMLAreaElementTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAreaElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAreaElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSHTMLAreaElementTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSHTMLAreaElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAreaElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAreaElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLAreaElementConstructorTableValues, 0 };
#else
@@ -106,7 +106,7 @@ static const HashTableValue JSHTMLAreaElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAreaElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAreaElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLAreaElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLAudioElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLAudioElement.cpp
index 00db209..a2fbfce 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLAudioElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLAudioElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLAudioElementTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAudioElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAudioElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLAudioElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLAudioElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAudioElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAudioElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLAudioElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLAudioElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLAudioElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLAudioElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLAudioElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLBRElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLBRElement.cpp
index aff5b90..2a43e6c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLBRElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLBRElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLBRElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBRElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBRElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLBRElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLBRElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBRElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBRElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBRElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLBRElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBRElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBRElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBRElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLBaseElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLBaseElement.cpp
index d0c6502..7c78555 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLBaseElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLBaseElement.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSHTMLBaseElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBaseElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBaseElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLBaseElementTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSHTMLBaseElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBaseElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBaseElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBaseElementConstructorTableValues, 0 };
#else
@@ -94,7 +94,7 @@ static const HashTableValue JSHTMLBaseElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBaseElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBaseElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBaseElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLBaseFontElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLBaseFontElement.cpp
index 24288a2..081be5a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLBaseFontElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLBaseFontElement.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSHTMLBaseFontElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBaseFontElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBaseFontElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLBaseFontElementTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSHTMLBaseFontElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBaseFontElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBaseFontElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBaseFontElementConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSHTMLBaseFontElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBaseFontElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBaseFontElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBaseFontElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLBlockquoteElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLBlockquoteElement.cpp
index aa108aa..852568b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLBlockquoteElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLBlockquoteElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLBlockquoteElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBlockquoteElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBlockquoteElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLBlockquoteElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLBlockquoteElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBlockquoteElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBlockquoteElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBlockquoteElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLBlockquoteElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBlockquoteElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBlockquoteElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBlockquoteElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp
index 6da9517..d86b723 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp
@@ -57,7 +57,7 @@ static const HashTableValue JSHTMLBodyElementTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBodyElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBodyElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLBodyElementTableValues, 0 };
#else
@@ -71,7 +71,7 @@ static const HashTableValue JSHTMLBodyElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBodyElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBodyElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBodyElementConstructorTableValues, 0 };
#else
@@ -109,7 +109,7 @@ static const HashTableValue JSHTMLBodyElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLBodyElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLBodyElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLBodyElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.cpp
index 96f463b..098528d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.cpp
@@ -24,7 +24,9 @@
#include "HTMLButtonElement.h"
#include "HTMLFormElement.h"
#include "JSHTMLFormElement.h"
+#include "JSValidityState.h"
#include "KURL.h"
+#include "ValidityState.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
@@ -37,9 +39,10 @@ ASSERT_CLASS_FITS_IN_CELL(JSHTMLButtonElement);
/* Hash table */
-static const HashTableValue JSHTMLButtonElementTableValues[10] =
+static const HashTableValue JSHTMLButtonElementTableValues[11] =
{
{ "form", DontDelete|ReadOnly, (intptr_t)jsHTMLButtonElementForm, (intptr_t)0 },
+ { "validity", DontDelete|ReadOnly, (intptr_t)jsHTMLButtonElementValidity, (intptr_t)0 },
{ "accessKey", DontDelete, (intptr_t)jsHTMLButtonElementAccessKey, (intptr_t)setJSHTMLButtonElementAccessKey },
{ "disabled", DontDelete, (intptr_t)jsHTMLButtonElementDisabled, (intptr_t)setJSHTMLButtonElementDisabled },
{ "autofocus", DontDelete, (intptr_t)jsHTMLButtonElementAutofocus, (intptr_t)setJSHTMLButtonElementAutofocus },
@@ -51,7 +54,7 @@ static const HashTableValue JSHTMLButtonElementTableValues[10] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLButtonElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLButtonElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLButtonElementTableValues, 0 };
#else
@@ -65,7 +68,7 @@ static const HashTableValue JSHTMLButtonElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLButtonElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLButtonElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLButtonElementConstructorTableValues, 0 };
#else
@@ -104,7 +107,7 @@ static const HashTableValue JSHTMLButtonElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLButtonElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLButtonElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLButtonElementPrototypeTableValues, 0 };
#else
@@ -147,6 +150,13 @@ JSValue jsHTMLButtonElementForm(ExecState* exec, const Identifier&, const Proper
return toJS(exec, WTF::getPtr(imp->form()));
}
+JSValue jsHTMLButtonElementValidity(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(static_cast<JSHTMLButtonElement*>(asObject(slot.slotBase()))->impl());
+ return toJS(exec, WTF::getPtr(imp->validity()));
+}
+
JSValue jsHTMLButtonElementAccessKey(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
UNUSED_PARAM(exec);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.h
index 9849bbb..1ac56c5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.h
@@ -66,6 +66,7 @@ JSC::JSValue JSC_HOST_CALL jsHTMLButtonElementPrototypeFunctionClick(JSC::ExecSt
// Attributes
JSC::JSValue jsHTMLButtonElementForm(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsHTMLButtonElementValidity(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsHTMLButtonElementAccessKey(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSHTMLButtonElementAccessKey(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsHTMLButtonElementDisabled(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLCanvasElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLCanvasElement.cpp
index b90cbea..d40e900 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLCanvasElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLCanvasElement.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSHTMLCanvasElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLCanvasElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLCanvasElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLCanvasElementTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSHTMLCanvasElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLCanvasElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLCanvasElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLCanvasElementConstructorTableValues, 0 };
#else
@@ -99,7 +99,7 @@ static const HashTableValue JSHTMLCanvasElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLCanvasElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLCanvasElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLCanvasElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp
index 7ff47ac..9b6bda3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSHTMLCollectionTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLCollectionTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLCollectionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLCollectionTableValues, 0 };
#else
@@ -62,7 +62,7 @@ static const HashTableValue JSHTMLCollectionConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLCollectionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLCollectionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLCollectionConstructorTableValues, 0 };
#else
@@ -103,7 +103,7 @@ static const HashTableValue JSHTMLCollectionPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLCollectionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLCollectionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLCollectionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDListElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLDListElement.cpp
index e65bb1f..a3f60b2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDListElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDListElement.cpp
@@ -39,7 +39,7 @@ static const HashTableValue JSHTMLDListElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDListElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDListElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLDListElementTableValues, 0 };
#else
@@ -53,7 +53,7 @@ static const HashTableValue JSHTMLDListElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDListElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDListElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDListElementConstructorTableValues, 0 };
#else
@@ -91,7 +91,7 @@ static const HashTableValue JSHTMLDListElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDListElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDListElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDListElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.cpp
index e0f8624..f070da6 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.cpp
@@ -19,6 +19,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "JSHTMLDataGridCellElement.h"
#include "HTMLDataGridCellElement.h"
@@ -46,7 +49,7 @@ static const HashTableValue JSHTMLDataGridCellElementTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridCellElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridCellElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLDataGridCellElementTableValues, 0 };
#else
@@ -60,7 +63,7 @@ static const HashTableValue JSHTMLDataGridCellElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridCellElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridCellElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDataGridCellElementConstructorTableValues, 0 };
#else
@@ -98,7 +101,7 @@ static const HashTableValue JSHTMLDataGridCellElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridCellElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridCellElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDataGridCellElementPrototypeTableValues, 0 };
#else
@@ -210,3 +213,5 @@ JSValue JSHTMLDataGridCellElement::getConstructor(ExecState* exec)
}
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.h
index a0b8815..eb0a6de 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.h
@@ -21,6 +21,8 @@
#ifndef JSHTMLDataGridCellElement_h
#define JSHTMLDataGridCellElement_h
+#if ENABLE(DATAGRID)
+
#include "JSHTMLElement.h"
namespace WebCore {
@@ -71,4 +73,6 @@ JSC::JSValue jsHTMLDataGridCellElementConstructor(JSC::ExecState*, const JSC::Id
} // namespace WebCore
+#endif // ENABLE(DATAGRID)
+
#endif
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.cpp
index a608a1f..0f750e7 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.cpp
@@ -19,6 +19,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "JSHTMLDataGridColElement.h"
#include "HTMLDataGridColElement.h"
@@ -46,7 +49,7 @@ static const HashTableValue JSHTMLDataGridColElementTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridColElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridColElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLDataGridColElementTableValues, 0 };
#else
@@ -60,7 +63,7 @@ static const HashTableValue JSHTMLDataGridColElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridColElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridColElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDataGridColElementConstructorTableValues, 0 };
#else
@@ -98,7 +101,7 @@ static const HashTableValue JSHTMLDataGridColElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridColElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridColElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDataGridColElementPrototypeTableValues, 0 };
#else
@@ -210,3 +213,5 @@ JSValue JSHTMLDataGridColElement::getConstructor(ExecState* exec)
}
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.h
index 24efd48..0fe1b0e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.h
@@ -21,6 +21,8 @@
#ifndef JSHTMLDataGridColElement_h
#define JSHTMLDataGridColElement_h
+#if ENABLE(DATAGRID)
+
#include "JSHTMLElement.h"
namespace WebCore {
@@ -71,4 +73,6 @@ JSC::JSValue jsHTMLDataGridColElementConstructor(JSC::ExecState*, const JSC::Ide
} // namespace WebCore
+#endif // ENABLE(DATAGRID)
+
#endif
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.cpp
index ea4237c..d964c7b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.cpp
@@ -19,6 +19,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "JSHTMLDataGridElement.h"
#include "DataGridColumnList.h"
@@ -45,7 +48,7 @@ static const HashTableValue JSHTMLDataGridElementTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLDataGridElementTableValues, 0 };
#else
@@ -59,7 +62,7 @@ static const HashTableValue JSHTMLDataGridElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDataGridElementConstructorTableValues, 0 };
#else
@@ -97,7 +100,7 @@ static const HashTableValue JSHTMLDataGridElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDataGridElementPrototypeTableValues, 0 };
#else
@@ -200,3 +203,5 @@ JSValue JSHTMLDataGridElement::getConstructor(ExecState* exec)
}
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.h
index ee6c8d8..7be0e5e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.h
@@ -21,6 +21,8 @@
#ifndef JSHTMLDataGridElement_h
#define JSHTMLDataGridElement_h
+#if ENABLE(DATAGRID)
+
#include "JSHTMLElement.h"
namespace WebCore {
@@ -74,4 +76,6 @@ JSC::JSValue jsHTMLDataGridElementConstructor(JSC::ExecState*, const JSC::Identi
} // namespace WebCore
+#endif // ENABLE(DATAGRID)
+
#endif
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.cpp
index 938ff16..b6a2d97 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.cpp
@@ -19,6 +19,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "JSHTMLDataGridRowElement.h"
#include "HTMLDataGridRowElement.h"
@@ -41,7 +44,7 @@ static const HashTableValue JSHTMLDataGridRowElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridRowElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridRowElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLDataGridRowElementTableValues, 0 };
#else
@@ -55,7 +58,7 @@ static const HashTableValue JSHTMLDataGridRowElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridRowElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridRowElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDataGridRowElementConstructorTableValues, 0 };
#else
@@ -93,7 +96,7 @@ static const HashTableValue JSHTMLDataGridRowElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDataGridRowElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDataGridRowElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDataGridRowElementPrototypeTableValues, 0 };
#else
@@ -179,3 +182,5 @@ JSValue JSHTMLDataGridRowElement::getConstructor(ExecState* exec)
}
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.h
index 562b5f7..987e8bf 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.h
@@ -21,6 +21,8 @@
#ifndef JSHTMLDataGridRowElement_h
#define JSHTMLDataGridRowElement_h
+#if ENABLE(DATAGRID)
+
#include "JSHTMLElement.h"
namespace WebCore {
@@ -67,4 +69,6 @@ JSC::JSValue jsHTMLDataGridRowElementConstructor(JSC::ExecState*, const JSC::Ide
} // namespace WebCore
+#endif // ENABLE(DATAGRID)
+
#endif
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDirectoryElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLDirectoryElement.cpp
index 711057b..ddad16b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDirectoryElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDirectoryElement.cpp
@@ -39,7 +39,7 @@ static const HashTableValue JSHTMLDirectoryElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDirectoryElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDirectoryElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLDirectoryElementTableValues, 0 };
#else
@@ -53,7 +53,7 @@ static const HashTableValue JSHTMLDirectoryElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDirectoryElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDirectoryElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDirectoryElementConstructorTableValues, 0 };
#else
@@ -91,7 +91,7 @@ static const HashTableValue JSHTMLDirectoryElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDirectoryElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDirectoryElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDirectoryElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDivElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLDivElement.cpp
index 43da933..779666e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDivElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDivElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLDivElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDivElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDivElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLDivElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLDivElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDivElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDivElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDivElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLDivElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDivElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDivElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDivElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLDocument.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLDocument.cpp
index 1182aee..fd3aaf4 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLDocument.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLDocument.cpp
@@ -62,7 +62,7 @@ static const HashTableValue JSHTMLDocumentTableValues[17] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDocumentTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDocumentTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSHTMLDocumentTableValues, 0 };
#else
@@ -76,7 +76,7 @@ static const HashTableValue JSHTMLDocumentConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDocumentConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDocumentConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLDocumentConstructorTableValues, 0 };
#else
@@ -122,7 +122,7 @@ static const HashTableValue JSHTMLDocumentPrototypeTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLDocumentPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLDocumentPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLDocumentPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLElement.cpp
index ce77377..25e9bca 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLElement.cpp
@@ -60,7 +60,7 @@ static const HashTableValue JSHTMLElementTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSHTMLElementTableValues, 0 };
#else
@@ -74,7 +74,7 @@ static const HashTableValue JSHTMLElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLElementConstructorTableValues, 0 };
#else
@@ -115,7 +115,7 @@ static const HashTableValue JSHTMLElementPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLElementWrapperFactory.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLElementWrapperFactory.cpp
index 7d66f62..aaedcca 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLElementWrapperFactory.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLElementWrapperFactory.cpp
@@ -243,21 +243,33 @@ static JSNode* createHTMLTableColElementWrapper(ExecState* exec, PassRefPtr<HTML
return CREATE_DOM_NODE_WRAPPER(exec, HTMLTableColElement, element.get());
}
+#if ENABLE(DATAGRID)
+
static JSNode* createHTMLDataGridElementWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
{
return CREATE_DOM_NODE_WRAPPER(exec, HTMLDataGridElement, element.get());
}
+#endif
+
+#if ENABLE(DATAGRID)
+
static JSNode* createHTMLDataGridCellElementWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
{
return CREATE_DOM_NODE_WRAPPER(exec, HTMLDataGridCellElement, element.get());
}
+#endif
+
+#if ENABLE(DATAGRID)
+
static JSNode* createHTMLDataGridColElementWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
{
return CREATE_DOM_NODE_WRAPPER(exec, HTMLDataGridColElement, element.get());
}
+#endif
+
static JSNode* createHTMLModElementWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
{
return CREATE_DOM_NODE_WRAPPER(exec, HTMLModElement, element.get());
@@ -278,11 +290,15 @@ static JSNode* createHTMLDListElementWrapper(ExecState* exec, PassRefPtr<HTMLEle
return CREATE_DOM_NODE_WRAPPER(exec, HTMLDListElement, element.get());
}
+#if ENABLE(DATAGRID)
+
static JSNode* createHTMLDataGridRowElementWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
{
return CREATE_DOM_NODE_WRAPPER(exec, HTMLDataGridRowElement, element.get());
}
+#endif
+
static JSNode* createHTMLEmbedElementWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
{
return CREATE_DOM_NODE_WRAPPER(exec, HTMLEmbedElement, element.get());
@@ -526,14 +542,22 @@ JSNode* createJSHTMLWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
map.set(captionTag.localName().impl(), createHTMLTableCaptionElementWrapper);
map.set(colTag.localName().impl(), createHTMLTableColElementWrapper);
map.set(colgroupTag.localName().impl(), createHTMLTableColElementWrapper);
+#if ENABLE(DATAGRID)
map.set(datagridTag.localName().impl(), createHTMLDataGridElementWrapper);
+#endif
+#if ENABLE(DATAGRID)
map.set(dcellTag.localName().impl(), createHTMLDataGridCellElementWrapper);
+#endif
+#if ENABLE(DATAGRID)
map.set(dcolTag.localName().impl(), createHTMLDataGridColElementWrapper);
+#endif
map.set(delTag.localName().impl(), createHTMLModElementWrapper);
map.set(dirTag.localName().impl(), createHTMLDirectoryElementWrapper);
map.set(divTag.localName().impl(), createHTMLDivElementWrapper);
map.set(dlTag.localName().impl(), createHTMLDListElementWrapper);
+#if ENABLE(DATAGRID)
map.set(drowTag.localName().impl(), createHTMLDataGridRowElementWrapper);
+#endif
map.set(embedTag.localName().impl(), createHTMLEmbedElementWrapper);
map.set(fieldsetTag.localName().impl(), createHTMLFieldSetElementWrapper);
map.set(fontTag.localName().impl(), createHTMLFontElementWrapper);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLEmbedElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLEmbedElement.cpp
index 107a225..b1c63f8 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLEmbedElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLEmbedElement.cpp
@@ -52,7 +52,7 @@ static const HashTableValue JSHTMLEmbedElementTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLEmbedElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLEmbedElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 16383, JSHTMLEmbedElementTableValues, 0 };
#else
@@ -66,7 +66,7 @@ static const HashTableValue JSHTMLEmbedElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLEmbedElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLEmbedElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLEmbedElementConstructorTableValues, 0 };
#else
@@ -105,7 +105,7 @@ static const HashTableValue JSHTMLEmbedElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLEmbedElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLEmbedElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLEmbedElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.cpp
index 27a1ebb..07dc170 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.cpp
@@ -24,6 +24,8 @@
#include "HTMLFieldSetElement.h"
#include "HTMLFormElement.h"
#include "JSHTMLFormElement.h"
+#include "JSValidityState.h"
+#include "ValidityState.h"
#include <wtf/GetPtr.h>
using namespace JSC;
@@ -34,15 +36,16 @@ ASSERT_CLASS_FITS_IN_CELL(JSHTMLFieldSetElement);
/* Hash table */
-static const HashTableValue JSHTMLFieldSetElementTableValues[4] =
+static const HashTableValue JSHTMLFieldSetElementTableValues[5] =
{
{ "form", DontDelete|ReadOnly, (intptr_t)jsHTMLFieldSetElementForm, (intptr_t)0 },
+ { "validity", DontDelete|ReadOnly, (intptr_t)jsHTMLFieldSetElementValidity, (intptr_t)0 },
{ "willValidate", DontDelete|ReadOnly, (intptr_t)jsHTMLFieldSetElementWillValidate, (intptr_t)0 },
{ "constructor", DontEnum|ReadOnly, (intptr_t)jsHTMLFieldSetElementConstructor, (intptr_t)0 },
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFieldSetElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFieldSetElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLFieldSetElementTableValues, 0 };
#else
@@ -56,7 +59,7 @@ static const HashTableValue JSHTMLFieldSetElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFieldSetElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFieldSetElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLFieldSetElementConstructorTableValues, 0 };
#else
@@ -94,7 +97,7 @@ static const HashTableValue JSHTMLFieldSetElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFieldSetElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFieldSetElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLFieldSetElementPrototypeTableValues, 0 };
#else
@@ -132,6 +135,13 @@ JSValue jsHTMLFieldSetElementForm(ExecState* exec, const Identifier&, const Prop
return toJS(exec, WTF::getPtr(imp->form()));
}
+JSValue jsHTMLFieldSetElementValidity(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ HTMLFieldSetElement* imp = static_cast<HTMLFieldSetElement*>(static_cast<JSHTMLFieldSetElement*>(asObject(slot.slotBase()))->impl());
+ return toJS(exec, WTF::getPtr(imp->validity()));
+}
+
JSValue jsHTMLFieldSetElementWillValidate(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
UNUSED_PARAM(exec);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.h
index fa6c56c..6966b40 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.h
@@ -57,6 +57,7 @@ public:
// Attributes
JSC::JSValue jsHTMLFieldSetElementForm(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsHTMLFieldSetElementValidity(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsHTMLFieldSetElementWillValidate(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsHTMLFieldSetElementConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLFontElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLFontElement.cpp
index 0bff1ee..5d80326 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLFontElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLFontElement.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSHTMLFontElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFontElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFontElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLFontElementTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSHTMLFontElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFontElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFontElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLFontElementConstructorTableValues, 0 };
#else
@@ -95,7 +95,7 @@ static const HashTableValue JSHTMLFontElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFontElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFontElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLFontElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLFormElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLFormElement.cpp
index de495a5..c3cb279 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLFormElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLFormElement.cpp
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLFormElementTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFormElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFormElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 4095, JSHTMLFormElementTableValues, 0 };
#else
@@ -69,7 +69,7 @@ static const HashTableValue JSHTMLFormElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFormElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFormElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLFormElementConstructorTableValues, 0 };
#else
@@ -109,7 +109,7 @@ static const HashTableValue JSHTMLFormElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFormElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFormElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLFormElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameElement.cpp
index a5bff3e..d11a908 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameElement.cpp
@@ -62,7 +62,7 @@ static const HashTableValue JSHTMLFrameElementTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFrameElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFrameElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 16383, JSHTMLFrameElementTableValues, 0 };
#else
@@ -76,7 +76,7 @@ static const HashTableValue JSHTMLFrameElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFrameElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFrameElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLFrameElementConstructorTableValues, 0 };
#else
@@ -115,7 +115,7 @@ static const HashTableValue JSHTMLFrameElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFrameElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFrameElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLFrameElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp
index 7abfddd..358280c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp
@@ -54,7 +54,7 @@ static const HashTableValue JSHTMLFrameSetElementTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFrameSetElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFrameSetElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLFrameSetElementTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSHTMLFrameSetElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFrameSetElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFrameSetElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLFrameSetElementConstructorTableValues, 0 };
#else
@@ -106,7 +106,7 @@ static const HashTableValue JSHTMLFrameSetElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLFrameSetElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLFrameSetElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLFrameSetElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLHRElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLHRElement.cpp
index 8ec45b5..e208976 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLHRElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLHRElement.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSHTMLHRElementTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHRElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHRElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLHRElementTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSHTMLHRElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHRElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHRElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLHRElementConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSHTMLHRElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHRElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHRElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLHRElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLHeadElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLHeadElement.cpp
index a2ec868..ff1f3e4 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLHeadElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLHeadElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLHeadElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHeadElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHeadElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLHeadElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLHeadElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHeadElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHeadElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLHeadElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLHeadElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHeadElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHeadElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLHeadElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLHeadingElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLHeadingElement.cpp
index 5a5b8b2..b4702f3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLHeadingElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLHeadingElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLHeadingElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHeadingElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHeadingElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLHeadingElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLHeadingElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHeadingElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHeadingElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLHeadingElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLHeadingElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHeadingElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHeadingElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLHeadingElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLHtmlElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLHtmlElement.cpp
index 95ab223..8325f69 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLHtmlElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLHtmlElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLHtmlElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHtmlElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHtmlElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLHtmlElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLHtmlElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHtmlElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHtmlElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLHtmlElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLHtmlElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLHtmlElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLHtmlElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLHtmlElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLIFrameElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLIFrameElement.cpp
index 068dfc2..557b3a4 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLIFrameElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLIFrameElement.cpp
@@ -60,7 +60,7 @@ static const HashTableValue JSHTMLIFrameElementTableValues[14] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLIFrameElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLIFrameElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 16383, JSHTMLIFrameElementTableValues, 0 };
#else
@@ -74,7 +74,7 @@ static const HashTableValue JSHTMLIFrameElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLIFrameElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLIFrameElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLIFrameElementConstructorTableValues, 0 };
#else
@@ -113,7 +113,7 @@ static const HashTableValue JSHTMLIFrameElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLIFrameElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLIFrameElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLIFrameElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLImageElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLImageElement.cpp
index a0259bb..da621b2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLImageElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLImageElement.cpp
@@ -60,7 +60,7 @@ static const HashTableValue JSHTMLImageElementTableValues[20] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLImageElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLImageElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 16383, JSHTMLImageElementTableValues, 0 };
#else
@@ -74,7 +74,7 @@ static const HashTableValue JSHTMLImageElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLImageElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLImageElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLImageElementConstructorTableValues, 0 };
#else
@@ -112,7 +112,7 @@ static const HashTableValue JSHTMLImageElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLImageElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLImageElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLImageElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.cpp
index 720249a..e6111bb 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.cpp
@@ -26,7 +26,9 @@
#include "HTMLInputElement.h"
#include "JSFileList.h"
#include "JSHTMLFormElement.h"
+#include "JSValidityState.h"
#include "KURL.h"
+#include "ValidityState.h"
#include <runtime/Error.h>
#include <runtime/JSNumberCell.h>
#include <runtime/JSString.h>
@@ -40,11 +42,12 @@ ASSERT_CLASS_FITS_IN_CELL(JSHTMLInputElement);
/* Hash table */
-static const HashTableValue JSHTMLInputElementTableValues[27] =
+static const HashTableValue JSHTMLInputElementTableValues[28] =
{
{ "defaultValue", DontDelete, (intptr_t)jsHTMLInputElementDefaultValue, (intptr_t)setJSHTMLInputElementDefaultValue },
{ "defaultChecked", DontDelete, (intptr_t)jsHTMLInputElementDefaultChecked, (intptr_t)setJSHTMLInputElementDefaultChecked },
{ "form", DontDelete|ReadOnly, (intptr_t)jsHTMLInputElementForm, (intptr_t)0 },
+ { "validity", DontDelete|ReadOnly, (intptr_t)jsHTMLInputElementValidity, (intptr_t)0 },
{ "accept", DontDelete, (intptr_t)jsHTMLInputElementAccept, (intptr_t)setJSHTMLInputElementAccept },
{ "accessKey", DontDelete, (intptr_t)jsHTMLInputElementAccessKey, (intptr_t)setJSHTMLInputElementAccessKey },
{ "align", DontDelete, (intptr_t)jsHTMLInputElementAlign, (intptr_t)setJSHTMLInputElementAlign },
@@ -71,7 +74,7 @@ static const HashTableValue JSHTMLInputElementTableValues[27] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLInputElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLInputElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSHTMLInputElementTableValues, 0 };
#else
@@ -85,7 +88,7 @@ static const HashTableValue JSHTMLInputElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLInputElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLInputElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLInputElementConstructorTableValues, 0 };
#else
@@ -126,7 +129,7 @@ static const HashTableValue JSHTMLInputElementPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLInputElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLInputElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLInputElementPrototypeTableValues, 0 };
#else
@@ -183,6 +186,13 @@ JSValue jsHTMLInputElementForm(ExecState* exec, const Identifier&, const Propert
return toJS(exec, WTF::getPtr(imp->form()));
}
+JSValue jsHTMLInputElementValidity(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ HTMLInputElement* imp = static_cast<HTMLInputElement*>(static_cast<JSHTMLInputElement*>(asObject(slot.slotBase()))->impl());
+ return toJS(exec, WTF::getPtr(imp->validity()));
+}
+
JSValue jsHTMLInputElementAccept(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
UNUSED_PARAM(exec);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.h
index ef9431c..52f455e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.h
@@ -82,6 +82,7 @@ void setJSHTMLInputElementDefaultValue(JSC::ExecState*, JSC::JSObject*, JSC::JSV
JSC::JSValue jsHTMLInputElementDefaultChecked(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSHTMLInputElementDefaultChecked(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsHTMLInputElementForm(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsHTMLInputElementValidity(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsHTMLInputElementAccept(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSHTMLInputElementAccept(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsHTMLInputElementAccessKey(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLIsIndexElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLIsIndexElement.cpp
index d23f3f1..6322e51 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLIsIndexElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLIsIndexElement.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSHTMLIsIndexElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLIsIndexElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLIsIndexElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLIsIndexElementTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSHTMLIsIndexElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLIsIndexElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLIsIndexElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLIsIndexElementConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSHTMLIsIndexElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLIsIndexElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLIsIndexElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLIsIndexElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLLIElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLLIElement.cpp
index 35f00d2..14ba464 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLLIElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLLIElement.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSHTMLLIElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLIElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLIElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLLIElementTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSHTMLLIElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLIElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLIElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLLIElementConstructorTableValues, 0 };
#else
@@ -95,7 +95,7 @@ static const HashTableValue JSHTMLLIElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLIElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLIElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLLIElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLLabelElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLLabelElement.cpp
index 24d1f57..37c7c76 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLLabelElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLLabelElement.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSHTMLLabelElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLabelElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLabelElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLLabelElementTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSHTMLLabelElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLabelElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLabelElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLLabelElementConstructorTableValues, 0 };
#else
@@ -97,7 +97,7 @@ static const HashTableValue JSHTMLLabelElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLabelElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLabelElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLLabelElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLLegendElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLLegendElement.cpp
index b52f3e9..b3b985a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLLegendElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLLegendElement.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSHTMLLegendElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLegendElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLegendElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLLegendElementTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSHTMLLegendElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLegendElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLegendElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLLegendElementConstructorTableValues, 0 };
#else
@@ -97,7 +97,7 @@ static const HashTableValue JSHTMLLegendElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLegendElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLegendElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLLegendElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLLinkElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLLinkElement.cpp
index c40004e..d6bf634 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLLinkElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLLinkElement.cpp
@@ -52,7 +52,7 @@ static const HashTableValue JSHTMLLinkElementTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLinkElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLinkElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLLinkElementTableValues, 0 };
#else
@@ -66,7 +66,7 @@ static const HashTableValue JSHTMLLinkElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLinkElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLinkElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLLinkElementConstructorTableValues, 0 };
#else
@@ -104,7 +104,7 @@ static const HashTableValue JSHTMLLinkElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLLinkElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLLinkElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLLinkElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLMapElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLMapElement.cpp
index 458c3f1..9c9345f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLMapElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLMapElement.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSHTMLMapElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMapElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMapElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLMapElementTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSHTMLMapElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMapElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMapElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLMapElementConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSHTMLMapElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMapElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMapElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLMapElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLMarqueeElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLMarqueeElement.cpp
index 90f090f..2e8c6d3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLMarqueeElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLMarqueeElement.cpp
@@ -39,7 +39,7 @@ static const HashTableValue JSHTMLMarqueeElementTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMarqueeElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMarqueeElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLMarqueeElementTableValues, 0 };
#else
@@ -53,7 +53,7 @@ static const HashTableValue JSHTMLMarqueeElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMarqueeElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMarqueeElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLMarqueeElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLMarqueeElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMarqueeElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMarqueeElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLMarqueeElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLMediaElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLMediaElement.cpp
index 1f04d40..c3c74d3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLMediaElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLMediaElement.cpp
@@ -72,7 +72,7 @@ static const HashTableValue JSHTMLMediaElementTableValues[25] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMediaElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMediaElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSHTMLMediaElementTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSHTMLMediaElementConstructorTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMediaElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMediaElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLMediaElementConstructorTableValues, 0 };
#else
@@ -148,7 +148,7 @@ static const HashTableValue JSHTMLMediaElementPrototypeTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMediaElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMediaElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLMediaElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLMenuElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLMenuElement.cpp
index 35ce014..e658ed8 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLMenuElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLMenuElement.cpp
@@ -39,7 +39,7 @@ static const HashTableValue JSHTMLMenuElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMenuElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMenuElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLMenuElementTableValues, 0 };
#else
@@ -53,7 +53,7 @@ static const HashTableValue JSHTMLMenuElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMenuElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMenuElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLMenuElementConstructorTableValues, 0 };
#else
@@ -91,7 +91,7 @@ static const HashTableValue JSHTMLMenuElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMenuElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMenuElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLMenuElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLMetaElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLMetaElement.cpp
index 213c2bf..6b26520 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLMetaElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLMetaElement.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSHTMLMetaElementTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMetaElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMetaElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLMetaElementTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSHTMLMetaElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMetaElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMetaElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLMetaElementConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSHTMLMetaElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLMetaElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLMetaElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLMetaElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLModElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLModElement.cpp
index b55516c..ded7e9f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLModElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLModElement.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSHTMLModElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLModElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLModElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLModElementTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSHTMLModElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLModElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLModElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLModElementConstructorTableValues, 0 };
#else
@@ -94,7 +94,7 @@ static const HashTableValue JSHTMLModElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLModElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLModElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLModElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLOListElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLOListElement.cpp
index 70fe0b4..63b781c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLOListElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLOListElement.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSHTMLOListElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOListElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOListElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLOListElementTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSHTMLOListElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOListElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOListElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLOListElementConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSHTMLOListElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOListElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOListElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLOListElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLObjectElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLObjectElement.cpp
index c50e27a..c9f7102 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLObjectElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLObjectElement.cpp
@@ -69,7 +69,7 @@ static const HashTableValue JSHTMLObjectElementTableValues[20] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLObjectElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLObjectElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLObjectElementTableValues, 0 };
#else
@@ -83,7 +83,7 @@ static const HashTableValue JSHTMLObjectElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLObjectElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLObjectElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLObjectElementConstructorTableValues, 0 };
#else
@@ -122,7 +122,7 @@ static const HashTableValue JSHTMLObjectElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLObjectElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLObjectElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLObjectElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLOptGroupElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLOptGroupElement.cpp
index 69506b0..4b651c4 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLOptGroupElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLOptGroupElement.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSHTMLOptGroupElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOptGroupElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOptGroupElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLOptGroupElementTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSHTMLOptGroupElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOptGroupElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOptGroupElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLOptGroupElementConstructorTableValues, 0 };
#else
@@ -94,7 +94,7 @@ static const HashTableValue JSHTMLOptGroupElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOptGroupElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOptGroupElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLOptGroupElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLOptionElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLOptionElement.cpp
index ee1283d..4c9b51a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLOptionElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLOptionElement.cpp
@@ -51,7 +51,7 @@ static const HashTableValue JSHTMLOptionElementTableValues[10] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOptionElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOptionElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLOptionElementTableValues, 0 };
#else
@@ -65,7 +65,7 @@ static const HashTableValue JSHTMLOptionElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOptionElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOptionElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLOptionElementConstructorTableValues, 0 };
#else
@@ -103,7 +103,7 @@ static const HashTableValue JSHTMLOptionElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOptionElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOptionElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLOptionElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLOptionsCollection.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLOptionsCollection.cpp
index 578ab90..b9e8d15 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLOptionsCollection.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLOptionsCollection.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLOptionsCollectionTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOptionsCollectionTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOptionsCollectionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSHTMLOptionsCollectionTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSHTMLOptionsCollectionPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLOptionsCollectionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLOptionsCollectionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSHTMLOptionsCollectionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLParagraphElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLParagraphElement.cpp
index ba47a53..b267dc2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLParagraphElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLParagraphElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLParagraphElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLParagraphElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLParagraphElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLParagraphElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLParagraphElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLParagraphElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLParagraphElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLParagraphElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLParagraphElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLParagraphElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLParagraphElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLParagraphElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLParamElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLParamElement.cpp
index b4c9348..467df03 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLParamElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLParamElement.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSHTMLParamElementTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLParamElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLParamElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLParamElementTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSHTMLParamElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLParamElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLParamElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLParamElementConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSHTMLParamElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLParamElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLParamElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLParamElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLPreElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLPreElement.cpp
index 8aac7c1..b6bc6fb 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLPreElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLPreElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLPreElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLPreElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLPreElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLPreElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLPreElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLPreElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLPreElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLPreElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLPreElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLPreElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLPreElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLPreElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLQuoteElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLQuoteElement.cpp
index dd831c0..a8313b9 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLQuoteElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLQuoteElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLQuoteElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLQuoteElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLQuoteElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLQuoteElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLQuoteElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLQuoteElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLQuoteElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLQuoteElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLQuoteElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLQuoteElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLQuoteElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLQuoteElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLScriptElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLScriptElement.cpp
index ab7bc3d..8e157d1 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLScriptElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLScriptElement.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSHTMLScriptElementTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLScriptElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLScriptElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLScriptElementTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSHTMLScriptElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLScriptElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLScriptElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLScriptElementConstructorTableValues, 0 };
#else
@@ -99,7 +99,7 @@ static const HashTableValue JSHTMLScriptElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLScriptElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLScriptElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLScriptElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.cpp
index 8a61381..08e765c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.cpp
@@ -29,8 +29,10 @@
#include "JSHTMLFormElement.h"
#include "JSHTMLOptionsCollection.h"
#include "JSNode.h"
+#include "JSValidityState.h"
#include "KURL.h"
#include "Node.h"
+#include "ValidityState.h"
#include <runtime/Error.h>
#include <runtime/JSNumberCell.h>
#include <runtime/JSString.h>
@@ -45,13 +47,14 @@ ASSERT_CLASS_FITS_IN_CELL(JSHTMLSelectElement);
/* Hash table */
-static const HashTableValue JSHTMLSelectElementTableValues[14] =
+static const HashTableValue JSHTMLSelectElementTableValues[15] =
{
{ "type", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementType, (intptr_t)0 },
{ "selectedIndex", DontDelete, (intptr_t)jsHTMLSelectElementSelectedIndex, (intptr_t)setJSHTMLSelectElementSelectedIndex },
{ "value", DontDelete, (intptr_t)jsHTMLSelectElementValue, (intptr_t)setJSHTMLSelectElementValue },
{ "length", DontDelete, (intptr_t)jsHTMLSelectElementLength, (intptr_t)setJSHTMLSelectElementLength },
{ "form", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementForm, (intptr_t)0 },
+ { "validity", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementValidity, (intptr_t)0 },
{ "willValidate", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementWillValidate, (intptr_t)0 },
{ "options", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementOptions, (intptr_t)0 },
{ "disabled", DontDelete, (intptr_t)jsHTMLSelectElementDisabled, (intptr_t)setJSHTMLSelectElementDisabled },
@@ -63,11 +66,11 @@ static const HashTableValue JSHTMLSelectElementTableValues[14] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLSelectElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLSelectElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLSelectElementTableValues, 0 };
#else
- { 34, 31, JSHTMLSelectElementTableValues, 0 };
+ { 35, 31, JSHTMLSelectElementTableValues, 0 };
#endif
/* Hash table for constructor */
@@ -77,7 +80,7 @@ static const HashTableValue JSHTMLSelectElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLSelectElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLSelectElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLSelectElementConstructorTableValues, 0 };
#else
@@ -119,7 +122,7 @@ static const HashTableValue JSHTMLSelectElementPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLSelectElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLSelectElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLSelectElementPrototypeTableValues, 0 };
#else
@@ -210,6 +213,13 @@ JSValue jsHTMLSelectElementForm(ExecState* exec, const Identifier&, const Proper
return toJS(exec, WTF::getPtr(imp->form()));
}
+JSValue jsHTMLSelectElementValidity(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
+ return toJS(exec, WTF::getPtr(imp->validity()));
+}
+
JSValue jsHTMLSelectElementWillValidate(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
UNUSED_PARAM(exec);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.h
index 1790360..53459cb 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.h
@@ -84,6 +84,7 @@ void setJSHTMLSelectElementValue(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsHTMLSelectElementLength(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSHTMLSelectElementLength(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsHTMLSelectElementForm(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsHTMLSelectElementValidity(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsHTMLSelectElementWillValidate(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsHTMLSelectElementOptions(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsHTMLSelectElementDisabled(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLSourceElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLSourceElement.cpp
index b9f65ad..5e534cf 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLSourceElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLSourceElement.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSHTMLSourceElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLSourceElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLSourceElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLSourceElementTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSHTMLSourceElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLSourceElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLSourceElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLSourceElementConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSHTMLSourceElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLSourceElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLSourceElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLSourceElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLStyleElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLStyleElement.cpp
index 5b31c04..77b1b1a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLStyleElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLStyleElement.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSHTMLStyleElementTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLStyleElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLStyleElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLStyleElementTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSHTMLStyleElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLStyleElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLStyleElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLStyleElementConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSHTMLStyleElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLStyleElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLStyleElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLStyleElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableCaptionElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableCaptionElement.cpp
index 51b8dbe..3fcbcba 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableCaptionElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableCaptionElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLTableCaptionElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableCaptionElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableCaptionElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLTableCaptionElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLTableCaptionElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableCaptionElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableCaptionElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTableCaptionElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLTableCaptionElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableCaptionElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableCaptionElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTableCaptionElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableCellElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableCellElement.cpp
index cb81f6d..8ddf4ca 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableCellElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableCellElement.cpp
@@ -56,7 +56,7 @@ static const HashTableValue JSHTMLTableCellElementTableValues[17] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableCellElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableCellElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSHTMLTableCellElementTableValues, 0 };
#else
@@ -70,7 +70,7 @@ static const HashTableValue JSHTMLTableCellElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableCellElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableCellElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTableCellElementConstructorTableValues, 0 };
#else
@@ -108,7 +108,7 @@ static const HashTableValue JSHTMLTableCellElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableCellElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableCellElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTableCellElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableColElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableColElement.cpp
index 470cd02..b79eda4 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableColElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableColElement.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSHTMLTableColElementTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableColElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableColElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSHTMLTableColElementTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSHTMLTableColElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableColElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableColElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTableColElementConstructorTableValues, 0 };
#else
@@ -99,7 +99,7 @@ static const HashTableValue JSHTMLTableColElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableColElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableColElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTableColElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableElement.cpp
index 96b92e0..6965555 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableElement.cpp
@@ -63,7 +63,7 @@ static const HashTableValue JSHTMLTableElementTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLTableElementTableValues, 0 };
#else
@@ -77,7 +77,7 @@ static const HashTableValue JSHTMLTableElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTableElementConstructorTableValues, 0 };
#else
@@ -123,7 +123,7 @@ static const HashTableValue JSHTMLTableElementPrototypeTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSHTMLTableElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableRowElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableRowElement.cpp
index c384613..d806271 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableRowElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableRowElement.cpp
@@ -54,7 +54,7 @@ static const HashTableValue JSHTMLTableRowElementTableValues[10] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableRowElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableRowElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSHTMLTableRowElementTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSHTMLTableRowElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableRowElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableRowElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTableRowElementConstructorTableValues, 0 };
#else
@@ -108,7 +108,7 @@ static const HashTableValue JSHTMLTableRowElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableRowElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableRowElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSHTMLTableRowElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableSectionElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableSectionElement.cpp
index 8e8ce54..7515cfd 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTableSectionElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTableSectionElement.cpp
@@ -50,7 +50,7 @@ static const HashTableValue JSHTMLTableSectionElementTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableSectionElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableSectionElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLTableSectionElementTableValues, 0 };
#else
@@ -64,7 +64,7 @@ static const HashTableValue JSHTMLTableSectionElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableSectionElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableSectionElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTableSectionElementConstructorTableValues, 0 };
#else
@@ -104,7 +104,7 @@ static const HashTableValue JSHTMLTableSectionElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTableSectionElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTableSectionElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLTableSectionElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp
index 6d845f9..f103fb7 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp
@@ -24,7 +24,9 @@
#include "HTMLFormElement.h"
#include "HTMLTextAreaElement.h"
#include "JSHTMLFormElement.h"
+#include "JSValidityState.h"
#include "KURL.h"
+#include "ValidityState.h"
#include <runtime/Error.h>
#include <runtime/JSNumberCell.h>
#include <runtime/JSString.h>
@@ -38,10 +40,11 @@ ASSERT_CLASS_FITS_IN_CELL(JSHTMLTextAreaElement);
/* Hash table */
-static const HashTableValue JSHTMLTextAreaElementTableValues[16] =
+static const HashTableValue JSHTMLTextAreaElementTableValues[17] =
{
{ "defaultValue", DontDelete, (intptr_t)jsHTMLTextAreaElementDefaultValue, (intptr_t)setJSHTMLTextAreaElementDefaultValue },
{ "form", DontDelete|ReadOnly, (intptr_t)jsHTMLTextAreaElementForm, (intptr_t)0 },
+ { "validity", DontDelete|ReadOnly, (intptr_t)jsHTMLTextAreaElementValidity, (intptr_t)0 },
{ "accessKey", DontDelete, (intptr_t)jsHTMLTextAreaElementAccessKey, (intptr_t)setJSHTMLTextAreaElementAccessKey },
{ "cols", DontDelete, (intptr_t)jsHTMLTextAreaElementCols, (intptr_t)setJSHTMLTextAreaElementCols },
{ "disabled", DontDelete, (intptr_t)jsHTMLTextAreaElementDisabled, (intptr_t)setJSHTMLTextAreaElementDisabled },
@@ -58,11 +61,11 @@ static const HashTableValue JSHTMLTextAreaElementTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTextAreaElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTextAreaElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSHTMLTextAreaElementTableValues, 0 };
#else
- { 35, 31, JSHTMLTextAreaElementTableValues, 0 };
+ { 36, 31, JSHTMLTextAreaElementTableValues, 0 };
#endif
/* Hash table for constructor */
@@ -72,7 +75,7 @@ static const HashTableValue JSHTMLTextAreaElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTextAreaElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTextAreaElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTextAreaElementConstructorTableValues, 0 };
#else
@@ -112,7 +115,7 @@ static const HashTableValue JSHTMLTextAreaElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTextAreaElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTextAreaElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSHTMLTextAreaElementPrototypeTableValues, 0 };
#else
@@ -162,6 +165,13 @@ JSValue jsHTMLTextAreaElementForm(ExecState* exec, const Identifier&, const Prop
return toJS(exec, WTF::getPtr(imp->form()));
}
+JSValue jsHTMLTextAreaElementValidity(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(asObject(slot.slotBase()))->impl());
+ return toJS(exec, WTF::getPtr(imp->validity()));
+}
+
JSValue jsHTMLTextAreaElementAccessKey(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
UNUSED_PARAM(exec);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h
index d248975..63d0575 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h
@@ -69,6 +69,7 @@ JSC::JSValue JSC_HOST_CALL jsHTMLTextAreaElementPrototypeFunctionSetSelectionRan
JSC::JSValue jsHTMLTextAreaElementDefaultValue(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSHTMLTextAreaElementDefaultValue(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsHTMLTextAreaElementForm(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsHTMLTextAreaElementValidity(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
JSC::JSValue jsHTMLTextAreaElementAccessKey(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSHTMLTextAreaElementAccessKey(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsHTMLTextAreaElementCols(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTitleElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLTitleElement.cpp
index 82a61ad..dbc9932 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTitleElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTitleElement.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHTMLTitleElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTitleElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTitleElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSHTMLTitleElementTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSHTMLTitleElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTitleElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTitleElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTitleElementConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSHTMLTitleElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLTitleElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLTitleElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLTitleElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLUListElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLUListElement.cpp
index 522ff7f..aae57e3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLUListElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLUListElement.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSHTMLUListElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLUListElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLUListElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSHTMLUListElementTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSHTMLUListElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLUListElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLUListElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLUListElementConstructorTableValues, 0 };
#else
@@ -94,7 +94,7 @@ static const HashTableValue JSHTMLUListElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLUListElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLUListElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLUListElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLVideoElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLVideoElement.cpp
index c097281..19c1a20 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHTMLVideoElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLVideoElement.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSHTMLVideoElementTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLVideoElementTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLVideoElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHTMLVideoElementTableValues, 0 };
#else
@@ -63,7 +63,7 @@ static const HashTableValue JSHTMLVideoElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLVideoElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLVideoElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLVideoElementConstructorTableValues, 0 };
#else
@@ -101,7 +101,7 @@ static const HashTableValue JSHTMLVideoElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHTMLVideoElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHTMLVideoElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHTMLVideoElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp b/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp
index 55e22af..097a6b7 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSHistoryTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHistoryTable =
+static JSC_CONST_HASHTABLE HashTable JSHistoryTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSHistoryTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSHistoryPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSHistoryPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSHistoryPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSHistoryPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp b/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp
index a965375..139249b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSImageDataTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSImageDataTable =
+static JSC_CONST_HASHTABLE HashTable JSImageDataTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSImageDataTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSImageDataConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSImageDataConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSImageDataConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSImageDataConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSImageDataPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSImageDataPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSImageDataPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSImageDataPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSInspectorController.cpp b/src/3rdparty/webkit/WebCore/generated/JSInspectorController.cpp
index a0dac40..a457224 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSInspectorController.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSInspectorController.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSInspectorControllerTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSInspectorControllerTable =
+static JSC_CONST_HASHTABLE HashTable JSInspectorControllerTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSInspectorControllerTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSInspectorControllerConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSInspectorControllerConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSInspectorControllerConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSInspectorControllerConstructorTableValues, 0 };
#else
@@ -143,7 +143,7 @@ static const HashTableValue JSInspectorControllerPrototypeTableValues[48] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSInspectorControllerPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSInspectorControllerPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSInspectorControllerPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp b/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp
index c8a3f3d..a4a4f8b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp
@@ -52,7 +52,7 @@ static const HashTableValue JSJavaScriptCallFrameTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSJavaScriptCallFrameTable =
+static JSC_CONST_HASHTABLE HashTable JSJavaScriptCallFrameTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSJavaScriptCallFrameTableValues, 0 };
#else
@@ -67,7 +67,7 @@ static const HashTableValue JSJavaScriptCallFramePrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSJavaScriptCallFramePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSJavaScriptCallFramePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSJavaScriptCallFramePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSKeyboardEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSKeyboardEvent.cpp
index 750d1be..a03e149 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSKeyboardEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSKeyboardEvent.cpp
@@ -50,7 +50,7 @@ static const HashTableValue JSKeyboardEventTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSKeyboardEventTable =
+static JSC_CONST_HASHTABLE HashTable JSKeyboardEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSKeyboardEventTableValues, 0 };
#else
@@ -64,7 +64,7 @@ static const HashTableValue JSKeyboardEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSKeyboardEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSKeyboardEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSKeyboardEventConstructorTableValues, 0 };
#else
@@ -103,7 +103,7 @@ static const HashTableValue JSKeyboardEventPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSKeyboardEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSKeyboardEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSKeyboardEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp
index a1c76be..01b1416 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSLocationTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSLocationTable =
+static JSC_CONST_HASHTABLE HashTable JSLocationTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSLocationTableValues, 0 };
#else
@@ -67,7 +67,7 @@ static const HashTableValue JSLocationPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSLocationPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSLocationPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSLocationPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp b/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp
index 490e06c..76d8044 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSMediaErrorTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMediaErrorTable =
+static JSC_CONST_HASHTABLE HashTable JSMediaErrorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSMediaErrorTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSMediaErrorConstructorTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMediaErrorConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSMediaErrorConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSMediaErrorConstructorTableValues, 0 };
#else
@@ -103,7 +103,7 @@ static const HashTableValue JSMediaErrorPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMediaErrorPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMediaErrorPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSMediaErrorPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp b/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp
index 4a517c8f..448b378 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSMediaListTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMediaListTable =
+static JSC_CONST_HASHTABLE HashTable JSMediaListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSMediaListTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSMediaListConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMediaListConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSMediaListConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMediaListConstructorTableValues, 0 };
#else
@@ -99,7 +99,7 @@ static const HashTableValue JSMediaListPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMediaListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMediaListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSMediaListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp b/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp
index 8f660f2..5b41a54 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSMessageChannelTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMessageChannelTable =
+static JSC_CONST_HASHTABLE HashTable JSMessageChannelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSMessageChannelTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSMessageChannelPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMessageChannelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMessageChannelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMessageChannelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMessageEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSMessageEvent.cpp
index e95dd9c..190fb5a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMessageEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSMessageEvent.cpp
@@ -50,7 +50,7 @@ static const HashTableValue JSMessageEventTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMessageEventTable =
+static JSC_CONST_HASHTABLE HashTable JSMessageEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSMessageEventTableValues, 0 };
#else
@@ -64,7 +64,7 @@ static const HashTableValue JSMessageEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMessageEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSMessageEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMessageEventConstructorTableValues, 0 };
#else
@@ -103,7 +103,7 @@ static const HashTableValue JSMessageEventPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMessageEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMessageEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMessageEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp b/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp
index 7cb75b2..cc43258 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSMessagePortTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMessagePortTable =
+static JSC_CONST_HASHTABLE HashTable JSMessagePortTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSMessagePortTableValues, 0 };
#else
@@ -62,7 +62,7 @@ static const HashTableValue JSMessagePortConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMessagePortConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSMessagePortConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMessagePortConstructorTableValues, 0 };
#else
@@ -106,7 +106,7 @@ static const HashTableValue JSMessagePortPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMessagePortPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMessagePortPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSMessagePortPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp b/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp
index 09a5dbd..1938061 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSMimeTypeTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMimeTypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMimeTypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSMimeTypeTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSMimeTypeConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMimeTypeConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSMimeTypeConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMimeTypeConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSMimeTypePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMimeTypePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMimeTypePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMimeTypePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp
index 509d6d0..28e3930 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSMimeTypeArrayTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMimeTypeArrayTable =
+static JSC_CONST_HASHTABLE HashTable JSMimeTypeArrayTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSMimeTypeArrayTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSMimeTypeArrayConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMimeTypeArrayConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSMimeTypeArrayConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMimeTypeArrayConstructorTableValues, 0 };
#else
@@ -99,7 +99,7 @@ static const HashTableValue JSMimeTypeArrayPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMimeTypeArrayPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMimeTypeArrayPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSMimeTypeArrayPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMouseEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSMouseEvent.cpp
index 6daf2ab..fca18c5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMouseEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSMouseEvent.cpp
@@ -64,7 +64,7 @@ static const HashTableValue JSMouseEventTableValues[19] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMouseEventTable =
+static JSC_CONST_HASHTABLE HashTable JSMouseEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSMouseEventTableValues, 0 };
#else
@@ -78,7 +78,7 @@ static const HashTableValue JSMouseEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMouseEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSMouseEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMouseEventConstructorTableValues, 0 };
#else
@@ -117,7 +117,7 @@ static const HashTableValue JSMouseEventPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMouseEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMouseEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSMouseEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMutationEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSMutationEvent.cpp
index 71d339e..2f6bc8e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMutationEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSMutationEvent.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSMutationEventTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMutationEventTable =
+static JSC_CONST_HASHTABLE HashTable JSMutationEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSMutationEventTableValues, 0 };
#else
@@ -66,7 +66,7 @@ static const HashTableValue JSMutationEventConstructorTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMutationEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSMutationEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSMutationEventConstructorTableValues, 0 };
#else
@@ -108,7 +108,7 @@ static const HashTableValue JSMutationEventPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSMutationEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSMutationEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSMutationEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp b/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp
index 9c6a5a9..47a7643 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSNamedNodeMapTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNamedNodeMapTable =
+static JSC_CONST_HASHTABLE HashTable JSNamedNodeMapTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSNamedNodeMapTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSNamedNodeMapConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNamedNodeMapConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSNamedNodeMapConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSNamedNodeMapConstructorTableValues, 0 };
#else
@@ -104,7 +104,7 @@ static const HashTableValue JSNamedNodeMapPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNamedNodeMapPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSNamedNodeMapPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSNamedNodeMapPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp b/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp
index feefecc..e55a3cc 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp
@@ -58,7 +58,7 @@ static const HashTableValue JSNavigatorTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNavigatorTable =
+static JSC_CONST_HASHTABLE HashTable JSNavigatorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSNavigatorTableValues, 0 };
#else
@@ -73,7 +73,7 @@ static const HashTableValue JSNavigatorPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNavigatorPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSNavigatorPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSNavigatorPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSNode.cpp b/src/3rdparty/webkit/WebCore/generated/JSNode.cpp
index fda843c..d9d3d35 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSNode.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSNode.cpp
@@ -71,7 +71,7 @@ static const HashTableValue JSNodeTableValues[19] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 4095, JSNodeTableValues, 0 };
#else
@@ -103,7 +103,7 @@ static const HashTableValue JSNodeConstructorTableValues[19] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSNodeConstructorTableValues, 0 };
#else
@@ -177,7 +177,7 @@ static const HashTableValue JSNodePrototypeTableValues[37] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSNodePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 4095, JSNodePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp
index 3084eed..32ef101 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp
@@ -39,7 +39,7 @@ static const HashTableValue JSNodeFilterTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeFilterTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeFilterTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSNodeFilterTableValues, 0 };
#else
@@ -69,7 +69,7 @@ static const HashTableValue JSNodeFilterConstructorTableValues[17] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeFilterConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeFilterConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSNodeFilterConstructorTableValues, 0 };
#else
@@ -124,7 +124,7 @@ static const HashTableValue JSNodeFilterPrototypeTableValues[18] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeFilterPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeFilterPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSNodeFilterPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp
index 152ab6f..6e79669 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp
@@ -50,7 +50,7 @@ static const HashTableValue JSNodeIteratorTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeIteratorTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeIteratorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSNodeIteratorTableValues, 0 };
#else
@@ -64,7 +64,7 @@ static const HashTableValue JSNodeIteratorConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeIteratorConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeIteratorConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSNodeIteratorConstructorTableValues, 0 };
#else
@@ -105,7 +105,7 @@ static const HashTableValue JSNodeIteratorPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeIteratorPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeIteratorPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSNodeIteratorPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp
index 80e1f22..f02b7b7 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSNodeListTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeListTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSNodeListTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSNodeListConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeListConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeListConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSNodeListConstructorTableValues, 0 };
#else
@@ -99,7 +99,7 @@ static const HashTableValue JSNodeListPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNodeListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSNodeListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSNodeListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSNotation.cpp b/src/3rdparty/webkit/WebCore/generated/JSNotation.cpp
index 95dacaa..13ac97b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSNotation.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSNotation.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSNotationTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNotationTable =
+static JSC_CONST_HASHTABLE HashTable JSNotationTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSNotationTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSNotationConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNotationConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSNotationConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSNotationConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSNotationPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSNotationPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSNotationPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSNotationPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSONObject.lut.h b/src/3rdparty/webkit/WebCore/generated/JSONObject.lut.h
index 9a12bb4..ce685c2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSONObject.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSONObject.lut.h
@@ -10,6 +10,6 @@ static const struct HashTableValue jsonTableValues[3] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable jsonTable =
+extern JSC_CONST_HASHTABLE HashTable jsonTable =
{ 4, 3, jsonTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/JSOverflowEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSOverflowEvent.cpp
index b704dcb..88a8bd3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSOverflowEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSOverflowEvent.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSOverflowEventTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSOverflowEventTable =
+static JSC_CONST_HASHTABLE HashTable JSOverflowEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSOverflowEventTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSOverflowEventConstructorTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSOverflowEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSOverflowEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSOverflowEventConstructorTableValues, 0 };
#else
@@ -102,7 +102,7 @@ static const HashTableValue JSOverflowEventPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSOverflowEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSOverflowEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSOverflowEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp b/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp
index 9b3c480..c8d0432 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp
@@ -50,7 +50,7 @@ static const HashTableValue JSPluginTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSPluginTable =
+static JSC_CONST_HASHTABLE HashTable JSPluginTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSPluginTableValues, 0 };
#else
@@ -64,7 +64,7 @@ static const HashTableValue JSPluginConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSPluginConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSPluginConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSPluginConstructorTableValues, 0 };
#else
@@ -104,7 +104,7 @@ static const HashTableValue JSPluginPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSPluginPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSPluginPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSPluginPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp
index ba960da..2d0ec36 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSPluginArrayTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSPluginArrayTable =
+static JSC_CONST_HASHTABLE HashTable JSPluginArrayTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSPluginArrayTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSPluginArrayConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSPluginArrayConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSPluginArrayConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSPluginArrayConstructorTableValues, 0 };
#else
@@ -100,7 +100,7 @@ static const HashTableValue JSPluginArrayPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSPluginArrayPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSPluginArrayPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSPluginArrayPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp b/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp
index 89f9e56..680cfc3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSPositionErrorTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSPositionErrorTable =
+static JSC_CONST_HASHTABLE HashTable JSPositionErrorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSPositionErrorTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSPositionErrorConstructorTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSPositionErrorConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSPositionErrorConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSPositionErrorConstructorTableValues, 0 };
#else
@@ -103,7 +103,7 @@ static const HashTableValue JSPositionErrorPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSPositionErrorPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSPositionErrorPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSPositionErrorPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSProcessingInstruction.cpp b/src/3rdparty/webkit/WebCore/generated/JSProcessingInstruction.cpp
index 7ca8069..f9d2fc0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSProcessingInstruction.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSProcessingInstruction.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSProcessingInstructionTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSProcessingInstructionTable =
+static JSC_CONST_HASHTABLE HashTable JSProcessingInstructionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSProcessingInstructionTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSProcessingInstructionConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSProcessingInstructionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSProcessingInstructionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSProcessingInstructionConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSProcessingInstructionPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSProcessingInstructionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSProcessingInstructionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSProcessingInstructionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSProgressEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSProgressEvent.cpp
index b70c3c2..5c7bd50 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSProgressEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSProgressEvent.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSProgressEventTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSProgressEventTable =
+static JSC_CONST_HASHTABLE HashTable JSProgressEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSProgressEventTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSProgressEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSProgressEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSProgressEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSProgressEventConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSProgressEventPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSProgressEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSProgressEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSProgressEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSRGBColor.lut.h b/src/3rdparty/webkit/WebCore/generated/JSRGBColor.lut.h
index 03bb415..4bcba9c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSRGBColor.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSRGBColor.lut.h
@@ -11,6 +11,6 @@ static const struct HashTableValue JSRGBColorTableValues[4] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable JSRGBColorTable =
+extern JSC_CONST_HASHTABLE HashTable JSRGBColorTable =
{ 8, 7, JSRGBColorTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/JSRange.cpp b/src/3rdparty/webkit/WebCore/generated/JSRange.cpp
index 901b8f3..35582f5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSRange.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSRange.cpp
@@ -53,7 +53,7 @@ static const HashTableValue JSRangeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSRangeTable =
+static JSC_CONST_HASHTABLE HashTable JSRangeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSRangeTableValues, 0 };
#else
@@ -75,7 +75,7 @@ static const HashTableValue JSRangeConstructorTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSRangeConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSRangeConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSRangeConstructorTableValues, 0 };
#else
@@ -144,7 +144,7 @@ static const HashTableValue JSRangePrototypeTableValues[32] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSRangePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSRangePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSRangePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp b/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp
index 3cf51ee..799616e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSRangeExceptionTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSRangeExceptionTable =
+static JSC_CONST_HASHTABLE HashTable JSRangeExceptionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSRangeExceptionTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSRangeExceptionConstructorTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSRangeExceptionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSRangeExceptionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSRangeExceptionConstructorTableValues, 0 };
#else
@@ -102,7 +102,7 @@ static const HashTableValue JSRangeExceptionPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSRangeExceptionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSRangeExceptionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSRangeExceptionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSRect.cpp
index 02423ef..4f6a2f7 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSRect.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSRect.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSRectTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSRectTable =
+static JSC_CONST_HASHTABLE HashTable JSRectTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSRectTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSRectConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSRectConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSRectConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSRectConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSRectPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSRectPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSRectPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSRectPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp
index 77cdc74..f907210 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSQLErrorTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSQLErrorTable =
+static JSC_CONST_HASHTABLE HashTable JSSQLErrorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSQLErrorTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSSQLErrorPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSQLErrorPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSQLErrorPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSQLErrorPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp
index 8852997..e00abfe 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSSQLResultSetTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSQLResultSetTable =
+static JSC_CONST_HASHTABLE HashTable JSSQLResultSetTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSQLResultSetTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSSQLResultSetPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSQLResultSetPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSQLResultSetPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSQLResultSetPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp
index daf19f5..1a8af16 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSQLResultSetRowListTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSQLResultSetRowListTable =
+static JSC_CONST_HASHTABLE HashTable JSSQLResultSetRowListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSQLResultSetRowListTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSSQLResultSetRowListPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSQLResultSetRowListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSQLResultSetRowListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSQLResultSetRowListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp
index 1f086ee..cb7dabd 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSQLTransactionPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSQLTransactionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSQLTransactionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSQLTransactionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAElement.cpp
index 3e6d235..b7a3237 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAElement.cpp
@@ -70,7 +70,7 @@ static const HashTableValue JSSVGAElementTableValues[14] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGAElementTableValues, 0 };
#else
@@ -90,7 +90,7 @@ static const HashTableValue JSSVGAElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGAElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAltGlyphElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAltGlyphElement.cpp
index 89543b1..56a4392 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAltGlyphElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAltGlyphElement.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSSVGAltGlyphElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAltGlyphElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAltGlyphElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGAltGlyphElementTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSSVGAltGlyphElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAltGlyphElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAltGlyphElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAltGlyphElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp
index 39c7e73..4bb4518 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSSVGAngleTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAngleTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAngleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGAngleTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGAngleConstructorTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAngleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAngleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGAngleConstructorTableValues, 0 };
#else
@@ -113,7 +113,7 @@ static const HashTableValue JSSVGAnglePrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnglePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnglePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGAnglePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateColorElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateColorElement.cpp
index cbb2269..432bd7e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateColorElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateColorElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGAnimateColorElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimateColorElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimateColorElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimateColorElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateElement.cpp
index 77d0331..b79ba69 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGAnimateElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimateElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimateElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimateElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateTransformElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateTransformElement.cpp
index 511108f..8b68ea4 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateTransformElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimateTransformElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGAnimateTransformElementPrototypeTableValues[1]
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimateTransformElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimateTransformElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimateTransformElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp
index 92c485a..34a9a9b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGAnimatedAngleTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedAngleTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedAngleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedAngleTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGAnimatedAnglePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedAnglePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedAnglePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedAnglePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp
index 2821aaa..969a5c9 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSSVGAnimatedBooleanTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedBooleanTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedBooleanTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedBooleanTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSSVGAnimatedBooleanPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedBooleanPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedBooleanPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedBooleanPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp
index 3af330f..d61ea12 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGAnimatedEnumerationTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedEnumerationTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedEnumerationTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedEnumerationTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGAnimatedEnumerationPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedEnumerationPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedEnumerationPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedEnumerationPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp
index 11337a2..8228409 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGAnimatedIntegerTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedIntegerTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedIntegerTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedIntegerTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGAnimatedIntegerPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedIntegerPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedIntegerPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedIntegerPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp
index 2e1fc5b..e680aea 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGAnimatedLengthTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedLengthTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedLengthTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedLengthTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGAnimatedLengthPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedLengthPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedLengthPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedLengthPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp
index 04fa5f2..f6bf514 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGAnimatedLengthListTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedLengthListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedLengthListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedLengthListTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGAnimatedLengthListPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedLengthListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedLengthListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedLengthListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp
index 0b1d5a3..232b085 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGAnimatedNumberTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedNumberTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedNumberTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedNumberTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGAnimatedNumberPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedNumberPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedNumberPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedNumberPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp
index 3e07104..c782499 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGAnimatedNumberListTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedNumberListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedNumberListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedNumberListTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGAnimatedNumberListPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedNumberListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedNumberListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedNumberListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp
index 6209832..6fd809c6 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGAnimatedPreserveAspectRatioTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedPreserveAspectRatioTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedPreserveAspectRatioTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedPreserveAspectRatioTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGAnimatedPreserveAspectRatioPrototypeTableValues
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedPreserveAspectRatioPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedPreserveAspectRatioPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedPreserveAspectRatioPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp
index 41698eb..8d8a4da 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGAnimatedRectTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedRectTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedRectTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedRectTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGAnimatedRectPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedRectPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedRectPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedRectPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp
index 8d29f52..cfcebf0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSSVGAnimatedStringTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedStringTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedStringTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedStringTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSSVGAnimatedStringPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedStringPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedStringPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedStringPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp
index ecdf262..80d48c9 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGAnimatedTransformListTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedTransformListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedTransformListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGAnimatedTransformListTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGAnimatedTransformListPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimatedTransformListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimatedTransformListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGAnimatedTransformListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimationElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimationElement.cpp
index 12d6f19..70fc7b3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimationElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimationElement.cpp
@@ -52,7 +52,7 @@ static const HashTableValue JSSVGAnimationElementTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimationElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimationElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGAnimationElementTableValues, 0 };
#else
@@ -74,7 +74,7 @@ static const HashTableValue JSSVGAnimationElementPrototypeTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGAnimationElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGAnimationElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGAnimationElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGCircleElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGCircleElement.cpp
index f9fa2aa..a487e9c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGCircleElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGCircleElement.cpp
@@ -72,7 +72,7 @@ static const HashTableValue JSSVGCircleElementTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGCircleElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGCircleElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGCircleElementTableValues, 0 };
#else
@@ -92,7 +92,7 @@ static const HashTableValue JSSVGCircleElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGCircleElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGCircleElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGCircleElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGClipPathElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGClipPathElement.cpp
index 73e31af..5adfdb9 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGClipPathElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGClipPathElement.cpp
@@ -70,7 +70,7 @@ static const HashTableValue JSSVGClipPathElementTableValues[13] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGClipPathElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGClipPathElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGClipPathElementTableValues, 0 };
#else
@@ -90,7 +90,7 @@ static const HashTableValue JSSVGClipPathElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGClipPathElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGClipPathElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGClipPathElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGColor.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGColor.cpp
index 88c62e4..97ea35b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGColor.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGColor.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSSVGColorTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGColorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGColorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGColorTableValues, 0 };
#else
@@ -64,7 +64,7 @@ static const HashTableValue JSSVGColorConstructorTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGColorConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGColorConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGColorConstructorTableValues, 0 };
#else
@@ -109,7 +109,7 @@ static const HashTableValue JSSVGColorPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGColorPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGColorPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGColorPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGComponentTransferFunctionElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGComponentTransferFunctionElement.cpp
index d5be3bc..3fc9adc 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGComponentTransferFunctionElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGComponentTransferFunctionElement.cpp
@@ -51,7 +51,7 @@ static const HashTableValue JSSVGComponentTransferFunctionElementTableValues[9]
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGComponentTransferFunctionElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGComponentTransferFunctionElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGComponentTransferFunctionElementTableValues, 0 };
#else
@@ -71,7 +71,7 @@ static const HashTableValue JSSVGComponentTransferFunctionElementConstructorTabl
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGComponentTransferFunctionElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGComponentTransferFunctionElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGComponentTransferFunctionElementConstructorTableValues, 0 };
#else
@@ -115,7 +115,7 @@ static const HashTableValue JSSVGComponentTransferFunctionElementPrototypeTableV
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGComponentTransferFunctionElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGComponentTransferFunctionElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGComponentTransferFunctionElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGCursorElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGCursorElement.cpp
index d6171c6..c38cb5b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGCursorElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGCursorElement.cpp
@@ -53,7 +53,7 @@ static const HashTableValue JSSVGCursorElementTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGCursorElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGCursorElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGCursorElementTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGCursorElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGCursorElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGCursorElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGCursorElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGDefinitionSrcElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGDefinitionSrcElement.cpp
index 6947dda..207bbe7 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGDefinitionSrcElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGDefinitionSrcElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGDefinitionSrcElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGDefinitionSrcElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGDefinitionSrcElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGDefinitionSrcElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGDefsElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGDefsElement.cpp
index 83e26d0..dd87211 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGDefsElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGDefsElement.cpp
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGDefsElementTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGDefsElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGDefsElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGDefsElementTableValues, 0 };
#else
@@ -88,7 +88,7 @@ static const HashTableValue JSSVGDefsElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGDefsElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGDefsElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGDefsElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGDescElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGDescElement.cpp
index 28641ab..77be621 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGDescElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGDescElement.cpp
@@ -53,7 +53,7 @@ static const HashTableValue JSSVGDescElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGDescElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGDescElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGDescElementTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGDescElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGDescElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGDescElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGDescElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGDocument.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGDocument.cpp
index 840e6c9..6d91ccc 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGDocument.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGDocument.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSSVGDocumentTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGDocumentTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGDocumentTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGDocumentTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSSVGDocumentPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGDocumentPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGDocumentPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGDocumentPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGElement.cpp
index e4defcf..b9e0a2d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGElement.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSSVGElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGElementTableValues, 0 };
#else
@@ -63,7 +63,7 @@ static const HashTableValue JSSVGElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp
index 3b4d6b1..560630d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp
@@ -102,7 +102,7 @@ static const HashTableValue JSSVGElementInstanceTableValues[49] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGElementInstanceTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGElementInstanceTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 4095, JSSVGElementInstanceTableValues, 0 };
#else
@@ -119,7 +119,7 @@ static const HashTableValue JSSVGElementInstancePrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGElementInstancePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGElementInstancePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGElementInstancePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp
index 81c9335..312345f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSVGElementInstanceListTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGElementInstanceListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGElementInstanceListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGElementInstanceListTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSSVGElementInstanceListPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGElementInstanceListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGElementInstanceListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGElementInstanceListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGEllipseElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGEllipseElement.cpp
index 8d6d8ec..73d7cfa 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGEllipseElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGEllipseElement.cpp
@@ -73,7 +73,7 @@ static const HashTableValue JSSVGEllipseElementTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGEllipseElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGEllipseElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGEllipseElementTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSSVGEllipseElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGEllipseElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGEllipseElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGEllipseElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp
index af6a2090..7860c9d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSSVGExceptionTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGExceptionTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGExceptionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGExceptionTableValues, 0 };
#else
@@ -65,7 +65,7 @@ static const HashTableValue JSSVGExceptionConstructorTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGExceptionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGExceptionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGExceptionConstructorTableValues, 0 };
#else
@@ -107,7 +107,7 @@ static const HashTableValue JSSVGExceptionPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGExceptionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGExceptionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGExceptionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEBlendElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEBlendElement.cpp
index 0ecbe59..a353006 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEBlendElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEBlendElement.cpp
@@ -60,7 +60,7 @@ static const HashTableValue JSSVGFEBlendElementTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEBlendElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEBlendElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEBlendElementTableValues, 0 };
#else
@@ -80,7 +80,7 @@ static const HashTableValue JSSVGFEBlendElementConstructorTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEBlendElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEBlendElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGFEBlendElementConstructorTableValues, 0 };
#else
@@ -125,7 +125,7 @@ static const HashTableValue JSSVGFEBlendElementPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEBlendElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEBlendElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGFEBlendElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEColorMatrixElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEColorMatrixElement.cpp
index dd8db83..d875386 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEColorMatrixElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEColorMatrixElement.cpp
@@ -61,7 +61,7 @@ static const HashTableValue JSSVGFEColorMatrixElementTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEColorMatrixElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEColorMatrixElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEColorMatrixElementTableValues, 0 };
#else
@@ -80,7 +80,7 @@ static const HashTableValue JSSVGFEColorMatrixElementConstructorTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEColorMatrixElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEColorMatrixElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGFEColorMatrixElementConstructorTableValues, 0 };
#else
@@ -124,7 +124,7 @@ static const HashTableValue JSSVGFEColorMatrixElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEColorMatrixElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEColorMatrixElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGFEColorMatrixElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEComponentTransferElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEComponentTransferElement.cpp
index cf4de5c..c5238a8 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEComponentTransferElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEComponentTransferElement.cpp
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGFEComponentTransferElementTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEComponentTransferElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEComponentTransferElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEComponentTransferElementTableValues, 0 };
#else
@@ -71,7 +71,7 @@ static const HashTableValue JSSVGFEComponentTransferElementPrototypeTableValues[
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEComponentTransferElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEComponentTransferElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEComponentTransferElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFECompositeElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFECompositeElement.cpp
index 6aff814..8edb5f0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFECompositeElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFECompositeElement.cpp
@@ -65,7 +65,7 @@ static const HashTableValue JSSVGFECompositeElementTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFECompositeElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFECompositeElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFECompositeElementTableValues, 0 };
#else
@@ -86,7 +86,7 @@ static const HashTableValue JSSVGFECompositeElementConstructorTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFECompositeElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFECompositeElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGFECompositeElementConstructorTableValues, 0 };
#else
@@ -132,7 +132,7 @@ static const HashTableValue JSSVGFECompositeElementPrototypeTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFECompositeElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFECompositeElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGFECompositeElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEDiffuseLightingElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEDiffuseLightingElement.cpp
index 4549381..0fffc6e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEDiffuseLightingElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEDiffuseLightingElement.cpp
@@ -61,7 +61,7 @@ static const HashTableValue JSSVGFEDiffuseLightingElementTableValues[13] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEDiffuseLightingElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEDiffuseLightingElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEDiffuseLightingElementTableValues, 0 };
#else
@@ -76,7 +76,7 @@ static const HashTableValue JSSVGFEDiffuseLightingElementPrototypeTableValues[2]
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEDiffuseLightingElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEDiffuseLightingElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEDiffuseLightingElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEDisplacementMapElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEDisplacementMapElement.cpp
index dca7363..0e8e342 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEDisplacementMapElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEDisplacementMapElement.cpp
@@ -63,7 +63,7 @@ static const HashTableValue JSSVGFEDisplacementMapElementTableValues[14] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEDisplacementMapElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEDisplacementMapElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEDisplacementMapElementTableValues, 0 };
#else
@@ -82,7 +82,7 @@ static const HashTableValue JSSVGFEDisplacementMapElementConstructorTableValues[
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEDisplacementMapElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEDisplacementMapElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGFEDisplacementMapElementConstructorTableValues, 0 };
#else
@@ -126,7 +126,7 @@ static const HashTableValue JSSVGFEDisplacementMapElementPrototypeTableValues[7]
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEDisplacementMapElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEDisplacementMapElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGFEDisplacementMapElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEDistantLightElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEDistantLightElement.cpp
index 55abac8..63ece0d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEDistantLightElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEDistantLightElement.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGFEDistantLightElementTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEDistantLightElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEDistantLightElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGFEDistantLightElementTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGFEDistantLightElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEDistantLightElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEDistantLightElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEDistantLightElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFloodElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFloodElement.cpp
index 1b7cab5..f80ec71 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFloodElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFloodElement.cpp
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGFEFloodElementTableValues[10] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEFloodElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEFloodElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEFloodElementTableValues, 0 };
#else
@@ -71,7 +71,7 @@ static const HashTableValue JSSVGFEFloodElementConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEFloodElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEFloodElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEFloodElementConstructorTableValues, 0 };
#else
@@ -110,7 +110,7 @@ static const HashTableValue JSSVGFEFloodElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEFloodElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEFloodElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEFloodElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncAElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncAElement.cpp
index 90dbf26..a51799b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncAElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncAElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFEFuncAElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEFuncAElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEFuncAElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEFuncAElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncBElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncBElement.cpp
index a2c895b..710a37b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncBElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncBElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFEFuncBElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEFuncBElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEFuncBElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEFuncBElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncGElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncGElement.cpp
index acebd39..82aa829 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncGElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncGElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFEFuncGElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEFuncGElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEFuncGElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEFuncGElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncRElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncRElement.cpp
index c6fad7b..26b8c93 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncRElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncRElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFEFuncRElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEFuncRElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEFuncRElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEFuncRElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEGaussianBlurElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEGaussianBlurElement.cpp
index 281c9be..f36edd6 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEGaussianBlurElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEGaussianBlurElement.cpp
@@ -59,7 +59,7 @@ static const HashTableValue JSSVGFEGaussianBlurElementTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEGaussianBlurElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEGaussianBlurElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEGaussianBlurElementTableValues, 0 };
#else
@@ -75,7 +75,7 @@ static const HashTableValue JSSVGFEGaussianBlurElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEGaussianBlurElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEGaussianBlurElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGFEGaussianBlurElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEImageElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEImageElement.cpp
index 08ea33e..d3f76f9 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEImageElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEImageElement.cpp
@@ -62,7 +62,7 @@ static const HashTableValue JSSVGFEImageElementTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEImageElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEImageElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEImageElementTableValues, 0 };
#else
@@ -77,7 +77,7 @@ static const HashTableValue JSSVGFEImageElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEImageElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEImageElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEImageElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeElement.cpp
index 7262013..4b18c0a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeElement.cpp
@@ -55,7 +55,7 @@ static const HashTableValue JSSVGFEMergeElementTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEMergeElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEMergeElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEMergeElementTableValues, 0 };
#else
@@ -70,7 +70,7 @@ static const HashTableValue JSSVGFEMergeElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEMergeElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEMergeElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEMergeElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeNodeElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeNodeElement.cpp
index 32fc5c7..3ea7b74 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeNodeElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeNodeElement.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGFEMergeNodeElementTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEMergeNodeElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEMergeNodeElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEMergeNodeElementTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGFEMergeNodeElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEMergeNodeElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEMergeNodeElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEMergeNodeElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEOffsetElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEOffsetElement.cpp
index 3b36b96..4ea1f85 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEOffsetElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEOffsetElement.cpp
@@ -59,7 +59,7 @@ static const HashTableValue JSSVGFEOffsetElementTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEOffsetElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEOffsetElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFEOffsetElementTableValues, 0 };
#else
@@ -74,7 +74,7 @@ static const HashTableValue JSSVGFEOffsetElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEOffsetElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEOffsetElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEOffsetElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFEPointLightElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFEPointLightElement.cpp
index 5004762..6ca91ec 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFEPointLightElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFEPointLightElement.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSSVGFEPointLightElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEPointLightElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEPointLightElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGFEPointLightElementTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSSVGFEPointLightElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFEPointLightElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFEPointLightElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFEPointLightElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFESpecularLightingElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFESpecularLightingElement.cpp
index 7521e62..4f8ac6c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFESpecularLightingElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFESpecularLightingElement.cpp
@@ -60,7 +60,7 @@ static const HashTableValue JSSVGFESpecularLightingElementTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFESpecularLightingElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFESpecularLightingElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSSVGFESpecularLightingElementTableValues, 0 };
#else
@@ -75,7 +75,7 @@ static const HashTableValue JSSVGFESpecularLightingElementPrototypeTableValues[2
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFESpecularLightingElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFESpecularLightingElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFESpecularLightingElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFESpotLightElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFESpotLightElement.cpp
index de15407..b5ae3d1 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFESpotLightElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFESpotLightElement.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSSVGFESpotLightElementTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFESpotLightElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFESpotLightElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGFESpotLightElementTableValues, 0 };
#else
@@ -63,7 +63,7 @@ static const HashTableValue JSSVGFESpotLightElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFESpotLightElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFESpotLightElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFESpotLightElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFETileElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFETileElement.cpp
index 66b19e8..bc0e33c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFETileElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFETileElement.cpp
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGFETileElementTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFETileElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFETileElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFETileElementTableValues, 0 };
#else
@@ -71,7 +71,7 @@ static const HashTableValue JSSVGFETileElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFETileElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFETileElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFETileElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFETurbulenceElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFETurbulenceElement.cpp
index 50369f1..c0e4fac 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFETurbulenceElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFETurbulenceElement.cpp
@@ -65,7 +65,7 @@ static const HashTableValue JSSVGFETurbulenceElementTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFETurbulenceElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFETurbulenceElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGFETurbulenceElementTableValues, 0 };
#else
@@ -85,7 +85,7 @@ static const HashTableValue JSSVGFETurbulenceElementConstructorTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFETurbulenceElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFETurbulenceElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGFETurbulenceElementConstructorTableValues, 0 };
#else
@@ -130,7 +130,7 @@ static const HashTableValue JSSVGFETurbulenceElementPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFETurbulenceElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFETurbulenceElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGFETurbulenceElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFilterElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFilterElement.cpp
index 9a63655..6ba6d1b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFilterElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFilterElement.cpp
@@ -67,7 +67,7 @@ static const HashTableValue JSSVGFilterElementTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFilterElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFilterElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSSVGFilterElementTableValues, 0 };
#else
@@ -83,7 +83,7 @@ static const HashTableValue JSSVGFilterElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFilterElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFilterElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGFilterElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFontElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFontElement.cpp
index d66d6b6..755c2c0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFontElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFontElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFontElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFontElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFontElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFontElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceElement.cpp
index 55633bb..cddf759 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFontFaceElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFontFaceElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFontFaceElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFontFaceElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceFormatElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceFormatElement.cpp
index 50708c2..bc0d0ae 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceFormatElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceFormatElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFontFaceFormatElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFontFaceFormatElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFontFaceFormatElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFontFaceFormatElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceNameElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceNameElement.cpp
index 2f12035..87c749a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceNameElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceNameElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFontFaceNameElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFontFaceNameElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFontFaceNameElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFontFaceNameElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceSrcElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceSrcElement.cpp
index 82c6137..302e4be 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceSrcElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceSrcElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFontFaceSrcElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFontFaceSrcElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFontFaceSrcElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFontFaceSrcElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceUriElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceUriElement.cpp
index 32208d8..16507ff 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceUriElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceUriElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGFontFaceUriElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGFontFaceUriElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGFontFaceUriElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGFontFaceUriElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGForeignObjectElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGForeignObjectElement.cpp
index 7bba5bb..8bac171 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGForeignObjectElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGForeignObjectElement.cpp
@@ -73,7 +73,7 @@ static const HashTableValue JSSVGForeignObjectElementTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGForeignObjectElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGForeignObjectElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSSVGForeignObjectElementTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSSVGForeignObjectElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGForeignObjectElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGForeignObjectElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGForeignObjectElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGGElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGGElement.cpp
index 75a61b6..1ea98b2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGGElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGGElement.cpp
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGGElementTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGGElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGGElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGGElementTableValues, 0 };
#else
@@ -88,7 +88,7 @@ static const HashTableValue JSSVGGElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGGElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGGElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGGElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGGlyphElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGGlyphElement.cpp
index 684831f..6cd2211 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGGlyphElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGGlyphElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGGlyphElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGGlyphElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGGlyphElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGGlyphElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGGradientElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGGradientElement.cpp
index 1dc75b0..bcadbfc 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGGradientElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGGradientElement.cpp
@@ -58,7 +58,7 @@ static const HashTableValue JSSVGGradientElementTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGGradientElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGGradientElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGGradientElementTableValues, 0 };
#else
@@ -76,7 +76,7 @@ static const HashTableValue JSSVGGradientElementConstructorTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGGradientElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGGradientElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGGradientElementConstructorTableValues, 0 };
#else
@@ -119,7 +119,7 @@ static const HashTableValue JSSVGGradientElementPrototypeTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGGradientElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGGradientElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGGradientElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGHKernElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGHKernElement.cpp
index 87c1fe8..d636a27 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGHKernElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGHKernElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGHKernElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGHKernElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGHKernElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGHKernElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGImageElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGImageElement.cpp
index 4f6f84f..8aaa237 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGImageElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGImageElement.cpp
@@ -76,7 +76,7 @@ static const HashTableValue JSSVGImageElementTableValues[18] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGImageElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGImageElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSSVGImageElementTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSSVGImageElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGImageElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGImageElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGImageElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp
index 7e86524..7a4d143 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSSVGLengthTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGLengthTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGLengthTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGLengthTableValues, 0 };
#else
@@ -74,7 +74,7 @@ static const HashTableValue JSSVGLengthConstructorTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGLengthConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGLengthConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSSVGLengthConstructorTableValues, 0 };
#else
@@ -125,7 +125,7 @@ static const HashTableValue JSSVGLengthPrototypeTableValues[14] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGLengthPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGLengthPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSSVGLengthPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp
index 9283d38..86b9320 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSVGLengthListTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGLengthListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGLengthListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGLengthListTableValues, 0 };
#else
@@ -66,7 +66,7 @@ static const HashTableValue JSSVGLengthListPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGLengthListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGLengthListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGLengthListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLineElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLineElement.cpp
index 62e72c5..9e7057b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGLineElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLineElement.cpp
@@ -73,7 +73,7 @@ static const HashTableValue JSSVGLineElementTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGLineElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGLineElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSSVGLineElementTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSSVGLineElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGLineElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGLineElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGLineElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLinearGradientElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLinearGradientElement.cpp
index 4e0c48a..56ec26c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGLinearGradientElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLinearGradientElement.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSVGLinearGradientElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGLinearGradientElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGLinearGradientElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGLinearGradientElementTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSSVGLinearGradientElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGLinearGradientElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGLinearGradientElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGLinearGradientElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGMarkerElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGMarkerElement.cpp
index afaf538..d1b0cd6 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGMarkerElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGMarkerElement.cpp
@@ -71,7 +71,7 @@ static const HashTableValue JSSVGMarkerElementTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGMarkerElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGMarkerElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGMarkerElementTableValues, 0 };
#else
@@ -91,7 +91,7 @@ static const HashTableValue JSSVGMarkerElementConstructorTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGMarkerElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGMarkerElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGMarkerElementConstructorTableValues, 0 };
#else
@@ -138,7 +138,7 @@ static const HashTableValue JSSVGMarkerElementPrototypeTableValues[10] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGMarkerElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGMarkerElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGMarkerElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGMaskElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGMaskElement.cpp
index d6e2a33..c266956 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGMaskElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGMaskElement.cpp
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGMaskElementTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGMaskElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGMaskElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGMaskElementTableValues, 0 };
#else
@@ -84,7 +84,7 @@ static const HashTableValue JSSVGMaskElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGMaskElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGMaskElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGMaskElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp
index 761f128..e668ab2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSSVGMatrixTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGMatrixTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGMatrixTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGMatrixTableValues, 0 };
#else
@@ -73,7 +73,7 @@ static const HashTableValue JSSVGMatrixPrototypeTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGMatrixPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGMatrixPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGMatrixPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGMetadataElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGMetadataElement.cpp
index a150bd3..500bb33 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGMetadataElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGMetadataElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGMetadataElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGMetadataElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGMetadataElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGMetadataElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGMissingGlyphElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGMissingGlyphElement.cpp
index f5eaa01..b6efc8c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGMissingGlyphElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGMissingGlyphElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGMissingGlyphElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGMissingGlyphElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGMissingGlyphElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGMissingGlyphElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp
index 9e3dede..491e6bf 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSSVGNumberTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGNumberTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGNumberTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGNumberTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSSVGNumberPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGNumberPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGNumberPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGNumberPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp
index 28fd4bc..1558247 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSSVGNumberListTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGNumberListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGNumberListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGNumberListTableValues, 0 };
#else
@@ -65,7 +65,7 @@ static const HashTableValue JSSVGNumberListPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGNumberListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGNumberListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGNumberListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPaint.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPaint.cpp
index 8bfddc2..f3e7b6f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPaint.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPaint.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSSVGPaintTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPaintTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPaintTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGPaintTableValues, 0 };
#else
@@ -71,7 +71,7 @@ static const HashTableValue JSSVGPaintConstructorTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPaintConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPaintConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 4095, JSSVGPaintConstructorTableValues, 0 };
#else
@@ -121,7 +121,7 @@ static const HashTableValue JSSVGPaintPrototypeTableValues[13] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPaintPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPaintPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 4095, JSSVGPaintPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathElement.cpp
index 0855624..8da1204 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathElement.cpp
@@ -107,7 +107,7 @@ static const HashTableValue JSSVGPathElementTableValues[17] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGPathElementTableValues, 0 };
#else
@@ -149,7 +149,7 @@ static const HashTableValue JSSVGPathElementPrototypeTableValues[29] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGPathElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp
index 99c580b..b19e3a0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSSVGPathSegTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGPathSegTableValues, 0 };
#else
@@ -80,7 +80,7 @@ static const HashTableValue JSSVGPathSegConstructorTableValues[21] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGPathSegConstructorTableValues, 0 };
#else
@@ -138,7 +138,7 @@ static const HashTableValue JSSVGPathSegPrototypeTableValues[21] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGPathSegPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcAbs.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcAbs.cpp
index f754bf0..d8f37b2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcAbs.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcAbs.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSSVGPathSegArcAbsTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegArcAbsTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegArcAbsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGPathSegArcAbsTableValues, 0 };
#else
@@ -62,7 +62,7 @@ static const HashTableValue JSSVGPathSegArcAbsPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegArcAbsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegArcAbsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegArcAbsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcRel.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcRel.cpp
index 70a23c5..0f59520 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcRel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcRel.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSSVGPathSegArcRelTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegArcRelTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegArcRelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGPathSegArcRelTableValues, 0 };
#else
@@ -62,7 +62,7 @@ static const HashTableValue JSSVGPathSegArcRelPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegArcRelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegArcRelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegArcRelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegClosePath.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegClosePath.cpp
index 1270ef2..1519f2a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegClosePath.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegClosePath.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGPathSegClosePathPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegClosePathPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegClosePathPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegClosePathPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicAbs.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicAbs.cpp
index a33c4bc..c862653 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicAbs.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicAbs.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSSVGPathSegCurvetoCubicAbsTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoCubicAbsTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoCubicAbsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGPathSegCurvetoCubicAbsTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSSVGPathSegCurvetoCubicAbsPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoCubicAbsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoCubicAbsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegCurvetoCubicAbsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicRel.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicRel.cpp
index f6c6ad4..84c349c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicRel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicRel.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSSVGPathSegCurvetoCubicRelTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoCubicRelTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoCubicRelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGPathSegCurvetoCubicRelTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSSVGPathSegCurvetoCubicRelPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoCubicRelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoCubicRelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegCurvetoCubicRelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothAbs.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothAbs.cpp
index 22f8de9..f5716b0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothAbs.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothAbs.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSVGPathSegCurvetoCubicSmoothAbsTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoCubicSmoothAbsTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoCubicSmoothAbsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGPathSegCurvetoCubicSmoothAbsTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSSVGPathSegCurvetoCubicSmoothAbsPrototypeTableValue
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoCubicSmoothAbsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoCubicSmoothAbsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegCurvetoCubicSmoothAbsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothRel.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothRel.cpp
index 8608b28..c5c05d7 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothRel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothRel.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSVGPathSegCurvetoCubicSmoothRelTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoCubicSmoothRelTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoCubicSmoothRelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGPathSegCurvetoCubicSmoothRelTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSSVGPathSegCurvetoCubicSmoothRelPrototypeTableValue
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoCubicSmoothRelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoCubicSmoothRelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegCurvetoCubicSmoothRelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticAbs.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticAbs.cpp
index 5897807..4170299 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticAbs.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticAbs.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSVGPathSegCurvetoQuadraticAbsTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoQuadraticAbsTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoQuadraticAbsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGPathSegCurvetoQuadraticAbsTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSSVGPathSegCurvetoQuadraticAbsPrototypeTableValues[
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoQuadraticAbsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoQuadraticAbsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegCurvetoQuadraticAbsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticRel.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticRel.cpp
index 19f9b60..4f50522 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticRel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticRel.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSVGPathSegCurvetoQuadraticRelTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoQuadraticRelTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoQuadraticRelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGPathSegCurvetoQuadraticRelTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSSVGPathSegCurvetoQuadraticRelPrototypeTableValues[
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoQuadraticRelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoQuadraticRelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegCurvetoQuadraticRelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp
index 3fefc7e..0ebe08a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGPathSegCurvetoQuadraticSmoothAbsTableValues[3]
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoQuadraticSmoothAbsTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoQuadraticSmoothAbsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGPathSegCurvetoQuadraticSmoothAbsTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGPathSegCurvetoQuadraticSmoothAbsPrototypeTableV
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoQuadraticSmoothAbsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoQuadraticSmoothAbsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegCurvetoQuadraticSmoothAbsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothRel.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothRel.cpp
index e16e6b5..69382f9 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothRel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothRel.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGPathSegCurvetoQuadraticSmoothRelTableValues[3]
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoQuadraticSmoothRelTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoQuadraticSmoothRelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGPathSegCurvetoQuadraticSmoothRelTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGPathSegCurvetoQuadraticSmoothRelPrototypeTableV
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegCurvetoQuadraticSmoothRelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegCurvetoQuadraticSmoothRelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegCurvetoQuadraticSmoothRelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoAbs.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoAbs.cpp
index 8676d4b..bd7a491 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoAbs.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoAbs.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGPathSegLinetoAbsTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoAbsTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoAbsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGPathSegLinetoAbsTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGPathSegLinetoAbsPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoAbsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoAbsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoAbsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalAbs.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalAbs.cpp
index 0289a9a..d5b7b4f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalAbs.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalAbs.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGPathSegLinetoHorizontalAbsTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoHorizontalAbsTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoHorizontalAbsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoHorizontalAbsTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGPathSegLinetoHorizontalAbsPrototypeTableValues[
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoHorizontalAbsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoHorizontalAbsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoHorizontalAbsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalRel.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalRel.cpp
index cd0755a..2549caf 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalRel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalRel.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGPathSegLinetoHorizontalRelTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoHorizontalRelTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoHorizontalRelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoHorizontalRelTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGPathSegLinetoHorizontalRelPrototypeTableValues[
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoHorizontalRelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoHorizontalRelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoHorizontalRelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoRel.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoRel.cpp
index 250196a..117083b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoRel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoRel.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGPathSegLinetoRelTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoRelTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoRelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGPathSegLinetoRelTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGPathSegLinetoRelPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoRelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoRelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoRelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalAbs.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalAbs.cpp
index 82f7ff8..dea3f90 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalAbs.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalAbs.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGPathSegLinetoVerticalAbsTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoVerticalAbsTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoVerticalAbsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoVerticalAbsTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGPathSegLinetoVerticalAbsPrototypeTableValues[1]
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoVerticalAbsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoVerticalAbsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoVerticalAbsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalRel.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalRel.cpp
index e07cdd2..e1ff669 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalRel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalRel.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGPathSegLinetoVerticalRelTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoVerticalRelTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoVerticalRelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoVerticalRelTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGPathSegLinetoVerticalRelPrototypeTableValues[1]
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegLinetoVerticalRelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegLinetoVerticalRelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegLinetoVerticalRelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp
index 9a76052..8cfdc3c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSSVGPathSegListTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegListTableValues, 0 };
#else
@@ -65,7 +65,7 @@ static const HashTableValue JSSVGPathSegListPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGPathSegListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoAbs.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoAbs.cpp
index 3f23fb6..88ef122 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoAbs.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoAbs.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGPathSegMovetoAbsTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegMovetoAbsTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegMovetoAbsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGPathSegMovetoAbsTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGPathSegMovetoAbsPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegMovetoAbsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegMovetoAbsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegMovetoAbsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoRel.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoRel.cpp
index 51a946d..1f572b2 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoRel.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoRel.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGPathSegMovetoRelTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegMovetoRelTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegMovetoRelTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGPathSegMovetoRelTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSSVGPathSegMovetoRelPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPathSegMovetoRelPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPathSegMovetoRelPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPathSegMovetoRelPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPatternElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPatternElement.cpp
index a01e6f2..4616edc 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPatternElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPatternElement.cpp
@@ -75,7 +75,7 @@ static const HashTableValue JSSVGPatternElementTableValues[19] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPatternElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPatternElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGPatternElementTableValues, 0 };
#else
@@ -91,7 +91,7 @@ static const HashTableValue JSSVGPatternElementPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPatternElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPatternElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGPatternElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp
index ea8bc94..d0050bf 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSVGPointTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPointTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPointTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSSVGPointTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSSVGPointPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPointPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPointPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPointPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp
index 74c85a6..5c911bd 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSSVGPointListTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPointListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPointListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGPointListTableValues, 0 };
#else
@@ -64,7 +64,7 @@ static const HashTableValue JSSVGPointListPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPointListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPointListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGPointListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPolygonElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPolygonElement.cpp
index 33a19b4..aba8123 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPolygonElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPolygonElement.cpp
@@ -72,7 +72,7 @@ static const HashTableValue JSSVGPolygonElementTableValues[14] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPolygonElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPolygonElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGPolygonElementTableValues, 0 };
#else
@@ -92,7 +92,7 @@ static const HashTableValue JSSVGPolygonElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPolygonElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPolygonElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGPolygonElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPolylineElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPolylineElement.cpp
index a04f5fa..8a967cd 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPolylineElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPolylineElement.cpp
@@ -72,7 +72,7 @@ static const HashTableValue JSSVGPolylineElementTableValues[14] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPolylineElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPolylineElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGPolylineElementTableValues, 0 };
#else
@@ -92,7 +92,7 @@ static const HashTableValue JSSVGPolylineElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPolylineElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPolylineElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGPolylineElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp
index b586e60..85e123c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSSVGPreserveAspectRatioTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPreserveAspectRatioTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPreserveAspectRatioTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGPreserveAspectRatioTableValues, 0 };
#else
@@ -72,7 +72,7 @@ static const HashTableValue JSSVGPreserveAspectRatioConstructorTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPreserveAspectRatioConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPreserveAspectRatioConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGPreserveAspectRatioConstructorTableValues, 0 };
#else
@@ -124,7 +124,7 @@ static const HashTableValue JSSVGPreserveAspectRatioPrototypeTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGPreserveAspectRatioPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGPreserveAspectRatioPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGPreserveAspectRatioPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRadialGradientElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRadialGradientElement.cpp
index b888704..ae2d18e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGRadialGradientElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRadialGradientElement.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSSVGRadialGradientElementTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGRadialGradientElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGRadialGradientElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSSVGRadialGradientElementTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSSVGRadialGradientElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGRadialGradientElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGRadialGradientElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGRadialGradientElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp
index 8e857f2..59e4127 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSSVGRectTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGRectTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGRectTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGRectTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSSVGRectPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGRectPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGRectPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGRectPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRectElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRectElement.cpp
index 2f97100..423808c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGRectElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRectElement.cpp
@@ -75,7 +75,7 @@ static const HashTableValue JSSVGRectElementTableValues[18] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGRectElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGRectElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 8191, JSSVGRectElementTableValues, 0 };
#else
@@ -95,7 +95,7 @@ static const HashTableValue JSSVGRectElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGRectElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGRectElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGRectElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp
index 97df330..938f097 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSSVGRenderingIntentTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGRenderingIntentTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGRenderingIntentTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGRenderingIntentTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSSVGRenderingIntentConstructorTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGRenderingIntentConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGRenderingIntentConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGRenderingIntentConstructorTableValues, 0 };
#else
@@ -105,7 +105,7 @@ static const HashTableValue JSSVGRenderingIntentPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGRenderingIntentPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGRenderingIntentPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGRenderingIntentPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGSVGElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGSVGElement.cpp
index 072c0cf..b610779 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGSVGElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGSVGElement.cpp
@@ -99,7 +99,7 @@ static const HashTableValue JSSVGSVGElementTableValues[28] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGSVGElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGSVGElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSSVGSVGElementTableValues, 0 };
#else
@@ -144,7 +144,7 @@ static const HashTableValue JSSVGSVGElementPrototypeTableValues[32] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGSVGElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGSVGElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGSVGElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGScriptElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGScriptElement.cpp
index da7b486..4c8e140 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGScriptElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGScriptElement.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSSVGScriptElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGScriptElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGScriptElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGScriptElementTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSSVGScriptElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGScriptElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGScriptElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGScriptElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGSetElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGSetElement.cpp
index e54b57f..35f8787 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGSetElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGSetElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGSetElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGSetElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGSetElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGSetElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGStopElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGStopElement.cpp
index 8308fcb..ea8be78 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGStopElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGStopElement.cpp
@@ -51,7 +51,7 @@ static const HashTableValue JSSVGStopElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGStopElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGStopElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGStopElementTableValues, 0 };
#else
@@ -66,7 +66,7 @@ static const HashTableValue JSSVGStopElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGStopElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGStopElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGStopElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp
index ee9cf18..1f80627 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSSVGStringListTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGStringListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGStringListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGStringListTableValues, 0 };
#else
@@ -66,7 +66,7 @@ static const HashTableValue JSSVGStringListPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGStringListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGStringListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGStringListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGStyleElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGStyleElement.cpp
index 6b9f6b7..1d7bd7a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGStyleElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGStyleElement.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSSVGStyleElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGStyleElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGStyleElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGStyleElementTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSSVGStyleElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGStyleElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGStyleElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGStyleElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGSwitchElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGSwitchElement.cpp
index 563c735..83b2146 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGSwitchElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGSwitchElement.cpp
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGSwitchElementTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGSwitchElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGSwitchElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGSwitchElementTableValues, 0 };
#else
@@ -88,7 +88,7 @@ static const HashTableValue JSSVGSwitchElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGSwitchElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGSwitchElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGSwitchElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGSymbolElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGSymbolElement.cpp
index 757bfd8f..4a34e05 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGSymbolElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGSymbolElement.cpp
@@ -59,7 +59,7 @@ static const HashTableValue JSSVGSymbolElementTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGSymbolElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGSymbolElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGSymbolElementTableValues, 0 };
#else
@@ -74,7 +74,7 @@ static const HashTableValue JSSVGSymbolElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGSymbolElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGSymbolElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGSymbolElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTRefElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTRefElement.cpp
index 7abab12..8ee0f5f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGTRefElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTRefElement.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSSVGTRefElementTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTRefElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTRefElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGTRefElementTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSSVGTRefElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTRefElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTRefElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGTRefElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTSpanElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTSpanElement.cpp
index acfbd95..5203dfb 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGTSpanElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTSpanElement.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSSVGTSpanElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTSpanElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTSpanElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGTSpanElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTextContentElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTextContentElement.cpp
index 16afd09..4208aa3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGTextContentElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTextContentElement.cpp
@@ -70,7 +70,7 @@ static const HashTableValue JSSVGTextContentElementTableValues[12] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextContentElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextContentElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGTextContentElementTableValues, 0 };
#else
@@ -87,7 +87,7 @@ static const HashTableValue JSSVGTextContentElementConstructorTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextContentElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextContentElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGTextContentElementConstructorTableValues, 0 };
#else
@@ -139,7 +139,7 @@ static const HashTableValue JSSVGTextContentElementPrototypeTableValues[15] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextContentElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextContentElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGTextContentElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTextElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTextElement.cpp
index 9ebc992..270113b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGTextElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTextElement.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSSVGTextElementTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSSVGTextElementTableValues, 0 };
#else
@@ -67,7 +67,7 @@ static const HashTableValue JSSVGTextElementPrototypeTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGTextElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTextPathElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTextPathElement.cpp
index ff320ca..68bcbf8 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGTextPathElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTextPathElement.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSSVGTextPathElementTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextPathElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextPathElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGTextPathElementTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGTextPathElementConstructorTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextPathElementConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextPathElementConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGTextPathElementConstructorTableValues, 0 };
#else
@@ -112,7 +112,7 @@ static const HashTableValue JSSVGTextPathElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextPathElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextPathElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGTextPathElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTextPositioningElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTextPositioningElement.cpp
index 373d0c3..24bc336 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGTextPositioningElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTextPositioningElement.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSSVGTextPositioningElementTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextPositioningElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextPositioningElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGTextPositioningElementTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSSVGTextPositioningElementPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTextPositioningElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTextPositioningElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGTextPositioningElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTitleElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTitleElement.cpp
index 479cbcc..962a9f5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGTitleElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTitleElement.cpp
@@ -53,7 +53,7 @@ static const HashTableValue JSSVGTitleElementTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTitleElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTitleElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGTitleElementTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGTitleElementPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTitleElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTitleElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGTitleElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp
index cb98e9f..8f0aeb0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSSVGTransformTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTransformTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTransformTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGTransformTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGTransformConstructorTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTransformConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTransformConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGTransformConstructorTableValues, 0 };
#else
@@ -119,7 +119,7 @@ static const HashTableValue JSSVGTransformPrototypeTableValues[14] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTransformPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTransformPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSSVGTransformPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp
index 3232123..855efe0 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSSVGTransformListTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTransformListTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTransformListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGTransformListTableValues, 0 };
#else
@@ -69,7 +69,7 @@ static const HashTableValue JSSVGTransformListPrototypeTableValues[10] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGTransformListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGTransformListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSSVGTransformListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp
index 5477773..569a35a 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSSVGUnitTypesTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGUnitTypesTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGUnitTypesTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGUnitTypesTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSSVGUnitTypesConstructorTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGUnitTypesConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGUnitTypesConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGUnitTypesConstructorTableValues, 0 };
#else
@@ -99,7 +99,7 @@ static const HashTableValue JSSVGUnitTypesPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGUnitTypesPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGUnitTypesPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSSVGUnitTypesPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGUseElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGUseElement.cpp
index d05bc22..f309e6d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGUseElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGUseElement.cpp
@@ -78,7 +78,7 @@ static const HashTableValue JSSVGUseElementTableValues[19] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGUseElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGUseElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSSVGUseElementTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSSVGUseElementPrototypeTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGUseElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGUseElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 2047, JSSVGUseElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGViewElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGViewElement.cpp
index 115ed1e..16b1ffb 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGViewElement.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGViewElement.cpp
@@ -51,7 +51,7 @@ static const HashTableValue JSSVGViewElementTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGViewElementTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGViewElementTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSSVGViewElementTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSSVGViewElementPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGViewElementPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGViewElementPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGViewElementPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGZoomEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGZoomEvent.cpp
index 5434095..74cdb26 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSSVGZoomEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSSVGZoomEvent.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSSVGZoomEventTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGZoomEventTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGZoomEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSSVGZoomEventTableValues, 0 };
#else
@@ -62,7 +62,7 @@ static const HashTableValue JSSVGZoomEventPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSSVGZoomEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSSVGZoomEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSSVGZoomEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp b/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp
index b68c308..0da8897 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp
@@ -46,7 +46,7 @@ static const HashTableValue JSScreenTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSScreenTable =
+static JSC_CONST_HASHTABLE HashTable JSScreenTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSScreenTableValues, 0 };
#else
@@ -60,7 +60,7 @@ static const HashTableValue JSScreenPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSScreenPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSScreenPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSScreenPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp b/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp
index bcdea8b..9f15644 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSStorageTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStorageTable =
+static JSC_CONST_HASHTABLE HashTable JSStorageTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSStorageTableValues, 0 };
#else
@@ -62,7 +62,7 @@ static const HashTableValue JSStorageConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStorageConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSStorageConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSStorageConstructorTableValues, 0 };
#else
@@ -105,7 +105,7 @@ static const HashTableValue JSStoragePrototypeTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStoragePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSStoragePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSStoragePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSStorageEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSStorageEvent.cpp
index 293d0ad..42aac0e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSStorageEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSStorageEvent.cpp
@@ -54,7 +54,7 @@ static const HashTableValue JSStorageEventTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStorageEventTable =
+static JSC_CONST_HASHTABLE HashTable JSStorageEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSStorageEventTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSStorageEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStorageEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSStorageEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSStorageEventConstructorTableValues, 0 };
#else
@@ -107,7 +107,7 @@ static const HashTableValue JSStorageEventPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStorageEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSStorageEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSStorageEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp b/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp
index 04c6895..1e75a0d 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp
@@ -51,7 +51,7 @@ static const HashTableValue JSStyleSheetTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStyleSheetTable =
+static JSC_CONST_HASHTABLE HashTable JSStyleSheetTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSStyleSheetTableValues, 0 };
#else
@@ -65,7 +65,7 @@ static const HashTableValue JSStyleSheetConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStyleSheetConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSStyleSheetConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSStyleSheetConstructorTableValues, 0 };
#else
@@ -103,7 +103,7 @@ static const HashTableValue JSStyleSheetPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStyleSheetPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSStyleSheetPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSStyleSheetPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp b/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp
index fccd08b..41cc305 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSStyleSheetListTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStyleSheetListTable =
+static JSC_CONST_HASHTABLE HashTable JSStyleSheetListTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSStyleSheetListTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSStyleSheetListConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStyleSheetListConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSStyleSheetListConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSStyleSheetListConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSStyleSheetListPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSStyleSheetListPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSStyleSheetListPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSStyleSheetListPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSText.cpp b/src/3rdparty/webkit/WebCore/generated/JSText.cpp
index ea29d3c..8be8a89 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSText.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSText.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSTextTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTextTable =
+static JSC_CONST_HASHTABLE HashTable JSTextTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSTextTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSTextConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTextConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSTextConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSTextConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSTextPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTextPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSTextPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSTextPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSTextEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSTextEvent.cpp
index e20e411..de001cf 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSTextEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSTextEvent.cpp
@@ -43,7 +43,7 @@ static const HashTableValue JSTextEventTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTextEventTable =
+static JSC_CONST_HASHTABLE HashTable JSTextEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSTextEventTableValues, 0 };
#else
@@ -57,7 +57,7 @@ static const HashTableValue JSTextEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTextEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSTextEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSTextEventConstructorTableValues, 0 };
#else
@@ -96,7 +96,7 @@ static const HashTableValue JSTextEventPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTextEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSTextEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSTextEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp b/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp
index 904be08..d11e8f8 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSTextMetricsTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTextMetricsTable =
+static JSC_CONST_HASHTABLE HashTable JSTextMetricsTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSTextMetricsTableValues, 0 };
#else
@@ -54,7 +54,7 @@ static const HashTableValue JSTextMetricsConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTextMetricsConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSTextMetricsConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSTextMetricsConstructorTableValues, 0 };
#else
@@ -92,7 +92,7 @@ static const HashTableValue JSTextMetricsPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTextMetricsPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSTextMetricsPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSTextMetricsPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp b/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp
index eebd8cd..fdd6278 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSTimeRangesTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTimeRangesTable =
+static JSC_CONST_HASHTABLE HashTable JSTimeRangesTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSTimeRangesTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSTimeRangesPrototypeTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTimeRangesPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSTimeRangesPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 31, JSTimeRangesPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp b/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp
index da610da..b10b4cb 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp
@@ -49,7 +49,7 @@ static const HashTableValue JSTreeWalkerTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTreeWalkerTable =
+static JSC_CONST_HASHTABLE HashTable JSTreeWalkerTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSTreeWalkerTableValues, 0 };
#else
@@ -63,7 +63,7 @@ static const HashTableValue JSTreeWalkerConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTreeWalkerConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSTreeWalkerConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSTreeWalkerConstructorTableValues, 0 };
#else
@@ -108,7 +108,7 @@ static const HashTableValue JSTreeWalkerPrototypeTableValues[8] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSTreeWalkerPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSTreeWalkerPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSTreeWalkerPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSUIEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSUIEvent.cpp
index 3711f49..cdf611f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSUIEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSUIEvent.cpp
@@ -51,7 +51,7 @@ static const HashTableValue JSUIEventTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSUIEventTable =
+static JSC_CONST_HASHTABLE HashTable JSUIEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSUIEventTableValues, 0 };
#else
@@ -65,7 +65,7 @@ static const HashTableValue JSUIEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSUIEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSUIEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSUIEventConstructorTableValues, 0 };
#else
@@ -104,7 +104,7 @@ static const HashTableValue JSUIEventPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSUIEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSUIEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSUIEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp b/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp
new file mode 100644
index 0000000..fe8ea20
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp
@@ -0,0 +1,172 @@
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSValidityState.h"
+
+#include "ValidityState.h"
+#include <wtf/GetPtr.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+ASSERT_CLASS_FITS_IN_CELL(JSValidityState);
+
+/* Hash table */
+
+static const HashTableValue JSValidityStateTableValues[10] =
+{
+ { "valueMissing", DontDelete|ReadOnly, (intptr_t)jsValidityStateValueMissing, (intptr_t)0 },
+ { "typeMismatch", DontDelete|ReadOnly, (intptr_t)jsValidityStateTypeMismatch, (intptr_t)0 },
+ { "patternMismatch", DontDelete|ReadOnly, (intptr_t)jsValidityStatePatternMismatch, (intptr_t)0 },
+ { "tooLong", DontDelete|ReadOnly, (intptr_t)jsValidityStateTooLong, (intptr_t)0 },
+ { "rangeUnderflow", DontDelete|ReadOnly, (intptr_t)jsValidityStateRangeUnderflow, (intptr_t)0 },
+ { "rangeOverflow", DontDelete|ReadOnly, (intptr_t)jsValidityStateRangeOverflow, (intptr_t)0 },
+ { "stepMismatch", DontDelete|ReadOnly, (intptr_t)jsValidityStateStepMismatch, (intptr_t)0 },
+ { "customError", DontDelete|ReadOnly, (intptr_t)jsValidityStateCustomError, (intptr_t)0 },
+ { "valid", DontDelete|ReadOnly, (intptr_t)jsValidityStateValid, (intptr_t)0 },
+ { 0, 0, 0, 0 }
+};
+
+static JSC_CONST_HASHTABLE HashTable JSValidityStateTable =
+#if ENABLE(PERFECT_HASH_SIZE)
+ { 1023, JSValidityStateTableValues, 0 };
+#else
+ { 34, 31, JSValidityStateTableValues, 0 };
+#endif
+
+/* Hash table for prototype */
+
+static const HashTableValue JSValidityStatePrototypeTableValues[1] =
+{
+ { 0, 0, 0, 0 }
+};
+
+static JSC_CONST_HASHTABLE HashTable JSValidityStatePrototypeTable =
+#if ENABLE(PERFECT_HASH_SIZE)
+ { 0, JSValidityStatePrototypeTableValues, 0 };
+#else
+ { 1, 0, JSValidityStatePrototypeTableValues, 0 };
+#endif
+
+const ClassInfo JSValidityStatePrototype::s_info = { "ValidityStatePrototype", 0, &JSValidityStatePrototypeTable, 0 };
+
+JSObject* JSValidityStatePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
+{
+ return getDOMPrototype<JSValidityState>(exec, globalObject);
+}
+
+const ClassInfo JSValidityState::s_info = { "ValidityState", 0, &JSValidityStateTable, 0 };
+
+JSValidityState::JSValidityState(PassRefPtr<Structure> structure, PassRefPtr<ValidityState> impl)
+ : DOMObject(structure)
+ , m_impl(impl)
+{
+}
+
+JSValidityState::~JSValidityState()
+{
+ forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get());
+}
+
+JSObject* JSValidityState::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
+{
+ return new (exec) JSValidityStatePrototype(JSValidityStatePrototype::createStructure(globalObject->objectPrototype()));
+}
+
+bool JSValidityState::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSValidityState, Base>(exec, &JSValidityStateTable, this, propertyName, slot);
+}
+
+JSValue jsValidityStateValueMissing(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ ValidityState* imp = static_cast<ValidityState*>(static_cast<JSValidityState*>(asObject(slot.slotBase()))->impl());
+ return jsBoolean(imp->valueMissing());
+}
+
+JSValue jsValidityStateTypeMismatch(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ ValidityState* imp = static_cast<ValidityState*>(static_cast<JSValidityState*>(asObject(slot.slotBase()))->impl());
+ return jsBoolean(imp->typeMismatch());
+}
+
+JSValue jsValidityStatePatternMismatch(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ ValidityState* imp = static_cast<ValidityState*>(static_cast<JSValidityState*>(asObject(slot.slotBase()))->impl());
+ return jsBoolean(imp->patternMismatch());
+}
+
+JSValue jsValidityStateTooLong(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ ValidityState* imp = static_cast<ValidityState*>(static_cast<JSValidityState*>(asObject(slot.slotBase()))->impl());
+ return jsBoolean(imp->tooLong());
+}
+
+JSValue jsValidityStateRangeUnderflow(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ ValidityState* imp = static_cast<ValidityState*>(static_cast<JSValidityState*>(asObject(slot.slotBase()))->impl());
+ return jsBoolean(imp->rangeUnderflow());
+}
+
+JSValue jsValidityStateRangeOverflow(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ ValidityState* imp = static_cast<ValidityState*>(static_cast<JSValidityState*>(asObject(slot.slotBase()))->impl());
+ return jsBoolean(imp->rangeOverflow());
+}
+
+JSValue jsValidityStateStepMismatch(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ ValidityState* imp = static_cast<ValidityState*>(static_cast<JSValidityState*>(asObject(slot.slotBase()))->impl());
+ return jsBoolean(imp->stepMismatch());
+}
+
+JSValue jsValidityStateCustomError(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ ValidityState* imp = static_cast<ValidityState*>(static_cast<JSValidityState*>(asObject(slot.slotBase()))->impl());
+ return jsBoolean(imp->customError());
+}
+
+JSValue jsValidityStateValid(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ UNUSED_PARAM(exec);
+ ValidityState* imp = static_cast<ValidityState*>(static_cast<JSValidityState*>(asObject(slot.slotBase()))->impl());
+ return jsBoolean(imp->valid());
+}
+
+JSC::JSValue toJS(JSC::ExecState* exec, ValidityState* object)
+{
+ return getDOMObjectWrapper<JSValidityState>(exec, object);
+}
+ValidityState* toValidityState(JSC::JSValue value)
+{
+ return value.isObject(&JSValidityState::s_info) ? static_cast<JSValidityState*>(asObject(value))->impl() : 0;
+}
+
+}
diff --git a/src/3rdparty/webkit/WebCore/generated/JSValidityState.h b/src/3rdparty/webkit/WebCore/generated/JSValidityState.h
new file mode 100644
index 0000000..a866146
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/generated/JSValidityState.h
@@ -0,0 +1,79 @@
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef JSValidityState_h
+#define JSValidityState_h
+
+#include "JSDOMBinding.h"
+#include <runtime/JSGlobalObject.h>
+#include <runtime/ObjectPrototype.h>
+
+namespace WebCore {
+
+class ValidityState;
+
+class JSValidityState : public DOMObject {
+ typedef DOMObject Base;
+public:
+ JSValidityState(PassRefPtr<JSC::Structure>, PassRefPtr<ValidityState>);
+ virtual ~JSValidityState();
+ static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ static const JSC::ClassInfo s_info;
+
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType));
+ }
+
+ ValidityState* impl() const { return m_impl.get(); }
+
+private:
+ RefPtr<ValidityState> m_impl;
+};
+
+JSC::JSValue toJS(JSC::ExecState*, ValidityState*);
+ValidityState* toValidityState(JSC::JSValue);
+
+class JSValidityStatePrototype : public JSC::JSObject {
+ typedef JSC::JSObject Base;
+public:
+ static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*);
+ virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ static const JSC::ClassInfo s_info;
+ JSValidityStatePrototype(PassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }
+};
+
+// Attributes
+
+JSC::JSValue jsValidityStateValueMissing(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsValidityStateTypeMismatch(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsValidityStatePatternMismatch(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsValidityStateTooLong(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsValidityStateRangeUnderflow(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsValidityStateRangeOverflow(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsValidityStateStepMismatch(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsValidityStateCustomError(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+JSC::JSValue jsValidityStateValid(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+
+} // namespace WebCore
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp b/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp
index ad9ae01..b95c440 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp
@@ -39,7 +39,7 @@ static const HashTableValue JSVoidCallbackPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSVoidCallbackPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSVoidCallbackPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSVoidCallbackPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitAnimationEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitAnimationEvent.cpp
index a1cb988..e8b791b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWebKitAnimationEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitAnimationEvent.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSWebKitAnimationEventTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitAnimationEventTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitAnimationEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSWebKitAnimationEventTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSWebKitAnimationEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitAnimationEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitAnimationEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWebKitAnimationEventConstructorTableValues, 0 };
#else
@@ -97,7 +97,7 @@ static const HashTableValue JSWebKitAnimationEventPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitAnimationEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitAnimationEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWebKitAnimationEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframeRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframeRule.cpp
index c07c962..a99fac6 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframeRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframeRule.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSWebKitCSSKeyframeRuleTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSKeyframeRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframeRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSWebKitCSSKeyframeRuleTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSWebKitCSSKeyframeRuleConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSKeyframeRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframeRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWebKitCSSKeyframeRuleConstructorTableValues, 0 };
#else
@@ -97,7 +97,7 @@ static const HashTableValue JSWebKitCSSKeyframeRulePrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSKeyframeRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframeRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWebKitCSSKeyframeRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframesRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframesRule.cpp
index 1bc7805..013622c 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframesRule.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframesRule.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSWebKitCSSKeyframesRuleTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSKeyframesRuleTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframesRuleTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSWebKitCSSKeyframesRuleTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSWebKitCSSKeyframesRuleConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSKeyframesRuleConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframesRuleConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWebKitCSSKeyframesRuleConstructorTableValues, 0 };
#else
@@ -102,7 +102,7 @@ static const HashTableValue JSWebKitCSSKeyframesRulePrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSKeyframesRulePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframesRulePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSWebKitCSSKeyframesRulePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp
index 8b28647..9c1436b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp
@@ -64,7 +64,7 @@ static const HashTableValue JSWebKitCSSMatrixTableValues[23] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSMatrixTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSMatrixTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 255, JSWebKitCSSMatrixTableValues, 0 };
#else
@@ -86,7 +86,7 @@ static const HashTableValue JSWebKitCSSMatrixPrototypeTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSMatrixPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSMatrixPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSWebKitCSSMatrixPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSTransformValue.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSTransformValue.cpp
index 37f1563..59a4650 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSTransformValue.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSTransformValue.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSWebKitCSSTransformValueTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSTransformValueTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSTransformValueTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSWebKitCSSTransformValueTableValues, 0 };
#else
@@ -75,7 +75,7 @@ static const HashTableValue JSWebKitCSSTransformValueConstructorTableValues[22]
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSTransformValueConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSTransformValueConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSWebKitCSSTransformValueConstructorTableValues, 0 };
#else
@@ -134,7 +134,7 @@ static const HashTableValue JSWebKitCSSTransformValuePrototypeTableValues[22] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitCSSTransformValuePrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitCSSTransformValuePrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSWebKitCSSTransformValuePrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp
index b954f24..ced49fb 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp
@@ -40,7 +40,7 @@ static const HashTableValue JSWebKitPointTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitPointTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitPointTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSWebKitPointTableValues, 0 };
#else
@@ -54,7 +54,7 @@ static const HashTableValue JSWebKitPointPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitPointPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitPointPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWebKitPointPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitTransitionEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitTransitionEvent.cpp
index 3ca4c82..75e4de7 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWebKitTransitionEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitTransitionEvent.cpp
@@ -44,7 +44,7 @@ static const HashTableValue JSWebKitTransitionEventTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitTransitionEventTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitTransitionEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 7, JSWebKitTransitionEventTableValues, 0 };
#else
@@ -58,7 +58,7 @@ static const HashTableValue JSWebKitTransitionEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitTransitionEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitTransitionEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWebKitTransitionEventConstructorTableValues, 0 };
#else
@@ -97,7 +97,7 @@ static const HashTableValue JSWebKitTransitionEventPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWebKitTransitionEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWebKitTransitionEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWebKitTransitionEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWheelEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSWheelEvent.cpp
index e56513d..1a47e6f 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWheelEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWheelEvent.cpp
@@ -54,7 +54,7 @@ static const HashTableValue JSWheelEventTableValues[17] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWheelEventTable =
+static JSC_CONST_HASHTABLE HashTable JSWheelEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSWheelEventTableValues, 0 };
#else
@@ -68,7 +68,7 @@ static const HashTableValue JSWheelEventConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWheelEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSWheelEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWheelEventConstructorTableValues, 0 };
#else
@@ -106,7 +106,7 @@ static const HashTableValue JSWheelEventPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWheelEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWheelEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWheelEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp
index 4c4f8a0..979f43b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp
@@ -30,6 +30,7 @@
#include "JSDOMGlobalObject.h"
#include "JSEvent.h"
#include "JSEventListener.h"
+#include "JSMessagePort.h"
#include "Worker.h"
#include <runtime/Error.h>
#include <wtf/GetPtr.h>
@@ -49,7 +50,7 @@ static const HashTableValue JSWorkerTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWorkerTable =
+static JSC_CONST_HASHTABLE HashTable JSWorkerTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSWorkerTableValues, 0 };
#else
@@ -60,7 +61,7 @@ static const HashTable JSWorkerTable =
static const HashTableValue JSWorkerPrototypeTableValues[6] =
{
- { "postMessage", DontDelete|Function, (intptr_t)jsWorkerPrototypeFunctionPostMessage, (intptr_t)1 },
+ { "postMessage", DontDelete|Function, (intptr_t)jsWorkerPrototypeFunctionPostMessage, (intptr_t)2 },
{ "terminate", DontDelete|Function, (intptr_t)jsWorkerPrototypeFunctionTerminate, (intptr_t)0 },
{ "addEventListener", DontDelete|Function, (intptr_t)jsWorkerPrototypeFunctionAddEventListener, (intptr_t)3 },
{ "removeEventListener", DontDelete|Function, (intptr_t)jsWorkerPrototypeFunctionRemoveEventListener, (intptr_t)3 },
@@ -68,7 +69,7 @@ static const HashTableValue JSWorkerPrototypeTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWorkerPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWorkerPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSWorkerPrototypeTableValues, 0 };
#else
@@ -164,9 +165,20 @@ JSValue JSC_HOST_CALL jsWorkerPrototypeFunctionPostMessage(ExecState* exec, JSOb
return throwError(exec, TypeError);
JSWorker* castedThisObj = static_cast<JSWorker*>(asObject(thisValue));
Worker* imp = static_cast<Worker*>(castedThisObj->impl());
+ ExceptionCode ec = 0;
const UString& message = args.at(0).toString(exec);
- imp->postMessage(message);
+ int argsCount = args.size();
+ if (argsCount < 2) {
+ imp->postMessage(message, ec);
+ setDOMException(exec, ec);
+ return jsUndefined();
+ }
+
+ MessagePort* messagePort = toMessagePort(args.at(1));
+
+ imp->postMessage(message, messagePort, ec);
+ setDOMException(exec, ec);
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp
index cf2e02d..cf46141 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp
@@ -28,7 +28,9 @@
#include "EventListener.h"
#include "JSEvent.h"
#include "JSEventListener.h"
+#include "JSMessageChannel.h"
#include "JSMessageEvent.h"
+#include "JSMessagePort.h"
#include "JSWorkerContext.h"
#include "JSWorkerLocation.h"
#include "JSWorkerNavigator.h"
@@ -47,7 +49,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSWorkerContext);
/* Hash table */
-static const HashTableValue JSWorkerContextTableValues[8] =
+static const HashTableValue JSWorkerContextTableValues[9] =
{
{ "self", DontDelete, (intptr_t)jsWorkerContextSelf, (intptr_t)setJSWorkerContextSelf },
{ "location", DontDelete, (intptr_t)jsWorkerContextLocation, (intptr_t)setJSWorkerContextLocation },
@@ -55,11 +57,12 @@ static const HashTableValue JSWorkerContextTableValues[8] =
{ "onmessage", DontDelete, (intptr_t)jsWorkerContextOnmessage, (intptr_t)setJSWorkerContextOnmessage },
{ "MessageEvent", DontDelete, (intptr_t)jsWorkerContextMessageEventConstructor, (intptr_t)setJSWorkerContextMessageEventConstructor },
{ "WorkerLocation", DontDelete, (intptr_t)jsWorkerContextWorkerLocationConstructor, (intptr_t)setJSWorkerContextWorkerLocationConstructor },
+ { "MessageChannel", DontDelete, (intptr_t)jsWorkerContextMessageChannelConstructor, (intptr_t)setJSWorkerContextMessageChannelConstructor },
{ "XMLHttpRequest", DontDelete, (intptr_t)jsWorkerContextXMLHttpRequestConstructor, (intptr_t)setJSWorkerContextXMLHttpRequestConstructor },
{ 0, 0, 0, 0 }
};
-static const HashTable JSWorkerContextTable =
+static JSC_CONST_HASHTABLE HashTable JSWorkerContextTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSWorkerContextTableValues, 0 };
#else
@@ -72,7 +75,7 @@ static const HashTableValue JSWorkerContextPrototypeTableValues[11] =
{
{ "close", DontDelete|Function, (intptr_t)jsWorkerContextPrototypeFunctionClose, (intptr_t)0 },
{ "importScripts", DontDelete|Function, (intptr_t)jsWorkerContextPrototypeFunctionImportScripts, (intptr_t)0 },
- { "postMessage", DontDelete|Function, (intptr_t)jsWorkerContextPrototypeFunctionPostMessage, (intptr_t)1 },
+ { "postMessage", DontDelete|Function, (intptr_t)jsWorkerContextPrototypeFunctionPostMessage, (intptr_t)2 },
{ "setTimeout", DontDelete|Function, (intptr_t)jsWorkerContextPrototypeFunctionSetTimeout, (intptr_t)2 },
{ "clearTimeout", DontDelete|Function, (intptr_t)jsWorkerContextPrototypeFunctionClearTimeout, (intptr_t)1 },
{ "setInterval", DontDelete|Function, (intptr_t)jsWorkerContextPrototypeFunctionSetInterval, (intptr_t)2 },
@@ -83,7 +86,7 @@ static const HashTableValue JSWorkerContextPrototypeTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWorkerContextPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWorkerContextPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSWorkerContextPrototypeTableValues, 0 };
#else
@@ -168,6 +171,11 @@ JSValue jsWorkerContextWorkerLocationConstructor(ExecState* exec, const Identifi
return JSWorkerLocation::getConstructor(exec);
}
+JSValue jsWorkerContextMessageChannelConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
+{
+ return static_cast<JSWorkerContext*>(asObject(slot.slotBase()))->messageChannel(exec);
+}
+
JSValue jsWorkerContextXMLHttpRequestConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
return static_cast<JSWorkerContext*>(asObject(slot.slotBase()))->xmlHttpRequest(exec);
@@ -216,6 +224,12 @@ void setJSWorkerContextWorkerLocationConstructor(ExecState* exec, JSObject* this
static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "WorkerLocation"), value);
}
+void setJSWorkerContextMessageChannelConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ // Shadowing a built-in constructor
+ static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "MessageChannel"), value);
+}
+
void setJSWorkerContextXMLHttpRequestConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
{
// Shadowing a built-in constructor
@@ -250,9 +264,20 @@ JSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionPostMessage(ExecState* exe
return throwError(exec, TypeError);
JSWorkerContext* castedThisObj = static_cast<JSWorkerContext*>(asObject(thisValue));
WorkerContext* imp = static_cast<WorkerContext*>(castedThisObj->impl());
+ ExceptionCode ec = 0;
const UString& message = args.at(0).toString(exec);
- imp->postMessage(message);
+ int argsCount = args.size();
+ if (argsCount < 2) {
+ imp->postMessage(message, ec);
+ setDOMException(exec, ec);
+ return jsUndefined();
+ }
+
+ MessagePort* messagePort = toMessagePort(args.at(1));
+
+ imp->postMessage(message, messagePort, ec);
+ setDOMException(exec, ec);
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h
index c522808..7453f27 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h
@@ -48,6 +48,7 @@ public:
// Custom attributes
+ JSC::JSValue messageChannel(JSC::ExecState*) const;
JSC::JSValue xmlHttpRequest(JSC::ExecState*) const;
// Custom functions
@@ -99,6 +100,8 @@ JSC::JSValue jsWorkerContextMessageEventConstructor(JSC::ExecState*, const JSC::
void setJSWorkerContextMessageEventConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsWorkerContextWorkerLocationConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSWorkerContextWorkerLocationConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsWorkerContextMessageChannelConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
+void setJSWorkerContextMessageChannelConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsWorkerContextXMLHttpRequestConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);
void setJSWorkerContextXMLHttpRequestConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp
index 7960f9a..d29c219 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp
@@ -52,7 +52,7 @@ static const HashTableValue JSWorkerLocationTableValues[10] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWorkerLocationTable =
+static JSC_CONST_HASHTABLE HashTable JSWorkerLocationTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSWorkerLocationTableValues, 0 };
#else
@@ -66,7 +66,7 @@ static const HashTableValue JSWorkerLocationConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWorkerLocationConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSWorkerLocationConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWorkerLocationConstructorTableValues, 0 };
#else
@@ -105,7 +105,7 @@ static const HashTableValue JSWorkerLocationPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWorkerLocationPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWorkerLocationPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWorkerLocationPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp
index 457f163..76da8f1 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp
@@ -47,7 +47,7 @@ static const HashTableValue JSWorkerNavigatorTableValues[6] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWorkerNavigatorTable =
+static JSC_CONST_HASHTABLE HashTable JSWorkerNavigatorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 511, JSWorkerNavigatorTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSWorkerNavigatorPrototypeTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSWorkerNavigatorPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSWorkerNavigatorPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSWorkerNavigatorPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp
index 1677954..ebd723e 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp
@@ -64,7 +64,7 @@ static const HashTableValue JSXMLHttpRequestTableValues[14] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSXMLHttpRequestTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSXMLHttpRequestPrototypeTableValues[16] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1023, JSXMLHttpRequestPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp
index 34a5444..3820567 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSXMLHttpRequestExceptionTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestExceptionTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestExceptionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSXMLHttpRequestExceptionTableValues, 0 };
#else
@@ -61,7 +61,7 @@ static const HashTableValue JSXMLHttpRequestExceptionConstructorTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestExceptionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestExceptionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 1, JSXMLHttpRequestExceptionConstructorTableValues, 0 };
#else
@@ -102,7 +102,7 @@ static const HashTableValue JSXMLHttpRequestExceptionPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestExceptionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestExceptionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSXMLHttpRequestExceptionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestProgressEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestProgressEvent.cpp
index 4882570..d1a5324 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestProgressEvent.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestProgressEvent.cpp
@@ -41,7 +41,7 @@ static const HashTableValue JSXMLHttpRequestProgressEventTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestProgressEventTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestProgressEventTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSXMLHttpRequestProgressEventTableValues, 0 };
#else
@@ -55,7 +55,7 @@ static const HashTableValue JSXMLHttpRequestProgressEventConstructorTableValues[
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestProgressEventConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestProgressEventConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXMLHttpRequestProgressEventConstructorTableValues, 0 };
#else
@@ -93,7 +93,7 @@ static const HashTableValue JSXMLHttpRequestProgressEventPrototypeTableValues[1]
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestProgressEventPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestProgressEventPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXMLHttpRequestProgressEventPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp
index 34942b0..ad482ce 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp
@@ -50,7 +50,7 @@ static const HashTableValue JSXMLHttpRequestUploadTableValues[7] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestUploadTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestUploadTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 15, JSXMLHttpRequestUploadTableValues, 0 };
#else
@@ -64,7 +64,7 @@ static const HashTableValue JSXMLHttpRequestUploadConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestUploadConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestUploadConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXMLHttpRequestUploadConstructorTableValues, 0 };
#else
@@ -105,7 +105,7 @@ static const HashTableValue JSXMLHttpRequestUploadPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLHttpRequestUploadPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestUploadPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSXMLHttpRequestUploadPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp
index 211f027..8c803b5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp
@@ -42,7 +42,7 @@ static const HashTableValue JSXMLSerializerTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLSerializerTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLSerializerTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXMLSerializerTableValues, 0 };
#else
@@ -56,7 +56,7 @@ static const HashTableValue JSXMLSerializerConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLSerializerConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLSerializerConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXMLSerializerConstructorTableValues, 0 };
#else
@@ -104,7 +104,7 @@ static const HashTableValue JSXMLSerializerPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXMLSerializerPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXMLSerializerPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXMLSerializerPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp
index 6103329..7570bc4 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp
@@ -51,7 +51,7 @@ static const HashTableValue JSXPathEvaluatorTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathEvaluatorTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathEvaluatorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXPathEvaluatorTableValues, 0 };
#else
@@ -65,7 +65,7 @@ static const HashTableValue JSXPathEvaluatorConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathEvaluatorConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathEvaluatorConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXPathEvaluatorConstructorTableValues, 0 };
#else
@@ -115,7 +115,7 @@ static const HashTableValue JSXPathEvaluatorPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathEvaluatorPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathEvaluatorPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSXPathEvaluatorPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp
index 82518b1..8ac6eb3 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp
@@ -48,7 +48,7 @@ static const HashTableValue JSXPathExceptionTableValues[5] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathExceptionTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathExceptionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSXPathExceptionTableValues, 0 };
#else
@@ -64,7 +64,7 @@ static const HashTableValue JSXPathExceptionConstructorTableValues[3] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathExceptionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathExceptionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSXPathExceptionConstructorTableValues, 0 };
#else
@@ -105,7 +105,7 @@ static const HashTableValue JSXPathExceptionPrototypeTableValues[4] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathExceptionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathExceptionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 3, JSXPathExceptionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp
index fd945fe..2bfaae5 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSXPathExpressionTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathExpressionTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathExpressionTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXPathExpressionTableValues, 0 };
#else
@@ -59,7 +59,7 @@ static const HashTableValue JSXPathExpressionConstructorTableValues[1] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathExpressionConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathExpressionConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXPathExpressionConstructorTableValues, 0 };
#else
@@ -98,7 +98,7 @@ static const HashTableValue JSXPathExpressionPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathExpressionPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathExpressionPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXPathExpressionPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp
index 550c85e..7136752 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp
@@ -45,7 +45,7 @@ static const HashTableValue JSXPathNSResolverPrototypeTableValues[2] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathNSResolverPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathNSResolverPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSXPathNSResolverPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp
index cecdf90..118325b 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp
@@ -54,7 +54,7 @@ static const HashTableValue JSXPathResultTableValues[9] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathResultTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathResultTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 63, JSXPathResultTableValues, 0 };
#else
@@ -78,7 +78,7 @@ static const HashTableValue JSXPathResultConstructorTableValues[11] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathResultConstructorTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathResultConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSXPathResultConstructorTableValues, 0 };
#else
@@ -128,7 +128,7 @@ static const HashTableValue JSXPathResultPrototypeTableValues[13] =
{ 0, 0, 0, 0 }
};
-static const HashTable JSXPathResultPrototypeTable =
+static JSC_CONST_HASHTABLE HashTable JSXPathResultPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSXPathResultPrototypeTableValues, 0 };
#else
diff --git a/src/3rdparty/webkit/WebCore/generated/Lexer.lut.h b/src/3rdparty/webkit/WebCore/generated/Lexer.lut.h
index 4c46e07..2cf7617 100644
--- a/src/3rdparty/webkit/WebCore/generated/Lexer.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/Lexer.lut.h
@@ -44,6 +44,6 @@ static const struct HashTableValue mainTableValues[37] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable mainTable =
+extern JSC_CONST_HASHTABLE HashTable mainTable =
{ 133, 127, mainTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/MathObject.lut.h b/src/3rdparty/webkit/WebCore/generated/MathObject.lut.h
index c8359c1..ce76857 100644
--- a/src/3rdparty/webkit/WebCore/generated/MathObject.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/MathObject.lut.h
@@ -26,6 +26,6 @@ static const struct HashTableValue mathTableValues[19] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable mathTable =
+extern JSC_CONST_HASHTABLE HashTable mathTable =
{ 67, 63, mathTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/NumberConstructor.lut.h b/src/3rdparty/webkit/WebCore/generated/NumberConstructor.lut.h
index 6879c03..d1155ae 100644
--- a/src/3rdparty/webkit/WebCore/generated/NumberConstructor.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/NumberConstructor.lut.h
@@ -13,6 +13,6 @@ static const struct HashTableValue numberTableValues[6] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable numberTable =
+extern JSC_CONST_HASHTABLE HashTable numberTable =
{ 16, 15, numberTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/RegExpConstructor.lut.h b/src/3rdparty/webkit/WebCore/generated/RegExpConstructor.lut.h
index 0bdf10c..eea201c 100644
--- a/src/3rdparty/webkit/WebCore/generated/RegExpConstructor.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/RegExpConstructor.lut.h
@@ -29,6 +29,6 @@ static const struct HashTableValue regExpConstructorTableValues[22] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable regExpConstructorTable =
+extern JSC_CONST_HASHTABLE HashTable regExpConstructorTable =
{ 65, 63, regExpConstructorTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/RegExpObject.lut.h b/src/3rdparty/webkit/WebCore/generated/RegExpObject.lut.h
index 69a745d..146aec0 100644
--- a/src/3rdparty/webkit/WebCore/generated/RegExpObject.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/RegExpObject.lut.h
@@ -13,6 +13,6 @@ static const struct HashTableValue regExpTableValues[6] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable regExpTable =
+extern JSC_CONST_HASHTABLE HashTable regExpTable =
{ 17, 15, regExpTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/StringPrototype.lut.h b/src/3rdparty/webkit/WebCore/generated/StringPrototype.lut.h
index aa044fa..bbbd75e 100644
--- a/src/3rdparty/webkit/WebCore/generated/StringPrototype.lut.h
+++ b/src/3rdparty/webkit/WebCore/generated/StringPrototype.lut.h
@@ -40,6 +40,6 @@ static const struct HashTableValue stringTableValues[33] = {
{ 0, 0, 0, 0 }
};
-extern const struct HashTable stringTable =
+extern JSC_CONST_HASHTABLE HashTable stringTable =
{ 71, 63, stringTableValues, 0 };
} // namespace
diff --git a/src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheets.h b/src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheets.h
index 6c53189..1ccfa4a 100644
--- a/src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheets.h
+++ b/src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheets.h
@@ -1,8 +1,8 @@
namespace WebCore {
-extern const char html4UserAgentStyleSheet[8585];
+extern const char htmlUserAgentStyleSheet[8502];
extern const char quirksUserAgentStyleSheet[359];
extern const char svgUserAgentStyleSheet[358];
extern const char sourceUserAgentStyleSheet[2004];
extern const char wmlUserAgentStyleSheet[2956];
-extern const char mediaControlsUserAgentStyleSheet[1999];
+extern const char mediaControlsUserAgentStyleSheet[2346];
}
diff --git a/src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheetsData.cpp b/src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheetsData.cpp
index efc6b9a..a6915e6 100644
--- a/src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheetsData.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheetsData.cpp
@@ -1,5 +1,5 @@
namespace WebCore {
-extern const char html4UserAgentStyleSheet[8585] = {
+extern const char htmlUserAgentStyleSheet[8502] = {
110, 97, 109, 101, 115, 112, 97, 99, 101, 32, 34, 104, 116, 116, 112, 58,
47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57,
57, 47, 120, 104, 116, 109, 108, 34, 59, 32, 104, 116, 109, 108, 32, 123,
@@ -531,12 +531,7 @@ extern const char html4UserAgentStyleSheet[8585] = {
123, 32, 98, 111, 114, 100, 101, 114, 45, 99, 111, 108, 111, 114, 58, 32,
105, 110, 104, 101, 114, 105, 116, 32, 125, 32, 105, 102, 114, 97, 109, 101,
32, 123, 32, 98, 111, 114, 100, 101, 114, 58, 32, 50, 112, 120, 32, 105,
- 110, 115, 101, 116, 32, 125, 32, 105, 109, 103, 44, 32, 105, 110, 112, 117,
- 116, 91, 116, 121, 112, 101, 61, 105, 109, 97, 103, 101, 93, 44, 32, 118,
- 105, 100, 101, 111, 44, 32, 105, 102, 114, 97, 109, 101, 44, 32, 111, 98,
- 106, 101, 99, 116, 44, 32, 101, 109, 98, 101, 100, 44, 32, 97, 112, 112,
- 108, 101, 116, 32, 123, 32, 111, 118, 101, 114, 102, 108, 111, 119, 58, 32,
- 104, 105, 100, 100, 101, 110, 59, 32, 125
+ 110, 115, 101, 116, 32, 125
};
extern const char quirksUserAgentStyleSheet[359] = {
105, 109, 103, 91, 97, 108, 105, 103, 110, 61, 34, 108, 101, 102, 116, 34,
@@ -903,7 +898,7 @@ extern const char wmlUserAgentStyleSheet[2956] = {
32, 99, 111, 108, 111, 114, 58, 32, 45, 119, 101, 98, 107, 105, 116, 45,
97, 99, 116, 105, 118, 101, 108, 105, 110, 107, 32, 125
};
-extern const char mediaControlsUserAgentStyleSheet[1999] = {
+extern const char mediaControlsUserAgentStyleSheet[2346] = {
97, 117, 100, 105, 111, 32, 123, 32, 119, 105, 100, 116, 104, 58, 32, 50,
48, 48, 112, 120, 59, 32, 104, 101, 105, 103, 104, 116, 58, 32, 49, 54,
112, 120, 59, 32, 125, 32, 97, 117, 100, 105, 111, 58, 58, 45, 119, 101,
@@ -914,120 +909,142 @@ extern const char mediaControlsUserAgentStyleSheet[1999] = {
32, 100, 105, 115, 112, 108, 97, 121, 58, 32, 45, 119, 101, 98, 107, 105,
116, 45, 98, 111, 120, 59, 32, 45, 119, 101, 98, 107, 105, 116, 45, 98,
111, 120, 45, 111, 114, 105, 101, 110, 116, 58, 32, 104, 111, 114, 105, 122,
- 111, 110, 116, 97, 108, 59, 32, 45, 119, 101, 98, 107, 105, 116, 45, 117,
- 115, 101, 114, 45, 115, 101, 108, 101, 99, 116, 58, 32, 110, 111, 110, 101,
- 59, 32, 112, 111, 115, 105, 116, 105, 111, 110, 58, 32, 97, 98, 115, 111,
- 108, 117, 116, 101, 59, 32, 98, 111, 116, 116, 111, 109, 58, 32, 48, 59,
- 32, 119, 105, 100, 116, 104, 58, 32, 49, 48, 48, 37, 59, 32, 122, 45,
- 105, 110, 100, 101, 120, 58, 32, 48, 59, 32, 111, 118, 101, 114, 102, 108,
- 111, 119, 58, 32, 104, 105, 100, 100, 101, 110, 59, 32, 104, 101, 105, 103,
- 104, 116, 58, 32, 49, 54, 112, 120, 59, 32, 116, 101, 120, 116, 45, 97,
- 108, 105, 103, 110, 58, 32, 114, 105, 103, 104, 116, 59, 32, 125, 32, 118,
- 105, 100, 101, 111, 58, 45, 119, 101, 98, 107, 105, 116, 45, 102, 117, 108,
- 108, 45, 112, 97, 103, 101, 45, 109, 101, 100, 105, 97, 58, 58, 45, 119,
- 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116,
- 114, 111, 108, 115, 45, 112, 97, 110, 101, 108, 32, 123, 32, 98, 111, 116,
- 116, 111, 109, 58, 32, 45, 49, 54, 112, 120, 59, 32, 125, 32, 97, 117,
- 100, 105, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100,
- 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 109, 117, 116, 101,
- 45, 98, 117, 116, 116, 111, 110, 44, 32, 118, 105, 100, 101, 111, 58, 58,
+ 111, 110, 116, 97, 108, 59, 32, 45, 119, 101, 98, 107, 105, 116, 45, 98,
+ 111, 120, 45, 97, 108, 105, 103, 110, 58, 32, 99, 101, 110, 116, 101, 114,
+ 59, 32, 45, 119, 101, 98, 107, 105, 116, 45, 117, 115, 101, 114, 45, 115,
+ 101, 108, 101, 99, 116, 58, 32, 110, 111, 110, 101, 59, 32, 112, 111, 115,
+ 105, 116, 105, 111, 110, 58, 32, 97, 98, 115, 111, 108, 117, 116, 101, 59,
+ 32, 98, 111, 116, 116, 111, 109, 58, 32, 48, 59, 32, 119, 105, 100, 116,
+ 104, 58, 32, 49, 48, 48, 37, 59, 32, 122, 45, 105, 110, 100, 101, 120,
+ 58, 32, 48, 59, 32, 111, 118, 101, 114, 102, 108, 111, 119, 58, 32, 104,
+ 105, 100, 100, 101, 110, 59, 32, 104, 101, 105, 103, 104, 116, 58, 32, 49,
+ 54, 112, 120, 59, 32, 116, 101, 120, 116, 45, 97, 108, 105, 103, 110, 58,
+ 32, 114, 105, 103, 104, 116, 59, 32, 125, 32, 118, 105, 100, 101, 111, 58,
+ 45, 119, 101, 98, 107, 105, 116, 45, 102, 117, 108, 108, 45, 112, 97, 103,
+ 101, 45, 109, 101, 100, 105, 97, 58, 58, 45, 119, 101, 98, 107, 105, 116,
+ 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45,
+ 112, 97, 110, 101, 108, 32, 123, 32, 98, 111, 116, 116, 111, 109, 58, 32,
+ 45, 49, 54, 112, 120, 59, 32, 125, 32, 97, 117, 100, 105, 111, 58, 58,
45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111,
110, 116, 114, 111, 108, 115, 45, 109, 117, 116, 101, 45, 98, 117, 116, 116,
- 111, 110, 32, 123, 32, 45, 119, 101, 98, 107, 105, 116, 45, 97, 112, 112,
- 101, 97, 114, 97, 110, 99, 101, 58, 32, 109, 101, 100, 105, 97, 45, 109,
- 117, 116, 101, 45, 98, 117, 116, 116, 111, 110, 59, 32, 100, 105, 115, 112,
+ 111, 110, 44, 32, 118, 105, 100, 101, 111, 58, 58, 45, 119, 101, 98, 107,
+ 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108,
+ 115, 45, 109, 117, 116, 101, 45, 98, 117, 116, 116, 111, 110, 32, 123, 32,
+ 45, 119, 101, 98, 107, 105, 116, 45, 97, 112, 112, 101, 97, 114, 97, 110,
+ 99, 101, 58, 32, 109, 101, 100, 105, 97, 45, 109, 117, 116, 101, 45, 98,
+ 117, 116, 116, 111, 110, 59, 32, 100, 105, 115, 112, 108, 97, 121, 58, 32,
+ 45, 119, 101, 98, 107, 105, 116, 45, 98, 111, 120, 59, 32, 119, 105, 100,
+ 116, 104, 58, 32, 49, 54, 112, 120, 59, 32, 104, 101, 105, 103, 104, 116,
+ 58, 32, 49, 54, 112, 120, 59, 32, 125, 32, 97, 117, 100, 105, 111, 58,
+ 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99,
+ 111, 110, 116, 114, 111, 108, 115, 45, 112, 108, 97, 121, 45, 98, 117, 116,
+ 116, 111, 110, 44, 32, 118, 105, 100, 101, 111, 58, 58, 45, 119, 101, 98,
+ 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111,
+ 108, 115, 45, 112, 108, 97, 121, 45, 98, 117, 116, 116, 111, 110, 32, 123,
+ 32, 45, 119, 101, 98, 107, 105, 116, 45, 97, 112, 112, 101, 97, 114, 97,
+ 110, 99, 101, 58, 32, 109, 101, 100, 105, 97, 45, 112, 108, 97, 121, 45,
+ 98, 117, 116, 116, 111, 110, 59, 32, 100, 105, 115, 112, 108, 97, 121, 58,
+ 32, 45, 119, 101, 98, 107, 105, 116, 45, 98, 111, 120, 59, 32, 119, 105,
+ 100, 116, 104, 58, 32, 49, 54, 112, 120, 59, 32, 104, 101, 105, 103, 104,
+ 116, 58, 32, 49, 54, 112, 120, 59, 32, 125, 32, 97, 117, 100, 105, 111,
+ 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45,
+ 99, 111, 110, 116, 114, 111, 108, 115, 45, 116, 105, 109, 101, 108, 105, 110,
+ 101, 45, 99, 111, 110, 116, 97, 105, 110, 101, 114, 44, 32, 118, 105, 100,
+ 101, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105,
+ 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 116, 105, 109, 101, 108,
+ 105, 110, 101, 45, 99, 111, 110, 116, 97, 105, 110, 101, 114, 32, 123, 32,
+ 45, 119, 101, 98, 107, 105, 116, 45, 97, 112, 112, 101, 97, 114, 97, 110,
+ 99, 101, 58, 32, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111,
+ 108, 115, 45, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 59, 32, 100,
+ 105, 115, 112, 108, 97, 121, 58, 32, 45, 119, 101, 98, 107, 105, 116, 45,
+ 98, 111, 120, 59, 32, 45, 119, 101, 98, 107, 105, 116, 45, 98, 111, 120,
+ 45, 111, 114, 105, 101, 110, 116, 58, 32, 104, 111, 114, 105, 122, 111, 110,
+ 116, 97, 108, 59, 32, 45, 119, 101, 98, 107, 105, 116, 45, 98, 111, 120,
+ 45, 97, 108, 105, 103, 110, 58, 32, 99, 101, 110, 116, 101, 114, 59, 32,
+ 45, 119, 101, 98, 107, 105, 116, 45, 98, 111, 120, 45, 112, 97, 99, 107,
+ 58, 32, 101, 110, 100, 59, 32, 45, 119, 101, 98, 107, 105, 116, 45, 98,
+ 111, 120, 45, 102, 108, 101, 120, 58, 32, 49, 59, 32, 45, 119, 101, 98,
+ 107, 105, 116, 45, 117, 115, 101, 114, 45, 115, 101, 108, 101, 99, 116, 58,
+ 32, 110, 111, 110, 101, 59, 32, 104, 101, 105, 103, 104, 116, 58, 32, 49,
+ 54, 112, 120, 59, 32, 125, 32, 97, 117, 100, 105, 111, 58, 58, 45, 119,
+ 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116,
+ 114, 111, 108, 115, 45, 99, 117, 114, 114, 101, 110, 116, 45, 116, 105, 109,
+ 101, 45, 100, 105, 115, 112, 108, 97, 121, 44, 32, 118, 105, 100, 101, 111,
+ 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45,
+ 99, 111, 110, 116, 114, 111, 108, 115, 45, 99, 117, 114, 114, 101, 110, 116,
+ 45, 116, 105, 109, 101, 45, 100, 105, 115, 112, 108, 97, 121, 32, 123, 32,
+ 100, 105, 115, 112, 108, 97, 121, 58, 32, 110, 111, 110, 101, 59, 32, 125,
+ 32, 97, 117, 100, 105, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45,
+ 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 116,
+ 105, 109, 101, 45, 114, 101, 109, 97, 105, 110, 105, 110, 103, 45, 100, 105,
+ 115, 112, 108, 97, 121, 44, 32, 118, 105, 100, 101, 111, 58, 58, 45, 119,
+ 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116,
+ 114, 111, 108, 115, 45, 116, 105, 109, 101, 45, 114, 101, 109, 97, 105, 110,
+ 105, 110, 103, 45, 100, 105, 115, 112, 108, 97, 121, 32, 123, 32, 100, 105,
+ 115, 112, 108, 97, 121, 58, 32, 110, 111, 110, 101, 59, 32, 125, 32, 97,
+ 117, 100, 105, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101,
+ 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 116, 105, 109,
+ 101, 108, 105, 110, 101, 44, 32, 118, 105, 100, 101, 111, 58, 58, 45, 119,
+ 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116,
+ 114, 111, 108, 115, 45, 116, 105, 109, 101, 108, 105, 110, 101, 32, 123, 32,
+ 45, 119, 101, 98, 107, 105, 116, 45, 97, 112, 112, 101, 97, 114, 97, 110,
+ 99, 101, 58, 32, 109, 101, 100, 105, 97, 45, 115, 108, 105, 100, 101, 114,
+ 59, 32, 100, 105, 115, 112, 108, 97, 121, 58, 32, 45, 119, 101, 98, 107,
+ 105, 116, 45, 98, 111, 120, 59, 32, 45, 119, 101, 98, 107, 105, 116, 45,
+ 98, 111, 120, 45, 102, 108, 101, 120, 58, 32, 49, 59, 32, 104, 101, 105,
+ 103, 104, 116, 58, 32, 49, 54, 112, 120, 59, 32, 112, 97, 100, 100, 105,
+ 110, 103, 58, 32, 48, 112, 120, 32, 50, 112, 120, 59, 32, 125, 32, 97,
+ 117, 100, 105, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101,
+ 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 115, 101, 101,
+ 107, 45, 98, 97, 99, 107, 45, 98, 117, 116, 116, 111, 110, 44, 32, 118,
+ 105, 100, 101, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101,
+ 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 115, 101, 101,
+ 107, 45, 98, 97, 99, 107, 45, 98, 117, 116, 116, 111, 110, 32, 123, 32,
+ 45, 119, 101, 98, 107, 105, 116, 45, 97, 112, 112, 101, 97, 114, 97, 110,
+ 99, 101, 58, 32, 109, 101, 100, 105, 97, 45, 115, 101, 101, 107, 45, 98,
+ 97, 99, 107, 45, 98, 117, 116, 116, 111, 110, 59, 32, 100, 105, 115, 112,
108, 97, 121, 58, 32, 45, 119, 101, 98, 107, 105, 116, 45, 98, 111, 120,
59, 32, 119, 105, 100, 116, 104, 58, 32, 49, 54, 112, 120, 59, 32, 104,
101, 105, 103, 104, 116, 58, 32, 49, 54, 112, 120, 59, 32, 125, 32, 97,
117, 100, 105, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101,
- 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 112, 108, 97,
- 121, 45, 98, 117, 116, 116, 111, 110, 44, 32, 118, 105, 100, 101, 111, 58,
- 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99,
- 111, 110, 116, 114, 111, 108, 115, 45, 112, 108, 97, 121, 45, 98, 117, 116,
- 116, 111, 110, 32, 123, 32, 45, 119, 101, 98, 107, 105, 116, 45, 97, 112,
- 112, 101, 97, 114, 97, 110, 99, 101, 58, 32, 109, 101, 100, 105, 97, 45,
- 112, 108, 97, 121, 45, 98, 117, 116, 116, 111, 110, 59, 32, 100, 105, 115,
- 112, 108, 97, 121, 58, 32, 45, 119, 101, 98, 107, 105, 116, 45, 98, 111,
- 120, 59, 32, 119, 105, 100, 116, 104, 58, 32, 49, 54, 112, 120, 59, 32,
- 104, 101, 105, 103, 104, 116, 58, 32, 49, 54, 112, 120, 59, 32, 125, 32,
- 97, 117, 100, 105, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109,
- 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 116, 105,
- 109, 101, 108, 105, 110, 101, 45, 99, 111, 110, 116, 97, 105, 110, 101, 114,
+ 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 115, 101, 101,
+ 107, 45, 102, 111, 114, 119, 97, 114, 100, 45, 98, 117, 116, 116, 111, 110,
44, 32, 118, 105, 100, 101, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116,
45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45,
- 116, 105, 109, 101, 108, 105, 110, 101, 45, 99, 111, 110, 116, 97, 105, 110,
- 101, 114, 32, 123, 32, 45, 119, 101, 98, 107, 105, 116, 45, 97, 112, 112,
- 101, 97, 114, 97, 110, 99, 101, 58, 32, 109, 101, 100, 105, 97, 45, 116,
- 105, 109, 101, 108, 105, 110, 101, 45, 99, 111, 110, 116, 97, 105, 110, 101,
- 114, 59, 32, 100, 105, 115, 112, 108, 97, 121, 58, 32, 45, 119, 101, 98,
- 107, 105, 116, 45, 98, 111, 120, 59, 32, 45, 119, 101, 98, 107, 105, 116,
- 45, 98, 111, 120, 45, 111, 114, 105, 101, 110, 116, 58, 32, 104, 111, 114,
- 105, 122, 111, 110, 116, 97, 108, 59, 32, 45, 119, 101, 98, 107, 105, 116,
- 45, 98, 111, 120, 45, 97, 108, 105, 103, 110, 58, 32, 99, 101, 110, 116,
- 101, 114, 59, 32, 45, 119, 101, 98, 107, 105, 116, 45, 98, 111, 120, 45,
- 112, 97, 99, 107, 58, 32, 101, 110, 100, 59, 32, 45, 119, 101, 98, 107,
- 105, 116, 45, 98, 111, 120, 45, 102, 108, 101, 120, 58, 32, 49, 59, 32,
- 45, 119, 101, 98, 107, 105, 116, 45, 117, 115, 101, 114, 45, 115, 101, 108,
- 101, 99, 116, 58, 32, 110, 111, 110, 101, 59, 32, 104, 101, 105, 103, 104,
+ 115, 101, 101, 107, 45, 102, 111, 114, 119, 97, 114, 100, 45, 98, 117, 116,
+ 116, 111, 110, 32, 123, 32, 45, 119, 101, 98, 107, 105, 116, 45, 97, 112,
+ 112, 101, 97, 114, 97, 110, 99, 101, 58, 32, 109, 101, 100, 105, 97, 45,
+ 115, 101, 101, 107, 45, 102, 111, 114, 119, 97, 114, 100, 45, 98, 117, 116,
+ 116, 111, 110, 59, 32, 100, 105, 115, 112, 108, 97, 121, 58, 32, 45, 119,
+ 101, 98, 107, 105, 116, 45, 98, 111, 120, 59, 32, 119, 105, 100, 116, 104,
+ 58, 32, 49, 54, 112, 120, 59, 32, 104, 101, 105, 103, 104, 116, 58, 32,
+ 49, 54, 112, 120, 59, 32, 125, 32, 97, 117, 100, 105, 111, 58, 58, 45,
+ 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110,
+ 116, 114, 111, 108, 115, 45, 102, 117, 108, 108, 115, 99, 114, 101, 101, 110,
+ 45, 98, 117, 116, 116, 111, 110, 44, 32, 118, 105, 100, 101, 111, 58, 58,
+ 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111,
+ 110, 116, 114, 111, 108, 115, 45, 102, 117, 108, 108, 115, 99, 114, 101, 101,
+ 110, 45, 98, 117, 116, 116, 111, 110, 32, 123, 32, 45, 119, 101, 98, 107,
+ 105, 116, 45, 97, 112, 112, 101, 97, 114, 97, 110, 99, 101, 58, 32, 109,
+ 101, 100, 105, 97, 45, 102, 117, 108, 108, 115, 99, 114, 101, 101, 110, 45,
+ 98, 117, 116, 116, 111, 110, 59, 32, 100, 105, 115, 112, 108, 97, 121, 58,
+ 32, 45, 119, 101, 98, 107, 105, 116, 45, 98, 111, 120, 59, 32, 119, 105,
+ 100, 116, 104, 58, 32, 49, 54, 112, 120, 59, 32, 104, 101, 105, 103, 104,
116, 58, 32, 49, 54, 112, 120, 59, 32, 125, 32, 97, 117, 100, 105, 111,
58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45,
- 99, 111, 110, 116, 114, 111, 108, 115, 45, 99, 117, 114, 114, 101, 110, 116,
- 45, 116, 105, 109, 101, 45, 100, 105, 115, 112, 108, 97, 121, 44, 32, 118,
- 105, 100, 101, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101,
- 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 99, 117, 114,
- 114, 101, 110, 116, 45, 116, 105, 109, 101, 45, 100, 105, 115, 112, 108, 97,
- 121, 32, 123, 32, 100, 105, 115, 112, 108, 97, 121, 58, 32, 110, 111, 110,
- 101, 59, 32, 125, 32, 97, 117, 100, 105, 111, 58, 58, 45, 119, 101, 98,
- 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111,
- 108, 115, 45, 116, 105, 109, 101, 45, 114, 101, 109, 97, 105, 110, 105, 110,
- 103, 45, 100, 105, 115, 112, 108, 97, 121, 44, 32, 118, 105, 100, 101, 111,
- 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45,
- 99, 111, 110, 116, 114, 111, 108, 115, 45, 116, 105, 109, 101, 45, 114, 101,
- 109, 97, 105, 110, 105, 110, 103, 45, 100, 105, 115, 112, 108, 97, 121, 32,
- 123, 32, 100, 105, 115, 112, 108, 97, 121, 58, 32, 110, 111, 110, 101, 59,
- 32, 125, 32, 97, 117, 100, 105, 111, 58, 58, 45, 119, 101, 98, 107, 105,
- 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115,
- 45, 116, 105, 109, 101, 108, 105, 110, 101, 44, 32, 118, 105, 100, 101, 111,
- 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45,
- 99, 111, 110, 116, 114, 111, 108, 115, 45, 116, 105, 109, 101, 108, 105, 110,
- 101, 32, 123, 32, 45, 119, 101, 98, 107, 105, 116, 45, 97, 112, 112, 101,
- 97, 114, 97, 110, 99, 101, 58, 32, 109, 101, 100, 105, 97, 45, 115, 108,
- 105, 100, 101, 114, 59, 32, 100, 105, 115, 112, 108, 97, 121, 58, 32, 45,
- 119, 101, 98, 107, 105, 116, 45, 98, 111, 120, 59, 32, 45, 119, 101, 98,
- 107, 105, 116, 45, 98, 111, 120, 45, 102, 108, 101, 120, 58, 32, 49, 59,
- 32, 104, 101, 105, 103, 104, 116, 58, 32, 49, 54, 112, 120, 59, 32, 112,
- 97, 100, 100, 105, 110, 103, 58, 32, 48, 112, 120, 32, 50, 112, 120, 59,
- 32, 125, 32, 97, 117, 100, 105, 111, 58, 58, 45, 119, 101, 98, 107, 105,
- 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115,
- 45, 115, 101, 101, 107, 45, 98, 97, 99, 107, 45, 98, 117, 116, 116, 111,
- 110, 44, 32, 118, 105, 100, 101, 111, 58, 58, 45, 119, 101, 98, 107, 105,
- 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115,
- 45, 115, 101, 101, 107, 45, 98, 97, 99, 107, 45, 98, 117, 116, 116, 111,
- 110, 32, 123, 32, 45, 119, 101, 98, 107, 105, 116, 45, 97, 112, 112, 101,
- 97, 114, 97, 110, 99, 101, 58, 32, 109, 101, 100, 105, 97, 45, 115, 101,
- 101, 107, 45, 98, 97, 99, 107, 45, 98, 117, 116, 116, 111, 110, 59, 32,
- 100, 105, 115, 112, 108, 97, 121, 58, 32, 45, 119, 101, 98, 107, 105, 116,
- 45, 98, 111, 120, 59, 32, 119, 105, 100, 116, 104, 58, 32, 49, 54, 112,
- 120, 59, 32, 104, 101, 105, 103, 104, 116, 58, 32, 49, 54, 112, 120, 59,
- 32, 125, 32, 97, 117, 100, 105, 111, 58, 58, 45, 119, 101, 98, 107, 105,
- 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115,
- 45, 115, 101, 101, 107, 45, 102, 111, 114, 119, 97, 114, 100, 45, 98, 117,
- 116, 116, 111, 110, 44, 32, 118, 105, 100, 101, 111, 58, 58, 45, 119, 101,
- 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116, 114,
- 111, 108, 115, 45, 115, 101, 101, 107, 45, 102, 111, 114, 119, 97, 114, 100,
- 45, 98, 117, 116, 116, 111, 110, 32, 123, 32, 45, 119, 101, 98, 107, 105,
- 116, 45, 97, 112, 112, 101, 97, 114, 97, 110, 99, 101, 58, 32, 109, 101,
- 100, 105, 97, 45, 115, 101, 101, 107, 45, 102, 111, 114, 119, 97, 114, 100,
- 45, 98, 117, 116, 116, 111, 110, 59, 32, 100, 105, 115, 112, 108, 97, 121,
- 58, 32, 45, 119, 101, 98, 107, 105, 116, 45, 98, 111, 120, 59, 32, 119,
- 105, 100, 116, 104, 58, 32, 49, 54, 112, 120, 59, 32, 104, 101, 105, 103,
- 104, 116, 58, 32, 49, 54, 112, 120, 59, 32, 125, 32, 97, 117, 100, 105,
- 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97,
- 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 102, 117, 108, 108, 115, 99,
- 114, 101, 101, 110, 45, 98, 117, 116, 116, 111, 110, 44, 32, 118, 105, 100,
- 101, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105,
- 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 102, 117, 108, 108, 115,
- 99, 114, 101, 101, 110, 45, 98, 117, 116, 116, 111, 110, 32, 123, 32, 100,
- 105, 115, 112, 108, 97, 121, 58, 32, 110, 111, 110, 101, 59, 32, 125
+ 99, 111, 110, 116, 114, 111, 108, 115, 45, 114, 101, 119, 105, 110, 100, 45,
+ 98, 117, 116, 116, 111, 110, 44, 32, 118, 105, 100, 101, 111, 58, 58, 45,
+ 119, 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110,
+ 116, 114, 111, 108, 115, 45, 114, 101, 119, 105, 110, 100, 45, 98, 117, 116,
+ 116, 111, 110, 32, 123, 32, 100, 105, 115, 112, 108, 97, 121, 58, 32, 110,
+ 111, 110, 101, 59, 32, 125, 32, 97, 117, 100, 105, 111, 58, 58, 45, 119,
+ 101, 98, 107, 105, 116, 45, 109, 101, 100, 105, 97, 45, 99, 111, 110, 116,
+ 114, 111, 108, 115, 45, 114, 101, 116, 117, 114, 110, 45, 116, 111, 45, 114,
+ 101, 97, 108, 116, 105, 109, 101, 45, 98, 117, 116, 116, 111, 110, 44, 32,
+ 118, 105, 100, 101, 111, 58, 58, 45, 119, 101, 98, 107, 105, 116, 45, 109,
+ 101, 100, 105, 97, 45, 99, 111, 110, 116, 114, 111, 108, 115, 45, 114, 101,
+ 116, 117, 114, 110, 45, 116, 111, 45, 114, 101, 97, 108, 116, 105, 109, 101,
+ 45, 98, 117, 116, 116, 111, 110, 32, 123, 32, 100, 105, 115, 112, 108, 97,
+ 121, 58, 32, 110, 111, 110, 101, 59, 32, 125
};
}
diff --git a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp
index d06adf6..1872980 100644
--- a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -47,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -55,69 +54,28 @@
/* Pure parsers. */
#define YYPURE 1
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
/* Using locations. */
#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */
-#define yyparse xpathyyparse
-#define yylex xpathyylex
-#define yyerror xpathyyerror
-#define yylval xpathyylval
-#define yychar xpathyychar
-#define yydebug xpathyydebug
-#define yynerrs xpathyynerrs
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- MULOP = 258,
- RELOP = 259,
- EQOP = 260,
- MINUS = 261,
- PLUS = 262,
- AND = 263,
- OR = 264,
- AXISNAME = 265,
- NODETYPE = 266,
- PI = 267,
- FUNCTIONNAME = 268,
- LITERAL = 269,
- VARIABLEREFERENCE = 270,
- NUMBER = 271,
- DOTDOT = 272,
- SLASHSLASH = 273,
- NAMETEST = 274,
- XPATH_ERROR = 275
- };
-#endif
-/* Tokens. */
-#define MULOP 258
-#define RELOP 259
-#define EQOP 260
-#define MINUS 261
-#define PLUS 262
-#define AND 263
-#define OR 264
-#define AXISNAME 265
-#define NODETYPE 266
-#define PI 267
-#define FUNCTIONNAME 268
-#define LITERAL 269
-#define VARIABLEREFERENCE 270
-#define NUMBER 271
-#define DOTDOT 272
-#define SLASHSLASH 273
-#define NAMETEST 274
-#define XPATH_ERROR 275
-
-
+#define yyparse xpathyyparse
+#define yylex xpathyylex
+#define yyerror xpathyyerror
+#define yylval xpathyylval
+#define yychar xpathyychar
+#define yydebug xpathyydebug
+#define yynerrs xpathyynerrs
/* Copy the first part of user declarations. */
+
+/* Line 189 of yacc.c */
#line 28 "../xml/XPathGrammar.y"
@@ -144,6 +102,9 @@ using namespace XPath;
+/* Line 189 of yacc.c */
+#line 107 "WebCore/tmp/../generated/XPathGrammar.tab.c"
+
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -162,10 +123,43 @@ using namespace XPath;
# define YYTOKEN_TABLE 0
#endif
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ MULOP = 258,
+ RELOP = 259,
+ EQOP = 260,
+ MINUS = 261,
+ PLUS = 262,
+ AND = 263,
+ OR = 264,
+ AXISNAME = 265,
+ NODETYPE = 266,
+ PI = 267,
+ FUNCTIONNAME = 268,
+ LITERAL = 269,
+ VARIABLEREFERENCE = 270,
+ NUMBER = 271,
+ DOTDOT = 272,
+ SLASHSLASH = 273,
+ NAMETEST = 274,
+ XPATH_ERROR = 275
+ };
+#endif
+
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 56 "../xml/XPathGrammar.y"
{
+
+/* Line 214 of yacc.c */
+#line 56 "../xml/XPathGrammar.y"
+
Step::Axis axis;
Step::NodeTest* nodeTest;
NumericOp::Opcode numop;
@@ -176,18 +170,21 @@ typedef union YYSTYPE
Vector<Expression*>* argList;
Step* step;
LocationPath* locationPath;
-}
-/* Line 187 of yacc.c. */
-#line 182 "WebCore/tmp/../generated/XPathGrammar.tab.c"
- YYSTYPE;
+
+
+
+/* Line 214 of yacc.c */
+#line 178 "WebCore/tmp/../generated/XPathGrammar.tab.c"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
-
/* Copy the second part of user declarations. */
+
+/* Line 264 of yacc.c */
#line 69 "../xml/XPathGrammar.y"
@@ -196,8 +193,8 @@ static void xpathyyerror(const char*) { }
-/* Line 216 of yacc.c. */
-#line 201 "WebCore/tmp/../generated/XPathGrammar.tab.c"
+/* Line 264 of yacc.c */
+#line 198 "WebCore/tmp/../generated/XPathGrammar.tab.c"
#ifdef short
# undef short
@@ -272,14 +269,14 @@ typedef short int yytype_int16;
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
-YYID (int i)
+YYID (int yyi)
#else
static int
-YYID (i)
- int i;
+YYID (yyi)
+ int yyi;
#endif
{
- return i;
+ return yyi;
}
#endif
@@ -360,9 +357,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- };
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -396,12 +393,12 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
@@ -854,17 +851,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
-yy_stack_print (bottom, top)
- yytype_int16 *bottom;
- yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
- for (; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
YYFPRINTF (stderr, "\n");
}
@@ -898,11 +898,11 @@ yy_reduce_print (yyvsp, yyrule)
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
- fprintf (stderr, " $%d = ", yyi + 1);
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
- fprintf (stderr, "\n");
+ YYFPRINTF (stderr, "\n");
}
}
@@ -1182,10 +1182,8 @@ yydestruct (yymsg, yytype, yyvaluep)
break;
}
}
-
/* Prevent warnings from -Wmissing-prototypes. */
-
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
@@ -1204,10 +1202,9 @@ int yyparse ();
-
-/*----------.
-| yyparse. |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse. |
+`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1231,74 +1228,75 @@ yyparse ()
#endif
#endif
{
- /* The look-ahead symbol. */
+/* The lookahead symbol. */
int yychar;
-/* The semantic value of the look-ahead symbol. */
+/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-/* Number of syntax errors so far. */
-int yynerrs;
-
- int yystate;
- int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
+ /* Number of syntax errors so far. */
+ int yynerrs;
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss = yyssa;
- yytype_int16 *yyssp;
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
+ /* The stacks and their tools:
+ `yyss': related to states.
+ `yyvs': related to semantic values.
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
- YYSIZE_T yystacksize = YYINITDEPTH;
+ YYSIZE_T yystacksize;
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
+ yytoken = 0;
+ yyss = yyssa;
+ yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
+
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
+ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
-
yyssp = yyss;
yyvsp = yyvs;
@@ -1328,7 +1326,6 @@ int yynerrs;
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
-
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
@@ -1336,7 +1333,6 @@ int yynerrs;
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
-
&yystacksize);
yyss = yyss1;
@@ -1359,9 +1355,8 @@ int yynerrs;
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
@@ -1372,7 +1367,6 @@ int yynerrs;
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
-
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
@@ -1382,6 +1376,9 @@ int yynerrs;
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
goto yybackup;
/*-----------.
@@ -1390,16 +1387,16 @@ int yynerrs;
yybackup:
/* Do appropriate processing given the current state. Read a
- look-ahead token if we need one and don't already have one. */
+ lookahead token if we need one and don't already have one. */
- /* First try to decide what to do without reference to look-ahead token. */
+ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
- /* Not known => get a look-ahead token if don't already have one. */
+ /* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
@@ -1431,20 +1428,16 @@ yybackup:
goto yyreduce;
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
- /* Shift the look-ahead token. */
+ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
- /* Discard the shifted token unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
@@ -1484,6 +1477,8 @@ yyreduce:
switch (yyn)
{
case 2:
+
+/* Line 1455 of yacc.c */
#line 118 "../xml/XPathGrammar.y"
{
PARSER->m_topExpr = (yyvsp[(1) - (1)].expr);
@@ -1491,6 +1486,8 @@ yyreduce:
break;
case 3:
+
+/* Line 1455 of yacc.c */
#line 125 "../xml/XPathGrammar.y"
{
(yyval.locationPath)->setAbsolute(false);
@@ -1498,6 +1495,8 @@ yyreduce:
break;
case 4:
+
+/* Line 1455 of yacc.c */
#line 130 "../xml/XPathGrammar.y"
{
(yyval.locationPath)->setAbsolute(true);
@@ -1505,6 +1504,8 @@ yyreduce:
break;
case 5:
+
+/* Line 1455 of yacc.c */
#line 137 "../xml/XPathGrammar.y"
{
(yyval.locationPath) = new LocationPath;
@@ -1513,6 +1514,8 @@ yyreduce:
break;
case 6:
+
+/* Line 1455 of yacc.c */
#line 143 "../xml/XPathGrammar.y"
{
(yyval.locationPath) = (yyvsp[(2) - (2)].locationPath);
@@ -1520,6 +1523,8 @@ yyreduce:
break;
case 7:
+
+/* Line 1455 of yacc.c */
#line 148 "../xml/XPathGrammar.y"
{
(yyval.locationPath) = (yyvsp[(2) - (2)].locationPath);
@@ -1529,6 +1534,8 @@ yyreduce:
break;
case 8:
+
+/* Line 1455 of yacc.c */
#line 157 "../xml/XPathGrammar.y"
{
(yyval.locationPath) = new LocationPath;
@@ -1539,6 +1546,8 @@ yyreduce:
break;
case 9:
+
+/* Line 1455 of yacc.c */
#line 165 "../xml/XPathGrammar.y"
{
(yyval.locationPath)->appendStep((yyvsp[(3) - (3)].step));
@@ -1547,6 +1556,8 @@ yyreduce:
break;
case 10:
+
+/* Line 1455 of yacc.c */
#line 171 "../xml/XPathGrammar.y"
{
(yyval.locationPath)->appendStep((yyvsp[(2) - (3)].step));
@@ -1557,6 +1568,8 @@ yyreduce:
break;
case 11:
+
+/* Line 1455 of yacc.c */
#line 181 "../xml/XPathGrammar.y"
{
if ((yyvsp[(2) - (2)].predList)) {
@@ -1570,6 +1583,8 @@ yyreduce:
break;
case 12:
+
+/* Line 1455 of yacc.c */
#line 192 "../xml/XPathGrammar.y"
{
String localName;
@@ -1590,6 +1605,8 @@ yyreduce:
break;
case 13:
+
+/* Line 1455 of yacc.c */
#line 210 "../xml/XPathGrammar.y"
{
if ((yyvsp[(3) - (3)].predList)) {
@@ -1603,6 +1620,8 @@ yyreduce:
break;
case 14:
+
+/* Line 1455 of yacc.c */
#line 221 "../xml/XPathGrammar.y"
{
String localName;
@@ -1623,6 +1642,8 @@ yyreduce:
break;
case 17:
+
+/* Line 1455 of yacc.c */
#line 245 "../xml/XPathGrammar.y"
{
(yyval.axis) = Step::AttributeAxis;
@@ -1630,6 +1651,8 @@ yyreduce:
break;
case 18:
+
+/* Line 1455 of yacc.c */
#line 252 "../xml/XPathGrammar.y"
{
if (*(yyvsp[(1) - (3)].str) == "node")
@@ -1645,6 +1668,8 @@ yyreduce:
break;
case 19:
+
+/* Line 1455 of yacc.c */
#line 265 "../xml/XPathGrammar.y"
{
(yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest);
@@ -1654,6 +1679,8 @@ yyreduce:
break;
case 20:
+
+/* Line 1455 of yacc.c */
#line 272 "../xml/XPathGrammar.y"
{
(yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, (yyvsp[(3) - (4)].str)->stripWhiteSpace());
@@ -1664,6 +1691,8 @@ yyreduce:
break;
case 21:
+
+/* Line 1455 of yacc.c */
#line 282 "../xml/XPathGrammar.y"
{
(yyval.predList) = 0;
@@ -1671,6 +1700,8 @@ yyreduce:
break;
case 23:
+
+/* Line 1455 of yacc.c */
#line 291 "../xml/XPathGrammar.y"
{
(yyval.predList) = new Vector<Predicate*>;
@@ -1681,6 +1712,8 @@ yyreduce:
break;
case 24:
+
+/* Line 1455 of yacc.c */
#line 299 "../xml/XPathGrammar.y"
{
(yyval.predList)->append(new Predicate((yyvsp[(2) - (2)].expr)));
@@ -1689,6 +1722,8 @@ yyreduce:
break;
case 25:
+
+/* Line 1455 of yacc.c */
#line 307 "../xml/XPathGrammar.y"
{
(yyval.expr) = (yyvsp[(2) - (3)].expr);
@@ -1696,6 +1731,8 @@ yyreduce:
break;
case 26:
+
+/* Line 1455 of yacc.c */
#line 314 "../xml/XPathGrammar.y"
{
(yyval.step) = new Step(Step::DescendantOrSelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest));
@@ -1704,6 +1741,8 @@ yyreduce:
break;
case 27:
+
+/* Line 1455 of yacc.c */
#line 322 "../xml/XPathGrammar.y"
{
(yyval.step) = new Step(Step::SelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest));
@@ -1712,6 +1751,8 @@ yyreduce:
break;
case 28:
+
+/* Line 1455 of yacc.c */
#line 328 "../xml/XPathGrammar.y"
{
(yyval.step) = new Step(Step::ParentAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest));
@@ -1720,6 +1761,8 @@ yyreduce:
break;
case 29:
+
+/* Line 1455 of yacc.c */
#line 336 "../xml/XPathGrammar.y"
{
(yyval.expr) = new VariableReference(*(yyvsp[(1) - (1)].str));
@@ -1729,6 +1772,8 @@ yyreduce:
break;
case 30:
+
+/* Line 1455 of yacc.c */
#line 343 "../xml/XPathGrammar.y"
{
(yyval.expr) = (yyvsp[(2) - (3)].expr);
@@ -1736,6 +1781,8 @@ yyreduce:
break;
case 31:
+
+/* Line 1455 of yacc.c */
#line 348 "../xml/XPathGrammar.y"
{
(yyval.expr) = new StringExpression(*(yyvsp[(1) - (1)].str));
@@ -1745,6 +1792,8 @@ yyreduce:
break;
case 32:
+
+/* Line 1455 of yacc.c */
#line 355 "../xml/XPathGrammar.y"
{
(yyval.expr) = new Number((yyvsp[(1) - (1)].str)->toDouble());
@@ -1754,6 +1803,8 @@ yyreduce:
break;
case 34:
+
+/* Line 1455 of yacc.c */
#line 366 "../xml/XPathGrammar.y"
{
(yyval.expr) = createFunction(*(yyvsp[(1) - (3)].str));
@@ -1765,6 +1816,8 @@ yyreduce:
break;
case 35:
+
+/* Line 1455 of yacc.c */
#line 375 "../xml/XPathGrammar.y"
{
(yyval.expr) = createFunction(*(yyvsp[(1) - (4)].str), *(yyvsp[(3) - (4)].argList));
@@ -1777,6 +1830,8 @@ yyreduce:
break;
case 36:
+
+/* Line 1455 of yacc.c */
#line 387 "../xml/XPathGrammar.y"
{
(yyval.argList) = new Vector<Expression*>;
@@ -1787,6 +1842,8 @@ yyreduce:
break;
case 37:
+
+/* Line 1455 of yacc.c */
#line 395 "../xml/XPathGrammar.y"
{
(yyval.argList)->append((yyvsp[(3) - (3)].expr));
@@ -1795,6 +1852,8 @@ yyreduce:
break;
case 40:
+
+/* Line 1455 of yacc.c */
#line 409 "../xml/XPathGrammar.y"
{
(yyval.expr) = new Union;
@@ -1807,6 +1866,8 @@ yyreduce:
break;
case 41:
+
+/* Line 1455 of yacc.c */
#line 421 "../xml/XPathGrammar.y"
{
(yyval.expr) = (yyvsp[(1) - (1)].locationPath);
@@ -1814,6 +1875,8 @@ yyreduce:
break;
case 43:
+
+/* Line 1455 of yacc.c */
#line 428 "../xml/XPathGrammar.y"
{
(yyvsp[(3) - (3)].locationPath)->setAbsolute(true);
@@ -1825,6 +1888,8 @@ yyreduce:
break;
case 44:
+
+/* Line 1455 of yacc.c */
#line 437 "../xml/XPathGrammar.y"
{
(yyvsp[(3) - (3)].locationPath)->insertFirstStep((yyvsp[(2) - (3)].step));
@@ -1838,6 +1903,8 @@ yyreduce:
break;
case 46:
+
+/* Line 1455 of yacc.c */
#line 452 "../xml/XPathGrammar.y"
{
(yyval.expr) = new Filter((yyvsp[(1) - (2)].expr), *(yyvsp[(2) - (2)].predList));
@@ -1848,6 +1915,8 @@ yyreduce:
break;
case 48:
+
+/* Line 1455 of yacc.c */
#line 464 "../xml/XPathGrammar.y"
{
(yyval.expr) = new LogicalOp(LogicalOp::OP_Or, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
@@ -1858,6 +1927,8 @@ yyreduce:
break;
case 50:
+
+/* Line 1455 of yacc.c */
#line 476 "../xml/XPathGrammar.y"
{
(yyval.expr) = new LogicalOp(LogicalOp::OP_And, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
@@ -1868,6 +1939,8 @@ yyreduce:
break;
case 52:
+
+/* Line 1455 of yacc.c */
#line 488 "../xml/XPathGrammar.y"
{
(yyval.expr) = new EqTestOp((yyvsp[(2) - (3)].eqop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
@@ -1878,6 +1951,8 @@ yyreduce:
break;
case 54:
+
+/* Line 1455 of yacc.c */
#line 500 "../xml/XPathGrammar.y"
{
(yyval.expr) = new EqTestOp((yyvsp[(2) - (3)].eqop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
@@ -1888,6 +1963,8 @@ yyreduce:
break;
case 56:
+
+/* Line 1455 of yacc.c */
#line 512 "../xml/XPathGrammar.y"
{
(yyval.expr) = new NumericOp(NumericOp::OP_Add, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
@@ -1898,6 +1975,8 @@ yyreduce:
break;
case 57:
+
+/* Line 1455 of yacc.c */
#line 520 "../xml/XPathGrammar.y"
{
(yyval.expr) = new NumericOp(NumericOp::OP_Sub, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
@@ -1908,6 +1987,8 @@ yyreduce:
break;
case 59:
+
+/* Line 1455 of yacc.c */
#line 532 "../xml/XPathGrammar.y"
{
(yyval.expr) = new NumericOp((yyvsp[(2) - (3)].numop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
@@ -1918,6 +1999,8 @@ yyreduce:
break;
case 61:
+
+/* Line 1455 of yacc.c */
#line 544 "../xml/XPathGrammar.y"
{
(yyval.expr) = new Negative;
@@ -1928,8 +2011,9 @@ yyreduce:
break;
-/* Line 1267 of yacc.c. */
-#line 1933 "WebCore/tmp/../generated/XPathGrammar.tab.c"
+
+/* Line 1455 of yacc.c */
+#line 2017 "WebCore/tmp/../generated/XPathGrammar.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1940,7 +2024,6 @@ yyreduce:
*++yyvsp = yyval;
-
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -2005,7 +2088,7 @@ yyerrlab:
if (yyerrstatus == 3)
{
- /* If just tried and failed to reuse look-ahead token after an
+ /* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
@@ -2022,7 +2105,7 @@ yyerrlab:
}
}
- /* Else will try to reuse look-ahead token after shifting the error
+ /* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
@@ -2079,9 +2162,6 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
*++yyvsp = yylval;
@@ -2106,7 +2186,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -2117,7 +2197,7 @@ yyexhaustedlab:
#endif
yyreturn:
- if (yychar != YYEOF && yychar != YYEMPTY)
+ if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
/* Do not reclaim the symbols of the rule which action triggered
@@ -2143,6 +2223,8 @@ yyreturn:
}
+
+/* Line 1675 of yacc.c */
#line 552 "../xml/XPathGrammar.y"
diff --git a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h
index 9728266..5a974bb 100644
--- a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h
+++ b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -29,10 +28,11 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -59,33 +59,16 @@
XPATH_ERROR = 275
};
#endif
-/* Tokens. */
-#define MULOP 258
-#define RELOP 259
-#define EQOP 260
-#define MINUS 261
-#define PLUS 262
-#define AND 263
-#define OR 264
-#define AXISNAME 265
-#define NODETYPE 266
-#define PI 267
-#define FUNCTIONNAME 268
-#define LITERAL 269
-#define VARIABLEREFERENCE 270
-#define NUMBER 271
-#define DOTDOT 272
-#define SLASHSLASH 273
-#define NAMETEST 274
-#define XPATH_ERROR 275
-
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 56 "../xml/XPathGrammar.y"
{
+
+/* Line 1676 of yacc.c */
+#line 56 "../xml/XPathGrammar.y"
+
Step::Axis axis;
Step::NodeTest* nodeTest;
NumericOp::Opcode numop;
@@ -96,14 +79,17 @@ typedef union YYSTYPE
Vector<Expression*>* argList;
Step* step;
LocationPath* locationPath;
-}
-/* Line 1489 of yacc.c. */
-#line 102 "WebCore/tmp/../generated/XPathGrammar.tab.h"
- YYSTYPE;
+
+
+
+/* Line 1676 of yacc.c */
+#line 87 "WebCore/tmp/../generated/XPathGrammar.tab.h"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
+
diff --git a/src/3rdparty/webkit/WebCore/history/HistoryItem.cpp b/src/3rdparty/webkit/WebCore/history/HistoryItem.cpp
index 6156524..e199337 100644
--- a/src/3rdparty/webkit/WebCore/history/HistoryItem.cpp
+++ b/src/3rdparty/webkit/WebCore/history/HistoryItem.cpp
@@ -161,8 +161,8 @@ const String& HistoryItem::alternateTitle() const
Image* HistoryItem::icon() const
{
- Image* result = iconDatabase()->iconForPageURL(m_urlString, IntSize(16,16));
- return result ? result : iconDatabase()->defaultIcon(IntSize(16,16));
+ Image* result = iconDatabase()->iconForPageURL(m_urlString, IntSize(16, 16));
+ return result ? result : iconDatabase()->defaultIcon(IntSize(16, 16));
}
double HistoryItem::lastVisitedTime() const
@@ -287,14 +287,16 @@ void HistoryItem::collapseDailyVisitsToWeekly()
m_weeklyVisitCounts.shrink(maxWeeklyCounts);
}
-void HistoryItem::recordVisitAtTime(double time)
+void HistoryItem::recordVisitAtTime(double time, VisitCountBehavior visitCountBehavior)
{
padDailyCountsForNewVisit(time);
m_lastVisitedTime = time;
- m_visitCount++;
- m_dailyVisitCounts[0]++;
+ if (visitCountBehavior == IncreaseVisitCount) {
+ ++m_visitCount;
+ ++m_dailyVisitCounts[0];
+ }
collapseDailyVisitsToWeekly();
}
@@ -305,10 +307,10 @@ void HistoryItem::setLastVisitedTime(double time)
recordVisitAtTime(time);
}
-void HistoryItem::visited(const String& title, double time)
+void HistoryItem::visited(const String& title, double time, VisitCountBehavior visitCountBehavior)
{
m_title = title;
- recordVisitAtTime(time);
+ recordVisitAtTime(time, visitCountBehavior);
}
int HistoryItem::visitCount() const
@@ -329,10 +331,10 @@ void HistoryItem::setVisitCount(int count)
void HistoryItem::adoptVisitCounts(Vector<int>& dailyCounts, Vector<int>& weeklyCounts)
{
- m_dailyVisitCounts.clear();
- m_dailyVisitCounts.swap(dailyCounts);
- m_weeklyVisitCounts.clear();
- m_weeklyVisitCounts.swap(weeklyCounts);
+ m_dailyVisitCounts.clear();
+ m_dailyVisitCounts.swap(dailyCounts);
+ m_weeklyVisitCounts.clear();
+ m_weeklyVisitCounts.swap(weeklyCounts);
}
const IntPoint& HistoryItem::scrollPoint() const
diff --git a/src/3rdparty/webkit/WebCore/history/HistoryItem.h b/src/3rdparty/webkit/WebCore/history/HistoryItem.h
index ac7d124..c12122f 100644
--- a/src/3rdparty/webkit/WebCore/history/HistoryItem.h
+++ b/src/3rdparty/webkit/WebCore/history/HistoryItem.h
@@ -56,6 +56,11 @@ typedef Vector<RefPtr<HistoryItem> > HistoryItemVector;
extern void (*notifyHistoryItemChanged)();
+enum VisitCountBehavior {
+ IncreaseVisitCount,
+ DoNotIncreaseVisitCount
+};
+
class HistoryItem : public RefCounted<HistoryItem> {
friend class PageCache;
@@ -144,7 +149,7 @@ public:
// This should not be called directly for HistoryItems that are already included
// in GlobalHistory. The WebKit api for this is to use -[WebHistory setLastVisitedTimeInterval:forItem:] instead.
void setLastVisitedTime(double);
- void visited(const String& title, double time);
+ void visited(const String& title, double time, VisitCountBehavior);
void addRedirectURL(const String&);
Vector<String>* redirectURLs() const;
@@ -189,7 +194,7 @@ private:
void padDailyCountsForNewVisit(double time);
void collapseDailyVisitsToWeekly();
- void recordVisitAtTime(double);
+ void recordVisitAtTime(double, VisitCountBehavior = IncreaseVisitCount);
HistoryItem* findTargetItem();
diff --git a/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp
index 37f4799..7a255d8 100644
--- a/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp
+++ b/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp
@@ -58,10 +58,10 @@
#include "TextMetrics.h"
#include "HTMLVideoElement.h"
#include <stdio.h>
-
#include <wtf/ByteArray.h>
#include <wtf/MathExtras.h>
#include <wtf/OwnPtr.h>
+#include <wtf/UnusedParam.h>
using namespace std;
@@ -546,6 +546,8 @@ void CanvasRenderingContext2D::lineTo(float x, float y)
return;
if (!state().m_invertibleCTM)
return;
+ if (m_path.isEmpty())
+ m_path.moveTo(FloatPoint(x, y));
m_path.addLineTo(FloatPoint(x, y));
}
@@ -555,6 +557,8 @@ void CanvasRenderingContext2D::quadraticCurveTo(float cpx, float cpy, float x, f
return;
if (!state().m_invertibleCTM)
return;
+ if (m_path.isEmpty())
+ m_path.moveTo(FloatPoint(cpx, cpy));
m_path.addQuadCurveTo(FloatPoint(cpx, cpy), FloatPoint(x, y));
}
@@ -564,6 +568,8 @@ void CanvasRenderingContext2D::bezierCurveTo(float cp1x, float cp1y, float cp2x,
return;
if (!state().m_invertibleCTM)
return;
+ if (m_path.isEmpty())
+ m_path.moveTo(FloatPoint(cp1x, cp1y));
m_path.addBezierCurveTo(FloatPoint(cp1x, cp1y), FloatPoint(cp2x, cp2y), FloatPoint(x, y));
}
@@ -1103,7 +1109,7 @@ void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec
c->translate(destRect.x(), destRect.y());
c->scale(FloatSize(destRect.width()/sourceRect.width(), destRect.height()/sourceRect.height()));
c->translate(-sourceRect.x(), -sourceRect.y());
- video->paint(c, IntRect(IntPoint(), size(video)));
+ video->paintCurrentFrameInContext(c, IntRect(IntPoint(), size(video)));
c->restore();
}
#endif
@@ -1158,6 +1164,8 @@ void CanvasRenderingContext2D::prepareGradientForDashboard(CanvasGradient* gradi
if (Settings* settings = m_canvas->document()->settings())
if (settings->usesDashboardBackwardCompatibilityMode())
gradient->setDashboardCompatibilityMode();
+#else
+ UNUSED_PARAM(gradient);
#endif
}
diff --git a/src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp b/src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp
index 743ed4f..946cac7 100644
--- a/src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp
+++ b/src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp
@@ -174,7 +174,7 @@ void CanvasStyle::applyFillColor(GraphicsContext* context)
switch (m_type) {
case ColorString: {
Color c = Color(m_color);
- if (c.isValid()){
+ if (c.isValid()) {
context->setFillColor(c.rgb());
break;
}
@@ -185,7 +185,7 @@ void CanvasStyle::applyFillColor(GraphicsContext* context)
}
case ColorStringWithAlpha: {
Color c = Color(m_color);
- if (c.isValid()){
+ if (c.isValid()) {
context->setFillColor(colorWithOverrideAlpha(c.rgb(), m_alpha));
break;
}
diff --git a/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp b/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp
new file mode 100644
index 0000000..aa44d8c
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(DATAGRID)
+
+#include "DOMDataGridDataSource.h"
+
+namespace WebCore {
+
+DOMDataGridDataSource::DOMDataGridDataSource()
+{
+}
+
+DOMDataGridDataSource::~DOMDataGridDataSource()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h b/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h
new file mode 100644
index 0000000..2ce2ab8
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#ifndef DOMDataGridDataSource_h
+#define DOMDataGridDataSource_h
+
+#if ENABLE(DATAGRID)
+
+#include "DataGridDataSource.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class HTMLDataGridElement;
+
+class DOMDataGridDataSource : public DataGridDataSource {
+public:
+ static PassRefPtr<DOMDataGridDataSource> create()
+ {
+ return adoptRef(new DOMDataGridDataSource);
+ }
+
+ virtual ~DOMDataGridDataSource();
+
+ virtual bool isDOMDataGridDataSource() const { return true; }
+
+private:
+ DOMDataGridDataSource();
+};
+
+inline DOMDataGridDataSource* asDOMDataGridDataSource(DataGridDataSource* dataSource)
+{
+ ASSERT(dataSource->isDOMDataGridDataSource());
+ return static_cast<DOMDataGridDataSource*>(dataSource);
+}
+
+inline const DOMDataGridDataSource* asDOMDataGridDataSource(const DataGridDataSource* dataSource)
+{
+ ASSERT(dataSource->isDOMDataGridDataSource());
+ return static_cast<const DOMDataGridDataSource*>(dataSource);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(DATAGRID)
+#endif // DOMDataGridDataSource_h
diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp b/src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp
index 136c08e..7810c86 100644
--- a/src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp
+++ b/src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp
@@ -24,6 +24,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "DataGridColumn.h"
#include "DataGridColumnList.h"
@@ -39,4 +42,12 @@ void DataGridColumn::setPrimary(bool primary)
}
}
+void DataGridColumn::columnChanged()
+{
+ if (m_columns)
+ m_columns->setDataGridNeedsLayout();
+}
+
} // namespace WebCore
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumn.h b/src/3rdparty/webkit/WebCore/html/DataGridColumn.h
index 8e63cd6..3d480a9 100644
--- a/src/3rdparty/webkit/WebCore/html/DataGridColumn.h
+++ b/src/3rdparty/webkit/WebCore/html/DataGridColumn.h
@@ -26,7 +26,10 @@
#ifndef DataGridColumn_h
#define DataGridColumn_h
+#if ENABLE(DATAGRID)
+
#include "AtomicString.h"
+#include "RenderStyle.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -36,34 +39,49 @@ class DataGridColumnList;
class DataGridColumn : public RefCounted<DataGridColumn> {
public:
- static PassRefPtr<DataGridColumn> create(DataGridColumnList* columns, const String& columnID, const String& label, const String& type, bool primary, unsigned short sortable)
+ static PassRefPtr<DataGridColumn> create(const String& columnID, const String& label, const String& type, bool primary, unsigned short sortable)
{
- return new DataGridColumn(columns, columnID, label, type, primary, sortable);
+ return adoptRef(new DataGridColumn(columnID, label, type, primary, sortable));
}
const AtomicString& id() const { return m_id; }
- void setId(const AtomicString& id) { m_id = id; }
+ void setId(const AtomicString& id) { m_id = id; columnChanged(); }
const AtomicString& label() const { return m_label; }
- void setLabel(const AtomicString& label) { m_label = label; }
+ void setLabel(const AtomicString& label) { m_label = label; columnChanged(); }
const AtomicString& type() const { return m_type; }
- void setType(const AtomicString& type) { m_type = type; }
+ void setType(const AtomicString& type) { m_type = type; columnChanged(); }
unsigned short sortable() const { return m_sortable; }
- void setSortable(unsigned short sortable) { m_sortable = sortable; }
+ void setSortable(unsigned short sortable) { m_sortable = sortable; columnChanged(); }
unsigned short sortDirection() const { return m_sortDirection; }
- void setSortDirection(unsigned short sortDirection) { m_sortDirection = sortDirection; }
+ void setSortDirection(unsigned short sortDirection) { m_sortDirection = sortDirection; columnChanged(); }
bool primary() const { return m_primary; }
void setPrimary(bool);
- void detachFromColumnList() { m_columns = 0; }
+ void setColumnList(DataGridColumnList* list)
+ {
+ m_columns = list;
+ m_columnStyle = 0;
+ m_headerStyle = 0;
+ m_rect = IntRect();
+ }
+
+ RenderStyle* columnStyle() const { return m_columnStyle.get(); }
+ void setColumnStyle(PassRefPtr<RenderStyle> style) { m_columnStyle = style; }
+
+ RenderStyle* headerStyle() const { return m_headerStyle.get(); }
+ void setHeaderStyle(PassRefPtr<RenderStyle> style) { m_headerStyle = style; }
+
+ const IntRect& rect() const { return m_rect; }
+ void setRect(const IntRect& rect) { m_rect = rect; }
private:
- DataGridColumn(DataGridColumnList* columns, const String& columnID, const String& label, const String& type, bool primary, unsigned short sortable)
- : m_columns(columns)
+ DataGridColumn(const String& columnID, const String& label, const String& type, bool primary, unsigned short sortable)
+ : m_columns(0)
, m_id(columnID)
, m_label(label)
, m_type(type)
@@ -73,6 +91,8 @@ private:
{
}
+ void columnChanged();
+
DataGridColumnList* m_columns; // Not refcounted. The columns list will null out our reference when it goes away.
AtomicString m_id;
@@ -83,8 +103,15 @@ private:
unsigned short m_sortable;
unsigned short m_sortDirection;
+
+ RefPtr<RenderStyle> m_columnStyle; // The style used to render the column background behind the row cells.
+ RefPtr<RenderStyle> m_headerStyle; // The style used to render the column header above the row cells.
+
+ IntRect m_rect;
};
} // namespace WebCore
+#endif
+
#endif // DataGridColumn_h
diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumn.idl b/src/3rdparty/webkit/WebCore/html/DataGridColumn.idl
index 04418a1..f566325 100644
--- a/src/3rdparty/webkit/WebCore/html/DataGridColumn.idl
+++ b/src/3rdparty/webkit/WebCore/html/DataGridColumn.idl
@@ -26,7 +26,8 @@
module html {
interface [
- GenerateConstructor
+ GenerateConstructor,
+ Conditional=DATAGRID
] DataGridColumn {
attribute DOMString id; // The identifier for the column.
attribute DOMString label; // The text to display in the column.
diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp
index 48f7d60..9613402 100644
--- a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp
+++ b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp
@@ -24,13 +24,22 @@
*/
#include "config.h"
-#include "DataGridColumnList.h"
+
+#if ENABLE(DATAGRID)
#include "AtomicString.h"
+#include "DataGridColumnList.h"
+#include "HTMLDataGridElement.h"
#include "PlatformString.h"
+#include "RenderObject.h"
namespace WebCore {
+DataGridColumnList::DataGridColumnList(HTMLDataGridElement* dataGrid)
+ : m_dataGrid(dataGrid)
+{
+}
+
DataGridColumnList::~DataGridColumnList()
{
clear();
@@ -46,13 +55,26 @@ DataGridColumn* DataGridColumnList::itemWithName(const AtomicString& name) const
return 0;
}
+void DataGridColumnList::setDataGridNeedsLayout()
+{
+ // Mark the datagrid as needing layout.
+ if (dataGrid() && dataGrid()->renderer())
+ dataGrid()->renderer()->setNeedsLayout(true);
+}
+
DataGridColumn* DataGridColumnList::add(const String& id, const String& label, const String& type, bool primary, unsigned short sortable)
{
- RefPtr<DataGridColumn> column = DataGridColumn::create(this, id, label, type, primary, sortable);
- if (primary)
+ return add(DataGridColumn::create(id, label, type, primary, sortable).get());
+}
+
+DataGridColumn* DataGridColumnList::add(DataGridColumn* column)
+{
+ if (column->primary())
m_primaryColumn = column;
m_columns.append(column);
- return column.get();
+ column->setColumnList(this);
+ setDataGridNeedsLayout();
+ return column;
}
void DataGridColumnList::remove(DataGridColumn* col)
@@ -65,6 +87,8 @@ void DataGridColumnList::remove(DataGridColumn* col)
m_primaryColumn = 0;
if (col == m_sortColumn)
m_sortColumn = 0;
+ col->setColumnList(0);
+ setDataGridNeedsLayout();
}
void DataGridColumnList::move(DataGridColumn* col, unsigned long index)
@@ -73,16 +97,18 @@ void DataGridColumnList::move(DataGridColumn* col, unsigned long index)
if (colIndex == notFound)
return;
m_columns.insert(index, col);
+ setDataGridNeedsLayout();
}
void DataGridColumnList::clear()
{
unsigned length = m_columns.size();
for (unsigned i = 0; i < length; ++i)
- m_columns[i]->detachFromColumnList();
+ m_columns[i]->setColumnList(0);
m_columns.clear();
m_primaryColumn = 0;
m_sortColumn = 0;
+ setDataGridNeedsLayout();
}
void DataGridColumnList::primaryColumnChanged(DataGridColumn* col)
@@ -92,7 +118,9 @@ void DataGridColumnList::primaryColumnChanged(DataGridColumn* col)
else if (m_primaryColumn = col)
m_primaryColumn = 0;
- // FIXME: Invalidate the tree.
+ setDataGridNeedsLayout();
}
} // namespace WebCore
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.h b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.h
index d0caebe..ed72863 100644
--- a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.h
+++ b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.h
@@ -1,6 +1,8 @@
#ifndef DataGridColumnList_h
#define DataGridColumnList_h
+#if ENABLE(DATAGRID)
+
#include "DataGridColumn.h"
#include <wtf/PassRefPtr.h>
@@ -10,13 +12,14 @@
namespace WebCore {
class AtomicString;
+class HTMLDataGridElement;
class DataGridColumnList : public RefCounted<DataGridColumnList> {
friend class DataGridColumn;
public:
- static PassRefPtr<DataGridColumnList> create()
+ static PassRefPtr<DataGridColumnList> create(HTMLDataGridElement* grid)
{
- return new DataGridColumnList();
+ return adoptRef(new DataGridColumnList(grid));
}
~DataGridColumnList();
@@ -31,12 +34,22 @@ public:
DataGridColumn* sortColumn() const { return m_sortColumn.get(); }
DataGridColumn* add(const String& id, const String& label, const String& type, bool primary, unsigned short sortable);
+ DataGridColumn* add(DataGridColumn*);
void remove(DataGridColumn*);
void move(DataGridColumn*, unsigned long index);
void clear();
+ HTMLDataGridElement* dataGrid() const { return m_dataGrid; }
+ void clearDataGrid() { m_dataGrid = 0; }
+
+ void setDataGridNeedsLayout();
+
private:
- void primaryColumnChanged(DataGridColumn* col);
+ DataGridColumnList(HTMLDataGridElement*);
+
+ void primaryColumnChanged(DataGridColumn*);
+
+ HTMLDataGridElement* m_dataGrid; // Weak reference. Will be nulled out when our tree goes away.
Vector<RefPtr<DataGridColumn> > m_columns;
RefPtr<DataGridColumn> m_primaryColumn;
@@ -45,4 +58,6 @@ private:
} // namespace WebCore
+#endif
+
#endif // DataGridColumnList_h
diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl
index cab4339..1a59f43 100644
--- a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl
+++ b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl
@@ -28,7 +28,8 @@ module html {
interface [
GenerateConstructor,
HasIndexGetter,
- HasNameGetter
+ HasNameGetter,
+ Conditional=DATAGRID
] DataGridColumnList {
DataGridColumn item(in [IsIndex] unsigned long index);
readonly attribute unsigned long length;
diff --git a/src/3rdparty/webkit/WebCore/html/DataGridDataSource.h b/src/3rdparty/webkit/WebCore/html/DataGridDataSource.h
index 0c9a24d..2ab1f5b 100644
--- a/src/3rdparty/webkit/WebCore/html/DataGridDataSource.h
+++ b/src/3rdparty/webkit/WebCore/html/DataGridDataSource.h
@@ -26,6 +26,8 @@
#ifndef DataGridDataSource_h
#define DataGridDataSource_h
+#if ENABLE(DATAGRID)
+
#include <wtf/RefCounted.h>
namespace WebCore {
@@ -36,11 +38,12 @@ class DataGridDataSource : public RefCounted<DataGridDataSource> {
public:
virtual ~DataGridDataSource() { }
+ virtual bool isDOMDataGridDataSource() const { return false; }
virtual bool isJSDataGridDataSource() const { return false; }
-
- virtual void initialize(HTMLDataGridElement*) = 0;
};
} // namespace WebCore
+#endif
+
#endif // DataGridDataSource_h
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp
index 354f9f0..09362cd 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp
@@ -249,7 +249,7 @@ void HTMLAnchorElement::setActive(bool down, bool pause)
if (Settings* settings = document()->settings())
editableLinkBehavior = settings->editableLinkBehavior();
- switch(editableLinkBehavior) {
+ switch (editableLinkBehavior) {
default:
case EditableLinkDefaultBehavior:
case EditableLinkAlwaysLive:
@@ -497,7 +497,7 @@ bool HTMLAnchorElement::isLiveLink() const
if (Settings* settings = document()->settings())
editableLinkBehavior = settings->editableLinkBehavior();
- switch(editableLinkBehavior) {
+ switch (editableLinkBehavior) {
default:
case EditableLinkDefaultBehavior:
case EditableLinkAlwaysLive:
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h b/src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h
index 26d8126..e271965 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h
@@ -30,8 +30,7 @@ namespace WebCore {
class HTMLFormElement;
class HTMLImageLoader;
-class HTMLAppletElement : public HTMLPlugInElement
-{
+class HTMLAppletElement : public HTMLPlugInElement {
public:
HTMLAppletElement(const QualifiedName&, Document*);
~HTMLAppletElement();
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in b/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in
index a29d6d2..0fc45d7 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in
+++ b/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in
@@ -17,6 +17,7 @@ aria-checked
aria-describedby
aria-disabled
aria-hidden
+aria-label
aria-labeledby
aria-labelledby
aria-level
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h b/src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h
index de390cf..1dbe44f 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h
@@ -32,8 +32,7 @@
namespace WebCore {
-class HTMLAudioElement : public HTMLMediaElement
-{
+class HTMLAudioElement : public HTMLMediaElement {
public:
HTMLAudioElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBRElement.h b/src/3rdparty/webkit/WebCore/html/HTMLBRElement.h
index 982a646..5600463 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLBRElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLBRElement.h
@@ -28,8 +28,7 @@ namespace WebCore {
class String;
-class HTMLBRElement : public HTMLElement
-{
+class HTMLBRElement : public HTMLElement {
public:
HTMLBRElement(const QualifiedName&, Document*);
~HTMLBRElement();
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp
index a278908..84e359c 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp
@@ -30,6 +30,7 @@
#include "HTMLNames.h"
#include "KURL.h"
#include "MappedAttribute.h"
+#include "XSSAuditor.h"
namespace WebCore {
@@ -48,6 +49,7 @@ HTMLBaseElement::~HTMLBaseElement()
void HTMLBaseElement::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name() == hrefAttr) {
+ m_hrefAttrValue = attr->value();
m_href = parseURL(attr->value());
process();
} else if (attr->name() == targetAttr) {
@@ -78,7 +80,7 @@ void HTMLBaseElement::process()
if (!inDocument())
return;
- if (!m_href.isEmpty())
+ if (!m_href.isEmpty() && (!document()->frame() || document()->frame()->script()->xssAuditor()->canSetBaseElementURL(m_hrefAttrValue)))
document()->setBaseElementURL(KURL(document()->url(), m_href));
if (!m_target.isEmpty())
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h b/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h
index f068851..bb980e9 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h
@@ -26,8 +26,7 @@
namespace WebCore {
-class HTMLBaseElement : public HTMLElement
-{
+class HTMLBaseElement : public HTMLElement {
public:
HTMLBaseElement(const QualifiedName&, Document*);
~HTMLBaseElement();
@@ -48,6 +47,7 @@ public:
void setTarget(const String&);
protected:
+ String m_hrefAttrValue;
String m_href;
String m_target;
};
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h b/src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h
index 0c9a9fd..c15a36e 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h
@@ -26,8 +26,7 @@
namespace WebCore {
-class HTMLBaseFontElement : public HTMLElement
-{
+class HTMLBaseFontElement : public HTMLElement {
public:
HTMLBaseFontElement(const QualifiedName&, Document* doc);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl
index 028e92b..30ad6f2 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl
+++ b/src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl
@@ -26,6 +26,9 @@ module html {
ImplementationUUID=1be13b5f-40df-4550-b70e-8c805e546cad
] HTMLButtonElement : HTMLElement {
readonly attribute HTMLFormElement form;
+#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
+ readonly attribute ValidityState validity;
+#endif
attribute [ConvertNullToNullString] DOMString accessKey;
attribute boolean disabled;
attribute boolean autofocus;
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDListElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDListElement.h
index 8925e6b..49c944b 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDListElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDListElement.h
@@ -26,8 +26,7 @@
namespace WebCore {
-class HTMLDListElement : public HTMLElement
-{
+class HTMLDListElement : public HTMLElement {
public:
HTMLDListElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp
index d06ad82..bad8929 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp
@@ -24,6 +24,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "HTMLDataGridCellElement.h"
#include "HTMLNames.h"
@@ -89,3 +92,5 @@ void HTMLDataGridCellElement::setProgress(float progress)
}
} // namespace WebCore
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h
index 9de6e40..270835c 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h
@@ -26,6 +26,8 @@
#ifndef HTMLDataGridCellElement_h
#define HTMLDataGridCellElement_h
+#if ENABLE(DATAGRID)
+
#include "HTMLElement.h"
namespace WebCore {
@@ -55,4 +57,6 @@ public:
} // namespace WebCore
+#endif
+
#endif // HTMLDataGridCellElement_h
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl
index 4d15f6f..c7c51bc 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl
@@ -26,7 +26,8 @@
module html {
interface [
- GenerateConstructor
+ GenerateConstructor,
+ Conditional=DATAGRID
] HTMLDataGridCellElement : HTMLElement {
attribute DOMString label; // The text to display in the column, assuming the type supports text.
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp
index b209447..8398545 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp
@@ -24,9 +24,14 @@
*/
#include "config.h"
-#include "HTMLDataGridColElement.h"
+#if ENABLE(DATAGRID)
+
+#include "DataGridColumn.h"
+#include "HTMLDataGridElement.h"
+#include "HTMLDataGridColElement.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "Text.h"
namespace WebCore {
@@ -35,9 +40,48 @@ using namespace HTMLNames;
HTMLDataGridColElement::HTMLDataGridColElement(const QualifiedName& name, Document* doc)
: HTMLElement(name, doc)
+ , m_dataGrid(0)
+{
+}
+
+HTMLDataGridElement* HTMLDataGridColElement::findDataGridAncestor() const
+{
+ if (parent() && parent()->hasTagName(datagridTag))
+ return static_cast<HTMLDataGridElement*>(parent());
+ return 0;
+}
+
+void HTMLDataGridColElement::ensureColumn()
{
+ if (m_column)
+ return;
+ m_column = DataGridColumn::create(getAttribute(idAttr), label(), type(), primary(), sortable());
}
+void HTMLDataGridColElement::insertedIntoTree(bool deep)
+{
+ HTMLElement::insertedIntoTree(deep);
+ if (dataGrid()) // We're connected to a datagrid already.
+ return;
+ m_dataGrid = findDataGridAncestor();
+ if (dataGrid() && dataGrid()->dataSource()->isDOMDataGridDataSource()) {
+ ensureColumn();
+ m_dataGrid->columns()->add(column()); // FIXME: Deal with ordering issues (complicated, since columns can be made outside the DOM).
+ }
+}
+
+void HTMLDataGridColElement::removedFromTree(bool deep)
+{
+ HTMLElement::removedFromTree(deep);
+ if (dataGrid() && dataGrid()->dataSource()->isDOMDataGridDataSource()) {
+ HTMLDataGridElement* grid = findDataGridAncestor();
+ if (!grid && column()) {
+ dataGrid()->columns()->remove(column());
+ m_dataGrid = 0;
+ }
+ }
+}
+
String HTMLDataGridColElement::label() const
{
return getAttribute(labelAttr);
@@ -60,12 +104,14 @@ void HTMLDataGridColElement::setType(const String& type)
unsigned short HTMLDataGridColElement::sortable() const
{
- return hasAttribute(sortableAttr);
+ if (!hasAttribute(sortableAttr))
+ return 2;
+ return getAttribute(sortableAttr).toInt(0);
}
void HTMLDataGridColElement::setSortable(unsigned short sortable)
{
- setAttribute(sortableAttr, sortable ? "" : 0);
+ setAttribute(sortableAttr, String::number(sortable));
}
unsigned short HTMLDataGridColElement::sortDirection() const
@@ -99,4 +145,27 @@ void HTMLDataGridColElement::setPrimary(bool primary)
setAttribute(primaryAttr, primary ? "" : 0);
}
+void HTMLDataGridColElement::parseMappedAttribute(MappedAttribute* attr)
+{
+ HTMLElement::parseMappedAttribute(attr);
+
+ if (!column())
+ return;
+
+ if (attr->name() == labelAttr)
+ column()->setLabel(label());
+ else if (attr->name() == typeAttr)
+ column()->setType(type());
+ else if (attr->name() == primaryAttr)
+ column()->setPrimary(primary());
+ else if (attr->name() == sortableAttr)
+ column()->setSortable(sortable());
+ else if (attr->name() == sortdirectionAttr)
+ column()->setSortDirection(sortDirection());
+ else if (attr->name() == idAttr)
+ column()->setId(getAttribute(idAttr));
+}
+
} // namespace WebCore
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h
index 87133cc..d91ec51 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h
@@ -26,17 +26,25 @@
#ifndef HTMLDataGridColElement_h
#define HTMLDataGridColElement_h
+#if ENABLE(DATAGRID)
+
+#include "DataGridColumn.h"
#include "HTMLElement.h"
namespace WebCore {
+class HTMLDataGridElement;
+
class HTMLDataGridColElement : public HTMLElement {
public:
HTMLDataGridColElement(const QualifiedName&, Document*);
virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
virtual int tagPriority() const { return 0; }
-
+ virtual void insertedIntoTree(bool /*deep*/);
+ virtual void removedFromTree(bool /*deep*/);
+ virtual void parseMappedAttribute(MappedAttribute*);
+
String label() const;
void setLabel(const String&);
@@ -51,8 +59,21 @@ public:
bool primary() const;
void setPrimary(bool);
+
+ DataGridColumn* column() const { return m_column.get(); }
+ void setColumn(PassRefPtr<DataGridColumn> col) { m_column = col; }
+
+private:
+ HTMLDataGridElement* dataGrid() const { return m_dataGrid; }
+ HTMLDataGridElement* findDataGridAncestor() const;
+ void ensureColumn();
+
+ RefPtr<DataGridColumn> m_column;
+ HTMLDataGridElement* m_dataGrid; // Not refcounted. We will null out our reference if we get removed from the grid.
};
} // namespace WebCore
+#endif
+
#endif // HTMLDataGridColElement_h
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl
index c72751c..5861039 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl
@@ -26,7 +26,8 @@
module html {
interface [
- GenerateConstructor
+ GenerateConstructor,
+ Conditional=DATAGRID
] HTMLDataGridColElement : HTMLElement {
attribute DOMString label; // The text to display in the column.
attribute DOMString type; // The type of data displayed in this column.
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp
index 2d9f852..bb1f4a6 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp
@@ -24,8 +24,12 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "HTMLDataGridElement.h"
+#include "DOMDataGridDataSource.h"
#include "HTMLNames.h"
#include "RenderDataGrid.h"
#include "Text.h"
@@ -36,13 +40,14 @@ using namespace HTMLNames;
HTMLDataGridElement::HTMLDataGridElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document)
- , m_initializationTimer(this, &HTMLDataGridElement::initializationTimerFired)
+ , m_columns(DataGridColumnList::create(this))
{
- m_columns = DataGridColumnList::create();
+ setDataSource(DOMDataGridDataSource::create());
}
HTMLDataGridElement::~HTMLDataGridElement()
{
+ m_columns->clearDataGrid();
}
bool HTMLDataGridElement::checkDTD(const Node* newChild)
@@ -87,18 +92,27 @@ void HTMLDataGridElement::setMultiple(bool multiple)
setAttribute(multipleAttr, multiple ? "" : 0);
}
-void HTMLDataGridElement::setDataSource(PassRefPtr<DataGridDataSource> dataSource)
+void HTMLDataGridElement::setDataSource(PassRefPtr<DataGridDataSource> ds)
{
- if (m_initializationTimer.isActive())
- m_initializationTimer.stop();
-
+ if (m_dataSource == ds)
+ return;
+
+ RefPtr<DataGridDataSource> dataSource = ds;
+ if (!dataSource)
+ dataSource = DOMDataGridDataSource::create();
m_dataSource = dataSource;
- m_initializationTimer.startOneShot(0);
+
+ // Always clear our columns when a data source changes.
+ // The register callback will rebuild the columns.
+ m_columns->clear();
}
-void HTMLDataGridElement::initializationTimerFired(Timer<HTMLDataGridElement>*)
+DataGridDataSource* HTMLDataGridElement::dataSource() const
{
- m_dataSource->initialize(this);
+ ASSERT(m_dataSource);
+ return m_dataSource.get();
}
} // namespace WebCore
+
+#endif // ENABLE(DATAGRID)
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h
index 646c97e..94672c1 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h
@@ -26,6 +26,8 @@
#ifndef HTMLDataGridElement_h
#define HTMLDataGridElement_h
+#if ENABLE(DATAGRID)
+
#include "DataGridColumnList.h"
#include "DataGridDataSource.h"
#include "HTMLElement.h"
@@ -53,19 +55,17 @@ public:
void setMultiple(bool);
void setDataSource(PassRefPtr<DataGridDataSource>);
- DataGridDataSource* dataSource() const { return m_dataSource.get(); }
+ DataGridDataSource* dataSource() const;
DataGridColumnList* columns() const { return m_columns.get(); }
private:
- void initializationTimerFired(Timer<HTMLDataGridElement>*);
-
- Timer<HTMLDataGridElement> m_initializationTimer;
RefPtr<DataGridDataSource> m_dataSource;
-
RefPtr<DataGridColumnList> m_columns;
};
} // namespace WebCore
+#endif
+
#endif // HTMLDataGridElement_h
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl
index b4b0897..c9e6d9d 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl
@@ -26,7 +26,8 @@
module html {
interface [
- GenerateConstructor
+ GenerateConstructor,
+ Conditional=DATAGRID
] HTMLDataGridElement : HTMLElement {
attribute [Custom] DataGridDataSource dataSource;
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp
index e671806..c958cbd 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp
@@ -24,6 +24,9 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "HTMLDataGridRowElement.h"
#include "HTMLNames.h"
@@ -76,3 +79,5 @@ void HTMLDataGridRowElement::setExpanded(bool expanded)
}
} // namespace WebCore
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h
index d911db2..eac33e6 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h
@@ -26,6 +26,8 @@
#ifndef HTMLDataGridRowElement_h
#define HTMLDataGridRowElement_h
+#if ENABLE(DATAGRID)
+
#include "HTMLElement.h"
namespace WebCore {
@@ -49,4 +51,6 @@ public:
} // namespace WebCore
+#endif
+
#endif // HTMLDataGridRowElement_h
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl
index 4aeb4d5..f6954af 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl
@@ -26,7 +26,8 @@
module html {
interface [
- GenerateConstructor
+ GenerateConstructor,
+ Conditional=DATAGRID
] HTMLDataGridRowElement : HTMLElement {
attribute boolean selected; // Whether or not the row is currently selected.
attribute boolean focused; // Whether or not the row is the current object in the tree for keyboard navigation (or as the principal item of a multiple selection).
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h
index 6be4c22..eead141 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h
@@ -26,8 +26,7 @@
namespace WebCore {
-class HTMLDirectoryElement : public HTMLElement
-{
+class HTMLDirectoryElement : public HTMLElement {
public:
HTMLDirectoryElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLElement.cpp
index 5655df8..8acc6bd 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLElement.cpp
@@ -79,7 +79,7 @@ HTMLTagStatus HTMLElement::endTagRequirement() const
{
if (hasLocalName(wbrTag))
return TagStatusForbidden;
- if (hasLocalName(dtTag) || hasLocalName(ddTag))
+ if (hasLocalName(dtTag) || hasLocalName(ddTag) || hasLocalName(rpTag) || hasLocalName(rtTag))
return TagStatusOptional;
// Same values as <span>. This way custom tag name elements will behave like inline spans.
@@ -90,9 +90,9 @@ int HTMLElement::tagPriority() const
{
if (hasLocalName(wbrTag))
return 0;
- if (hasLocalName(addressTag) || hasLocalName(ddTag) || hasLocalName(dtTag) || hasLocalName(noscriptTag))
+ if (hasLocalName(addressTag) || hasLocalName(ddTag) || hasLocalName(dtTag) || hasLocalName(noscriptTag) || hasLocalName(rpTag) || hasLocalName(rtTag))
return 3;
- if (hasLocalName(centerTag) || hasLocalName(nobrTag))
+ if (hasLocalName(centerTag) || hasLocalName(nobrTag) || hasLocalName(rubyTag))
return 5;
if (hasLocalName(noembedTag) || hasLocalName(noframesTag))
return 10;
@@ -875,6 +875,9 @@ static HashSet<AtomicStringImpl*>* inlineTagList()
tagList.add(audioTag.localName().impl());
tagList.add(videoTag.localName().impl());
#endif
+ tagList.add(rpTag.localName().impl());
+ tagList.add(rtTag.localName().impl());
+ tagList.add(rubyTag.localName().impl());
}
return &tagList;
}
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp
index eb8d4ed..eb83173 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp
@@ -34,7 +34,7 @@ namespace WebCore {
using namespace HTMLNames;
HTMLFieldSetElement::HTMLFieldSetElement(const QualifiedName& tagName, Document *doc, HTMLFormElement *f)
- : HTMLFormControlElement(tagName, doc, f)
+ : HTMLFormControlElement(tagName, doc, f)
{
ASSERT(hasTagName(fieldsetTag));
}
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl
index c48f8d6..371f3fd 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl
+++ b/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl
@@ -25,6 +25,9 @@ module html {
ImplementationUUID=93573758-96db-415d-9bdc-ee7238604094
] HTMLFieldSetElement : HTMLElement {
readonly attribute HTMLFormElement form;
+#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
+ readonly attribute ValidityState validity;
+#endif
readonly attribute boolean willValidate;
};
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp
index b985e75..87938ac 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "HTMLFormControlElement.h"
+#include "ChromeClient.h"
#include "Document.h"
#include "EventHandler.h"
#include "EventNames.h"
@@ -35,8 +36,10 @@
#include "HTMLParser.h"
#include "HTMLTokenizer.h"
#include "MappedAttribute.h"
+#include "Page.h"
#include "RenderBox.h"
#include "RenderTheme.h"
+#include "ValidityState.h"
namespace WebCore {
@@ -61,6 +64,14 @@ HTMLFormControlElement::~HTMLFormControlElement()
m_form->removeFormElement(this);
}
+ValidityState* HTMLFormControlElement::validity()
+{
+ if (!m_validityState)
+ m_validityState = ValidityState::create(this);
+
+ return m_validityState.get();
+}
+
void HTMLFormControlElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == nameAttr) {
@@ -242,6 +253,22 @@ bool HTMLFormControlElement::willValidate() const
return form() && name().length() && !disabled() && !isReadOnlyFormControl();
}
+void HTMLFormControlElement::dispatchFocusEvent()
+{
+ if (document()->frame() && document()->frame()->page())
+ document()->frame()->page()->chrome()->client()->formDidFocus(this);
+
+ HTMLElement::dispatchFocusEvent();
+}
+
+void HTMLFormControlElement::dispatchBlurEvent()
+{
+ if (document()->frame() && document()->frame()->page())
+ document()->frame()->page()->chrome()->client()->formDidBlur(this);
+
+ HTMLElement::dispatchBlurEvent();
+}
+
bool HTMLFormControlElement::supportsFocus() const
{
return isFocusable() || (!disabled() && !document()->haveStylesheetsLoaded());
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h
index 0a7bbd1..a03eb1a 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h
@@ -30,6 +30,7 @@ namespace WebCore {
class FormDataList;
class HTMLFormElement;
+class ValidityState;
class HTMLFormControlElement : public HTMLElement {
public:
@@ -40,6 +41,7 @@ public:
virtual int tagPriority() const { return 1; }
HTMLFormElement* form() const { return m_form; }
+ virtual ValidityState* validity();
virtual bool isTextFormControl() const { return false; }
virtual bool isEnabledFormControl() const { return !disabled(); }
@@ -100,6 +102,9 @@ public:
void formDestroyed() { m_form = 0; }
+ virtual void dispatchFocusEvent();
+ virtual void dispatchBlurEvent();
+
protected:
void removeFromForm();
@@ -107,6 +112,7 @@ private:
virtual HTMLFormElement* virtualForm() const;
HTMLFormElement* m_form;
+ RefPtr<ValidityState> m_validityState;
bool m_disabled;
bool m_readOnly;
bool m_valueMatchesRenderer;
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp
index 64cac37..f2012e1 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp
@@ -328,7 +328,7 @@ static void transferMailtoPostFormDataToURL(RefPtr<FormData>& data, KURL& url, c
url.setQuery(query);
}
-void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockHistory, bool lockBackForwardList)
+void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockHistory)
{
FrameView* view = document()->view();
Frame* frame = document()->frame();
@@ -389,14 +389,14 @@ void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockH
m_url = url.string();
}
- frame->loader()->submitForm("POST", m_url, data.release(), m_target, m_formDataBuilder.encodingType(), String(), lockHistory, lockBackForwardList, event, formState.release());
+ frame->loader()->submitForm("POST", m_url, data.release(), m_target, m_formDataBuilder.encodingType(), String(), lockHistory, event, formState.release());
} else {
Vector<char> boundary = m_formDataBuilder.generateUniqueBoundaryString();
- frame->loader()->submitForm("POST", m_url, createFormData(boundary.data()), m_target, m_formDataBuilder.encodingType(), boundary.data(), lockHistory, lockBackForwardList, event, formState.release());
+ frame->loader()->submitForm("POST", m_url, createFormData(boundary.data()), m_target, m_formDataBuilder.encodingType(), boundary.data(), lockHistory, event, formState.release());
}
} else {
m_formDataBuilder.setIsMultiPartForm(false);
- frame->loader()->submitForm("GET", m_url, createFormData(CString()), m_target, String(), String(), lockHistory, lockBackForwardList, event, formState.release());
+ frame->loader()->submitForm("GET", m_url, createFormData(CString()), m_target, String(), String(), lockHistory, event, formState.release());
}
if (needButtonActivation && firstSuccessfulSubmitButton)
@@ -415,7 +415,7 @@ void HTMLFormElement::reset()
// ### DOM2 labels this event as not cancelable, however
// common browsers( sick! ) allow it be cancelled.
- if ( !dispatchEvent(eventNames().resetEvent,true, true) ) {
+ if ( !dispatchEvent(eventNames().resetEvent, true, true) ) {
m_inreset = false;
return;
}
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h
index d08e16c..6b7812a 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h
@@ -78,7 +78,7 @@ public:
void removeImgElement(HTMLImageElement*);
bool prepareSubmit(Event*);
- void submit(Event* = 0, bool activateSubmitButton = false, bool lockHistory = false, bool lockBackForwardList = false);
+ void submit(Event* = 0, bool activateSubmitButton = false, bool lockHistory = false);
void reset();
// Used to indicate a malformed state to keep from applying the bottom margin of the form.
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp
index d6cc58e..6858f56 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp
@@ -71,7 +71,7 @@ void HTMLHRElement::parseMappedAttribute(MappedAttribute *attr)
} else if (attr->name() == widthAttr) {
bool ok;
int v = attr->value().toInt(&ok);
- if(ok && !v)
+ if (ok && !v)
addCSSLength(attr, CSSPropertyWidth, "1");
else
addCSSLength(attr, CSSPropertyWidth, attr->value());
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h b/src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h
index 2f01ef2..21d8a2f 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h
@@ -30,8 +30,7 @@
namespace WebCore {
-class HTMLHeadElement : public HTMLElement
-{
+class HTMLHeadElement : public HTMLElement {
public:
HTMLHeadElement(const QualifiedName&, Document*);
~HTMLHeadElement();
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h b/src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h
index 91a0045..86603b5 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h
@@ -30,8 +30,7 @@
namespace WebCore {
-class HTMLHtmlElement : public HTMLElement
-{
+class HTMLHtmlElement : public HTMLElement {
public:
HTMLHtmlElement(const QualifiedName&, Document*);
~HTMLHtmlElement();
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h b/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h
index 25cbb55..ae2ce38 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h
@@ -67,7 +67,7 @@ public:
CachedImage* cachedImage() const { return m_imageLoader.image(); }
void setCachedImage(CachedImage* i) { m_imageLoader.setImage(i); };
- void setLoadManually (bool loadManually) { m_imageLoader.setLoadManually(loadManually); }
+ void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); }
String name() const;
void setName(const String&);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp
index ae7e768..8b2aa0e 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp
@@ -1590,9 +1590,9 @@ void HTMLInputElement::onSearch()
VisibleSelection HTMLInputElement::selection() const
{
- if (!renderer() || !isTextField() || m_data.cachedSelectionStart() == -1 || m_data.cachedSelectionEnd() == -1)
+ if (!renderer() || !isTextField() || m_data.cachedSelectionStart() == -1 || m_data.cachedSelectionEnd() == -1)
return VisibleSelection();
- return toRenderTextControl(renderer())->selection(m_data.cachedSelectionStart(), m_data.cachedSelectionEnd());
+ return toRenderTextControl(renderer())->selection(m_data.cachedSelectionStart(), m_data.cachedSelectionEnd());
}
void HTMLInputElement::documentDidBecomeActive()
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl
index 5536733..7cd91b0 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl
+++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl
@@ -28,6 +28,9 @@ module html {
attribute [ConvertNullToNullString] DOMString defaultValue;
attribute boolean defaultChecked;
readonly attribute HTMLFormElement form;
+#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
+ readonly attribute ValidityState validity;
+#endif
attribute [ConvertNullToNullString] DOMString accept;
attribute [ConvertNullToNullString] DOMString accessKey;
attribute [ConvertNullToNullString] DOMString align;
@@ -69,7 +72,7 @@ module html {
readonly attribute URL absoluteImageURL;
#endif
-#if !defined(LANGUAGE_COM)
+#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
readonly attribute FileList files;
#endif
};
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h b/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h
index 82042cf..a1462b8 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h
@@ -27,8 +27,7 @@
namespace WebCore {
-class HTMLIsIndexElement : public HTMLInputElement
-{
+class HTMLIsIndexElement : public HTMLInputElement {
public:
HTMLIsIndexElement(const QualifiedName&, Document *doc, HTMLFormElement *f = 0);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp
index cb8f36c..986544a 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp
@@ -181,9 +181,11 @@ void HTMLLinkElement::process()
if (m_isDNSPrefetch && m_url.isValid() && !m_url.isEmpty())
prefetchDNS(m_url.host());
+ bool acceptIfTypeContainsTextCSS = document()->page() && document()->page()->settings() && document()->page()->settings()->treatsAnyTextCSSLinkAsStylesheet();
+
// Stylesheet
// This was buggy and would incorrectly match <link rel="alternate">, which has a different specified meaning. -dwh
- if (m_disabledState != 2 && m_isStyleSheet && document()->frame() && m_url.isValid()) {
+ if (m_disabledState != 2 && (m_isStyleSheet || acceptIfTypeContainsTextCSS && type.contains("text/css")) && document()->frame() && m_url.isValid()) {
// also, don't load style sheets for standalone documents
// Add ourselves as a pending sheet, but only if we aren't an alternate
// stylesheet. Alternate stylesheets don't hold up render tree construction.
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp
index d62eaab..0cb6501 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp
@@ -34,7 +34,7 @@ namespace WebCore {
using namespace HTMLNames;
- // WinIE uses 60ms as the minimum delay by default.
+// WinIE uses 60ms as the minimum delay by default.
const int defaultMinimumDelay = 60;
HTMLMarqueeElement::HTMLMarqueeElement(const QualifiedName& tagName, Document* doc)
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp
index 3d48b82..716a592 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp
@@ -391,7 +391,7 @@ String HTMLMediaElement::canPlayType(const String& mimeType) const
switch (support)
{
case MediaPlayer::IsNotSupported:
- canPlay = "no";
+ canPlay = "";
break;
case MediaPlayer::MayBeSupported:
canPlay = "maybe";
@@ -690,7 +690,6 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
}
if (state == MediaPlayer::Idle) {
- ASSERT(static_cast<ReadyState>(m_player->readyState()) < HAVE_ENOUGH_DATA);
if (m_networkState > NETWORK_IDLE) {
stopPeriodicTimers();
scheduleProgressEvent(eventNames().suspendEvent);
@@ -752,7 +751,6 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
if (m_seeking && m_readyState < HAVE_CURRENT_DATA) {
// 4.8.10.10, step 9
scheduleEvent(eventNames().seekingEvent);
- m_seeking = false;
}
if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) {
@@ -839,6 +837,18 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*)
}
}
+void HTMLMediaElement::rewind(float timeDelta)
+{
+ ExceptionCode e;
+ setCurrentTime(max(currentTime() - timeDelta, minTimeSeekable()), e);
+}
+
+void HTMLMediaElement::returnToRealtime()
+{
+ ExceptionCode e;
+ setCurrentTime(maxTimeSeekable(), e);
+}
+
void HTMLMediaElement::seek(float time, ExceptionCode& ec)
{
// 4.8.10.10. Seeking
@@ -891,6 +901,11 @@ HTMLMediaElement::ReadyState HTMLMediaElement::readyState() const
return m_readyState;
}
+MediaPlayer::MovieLoadType HTMLMediaElement::movieLoadType() const
+{
+ return m_player ? m_player->movieLoadType() : MediaPlayer::Unknown;
+}
+
bool HTMLMediaElement::seeking() const
{
return m_seeking;
@@ -1408,9 +1423,9 @@ PassRefPtr<TimeRanges> HTMLMediaElement::played() const
PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const
{
// FIXME real ranges support
- if (!m_player || !m_player->maxTimeSeekable())
+ if (!maxTimeSeekable())
return TimeRanges::create();
- return TimeRanges::create(0, m_player->maxTimeSeekable());
+ return TimeRanges::create(minTimeSeekable(), maxTimeSeekable());
}
bool HTMLMediaElement::potentiallyPlaying() const
@@ -1444,6 +1459,16 @@ bool HTMLMediaElement::pausedForUserInteraction() const
return false;
}
+float HTMLMediaElement::minTimeSeekable() const
+{
+ return 0;
+}
+
+float HTMLMediaElement::maxTimeSeekable() const
+{
+ return m_player ? m_player->maxTimeSeekable() : 0;
+}
+
void HTMLMediaElement::updateVolume()
{
if (!m_player)
@@ -1603,7 +1628,7 @@ bool HTMLMediaElement::processingUserGesture() const
FrameLoader* loader = frame ? frame->loader() : 0;
// return 'true' for safety if we don't know the answer
- return loader ? loader->userGestureHint() : true;
+ return loader ? loader->isProcessingUserGesture() : true;
}
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h
index 8d238d5..486574b 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h
@@ -66,6 +66,9 @@ public:
virtual bool isVideo() const { return false; }
virtual bool hasVideo() const { return false; }
+ void rewind(float timeDelta);
+ void returnToRealtime();
+
virtual bool supportsFullscreen() const { return false; }
void scheduleLoad();
@@ -75,6 +78,8 @@ public:
// Pauses playback without changing any states or generating events
void setPausedInternal(bool);
+ MediaPlayer::MovieLoadType movieLoadType() const;
+
bool inActiveDocument() const { return m_inActiveDocument; }
// DOM API
@@ -221,10 +226,12 @@ private:
bool stoppedDueToErrors() const;
bool pausedForUserInteraction() const;
+ float minTimeSeekable() const;
+ float maxTimeSeekable() const;
+
// Restrictions to change default behaviors. This is a effectively a compile time choice at the moment
// because there are no accessor methods.
- enum BehaviorRestrictions
- {
+ enum BehaviorRestrictions {
NoRestrictions = 0,
RequireUserGestureForLoadRestriction = 1 << 0,
RequireUserGestureForRateChangeRestriction = 1 << 1,
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h
index 0f4488d..68b5b8f 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h
@@ -26,8 +26,7 @@
namespace WebCore {
-class HTMLMenuElement : public HTMLElement
-{
+class HTMLMenuElement : public HTMLElement {
public:
HTMLMenuElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h
index f535293..d86df2e 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h
@@ -28,8 +28,7 @@
namespace WebCore {
-class HTMLMetaElement : public HTMLElement
-{
+class HTMLMetaElement : public HTMLElement {
public:
HTMLMetaElement(const QualifiedName&, Document*);
~HTMLMetaElement();
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLModElement.h b/src/3rdparty/webkit/WebCore/html/HTMLModElement.h
index 399053c..83697f9 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLModElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLModElement.h
@@ -30,8 +30,7 @@ namespace WebCore {
class String;
-class HTMLModElement : public HTMLElement
-{
+class HTMLModElement : public HTMLElement {
public:
HTMLModElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLOListElement.h b/src/3rdparty/webkit/WebCore/html/HTMLOListElement.h
index e459269..b7a13ee 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLOListElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLOListElement.h
@@ -26,8 +26,7 @@
namespace WebCore {
-class HTMLOListElement : public HTMLElement
-{
+class HTMLOListElement : public HTMLElement {
public:
HTMLOListElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp
index 1d446f7..8cb95d0 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp
@@ -152,10 +152,10 @@ void HTMLOptionElement::setSelectedState(bool selected)
void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
- HTMLSelectElement* select = ownerSelectElement();
- if (select)
- select->childrenChanged(changedByParser);
- HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+ HTMLSelectElement* select = ownerSelectElement();
+ if (select)
+ select->childrenChanged(changedByParser);
+ HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLParamElement.h b/src/3rdparty/webkit/WebCore/html/HTMLParamElement.h
index 4da2ed3..1867ccf 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLParamElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLParamElement.h
@@ -27,8 +27,7 @@
namespace WebCore {
-class HTMLParamElement : public HTMLElement
-{
+class HTMLParamElement : public HTMLElement {
friend class HTMLAppletElement;
public:
HTMLParamElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp
index ea6bbe2..722f4e2 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp
@@ -793,6 +793,20 @@ bool HTMLParser::dtCreateErrorCheck(Token* t, RefPtr<Node>& result)
return true;
}
+bool HTMLParser::rpCreateErrorCheck(Token*, RefPtr<Node>&)
+{
+ popBlock(rpTag);
+ popBlock(rtTag);
+ return true;
+}
+
+bool HTMLParser::rtCreateErrorCheck(Token*, RefPtr<Node>&)
+{
+ popBlock(rpTag);
+ popBlock(rtTag);
+ return true;
+}
+
bool HTMLParser::nestedCreateErrorCheck(Token* t, RefPtr<Node>&)
{
popBlock(t->tagName);
@@ -917,6 +931,8 @@ PassRefPtr<Node> HTMLParser::getNode(Token* t)
gFunctionMap.set(pTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
gFunctionMap.set(plaintextTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
gFunctionMap.set(preTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+ gFunctionMap.set(rpTag.localName().impl(), &HTMLParser::rpCreateErrorCheck);
+ gFunctionMap.set(rtTag.localName().impl(), &HTMLParser::rtCreateErrorCheck);
gFunctionMap.set(sTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
gFunctionMap.set(selectTag.localName().impl(), &HTMLParser::selectCreateErrorCheck);
gFunctionMap.set(smallTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
@@ -1656,7 +1672,7 @@ void HTMLParser::reportErrorToConsole(HTMLParserErrorCode errorCode, const Atomi
message.replace("%tag1", tag1);
message.replace("%tag2", tag2);
- frame->domWindow()->console()->addMessage(HTMLMessageSource,
+ frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType,
isWarning(errorCode) ? WarningMessageLevel : ErrorMessageLevel,
message, lineNumber, m_document->url().string());
}
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLParser.h b/src/3rdparty/webkit/WebCore/html/HTMLParser.h
index 19f553e..bd12049 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLParser.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLParser.h
@@ -102,6 +102,8 @@ private:
bool noscriptCreateErrorCheck(Token*, RefPtr<Node>&);
bool pCloserCreateErrorCheck(Token*, RefPtr<Node>&);
bool pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool rpCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool rtCreateErrorCheck(Token*, RefPtr<Node>&);
bool selectCreateErrorCheck(Token*, RefPtr<Node>&);
bool tableCellCreateErrorCheck(Token*, RefPtr<Node>&);
bool tableSectionCreateErrorCheck(Token*, RefPtr<Node>&);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h b/src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h
index 623c28f..addbfb4 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h
@@ -28,8 +28,7 @@ namespace WebCore {
class String;
-class HTMLQuoteElement : public HTMLElement
-{
+class HTMLQuoteElement : public HTMLElement {
public:
HTMLQuoteElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp
index c47bb70..2409f31 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp
@@ -106,13 +106,7 @@ int HTMLSelectElement::activeSelectionEndListIndex() const
unsigned HTMLSelectElement::length() const
{
- unsigned len = 0;
- const Vector<Element*>& items = listItems();
- for (unsigned i = 0; i < items.size(); ++i) {
- if (items[i]->hasLocalName(optionTag))
- ++len;
- }
- return len;
+ return SelectElement::optionCount(m_data, this);
}
void HTMLSelectElement::add(HTMLElement *element, HTMLElement *before, ExceptionCode& ec)
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl
index fb08bb1..26f2653 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl
+++ b/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl
@@ -41,6 +41,9 @@ module html {
#endif
readonly attribute HTMLFormElement form;
+#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
+ readonly attribute ValidityState validity;
+#endif
readonly attribute boolean willValidate;
// Modified in DOM Level 2:
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h b/src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h
index fe3adb0..03b4c66 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h
@@ -28,8 +28,7 @@
namespace WebCore {
-class HTMLStyleElement : public HTMLElement, public StyleElement
-{
+class HTMLStyleElement : public HTMLElement, public StyleElement {
public:
HTMLStyleElement(const QualifiedName&, Document*, bool createdByParser);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h
index 38bc434..3c2aaa1 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h
@@ -30,8 +30,7 @@
namespace WebCore {
-class HTMLTableCaptionElement : public HTMLTablePartElement
-{
+class HTMLTableCaptionElement : public HTMLTablePartElement {
public:
HTMLTableCaptionElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h
index 7e26e94..fc74cae 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h
@@ -32,8 +32,7 @@
namespace WebCore {
-class HTMLTableCellElement : public HTMLTablePartElement
-{
+class HTMLTableCellElement : public HTMLTablePartElement {
public:
HTMLTableCellElement(const QualifiedName&, Document*);
~HTMLTableCellElement();
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h
index 0bed401..83a26aa 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h
@@ -34,8 +34,7 @@ namespace WebCore {
class HTMLTableElement;
-class HTMLTableColElement : public HTMLTablePartElement
-{
+class HTMLTableColElement : public HTMLTablePartElement {
public:
HTMLTableColElement(const QualifiedName& tagName, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp
index e91a96a..15fa97e 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp
@@ -99,7 +99,7 @@ PassRefPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index, ExceptionC
return r.release();
}
-void HTMLTableSectionElement::deleteRow( int index, ExceptionCode& ec)
+void HTMLTableSectionElement::deleteRow(int index, ExceptionCode& ec)
{
RefPtr<HTMLCollection> children = rows();
int numRows = children ? (int)children->length() : 0;
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTagNames.in b/src/3rdparty/webkit/WebCore/html/HTMLTagNames.in
index e6bbfc9..c066e3c 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLTagNames.in
+++ b/src/3rdparty/webkit/WebCore/html/HTMLTagNames.in
@@ -25,10 +25,10 @@ cite interfaceName=HTMLElement
code interfaceName=HTMLElement
col interfaceName=HTMLTableColElement
colgroup interfaceName=HTMLTableColElement
-datagrid interfaceName=HTMLDataGridElement
-dcell interfaceName=HTMLDataGridCellElement
-dcol interfaceName=HTMLDataGridColElement
-drow interfaceName=HTMLDataGridRowElement
+datagrid interfaceName=HTMLDataGridElement,conditional=DATAGRID
+dcell interfaceName=HTMLDataGridCellElement,conditional=DATAGRID
+dcol interfaceName=HTMLDataGridColElement,conditional=DATAGRID
+drow interfaceName=HTMLDataGridRowElement,conditional=DATAGRID
dd interfaceName=HTMLElement
del interfaceName=HTMLModElement
dfn interfaceName=HTMLElement
@@ -89,6 +89,9 @@ param
plaintext interfaceName=HTMLElement
pre
q interfaceName=HTMLQuoteElement
+rp interfaceName=HTMLElement
+rt interfaceName=HTMLElement
+ruby interfaceName=HTMLElement
s interfaceName=HTMLElement
samp interfaceName=HTMLElement
script constructorNeedsCreatedByParser
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl
index c4f144b..f6ac05a 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl
+++ b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl
@@ -27,6 +27,9 @@ module html {
] HTMLTextAreaElement : HTMLElement {
attribute [ConvertNullToNullString] DOMString defaultValue;
readonly attribute HTMLFormElement form;
+#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
+ readonly attribute ValidityState validity;
+#endif
attribute [ConvertNullToNullString] DOMString accessKey;
attribute long cols;
attribute boolean disabled;
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h
index 2cbb667..5335d8d 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h
@@ -28,8 +28,7 @@
namespace WebCore {
-class HTMLTitleElement : public HTMLElement
-{
+class HTMLTitleElement : public HTMLElement {
public:
HTMLTitleElement(const QualifiedName&, Document*);
~HTMLTitleElement();
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp
index 6966351..5788eb6 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp
@@ -321,7 +321,7 @@ HTMLTokenizer::State HTMLTokenizer::parseNonHTMLText(SegmentedString& src, State
{
ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState());
ASSERT(!state.hasTagState());
- ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1 );
+ ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1);
if (state.inScript() && !m_currentScriptTagStartLineNumber)
m_currentScriptTagStartLineNumber = m_lineNumber;
@@ -730,9 +730,9 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de
EntityUnicodeValue = 0;
}
- while(!src.isEmpty()) {
+ while (!src.isEmpty()) {
UChar cc = *src;
- switch(state.entityState()) {
+ switch (state.entityState()) {
case NoEntity:
ASSERT(state.entityState() != NoEntity);
return state;
@@ -781,7 +781,7 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de
case Decimal:
{
int ll = min(src.length(), 9-cBufferPos);
- while(ll--) {
+ while (ll--) {
cc = *src;
if (!(cc >= '0' && cc <= '9')) {
@@ -800,7 +800,7 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de
case EntityName:
{
int ll = min(src.length(), 9-cBufferPos);
- while(ll--) {
+ while (ll--) {
cc = *src;
if (!((cc >= 'a' && cc <= 'z') || (cc >= '0' && cc <= '9') || (cc >= 'A' && cc <= 'Z'))) {
@@ -814,7 +814,7 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de
if (cBufferPos == 9)
state.setEntityState(SearchSemicolon);
if (state.entityState() == SearchSemicolon) {
- if(cBufferPos > 1) {
+ if (cBufferPos > 1) {
// Since the maximum length of entity name is 9,
// so a single char array which is allocated on
// the stack, its length is 10, should be OK.
@@ -837,11 +837,11 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de
else
e = 0;
- if(e)
+ if (e)
EntityUnicodeValue = e->code;
// be IE compatible
- if(parsingTag && EntityUnicodeValue > 255 && *src != ';')
+ if (parsingTag && EntityUnicodeValue > 255 && *src != ';')
EntityUnicodeValue = 0;
}
}
@@ -1122,7 +1122,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
while (!src.isEmpty()) {
checkBuffer();
- switch(state.tagState()) {
+ switch (state.tagState()) {
case NoTag:
{
m_cBufferPos = cBufferPos;
@@ -1237,7 +1237,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
break;
}
case SearchAttribute:
- while(!src.isEmpty()) {
+ while (!src.isEmpty()) {
UChar curchar = *src;
// In this mode just ignore any quotes we encounter and treat them like spaces.
if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"') {
@@ -1256,6 +1256,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
break;
case AttributeName:
{
+ m_rawAttributeBeforeValue.clear();
int ll = min(src.length(), CBUFLEN - cBufferPos);
while (ll--) {
UChar curchar = *src;
@@ -1278,6 +1279,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
else
m_cBuffer[cBufferPos++] = curchar;
+ m_rawAttributeBeforeValue.append(curchar);
src.advance(m_lineNumber);
}
if (cBufferPos == CBUFLEN) {
@@ -1309,6 +1311,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
state.setTagState(SearchValue);
if (inViewSourceMode())
m_currentToken.addViewSourceChar(curchar);
+ m_rawAttributeBeforeValue.append(curchar);
src.advancePastNonNewline();
} else {
m_currentToken.addAttribute(m_attrName, emptyAtom, inViewSourceMode());
@@ -1318,11 +1321,12 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
}
break;
}
- if (inViewSourceMode())
- m_currentToken.addViewSourceChar(curchar);
-
+
lastIsSlash = curchar == '/';
+ if (inViewSourceMode())
+ m_currentToken.addViewSourceChar(curchar);
+ m_rawAttributeBeforeValue.append(curchar);
src.advance(m_lineNumber);
}
break;
@@ -1335,6 +1339,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
state.setTagState(QuotedValue);
if (inViewSourceMode())
m_currentToken.addViewSourceChar(curchar);
+ m_rawAttributeBeforeValue.append(curchar);
src.advancePastNonNewline();
} else
state.setTagState(Value);
@@ -1343,6 +1348,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
}
if (inViewSourceMode())
m_currentToken.addViewSourceChar(curchar);
+ m_rawAttributeBeforeValue.append(curchar);
src.advance(m_lineNumber);
}
break;
@@ -1391,6 +1397,13 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
m_currentToken.addViewSourceChar('x');
} else if (inViewSourceMode())
m_currentToken.addViewSourceChar('v');
+
+ if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_parser->skipMode() && m_attrName == srcAttr) {
+ String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size());
+ if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(context, attributeValue))
+ attributeValue = blankURL().string();
+ }
+
m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode());
m_dest = m_buffer;
state.setTagState(SearchAttribute);
@@ -1407,7 +1420,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
}
break;
case Value:
- while(!src.isEmpty()) {
+ while (!src.isEmpty()) {
checkBuffer();
UChar curchar = *src;
if (curchar <= '>' && !src.escaped()) {
@@ -1421,6 +1434,13 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
// '/' does not delimit in IE!
if (isASCIISpace(curchar) || curchar == '>') {
AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1);
+
+ if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_parser->skipMode() && m_attrName == srcAttr) {
+ String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size());
+ if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(context, attributeValue))
+ attributeValue = blankURL().string();
+ }
+
m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode());
if (inViewSourceMode())
m_currentToken.addViewSourceChar('v');
@@ -1473,11 +1493,8 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
m_scriptTagCharsetAttrValue = String();
if (m_currentToken.attrs && !m_fragment) {
if (m_doc->frame() && m_doc->frame()->script()->isEnabled()) {
- if ((a = m_currentToken.attrs->getAttributeItem(srcAttr))) {
+ if ((a = m_currentToken.attrs->getAttributeItem(srcAttr)))
m_scriptTagSrcAttrValue = m_doc->completeURL(parseURL(a->value())).string();
- if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(a->value()))
- m_scriptTagSrcAttrValue = String();
- }
}
}
}
@@ -1684,7 +1701,7 @@ void HTMLTokenizer::write(const SegmentedString& str, bool appendData)
else if (state.startTag()) {
state.setStartTag(false);
- switch(cc) {
+ switch (cc) {
case '/':
break;
case '!': {
@@ -1712,7 +1729,7 @@ void HTMLTokenizer::write(const SegmentedString& str, bool appendData)
}
// else fall through
default: {
- if( ((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) {
+ if ( ((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) {
// Start of a Start-Tag
} else {
// Invalid tag
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h
index 6612af8..d731b2d 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h
@@ -213,6 +213,10 @@ private:
Token m_currentToken;
+ // This buffer holds the raw characters we've seen between the beginning of
+ // the attribute name and the first character of the attribute value.
+ Vector<UChar, 32> m_rawAttributeBeforeValue;
+
// Tokenizer flags
//////////////////
// are we in quotes within a html tag
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLUListElement.h b/src/3rdparty/webkit/WebCore/html/HTMLUListElement.h
index 3a565a4..1eda5f3 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLUListElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLUListElement.h
@@ -26,8 +26,7 @@
namespace WebCore {
-class HTMLUListElement : public HTMLElement
-{
+class HTMLUListElement : public HTMLElement {
public:
HTMLUListElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp
index a6210a2..ecd74e7 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp
@@ -186,7 +186,7 @@ void HTMLVideoElement::updatePosterImage()
#endif
}
-void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& r)
+void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& destRect)
{
// FIXME: We should also be able to paint the poster image.
@@ -195,7 +195,19 @@ void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& r)
return;
player->setVisible(true); // Make player visible or it won't draw.
- player->paint(context, r);
+ player->paint(context, destRect);
+}
+
+void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect)
+{
+ // FIXME: We should also be able to paint the poster image.
+
+ MediaPlayer* player = HTMLMediaElement::player();
+ if (!player)
+ return;
+
+ player->setVisible(true); // Make player visible or it won't draw.
+ player->paintCurrentFrameInContext(context, destRect);
}
}
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h b/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h
index 830e72e..dc9714a 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h
@@ -35,8 +35,7 @@ namespace WebCore {
class HTMLImageLoader;
-class HTMLVideoElement : public HTMLMediaElement
-{
+class HTMLVideoElement : public HTMLMediaElement {
public:
HTMLVideoElement(const QualifiedName&, Document*);
@@ -67,8 +66,9 @@ public:
void updatePosterImage();
- // Used by canvas to gain raw pixel access
void paint(GraphicsContext*, const IntRect&);
+ // Used by canvas to gain raw pixel access
+ void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);
private:
OwnPtr<HTMLImageLoader> m_imageLoader;
diff --git a/src/3rdparty/webkit/WebCore/html/ImageData.idl b/src/3rdparty/webkit/WebCore/html/ImageData.idl
index 7f37b52..8025de1 100644
--- a/src/3rdparty/webkit/WebCore/html/ImageData.idl
+++ b/src/3rdparty/webkit/WebCore/html/ImageData.idl
@@ -29,8 +29,8 @@
module html {
interface [
+ CustomToJS,
GenerateConstructor,
- GenerateToJS
] ImageData {
readonly attribute long width;
readonly attribute long height;
diff --git a/src/3rdparty/webkit/WebCore/html/TimeRanges.h b/src/3rdparty/webkit/WebCore/html/TimeRanges.h
index 37820dc..6be8c4e 100644
--- a/src/3rdparty/webkit/WebCore/html/TimeRanges.h
+++ b/src/3rdparty/webkit/WebCore/html/TimeRanges.h
@@ -64,7 +64,8 @@ private:
// We consider all the Ranges to be semi-bounded as follow: [start, end[
struct Range {
Range() { }
- Range(float start, float end) {
+ Range(float start, float end)
+ {
m_start = start;
m_end = end;
}
diff --git a/src/3rdparty/webkit/WebCore/html/ValidityState.cpp b/src/3rdparty/webkit/WebCore/html/ValidityState.cpp
new file mode 100644
index 0000000..8ff629c
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/html/ValidityState.cpp
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "ValidityState.h"
+#include "HTMLFormControlElement.h"
+
+namespace WebCore {
+
+ValidityState::ValidityState(HTMLFormControlElement* parent)
+ : m_control(parent)
+{
+ ASSERT(parent);
+}
+
+bool ValidityState::valid()
+{
+ bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow() ||
+ tooLong() || patternMismatch() || valueMissing() || customError();
+
+ return !someError;
+}
+
+} // namespace
diff --git a/src/3rdparty/webkit/WebCore/html/ValidityState.h b/src/3rdparty/webkit/WebCore/html/ValidityState.h
new file mode 100644
index 0000000..a011f7a
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/html/ValidityState.h
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ValidityState_h
+#define ValidityState_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class HTMLFormControlElement;
+
+ class ValidityState : public RefCounted<ValidityState> {
+ public:
+ static PassRefPtr<ValidityState> create(HTMLFormControlElement* owner)
+ {
+ return adoptRef(new ValidityState(owner));
+ }
+
+ HTMLFormControlElement* control() const { return m_control; }
+
+ bool valueMissing() { return false; }
+ bool typeMismatch() { return false; }
+ bool patternMismatch() { return false; }
+ bool tooLong() { return false; }
+ bool rangeUnderflow() { return false; }
+ bool rangeOverflow() { return false; }
+ bool stepMismatch() { return false; }
+ bool customError() { return false; }
+ bool valid();
+
+ private:
+ ValidityState(HTMLFormControlElement*);
+ HTMLFormControlElement* m_control;
+ };
+
+} // namespace WebCore
+
+#endif // ValidityState_h
diff --git a/src/3rdparty/webkit/WebCore/html/ValidityState.idl b/src/3rdparty/webkit/WebCore/html/ValidityState.idl
new file mode 100644
index 0000000..b926852
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/html/ValidityState.idl
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+module html {
+
+ interface ValidityState {
+ readonly attribute boolean valueMissing;
+ readonly attribute boolean typeMismatch;
+ readonly attribute boolean patternMismatch;
+ readonly attribute boolean tooLong;
+ readonly attribute boolean rangeUnderflow;
+ readonly attribute boolean rangeOverflow;
+ readonly attribute boolean stepMismatch;
+ readonly attribute boolean customError;
+ readonly attribute boolean valid;
+ };
+}
diff --git a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp
index b3c0218..609197e 100644
--- a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp
+++ b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp
@@ -38,8 +38,9 @@
namespace WebCore {
-ConsoleMessage::ConsoleMessage(MessageSource s, MessageLevel l, const String& m, unsigned li, const String& u, unsigned g)
+ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, unsigned li, const String& u, unsigned g)
: m_source(s)
+ , m_type(t)
, m_level(l)
, m_message(m)
, m_line(li)
@@ -49,8 +50,9 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageLevel l, const String& m,
{
}
-ConsoleMessage::ConsoleMessage(MessageSource s, MessageLevel l, ScriptCallStack* callStack, unsigned g, bool storeTrace)
+ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, ScriptCallStack* callStack, unsigned g, bool storeTrace)
: m_source(s)
+ , m_type(t)
, m_level(l)
, m_wrappedArguments(callStack->at(0).argumentCount())
, m_frames(storeTrace ? callStack->size() : 0)
@@ -77,6 +79,7 @@ void ConsoleMessage::addToConsole(InspectorFrontend* frontend)
{
InspectorJSONObject jsonObj = frontend->newInspectorJSONObject();
jsonObj.set("source", static_cast<int>(m_source));
+ jsonObj.set("type", static_cast<int>(m_type));
jsonObj.set("level", static_cast<int>(m_level));
jsonObj.set("line", static_cast<int>(m_line));
jsonObj.set("url", m_url);
@@ -109,6 +112,7 @@ bool ConsoleMessage::isEqual(ScriptState* state, ConsoleMessage* msg) const
}
return msg->m_source == m_source
+ && msg->m_type == m_type
&& msg->m_level == m_level
&& msg->m_message == m_message
&& msg->m_line == m_line
diff --git a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h
index 15e6e7e..5b2f7d5 100644
--- a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h
+++ b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h
@@ -44,8 +44,8 @@ namespace WebCore {
class ConsoleMessage {
public:
- ConsoleMessage(MessageSource, MessageLevel, const String& m, unsigned li, const String& u, unsigned g);
- ConsoleMessage(MessageSource, MessageLevel, ScriptCallStack*, unsigned g, bool storeTrace = false);
+ ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, unsigned li, const String& u, unsigned g);
+ ConsoleMessage(MessageSource, MessageType, MessageLevel, ScriptCallStack*, unsigned g, bool storeTrace = false);
void addToConsole(InspectorFrontend* frontend);
void incrementCount() { ++m_repeatCount; };
@@ -53,6 +53,7 @@ namespace WebCore {
private:
MessageSource m_source;
+ MessageType m_type;
MessageLevel m_level;
String m_message;
Vector<ScriptValue> m_wrappedArguments;
diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp
index 7e0cf31..4b2dd59 100644
--- a/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp
+++ b/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp
@@ -395,20 +395,20 @@ void InspectorController::setWindowVisible(bool visible, bool attached)
m_showAfterVisible = CurrentPanel;
}
-void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, ScriptCallStack* callStack)
+void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, ScriptCallStack* callStack)
{
if (!enabled())
return;
- addConsoleMessage(callStack->state(), new ConsoleMessage(source, level, callStack, m_groupLevel, level == TraceMessageLevel));
+ addConsoleMessage(callStack->state(), new ConsoleMessage(source, type, level, callStack, m_groupLevel, type == TraceMessageType));
}
-void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
+void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
{
if (!enabled())
return;
- addConsoleMessage(0, new ConsoleMessage(source, level, message, lineNumber, sourceID, m_groupLevel));
+ addConsoleMessage(0, new ConsoleMessage(source, type, level, message, lineNumber, sourceID, m_groupLevel));
}
void InspectorController::addConsoleMessage(ScriptState* scriptState, ConsoleMessage* consoleMessage)
@@ -440,7 +440,7 @@ void InspectorController::startGroup(MessageSource source, ScriptCallStack* call
{
++m_groupLevel;
- addConsoleMessage(callStack->state(), new ConsoleMessage(source, StartGroupMessageLevel, callStack, m_groupLevel));
+ addConsoleMessage(callStack->state(), new ConsoleMessage(source, StartGroupMessageType, LogMessageLevel, callStack, m_groupLevel));
}
void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL)
@@ -450,7 +450,7 @@ void InspectorController::endGroup(MessageSource source, unsigned lineNumber, co
--m_groupLevel;
- addConsoleMessage(0, new ConsoleMessage(source, EndGroupMessageLevel, String(), lineNumber, sourceURL, m_groupLevel));
+ addConsoleMessage(0, new ConsoleMessage(source, EndGroupMessageType, LogMessageLevel, String(), lineNumber, sourceURL, m_groupLevel));
}
void InspectorController::attachWindow()
@@ -987,7 +987,8 @@ void InspectorController::scriptImported(unsigned long identifier, const String&
resource->updateScriptObject(m_frontend.get());
}
-void InspectorController::enableResourceTracking(bool always) {
+void InspectorController::enableResourceTracking(bool always)
+{
if (!enabled())
return;
@@ -1005,7 +1006,8 @@ void InspectorController::enableResourceTracking(bool always) {
m_inspectedPage->mainFrame()->loader()->reload();
}
-void InspectorController::disableResourceTracking(bool always) {
+void InspectorController::disableResourceTracking(bool always)
+{
if (!enabled())
return;
@@ -1098,7 +1100,7 @@ void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr<Profile>
message += "/";
message += UString::from(profile->uid());
message += "\" finished.";
- addMessageToConsole(JSMessageSource, LogMessageLevel, message, lineNumber, sourceURL);
+ addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
}
void InspectorController::addStartProfilingMessageToConsole(const UString& title, unsigned lineNumber, const UString& sourceURL)
@@ -1106,7 +1108,7 @@ void InspectorController::addStartProfilingMessageToConsole(const UString& title
UString message = "Profile \"webkit-profile://";
message += encodeWithURLEscapeSequences(title);
message += "/0\" started.";
- addMessageToConsole(JSMessageSource, LogMessageLevel, message, lineNumber, sourceURL);
+ addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
}
void InspectorController::addScriptProfile(Profile* profile)
@@ -1506,7 +1508,7 @@ void InspectorController::count(const String& title, unsigned lineNumber, const
m_counts.add(identifier, count);
String message = String::format("%s: %d", title.utf8().data(), count);
- addMessageToConsole(JSMessageSource, LogMessageLevel, message, lineNumber, sourceID);
+ addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceID);
}
void InspectorController::startTiming(const String& title)
diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorController.h b/src/3rdparty/webkit/WebCore/inspector/InspectorController.h
index 8ba8669..4c90bc5 100644
--- a/src/3rdparty/webkit/WebCore/inspector/InspectorController.h
+++ b/src/3rdparty/webkit/WebCore/inspector/InspectorController.h
@@ -173,8 +173,8 @@ public:
void addResourceSourceToFrame(long identifier, Node* frame);
bool addSourceToFrame(const String& mimeType, const String& source, Node*);
- void addMessageToConsole(MessageSource, MessageLevel, ScriptCallStack*);
- void addMessageToConsole(MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
+ void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*);
+ void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
void clearConsoleMessages();
void attachWindow();
diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp
index 255f1d8..c1abd31 100644
--- a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp
+++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp
@@ -61,7 +61,8 @@ InspectorFrontend::~InspectorFrontend()
m_webInspector = ScriptObject();
}
-InspectorJSONObject InspectorFrontend::newInspectorJSONObject() {
+InspectorJSONObject InspectorFrontend::newInspectorJSONObject()
+{
return InspectorJSONObject::createNew(m_scriptState);
}
diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp
index 6e8fce9..1ce0def 100644
--- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp
+++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp
@@ -62,6 +62,14 @@ const JSC::ScopeChainNode* JavaScriptCallFrame::scopeChain() const
return m_debuggerCallFrame.scopeChain();
}
+JSC::JSGlobalObject* JavaScriptCallFrame::dynamicGlobalObject() const
+{
+ ASSERT(m_isValid);
+ if (!m_isValid)
+ return 0;
+ return m_debuggerCallFrame.dynamicGlobalObject();
+}
+
String JavaScriptCallFrame::functionName() const
{
ASSERT(m_isValid);
diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h
index 9f193d8..e86b0eb 100644
--- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h
+++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h
@@ -61,6 +61,7 @@ namespace WebCore {
String functionName() const;
JSC::DebuggerCallFrame::Type type() const;
const JSC::ScopeChainNode* scopeChain() const;
+ JSC::JSGlobalObject* dynamicGlobalObject() const;
JSC::JSObject* thisObject() const;
JSC::JSValue evaluate(const JSC::UString& script, JSC::JSValue& exception) const;
diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.cpp b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.cpp
index bb6358c..84bc2f6 100644
--- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.cpp
+++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.cpp
@@ -275,6 +275,19 @@ static Page* toPage(JSGlobalObject* globalObject)
return frame ? frame->page() : 0;
}
+void JavaScriptDebugServer::detach(JSGlobalObject* globalObject)
+{
+ // If we're detaching from the currently executing global object, manually tear down our
+ // stack, since we won't get further debugger callbacks to do so. Also, resume execution,
+ // since there's no point in staying paused once a window closes.
+ if (m_currentCallFrame && m_currentCallFrame->dynamicGlobalObject() == globalObject) {
+ m_currentCallFrame = 0;
+ m_pauseOnCallFrame = 0;
+ continueProgram();
+ }
+ Debugger::detach(globalObject);
+}
+
void JavaScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& source, int errorLine, const UString& errorMessage)
{
if (m_callingListeners)
@@ -387,12 +400,12 @@ void JavaScriptDebugServer::setJavaScriptPaused(FrameView* view, bool paused)
if (!view)
return;
- const HashSet<Widget*>* children = view->children();
+ const HashSet<RefPtr<Widget> >* children = view->children();
ASSERT(children);
- HashSet<Widget*>::const_iterator end = children->end();
- for (HashSet<Widget*>::const_iterator it = children->begin(); it != end; ++it) {
- Widget* widget = *it;
+ HashSet<RefPtr<Widget> >::const_iterator end = children->end();
+ for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(); it != end; ++it) {
+ Widget* widget = (*it).get();
if (!widget->isPluginView())
continue;
static_cast<PluginView*>(widget)->setJavaScriptPaused(paused);
diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.h b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.h
index 4ec3e33..baa6699 100644
--- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.h
+++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.h
@@ -39,6 +39,7 @@
namespace JSC {
class DebuggerCallFrame;
+ class JSGlobalObject;
}
namespace WebCore {
@@ -99,6 +100,8 @@ namespace WebCore {
void dispatchFunctionToListeners(JavaScriptExecutionCallback, Page*);
void pauseIfNeeded(Page*);
+
+ virtual void detach(JSC::JSGlobalObject*);
virtual void sourceParsed(JSC::ExecState*, const JSC::SourceCode&, int errorLine, const JSC::UString& errorMsg);
virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js b/src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js
index a2c8bed..c08cc7a 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js
@@ -26,6 +26,16 @@
WebInspector.CallStackSidebarPane = function()
{
WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack"));
+
+ this._shortcuts = {};
+
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Period,
+ WebInspector.KeyboardShortcut.Modifiers.Ctrl);
+ this._shortcuts[shortcut] = this._selectNextCallFrameOnStack.bind(this);
+
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Comma,
+ WebInspector.KeyboardShortcut.Modifiers.Ctrl);
+ this._shortcuts[shortcut] = this._selectPreviousCallFrameOnStack.bind(this);
}
WebInspector.CallStackSidebarPane.prototype = {
@@ -100,6 +110,53 @@ WebInspector.CallStackSidebarPane.prototype = {
this.dispatchEventToListeners("call frame selected");
},
+ handleKeyEvent: function(event)
+ {
+ var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
+ var handler = this._shortcuts[shortcut];
+ if (handler) {
+ handler(event);
+ event.preventDefault();
+ event.handled = true;
+ }
+ },
+
+ _selectNextCallFrameOnStack: function()
+ {
+ var index = this._selectedCallFrameIndex();
+ if (index == -1)
+ return;
+ this._selectedPlacardByIndex(index + 1);
+ },
+
+ _selectPreviousCallFrameOnStack: function()
+ {
+ var index = this._selectedCallFrameIndex();
+ if (index == -1)
+ return;
+ this._selectedPlacardByIndex(index - 1);
+ },
+
+ _selectedPlacardByIndex: function(index)
+ {
+ if (index < 0 || index >= this.placards.length)
+ return;
+ var placard = this.placards[index];
+ this.selectedCallFrame = placard.callFrame
+ },
+
+ _selectedCallFrameIndex: function()
+ {
+ if (!this._selectedCallFrame)
+ return -1;
+ for (var i = 0; i < this.placards.length; ++i) {
+ var placard = this.placards[i];
+ if (placard.callFrame === this._selectedCallFrame)
+ return i;
+ }
+ return -1;
+ },
+
_placardSelected: function(event)
{
var placardElement = event.target.enclosingNodeOrSelfWithClass("placard");
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Console.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Console.js
index bce1784..ca9ac00 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/Console.js
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Console.js
@@ -198,7 +198,7 @@ WebInspector.Console.prototype = {
this.messages.push(msg);
- if (msg.level === WebInspector.ConsoleMessage.MessageLevel.EndGroup) {
+ if (msg.type === WebInspector.ConsoleMessage.MessageType.EndGroup) {
if (this.groupLevel < 1)
return;
@@ -206,7 +206,7 @@ WebInspector.Console.prototype = {
this.currentGroup = this.currentGroup.parentGroup;
} else {
- if (msg.level === WebInspector.ConsoleMessage.MessageLevel.StartGroup) {
+ if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup) {
this.groupLevel++;
var group = new WebInspector.ConsoleGroup(this.currentGroup, this.groupLevel);
@@ -260,16 +260,7 @@ WebInspector.Console.prototype = {
return;
var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix);
- if (expressionString) {
- this._evalInInspectedWindow(expressionString, reportCompletions);
- } else {
- // There is no expressionString, so the completion should happen against global properties.
- // Or if the debugger is paused, against properties in scope of the selected call frame.
- if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused)
- reportCompletions(WebInspector.panels.scripts.variablesInScopeForSelectedCallFrame());
- else
- reportCompletions(InspectorController.inspectedWindow());
- }
+ this._evalInInspectedWindow(expressionString, reportCompletions);
},
_reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result) {
@@ -397,7 +388,6 @@ WebInspector.Console.prototype = {
WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, callback);
return;
}
-
this.doEvalInWindow(expression, callback);
},
@@ -431,6 +421,11 @@ WebInspector.Console.prototype = {
doEvalInWindow: function(expression, callback)
{
+ if (!expression) {
+ // There is no expression, so the completion should happen against global properties.
+ expression = "this";
+ }
+
// Surround the expression in with statements to inject our command line API so that
// the window object properties still take more precedent than our API functions.
expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }";
@@ -581,23 +576,24 @@ WebInspector.Console.prototype = {
WebInspector.Console.prototype.__proto__ = WebInspector.View.prototype;
-WebInspector.ConsoleMessage = function(source, level, line, url, groupLevel, repeatCount)
+WebInspector.ConsoleMessage = function(source, type, level, line, url, groupLevel, repeatCount)
{
this.source = source;
+ this.type = type;
this.level = level;
this.line = line;
this.url = url;
this.groupLevel = groupLevel;
this.repeatCount = repeatCount;
- if (arguments.length > 6)
- this.setMessageBody(Array.prototype.slice.call(arguments, 6));
+ if (arguments.length > 7)
+ this.setMessageBody(Array.prototype.slice.call(arguments, 7));
}
WebInspector.ConsoleMessage.prototype = {
setMessageBody: function(args)
{
- switch (this.level) {
- case WebInspector.ConsoleMessage.MessageLevel.Trace:
+ switch (this.type) {
+ case WebInspector.ConsoleMessage.MessageType.Trace:
var span = document.createElement("span");
span.addStyleClass("console-formatted-trace");
var stack = Array.prototype.slice.call(args);
@@ -607,7 +603,7 @@ WebInspector.ConsoleMessage.prototype = {
span.appendChild(document.createTextNode(funcNames.join("\n")));
this.formattedMessage = span;
break;
- case WebInspector.ConsoleMessage.MessageLevel.Object:
+ case WebInspector.ConsoleMessage.MessageType.Object:
this.formattedMessage = this._format(["%O", args[0]]);
break;
default:
@@ -725,8 +721,10 @@ WebInspector.ConsoleMessage.prototype = {
case WebInspector.ConsoleMessage.MessageLevel.Error:
element.addStyleClass("console-error-level");
break;
- case WebInspector.ConsoleMessage.MessageLevel.StartGroup:
- element.addStyleClass("console-group-title-level");
+ }
+
+ if (this.type === WebInspector.ConsoleMessage.MessageType.StartGroup) {
+ element.addStyleClass("console-group-title");
}
if (this.elementsTreeOutline) {
@@ -793,6 +791,25 @@ WebInspector.ConsoleMessage.prototype = {
break;
}
+ var typeString;
+ switch (this.type) {
+ case WebInspector.ConsoleMessage.MessageType.Log:
+ typeString = "Log";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.Object:
+ typeString = "Object";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.Trace:
+ typeString = "Trace";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.StartGroup:
+ typeString = "Start Group";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.EndGroup:
+ typeString = "End Group";
+ break;
+ }
+
var levelString;
switch (this.level) {
case WebInspector.ConsoleMessage.MessageLevel.Tip:
@@ -807,21 +824,9 @@ WebInspector.ConsoleMessage.prototype = {
case WebInspector.ConsoleMessage.MessageLevel.Error:
levelString = "Error";
break;
- case WebInspector.ConsoleMessage.MessageLevel.Object:
- levelString = "Object";
- break;
- case WebInspector.ConsoleMessage.MessageLevel.Trace:
- levelString = "Trace";
- break;
- case WebInspector.ConsoleMessage.MessageLevel.StartGroup:
- levelString = "Start Group";
- break;
- case WebInspector.ConsoleMessage.MessageLevel.EndGroup:
- levelString = "End Group";
- break;
}
- return sourceString + " " + levelString + ": " + this.formattedMessage.textContent + "\n" + this.url + " line " + this.line;
+ return sourceString + " " + typeString + " " + levelString + ": " + this.formattedMessage.textContent + "\n" + this.url + " line " + this.line;
},
isEqual: function(msg, disreguardGroup)
@@ -830,6 +835,7 @@ WebInspector.ConsoleMessage.prototype = {
return false;
var ret = (this.source == msg.source)
+ && (this.type == msg.type)
&& (this.level == msg.level)
&& (this.line == msg.line)
&& (this.url == msg.url)
@@ -849,15 +855,19 @@ WebInspector.ConsoleMessage.MessageSource = {
Other: 5
}
+WebInspector.ConsoleMessage.MessageType = {
+ Log: 0,
+ Object: 1,
+ Trace: 2,
+ StartGroup: 3,
+ EndGroup: 4
+}
+
WebInspector.ConsoleMessage.MessageLevel = {
Tip: 0,
Log: 1,
Warning: 2,
- Error: 3,
- Object: 4,
- Trace: 5,
- StartGroup: 6,
- EndGroup: 7
+ Error: 3
}
WebInspector.ConsoleCommand = function(command)
@@ -888,7 +898,7 @@ WebInspector.ConsoleCommandResult = function(result, exception, originatingComma
var line = (exception ? result.line : -1);
var url = (exception ? result.sourceURL : null);
- WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, level, line, url, null, 1, message);
+ WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Log, level, line, url, null, 1, message);
this.originatingCommand = originatingCommand;
}
@@ -925,7 +935,7 @@ WebInspector.ConsoleGroup.prototype = {
{
var element = msg.toMessageElement();
- if (msg.level === WebInspector.ConsoleMessage.MessageLevel.StartGroup) {
+ if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup) {
this.messagesElement.parentNode.insertBefore(element, this.messagesElement);
element.addEventListener("click", this._titleClicked.bind(this), true);
} else
@@ -937,7 +947,7 @@ WebInspector.ConsoleGroup.prototype = {
_titleClicked: function(event)
{
- var groupTitleElement = event.target.enclosingNodeOrSelfWithClass("console-group-title-level");
+ var groupTitleElement = event.target.enclosingNodeOrSelfWithClass("console-group-title");
if (groupTitleElement) {
var groupElement = groupTitleElement.enclosingNodeOrSelfWithClass("console-group");
if (groupElement)
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/KeyboardShortcut.js b/src/3rdparty/webkit/WebCore/inspector/front-end/KeyboardShortcut.js
new file mode 100644
index 0000000..ed28a48
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/KeyboardShortcut.js
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google 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 Computer, 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.
+ */
+
+WebInspector.KeyboardShortcut = function()
+{
+};
+
+/**
+ * Constants for encoding modifier key set as a bit mask.
+ * @see #_makeKeyFromCodeAndModifiers
+ */
+WebInspector.KeyboardShortcut.Modifiers = {
+ None: 0, // Constant for empty modifiers set.
+ Shift: 1,
+ Ctrl: 2,
+ Alt: 4,
+ Meta: 8 // Command key on Mac, Win key on other platforms.
+};
+
+WebInspector.KeyboardShortcut.KeyCodes = {
+ Esc: 27,
+ Space: 32,
+ PageUp: 33, // also NUM_NORTH_EAST
+ PageDown: 34, // also NUM_SOUTH_EAST
+ End: 35, // also NUM_SOUTH_WEST
+ Home: 36, // also NUM_NORTH_WEST
+ Left: 37, // also NUM_WEST
+ Up: 38, // also NUM_NORTH
+ Right: 39, // also NUM_EAST
+ Down: 40, // also NUM_SOUTH
+ F1: 112,
+ F2: 113,
+ F3: 114,
+ F4: 115,
+ F5: 116,
+ F6: 117,
+ F7: 118,
+ F8: 119,
+ F9: 120,
+ F10: 121,
+ F11: 122,
+ F12: 123,
+ Semicolon: 186, // ;
+ Comma: 188, // ,
+ Period: 190, // .
+ Slash: 191, // /
+ Apostrophe: 192, // `
+ SingleQuote: 222, // '
+};
+
+/**
+ * Creates a number encoding keyCode in the lower 8 bits and modifiers mask in the higher 8 bits.
+ * It is usefull for matching pressed keys.
+ * @param {number} keyCode Code of the key.
+ * @param {number} optModifiers Optional list of modifiers passed as additional paramerters.
+ */
+WebInspector.KeyboardShortcut.makeKey = function(keyCode, optModifiers)
+{
+ var modifiers = WebInspector.KeyboardShortcut.Modifiers.None;
+ for (var i = 1; i < arguments.length; i++)
+ modifiers |= arguments[i];
+ return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode, modifiers);
+};
+
+WebInspector.KeyboardShortcut.makeKeyFromEvent = function(keyboardEvent)
+{
+ var modifiers = WebInspector.KeyboardShortcut.Modifiers.None;
+ if (keyboardEvent.shiftKey)
+ modifiers |= WebInspector.KeyboardShortcut.Modifiers.Shift;
+ if (keyboardEvent.ctrlKey)
+ modifiers |= WebInspector.KeyboardShortcut.Modifiers.Ctrl;
+ if (keyboardEvent.altKey)
+ modifiers |= WebInspector.KeyboardShortcut.Modifiers.Alt;
+ if (keyboardEvent.metaKey)
+ modifiers |= WebInspector.KeyboardShortcut.Modifiers.Meta;
+ return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyboardEvent.keyCode, modifiers);
+};
+
+WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers = function(keyCode, modifiers)
+{
+ return (keyCode & 255) | (modifiers << 8);
+};
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js
index 058f232..85d5cd2 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js
@@ -489,7 +489,8 @@ WebInspector.Resource.prototype = {
// Otherwise, we flood the Console with too many tips.
/*
var msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,
- WebInspector.ConsoleMessage.MessageLevel.Tip, -1, this.url, null, 1, tip.message);
+ WebInspector.ConsoleMessage.MessageType.Log, WebInspector.ConsoleMessage.MessageLevel.Tip,
+ -1, this.url, null, 1, tip.message);
WebInspector.console.addMessage(msg);
*/
},
@@ -549,6 +550,7 @@ WebInspector.Resource.prototype = {
case WebInspector.Warnings.IncorrectMIMEType.id:
if (!this._mimeTypeIsConsistentWithType())
msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,
+ WebInspector.ConsoleMessage.MessageType.Log,
WebInspector.ConsoleMessage.MessageLevel.Warning, -1, this.url, null, 1,
String.sprintf(WebInspector.Warnings.IncorrectMIMEType.message,
WebInspector.Resource.Type.toString(this.type), this.mimeType));
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js
index 04d998e..c4ea83f 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js
@@ -126,7 +126,7 @@ WebInspector.ResourcesPanel = function()
this.resourcesTreeElement.expand();
- var panelEnablerHeading = WebInspector.UIString("You need to enable resource tracking to use the this panel.");
+ var panelEnablerHeading = WebInspector.UIString("You need to enable resource tracking to use this panel.");
var panelEnablerDisclaimer = WebInspector.UIString("Enabling resource tracking will reload the page and make page loading slower.");
var panelEnablerButton = WebInspector.UIString("Enable resource tracking");
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js
index d30c002..68013c9 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js
@@ -163,6 +163,39 @@ WebInspector.ScriptsPanel = function()
this._breakpointsURLMap = {};
+ this._shortcuts = {};
+
+ var isMac = InspectorController.platform().indexOf("mac-") === 0;
+ var platformSpecificModifier = isMac ? WebInspector.KeyboardShortcut.Modifiers.Meta : WebInspector.KeyboardShortcut.Modifiers.Ctrl;
+
+ // Continue.
+ var handler = this.pauseButton.click.bind(this.pauseButton);
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F8);
+ this._shortcuts[shortcut] = handler;
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Slash, platformSpecificModifier);
+ this._shortcuts[shortcut] = handler;
+
+ // Step over.
+ var handler = this.stepOverButton.click.bind(this.stepOverButton);
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F10);
+ this._shortcuts[shortcut] = handler;
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.SingleQuote, platformSpecificModifier);
+ this._shortcuts[shortcut] = handler;
+
+ // Step into.
+ var handler = this.stepIntoButton.click.bind(this.stepIntoButton);
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F11);
+ this._shortcuts[shortcut] = handler;
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Semicolon, platformSpecificModifier);
+ this._shortcuts[shortcut] = handler;
+
+ // Step out.
+ var handler = this.stepOutButton.click.bind(this.stepOutButton);
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F11, WebInspector.KeyboardShortcut.Modifiers.Shift);
+ this._shortcuts[shortcut] = handler;
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift, platformSpecificModifier);
+ this._shortcuts[shortcut] = handler;
+
this.reset();
}
@@ -337,8 +370,14 @@ WebInspector.ScriptsPanel.prototype = {
doEvalInCallFrame: function(callFrame, code, callback)
{
+ var panel = this;
function delayedEvaluation()
{
+ if (!code) {
+ // Evaluate into properties in scope of the selected call frame.
+ callback(panel._variablesInScope(callFrame));
+ return;
+ }
try {
callback(callFrame.evaluate(code));
} catch (e) {
@@ -348,20 +387,15 @@ WebInspector.ScriptsPanel.prototype = {
setTimeout(delayedEvaluation, 0);
},
- variablesInScopeForSelectedCallFrame: function()
+ _variablesInScope: function(callFrame)
{
- var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame;
- if (!this._paused || !selectedCallFrame)
- return {};
-
var result = {};
- var scopeChain = selectedCallFrame.scopeChain;
+ var scopeChain = callFrame.scopeChain;
for (var i = 0; i < scopeChain.length; ++i) {
var scopeObject = scopeChain[i];
for (var property in scopeObject)
result[property] = true;
}
-
return result;
},
@@ -486,6 +520,19 @@ WebInspector.ScriptsPanel.prototype = {
this._showScriptOrResource((view.resource || view.script));
},
+ handleKeyEvent: function(event)
+ {
+ var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
+ var handler = this._shortcuts[shortcut];
+ if (handler) {
+ handler(event);
+ event.preventDefault();
+ event.handled = true;
+ } else {
+ this.sidebarPanes.callstack.handleKeyEvent(event);
+ }
+ },
+
scriptViewForScript: function(script)
{
if (!script)
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js b/src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js
index 30772f7..4194ff1 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js
@@ -159,10 +159,9 @@ WebInspector.TextPrompt.prototype = {
return;
var selectionRange = selection.getRangeAt(0);
- var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, this.completionStopCharacters, this.element, "backward");
var fullWordRange = document.createRange();
- fullWordRange.setStart(wordPrefixRange.startContainer, wordPrefixRange.startOffset);
+ fullWordRange.setStart(originalWordPrefixRange.startContainer, originalWordPrefixRange.startOffset);
fullWordRange.setEnd(selectionRange.endContainer, selectionRange.endOffset);
if (originalWordPrefixRange.toString() + selectionRange.toString() != fullWordRange.toString())
@@ -185,7 +184,7 @@ WebInspector.TextPrompt.prototype = {
var completionText = completions[foundIndex + 1];
}
- var wordPrefixLength = wordPrefixRange.toString().length;
+ var wordPrefixLength = originalWordPrefixRange.toString().length;
this._userEnteredRange = fullWordRange;
this._userEnteredText = fullWordRange.toString();
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc
index 76a925b..6619499 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc
@@ -19,6 +19,7 @@
<file>FontView.js</file>
<file>ImageView.js</file>
<file>inspector.js</file>
+ <file>KeyboardShortcut.js</file>
<file>MetricsSidebarPane.js</file>
<file>Object.js</file>
<file>ObjectPropertiesSection.js</file>
@@ -109,6 +110,7 @@
<file>Images/resourcePlainIcon.png</file>
<file>Images/resourcePlainIconSmall.png</file>
<file>Images/resourcesIcon.png</file>
+ <file>Images/resourcesSilhouette.png</file>
<file>Images/resourcesSizeGraphIcon.png</file>
<file>Images/resourcesTimeGraphIcon.png</file>
<file>Images/scriptsIcon.png</file>
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css
index c162531..929caa2 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css
@@ -483,7 +483,7 @@ body.console-visible #console {
background-image: none;
}
-.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title-level::before {
+.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title::before {
position: absolute;
display: block;
content: "";
@@ -529,18 +529,18 @@ body.console-visible #console {
margin-left: 16px;
}
-.console-group-title-level {
+.console-group-title {
font-weight: bold;
}
-.console-group-title-level::before {
+.console-group-title::before {
background-image: url(Images/disclosureTriangleSmallDown.png);
top: 0.6em;
width: 11px;
height: 12px;
}
-.console-group.collapsed .console-group-title-level::before {
+.console-group.collapsed .console-group-title::before {
background-image: url(Images/disclosureTriangleSmallRight.png);
}
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html
index 184bb45..f211fb7 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html
@@ -34,6 +34,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<script type="text/javascript" src="treeoutline.js"></script>
<script type="text/javascript" src="inspector.js"></script>
<script type="text/javascript" src="Object.js"></script>
+ <script type="text/javascript" src="KeyboardShortcut.js"></script>
<script type="text/javascript" src="TextPrompt.js"></script>
<script type="text/javascript" src="Placard.js"></script>
<script type="text/javascript" src="View.js"></script>
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js
index 9d5bac0..91f2659 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js
@@ -979,6 +979,7 @@ WebInspector.addMessageToConsole = function(payload)
{
var consoleMessage = new WebInspector.ConsoleMessage(
payload.source,
+ payload.type,
payload.level,
payload.line,
payload.url,
diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp
index 06d96bc..0b72f94 100644
--- a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp
@@ -247,7 +247,7 @@ void DocLoader::printAccessDeniedMessage(const KURL& url) const
m_doc->url().string().utf8().data());
// FIXME: provide a real line number and source URL.
- frame()->domWindow()->console()->addMessage(OtherMessageSource, ErrorMessageLevel, message, 1, String());
+ frame()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String());
}
void DocLoader::setAutoLoadImages(bool enable)
diff --git a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h
index 2abd54f..f1c4c5d 100644
--- a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h
+++ b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h
@@ -95,7 +95,7 @@ public:
virtual void setResizable(bool) { }
- virtual void addMessageToConsole(MessageSource, MessageLevel, const String&, unsigned, const String&) { }
+ virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String&, unsigned, const String&) { }
virtual bool canRunBeforeUnloadConfirmPanel() { return false; }
virtual bool runBeforeUnloadConfirmPanel(const String&, Frame*) { return true; }
@@ -137,6 +137,9 @@ public:
virtual void formStateDidChange(const Node*) { }
+ virtual void formDidFocus(const Node*) { }
+ virtual void formDidBlur(const Node*) { }
+
virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
virtual bool setCursor(PlatformCursorHandle) { return false; }
@@ -270,8 +273,8 @@ public:
virtual bool canCachePage() const { return false; }
virtual PassRefPtr<Frame> createFrame(const KURL&, const String&, HTMLFrameOwnerElement*, const String&, bool, int, int) { return 0; }
- virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; }
- virtual Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; }
+ virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; }
+ virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; }
virtual ObjectContentType objectContentType(const KURL&, const String&) { return ObjectContentType(); }
virtual String overrideMediaType() const { return String(); }
diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp
index 9a09e49..1e51583 100644
--- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp
@@ -424,7 +424,7 @@ bool FrameLoader::requestFrame(HTMLFrameOwnerElement* ownerElement, const String
Frame* frame = ownerElement->contentFrame();
if (frame)
- frame->loader()->scheduleLocationChange(url.string(), m_outgoingReferrer, true, true, userGestureHint());
+ frame->loader()->scheduleLocationChange(url.string(), m_outgoingReferrer, true, true, isProcessingUserGesture());
else
frame = loadSubframe(ownerElement, url, frameName, m_outgoingReferrer);
@@ -487,7 +487,7 @@ Frame* FrameLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const KURL
void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<FormData> formData,
const String& target, const String& contentType, const String& boundary,
- bool lockHistory, bool lockBackForwardList, PassRefPtr<Event> event, PassRefPtr<FormState> formState)
+ bool lockHistory, PassRefPtr<Event> event, PassRefPtr<FormState> formState)
{
ASSERT(action);
ASSERT(strcmp(action, "GET") == 0 || strcmp(action, "POST") == 0);
@@ -559,20 +559,7 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F
frameRequest.resourceRequest().setURL(u);
addHTTPOriginIfNeeded(frameRequest.resourceRequest(), outgoingOrigin());
- // Navigation of a subframe during loading of the main frame does not create a new back/forward item.
- // Strangely, we only implement this rule for form submission; time will tell if we need it for other types of navigation.
- // The definition of "during load" is any time before the load event has been handled.
- // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motivation for this.
- if (Page* targetPage = targetFrame->page()) {
- Frame* mainFrame = targetPage->mainFrame();
- if (mainFrame != targetFrame) {
- Document* document = mainFrame->document();
- if (!mainFrame->loader()->isComplete() || document && document->processingLoadEvent())
- lockBackForwardList = true;
- }
- }
-
- targetFrame->loader()->scheduleFormSubmission(frameRequest, lockHistory, lockBackForwardList, event, formState);
+ targetFrame->loader()->scheduleFormSubmission(frameRequest, lockHistory, event, formState);
}
void FrameLoader::stopLoading(bool sendUnload, DatabasePolicy databasePolicy)
@@ -1336,6 +1323,20 @@ void FrameLoader::scheduleHTTPRedirection(double delay, const String& url)
scheduleRedirection(new ScheduledRedirection(delay, url, true, delay <= 1, false, false));
}
+static bool mustLockBackForwardList(Frame* targetFrame)
+{
+ // Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item.
+ // The definition of "during load" is any time before all handlers for the load event have been run.
+ // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motivation for this.
+
+ for (Frame* ancestor = targetFrame->tree()->parent(); ancestor; ancestor = ancestor->tree()->parent()) {
+ Document* document = ancestor->document();
+ if (!ancestor->loader()->isComplete() || document && document->processingLoadEvent())
+ return true;
+ }
+ return false;
+}
+
void FrameLoader::scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture)
{
if (!m_frame->page())
@@ -1344,6 +1345,8 @@ void FrameLoader::scheduleLocationChange(const String& url, const String& referr
if (url.isEmpty())
return;
+ lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame);
+
// If the URL we're going to navigate to is the same as the current one, except for the
// fragment part, we don't need to schedule the location change.
KURL parsedURL(url);
@@ -1360,7 +1363,7 @@ void FrameLoader::scheduleLocationChange(const String& url, const String& referr
}
void FrameLoader::scheduleFormSubmission(const FrameLoadRequest& frameRequest,
- bool lockHistory, bool lockBackForwardList, PassRefPtr<Event> event, PassRefPtr<FormState> formState)
+ bool lockHistory, PassRefPtr<Event> event, PassRefPtr<FormState> formState)
{
ASSERT(m_frame->page());
ASSERT(!frameRequest.isEmpty());
@@ -1372,7 +1375,7 @@ void FrameLoader::scheduleFormSubmission(const FrameLoadRequest& frameRequest,
// This may happen when a frame changes the location of another frame.
bool duringLoad = !m_committedFirstRealDocumentLoad;
- scheduleRedirection(new ScheduledRedirection(frameRequest, lockHistory, lockBackForwardList, event, formState, duringLoad));
+ scheduleRedirection(new ScheduledRedirection(frameRequest, lockHistory, mustLockBackForwardList(m_frame), event, formState, duringLoad));
}
void FrameLoader::scheduleRefresh(bool wasUserGesture)
@@ -1586,28 +1589,8 @@ bool FrameLoader::gotoAnchor(const String& name)
if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top")))
return false;
- // We need to update the layout before scrolling, otherwise we could
- // really mess things up if an anchor scroll comes at a bad moment.
- m_frame->document()->updateStyleIfNeeded();
- // Only do a layout if changes have occurred that make it necessary.
- if (m_frame->view() && m_frame->contentRenderer() && m_frame->contentRenderer()->needsLayout())
- m_frame->view()->layout();
-
- // Scroll nested layers and frames to reveal the anchor.
- // Align to the top and to the closest side (this matches other browsers).
- RenderObject* renderer;
- IntRect rect;
- if (!anchorNode)
- renderer = m_frame->document()->renderer(); // top of document
- else {
- renderer = anchorNode->renderer();
- rect = anchorNode->getRect();
- }
- if (renderer) {
- renderer->enclosingLayer()->scrollRectToVisible(rect, true, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways);
- if (m_frame->view())
- m_frame->view()->setLockedToAnchor(true);
- }
+ if (FrameView* view = m_frame->view())
+ view->maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame->document());
return true;
}
@@ -1686,7 +1669,7 @@ static HTMLPlugInElement* toPlugInElement(Node* node)
bool FrameLoader::loadPlugin(RenderPart* renderer, const KURL& url, const String& mimeType,
const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback)
{
- Widget* widget = 0;
+ RefPtr<Widget> widget;
if (renderer && !useFallback) {
HTMLPlugInElement* element = toPlugInElement(renderer->node());
@@ -1768,7 +1751,7 @@ void FrameLoader::provisionalLoadStarted()
m_client->provisionalLoadStarted();
}
-bool FrameLoader::userGestureHint()
+bool FrameLoader::isProcessingUserGesture()
{
Frame* frame = m_frame->tree()->top();
if (!frame->script()->isEnabled())
@@ -2111,7 +2094,7 @@ void FrameLoader::completed()
if (Frame* parent = m_frame->tree()->parent())
parent->loader()->checkCompleted();
if (m_frame->view())
- m_frame->view()->setLockedToAnchor(false);
+ m_frame->view()->maintainScrollPositionAtAnchor(0);
}
void FrameLoader::started()
@@ -2406,7 +2389,7 @@ void FrameLoader::reportLocalLoadFailed(Frame* frame, const String& url)
if (!frame)
return;
- frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Not allowed to load local resource: " + url, 0, String());
+ frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Not allowed to load local resource: " + url, 0, String());
}
bool FrameLoader::shouldHideReferrer(const KURL& url, const String& referrer)
@@ -2623,7 +2606,7 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const
targetDocument->url().string().utf8().data(), activeDocument->url().string().utf8().data());
// FIXME: should we print to the console of the activeFrame as well?
- targetFrame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, 1, String());
+ targetFrame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String());
}
return false;
@@ -5066,7 +5049,7 @@ void FrameLoader::dispatchWindowObjectAvailable()
}
}
-Widget* FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args)
+PassRefPtr<Widget> FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args)
{
String baseURLString;
String codeBaseURLString;
@@ -5094,7 +5077,7 @@ Widget* FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletEleme
baseURLString = m_frame->document()->baseURL().string();
KURL baseURL = completeURL(baseURLString);
- Widget* widget = m_client->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues);
+ RefPtr<Widget> widget = m_client->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues);
if (!widget)
return 0;
diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h
index d96329f..b80a87c 100644
--- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h
+++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h
@@ -261,7 +261,7 @@ namespace WebCore {
void submitForm(const char* action, const String& url,
PassRefPtr<FormData>, const String& target, const String& contentType, const String& boundary,
- bool lockHistory, bool lockBackForwardList, PassRefPtr<Event>, PassRefPtr<FormState>);
+ bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>);
void stop();
void stopLoading(bool sendUnload, DatabasePolicy = DatabasePolicyStop);
@@ -305,7 +305,7 @@ namespace WebCore {
void handledOnloadEvents();
String userAgent(const KURL&) const;
- Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap<String, String>& args);
+ PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap<String, String>& args);
void dispatchWindowObjectAvailable();
void dispatchDocumentElementAvailable();
@@ -316,7 +316,7 @@ namespace WebCore {
bool openedByDOM() const;
void setOpenedByDOM();
- bool userGestureHint();
+ bool isProcessingUserGesture();
void resetMultipleFormSubmissionProtection();
@@ -492,7 +492,7 @@ namespace WebCore {
void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier);
static bool isLocationChange(const ScheduledRedirection&);
- void scheduleFormSubmission(const FrameLoadRequest&, bool lockHistory, bool lockBackForwardList, PassRefPtr<Event>, PassRefPtr<FormState>);
+ void scheduleFormSubmission(const FrameLoadRequest&, bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>);
void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>); // Calls continueLoadAfterNavigationPolicy
void load(DocumentLoader*); // Calls loadWithDocumentLoader
diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h b/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h
index 8c050f0..aa36b50 100644
--- a/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h
+++ b/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h
@@ -200,10 +200,10 @@ namespace WebCore {
virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) = 0;
- virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0;
+ virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0;
virtual void redirectDataToPlugin(Widget* pluginWidget) = 0;
- virtual Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) = 0;
+ virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) = 0;
virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) = 0;
virtual String overrideMediaType() const = 0;
diff --git a/src/3rdparty/webkit/WebCore/loader/TextDocument.cpp b/src/3rdparty/webkit/WebCore/loader/TextDocument.cpp
index 0d86c1b..a3d7061 100644
--- a/src/3rdparty/webkit/WebCore/loader/TextDocument.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/TextDocument.cpp
@@ -162,6 +162,8 @@ void TextTokenizer::write(const SegmentedString& s, bool)
void TextTokenizer::finish()
{
+ if (!m_preElement)
+ write(SegmentedString(), true); // Create document structure for an empty text document.
m_preElement = 0;
fastFree(m_buffer);
m_buffer = 0;
diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp
index 3ded4f3..b78291d 100644
--- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp
@@ -27,6 +27,8 @@
#include "config.h"
#include "IconDatabase.h"
+#if ENABLE(ICONDATABASE)
+
#include "AutodrainedPool.h"
#include "DocumentLoader.h"
#include "FileSystem.h"
@@ -2067,3 +2069,5 @@ void IconDatabase::writeIconSnapshotToSQLDatabase(const IconSnapshot& snapshot)
}
} // namespace WebCore
+
+#endif // ENABLE(ICONDATABASE)
diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h
index 40f641a..675e6c8 100644
--- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h
+++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h
@@ -165,6 +165,7 @@ private:
HashSet<String> m_pageURLsPendingImport;
HashSet<String> m_pageURLsInterestedInIcons;
HashSet<IconRecord*> m_iconsPendingReading;
+#endif // ENABLE(ICONDATABASE)
// *** Sync Thread Only ***
public:
@@ -174,6 +175,7 @@ public:
bool shouldStopThreadActivity() const;
+#if ENABLE(ICONDATABASE)
private:
static void* iconDatabaseSyncThreadStart(void *);
void* iconDatabaseSyncThread();
@@ -238,4 +240,4 @@ IconDatabase* iconDatabase();
} // namespace WebCore
-#endif
+#endif // IconDatabase_h
diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp
index a7fb88d..03a7964 100644
--- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp
@@ -26,6 +26,8 @@
#include "config.h"
#include "IconDatabase.h"
+#if !ENABLE(ICONDATABASE)
+
#include "PlatformString.h"
#include "SharedBuffer.h"
#include <wtf/StdLibExtras.h>
@@ -194,4 +196,23 @@ void IconDatabase::setClient(IconDatabaseClient*)
{
}
+// ************************
+// *** Sync Thread Only ***
+// ************************
+
+void IconDatabase::importIconURLForPageURL(const String&, const String&)
+{
+}
+
+void IconDatabase::importIconDataForIconURL(PassRefPtr<SharedBuffer>, const String&)
+{
+}
+
+bool IconDatabase::shouldStopThreadActivity() const
+{
+ return true;
+}
+
} // namespace WebCore
+
+#endif // !ENABLE(ICONDATABASE)
diff --git a/src/3rdparty/webkit/WebCore/loader/loader.cpp b/src/3rdparty/webkit/WebCore/loader/loader.cpp
index d10877f..881e200 100644
--- a/src/3rdparty/webkit/WebCore/loader/loader.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/loader.cpp
@@ -176,6 +176,35 @@ void Loader::resumePendingRequests()
scheduleServePendingRequests();
}
+void Loader::nonCacheRequestInFlight(const KURL& url)
+{
+ if (!url.protocolInHTTPFamily())
+ return;
+
+ AtomicString hostName = url.host();
+ RefPtr<Host> host = m_hosts.get(hostName.impl());
+ if (!host) {
+ host = Host::create(hostName, maxRequestsInFlightPerHost);
+ m_hosts.add(hostName.impl(), host);
+ }
+
+ host->nonCacheRequestInFlight();
+}
+
+void Loader::nonCacheRequestComplete(const KURL& url)
+{
+ if (!url.protocolInHTTPFamily())
+ return;
+
+ AtomicString hostName = url.host();
+ RefPtr<Host> host = m_hosts.get(hostName.impl());
+ ASSERT(host);
+ if (!host)
+ return;
+
+ host->nonCacheRequestComplete();
+}
+
void Loader::cancelRequests(DocLoader* docLoader)
{
docLoader->clearPendingPreloads();
@@ -204,6 +233,7 @@ Loader::Host::Host(const AtomicString& name, unsigned maxRequestsInFlight)
: m_name(name)
, m_maxRequestsInFlight(maxRequestsInFlight)
, m_numResourcesProcessing(0)
+ , m_nonCachedRequestsInFlight(0)
{
}
@@ -219,6 +249,17 @@ void Loader::Host::addRequest(Request* request, Priority priority)
m_requestsPending[priority].append(request);
}
+void Loader::Host::nonCacheRequestInFlight()
+{
+ ++m_nonCachedRequestsInFlight;
+}
+
+void Loader::Host::nonCacheRequestComplete()
+{
+ --m_nonCachedRequestsInFlight;
+ ASSERT(m_nonCachedRequestsInFlight >= 0);
+}
+
bool Loader::Host::hasRequests() const
{
if (!m_requestsLoading.isEmpty())
@@ -250,7 +291,7 @@ void Loader::Host::servePendingRequests(RequestQueue& requestsPending, bool& ser
// resources that we would want to push to the front of the queue. Just hand off the remaining resources
// to the networking layer.
bool parsedAndStylesheetsKnown = !docLoader->doc()->parsing() && docLoader->doc()->haveStylesheetsLoaded();
- if (!parsedAndStylesheetsKnown && !resourceIsCacheValidator && m_requestsLoading.size() >= m_maxRequestsInFlight) {
+ if (!parsedAndStylesheetsKnown && !resourceIsCacheValidator && m_requestsLoading.size() + m_nonCachedRequestsInFlight >= m_maxRequestsInFlight) {
serveLowerPriority = false;
return;
}
diff --git a/src/3rdparty/webkit/WebCore/loader/loader.h b/src/3rdparty/webkit/WebCore/loader/loader.h
index c5b9416..3cced3d 100644
--- a/src/3rdparty/webkit/WebCore/loader/loader.h
+++ b/src/3rdparty/webkit/WebCore/loader/loader.h
@@ -35,6 +35,7 @@ namespace WebCore {
class CachedResource;
class DocLoader;
+ class KURL;
class Request;
class Loader : Noncopyable {
@@ -52,6 +53,9 @@ namespace WebCore {
bool isSuspendingPendingRequests() { return m_isSuspendingPendingRequests; }
void suspendPendingRequests();
void resumePendingRequests();
+
+ void nonCacheRequestInFlight(const KURL&);
+ void nonCacheRequestComplete(const KURL&);
private:
Priority determinePriority(const CachedResource*) const;
@@ -69,11 +73,13 @@ namespace WebCore {
const AtomicString& name() const { return m_name; }
void addRequest(Request*, Priority);
+ void nonCacheRequestInFlight();
+ void nonCacheRequestComplete();
void servePendingRequests(Priority minimumPriority = Low);
void cancelRequests(DocLoader*);
bool hasRequests() const;
- bool processingResource() const { return m_numResourcesProcessing != 0; }
+ bool processingResource() const { return m_numResourcesProcessing != 0 || m_nonCachedRequestsInFlight !=0; }
private:
Host(const AtomicString&, unsigned);
@@ -94,6 +100,7 @@ namespace WebCore {
const AtomicString m_name;
const int m_maxRequestsInFlight;
int m_numResourcesProcessing;
+ int m_nonCachedRequestsInFlight;
};
typedef HashMap<AtomicStringImpl*, RefPtr<Host> > HostMap;
HostMap m_hosts;
diff --git a/src/3rdparty/webkit/WebCore/page/ChromeClient.h b/src/3rdparty/webkit/WebCore/page/ChromeClient.h
index e155754..78efa45 100644
--- a/src/3rdparty/webkit/WebCore/page/ChromeClient.h
+++ b/src/3rdparty/webkit/WebCore/page/ChromeClient.h
@@ -103,7 +103,7 @@ namespace WebCore {
virtual void setResizable(bool) = 0;
- virtual void addMessageToConsole(MessageSource, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID) = 0;
+ virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID) = 0;
virtual bool canRunBeforeUnloadConfirmPanel() = 0;
virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame) = 0;
@@ -168,6 +168,9 @@ namespace WebCore {
// Notification that the given form element has changed. This function
// will be called frequently, so handling should be very fast.
virtual void formStateDidChange(const Node*) = 0;
+
+ virtual void formDidFocus(const Node*) { };
+ virtual void formDidBlur(const Node*) { };
virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() = 0;
diff --git a/src/3rdparty/webkit/WebCore/page/Console.cpp b/src/3rdparty/webkit/WebCore/page/Console.cpp
index 1a654ab..45ff059 100644
--- a/src/3rdparty/webkit/WebCore/page/Console.cpp
+++ b/src/3rdparty/webkit/WebCore/page/Console.cpp
@@ -128,18 +128,6 @@ static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel
case ErrorMessageLevel:
levelString = "ERROR";
break;
- case ObjectMessageLevel:
- levelString = "OBJECT";
- break;
- case TraceMessageLevel:
- levelString = "TRACE";
- break;
- case StartGroupMessageLevel:
- levelString = "START GROUP";
- break;
- case EndGroupMessageLevel:
- levelString = "END GROUP";
- break;
default:
ASSERT_NOT_REACHED();
levelString = "UNKNOWN";
@@ -149,16 +137,16 @@ static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel
printf("%s %s:", sourceString, levelString);
}
-void Console::addMessage(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
{
Page* page = this->page();
if (!page)
return;
if (source == JSMessageSource || source == WMLMessageSource)
- page->chrome()->client()->addMessageToConsole(source, level, message, lineNumber, sourceURL);
+ page->chrome()->client()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL);
- page->inspectorController()->addMessageToConsole(source, level, message, lineNumber, sourceURL);
+ page->inspectorController()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL);
if (!Console::shouldPrintExceptions())
return;
@@ -169,7 +157,8 @@ void Console::addMessage(MessageSource source, MessageLevel level, const String&
printf(" %s\n", message.utf8().data());
}
-void Console::addMessage(MessageLevel level, ScriptCallStack* callStack, bool acceptNoArguments) {
+void Console::addMessage(MessageType type, MessageLevel level, ScriptCallStack* callStack, bool acceptNoArguments)
+{
Page* page = this->page();
if (!page)
return;
@@ -181,9 +170,9 @@ void Console::addMessage(MessageLevel level, ScriptCallStack* callStack, bool ac
String message;
if (getFirstArgumentAsString(callStack->state(), lastCaller, message))
- page->chrome()->client()->addMessageToConsole(JSMessageSource, level, message, lastCaller.lineNumber(), lastCaller.sourceURL().prettyURL());
+ page->chrome()->client()->addMessageToConsole(JSMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL().prettyURL());
- page->inspectorController()->addMessageToConsole(JSMessageSource, level, callStack);
+ page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, callStack);
if (!Console::shouldPrintExceptions())
return;
@@ -207,7 +196,7 @@ void Console::debug(ScriptCallStack* callStack)
void Console::error(ScriptCallStack* callStack)
{
- addMessage(ErrorMessageLevel, callStack);
+ addMessage(LogMessageType, ErrorMessageLevel, callStack);
}
void Console::info(ScriptCallStack* callStack)
@@ -217,12 +206,12 @@ void Console::info(ScriptCallStack* callStack)
void Console::log(ScriptCallStack* callStack)
{
- addMessage(LogMessageLevel, callStack);
+ addMessage(LogMessageType, LogMessageLevel, callStack);
}
void Console::dir(ScriptCallStack* callStack)
{
- addMessage(ObjectMessageLevel, callStack);
+ addMessage(ObjectMessageType, LogMessageLevel, callStack);
}
void Console::dirxml(ScriptCallStack* callStack)
@@ -233,7 +222,7 @@ void Console::dirxml(ScriptCallStack* callStack)
void Console::trace(ScriptCallStack* callStack)
{
- addMessage(TraceMessageLevel, callStack, true);
+ addMessage(TraceMessageType, LogMessageLevel, callStack, true);
if (!shouldPrintExceptions())
return;
@@ -251,7 +240,7 @@ void Console::assertCondition(bool condition, ScriptCallStack* callStack)
return;
// FIXME: <https://bugs.webkit.org/show_bug.cgi?id=19135> It would be nice to prefix assertion failures with a message like "Assertion failed: ".
- addMessage(ErrorMessageLevel, callStack, true);
+ addMessage(LogMessageType, ErrorMessageLevel, callStack, true);
}
void Console::count(ScriptCallStack* callStack)
@@ -349,7 +338,7 @@ void Console::timeEnd(const String& title, ScriptCallStack* callStack)
String message = title + String::format(": %.0fms", elapsed);
const ScriptCallFrame& lastCaller = callStack->at(0);
- page->inspectorController()->addMessageToConsole(JSMessageSource, LogMessageLevel, message, lastCaller.lineNumber(), lastCaller.sourceURL().string());
+ page->inspectorController()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lastCaller.lineNumber(), lastCaller.sourceURL().string());
}
void Console::group(ScriptCallStack* callStack)
@@ -372,7 +361,7 @@ void Console::groupEnd()
void Console::warn(ScriptCallStack* callStack)
{
- addMessage(WarningMessageLevel, callStack);
+ addMessage(LogMessageType, WarningMessageLevel, callStack);
}
static bool printExceptions = false;
diff --git a/src/3rdparty/webkit/WebCore/page/Console.h b/src/3rdparty/webkit/WebCore/page/Console.h
index 79396ea..64e596d 100644
--- a/src/3rdparty/webkit/WebCore/page/Console.h
+++ b/src/3rdparty/webkit/WebCore/page/Console.h
@@ -59,16 +59,19 @@ namespace WebCore {
OtherMessageSource
};
+ enum MessageType {
+ LogMessageType,
+ ObjectMessageType,
+ TraceMessageType,
+ StartGroupMessageType,
+ EndGroupMessageType
+ };
+
enum MessageLevel {
TipMessageLevel,
LogMessageLevel,
WarningMessageLevel,
- ErrorMessageLevel,
- // FIXME: the remaining levels should become a new MessageType enum.
- ObjectMessageLevel,
- TraceMessageLevel,
- StartGroupMessageLevel,
- EndGroupMessageLevel
+ ErrorMessageLevel
};
class Console : public RefCounted<Console> {
@@ -78,7 +81,7 @@ namespace WebCore {
Frame* frame() const;
void disconnectFrame();
- void addMessage(MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+ void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
void debug(ScriptCallStack*);
void error(ScriptCallStack*);
@@ -108,7 +111,7 @@ namespace WebCore {
private:
inline Page* page() const;
- void addMessage(MessageLevel, ScriptCallStack*, bool acceptNoArguments = false);
+ void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false);
Console(Frame*);
diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp
index eb1981c..8e64fe3 100644
--- a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp
+++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp
@@ -634,7 +634,7 @@ void DOMWindow::postMessageTimerFired(PostMessageTimer* t)
if (!timer->targetOrigin()->isSameSchemeHostPort(document()->securityOrigin())) {
String message = String::format("Unable to post message to %s. Recipient has origin %s.\n",
timer->targetOrigin()->toString().utf8().data(), document()->securityOrigin()->toString().utf8().data());
- console()->addMessage(JSMessageSource, ErrorMessageLevel, message, 0, String());
+ console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 0, String());
return;
}
}
diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl
index 942facc..bfdebd4 100644
--- a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl
+++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl
@@ -349,8 +349,9 @@ module window {
attribute HTMLBodyElementConstructor HTMLBodyElement;
attribute HTMLButtonElementConstructor HTMLButtonElement;
attribute HTMLCanvasElementConstructor HTMLCanvasElement;
- attribute HTMLDataGridElementConstructor HTMLDataGridElement;
- attribute HTMLDataGridColElementConstructor HTMLDataGridColElement;
+ attribute [Conditional=DATAGRID] HTMLDataGridElementConstructor HTMLDataGridElement;
+ attribute [Conditional=DATAGRID] HTMLDataGridCellElementConstructor HTMLDataGridCellElement;
+ attribute [Conditional=DATAGRID] HTMLDataGridColElementConstructor HTMLDataGridColElement;
attribute HTMLDListElementConstructor HTMLDListElement;
attribute HTMLDirectoryElementConstructor HTMLDirectoryElement;
attribute HTMLDivElementConstructor HTMLDivElement;
@@ -460,6 +461,10 @@ module window {
attribute [JSCCustomGetter] WorkerConstructor Worker; // Usable with the new operator
#endif
+#if defined(ENABLE_SHARED_WORKERS) && ENABLE_SHARED_WORKERS
+ attribute [JSCCustomGetter] SharedWorkerConstructor SharedWorker; // Usable with the new operator
+#endif
+
attribute PluginConstructor Plugin;
attribute PluginArrayConstructor PluginArray;
diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
index 8f0b420..3f0296e 100644
--- a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
+++ b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
@@ -154,6 +154,8 @@ EventHandler::EventHandler(Frame* frame)
, m_capturingMouseEventsNode(0)
, m_clickCount(0)
, m_mouseDownTimestamp(0)
+ , m_useLatchedWheelEventNode(false)
+ , m_widgetIsLatched(false)
#if PLATFORM(MAC)
, m_mouseDownView(nil)
, m_sendingEventToSubview(false)
@@ -193,6 +195,7 @@ void EventHandler::clear()
m_mousePressed = false;
m_capturesDragging = false;
m_capturingMouseEventsNode = 0;
+ m_latchedWheelEventNode = 0;
}
void EventHandler::selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults& result)
@@ -395,7 +398,7 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect ||
(m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNode->renderBox()->canBeProgramaticallyScrolled(true));
- return swallowEvent;
+ return swallowEvent;
}
bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event)
@@ -766,7 +769,7 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all
result = widgetHitTestResult;
if (testScrollbars == ShouldHitTestScrollbars) {
- Scrollbar* eventScrollbar = view->scrollbarUnderPoint(point);
+ Scrollbar* eventScrollbar = view->scrollbarAtPoint(point);
if (eventScrollbar)
result.setScrollbar(eventScrollbar);
}
@@ -967,7 +970,7 @@ Cursor EventHandler::selectCursor(const MouseEventWithHitTestResults& event, Scr
// If the link is editable, then we need to check the settings to see whether or not the link should be followed
if (editable) {
ASSERT(m_frame->settings());
- switch(m_frame->settings()->editableLinkBehavior()) {
+ switch (m_frame->settings()->editableLinkBehavior()) {
default:
case EditableLinkDefaultBehavior:
case EditableLinkAlwaysLive:
@@ -1159,7 +1162,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
invalidateClick();
return true;
}
- }
+ }
#endif
m_clickCount = mouseEvent.clickCount();
@@ -1205,7 +1208,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
}
FrameView* view = m_frame->view();
- Scrollbar* scrollbar = view ? view->scrollbarUnderPoint(mouseEvent.pos()) : 0;
+ Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mouseEvent.pos()) : 0;
if (!scrollbar)
scrollbar = mev.scrollbar();
if (scrollbar && passMousePressEventToScrollbar(mev, scrollbar))
@@ -1297,7 +1300,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi
// Send events right to a scrollbar if the mouse is pressed.
if (m_lastScrollbarUnderMouse && m_mousePressed)
- return m_lastScrollbarUnderMouse->mouseMoved(m_lastScrollbarUnderMouse->transformEvent(mouseEvent));
+ return m_lastScrollbarUnderMouse->mouseMoved(mouseEvent);
// Treat mouse move events while the mouse is pressed as "read-only" in prepareMouseEvent
// if we are allowed to select.
@@ -1319,7 +1322,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi
m_resizeLayer->resize(mouseEvent, m_offsetFromResizeCorner);
else {
if (FrameView* view = m_frame->view())
- scrollbar = view->scrollbarUnderPoint(mouseEvent.pos());
+ scrollbar = view->scrollbarAtPoint(mouseEvent.pos());
if (!scrollbar)
scrollbar = mev.scrollbar();
@@ -1349,7 +1352,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi
swallowEvent |= passMouseMoveEventToSubframe(mev, newSubframe.get(), hoveredNode);
} else {
if (scrollbar && !m_mousePressed)
- scrollbar->mouseMoved(scrollbar->transformEvent(mouseEvent)); // Handle hover effects on platforms that support visual feedback on scrollbar hovering.
+ scrollbar->mouseMoved(mouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering.
if (Page* page = m_frame->page()) {
if ((!m_resizeLayer || !m_resizeLayer->inResizeMode()) && !page->mainFrame()->eventHandler()->panScrollInProgress()) {
if (FrameView* view = m_frame->view())
@@ -1715,16 +1718,38 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
return false;
IntPoint vPoint = view->windowToContents(e.pos());
- HitTestRequest request(HitTestRequest::ReadOnly);
- HitTestResult result(vPoint);
- doc->renderView()->layer()->hitTest(request, result);
- Node* node = result.innerNode();
+ Node* node;
+ bool isOverWidget;
+ bool didSetLatchedNode = false;
+
+ if (m_useLatchedWheelEventNode) {
+ if (!m_latchedWheelEventNode) {
+ HitTestRequest request(HitTestRequest::ReadOnly);
+ HitTestResult result(vPoint);
+ doc->renderView()->layer()->hitTest(request, result);
+ m_latchedWheelEventNode = result.innerNode();
+ m_widgetIsLatched = result.isOverWidget();
+ didSetLatchedNode = true;
+ }
+
+ node = m_latchedWheelEventNode.get();
+ isOverWidget = m_widgetIsLatched;
+ } else {
+ if (m_latchedWheelEventNode)
+ m_latchedWheelEventNode = 0;
+
+ HitTestRequest request(HitTestRequest::ReadOnly);
+ HitTestResult result(vPoint);
+ doc->renderView()->layer()->hitTest(request, result);
+ node = result.innerNode();
+ isOverWidget = result.isOverWidget();
+ }
if (node) {
// Figure out which view to send the event to.
RenderObject* target = node->renderer();
- if (result.isOverWidget() && target && target->isWidget()) {
+ if (isOverWidget && target && target->isWidget()) {
Widget* widget = static_cast<RenderWidget*>(target)->widget();
if (widget && passWheelEventToWidget(e, widget)) {
@@ -2027,7 +2052,7 @@ void EventHandler::handleKeyboardSelectionMovement(KeyboardEvent* event)
void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
{
- if (event->type() == eventNames().keydownEvent) {
+ if (event->type() == eventNames().keydownEvent) {
m_frame->editor()->handleKeyboardEvent(event);
if (event->defaultHandled())
return;
@@ -2037,14 +2062,14 @@ void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
// provides KB navigation and selection for enhanced accessibility users
if (AXObjectCache::accessibilityEnhancedUserInterfaceEnabled())
handleKeyboardSelectionMovement(event);
- }
- if (event->type() == eventNames().keypressEvent) {
+ }
+ if (event->type() == eventNames().keypressEvent) {
m_frame->editor()->handleKeyboardEvent(event);
if (event->defaultHandled())
return;
if (event->charCode() == ' ')
defaultSpaceEventHandler(event);
- }
+ }
}
bool EventHandler::dragHysteresisExceeded(const FloatPoint& floatDragViewportLocation) const
@@ -2102,6 +2127,9 @@ void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperat
}
freeClipboard();
dragState().m_dragSrc = 0;
+ // In case the drag was ended due to an escape key press we need to ensure
+ // that consecutive mousemove events don't reinitiate the drag and drop.
+ m_mouseDownMayStartDrag = false;
}
// returns if we should continue "default processing", i.e., whether eventhandler canceled
diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.h b/src/3rdparty/webkit/WebCore/page/EventHandler.h
index f76716e..d5c0b97 100644
--- a/src/3rdparty/webkit/WebCore/page/EventHandler.h
+++ b/src/3rdparty/webkit/WebCore/page/EventHandler.h
@@ -332,6 +332,10 @@ private:
double m_mouseDownTimestamp;
PlatformMouseEvent m_mouseDown;
+ bool m_useLatchedWheelEventNode;
+ RefPtr<Node> m_latchedWheelEventNode;
+ bool m_widgetIsLatched;
+
#if PLATFORM(MAC)
NSView *m_mouseDownView;
bool m_sendingEventToSubview;
diff --git a/src/3rdparty/webkit/WebCore/page/FocusController.cpp b/src/3rdparty/webkit/WebCore/page/FocusController.cpp
index 8dad846..817801c 100644
--- a/src/3rdparty/webkit/WebCore/page/FocusController.cpp
+++ b/src/3rdparty/webkit/WebCore/page/FocusController.cpp
@@ -58,6 +58,7 @@ using namespace HTMLNames;
FocusController::FocusController(Page* page)
: m_page(page)
, m_isActive(false)
+ , m_isFocused(false)
{
}
@@ -66,16 +67,20 @@ void FocusController::setFocusedFrame(PassRefPtr<Frame> frame)
if (m_focusedFrame == frame)
return;
- if (m_focusedFrame && m_focusedFrame->view()) {
- m_focusedFrame->selection()->setFocused(false);
- m_focusedFrame->document()->dispatchWindowEvent(eventNames().blurEvent, false, false);
- }
+ RefPtr<Frame> oldFrame = m_focusedFrame;
+ RefPtr<Frame> newFrame = frame;
- m_focusedFrame = frame;
+ m_focusedFrame = newFrame;
- if (m_focusedFrame && m_focusedFrame->view()) {
- m_focusedFrame->selection()->setFocused(true);
- m_focusedFrame->document()->dispatchWindowEvent(eventNames().focusEvent, false, false);
+ // Now that the frame is updated, fire events and update the selection focused states of both frames.
+ if (oldFrame && oldFrame->view()) {
+ oldFrame->selection()->setFocused(false);
+ oldFrame->document()->dispatchWindowEvent(eventNames().blurEvent, false, false);
+ }
+
+ if (newFrame && newFrame->view() && isFocused()) {
+ newFrame->selection()->setFocused(true);
+ newFrame->document()->dispatchWindowEvent(eventNames().focusEvent, false, false);
}
}
@@ -86,6 +91,19 @@ Frame* FocusController::focusedOrMainFrame()
return m_page->mainFrame();
}
+void FocusController::setFocused(bool focused)
+{
+ if (isFocused() == focused)
+ return;
+
+ m_isFocused = focused;
+
+ if (m_focusedFrame && m_focusedFrame->view()) {
+ m_focusedFrame->selection()->setFocused(focused);
+ m_focusedFrame->document()->dispatchWindowEvent(focused ? eventNames().focusEvent : eventNames().blurEvent, false, false);
+ }
+}
+
static Node* deepFocusableNode(FocusDirection direction, Node* node, KeyboardEvent* event)
{
// The node we found might be a HTMLFrameOwnerElement, so descend down the frame tree until we find either:
@@ -322,7 +340,7 @@ void FocusController::setActive(bool active)
focusedOrMainFrame()->selection()->pageActivationChanged();
- if (m_focusedFrame)
+ if (m_focusedFrame && isFocused())
m_focusedFrame->document()->dispatchWindowEvent(active ? eventNames().focusEvent : eventNames().blurEvent, false, false);
}
diff --git a/src/3rdparty/webkit/WebCore/page/FocusController.h b/src/3rdparty/webkit/WebCore/page/FocusController.h
index f4a6632..33debf1 100644
--- a/src/3rdparty/webkit/WebCore/page/FocusController.h
+++ b/src/3rdparty/webkit/WebCore/page/FocusController.h
@@ -53,10 +53,14 @@ namespace WebCore {
void setActive(bool);
bool isActive() const { return m_isActive; }
+ void setFocused(bool);
+ bool isFocused() const { return m_isFocused; }
+
private:
Page* m_page;
RefPtr<Frame> m_focusedFrame;
bool m_isActive;
+ bool m_isFocused;
};
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/page/Frame.cpp b/src/3rdparty/webkit/WebCore/page/Frame.cpp
index 8905bd9..870bd2a 100644
--- a/src/3rdparty/webkit/WebCore/page/Frame.cpp
+++ b/src/3rdparty/webkit/WebCore/page/Frame.cpp
@@ -793,7 +793,7 @@ String Frame::jsStatusBarText() const
String Frame::jsDefaultStatusBarText() const
{
- return m_kjsDefaultStatusBarText;
+ return m_kjsDefaultStatusBarText;
}
void Frame::setNeedsReapplyStyles()
@@ -1771,7 +1771,7 @@ void Frame::createView(const IntSize& viewportSize,
frameView->setParentVisible(true);
if (ownerRenderer())
- ownerRenderer()->setWidget(frameView.get());
+ ownerRenderer()->setWidget(frameView);
if (HTMLFrameOwnerElement* owner = ownerElement())
view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOff);
diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.cpp b/src/3rdparty/webkit/WebCore/page/FrameView.cpp
index 41f2c5c..d57e845 100644
--- a/src/3rdparty/webkit/WebCore/page/FrameView.cpp
+++ b/src/3rdparty/webkit/WebCore/page/FrameView.cpp
@@ -111,7 +111,6 @@ FrameView::FrameView(Frame* frame)
, m_shouldUpdateWhileOffscreen(true)
, m_deferSetNeedsLayouts(0)
, m_setNeedsLayoutWasDeferred(false)
- , m_lockedToAnchor(false)
{
init();
}
@@ -185,7 +184,7 @@ void FrameView::reset()
m_isPainting = false;
m_isVisuallyNonEmpty = false;
m_firstVisuallyNonEmptyLayoutCallbackPending = true;
- m_lockedToAnchor = false;
+ m_maintainScrollPositionAnchor = 0;
}
bool FrameView::isFrameView() const
@@ -417,20 +416,18 @@ void FrameView::applyOverflowToViewport(RenderObject* o, ScrollbarMode& hMode, S
}
#if USE(ACCELERATED_COMPOSITING)
-void FrameView::updateCompositingLayers(CompositingUpdate updateType)
+void FrameView::updateCompositingLayers()
{
RenderView* view = m_frame->contentRenderer();
- if (view && view->compositor()) {
- // This call will make sure the cached hasAcceleratedCompositing is updated from the pref
- view->compositor()->cacheAcceleratedCompositingEnabledFlag();
- }
-
- if (!view || !view->usesCompositing())
+ if (!view)
return;
- if (updateType == ForcedCompositingUpdate)
- view->compositor()->setCompositingLayersNeedUpdate();
+ // This call will make sure the cached hasAcceleratedCompositing is updated from the pref
+ view->compositor()->cacheAcceleratedCompositingEnabledFlag();
+ if (!view->usesCompositing())
+ return;
+
view->compositor()->updateCompositingLayers();
}
@@ -624,7 +621,9 @@ void FrameView::layout(bool allowSubtree)
// Now update the positions of all layers.
beginDeferredRepaints();
- layer->updateLayerPositions(m_doFullRepaint);
+ layer->updateLayerPositions((m_doFullRepaint ? RenderLayer::DoFullRepaint : 0)
+ | RenderLayer::CheckForRepaint
+ | RenderLayer::UpdateCompositingLayers);
endDeferredRepaints();
#if USE(ACCELERATED_COMPOSITING)
@@ -666,9 +665,6 @@ void FrameView::layout(bool allowSubtree)
ASSERT(m_enqueueEvents);
}
- if (lockedToAnchor())
- m_frame->loader()->gotoAnchor();
-
m_nestedLayoutCount--;
}
@@ -751,11 +747,27 @@ void FrameView::restoreScrollbar()
setScrollbarsSuppressed(false);
}
+void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode)
+{
+ m_maintainScrollPositionAnchor = anchorNode;
+ if (!m_maintainScrollPositionAnchor)
+ return;
+
+ // We need to update the layout before scrolling, otherwise we could
+ // really mess things up if an anchor scroll comes at a bad moment.
+ m_frame->document()->updateStyleIfNeeded();
+ // Only do a layout if changes have occurred that make it necessary.
+ if (m_frame->contentRenderer() && m_frame->contentRenderer()->needsLayout())
+ layout();
+ else
+ scrollToAnchor();
+}
+
void FrameView::scrollRectIntoViewRecursively(const IntRect& r)
{
bool wasInProgrammaticScroll = m_inProgrammaticScroll;
m_inProgrammaticScroll = true;
- setLockedToAnchor(false);
+ m_maintainScrollPositionAnchor = 0;
ScrollView::scrollRectIntoViewRecursively(r);
m_inProgrammaticScroll = wasInProgrammaticScroll;
}
@@ -764,7 +776,7 @@ void FrameView::setScrollPosition(const IntPoint& scrollPoint)
{
bool wasInProgrammaticScroll = m_inProgrammaticScroll;
m_inProgrammaticScroll = true;
- setLockedToAnchor(false);
+ m_maintainScrollPositionAnchor = 0;
ScrollView::setScrollPosition(scrollPoint);
m_inProgrammaticScroll = wasInProgrammaticScroll;
}
@@ -1118,6 +1130,27 @@ void FrameView::resumeScheduledEvents()
ASSERT(m_scheduledEvents.isEmpty() || m_enqueueEvents);
}
+void FrameView::scrollToAnchor()
+{
+ RefPtr<Node> anchorNode = m_maintainScrollPositionAnchor;
+ if (!anchorNode)
+ return;
+
+ if (!anchorNode->renderer())
+ return;
+
+ IntRect rect;
+ if (anchorNode != m_frame->document())
+ rect = anchorNode->getRect();
+
+ // Scroll nested layers and frames to reveal the anchor.
+ // Align to the top and to the closest side (this matches other browsers).
+ anchorNode->renderer()->enclosingLayer()->scrollRectToVisible(rect, true, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways);
+
+ // scrollRectToVisible can call into scrollRectIntoViewRecursively(), which resets m_maintainScrollPositionAnchor.
+ m_maintainScrollPositionAnchor = anchorNode;
+}
+
bool FrameView::updateWidgets()
{
if (m_nestedLayoutCount > 1 || !m_widgetUpdateSet || m_widgetUpdateSet->isEmpty())
@@ -1161,7 +1194,9 @@ void FrameView::performPostLayoutTasks()
if (updateWidgets())
break;
}
-
+
+ scrollToAnchor();
+
resumeScheduledEvents();
if (!root->printing()) {
@@ -1351,7 +1386,7 @@ void FrameView::setWasScrolledByUser(bool wasScrolledByUser)
{
if (m_inProgrammaticScroll)
return;
- setLockedToAnchor(false);
+ m_maintainScrollPositionAnchor = 0;
m_wasScrolledByUser = wasScrolledByUser;
}
@@ -1447,11 +1482,13 @@ void FrameView::layoutIfNeededRecursive()
if (needsLayout())
layout();
- const HashSet<Widget*>* viewChildren = children();
- HashSet<Widget*>::const_iterator end = viewChildren->end();
- for (HashSet<Widget*>::const_iterator current = viewChildren->begin(); current != end; ++current)
- if ((*current)->isFrameView())
- static_cast<FrameView*>(*current)->layoutIfNeededRecursive();
+ const HashSet<RefPtr<Widget> >* viewChildren = children();
+ HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end();
+ for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) {
+ Widget* widget = (*current).get();
+ if (widget->isFrameView())
+ static_cast<FrameView*>(widget)->layoutIfNeededRecursive();
+ }
// layoutIfNeededRecursive is called when we need to make sure layout is up-to-date before
// painting, so we need to flush out any deferred repaints too.
@@ -1517,4 +1554,142 @@ void FrameView::adjustPageHeight(float *newBottom, float oldTop, float oldBottom
*newBottom = oldBottom;
}
+IntRect FrameView::convertFromRenderer(const RenderObject* renderer, const IntRect& rendererRect) const
+{
+ IntRect rect = renderer->localToAbsoluteQuad(FloatRect(rendererRect)).enclosingBoundingBox();
+
+ // Convert from page ("absolute") to FrameView coordinates.
+ rect.move(-scrollX(), -scrollY());
+
+ return rect;
+}
+
+IntRect FrameView::convertToRenderer(const RenderObject* renderer, const IntRect& viewRect) const
+{
+ IntRect rect = viewRect;
+
+ // Convert from FrameView coords into page ("absolute") coordinates.
+ rect.move(scrollX(), scrollY());
+
+ // FIXME: we don't have a way to map an absolute rect down to a local quad, so just
+ // move the rect for now.
+ rect.setLocation(roundedIntPoint(renderer->absoluteToLocal(rect.location(), false, true /* use transforms */)));
+ return rect;
+}
+
+IntPoint FrameView::convertFromRenderer(const RenderObject* renderer, const IntPoint& rendererPoint) const
+{
+ IntPoint point = roundedIntPoint(renderer->localToAbsolute(rendererPoint, false, true /* use transforms */));
+
+ // Convert from page ("absolute") to FrameView coordinates.
+ point.move(-scrollX(), -scrollY());
+ return point;
+}
+
+IntPoint FrameView::convertToRenderer(const RenderObject* renderer, const IntPoint& viewPoint) const
+{
+ IntPoint point = viewPoint;
+
+ // Convert from FrameView coords into page ("absolute") coordinates.
+ point += IntSize(scrollX(), scrollY());
+
+ return roundedIntPoint(renderer->absoluteToLocal(point, false, true /* use transforms */));
+}
+
+IntRect FrameView::convertToContainingView(const IntRect& localRect) const
+{
+ if (const ScrollView* parentScrollView = parent()) {
+ if (parentScrollView->isFrameView()) {
+ const FrameView* parentView = static_cast<const FrameView*>(parentScrollView);
+ // Get our renderer in the parent view
+ RenderPart* renderer = m_frame->ownerRenderer();
+ if (!renderer)
+ return localRect;
+
+ IntRect rect(localRect);
+ // Add borders and padding??
+ rect.move(renderer->borderLeft() + renderer->paddingLeft(),
+ renderer->borderTop() + renderer->paddingTop());
+ return parentView->convertFromRenderer(renderer, rect);
+ }
+
+ return Widget::convertToContainingView(localRect);
+ }
+
+ return localRect;
+}
+
+IntRect FrameView::convertFromContainingView(const IntRect& parentRect) const
+{
+ if (const ScrollView* parentScrollView = parent()) {
+ if (parentScrollView->isFrameView()) {
+ const FrameView* parentView = static_cast<const FrameView*>(parentScrollView);
+
+ // Get our renderer in the parent view
+ RenderPart* renderer = m_frame->ownerRenderer();
+ if (!renderer)
+ return parentRect;
+
+ IntRect rect = parentView->convertToRenderer(renderer, parentRect);
+ // Subtract borders and padding
+ rect.move(-renderer->borderLeft() - renderer->paddingLeft(),
+ -renderer->borderTop() - renderer->paddingTop());
+ return rect;
+ }
+
+ return Widget::convertFromContainingView(parentRect);
+ }
+
+ return parentRect;
+}
+
+IntPoint FrameView::convertToContainingView(const IntPoint& localPoint) const
+{
+ if (const ScrollView* parentScrollView = parent()) {
+ if (parentScrollView->isFrameView()) {
+ const FrameView* parentView = static_cast<const FrameView*>(parentScrollView);
+
+ // Get our renderer in the parent view
+ RenderPart* renderer = m_frame->ownerRenderer();
+ if (!renderer)
+ return localPoint;
+
+ IntPoint point(localPoint);
+
+ // Add borders and padding
+ point.move(renderer->borderLeft() + renderer->paddingLeft(),
+ renderer->borderTop() + renderer->paddingTop());
+ return parentView->convertFromRenderer(renderer, point);
+ }
+
+ return Widget::convertToContainingView(localPoint);
+ }
+
+ return localPoint;
+}
+
+IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const
+{
+ if (const ScrollView* parentScrollView = parent()) {
+ if (parentScrollView->isFrameView()) {
+ const FrameView* parentView = static_cast<const FrameView*>(parentScrollView);
+
+ // Get our renderer in the parent view
+ RenderPart* renderer = m_frame->ownerRenderer();
+ if (!renderer)
+ return parentPoint;
+
+ IntPoint point = parentView->convertToRenderer(renderer, parentPoint);
+ // Subtract borders and padding
+ point.move(-renderer->borderLeft() - renderer->paddingLeft(),
+ -renderer->borderTop() - renderer->paddingTop());
+ return point;
+ }
+
+ return Widget::convertFromContainingView(parentPoint);
+ }
+
+ return parentPoint;
+}
+
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.h b/src/3rdparty/webkit/WebCore/page/FrameView.h
index 9dabe56..8eee5b8 100644
--- a/src/3rdparty/webkit/WebCore/page/FrameView.h
+++ b/src/3rdparty/webkit/WebCore/page/FrameView.h
@@ -48,7 +48,7 @@ class String;
template <typename T> class Timer;
-class FrameView : public ScrollView, public RefCounted<FrameView> {
+class FrameView : public ScrollView {
public:
friend class RenderView;
@@ -93,8 +93,7 @@ public:
bool needsFullRepaint() const { return m_doFullRepaint; }
#if USE(ACCELERATED_COMPOSITING)
- enum CompositingUpdate { NormalCompositingUpdate, ForcedCompositingUpdate };
- void updateCompositingLayers(CompositingUpdate updateType = NormalCompositingUpdate);
+ void updateCompositingLayers();
// Called when changes to the GraphicsLayer hierarchy have to be synchronized with
// content rendered via the normal painting path.
@@ -126,11 +125,6 @@ public:
virtual IntRect windowClipRect(bool clipToContents = true) const;
IntRect windowClipRectForLayer(const RenderLayer*, bool clipToLayerContents) const;
- virtual bool isActive() const;
- virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
- virtual void valueChanged(Scrollbar*);
- virtual void getTickmarks(Vector<IntRect>&) const;
-
virtual IntRect windowResizerRect() const;
virtual void scrollRectIntoViewRecursively(const IntRect&);
@@ -185,9 +179,13 @@ public:
void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit);
- bool lockedToAnchor() { return m_lockedToAnchor; }
- void setLockedToAnchor(bool lockedToAnchor) { m_lockedToAnchor = lockedToAnchor; }
+ void maintainScrollPositionAtAnchor(Node*);
+ // Methods to convert points and rects between the coordinate space of the renderer, and this view.
+ virtual IntRect convertFromRenderer(const RenderObject*, const IntRect&) const;
+ virtual IntRect convertToRenderer(const RenderObject*, const IntRect&) const;
+ virtual IntPoint convertFromRenderer(const RenderObject*, const IntPoint&) const;
+ virtual IntPoint convertToRenderer(const RenderObject*, const IntPoint&) const;
private:
FrameView(Frame*);
@@ -215,12 +213,26 @@ private:
layout();
}
+ // Override ScrollView methods to do point conversion via renderers, in order to
+ // take transforms into account.
+ virtual IntRect convertToContainingView(const IntRect&) const;
+ virtual IntRect convertFromContainingView(const IntRect&) const;
+ virtual IntPoint convertToContainingView(const IntPoint&) const;
+ virtual IntPoint convertFromContainingView(const IntPoint&) const;
+
+ // ScrollBarClient interface
+ virtual void valueChanged(Scrollbar*);
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
+ virtual bool isActive() const;
+ virtual void getTickmarks(Vector<IntRect>&) const;
+
void deferredRepaintTimerFired(Timer<FrameView>*);
void doDeferredRepaints();
void updateDeferredRepaintDelay();
double adjustedDeferredRepaintDelay() const;
bool updateWidgets();
+ void scrollToAnchor();
static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache
@@ -290,7 +302,7 @@ private:
bool m_isVisuallyNonEmpty;
bool m_firstVisuallyNonEmptyLayoutCallbackPending;
- bool m_lockedToAnchor;
+ RefPtr<Node> m_maintainScrollPositionAnchor;
};
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/page/MouseEventWithHitTestResults.h b/src/3rdparty/webkit/WebCore/page/MouseEventWithHitTestResults.h
index c4e419c..7330d93 100644
--- a/src/3rdparty/webkit/WebCore/page/MouseEventWithHitTestResults.h
+++ b/src/3rdparty/webkit/WebCore/page/MouseEventWithHitTestResults.h
@@ -28,7 +28,6 @@ namespace WebCore {
class Scrollbar;
-// FIXME: Why doesn't this class just cache a HitTestResult instead of copying all of HitTestResult's fields over?
class MouseEventWithHitTestResults {
public:
MouseEventWithHitTestResults(const PlatformMouseEvent&, const HitTestResult&);
@@ -46,6 +45,6 @@ private:
HitTestResult m_hitTestResult;
};
-}
+} // namespace WebCore
-#endif
+#endif // MouseEventWithHitTestResults_h
diff --git a/src/3rdparty/webkit/WebCore/page/Settings.cpp b/src/3rdparty/webkit/WebCore/page/Settings.cpp
index 7a15163..6f8b7c7 100644
--- a/src/3rdparty/webkit/WebCore/page/Settings.cpp
+++ b/src/3rdparty/webkit/WebCore/page/Settings.cpp
@@ -75,6 +75,7 @@ Settings::Settings(Page* page)
#endif
, m_needsAdobeFrameReloadingQuirk(false)
, m_needsKeyboardEventDisambiguationQuirks(false)
+ , m_treatsAnyTextCSSLinkAsStylesheet(false)
, m_needsLeopardMailQuirks(false)
, m_needsTigerMailQuirks(false)
, m_isDOMPasteAllowed(false)
@@ -87,6 +88,7 @@ Settings::Settings(Page* page)
, m_needsSiteSpecificQuirks(false)
, m_fontRenderingMode(0)
, m_webArchiveDebugModeEnabled(false)
+ , m_localFileContentSniffingEnabled(false)
, m_inApplicationChromeMode(false)
, m_offlineWebApplicationCacheEnabled(false)
, m_shouldPaintCustomScrollbars(false)
@@ -314,6 +316,11 @@ void Settings::setNeedsKeyboardEventDisambiguationQuirks(bool needsQuirks)
m_needsKeyboardEventDisambiguationQuirks = needsQuirks;
}
+void Settings::setTreatsAnyTextCSSLinkAsStylesheet(bool treatsAnyTextCSSLinkAsStylesheet)
+{
+ m_treatsAnyTextCSSLinkAsStylesheet = treatsAnyTextCSSLinkAsStylesheet;
+}
+
void Settings::setNeedsLeopardMailQuirks(bool needsQuirks)
{
m_needsLeopardMailQuirks = needsQuirks;
@@ -400,6 +407,11 @@ void Settings::setWebArchiveDebugModeEnabled(bool enabled)
m_webArchiveDebugModeEnabled = enabled;
}
+void Settings::setLocalFileContentSniffingEnabled(bool enabled)
+{
+ m_localFileContentSniffingEnabled = enabled;
+}
+
void Settings::setLocalStorageDatabasePath(const String& path)
{
m_localStorageDatabasePath = path;
diff --git a/src/3rdparty/webkit/WebCore/page/Settings.h b/src/3rdparty/webkit/WebCore/page/Settings.h
index 4b9b40a..962af18 100644
--- a/src/3rdparty/webkit/WebCore/page/Settings.h
+++ b/src/3rdparty/webkit/WebCore/page/Settings.h
@@ -163,6 +163,9 @@ namespace WebCore {
void setNeedsKeyboardEventDisambiguationQuirks(bool);
bool needsKeyboardEventDisambiguationQuirks() const { return m_needsKeyboardEventDisambiguationQuirks; }
+ void setTreatsAnyTextCSSLinkAsStylesheet(bool);
+ bool treatsAnyTextCSSLinkAsStylesheet() const { return m_treatsAnyTextCSSLinkAsStylesheet; }
+
void setNeedsLeopardMailQuirks(bool);
bool needsLeopardMailQuirks() const { return m_needsLeopardMailQuirks; }
@@ -202,6 +205,9 @@ namespace WebCore {
void setWebArchiveDebugModeEnabled(bool);
bool webArchiveDebugModeEnabled() const { return m_webArchiveDebugModeEnabled; }
+ void setLocalFileContentSniffingEnabled(bool);
+ bool localFileContentSniffingEnabled() const { return m_localFileContentSniffingEnabled; }
+
void setLocalStorageDatabasePath(const String&);
const String& localStorageDatabasePath() const { return m_localStorageDatabasePath; }
@@ -282,6 +288,7 @@ namespace WebCore {
#endif
bool m_needsAdobeFrameReloadingQuirk : 1;
bool m_needsKeyboardEventDisambiguationQuirks : 1;
+ bool m_treatsAnyTextCSSLinkAsStylesheet : 1;
bool m_needsLeopardMailQuirks : 1;
bool m_needsTigerMailQuirks : 1;
bool m_isDOMPasteAllowed : 1;
@@ -294,6 +301,7 @@ namespace WebCore {
bool m_needsSiteSpecificQuirks : 1;
unsigned m_fontRenderingMode : 1;
bool m_webArchiveDebugModeEnabled : 1;
+ bool m_localFileContentSniffingEnabled : 1;
bool m_inApplicationChromeMode : 1;
bool m_offlineWebApplicationCacheEnabled : 1;
bool m_shouldPaintCustomScrollbars : 1;
diff --git a/src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp b/src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp
index f8a2f40..5dfc963 100644
--- a/src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp
+++ b/src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp
@@ -28,6 +28,7 @@
#include "XSSAuditor.h"
#include <wtf/StdLibExtras.h>
+#include <wtf/Vector.h>
#include "Console.h"
#include "CString.h"
@@ -35,6 +36,7 @@
#include "DOMWindow.h"
#include "Frame.h"
#include "KURL.h"
+#include "PreloadScanner.h"
#include "ResourceResponseBase.h"
#include "ScriptSourceCode.h"
#include "Settings.h"
@@ -44,6 +46,11 @@ using namespace WTF;
namespace WebCore {
+static bool isNonNullControlCharacter(UChar c)
+{
+ return (c > '\0' && c < ' ') || c == 127;
+}
+
XSSAuditor::XSSAuditor(Frame* frame)
: m_frame(frame)
{
@@ -64,9 +71,22 @@ bool XSSAuditor::canEvaluate(const String& sourceCode) const
if (!isEnabled())
return true;
- if (findInRequest(sourceCode)) {
+ if (findInRequest(sourceCode, false, true, false)) {
DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
- m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, consoleMessage, 1, String());
+ m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
+ return false;
+ }
+ return true;
+}
+
+bool XSSAuditor::canEvaluateJavaScriptURL(const String& code) const
+{
+ if (!isEnabled())
+ return true;
+
+ if (findInRequest(code, false, false, true, true)) {
+ DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
+ m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
return false;
}
return true;
@@ -77,17 +97,22 @@ bool XSSAuditor::canCreateInlineEventListener(const String&, const String& code)
if (!isEnabled())
return true;
- return canEvaluate(code);
+ if (findInRequest(code)) {
+ DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
+ m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
+ return false;
+ }
+ return true;
}
-bool XSSAuditor::canLoadExternalScriptFromSrc(const String& url) const
+bool XSSAuditor::canLoadExternalScriptFromSrc(const String& context, const String& url) const
{
if (!isEnabled())
return true;
- if (findInRequest(url)) {
+ if (findInRequest(context + url)) {
DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
- m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, consoleMessage, 1, String());
+ m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
return false;
}
return true;
@@ -98,45 +123,113 @@ bool XSSAuditor::canLoadObject(const String& url) const
if (!isEnabled())
return true;
- if (findInRequest(url)) {
+ if (findInRequest(url, false, false)) {
DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request"));
- m_frame->domWindow()->console()->addMessage(OtherMessageSource, ErrorMessageLevel, consoleMessage, 1, String());
+ m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
return false;
}
return true;
}
-String XSSAuditor::decodeURL(const String& str, const TextEncoding& encoding, bool allowControlCharacters)
+bool XSSAuditor::canSetBaseElementURL(const String& url) const
+{
+ if (!isEnabled())
+ return true;
+
+ KURL baseElementURL(m_frame->document()->url(), url);
+ if (m_frame->document()->url().host() != baseElementURL.host() && findInRequest(url)) {
+ DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request"));
+ m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
+ return false;
+ }
+ return true;
+}
+
+String XSSAuditor::decodeURL(const String& str, const TextEncoding& encoding, bool allowNullCharacters,
+ bool allowNonNullControlCharacters, bool decodeHTMLentities, bool leaveUndecodableHTMLEntitiesUntouched)
{
String result;
String url = str;
url.replace('+', ' ');
result = decodeURLEscapeSequences(url);
- if (!allowControlCharacters)
- result.removeCharacters(&isControlCharacter);
- result = encoding.decode(result.utf8().data(), result.length());
- if (!allowControlCharacters)
- result.removeCharacters(&isControlCharacter);
+ String decodedResult = encoding.decode(result.utf8().data(), result.length());
+ if (!decodedResult.isEmpty())
+ result = decodedResult;
+ if (decodeHTMLentities)
+ result = decodeHTMLEntities(result, leaveUndecodableHTMLEntitiesUntouched);
+ if (!allowNullCharacters)
+ result = StringImpl::createStrippingNullCharacters(result.characters(), result.length());
+ if (!allowNonNullControlCharacters) {
+ decodedResult = result.removeCharacters(&isNonNullControlCharacter);
+ if (!decodedResult.isEmpty())
+ result = decodedResult;
+ }
return result;
}
-bool XSSAuditor::findInRequest(const String& string) const
+String XSSAuditor::decodeHTMLEntities(const String& str, bool leaveUndecodableHTMLEntitiesUntouched)
+{
+ SegmentedString source(str);
+ SegmentedString sourceShadow;
+ Vector<UChar> result;
+
+ while (!source.isEmpty()) {
+ UChar cc = *source;
+ source.advance();
+
+ if (cc != '&') {
+ result.append(cc);
+ continue;
+ }
+
+ if (leaveUndecodableHTMLEntitiesUntouched)
+ sourceShadow = source;
+ bool notEnoughCharacters = false;
+ unsigned entity = PreloadScanner::consumeEntity(source, notEnoughCharacters);
+ // We ignore notEnoughCharacters because we might as well use this loop
+ // to copy the remaining characters into |result|.
+
+ if (entity > 0xFFFF) {
+ result.append(U16_LEAD(entity));
+ result.append(U16_TRAIL(entity));
+ } else if (!leaveUndecodableHTMLEntitiesUntouched || entity != 0xFFFD){
+ result.append(entity);
+ } else {
+ result.append('&');
+ if (leaveUndecodableHTMLEntitiesUntouched)
+ source = sourceShadow;
+ }
+ }
+
+ return String::adopt(result);
+}
+
+bool XSSAuditor::findInRequest(const String& string, bool matchNullCharacters, bool matchNonNullControlCharacters,
+ bool decodeHTMLentities, bool leaveUndecodableHTMLEntitiesUntouched) const
{
bool result = false;
Frame* parentFrame = m_frame->tree()->parent();
if (parentFrame && m_frame->document()->url() == blankURL())
- result = findInRequest(parentFrame, string);
+ result = findInRequest(parentFrame, string, matchNullCharacters, matchNonNullControlCharacters,
+ decodeHTMLentities, leaveUndecodableHTMLEntitiesUntouched);
if (!result)
- result = findInRequest(m_frame, string);
+ result = findInRequest(m_frame, string, matchNullCharacters, matchNonNullControlCharacters,
+ decodeHTMLentities, leaveUndecodableHTMLEntitiesUntouched);
return result;
}
-bool XSSAuditor::findInRequest(Frame* frame, const String& string) const
+bool XSSAuditor::findInRequest(Frame* frame, const String& string, bool matchNullCharacters, bool matchNonNullControlCharacters,
+ bool decodeHTMLentities, bool leaveUndecodableHTMLEntitiesUntouched) const
{
ASSERT(frame->document());
String pageURL = frame->document()->url().string();
+ if (!frame->document()->decoder()) {
+ // Note, JavaScript URLs do not have a charset.
+ return false;
+ }
+
if (protocolIs(pageURL, "data"))
return false;
@@ -145,7 +238,8 @@ bool XSSAuditor::findInRequest(Frame* frame, const String& string) const
if (string.length() < pageURL.length()) {
// The string can actually fit inside the pageURL.
- String decodedPageURL = decodeURL(pageURL, frame->document()->decoder()->encoding());
+ String decodedPageURL = decodeURL(pageURL, frame->document()->decoder()->encoding(), matchNullCharacters,
+ matchNonNullControlCharacters, decodeHTMLentities, leaveUndecodableHTMLEntitiesUntouched);
if (decodedPageURL.find(string, 0, false) != -1)
return true; // We've found the smoking gun.
}
@@ -158,7 +252,8 @@ bool XSSAuditor::findInRequest(Frame* frame, const String& string) const
// the url-encoded POST data because the length of the url-decoded
// code is less than or equal to the length of the url-encoded
// string.
- String decodedFormData = decodeURL(formData, frame->document()->decoder()->encoding());
+ String decodedFormData = decodeURL(formData, frame->document()->decoder()->encoding(), matchNullCharacters,
+ matchNonNullControlCharacters, decodeHTMLentities, leaveUndecodableHTMLEntitiesUntouched);
if (decodedFormData.find(string, 0, false) != -1)
return true; // We found the string in the POST data.
}
diff --git a/src/3rdparty/webkit/WebCore/page/XSSAuditor.h b/src/3rdparty/webkit/WebCore/page/XSSAuditor.h
index 7974d1c..6c6a56c 100644
--- a/src/3rdparty/webkit/WebCore/page/XSSAuditor.h
+++ b/src/3rdparty/webkit/WebCore/page/XSSAuditor.h
@@ -74,13 +74,17 @@ namespace WebCore {
// based on the content of any user-submitted data.
bool canEvaluate(const String& sourceCode) const;
+ // Determines whether the JavaScript URL should be allowed or denied execution
+ // based on the content of any user-submitted data.
+ bool canEvaluateJavaScriptURL(const String& code) const;
+
// Determines whether the event listener should be created based on the
// content of any user-submitted data.
bool canCreateInlineEventListener(const String& functionName, const String& code) const;
// Determines whether the external script should be loaded based on the
// content of any user-submitted data.
- bool canLoadExternalScriptFromSrc(const String& url) const;
+ bool canLoadExternalScriptFromSrc(const String& context, const String& url) const;
// Determines whether object should be loaded based on the content of
// any user-submitted data.
@@ -88,12 +92,24 @@ namespace WebCore {
// This method is called by FrameLoader::requestObject.
bool canLoadObject(const String& url) const;
+ // Determines whether the base URL should be changed based on the content
+ // of any user-submitted data.
+ //
+ // This method is called by HTMLBaseElement::process.
+ bool canSetBaseElementURL(const String& url) const;
+
private:
- static String decodeURL(const String& url, const TextEncoding& encoding = UTF8Encoding(), bool allowControlCharacters = false);
+ static String decodeURL(const String& url, const TextEncoding& encoding = UTF8Encoding(), bool allowNullCharacters = false,
+ bool allowNonNullControlCharacters = true, bool decodeHTMLentities = true,
+ bool leaveUndecodableHTMLEntitiesUntouched = false);
+
+ static String decodeHTMLEntities(const String&, bool leaveUndecodableHTMLEntitiesUntouched = false);
- bool findInRequest(const String&) const;
+ bool findInRequest(const String&, bool matchNullCharacters = true, bool matchNonNullControlCharacters = true,
+ bool decodeHTMLentities = true, bool leaveUndecodableHTMLEntitiesUntouched = false) const;
- bool findInRequest(Frame*, const String&) const;
+ bool findInRequest(Frame*, const String&, bool matchNullCharacters = true, bool matchNonNullControlCharacters = true,
+ bool decodeHTMLentities = true, bool leaveUndecodableHTMLEntitiesUntouched = false) const;
// The frame to audit.
Frame* m_frame;
diff --git a/src/3rdparty/webkit/WebCore/page/android/DragControllerAndroid.cpp b/src/3rdparty/webkit/WebCore/page/android/DragControllerAndroid.cpp
index 94c1cbb..19d02c6 100644
--- a/src/3rdparty/webkit/WebCore/page/android/DragControllerAndroid.cpp
+++ b/src/3rdparty/webkit/WebCore/page/android/DragControllerAndroid.cpp
@@ -44,7 +44,7 @@ DragOperation DragController::dragOperation(DragData* dragData)
if (dragData->containsURL())
return DragOperationCopy;
- return DragOperationNone;
+ return DragOperationNone;
}
const float DragController::DragImageAlpha = 1.0f;
diff --git a/src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp b/src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp
index 2464429..c6bce4f 100644
--- a/src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp
+++ b/src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp
@@ -41,7 +41,7 @@ namespace WebCore {
unsigned EventHandler::s_accessKeyModifiers = PlatformKeyboardEvent::AltKey;
-bool EventHandler::tabsToAllControls(KeyboardEvent* ) const
+bool EventHandler::tabsToAllControls(KeyboardEvent*) const
{
return true;
}
@@ -75,7 +75,7 @@ bool EventHandler::passMouseDownEventToWidget(Widget* )
return false;
}
-bool EventHandler::eventActivatedView(const PlatformMouseEvent& ) const
+bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const
{
notImplemented();
return false;
diff --git a/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp b/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp
index 7b8a189..a4916e9 100644
--- a/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp
+++ b/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp
@@ -1041,7 +1041,7 @@ void AnimationBase::getTimeToNextEvent(double& time, bool& isLooping) const
double nextIterationTime = m_totalDuration;
if (m_totalDuration < 0 || elapsedDuration < m_totalDuration) {
- durationLeft = m_animation->duration() - fmod(elapsedDuration, m_animation->duration());
+ durationLeft = m_animation->duration() > 0 ? (m_animation->duration() - fmod(elapsedDuration, m_animation->duration())) : 0;
nextIterationTime = elapsedDuration + durationLeft;
}
diff --git a/src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp b/src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp
index 58a1f5b..ed241e1 100644
--- a/src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp
+++ b/src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp
@@ -136,9 +136,9 @@ void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<Animat
Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = m_eventsToDispatch.end();
for (Vector<EventToDispatch>::const_iterator it = m_eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) {
if (it->eventType == eventNames().webkitTransitionEndEvent)
- it->element->dispatchWebKitTransitionEvent(it->eventType,it->name, it->elapsedTime);
+ it->element->dispatchWebKitTransitionEvent(it->eventType, it->name, it->elapsedTime);
else
- it->element->dispatchWebKitAnimationEvent(it->eventType,it->name, it->elapsedTime);
+ it->element->dispatchWebKitAnimationEvent(it->eventType, it->name, it->elapsedTime);
}
m_eventsToDispatch.clear();
@@ -152,20 +152,6 @@ void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<Animat
if (m_frame)
m_frame->document()->updateStyleIfNeeded();
-
- // We can now safely remove any animations or transitions that are finished.
- // We can't remove them any earlier because we might get a false restart of
- // a transition. This can happen because we have not yet set the final property
- // value until we call the rendering dispatcher. So this can make the current
- // style slightly different from the desired final style (because our last
- // animation step was, say 0.9999 or something). And we need to remove them
- // here because if there are no more animations running we'll never get back
- // into the animation code to clean them up.
- RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
- for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
- CompositeAnimation* compAnim = it->second.get();
- compAnim->cleanupFinishedAnimations(); // will not modify m_compositeAnimations, so OK to call while iterating
- }
}
void AnimationControllerPrivate::startUpdateStyleIfNeededDispatcher()
diff --git a/src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.cpp b/src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.cpp
index b03dfe3..9481b8d 100644
--- a/src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.cpp
+++ b/src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.cpp
@@ -117,7 +117,10 @@ void CompositeAnimation::updateTransitions(RenderObject* renderer, RenderStyle*
bool equal = true;
if (implAnim) {
- implAnim->setActive(true);
+ // If we are post active don't bother setting the active flag. This will cause
+ // this animation to get removed at the end of this function.
+ if (!implAnim->postActive())
+ implAnim->setActive(true);
// This might be a transition that is just finishing. That would be the case
// if it were postActive. But we still need to check for equality because
@@ -183,52 +186,62 @@ void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, Render
if (m_keyframeAnimations.isEmpty() && !targetStyle->hasAnimations())
return;
- // Nothing to do if the current and target animations are the same
- if (currentStyle && currentStyle->hasAnimations() && targetStyle->hasAnimations() && *(currentStyle->animations()) == *(targetStyle->animations()))
- return;
-
- // Mark all existing animations as no longer active
AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end();
- for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it)
- it->second->setIndex(-1);
-
- // Toss the animation order map
- m_keyframeAnimationOrderMap.clear();
- // Now mark any still active animations as active and add any new animations
- if (targetStyle->animations()) {
- int numAnims = targetStyle->animations()->size();
- for (int i = 0; i < numAnims; ++i) {
- const Animation* anim = targetStyle->animations()->animation(i);
- AtomicString animationName(anim->name());
-
- if (!anim->isValidAnimation())
- continue;
+ if (currentStyle && currentStyle->hasAnimations() && targetStyle->hasAnimations() && *(currentStyle->animations()) == *(targetStyle->animations())) {
+ // The current and target animations are the same so we just need to toss any
+ // animation which is finished (postActive).
+ for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
+ if (it->second->postActive())
+ it->second->setIndex(-1);
+ }
+ } else {
+ // Mark all existing animations as no longer active.
+ for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it)
+ it->second->setIndex(-1);
- // See if there is a current animation for this name
- RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(animationName.impl());
+ // Toss the animation order map.
+ m_keyframeAnimationOrderMap.clear();
+
+ // Now mark any still active animations as active and add any new animations.
+ if (targetStyle->animations()) {
+ int numAnims = targetStyle->animations()->size();
+ for (int i = 0; i < numAnims; ++i) {
+ const Animation* anim = targetStyle->animations()->animation(i);
+ AtomicString animationName(anim->name());
+
+ if (!anim->isValidAnimation())
+ continue;
+
+ // See if there is a current animation for this name.
+ RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(animationName.impl());
+
+ if (keyframeAnim) {
+ // If this animation is postActive, skip it so it gets removed at the end of this function.
+ if (keyframeAnim->postActive())
+ continue;
+
+ // This one is still active.
+
+ // Animations match, but play states may differ. Update if needed.
+ keyframeAnim->updatePlayState(anim->playState() == AnimPlayStatePlaying);
+
+ // Set the saved animation to this new one, just in case the play state has changed.
+ keyframeAnim->setAnimation(anim);
+ keyframeAnim->setIndex(i);
+ } else if ((anim->duration() || anim->delay()) && anim->iterationCount()) {
+ keyframeAnim = KeyframeAnimation::create(const_cast<Animation*>(anim), renderer, i, this, currentStyle ? currentStyle : targetStyle);
+ m_keyframeAnimations.set(keyframeAnim->name().impl(), keyframeAnim);
+ }
- if (keyframeAnim) {
- // There is one so it is still active
-
- // Animations match, but play states may differ. update if needed
- keyframeAnim->updatePlayState(anim->playState() == AnimPlayStatePlaying);
-
- // Set the saved animation to this new one, just in case the play state has changed
- keyframeAnim->setAnimation(anim);
- keyframeAnim->setIndex(i);
- } else if ((anim->duration() || anim->delay()) && anim->iterationCount()) {
- keyframeAnim = KeyframeAnimation::create(const_cast<Animation*>(anim), renderer, i, this, currentStyle ? currentStyle : targetStyle);
- m_keyframeAnimations.set(keyframeAnim->name().impl(), keyframeAnim);
+ // Add this to the animation order map.
+ if (keyframeAnim)
+ m_keyframeAnimationOrderMap.append(keyframeAnim->name().impl());
}
-
- // Add this to the animation order map
- if (keyframeAnim)
- m_keyframeAnimationOrderMap.append(keyframeAnim->name().impl());
}
}
-
- // Make a list of animations to be removed
+
+ // Make a list of animations to be removed.
Vector<AtomicStringImpl*> animsToBeRemoved;
kfend = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
@@ -237,7 +250,7 @@ void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, Render
animsToBeRemoved.append(keyframeAnim->name().impl());
}
- // Now remove the animations from the list
+ // Now remove the animations from the list.
for (size_t j = 0; j < animsToBeRemoved.size(); ++j)
m_keyframeAnimations.remove(animsToBeRemoved[j]);
}
@@ -246,11 +259,9 @@ PassRefPtr<RenderStyle> CompositeAnimation::animate(RenderObject* renderer, Rend
{
RefPtr<RenderStyle> resultStyle;
- // Update animations first so we can see if any transitions are overridden
- updateKeyframeAnimations(renderer, currentStyle, targetStyle);
-
- // We don't do any transitions if we don't have a currentStyle (on startup)
+ // We don't do any transitions if we don't have a currentStyle (on startup).
updateTransitions(renderer, currentStyle, targetStyle);
+ updateKeyframeAnimations(renderer, currentStyle, targetStyle);
if (currentStyle) {
// Now that we have transition objects ready, let them know about the new goal state. We want them
@@ -272,8 +283,6 @@ PassRefPtr<RenderStyle> CompositeAnimation::animate(RenderObject* renderer, Rend
keyframeAnim->animate(this, renderer, currentStyle, targetStyle, resultStyle);
}
- cleanupFinishedAnimations();
-
return resultStyle ? resultStyle.release() : targetStyle;
}
@@ -364,50 +373,6 @@ PassRefPtr<KeyframeAnimation> CompositeAnimation::getAnimationForProperty(int pr
return retval;
}
-void CompositeAnimation::cleanupFinishedAnimations()
-{
- if (isSuspended())
- return;
-
- // Make a list of transitions to be deleted
- Vector<int> finishedTransitions;
- if (!m_transitions.isEmpty()) {
- CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
-
- for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
- ImplicitAnimation* anim = it->second.get();
- if (!anim)
- continue;
- if (anim->postActive())
- finishedTransitions.append(anim->animatingProperty());
- }
-
- // Delete them
- size_t finishedTransitionCount = finishedTransitions.size();
- for (size_t i = 0; i < finishedTransitionCount; ++i)
- m_transitions.remove(finishedTransitions[i]);
- }
-
- // Make a list of animations to be deleted
- Vector<AtomicStringImpl*> finishedAnimations;
- if (!m_keyframeAnimations.isEmpty()) {
- AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-
- for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
- KeyframeAnimation* anim = it->second.get();
- if (!anim)
- continue;
- if (anim->postActive())
- finishedAnimations.append(anim->name().impl());
- }
-
- // Delete them
- size_t finishedAnimationCount = finishedAnimations.size();
- for (size_t i = 0; i < finishedAnimationCount; ++i)
- m_keyframeAnimations.remove(finishedAnimations[i]);
- }
-}
-
void CompositeAnimation::suspendAnimations()
{
if (m_isSuspended)
diff --git a/src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.h b/src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.h
index 739cfdc..b7db442 100644
--- a/src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.h
+++ b/src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.h
@@ -74,8 +74,6 @@ public:
PassRefPtr<KeyframeAnimation> getAnimationForProperty(int property) const;
- void cleanupFinishedAnimations();
-
void overrideImplicitAnimations(int property);
void resumeOverriddenImplicitAnimations(int property);
diff --git a/src/3rdparty/webkit/WebCore/page/animation/ImplicitAnimation.cpp b/src/3rdparty/webkit/WebCore/page/animation/ImplicitAnimation.cpp
index 8edcd5a..8e6349d 100644
--- a/src/3rdparty/webkit/WebCore/page/animation/ImplicitAnimation.cpp
+++ b/src/3rdparty/webkit/WebCore/page/animation/ImplicitAnimation.cpp
@@ -212,6 +212,10 @@ bool ImplicitAnimation::affectsProperty(int property) const
bool ImplicitAnimation::isTargetPropertyEqual(int prop, const RenderStyle* targetStyle)
{
+ // We can get here for a transition that has not started yet. This would make m_toStyle unset and null.
+ // So we check that here (see <https://bugs.webkit.org/show_bug.cgi?id=26706>)
+ if (!m_toStyle)
+ return false;
return propertiesEqual(prop, m_toStyle.get(), targetStyle);
}
diff --git a/src/3rdparty/webkit/WebCore/page/qt/DragControllerQt.cpp b/src/3rdparty/webkit/WebCore/page/qt/DragControllerQt.cpp
index 1fe56b4..e6c7682 100644
--- a/src/3rdparty/webkit/WebCore/page/qt/DragControllerQt.cpp
+++ b/src/3rdparty/webkit/WebCore/page/qt/DragControllerQt.cpp
@@ -31,8 +31,7 @@
#include "FrameView.h"
#include "Page.h"
-namespace WebCore
-{
+namespace WebCore {
// FIXME: These values are straight out of DragControllerMac, so probably have
// little correlation with Qt standards...
diff --git a/src/3rdparty/webkit/WebCore/page/win/DragControllerWin.cpp b/src/3rdparty/webkit/WebCore/page/win/DragControllerWin.cpp
index dca8ea2..f0404ff 100644
--- a/src/3rdparty/webkit/WebCore/page/win/DragControllerWin.cpp
+++ b/src/3rdparty/webkit/WebCore/page/win/DragControllerWin.cpp
@@ -50,7 +50,8 @@ DragOperation DragController::dragOperation(DragData* dragData)
return dragData->containsURL() && !m_didInitiateDrag ? DragOperationCopy : DragOperationNone;
}
-bool DragController::isCopyKeyDown() {
+bool DragController::isCopyKeyDown()
+{
return ::GetAsyncKeyState(VK_CONTROL);
}
diff --git a/src/3rdparty/webkit/WebCore/page/win/FrameWin.h b/src/3rdparty/webkit/WebCore/page/win/FrameWin.h
index 405c7b2..2924291 100644
--- a/src/3rdparty/webkit/WebCore/page/win/FrameWin.h
+++ b/src/3rdparty/webkit/WebCore/page/win/FrameWin.h
@@ -34,7 +34,7 @@ typedef struct HBITMAP__* HBITMAP;
namespace WebCore {
HBITMAP imageFromSelection(Frame* frame, bool forceWhiteText);
- void computePageRectsForFrame(Frame*, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor,Vector<IntRect>& pages, int& pageHeight);
+ void computePageRectsForFrame(Frame*, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector<IntRect>& pages, int& pageHeight);
}
diff --git a/src/3rdparty/webkit/WebCore/platform/CrossThreadCopier.h b/src/3rdparty/webkit/WebCore/platform/CrossThreadCopier.h
index e7b4c0e..d12d72d 100644
--- a/src/3rdparty/webkit/WebCore/platform/CrossThreadCopier.h
+++ b/src/3rdparty/webkit/WebCore/platform/CrossThreadCopier.h
@@ -32,6 +32,7 @@
#define CrossThreadCopier_h
#include <memory>
+#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Threading.h>
@@ -73,6 +74,14 @@ namespace WebCore {
}
};
+ template<typename T> struct CrossThreadCopierBase<false, PassOwnPtr<T> > {
+ typedef PassOwnPtr<T> Type;
+ static Type copy(const PassOwnPtr<T>& ownPtr)
+ {
+ return PassOwnPtr<T>(static_cast<T*>(ownPtr.release()));
+ }
+ };
+
template<typename T> struct CrossThreadCopierBase<false, std::auto_ptr<T> > {
typedef std::auto_ptr<T> Type;
static Type copy(const std::auto_ptr<T>& autoPtr)
diff --git a/src/3rdparty/webkit/WebCore/platform/DragImage.h b/src/3rdparty/webkit/WebCore/platform/DragImage.h
index 744e450..a9039db 100644
--- a/src/3rdparty/webkit/WebCore/platform/DragImage.h
+++ b/src/3rdparty/webkit/WebCore/platform/DragImage.h
@@ -46,6 +46,8 @@ typedef struct HBITMAP__* HBITMAP;
class wxDragImage;
#elif PLATFORM(CHROMIUM)
#include "DragImageRef.h"
+#elif PLATFORM(GTK)
+typedef struct _GdkPixbuf GdkPixbuf;
#endif
//We need to #define YOffset as it needs to be shared with WebKit
@@ -69,7 +71,7 @@ namespace WebCore {
#elif PLATFORM(WX)
typedef wxDragImage* DragImageRef;
#elif PLATFORM(GTK)
- typedef void* DragImageRef;
+ typedef GdkPixbuf* DragImageRef;
#endif
IntSize dragImageSize(DragImageRef);
diff --git a/src/3rdparty/webkit/WebCore/platform/FileSystem.h b/src/3rdparty/webkit/WebCore/platform/FileSystem.h
index 16afe8f..e23b6da 100644
--- a/src/3rdparty/webkit/WebCore/platform/FileSystem.h
+++ b/src/3rdparty/webkit/WebCore/platform/FileSystem.h
@@ -53,7 +53,7 @@
typedef const struct __CFData* CFDataRef;
-#if PLATFORM(WIN)
+#if PLATFORM(WIN_OS)
// These are to avoid including <winbase.h> in a header for Chromium
typedef void *HANDLE;
// Assuming STRICT
@@ -65,13 +65,15 @@ namespace WebCore {
class CString;
-#if PLATFORM(WIN)
-typedef HANDLE PlatformFileHandle;
-typedef HMODULE PlatformModule;
-// FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to
-// avoid using Windows headers in headers. We'd rather move this into the .cpp.
-const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1);
+#if PLATFORM(QT)
+typedef QFile* PlatformFileHandle;
+const PlatformFileHandle invalidPlatformFileHandle = 0;
+#if defined(Q_WS_MAC)
+typedef CFBundleRef PlatformModule;
+typedef unsigned PlatformModuleVersion;
+#elif defined(Q_OS_WIN)
+typedef HMODULE PlatformModule;
struct PlatformModuleVersion {
unsigned leastSig;
unsigned mostSig;
@@ -89,15 +91,18 @@ struct PlatformModuleVersion {
}
};
-#elif PLATFORM(QT)
-
-typedef QFile* PlatformFileHandle;
-const PlatformFileHandle invalidPlatformFileHandle = 0;
-#if defined(Q_WS_MAC)
-typedef CFBundleRef PlatformModule;
+#else
+typedef QLibrary* PlatformModule;
typedef unsigned PlatformModuleVersion;
-#elif defined(Q_OS_WIN)
+#endif
+
+#elif PLATFORM(WIN_OS)
+typedef HANDLE PlatformFileHandle;
typedef HMODULE PlatformModule;
+// FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to
+// avoid using Windows headers in headers. We'd rather move this into the .cpp.
+const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1);
+
struct PlatformModuleVersion {
unsigned leastSig;
unsigned mostSig;
@@ -116,11 +121,6 @@ struct PlatformModuleVersion {
};
#else
-typedef QLibrary* PlatformModule;
-typedef unsigned PlatformModuleVersion;
-#endif
-
-#else
typedef int PlatformFileHandle;
#if PLATFORM(GTK)
typedef GModule* PlatformModule;
diff --git a/src/3rdparty/webkit/WebCore/platform/LocalizedStrings.h b/src/3rdparty/webkit/WebCore/platform/LocalizedStrings.h
index b6ec878..7c586d3 100644
--- a/src/3rdparty/webkit/WebCore/platform/LocalizedStrings.h
+++ b/src/3rdparty/webkit/WebCore/platform/LocalizedStrings.h
@@ -132,6 +132,9 @@ namespace WebCore {
#endif
String imageTitle(const String& filename, const IntSize& size);
+
+ String mediaElementLoadingStateText();
+ String mediaElementLiveBroadcastStateText();
}
#endif
diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp
index 9d3c128..ba6b61c 100644
--- a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp
@@ -58,11 +58,12 @@ ScrollView::~ScrollView()
platformDestroy();
}
-void ScrollView::addChild(Widget* child)
+void ScrollView::addChild(PassRefPtr<Widget> prpChild)
{
+ Widget* child = prpChild.get();
ASSERT(child != this && !child->parent());
child->setParent(this);
- m_children.add(child);
+ m_children.add(prpChild);
if (child->platformWidget())
platformAddChild(child);
}
@@ -640,7 +641,7 @@ void ScrollView::setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppre
}
}
-Scrollbar* ScrollView::scrollbarUnderPoint(const IntPoint& windowPoint)
+Scrollbar* ScrollView::scrollbarAtPoint(const IntPoint& windowPoint)
{
if (platformWidget())
return 0;
@@ -709,8 +710,8 @@ void ScrollView::frameRectsChanged()
if (platformWidget())
return;
- HashSet<Widget*>::const_iterator end = m_children.end();
- for (HashSet<Widget*>::const_iterator current = m_children.begin(); current != end; ++current)
+ HashSet<RefPtr<Widget> >::const_iterator end = m_children.end();
+ for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin(); current != end; ++current)
(*current)->frameRectsChanged();
}
@@ -802,6 +803,39 @@ bool ScrollView::scrollbarCornerPresent() const
(m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0);
}
+IntRect ScrollView::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& localRect) const
+{
+ // Scrollbars won't be transformed within us
+ IntRect newRect = localRect;
+ newRect.move(scrollbar->x(), scrollbar->y());
+ return newRect;
+}
+
+IntRect ScrollView::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
+{
+ IntRect newRect = parentRect;
+ // Scrollbars won't be transformed within us
+ newRect.move(-scrollbar->x(), -scrollbar->y());
+ return newRect;
+}
+
+// FIXME: test these on windows
+IntPoint ScrollView::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& localPoint) const
+{
+ // Scrollbars won't be transformed within us
+ IntPoint newPoint = localPoint;
+ newPoint.move(scrollbar->x(), scrollbar->y());
+ return newPoint;
+}
+
+IntPoint ScrollView::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
+{
+ IntPoint newPoint = parentPoint;
+ // Scrollbars won't be transformed within us
+ newPoint.move(-scrollbar->x(), -scrollbar->y());
+ return newPoint;
+}
+
void ScrollView::setParentVisible(bool visible)
{
if (isParentVisible() == visible)
@@ -812,8 +846,8 @@ void ScrollView::setParentVisible(bool visible)
if (!isSelfVisible())
return;
- HashSet<Widget*>::iterator end = m_children.end();
- for (HashSet<Widget*>::iterator it = m_children.begin(); it != end; ++it)
+ HashSet<RefPtr<Widget> >::iterator end = m_children.end();
+ for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end; ++it)
(*it)->setParentVisible(visible);
}
@@ -822,8 +856,8 @@ void ScrollView::show()
if (!isSelfVisible()) {
setSelfVisible(true);
if (isParentVisible()) {
- HashSet<Widget*>::iterator end = m_children.end();
- for (HashSet<Widget*>::iterator it = m_children.begin(); it != end; ++it)
+ HashSet<RefPtr<Widget> >::iterator end = m_children.end();
+ for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end; ++it)
(*it)->setParentVisible(true);
}
}
@@ -835,8 +869,8 @@ void ScrollView::hide()
{
if (isSelfVisible()) {
if (isParentVisible()) {
- HashSet<Widget*>::iterator end = m_children.end();
- for (HashSet<Widget*>::iterator it = m_children.begin(); it != end; ++it)
+ HashSet<RefPtr<Widget> >::iterator end = m_children.end();
+ for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end; ++it)
(*it)->setParentVisible(false);
}
setSelfVisible(false);
diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.h b/src/3rdparty/webkit/WebCore/platform/ScrollView.h
index 7f99a22..b950327 100644
--- a/src/3rdparty/webkit/WebCore/platform/ScrollView.h
+++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.h
@@ -55,7 +55,6 @@ class Scrollbar;
class ScrollView : public Widget, public ScrollbarClient {
public:
- ScrollView();
~ScrollView();
// ScrollbarClient method. FrameView overrides the other two.
@@ -69,8 +68,8 @@ public:
virtual IntRect windowClipRect(bool clipToContents = true) const = 0;
// Methods for child manipulation and inspection.
- const HashSet<Widget*>* children() const { return &m_children; }
- void addChild(Widget*);
+ const HashSet<RefPtr<Widget> >* children() const { return &m_children; }
+ void addChild(PassRefPtr<Widget>);
void removeChild(Widget*);
// If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These methods
@@ -181,7 +180,7 @@ public:
virtual void setFrameRect(const IntRect&);
// For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
- Scrollbar* scrollbarUnderPoint(const IntPoint& windowPoint);
+ Scrollbar* scrollbarAtPoint(const IntPoint& windowPoint);
// This method exists for scrollviews that need to handle wheel events manually.
// On Mac the underlying NSScrollView just does the scrolling, but on other platforms
@@ -221,7 +220,14 @@ public:
virtual bool scrollbarCornerPresent() const;
+ virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const;
+ virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const;
+ virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const;
+ virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;
+
protected:
+ ScrollView();
+
virtual void repaintContentRectangle(const IntRect&, bool now = false);
virtual void paintContents(GraphicsContext*, const IntRect& damageRect) = 0;
@@ -239,7 +245,7 @@ private:
ScrollbarMode m_verticalScrollbarMode;
bool m_prohibitsScrolling;
- HashSet<Widget*> m_children;
+ HashSet<RefPtr<Widget> > m_children;
// This bool is unused on Mac OS because we directly ask the platform widget
// whether it is safe to blit on scroll.
diff --git a/src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp b/src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp
index babf3d4..4574f63 100644
--- a/src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp
@@ -449,9 +449,36 @@ void Scrollbar::invalidateRect(const IntRect& rect)
m_client->invalidateScrollbarRect(this, rect);
}
-PlatformMouseEvent Scrollbar::transformEvent(const PlatformMouseEvent& event)
+IntRect Scrollbar::convertToContainingView(const IntRect& localRect) const
{
- return event;
+ if (m_client)
+ return m_client->convertFromScrollbarToContainingView(this, localRect);
+
+ return Widget::convertToContainingView(localRect);
+}
+
+IntRect Scrollbar::convertFromContainingView(const IntRect& parentRect) const
+{
+ if (m_client)
+ return m_client->convertFromContainingViewToScrollbar(this, parentRect);
+
+ return Widget::convertFromContainingView(parentRect);
+}
+
+IntPoint Scrollbar::convertToContainingView(const IntPoint& localPoint) const
+{
+ if (m_client)
+ return m_client->convertFromScrollbarToContainingView(this, localPoint);
+
+ return Widget::convertToContainingView(localPoint);
+}
+
+IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const
+{
+ if (m_client)
+ return m_client->convertFromContainingViewToScrollbar(this, parentPoint);
+
+ return Widget::convertFromContainingView(parentPoint);
}
}
diff --git a/src/3rdparty/webkit/WebCore/platform/Scrollbar.h b/src/3rdparty/webkit/WebCore/platform/Scrollbar.h
index 711ae36..67496f2 100644
--- a/src/3rdparty/webkit/WebCore/platform/Scrollbar.h
+++ b/src/3rdparty/webkit/WebCore/platform/Scrollbar.h
@@ -26,7 +26,6 @@
#ifndef Scrollbar_h
#define Scrollbar_h
-#include <wtf/RefCounted.h>
#include "ScrollTypes.h"
#include "Timer.h"
#include "Widget.h"
@@ -45,7 +44,7 @@ class PlatformMouseEvent;
const int cScrollbarPixelsPerLineStep = 40;
const int cAmountToKeepWhenPaging = 40;
-class Scrollbar : public Widget, public RefCounted<Scrollbar> {
+class Scrollbar : public Widget {
protected:
Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0);
@@ -110,10 +109,6 @@ public:
bool contextMenu(const PlatformMouseEvent& event);
#endif
- // Takes an event and accounts for any transforms that might occur on the scrollbar. Returns
- // a new event that has had all of the transforms applied.
- PlatformMouseEvent transformEvent(const PlatformMouseEvent&);
-
ScrollbarTheme* theme() const { return m_theme; }
virtual void setParent(ScrollView*);
@@ -126,13 +121,19 @@ public:
virtual void styleChanged() { }
+ virtual IntRect convertToContainingView(const IntRect&) const;
+ virtual IntRect convertFromContainingView(const IntRect&) const;
+
+ virtual IntPoint convertToContainingView(const IntPoint&) const;
+ virtual IntPoint convertFromContainingView(const IntPoint&) const;
+
private:
virtual bool isScrollbar() const { return true; }
protected:
virtual void updateThumbPosition();
virtual void updateThumbProportion();
-
+
void autoscrollTimerFired(Timer<Scrollbar>*);
void startTimerIfNeeded(double delay);
void stopTimerIfNeeded();
diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollbarClient.h b/src/3rdparty/webkit/WebCore/platform/ScrollbarClient.h
index f720e95..6efe72e 100644
--- a/src/3rdparty/webkit/WebCore/platform/ScrollbarClient.h
+++ b/src/3rdparty/webkit/WebCore/platform/ScrollbarClient.h
@@ -27,12 +27,11 @@
#define ScrollbarClient_h
#include "IntRect.h"
+#include "Scrollbar.h"
#include <wtf/Vector.h>
namespace WebCore {
-class Scrollbar;
-
class ScrollbarClient {
public:
virtual ~ScrollbarClient() {}
@@ -45,6 +44,29 @@ public:
virtual bool scrollbarCornerPresent() const = 0;
virtual void getTickmarks(Vector<IntRect>&) const { }
+
+ // Convert points and rects between the scrollbar and its containing view.
+ // The client needs to implement these in order to be aware of layout effects
+ // like CSS transforms.
+ virtual IntRect convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const
+ {
+ return scrollbar->Widget::convertToContainingView(scrollbarRect);
+ }
+
+ virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
+ {
+ return scrollbar->Widget::convertFromContainingView(parentRect);
+ }
+
+ virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const
+ {
+ return scrollbar->Widget::convertToContainingView(scrollbarPoint);
+ }
+
+ virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
+ {
+ return scrollbar->Widget::convertFromContainingView(parentPoint);
+ }
};
}
diff --git a/src/3rdparty/webkit/WebCore/platform/Theme.h b/src/3rdparty/webkit/WebCore/platform/Theme.h
index 5574bd7..f211576 100644
--- a/src/3rdparty/webkit/WebCore/platform/Theme.h
+++ b/src/3rdparty/webkit/WebCore/platform/Theme.h
@@ -106,7 +106,7 @@ public:
virtual void inflateControlPaintRect(ControlPart, ControlStates, IntRect& /*zoomedRect*/, float /*zoomFactor*/) const { }
// This method is called once, from RenderTheme::adjustDefaultStyleSheet(), to let each platform adjust
- // the default CSS rules in html4.css.
+ // the default CSS rules in html.css.
static String defaultStyleSheet();
private:
diff --git a/src/3rdparty/webkit/WebCore/platform/ThemeTypes.h b/src/3rdparty/webkit/WebCore/platform/ThemeTypes.h
index ae85a63..b763675 100644
--- a/src/3rdparty/webkit/WebCore/platform/ThemeTypes.h
+++ b/src/3rdparty/webkit/WebCore/platform/ThemeTypes.h
@@ -43,12 +43,15 @@ enum ControlState {
typedef unsigned ControlStates;
+// Must follow CSSValueKeywords.in order
enum ControlPart {
NoControlPart, CheckboxPart, RadioPart, PushButtonPart, SquareButtonPart, ButtonPart,
ButtonBevelPart, DefaultButtonPart, ListboxPart, ListItemPart,
MediaFullscreenButtonPart, MediaMuteButtonPart, MediaPlayButtonPart, MediaSeekBackButtonPart,
- MediaSeekForwardButtonPart, MediaSliderPart, MediaSliderThumbPart, MediaTimelineContainerPart,
- MediaCurrentTimePart, MediaTimeRemainingPart,
+ MediaSeekForwardButtonPart, MediaRewindButtonPart, MediaReturnToRealtimeButtonPart,
+ MediaSliderPart,
+ MediaSliderThumbPart, MediaControlsBackgroundPart,
+ MediaCurrentTimePart, MediaTimeRemainingPart,
MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart,
SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart,
SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart,
diff --git a/src/3rdparty/webkit/WebCore/platform/Widget.cpp b/src/3rdparty/webkit/WebCore/platform/Widget.cpp
index a456431..5bb903b 100644
--- a/src/3rdparty/webkit/WebCore/platform/Widget.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/Widget.cpp
@@ -69,42 +69,61 @@ void Widget::removeFromParent()
parent()->removeChild(this);
}
-#if !PLATFORM(MAC)
+IntRect Widget::convertFromContainingWindow(const IntRect& windowRect) const
+{
+ if (const ScrollView* parentScrollView = parent()) {
+ IntRect parentRect = parentScrollView->convertFromContainingWindow(windowRect);
+ return convertFromContainingView(parentRect);
+ }
+ return convertFromContainingWindowToRoot(this, windowRect);
+}
+
+IntRect Widget::convertToContainingWindow(const IntRect& localRect) const
+{
+ if (const ScrollView* parentScrollView = parent()) {
+ IntRect parentRect = convertToContainingView(localRect);
+ return parentScrollView->convertToContainingWindow(parentRect);
+ }
+ return convertFromRootToContainingWindow(this, localRect);
+}
+
+IntPoint Widget::convertFromContainingWindow(const IntPoint& windowPoint) const
+{
+ if (const ScrollView* parentScrollView = parent()) {
+ IntPoint parentPoint = parentScrollView->convertFromContainingWindow(windowPoint);
+ return convertFromContainingView(parentPoint);
+ }
+ return convertFromContainingWindowToRoot(this, windowPoint);
+}
-IntRect Widget::convertToContainingWindow(const IntRect& rect) const
+IntPoint Widget::convertToContainingWindow(const IntPoint& localPoint) const
{
- IntRect convertedRect = rect;
- convertedRect.setLocation(convertToContainingWindow(convertedRect.location()));
- return convertedRect;
+ if (const ScrollView* parentScrollView = parent()) {
+ IntPoint parentPoint = convertToContainingView(localPoint);
+ return parentScrollView->convertToContainingWindow(parentPoint);
+ }
+ return convertFromRootToContainingWindow(this, localPoint);
}
-IntPoint Widget::convertToContainingWindow(const IntPoint& point) const
+#if !PLATFORM(MAC)
+IntRect Widget::convertFromRootToContainingWindow(const Widget*, const IntRect& rect)
{
- IntPoint windowPoint = point;
- const Widget* childWidget = this;
- for (const ScrollView* parentScrollView = parent();
- parentScrollView;
- childWidget = parentScrollView, parentScrollView = parentScrollView->parent())
- windowPoint = parentScrollView->convertChildToSelf(childWidget, windowPoint);
- return windowPoint;
+ return rect;
}
-IntPoint Widget::convertFromContainingWindow(const IntPoint& point) const
+IntRect Widget::convertFromContainingWindowToRoot(const Widget*, const IntRect& rect)
{
- IntPoint widgetPoint = point;
- const Widget* childWidget = this;
- for (const ScrollView* parentScrollView = parent();
- parentScrollView;
- childWidget = parentScrollView, parentScrollView = parentScrollView->parent())
- widgetPoint = parentScrollView->convertSelfToChild(childWidget, widgetPoint);
- return widgetPoint;
+ return rect;
}
-IntRect Widget::convertFromContainingWindow(const IntRect& rect) const
+IntPoint Widget::convertFromRootToContainingWindow(const Widget*, const IntPoint& point)
{
- IntRect result = rect;
- result.setLocation(convertFromContainingWindow(rect.location()));
- return result;
+ return point;
+}
+
+IntPoint Widget::convertFromContainingWindowToRoot(const Widget*, const IntPoint& point)
+{
+ return point;
}
#endif
@@ -118,4 +137,41 @@ void Widget::retainPlatformWidget()
}
#endif
+IntRect Widget::convertToContainingView(const IntRect& localRect) const
+{
+ if (const ScrollView* parentScrollView = parent()) {
+ IntRect parentRect(localRect);
+ parentRect.setLocation(parentScrollView->convertChildToSelf(this, localRect.location()));
+ return parentRect;
+ }
+ return localRect;
}
+
+IntRect Widget::convertFromContainingView(const IntRect& parentRect) const
+{
+ if (const ScrollView* parentScrollView = parent()) {
+ IntRect localRect = parentRect;
+ localRect.setLocation(parentScrollView->convertSelfToChild(this, localRect.location()));
+ return localRect;
+ }
+
+ return parentRect;
+}
+
+IntPoint Widget::convertToContainingView(const IntPoint& localPoint) const
+{
+ if (const ScrollView* parentScrollView = parent())
+ return parentScrollView->convertChildToSelf(this, localPoint);
+
+ return localPoint;
+}
+
+IntPoint Widget::convertFromContainingView(const IntPoint& parentPoint) const
+{
+ if (const ScrollView* parentScrollView = parent())
+ return parentScrollView->convertSelfToChild(this, parentPoint);
+
+ return parentPoint;
+}
+
+} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/platform/Widget.h b/src/3rdparty/webkit/WebCore/platform/Widget.h
index b6c0054..5fd18fa 100644
--- a/src/3rdparty/webkit/WebCore/platform/Widget.h
+++ b/src/3rdparty/webkit/WebCore/platform/Widget.h
@@ -73,6 +73,8 @@ typedef wxWindow* PlatformWidget;
#include "IntRect.h"
#include "IntSize.h"
+#include <wtf/RefCounted.h>
+
namespace WebCore {
class Cursor;
@@ -81,7 +83,6 @@ class Font;
class GraphicsContext;
class PlatformMouseEvent;
class ScrollView;
-class WidgetClient;
class WidgetPrivate;
// The Widget class serves as a base class for three kinds of objects:
@@ -99,11 +100,11 @@ class WidgetPrivate;
// Scrollbar - Mac, Gtk
// Plugin - Mac, Windows (windowed only), Qt (windowed only, widget is an HWND on windows), Gtk (windowed only)
//
-class Widget {
+class Widget : public RefCounted<Widget> {
public:
Widget(PlatformWidget = 0);
virtual ~Widget();
-
+
PlatformWidget platformWidget() const { return m_widget; }
void setPlatformWidget(PlatformWidget widget)
{
@@ -164,9 +165,10 @@ public:
// up with an inaccurate rect. Always make sure to use the rect-based convertFromContainingWindow method
// when converting window rects.
IntRect convertToContainingWindow(const IntRect&) const;
- IntPoint convertToContainingWindow(const IntPoint&) const;
- IntPoint convertFromContainingWindow(const IntPoint&) const; // See comment above about when not to use this method.
IntRect convertFromContainingWindow(const IntRect&) const;
+
+ IntPoint convertToContainingWindow(const IntPoint&) const;
+ IntPoint convertFromContainingWindow(const IntPoint&) const;
virtual void frameRectsChanged() {}
@@ -179,12 +181,26 @@ public:
void removeFromSuperview();
#endif
+ // Virtual methods to convert points to/from the containing ScrollView
+ virtual IntRect convertToContainingView(const IntRect&) const;
+ virtual IntRect convertFromContainingView(const IntRect&) const;
+ virtual IntPoint convertToContainingView(const IntPoint&) const;
+ virtual IntPoint convertFromContainingView(const IntPoint&) const;
+
private:
void init(PlatformWidget); // Must be called by all Widget constructors to initialize cross-platform data.
void releasePlatformWidget();
void retainPlatformWidget();
+ // These methods are used to convert from the root widget to the containing window,
+ // which has behavior that may differ between platforms (e.g. Mac uses flipped window coordinates).
+ static IntRect convertFromRootToContainingWindow(const Widget* rootWidget, const IntRect&);
+ static IntRect convertFromContainingWindowToRoot(const Widget* rootWidget, const IntRect&);
+
+ static IntPoint convertFromRootToContainingWindow(const Widget* rootWidget, const IntPoint&);
+ static IntPoint convertFromContainingWindowToRoot(const Widget* rootWidget, const IntPoint&);
+
private:
ScrollView* m_parent;
PlatformWidget m_widget;
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp
index 8933d7b..32aefc9 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp
@@ -86,7 +86,7 @@ void BitmapImage::destroyDecodedData(bool destroyAll)
destroyMetadataAndNotify(framesCleared);
- m_source.clear(destroyAll, clearBeforeFrame, m_data.get(), m_allDataReceived);
+ m_source.clear(destroyAll, clearBeforeFrame, data(), m_allDataReceived);
return;
}
@@ -163,7 +163,7 @@ bool BitmapImage::dataChanged(bool allDataReceived)
// Feed all the data we've seen so far to the image decoder.
m_allDataReceived = allDataReceived;
- m_source.setData(m_data.get(), allDataReceived);
+ m_source.setData(data(), allDataReceived);
// Clear the frame count.
m_haveFrameCount = false;
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/Color.h b/src/3rdparty/webkit/WebCore/platform/graphics/Color.h
index 032d0cb..7ac432f 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/Color.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/Color.h
@@ -145,7 +145,6 @@ inline bool operator!=(const Color& a, const Color& b)
return !(a == b);
}
-Color focusRingColor();
Color colorFromPremultipliedARGB(unsigned);
unsigned premultipliedARGBFromColor(const Color&);
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp
index 0c442a2..2b85bfa 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp
@@ -193,6 +193,7 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
, m_masksToBounds(false)
, m_drawsContent(false)
, m_paintingPhase(GraphicsLayerPaintAllMask)
+ , m_contentsOrientation(CompositingCoordinatesTopDown)
, m_parent(0)
#ifndef NDEBUG
, m_repaintCount(0)
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h
index ae51951..9407563 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h
@@ -293,6 +293,14 @@ public:
enum CompositingCoordinatesOrientation { CompositingCoordinatesTopDown, CompositingCoordinatesBottomUp };
static CompositingCoordinatesOrientation compositingCoordinatesOrientation();
+ // Set the geometry orientation (top-down, or bottom-up) for this layer, which also controls sublayer geometry.
+ virtual void setGeometryOrientation(CompositingCoordinatesOrientation) { }
+ virtual CompositingCoordinatesOrientation geometryOrientation() const { return CompositingCoordinatesTopDown; }
+
+ // Flippedness of the contents of this layer. Does not affect sublayer geometry.
+ virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; }
+ virtual CompositingCoordinatesOrientation contentsOrientation() const { return m_contentsOrientation; }
+
#ifndef NDEBUG
static bool showDebugBorders();
static bool showRepaintCounter();
@@ -348,6 +356,7 @@ protected:
bool m_drawsContent : 1;
GraphicsLayerPaintingPhase m_paintingPhase;
+ CompositingCoordinatesOrientation m_contentsOrientation;
Vector<GraphicsLayer*> m_children;
GraphicsLayer* m_parent;
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/Image.h b/src/3rdparty/webkit/WebCore/platform/graphics/Image.h
index bb61043c..c0d07c9 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/Image.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/Image.h
@@ -31,9 +31,9 @@
#include "GraphicsTypes.h"
#include "ImageSource.h"
#include "IntRect.h"
-#include <wtf/RefPtr.h>
-#include <wtf/PassRefPtr.h>
#include "SharedBuffer.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
#if PLATFORM(MAC)
#ifdef __OBJC__
@@ -67,13 +67,13 @@ typedef struct _GdkPixbuf GdkPixbuf;
namespace WebCore {
-class TransformationMatrix;
class FloatPoint;
class FloatRect;
class FloatSize;
class GraphicsContext;
class SharedBuffer;
class String;
+class TransformationMatrix;
// This class gets notified when an image creates or destroys decoded frames and when it advances animation frames.
class ImageObserver;
@@ -81,6 +81,7 @@ class ImageObserver;
class Image : public RefCounted<Image> {
friend class GeneratedImage;
friend class GraphicsContext;
+
public:
virtual ~Image();
@@ -168,13 +169,8 @@ protected:
virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
-#if PLATFORM(CG)
- // These are private to CG. Ideally they would be only in the .cpp file, but the callback requires access
- // to the private function nativeImageForCurrentFrame()
- static void drawPatternCallback(void* info, CGContext*);
-#endif
-
-protected:
+
+private:
RefPtr<SharedBuffer> m_data; // The encoded raw data for the image.
ImageObserver* m_imageObserver;
};
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/IntPoint.h b/src/3rdparty/webkit/WebCore/platform/graphics/IntPoint.h
index 1cae191..21af67b 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/IntPoint.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/IntPoint.h
@@ -80,6 +80,7 @@ public:
void setX(int x) { m_x = x; }
void setY(int y) { m_y = y; }
+ void move(const IntSize& s) { move(s.width(), s.height()); }
void move(int dx, int dy) { m_x += dx; m_y += dy; }
IntPoint expandedTo(const IntPoint& other) const
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp
index a277675..21ce22d 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp
@@ -437,6 +437,11 @@ void MediaPlayer::paint(GraphicsContext* p, const IntRect& r)
m_private->paint(p, r);
}
+void MediaPlayer::paintCurrentFrameInContext(GraphicsContext* p, const IntRect& r)
+{
+ m_private->paintCurrentFrameInContext(p, r);
+}
+
MediaPlayer::SupportsType MediaPlayer::supportsType(ContentType contentType)
{
String type = contentType.type();
@@ -490,6 +495,17 @@ bool MediaPlayer::supportsAcceleratedRendering() const
}
#endif // USE(ACCELERATED_COMPOSITING)
+bool MediaPlayer::hasSingleSecurityOrigin() const
+{
+ return m_private->hasSingleSecurityOrigin();
+}
+
+MediaPlayer::MovieLoadType MediaPlayer::movieLoadType() const
+{
+ return m_private->movieLoadType();
+}
+
+// Client callbacks.
void MediaPlayer::networkStateChanged()
{
if (m_mediaPlayerClient)
@@ -538,10 +554,6 @@ void MediaPlayer::rateChanged()
m_mediaPlayerClient->mediaPlayerRateChanged(this);
}
-bool MediaPlayer::hasSingleSecurityOrigin() const
-{
- return m_private->hasSingleSecurityOrigin();
}
-}
#endif
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h
index 187c701..9d9370b 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h
@@ -160,6 +160,7 @@ public:
void setAutobuffer(bool);
void paint(GraphicsContext*, const IntRect&);
+ void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);
enum NetworkState { Empty, Idle, Loading, Loaded, FormatError, NetworkError, DecodeError };
NetworkState networkState();
@@ -167,6 +168,9 @@ public:
enum ReadyState { HaveNothing, HaveMetadata, HaveCurrentData, HaveFutureData, HaveEnoughData };
ReadyState readyState();
+ enum MovieLoadType { Unknown, Download, StoredStream, LiveStream };
+ MovieLoadType movieLoadType() const;
+
void networkStateChanged();
void readyStateChanged();
void volumeChanged();
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h
index edbe125..753ccd2 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h
@@ -85,7 +85,9 @@ public:
virtual void setSize(const IntSize&) = 0;
- virtual void paint(GraphicsContext*, const IntRect&) = 0 ;
+ virtual void paint(GraphicsContext*, const IntRect&) = 0;
+
+ virtual void paintCurrentFrameInContext(GraphicsContext* c, const IntRect& r) { paint(c, r); }
virtual void setAutobuffer(bool) { };
@@ -103,6 +105,9 @@ public:
#endif
virtual bool hasSingleSecurityOrigin() const { return false; }
+
+ virtual MediaPlayer::MovieLoadType movieLoadType() const { return MediaPlayer::Unknown; }
+
};
}
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
index 7569031..fde6ea3 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
@@ -298,7 +298,9 @@ void Path::clear()
bool Path::isEmpty() const
{
- return m_path->isEmpty();
+ // Don't use QPainterPath::isEmpty(), as that also returns true if there's only
+ // one initial MoveTo element in the path.
+ return m_path->elementCount() == 0;
}
String Path::debugString() const
diff --git a/src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm
index ebb6d93..fdd7df5 100644
--- a/src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm
+++ b/src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm
@@ -697,4 +697,20 @@ String imageTitle(const String& filename, const IntSize& size)
return String();
}
+String mediaElementLoadingStateText()
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ return [[WebCoreViewFactory sharedFactory] mediaElementLoadingStateText];
+ END_BLOCK_OBJC_EXCEPTIONS;
+ return String();
+}
+
+String mediaElementLiveBroadcastStateText()
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ return [[WebCoreViewFactory sharedFactory] mediaElementLiveBroadcastStateText];
+ END_BLOCK_OBJC_EXCEPTIONS;
+ return String();
+}
+
}
diff --git a/src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm
index a3e743f..e7e12ac 100644
--- a/src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm
+++ b/src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm
@@ -26,6 +26,7 @@
#import "config.h"
#import "ThemeMac.h"
+#import "BlockExceptions.h"
#import "GraphicsContext.h"
#import "LocalCurrentGraphicsContext.h"
#import "ScrollView.h"
@@ -195,6 +196,8 @@ static NSButtonCell* checkbox(ControlStates states, const IntRect& zoomedRect, f
// FIXME: Share more code with radio buttons.
static void paintCheckbox(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+
// Determine the width and height needed for the control and prepare the cell for painting.
NSButtonCell* checkboxCell = checkbox(states, zoomedRect, zoomFactor);
@@ -218,6 +221,8 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const
[checkboxCell setControlView:nil];
context->restore();
+
+ END_BLOCK_OBJC_EXCEPTIONS
}
// Radio Buttons
@@ -289,8 +294,10 @@ static void paintRadio(ControlStates states, GraphicsContext* context, const Int
context->translate(-inflatedRect.x(), -inflatedRect.y());
}
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
[radioCell drawWithFrame:NSRect(inflatedRect) inView:scrollView->documentView()];
[radioCell setControlView:nil];
+ END_BLOCK_OBJC_EXCEPTIONS
context->restore();
}
@@ -348,6 +355,8 @@ static NSButtonCell* button(ControlPart part, ControlStates states, const IntRec
static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+
// Determine the width and height needed for the control and prepare the cell for painting.
NSButtonCell *buttonCell = button(part, states, zoomedRect, zoomFactor);
LocalCurrentGraphicsContext localContext(context);
@@ -391,6 +400,8 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext*
if (![previousDefaultButtonCell isEqual:buttonCell])
[window setDefaultButtonCell:previousDefaultButtonCell];
+
+ END_BLOCK_OBJC_EXCEPTIONS
}
// Theme overrides
@@ -479,6 +490,7 @@ LengthBox ThemeMac::controlPadding(ControlPart part, const Font& font, const Len
void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, IntRect& zoomedRect, float zoomFactor) const
{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
switch (part) {
case CheckboxPart: {
// We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox
@@ -520,6 +532,7 @@ void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, I
default:
break;
}
+ END_BLOCK_OBJC_EXCEPTIONS
}
void ThemeMac::paint(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) const
diff --git a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h
index cbe4aea..768899e 100644
--- a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -104,8 +104,9 @@ extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
extern NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
extern NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
extern BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
-extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration);
-extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, BOOL active);
+extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
+ float duration, unsigned state);
+extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
extern NSString* (*wkGetMIMETypeForExtension)(NSString*);
@@ -122,6 +123,7 @@ extern int (*wkQTMovieDataRate)(QTMovie*);
extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
+extern int (*wkQTMovieGetType)(QTMovie* movie);
extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
extern void (*wkSetDragImage)(NSImage*, NSPoint offset);
@@ -134,6 +136,7 @@ extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
extern void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
+extern BOOL (*wkIsLatchingWheelEvent)(NSEvent *);
#ifndef BUILDING_ON_TIGER
extern void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
diff --git a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm
index 05d1da6..d0e276f 100644
--- a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -39,9 +39,10 @@ void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
-void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration);
+void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
+ float duration, unsigned state);
BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
-void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, BOOL active);
+void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
@@ -56,6 +57,7 @@ int (*wkQTMovieDataRate)(QTMovie*);
float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
+int (*wkQTMovieGetType)(QTMovie* movie);
void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
void (*wkSetDragImage)(NSImage*, NSPoint offset);
@@ -78,6 +80,7 @@ void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
id (*wkCreateNSURLConnectionDelegateProxy)(void);
unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
+BOOL (*wkIsLatchingWheelEvent)(NSEvent *);
#ifndef BUILDING_ON_TIGER
void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
diff --git a/src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm
index 1aaf4b2..8653a03 100644
--- a/src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm
+++ b/src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm
@@ -283,72 +283,52 @@ void Widget::afterMouseDown(NSView *view, Widget* widget)
}
}
-IntPoint Widget::convertFromContainingWindow(const IntPoint& point) const
+// These are here to deal with flipped coords on Mac.
+IntRect Widget::convertFromRootToContainingWindow(const Widget* rootWidget, const IntRect& rect)
{
- if (!platformWidget()) {
- if (!parent())
- return point;
- IntPoint result = parent()->convertFromContainingWindow(point);
- result.move(parent()->scrollX() - x(), parent()->scrollY() - y());
- return result;
- }
-
+ if (!rootWidget->platformWidget())
+ return rect;
+
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return IntPoint([platformWidget() convertPoint:point fromView:nil]);
+ return enclosingIntRect([rootWidget->platformWidget() convertRect:rect toView:nil]);
END_BLOCK_OBJC_EXCEPTIONS;
-
- return point;
+
+ return rect;
}
-IntRect Widget::convertFromContainingWindow(const IntRect& rect) const
+IntRect Widget::convertFromContainingWindowToRoot(const Widget* rootWidget, const IntRect& rect)
{
- if (!platformWidget()) {
- if (!parent())
- return rect;
- IntRect result = parent()->convertFromContainingWindow(rect);
- result.move(parent()->scrollX() - x(), parent()->scrollY() - y());
- return result;
- }
-
+ if (!rootWidget->platformWidget())
+ return rect;
+
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return enclosingIntRect([platformWidget() convertRect:rect fromView:nil]);
+ return enclosingIntRect([rootWidget->platformWidget() convertRect:rect fromView:nil]);
END_BLOCK_OBJC_EXCEPTIONS;
-
+
return rect;
}
-IntRect Widget::convertToContainingWindow(const IntRect& r) const
+IntPoint Widget::convertFromRootToContainingWindow(const Widget* rootWidget, const IntPoint& point)
{
- if (!platformWidget()) {
- if (!parent())
- return r;
- IntRect result = r;
- result.move(parent()->scrollX() - x(), parent()->scrollY() - y());
- return parent()->convertToContainingWindow(result);
- }
-
+ if (!rootWidget->platformWidget())
+ return point;
+
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return IntRect([platformWidget() convertRect:r toView:nil]);
+ return IntPoint([rootWidget->platformWidget() convertPoint:point toView:nil]);
END_BLOCK_OBJC_EXCEPTIONS;
-
- return r;
+ return point;
}
-
-IntPoint Widget::convertToContainingWindow(const IntPoint& p) const
+
+IntPoint Widget::convertFromContainingWindowToRoot(const Widget* rootWidget, const IntPoint& point)
{
- if (!platformWidget()) {
- if (!parent())
- return p;
- IntPoint result = p;
- result.move(parent()->scrollX() - x(), parent()->scrollY() - y());
- return parent()->convertToContainingWindow(result);
- }
-
+ if (!rootWidget->platformWidget())
+ return point;
+
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return IntPoint([platformWidget() convertPoint:p toView:nil]);
+ return IntPoint([rootWidget->platformWidget() convertPoint:point fromView:nil]);
END_BLOCK_OBJC_EXCEPTIONS;
- return p;
+ return point;
}
void Widget::releasePlatformWidget()
diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h
index 8b0f476..676129a 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h
+++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h
@@ -35,7 +35,7 @@
#include <CFNetwork/CFURLConnectionPriv.h>
#endif
-#if USE(WININET)
+#if USE(WININET) || (USE(CURL) && PLATFORM(WIN))
#include <winsock2.h>
#include <windows.h>
#endif
@@ -111,7 +111,6 @@ namespace WebCore {
#if USE(SOUP)
, m_msg(0)
, m_cancelled(false)
- , m_reportedHeaders(false)
, m_gfile(0)
, m_inputStream(0)
, m_cancellable(0)
@@ -194,7 +193,6 @@ namespace WebCore {
SoupMessage* m_msg;
ResourceResponse m_response;
bool m_cancelled;
- bool m_reportedHeaders;
GFile* m_gfile;
GInputStream* m_inputStream;
GCancellable* m_cancellable;
diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.cpp b/src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.cpp
index a6d70fd..7f8a4e2 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.cpp
@@ -502,7 +502,7 @@ static bool isCacheHeaderSeparator(UChar c)
}
}
-bool isControlCharacter(UChar c)
+static bool isControlCharacter(UChar c)
{
return c < ' ' || c == 127;
}
diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.h b/src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.h
index 20165e7..7594c09 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.h
+++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.h
@@ -162,8 +162,6 @@ struct CrossThreadResourceResponseData {
time_t m_lastModifiedDate;
};
-bool isControlCharacter(UChar c);
-
} // namespace WebCore
#endif // ResourceResponseBase_h
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index 2f980fa..898e5f4 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -225,9 +225,11 @@ void QNetworkReplyHandler::finish()
resetState();
start();
} else if (m_reply->error() != QNetworkReply::NoError
- // a web page that returns 403/404 can still have content
+ // a web page that returns 401/403/404 can still have content
&& m_reply->error() != QNetworkReply::ContentOperationNotPermittedError
- && m_reply->error() != QNetworkReply::ContentNotFoundError) {
+ && m_reply->error() != QNetworkReply::ContentNotFoundError
+ && m_reply->error() != QNetworkReply::AuthenticationRequiredError
+ && m_reply->error() != QNetworkReply::ProxyAuthenticationRequiredError) {
QUrl url = m_reply->url();
ResourceError error(url.host(), m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(),
url.toString(), m_reply->errorString());
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp
index a17f3ab..bc9d2f4 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp
@@ -96,7 +96,7 @@ String pathGetFileName(const String& path)
String directoryName(const String& path)
{
- return String(QFileInfo(path).baseName());
+ return String(QFileInfo(path).absolutePath());
}
Vector<String> listDirectory(const String& path, const String& filter)
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp b/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp
index a6c7513..57a5e99 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp
@@ -352,5 +352,15 @@ String imageTitle(const String& filename, const IntSize& size)
return QCoreApplication::translate("QWebPage", "%1 (%2x%3 pixels)", "Title string for images").arg(filename).arg(size.width()).arg(size.height());
}
+String mediaElementLoadingStateText()
+{
+ return QCoreApplication::translate("QWebPage", "Loading...", "Media controller status message when the media is loading");
+}
+
+String mediaElementLiveBroadcastStateText()
+{
+ return QCoreApplication::translate("QWebPage", "Live Broadcast", "Media controller status message when watching a live broadcast");
+}
+
}
// vim: ts=4 sw=4 et
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
index 4a6df0a..0b42e5c 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
@@ -608,7 +608,7 @@ bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo
void RenderThemeQt::adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style,
Element* e) const
{
- // WORKAROUND because html4.css specifies -webkit-border-radius for <select> so we override it here
+ // WORKAROUND because html.css specifies -webkit-border-radius for <select> so we override it here
// see also http://bugs.webkit.org/show_bug.cgi?id=18399
style->resetBorderRadius();
diff --git a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp
index 702cf02..d9b57b2 100644
--- a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp
@@ -29,6 +29,7 @@
#include "DatabaseAuthorizer.h"
#include "Logging.h"
+#include "SQLiteFileSystem.h"
#include "SQLiteStatement.h"
#include <sqlite3.h>
@@ -60,9 +61,7 @@ bool SQLiteDatabase::open(const String& filename)
{
close();
- // SQLite expects a null terminator on its UTF-16 strings.
- String path = filename;
- m_lastError = sqlite3_open16(path.charactersWithNullTermination(), &m_db);
+ m_lastError = SQLiteFileSystem::openDatabase(filename, &m_db);
if (m_lastError != SQLITE_OK) {
LOG_ERROR("SQLite database failed to load from %s\nCause - %s", filename.ascii().data(),
sqlite3_errmsg(m_db));
diff --git a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.cpp b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.cpp
new file mode 100644
index 0000000..8cd7e80
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.cpp
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#include "config.h"
+#include "SQLiteFileSystem.h"
+
+#include "FileSystem.h"
+#include "SQLiteDatabase.h"
+#include "SQLiteStatement.h"
+#include <sqlite3.h>
+
+namespace WebCore {
+
+SQLiteFileSystem::SQLiteFileSystem()
+{
+}
+
+void SQLiteFileSystem::registerSQLiteVFS()
+{
+}
+
+int SQLiteFileSystem::openDatabase(const String& fileName, sqlite3** database)
+{
+ // SQLite expects a null terminator on its UTF-16 strings.
+ String path = fileName;
+ return sqlite3_open16(path.charactersWithNullTermination(), database);
+}
+
+String SQLiteFileSystem::getFileNameForNewDatabase(const String& dbDir, const String&,
+ const String&, SQLiteDatabase* db)
+{
+ // try to get the next sequence number from the given database
+ // if we can't get a number, return an empty string
+ SQLiteStatement sequenceStatement(*db, "SELECT seq FROM sqlite_sequence WHERE name='Databases';");
+ if (sequenceStatement.prepare() != SQLResultOk)
+ return String();
+ int result = sequenceStatement.step();
+ int64_t seq = 0;
+ if (result == SQLResultRow)
+ seq = sequenceStatement.getColumnInt64(0);
+ else if (result != SQLResultDone)
+ return String();
+ sequenceStatement.finalize();
+
+ // increment the number until we can use it to form a file name that doesn't exist
+ String fileName;
+ do {
+ ++seq;
+ fileName = pathByAppendingComponent(dbDir, String::format("%016llx.db", seq));
+ } while (fileExists(fileName));
+
+ return String::format("%016llx.db", seq);
+}
+
+String SQLiteFileSystem::appendDatabaseFileNameToPath(const String& path, const String& fileName)
+{
+ return pathByAppendingComponent(path, fileName);
+}
+
+bool SQLiteFileSystem::ensureDatabaseDirectoryExists(const String& path)
+{
+ if (path.isEmpty())
+ return false;
+ return makeAllDirectories(path);
+}
+
+bool SQLiteFileSystem::ensureDatabaseFileExists(const String& fileName, bool checkPathOnly)
+{
+ if (fileName.isEmpty())
+ return false;
+
+ if (checkPathOnly) {
+ String dir = directoryName(fileName);
+ return ensureDatabaseDirectoryExists(dir);
+ }
+
+ return fileExists(fileName);
+}
+
+bool SQLiteFileSystem::deleteEmptyDatabaseDirectory(const String& path)
+{
+ return deleteEmptyDirectory(path);
+}
+
+bool SQLiteFileSystem::deleteDatabaseFile(const String& fileName)
+{
+ return deleteFile(fileName);
+}
+
+long long SQLiteFileSystem::getDatabaseFileSize(const String& fileName)
+{
+ long long size;
+ return getFileSize(fileName, size) ? size : 0;
+}
+
+} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.h b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.h
new file mode 100644
index 0000000..0a26e9d
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#ifndef SQLiteFileSystem_h
+#define SQLiteFileSystem_h
+
+#include "PlatformString.h"
+#include <wtf/Threading.h>
+
+struct sqlite3;
+
+namespace WebCore {
+
+class SQLiteDatabase;
+
+// A class that abstracts the file system related operations required
+// by the WebKit database code.
+class SQLiteFileSystem {
+public:
+ // Registers a user-defined SQLite VFS.
+ static void registerSQLiteVFS();
+
+ // Opens a database file.
+ //
+ // fileName - The name of the database file.
+ // database - The SQLite structure that represents the database stored
+ // in the given file.
+ static int openDatabase(const String& fileName, sqlite3** database);
+
+ // Returns the file name for a database.
+ //
+ // dbDir - The directory where all databases are stored.
+ // dbName - The name of the database.
+ // originIdentifier - The origin that wants to use this database.
+ // db - A database with a number generator used to create unique file names.
+ static String getFileNameForNewDatabase(const String& dbDir, const String& dbName,
+ const String& originIdentifier, SQLiteDatabase* db);
+
+ // Creates an absolute file path given a directory and a file name.
+ //
+ // path - The directory.
+ // fileName - The file name.
+ static String appendDatabaseFileNameToPath(const String& path, const String& fileName);
+
+ // Makes sure the given directory exists, by creating all missing directories
+ // on the given path.
+ //
+ // path - The directory.
+ static bool ensureDatabaseDirectoryExists(const String& path);
+
+ // If 'checkPathOnly' is false, then this method only checks if the given file exists.
+ // If 'checkPathOnly' is true, then this method makes sure all directories on the
+ // given path exist by creating the missing ones, and does not check if the file
+ // itself exists.
+ //
+ // Sometimes we expect a DB file to exist; other times, we're OK with creating a new
+ // DB file, but we want to make sure that the directory in which we want to put the
+ // new DB file exists. This method covers both cases.
+ //
+ // fileName - The file name.
+ // checkPathOnly - If true, we only make sure that the given directory exists.
+ // If false, we only check if the file exists.
+ static bool ensureDatabaseFileExists(const String& fileName, bool checkPathOnly);
+
+ // Deletes an empty database directory.
+ //
+ // path - The directory.
+ static bool deleteEmptyDatabaseDirectory(const String& path);
+
+ // Deletes a database file.
+ //
+ // fileName - The file name.
+ static bool deleteDatabaseFile(const String& fileName);
+
+ // Returns the size of the database file.
+ //
+ // fileName - The file name.
+ static long long getDatabaseFileSize(const String& fileName);
+
+private:
+ // do not instantiate this class
+ SQLiteFileSystem();
+}; // class SQLiteFileSystem
+
+} // namespace WebCore
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorInternalICU.h b/src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorInternalICU.h
index d4b25e7..68b7003 100644
--- a/src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorInternalICU.h
+++ b/src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorInternalICU.h
@@ -21,10 +21,12 @@
#ifndef TextBreakIteratorInternalICU_h
#define TextBreakIteratorInternalICU_h
-#include <wtf/unicode/Unicode.h>
+// FIXME: Now that this handles locales for ICU, not just for text breaking,
+// this file and the various implementation files should be renamed.
namespace WebCore {
+ const char* currentSearchLocaleID();
const char* currentTextBreakLocaleID();
}
diff --git a/src/3rdparty/webkit/WebCore/platform/text/android/TextBreakIteratorInternalICU.cpp b/src/3rdparty/webkit/WebCore/platform/text/android/TextBreakIteratorInternalICU.cpp
index 9bebe74..9732e92 100644
--- a/src/3rdparty/webkit/WebCore/platform/text/android/TextBreakIteratorInternalICU.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/text/android/TextBreakIteratorInternalICU.cpp
@@ -28,8 +28,15 @@
namespace WebCore {
+const char* currentSearchLocaleID()
+{
+ // FIXME: Should use system locale.
+ return "";
+}
+
const char* currentTextBreakLocaleID()
{
+ // FIXME: Should use system locale.
return "en_us";
}
diff --git a/src/3rdparty/webkit/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm b/src/3rdparty/webkit/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm
index 92983eb..5da10e0 100644
--- a/src/3rdparty/webkit/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm
+++ b/src/3rdparty/webkit/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -21,41 +21,79 @@
#include "config.h"
#include "TextBreakIteratorInternalICU.h"
+#include <wtf/RetainPtr.h>
+
namespace WebCore {
static const int maxLocaleStringLength = 32;
-// This code was swiped from the CarbonCore UnicodeUtilities. One change from that is to use the empty
-// string instead of the "old locale model" as the ultimate fallback. This change is per the UnicodeUtilities
-// engineer.
-static void getTextBreakLocale(char localeStringBuffer[maxLocaleStringLength])
+static inline RetainPtr<CFStringRef> textBreakLocalePreference()
{
- // Empty string means "root locale", which is what we use if we can't use a pref.
+ RetainPtr<CFPropertyListRef> locale(AdoptCF, CFPreferencesCopyValue(CFSTR("AppleTextBreakLocale"),
+ kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
+ if (!locale || CFGetTypeID(locale.get()) != CFStringGetTypeID())
+ return 0;
+ return static_cast<CFStringRef>(locale.get());
+}
- // We get the parts string from AppleTextBreakLocale pref.
- // If that fails then look for the first language in the AppleLanguages pref.
- CFStringRef prefLocaleStr = (CFStringRef)CFPreferencesCopyValue(CFSTR("AppleTextBreakLocale"),
- kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
- if (!prefLocaleStr) {
- CFArrayRef appleLangArr = (CFArrayRef)CFPreferencesCopyValue(CFSTR("AppleLanguages"),
- kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
- if (appleLangArr) {
- // Take the topmost language. Retain so that we can blindly release later.
- prefLocaleStr = (CFStringRef)CFArrayGetValueAtIndex(appleLangArr, 0);
- if (prefLocaleStr)
- CFRetain(prefLocaleStr);
- CFRelease(appleLangArr);
- }
- }
- if (prefLocaleStr) {
- // Canonicalize pref string in case it is not in the canonical format.
- CFStringRef canonLocaleCFStr = CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, prefLocaleStr);
- if (canonLocaleCFStr) {
- CFStringGetCString(canonLocaleCFStr, localeStringBuffer, maxLocaleStringLength, kCFStringEncodingASCII);
- CFRelease(canonLocaleCFStr);
- }
- CFRelease(prefLocaleStr);
+static RetainPtr<CFStringRef> topLanguagePreference()
+{
+ RetainPtr<CFPropertyListRef> languages(AdoptCF, CFPreferencesCopyValue(CFSTR("AppleLanguages"),
+ kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
+ if (!languages || CFGetTypeID(languages.get()) != CFArrayGetTypeID())
+ return 0;
+ CFArrayRef languagesArray = static_cast<CFArrayRef>(languages.get());
+ if (CFArrayGetCount(languagesArray) < 1)
+ return 0;
+ const void* value = CFArrayGetValueAtIndex(languagesArray, 0);
+ if (!value || CFGetTypeID(value) != CFStringGetTypeID())
+ return 0;
+ return static_cast<CFStringRef>(value);
+}
+
+static RetainPtr<CFStringRef> canonicalLanguageIdentifier(CFStringRef locale)
+{
+ if (!locale)
+ return 0;
+ RetainPtr<CFStringRef> canonicalLocale(AdoptCF,
+ CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, locale));
+ if (!canonicalLocale)
+ return locale;
+ return canonicalLocale;
+}
+
+static void getLocale(CFStringRef locale, char localeStringBuffer[maxLocaleStringLength])
+{
+ // Empty string means "root locale", and that is what we use if we can't get a preference.
+ localeStringBuffer[0] = 0;
+ if (!locale)
+ return;
+ CFStringGetCString(locale, localeStringBuffer, maxLocaleStringLength, kCFStringEncodingASCII);
+}
+
+static void getSearchLocale(char localeStringBuffer[maxLocaleStringLength])
+{
+ getLocale(canonicalLanguageIdentifier(topLanguagePreference().get()).get(), localeStringBuffer);
+}
+
+const char* currentSearchLocaleID()
+{
+ static char localeStringBuffer[maxLocaleStringLength];
+ static bool gotSearchLocale = false;
+ if (!gotSearchLocale) {
+ getSearchLocale(localeStringBuffer);
+ gotSearchLocale = true;
}
+ return localeStringBuffer;
+}
+
+static void getTextBreakLocale(char localeStringBuffer[maxLocaleStringLength])
+{
+ // If there is no text break locale, use the top language preference.
+ RetainPtr<CFStringRef> locale = textBreakLocalePreference();
+ if (!locale)
+ locale = topLanguagePreference();
+ getLocale(canonicalLanguageIdentifier(locale.get()).get(), localeStringBuffer);
}
const char* currentTextBreakLocaleID()
diff --git a/src/3rdparty/webkit/WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp b/src/3rdparty/webkit/WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp
index ce436df..e417e17 100644
--- a/src/3rdparty/webkit/WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp
@@ -23,6 +23,12 @@
namespace WebCore {
+const char* currentSearchLocaleID()
+{
+ // FIXME: Should use system locale.
+ return "";
+}
+
const char* currentTextBreakLocaleID()
{
// Using en_US_POSIX now so word selection in address field works as expected as before (double-clicking
diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp
index 2c5adc5..8737572 100644
--- a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp
@@ -239,8 +239,12 @@ void PluginView::performRequest(PluginRequest* request)
m_streams.add(stream);
stream->start();
} else {
+ // If the target frame is our frame, we could destroy the
+ // PluginView, so we protect it. <rdar://problem/6991251>
+ RefPtr<PluginView> protect(this);
+
m_parentFrame->loader()->load(request->frameLoadRequest().resourceRequest(), targetFrameName, false);
-
+
// FIXME: <rdar://problem/4807469> This should be sent when the document has finished loading
if (request->sendNotification()) {
PluginView::setCurrentPluginView(this);
@@ -481,6 +485,11 @@ PassRefPtr<JSC::Bindings::Instance> PluginView::bindingInstance()
if (!m_plugin || !m_plugin->pluginFuncs()->getvalue)
return 0;
+ // On Windows, calling Java's NPN_GetValue can allow the message loop to
+ // run, allowing loading to take place or JavaScript to run. Protect the
+ // PluginView from destruction. <rdar://problem/6978804>
+ RefPtr<PluginView> protect(this);
+
NPError npErr;
{
PluginView::setCurrentPluginView(this);
@@ -491,6 +500,13 @@ PassRefPtr<JSC::Bindings::Instance> PluginView::bindingInstance()
PluginView::setCurrentPluginView(0);
}
+ if (hasOneRef()) {
+ // The renderer for the PluginView was destroyed during the above call, and
+ // the PluginView will be destroyed when this function returns, so we
+ // return null.
+ return 0;
+ }
+
if (npErr != NPERR_NO_ERROR || !object)
return 0;
@@ -667,7 +683,7 @@ bool PluginView::isCallingPlugin()
return s_callingPlugin > 0;
}
-PluginView* PluginView::create(Frame* parentFrame, const IntSize& size, Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
+PassRefPtr<PluginView> PluginView::create(Frame* parentFrame, const IntSize& size, Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
{
// if we fail to find a plugin for this MIME type, findPlugin will search for
// a plugin by the file extension and update the MIME type, so pass a mutable String
@@ -680,7 +696,7 @@ PluginView* PluginView::create(Frame* parentFrame, const IntSize& size, Element*
plugin = PluginDatabase::installedPlugins()->findPlugin(url, mimeTypeCopy);
}
- return new PluginView(parentFrame, size, plugin, element, url, paramNames, paramValues, mimeTypeCopy, loadManually);
+ return adoptRef(new PluginView(parentFrame, size, plugin, element, url, paramNames, paramValues, mimeTypeCopy, loadManually));
}
void PluginView::freeStringArray(char** stringArray, int length)
diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.h b/src/3rdparty/webkit/WebCore/plugins/PluginView.h
index 41d986b..3ed6756 100644
--- a/src/3rdparty/webkit/WebCore/plugins/PluginView.h
+++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.h
@@ -108,7 +108,7 @@ namespace WebCore {
class PluginView : public Widget, private PluginStreamClient, public PluginManualLoader {
public:
- static PluginView* create(Frame* parentFrame, const IntSize&, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually);
+ static PassRefPtr<PluginView> create(Frame* parentFrame, const IntSize&, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually);
virtual ~PluginView();
PluginPackage* plugin() const { return m_plugin.get(); }
diff --git a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp
index c59a9bb..ce0f859 100644
--- a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp
@@ -373,10 +373,10 @@ void PluginView::setNPWindowIfNeeded()
m_npWindow.height = m_windowRect.height();
// TODO: (also clip against scrollbars, etc.)
- m_npWindow.clipRect.left = 0;
- m_npWindow.clipRect.top = 0;
- m_npWindow.clipRect.right = m_windowRect.width();
- m_npWindow.clipRect.bottom = m_windowRect.height();
+ m_npWindow.clipRect.left = max(0, m_windowRect.x());
+ m_npWindow.clipRect.top = max(0, m_windowRect.y());
+ m_npWindow.clipRect.right = m_windowRect.x() + m_windowRect.width();
+ m_npWindow.clipRect.bottom = m_windowRect.y() + m_windowRect.height();
PluginView::setCurrentPluginView(this);
JSC::JSLock::DropAllLocks dropAllLocks(false);
diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginMessageThrottlerWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginMessageThrottlerWin.cpp
index 27bf5b9..b79ca20 100644
--- a/src/3rdparty/webkit/WebCore/plugins/win/PluginMessageThrottlerWin.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginMessageThrottlerWin.cpp
@@ -85,6 +85,9 @@ void PluginMessageThrottlerWin::messageThrottleTimerFired(Timer<PluginMessageThr
if (message == m_back)
m_back = 0;
+ // Protect the PluginView from destruction while calling its window proc.
+ // <rdar://problem/6930280>
+ RefPtr<PluginView> protect(m_pluginView);
::CallWindowProc(m_pluginView->pluginWndProc(), message->hWnd, message->msg, message->wParam, message->lParam);
freeMessage(message);
diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp
index b52553e..40d9b2a 100644
--- a/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp
@@ -81,9 +81,16 @@ bool PluginPackage::isPluginBlacklisted()
if (compareFileVersion(slPluginMinRequired) < 0)
return true;
- } else if (fileName() == "npmozax.dll")
+ } else if (fileName() == "npmozax.dll") {
// Bug 15217: Mozilla ActiveX control complains about missing xpcom_core.dll
return true;
+ } else if (name() == "Yahoo Application State Plugin") {
+ // https://bugs.webkit.org/show_bug.cgi?id=26860
+ // Bug in Yahoo Application State plug-in earlier than 1.0.0.6 leads to heap corruption.
+ static const PlatformModuleVersion yahooAppStatePluginMinRequired(0x00000006, 0x00010000);
+ if (compareFileVersion(yahooAppStatePluginMinRequired) < 0)
+ return true;
+ }
return false;
}
@@ -248,7 +255,7 @@ bool PluginPackage::load()
return false;
// Load the library
- m_module = ::LoadLibraryW(m_path.charactersWithNullTermination());
+ m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
if (!::SetCurrentDirectoryW(currentPath)) {
if (m_module)
diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp
index e477965..272a540 100644
--- a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp
@@ -110,11 +110,6 @@ static BYTE* endPaint;
HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint)
{
-#if (COMPILER(MINGW))
- Q_UNUSED(hWnd)
- Q_UNUSED(lpPaint)
- return 0;
-#else
PluginView* pluginView = reinterpret_cast<PluginView*>(GetProp(hWnd, kWebPluginViewProperty));
if (pluginView && pluginView->m_wmPrintHDC) {
// We're secretly handling WM_PRINTCLIENT, so set up the PAINTSTRUCT so
@@ -125,6 +120,17 @@ HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint)
return pluginView->m_wmPrintHDC;
}
+#if COMPILER(GCC)
+ HDC result;
+ asm ("push %2\n"
+ "push %3\n"
+ "call *%4\n"
+ : "=a" (result)
+ : "a" (beginPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*beginPaint)
+ : "memory"
+ );
+ return result;
+#else
// Call through to the original BeginPaint.
__asm mov eax, beginPaintSysCall
__asm push lpPaint
@@ -135,11 +141,6 @@ HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint)
BOOL WINAPI PluginView::hookedEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint)
{
-#if (COMPILER(MINGW))
- Q_UNUSED(hWnd)
- Q_UNUSED(lpPaint)
- return FALSE;
-#else
PluginView* pluginView = reinterpret_cast<PluginView*>(GetProp(hWnd, kWebPluginViewProperty));
if (pluginView && pluginView->m_wmPrintHDC) {
// We're secretly handling WM_PRINTCLIENT, so we don't have to do any
@@ -147,15 +148,24 @@ BOOL WINAPI PluginView::hookedEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint)
return TRUE;
}
+#if COMPILER(GCC)
+ BOOL result;
+ asm ("push %2\n"
+ "push %3\n"
+ "call *%4\n"
+ : "=a" (result)
+ : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "g" (*endPaint)
+ );
+ return result;
+#else
// Call through to the original EndPaint.
__asm mov eax, endPaintSysCall
__asm push lpPaint
__asm push hWnd
__asm call endPaint
-#endif
+#endif
}
-#if (!COMPILER(MINGW))
static void hook(const char* module, const char* proc, unsigned& sysCallID, BYTE*& pProc, const void* pNewProc)
{
// See <http://www.fengyuan.com/article/wmprint.html> for an explanation of
@@ -163,7 +173,7 @@ static void hook(const char* module, const char* proc, unsigned& sysCallID, BYTE
HINSTANCE hMod = GetModuleHandleA(module);
- pProc = reinterpret_cast<BYTE*>(GetProcAddress(hMod, proc));
+ pProc = reinterpret_cast<BYTE*>(reinterpret_cast<ptrdiff_t>(GetProcAddress(hMod, proc)));
if (pProc[0] != 0xB8)
return;
@@ -193,10 +203,10 @@ static void setUpOffscreenPaintingHooks(HDC (WINAPI*hookedBeginPaint)(HWND, PAIN
// we hook into BeginPaint/EndPaint to allow their normal WM_PAINT handling
// to draw into a given HDC. Note that this hooking affects the entire
// process.
- hook("user32.dll", "BeginPaint", beginPaintSysCall, beginPaint, hookedBeginPaint);
- hook("user32.dll", "EndPaint", endPaintSysCall, endPaint, hookedEndPaint);
+ hook("user32.dll", "BeginPaint", beginPaintSysCall, beginPaint, reinterpret_cast<const void *>(reinterpret_cast<ptrdiff_t>(hookedBeginPaint)));
+ hook("user32.dll", "EndPaint", endPaintSysCall, endPaint, reinterpret_cast<const void *>(reinterpret_cast<ptrdiff_t>(hookedEndPaint)));
+
}
-#endif
static bool registerPluginView()
{
@@ -940,9 +950,8 @@ void PluginView::init()
if (m_isWindowed) {
registerPluginView();
-#if (!COMPILER(MINGW))
setUpOffscreenPaintingHooks(hookedBeginPaint, hookedEndPaint);
-#endif
+
DWORD flags = WS_CHILD;
if (isSelfVisible())
flags |= WS_VISIBLE;
diff --git a/src/3rdparty/webkit/WebCore/rendering/AutoTableLayout.cpp b/src/3rdparty/webkit/WebCore/rendering/AutoTableLayout.cpp
index 648e843..afb72cf 100644
--- a/src/3rdparty/webkit/WebCore/rendering/AutoTableLayout.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/AutoTableLayout.cpp
@@ -94,7 +94,7 @@ void AutoTableLayout::recalcColumn(int effCol)
w.setRawValue(32760);
if (w.isNegative())
w.setValue(0);
- switch(w.type()) {
+ switch (w.type()) {
case Fixed:
// ignore width=0
if (w.value() > 0 && (int)l.width.type() != Percent) {
@@ -573,7 +573,7 @@ void AutoTableLayout::layout()
int reduction = min(w, excess);
// the lines below might look inconsistent, but that's the way it's handled in mozilla
excess -= reduction;
- int newWidth = max(int (m_layoutStruct[i].effMinWidth), w - reduction);
+ int newWidth = max(static_cast<int>(m_layoutStruct[i].effMinWidth), w - reduction);
available += w - newWidth;
m_layoutStruct[i].calcWidth = newWidth;
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/InlineBox.cpp b/src/3rdparty/webkit/WebCore/rendering/InlineBox.cpp
index 2d956a8..bbf11b3 100644
--- a/src/3rdparty/webkit/WebCore/rendering/InlineBox.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/InlineBox.cpp
@@ -88,10 +88,10 @@ void InlineBox::showTreeForThis() const
int InlineBox::height() const
{
#if ENABLE(SVG)
- if (isSVG())
- return svgBoxHeight();
+ if (hasVirtualHeight())
+ return virtualHeight();
#endif
-
+
if (renderer()->isText())
return m_isText ? renderer()->style(m_firstLine)->font().height() : 0;
if (renderer()->isBox() && parent())
@@ -244,26 +244,26 @@ bool InlineBox::prevOnLineExists() const
return m_prevOnLineExists;
}
-InlineBox* InlineBox::firstLeafChild()
-{
- return this;
-}
-
-InlineBox* InlineBox::lastLeafChild()
-{
- return this;
-}
-
-InlineBox* InlineBox::nextLeafChild()
+InlineBox* InlineBox::nextLeafChild() const
{
- return parent() ? parent()->firstLeafChildAfterBox(this) : 0;
+ InlineBox* leaf = 0;
+ for (InlineBox* box = nextOnLine(); box && !leaf; box = box->nextOnLine())
+ leaf = box->isLeaf() ? box : static_cast<InlineFlowBox*>(box)->firstLeafChild();
+ if (!leaf && parent())
+ leaf = parent()->nextLeafChild();
+ return leaf;
}
-
-InlineBox* InlineBox::prevLeafChild()
+
+InlineBox* InlineBox::prevLeafChild() const
{
- return parent() ? parent()->lastLeafChildBeforeBox(this) : 0;
+ InlineBox* leaf = 0;
+ for (InlineBox* box = prevOnLine(); box && !leaf; box = box->prevOnLine())
+ leaf = box->isLeaf() ? box : static_cast<InlineFlowBox*>(box)->lastLeafChild();
+ if (!leaf && parent())
+ leaf = parent()->prevLeafChild();
+ return leaf;
}
-
+
RenderObject::SelectionState InlineBox::selectionState()
{
return renderer()->selectionState();
diff --git a/src/3rdparty/webkit/WebCore/rendering/InlineBox.h b/src/3rdparty/webkit/WebCore/rendering/InlineBox.h
index 9585278..0f66edd 100644
--- a/src/3rdparty/webkit/WebCore/rendering/InlineBox.h
+++ b/src/3rdparty/webkit/WebCore/rendering/InlineBox.h
@@ -49,7 +49,7 @@ public:
, m_dirty(false)
, m_extracted(false)
#if ENABLE(SVG)
- , m_isSVG(false)
+ , m_hasVirtualHeight(false)
#endif
, m_endsWithBreak(false)
, m_hasSelectedChildren(false)
@@ -82,7 +82,7 @@ public:
, m_dirty(dirty)
, m_extracted(extracted)
#if ENABLE(SVG)
- , m_isSVG(false)
+ , m_hasVirtualHeight(false)
#endif
, m_endsWithBreak(false)
, m_hasSelectedChildren(false)
@@ -129,18 +129,22 @@ public:
#ifndef NDEBUG
void showTreeForThis() const;
#endif
+
+ bool isText() const { return m_isText; }
+ void setIsText(bool b) { m_isText = b; }
+
virtual bool isInlineBox() { return false; }
virtual bool isInlineFlowBox() const { return false; }
virtual bool isInlineTextBox() { return false; }
virtual bool isRootInlineBox() const { return false; }
#if ENABLE(SVG)
virtual bool isSVGRootInlineBox() { return false; }
- bool isSVG() const { return m_isSVG; }
- void setIsSVG(bool b) { m_isSVG = b; }
-#endif
- bool isText() const { return m_isText; }
- void setIsText(bool b) { m_isText = b; }
+ bool hasVirtualHeight() const { return m_hasVirtualHeight; }
+ void setHasVirtualHeight() { m_hasVirtualHeight = true; }
+ virtual int virtualHeight() const { ASSERT_NOT_REACHED(); return 0; }
+#endif
+
bool isConstructed() { return m_constructed; }
virtual void setConstructed()
{
@@ -171,10 +175,10 @@ public:
bool nextOnLineExists() const;
bool prevOnLineExists() const;
- virtual InlineBox* firstLeafChild();
- virtual InlineBox* lastLeafChild();
- InlineBox* nextLeafChild();
- InlineBox* prevLeafChild();
+ virtual bool isLeaf() const { return true; }
+
+ InlineBox* nextLeafChild() const;
+ InlineBox* prevLeafChild() const;
RenderObject* renderer() const { return m_renderer; }
@@ -201,6 +205,9 @@ public:
int height() const;
+ inline int baselinePosition(bool isRootLineBox) const { return renderer()->baselinePosition(m_firstLine, isRootLineBox); }
+ inline int lineHeight(bool isRootLineBox) const { return renderer()->lineHeight(m_firstLine, isRootLineBox); }
+
virtual int topOverflow() const { return y(); }
virtual int bottomOverflow() const { return y() + height(); }
virtual int leftOverflow() const { return x(); }
@@ -243,11 +250,6 @@ public:
return 0;
}
-protected:
-#if ENABLE(SVG)
- virtual int svgBoxHeight() const { return 0; }
-#endif
-
private:
InlineBox* m_next; // The next element on the same line as us.
InlineBox* m_prev; // The previous element on the same line as us.
@@ -272,10 +274,7 @@ private:
protected:
bool m_dirty : 1;
bool m_extracted : 1;
-
-#if ENABLE(SVG)
- bool m_isSVG : 1;
-#endif
+ bool m_hasVirtualHeight : 1;
// for RootInlineBox
bool m_endsWithBreak : 1; // Whether the line ends with a <br>.
diff --git a/src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.cpp b/src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.cpp
index be6b966..e46ba38 100644
--- a/src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.cpp
@@ -371,7 +371,7 @@ void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
if (curr->renderer()->isPositioned())
continue; // Positioned placeholders don't affect calculations.
if (curr->y() == PositionTop || curr->y() == PositionBottom) {
- int lineHeight = curr->renderer()->lineHeight(m_firstLine);
+ int lineHeight = curr->lineHeight(false);
if (curr->y() == PositionTop) {
if (maxAscent + maxDescent < lineHeight)
maxDescent = lineHeight - maxAscent;
@@ -404,11 +404,11 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
{
if (isRootInlineBox()) {
// Examine our root box.
- int lineHeight = renderer()->lineHeight(m_firstLine, true);
- int baseline = renderer()->baselinePosition(m_firstLine, true);
+ int height = lineHeight(true);
+ int baseline = baselinePosition(true);
if (hasTextChildren() || strictMode) {
int ascent = baseline;
- int descent = lineHeight - ascent;
+ int descent = height - ascent;
if (maxAscent < ascent)
maxAscent = ascent;
if (maxDescent < descent)
@@ -456,8 +456,8 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
}
}
} else {
- lineHeight = curr->renderer()->lineHeight(m_firstLine);
- baseline = curr->renderer()->baselinePosition(m_firstLine);
+ lineHeight = curr->lineHeight(false);
+ baseline = curr->baselinePosition(false);
}
curr->setY(verticalPositionForBox(curr, m_firstLine));
@@ -485,8 +485,8 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent,
int& topPosition, int& bottomPosition, int& selectionTop, int& selectionBottom)
{
if (isRootInlineBox())
- setY(yPos + max(0, maxAscent - renderer()->baselinePosition(m_firstLine, true))); // Place our root box.
-
+ setY(yPos + max(0, maxAscent - baselinePosition(true))); // Place our root box.
+
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->renderer()->isPositioned())
continue; // Positioned placeholders don't affect calculations.
@@ -501,11 +501,11 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent,
if (curr->y() == PositionTop)
curr->setY(yPos);
else if (curr->y() == PositionBottom)
- curr->setY(yPos + maxHeight - curr->renderer()->lineHeight(m_firstLine));
+ curr->setY(yPos + maxHeight - curr->lineHeight(false));
else {
if ((isInlineFlow && !static_cast<InlineFlowBox*>(curr)->hasTextChildren()) && !curr->boxModelObject()->hasHorizontalBordersOrPadding() && !strictMode)
childAffectsTopBottomPos = false;
- int posAdjust = maxAscent - curr->renderer()->baselinePosition(m_firstLine);
+ int posAdjust = maxAscent - curr->baselinePosition(false);
if (!childAffectsTopBottomPos)
posAdjust = max(0, posAdjust);
curr->setY(curr->y() + yPos + posAdjust);
@@ -521,7 +521,8 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent,
int overflowBottom = 0;
if (curr->isText() || curr->isInlineFlowBox()) {
const Font& font = curr->renderer()->style(m_firstLine)->font();
- newY += curr->renderer()->baselinePosition(m_firstLine) - font.ascent();
+ newY += curr->baselinePosition(false) - font.ascent();
+
for (ShadowData* shadow = curr->renderer()->style()->textShadow(); shadow; shadow = shadow->next) {
overflowTop = min(overflowTop, shadow->y - shadow->blur);
overflowBottom = max(overflowBottom, shadow->y + shadow->blur);
@@ -565,7 +566,7 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent,
if (isRootInlineBox()) {
const Font& font = renderer()->style(m_firstLine)->font();
- setY(y() + renderer()->baselinePosition(m_firstLine, true) - font.ascent());
+ setY(y() + baselinePosition(true) - font.ascent());
if (hasTextChildren() || strictMode) {
selectionTop = min(selectionTop, y());
selectionBottom = max(selectionBottom, y() + height());
@@ -980,33 +981,19 @@ void InlineFlowBox::paintTextDecorations(RenderObject::PaintInfo& paintInfo, int
}
}
-InlineBox* InlineFlowBox::firstLeafChild()
-{
- return firstLeafChildAfterBox();
-}
-
-InlineBox* InlineFlowBox::lastLeafChild()
-{
- return lastLeafChildBeforeBox();
-}
-
-InlineBox* InlineFlowBox::firstLeafChildAfterBox(InlineBox* start)
+InlineBox* InlineFlowBox::firstLeafChild() const
{
InlineBox* leaf = 0;
- for (InlineBox* box = start ? start->nextOnLine() : firstChild(); box && !leaf; box = box->nextOnLine())
- leaf = box->firstLeafChild();
- if (start && !leaf && parent())
- return parent()->firstLeafChildAfterBox(this);
+ for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnLine())
+ leaf = child->isLeaf() ? child : static_cast<InlineFlowBox*>(child)->firstLeafChild();
return leaf;
}
-InlineBox* InlineFlowBox::lastLeafChildBeforeBox(InlineBox* start)
+InlineBox* InlineFlowBox::lastLeafChild() const
{
InlineBox* leaf = 0;
- for (InlineBox* box = start ? start->prevOnLine() : lastChild(); box && !leaf; box = box->prevOnLine())
- leaf = box->lastLeafChild();
- if (start && !leaf && parent())
- return parent()->lastLeafChildBeforeBox(this);
+ for (InlineBox* child = lastChild(); child && !leaf; child = child->prevOnLine())
+ leaf = child->isLeaf() ? child : static_cast<InlineFlowBox*>(child)->lastLeafChild();
return leaf;
}
@@ -1037,7 +1024,7 @@ int InlineFlowBox::placeEllipsisBox(bool ltr, int blockLeftEdge, int blockRightE
int visibleLeftEdge = blockLeftEdge;
int visibleRightEdge = blockRightEdge;
- while(box) {
+ while (box) {
int currResult = box->placeEllipsisBox(ltr, visibleLeftEdge, visibleRightEdge, ellipsisWidth, foundBox);
if (currResult != -1 && result == -1)
result = currResult;
diff --git a/src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.h b/src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.h
index ab1b6f2..9bb1162 100644
--- a/src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.h
+++ b/src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.h
@@ -58,13 +58,13 @@ public:
InlineFlowBox* prevFlowBox() const { return static_cast<InlineFlowBox*>(m_prevLine); }
InlineFlowBox* nextFlowBox() const { return static_cast<InlineFlowBox*>(m_nextLine); }
- InlineBox* firstChild() { checkConsistency(); return m_firstChild; }
- InlineBox* lastChild() { checkConsistency(); return m_lastChild; }
+ InlineBox* firstChild() const { checkConsistency(); return m_firstChild; }
+ InlineBox* lastChild() const { checkConsistency(); return m_lastChild; }
- virtual InlineBox* firstLeafChild();
- virtual InlineBox* lastLeafChild();
- InlineBox* firstLeafChildAfterBox(InlineBox* start = 0);
- InlineBox* lastLeafChildBeforeBox(InlineBox* start = 0);
+ virtual bool isLeaf() const { return false; }
+
+ InlineBox* firstLeafChild() const;
+ InlineBox* lastLeafChild() const;
virtual void setConstructed()
{
diff --git a/src/3rdparty/webkit/WebCore/rendering/InlineTextBox.cpp b/src/3rdparty/webkit/WebCore/rendering/InlineTextBox.cpp
index 53646f9..94dd4f3 100644
--- a/src/3rdparty/webkit/WebCore/rendering/InlineTextBox.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/InlineTextBox.cpp
@@ -753,8 +753,8 @@ void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, int tx, in
void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, int tx, int ty, DocumentMarker marker, RenderStyle* style, const Font& font)
{
- // Use same y positioning and height as for selection, so that when the selection and this highlight are on
- // the same word there are no pieces sticking out.
+ // Use same y positioning and height as for selection, so that when the selection and this highlight are on
+ // the same word there are no pieces sticking out.
int y = selectionTop();
int h = selectionHeight();
diff --git a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp
index fc2790c..74293e0 100644
--- a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp
@@ -32,6 +32,7 @@
#include "MediaControlElements.h"
+#include "LocalizedStrings.h"
#include "EventNames.h"
#include "FloatConversion.h"
#include "Frame.h"
@@ -40,6 +41,7 @@
#include "RenderMedia.h"
#include "RenderSlider.h"
#include "RenderTheme.h"
+#include "CString.h"
namespace WebCore {
@@ -74,51 +76,165 @@ void MediaControlShadowRootElement::updateStyle()
}
// ----------------------------
+
-MediaTextDisplayElement::MediaTextDisplayElement(Document* doc, PseudoId pseudo, HTMLMediaElement* mediaElement)
+MediaControlElement::MediaControlElement(Document* doc, PseudoId pseudo, HTMLMediaElement* mediaElement)
: HTMLDivElement(divTag, doc)
, m_mediaElement(mediaElement)
, m_pseudoStyleId(pseudo)
{
- RenderStyle* style = m_mediaElement->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
- RenderObject* renderer = createRenderer(m_mediaElement->renderer()->renderArena(), style);
- if (renderer) {
- setRenderer(renderer);
- renderer->setStyle(style);
- }
- setAttached();
setInDocument(true);
}
-void MediaTextDisplayElement::attachToParent(Element* parent)
+void MediaControlElement::attachToParent(Element* parent)
{
parent->addChild(this);
- if (renderer() && parent->renderer())
- parent->renderer()->addChild(renderer());
}
-void MediaTextDisplayElement::update()
+void MediaControlElement::update()
{
if (renderer())
renderer()->updateFromElement();
updateStyle();
}
-void MediaTextDisplayElement::updateStyle()
+PassRefPtr<RenderStyle> MediaControlElement::styleForElement()
+{
+ RenderStyle* style = m_mediaElement->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
+ if (!style)
+ return 0;
+
+ // text-decoration can't be overrided from CSS. So we do it here.
+ // See https://bugs.webkit.org/show_bug.cgi?id=27015
+ style->setTextDecoration(TDNONE);
+ style->setTextDecorationsInEffect(TDNONE);
+
+ return style;
+}
+
+bool MediaControlElement::rendererIsNeeded(RenderStyle* style)
+{
+ return HTMLDivElement::rendererIsNeeded(style) && parent() && parent()->renderer();
+}
+
+void MediaControlElement::attach()
{
- if (renderer() && m_mediaElement->renderer()) {
- RenderStyle* style = m_mediaElement->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
- renderer()->setStyle(style);
+ RefPtr<RenderStyle> style = styleForElement();
+ if (!style)
+ return;
+ bool needsRenderer = rendererIsNeeded(style.get());
+ if (!needsRenderer)
+ return;
+ RenderObject* renderer = createRenderer(m_mediaElement->renderer()->renderArena(), style.get());
+ if (!renderer)
+ return;
+ renderer->setStyle(style.get());
+ setRenderer(renderer);
+ if (parent() && parent()->renderer()) {
+ // Find next sibling with a renderer to determine where to insert.
+ Node* sibling = nextSibling();
+ while (sibling && !sibling->renderer())
+ sibling = sibling->nextSibling();
+ parent()->renderer()->addChild(renderer, sibling ? sibling->renderer() : 0);
}
+ ContainerNode::attach();
}
-MediaTimeDisplayElement::MediaTimeDisplayElement(Document* doc, HTMLMediaElement* element, bool currentTime)
- : MediaTextDisplayElement(doc, currentTime ? MEDIA_CONTROLS_CURRENT_TIME_DISPLAY : MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, element)
+void MediaControlElement::updateStyle()
{
+ if (!m_mediaElement || !m_mediaElement->renderer())
+ return;
+
+ RefPtr<RenderStyle> style = styleForElement();
+ if (!style)
+ return;
+
+ bool needsRenderer = rendererIsNeeded(style.get()) && parent() && parent()->renderer();
+ if (renderer() && !needsRenderer)
+ detach();
+ else if (!renderer() && needsRenderer)
+ attach();
+ else if (renderer()) {
+ renderer()->setStyle(style.get());
+
+ // Make sure that if there is any innerText renderer, it is updated as well.
+ if (firstChild() && firstChild()->renderer())
+ firstChild()->renderer()->setStyle(style.get());
+ }
}
// ----------------------------
+MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* doc, HTMLMediaElement* element)
+: MediaControlElement(doc, MEDIA_CONTROLS_TIMELINE_CONTAINER, element)
+{
+}
+
+bool MediaControlTimelineContainerElement::rendererIsNeeded(RenderStyle* style)
+{
+ if (!MediaControlElement::rendererIsNeeded(style))
+ return false;
+
+ // This is for MediaControllerThemeClassic:
+ // If there is no style for MediaControlStatusDisplayElement style, don't hide
+ // the timeline.
+ if (!m_mediaElement->renderer()->getCachedPseudoStyle(MEDIA_CONTROLS_STATUS_DISPLAY))
+ return true;
+
+ float duration = m_mediaElement->duration();
+ return !isnan(duration) && !isinf(duration);
+}
+
+
+// ----------------------------
+
+MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* doc, HTMLMediaElement* element)
+: MediaControlElement(doc, MEDIA_CONTROLS_STATUS_DISPLAY, element)
+, m_stateBeingDisplayed(Nothing)
+{
+}
+
+void MediaControlStatusDisplayElement::update()
+{
+ MediaControlElement::update();
+
+ // Get the new state that we'll have to display.
+ StateBeingDisplayed newStateToDisplay = Nothing;
+
+ if (m_mediaElement->readyState() != HTMLMediaElement::HAVE_ENOUGH_DATA && !m_mediaElement->currentSrc().isEmpty())
+ newStateToDisplay = Loading;
+ else if (m_mediaElement->movieLoadType() == MediaPlayer::LiveStream)
+ newStateToDisplay = LiveBroadcast;
+
+ // Propagate only if needed.
+ if (newStateToDisplay == m_stateBeingDisplayed)
+ return;
+ m_stateBeingDisplayed = newStateToDisplay;
+
+ ExceptionCode e;
+ switch (m_stateBeingDisplayed) {
+ case Nothing:
+ setInnerText("", e);
+ break;
+ case Loading:
+ setInnerText(mediaElementLoadingStateText(), e);
+ break;
+ case LiveBroadcast:
+ setInnerText(mediaElementLiveBroadcastStateText(), e);
+ break;
+ }
+}
+
+bool MediaControlStatusDisplayElement::rendererIsNeeded(RenderStyle* style)
+{
+ if (!MediaControlElement::rendererIsNeeded(style))
+ return false;
+ float duration = m_mediaElement->duration();
+ return (isnan(duration) || isinf(duration));
+}
+
+// ----------------------------
+
MediaControlInputElement::MediaControlInputElement(Document* doc, PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement, MediaControlElementType displayType)
: HTMLInputElement(inputTag, doc)
, m_mediaElement(mediaElement)
@@ -126,15 +242,12 @@ MediaControlInputElement::MediaControlInputElement(Document* doc, PseudoId pseud
, m_displayType(displayType)
{
setInputType(type);
- updateStyle();
setInDocument(true);
}
void MediaControlInputElement::attachToParent(Element* parent)
{
parent->addChild(this);
- if (renderer() && parent->renderer())
- parent->renderer()->addChild(renderer());
}
void MediaControlInputElement::update()
@@ -145,34 +258,58 @@ void MediaControlInputElement::update()
updateStyle();
}
+PassRefPtr<RenderStyle> MediaControlInputElement::styleForElement()
+{
+ return m_mediaElement->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
+}
+
+bool MediaControlInputElement::rendererIsNeeded(RenderStyle* style)
+{
+ return HTMLInputElement::rendererIsNeeded(style) && parent() && parent()->renderer();
+}
+
+void MediaControlInputElement::attach()
+{
+ RefPtr<RenderStyle> style = styleForElement();
+ if (!style)
+ return;
+
+ bool needsRenderer = rendererIsNeeded(style.get());
+ if (!needsRenderer)
+ return;
+ RenderObject* renderer = createRenderer(m_mediaElement->renderer()->renderArena(), style.get());
+ if (!renderer)
+ return;
+ renderer->setStyle(style.get());
+ setRenderer(renderer);
+ if (parent() && parent()->renderer()) {
+ // Find next sibling with a renderer to determine where to insert.
+ Node* sibling = nextSibling();
+ while (sibling && !sibling->renderer())
+ sibling = sibling->nextSibling();
+ parent()->renderer()->addChild(renderer, sibling ? sibling->renderer() : 0);
+ }
+ ContainerNode::attach();
+}
+
void MediaControlInputElement::updateStyle()
{
if (!m_mediaElement || !m_mediaElement->renderer())
return;
- RenderStyle* style = m_mediaElement->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
+ RefPtr<RenderStyle> style = styleForElement();
+ if (!style)
+ return;
- bool needsRenderer = rendererIsNeeded(style);
+ bool needsRenderer = rendererIsNeeded(style.get()) && parent() && parent()->renderer();
if (renderer() && !needsRenderer)
detach();
- else if (!renderer() && needsRenderer) {
- RenderObject* renderer = createRenderer(m_mediaElement->renderer()->renderArena(), style);
- if (!renderer)
- return;
- renderer->setStyle(style);
- setRenderer(renderer);
- setAttached();
- if (parent() && parent()->renderer()) {
- // Find next sibling with a renderer to determine where to insert.
- Node* sibling = nextSibling();
- while (sibling && !sibling->renderer())
- sibling = sibling->nextSibling();
- parent()->renderer()->addChild(renderer, sibling ? sibling->renderer() : 0);
- }
- } else if (renderer())
- renderer()->setStyle(style);
+ else if (!renderer() && needsRenderer)
+ attach();
+ else if (renderer())
+ renderer()->setStyle(style.get());
}
-
+
bool MediaControlInputElement::hitTest(const IntPoint& absPoint)
{
if (renderer() && renderer()->style()->hasAppearance())
@@ -283,6 +420,59 @@ void MediaControlSeekButtonElement::seekTimerFired(Timer<MediaControlSeekButtonE
m_mediaElement->setCurrentTime(m_mediaElement->currentTime() + seekTime, ec);
}
+void MediaControlSeekButtonElement::detach()
+{
+ if (m_capturing) {
+ if (Frame* frame = document()->frame())
+ frame->eventHandler()->setCapturingMouseEventsNode(0);
+ }
+ MediaControlInputElement::detach();
+}
+
+
+// ----------------------------
+
+MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* doc, HTMLMediaElement* element)
+: MediaControlInputElement(doc, MEDIA_CONTROLS_REWIND_BUTTON, "button", element, MediaRewindButton)
+{
+}
+
+void MediaControlRewindButtonElement::defaultEventHandler(Event* event)
+{
+ if (event->type() == eventNames().clickEvent) {
+ m_mediaElement->rewind(30);
+ event->setDefaultHandled();
+ }
+ HTMLInputElement::defaultEventHandler(event);
+}
+
+bool MediaControlRewindButtonElement::rendererIsNeeded(RenderStyle* style)
+{
+ return MediaControlInputElement::rendererIsNeeded(style) && m_mediaElement->movieLoadType() != MediaPlayer::LiveStream;
+}
+
+
+// ----------------------------
+
+MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* doc, HTMLMediaElement* element)
+: MediaControlInputElement(doc, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button", element, MediaReturnToRealtimeButton)
+{
+}
+
+void MediaControlReturnToRealtimeButtonElement::defaultEventHandler(Event* event)
+{
+ if (event->type() == eventNames().clickEvent) {
+ m_mediaElement->returnToRealtime();
+ event->setDefaultHandled();
+ }
+ HTMLInputElement::defaultEventHandler(event);
+}
+
+bool MediaControlReturnToRealtimeButtonElement::rendererIsNeeded(RenderStyle* style)
+{
+ return MediaControlInputElement::rendererIsNeeded(style) && m_mediaElement->movieLoadType() == MediaPlayer::LiveStream;
+}
+
// ----------------------------
MediaControlTimelineElement::MediaControlTimelineElement(Document* document, HTMLMediaElement* element)
@@ -295,9 +485,9 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mousedownEvent)
m_mediaElement->beginScrubbing();
- HTMLInputElement::defaultEventHandler(event);
+ MediaControlInputElement::defaultEventHandler(event);
- if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent ) {
+ if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent) {
return;
}
@@ -322,6 +512,7 @@ void MediaControlTimelineElement::update(bool updateDuration)
setAttribute(maxAttr, String::number(isfinite(dur) ? dur : 0));
}
setValue(String::number(m_mediaElement->currentTime()));
+ MediaControlInputElement::update();
}
// ----------------------------
@@ -341,11 +532,42 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
bool MediaControlFullscreenButtonElement::rendererIsNeeded(RenderStyle* style)
{
- return m_mediaElement->supportsFullscreen() && MediaControlInputElement::rendererIsNeeded(style);
+ return MediaControlInputElement::rendererIsNeeded(style) && m_mediaElement->supportsFullscreen();
}
// ----------------------------
+MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* doc, PseudoId pseudo, HTMLMediaElement* element)
+ : MediaControlElement(doc, pseudo, element)
+ , m_isVisible(true)
+{
+}
+
+PassRefPtr<RenderStyle> MediaControlTimeDisplayElement::styleForElement()
+{
+ RefPtr<RenderStyle> style = MediaControlElement::styleForElement();
+ if (!m_isVisible) {
+ style = RenderStyle::clone(style.get());
+ style->setWidth(Length(0, Fixed));
+ }
+ return style;
+}
+
+void MediaControlTimeDisplayElement::setVisible(bool visible)
+{
+ // This function is used during the RenderMedia::layout()
+ // call, where we cannot change the renderer at this time.
+ if (!renderer() || !renderer()->style())
+ return;
+
+ if (visible == m_isVisible)
+ return;
+ m_isVisible = visible;
+ RefPtr<RenderStyle> style = styleForElement();
+ renderer()->setStyle(style.get());
+}
+
+
} //namespace WebCore
#endif // enable(video)
diff --git a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h
index eefb2ce..d5fa5d2 100644
--- a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h
+++ b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,11 +43,24 @@ namespace WebCore {
class Event;
class Frame;
+// Must match WebKitSystemInterface.h
enum MediaControlElementType {
- MediaFullscreenButton, MediaMuteButton, MediaPlayButton,
- MediaSeekBackButton, MediaSeekForwardButton, MediaSlider, MediaSliderThumb,
- MediaUnMuteButton, MediaPauseButton, MediaTimelineContainer, MediaCurrentTimeDisplay,
- MediaTimeRemainingDisplay, MediaControlsPanel
+ MediaFullscreenButton = 0,
+ MediaMuteButton,
+ MediaPlayButton,
+ MediaSeekBackButton,
+ MediaSeekForwardButton,
+ MediaSlider,
+ MediaSliderThumb,
+ MediaRewindButton,
+ MediaReturnToRealtimeButton,
+ MediaUnMuteButton,
+ MediaPauseButton,
+ MediaTimelineContainer,
+ MediaCurrentTimeDisplay,
+ MediaTimeRemainingDisplay,
+ MediaStatusDisplay,
+ MediaControlsPanel
};
class MediaControlShadowRootElement : public HTMLDivElement {
@@ -63,15 +76,19 @@ private:
HTMLMediaElement* m_mediaElement;
};
- // ----------------------------
-
-class MediaTextDisplayElement : public HTMLDivElement
-{
+// ----------------------------
+
+class MediaControlElement : public HTMLDivElement {
public:
- MediaTextDisplayElement(Document*, PseudoId, HTMLMediaElement*);
+ MediaControlElement(Document*, PseudoId, HTMLMediaElement*);
+ virtual void attach();
+ virtual bool rendererIsNeeded(RenderStyle*);
+
+ virtual PassRefPtr<RenderStyle> styleForElement();
void attachToParent(Element*);
void update();
- void updateStyle();
+ virtual void updateStyle();
+
protected:
HTMLMediaElement* m_mediaElement;
PseudoId m_pseudoStyleId;
@@ -79,9 +96,22 @@ protected:
// ----------------------------
-class MediaTimeDisplayElement : public MediaTextDisplayElement {
+class MediaControlTimelineContainerElement : public MediaControlElement {
+public:
+ MediaControlTimelineContainerElement(Document*, HTMLMediaElement*);
+ virtual bool rendererIsNeeded(RenderStyle*);
+};
+
+// ----------------------------
+
+class MediaControlStatusDisplayElement : public MediaControlElement {
public:
- MediaTimeDisplayElement(Document*, HTMLMediaElement*, bool currentTime);
+ MediaControlStatusDisplayElement(Document*, HTMLMediaElement*);
+ virtual void update();
+ virtual bool rendererIsNeeded(RenderStyle*);
+private:
+ enum StateBeingDisplayed { Nothing, Loading, LiveBroadcast };
+ StateBeingDisplayed m_stateBeingDisplayed;
};
// ----------------------------
@@ -89,9 +119,14 @@ public:
class MediaControlInputElement : public HTMLInputElement {
public:
MediaControlInputElement(Document*, PseudoId, const String& type, HTMLMediaElement*, MediaControlElementType);
+ virtual void attach();
+ virtual bool rendererIsNeeded(RenderStyle*);
+
+ virtual PassRefPtr<RenderStyle> styleForElement();
void attachToParent(Element*);
void update();
- virtual void updateStyle();
+ void updateStyle();
+
bool hitTest(const IntPoint& absPoint);
MediaControlElementType displayType() const { return m_displayType; }
@@ -128,6 +163,7 @@ class MediaControlSeekButtonElement : public MediaControlInputElement {
public:
MediaControlSeekButtonElement(Document*, HTMLMediaElement*, bool forward);
virtual void defaultEventHandler(Event*);
+ virtual void detach();
void seekTimerFired(Timer<MediaControlSeekButtonElement>*);
private:
@@ -136,6 +172,24 @@ private:
bool m_capturing;
Timer<MediaControlSeekButtonElement> m_seekTimer;
};
+
+// ----------------------------
+
+class MediaControlRewindButtonElement : public MediaControlInputElement {
+public:
+ MediaControlRewindButtonElement(Document*, HTMLMediaElement*);
+ virtual void defaultEventHandler(Event*);
+ virtual bool rendererIsNeeded(RenderStyle*);
+};
+
+// ----------------------------
+
+class MediaControlReturnToRealtimeButtonElement : public MediaControlInputElement {
+public:
+ MediaControlReturnToRealtimeButtonElement(Document*, HTMLMediaElement*);
+ virtual void defaultEventHandler(Event*);
+ virtual bool rendererIsNeeded(RenderStyle*);
+};
// ----------------------------
@@ -157,14 +211,27 @@ public:
// ----------------------------
+class MediaControlTimeDisplayElement : public MediaControlElement {
+public:
+ MediaControlTimeDisplayElement(Document*, PseudoId, HTMLMediaElement*);
+ void setVisible(bool);
+ virtual PassRefPtr<RenderStyle> styleForElement();
+
+private:
+ bool m_isVisible;
+};
+
+// ----------------------------
+
class RenderMediaControlShadowRoot : public RenderBlock {
public:
RenderMediaControlShadowRoot(Element* e) : RenderBlock(e) { }
void setParent(RenderObject* p) { RenderObject::setParent(p); }
};
-
+
// ----------------------------
+
} //namespace WebCore
#endif // enable(video)
#endif // MediaControlElements_h
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderApplet.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderApplet.cpp
index a989d6f..062641e 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderApplet.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderApplet.cpp
@@ -26,6 +26,7 @@
#include "HTMLAppletElement.h"
#include "HTMLNames.h"
#include "HTMLParamElement.h"
+#include "Widget.h"
namespace WebCore {
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderArena.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderArena.cpp
index b7bfe4d..34325d4 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderArena.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderArena.cpp
@@ -39,7 +39,7 @@
#include <string.h>
#include <wtf/Assertions.h>
-#define ROUNDUP(x,y) ((((x)+((y)-1))/(y))*(y))
+#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
namespace WebCore {
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp
index 98426ed..c949eda 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp
@@ -84,6 +84,10 @@ static PercentHeightContainerMap* gPercentHeightContainerMap = 0;
typedef WTF::HashMap<RenderBlock*, ListHashSet<RenderInline*>*> ContinuationOutlineTableMap;
+typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet;
+static int gDelayUpdateScrollInfo = 0;
+static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0;
+
// Our MarginInfo state used when laying out block children.
RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int top, int bottom)
{
@@ -389,14 +393,14 @@ void RenderBlock::deleteLineBoxTree()
m_lineBoxes.deleteLineBoxTree(renderArena());
}
-RootInlineBox* RenderBlock::createRootBox()
+RootInlineBox* RenderBlock::createRootInlineBox()
{
return new (renderArena()) RootInlineBox(this);
}
-RootInlineBox* RenderBlock::createRootInlineBox()
+RootInlineBox* RenderBlock::createAndAppendRootInlineBox()
{
- RootInlineBox* rootBox = createRootBox();
+ RootInlineBox* rootBox = createRootInlineBox();
m_lineBoxes.appendLineBox(rootBox);
return rootBox;
}
@@ -688,6 +692,45 @@ bool RenderBlock::isSelfCollapsingBlock() const
return false;
}
+void RenderBlock::startDelayUpdateScrollInfo()
+{
+ if (gDelayUpdateScrollInfo == 0) {
+ ASSERT(!gDelayedUpdateScrollInfoSet);
+ gDelayedUpdateScrollInfoSet = new DelayedUpdateScrollInfoSet;
+ }
+ ASSERT(gDelayedUpdateScrollInfoSet);
+ ++gDelayUpdateScrollInfo;
+}
+
+void RenderBlock::finishDelayUpdateScrollInfo()
+{
+ --gDelayUpdateScrollInfo;
+ ASSERT(gDelayUpdateScrollInfo >= 0);
+ if (gDelayUpdateScrollInfo == 0) {
+ ASSERT(gDelayedUpdateScrollInfoSet);
+
+ for (DelayedUpdateScrollInfoSet::iterator it = gDelayedUpdateScrollInfoSet->begin(); it != gDelayedUpdateScrollInfoSet->end(); ++it) {
+ RenderBlock* block = *it;
+ if (block->hasOverflowClip()) {
+ block->layer()->updateScrollInfoAfterLayout();
+ }
+ }
+
+ delete gDelayedUpdateScrollInfoSet;
+ gDelayedUpdateScrollInfoSet = 0;
+ }
+}
+
+void RenderBlock::updateScrollInfoAfterLayout()
+{
+ if (hasOverflowClip()) {
+ if (gDelayUpdateScrollInfo)
+ gDelayedUpdateScrollInfoSet->add(this);
+ else
+ layer()->updateScrollInfoAfterLayout();
+ }
+}
+
void RenderBlock::layout()
{
// Update our first letter info now.
@@ -844,8 +887,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren)
// Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
// we overflow or not.
- if (hasOverflowClip())
- layer()->updateScrollInfoAfterLayout();
+ updateScrollInfoAfterLayout();
// Repaint with our new bounds if they are different from our old bounds.
bool didFullRepaint = repainter.repaintAfterLayout();
@@ -1436,8 +1478,10 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
child->repaintDuringLayoutIfMoved(oldRect);
}
- if (!childHadLayout && child->checkForRepaintDuringLayout())
+ if (!childHadLayout && child->checkForRepaintDuringLayout()) {
child->repaint();
+ child->repaintOverhangingFloats(true);
+ }
ASSERT(oldLayoutDelta == view()->layoutDelta());
}
@@ -1465,8 +1509,7 @@ bool RenderBlock::layoutOnlyPositionedObjects()
statePusher.pop();
- if (hasOverflowClip())
- layer()->updateScrollInfoAfterLayout();
+ updateScrollInfoAfterLayout();
setNeedsLayout(false);
return true;
@@ -2421,10 +2464,10 @@ bool RenderBlock::positionNewFloats()
if (o->style()->floating() == FLEFT) {
int heightRemainingLeft = 1;
int heightRemainingRight = 1;
- int fx = leftRelOffset(y,lo, false, &heightRemainingLeft);
- while (rightRelOffset(y,ro, false, &heightRemainingRight)-fx < fwidth) {
+ int fx = leftRelOffset(y, lo, false, &heightRemainingLeft);
+ while (rightRelOffset(y, ro, false, &heightRemainingRight)-fx < fwidth) {
y += min(heightRemainingLeft, heightRemainingRight);
- fx = leftRelOffset(y,lo, false, &heightRemainingLeft);
+ fx = leftRelOffset(y, lo, false, &heightRemainingLeft);
}
fx = max(0, fx);
f->m_left = fx;
@@ -2432,8 +2475,8 @@ bool RenderBlock::positionNewFloats()
} else {
int heightRemainingLeft = 1;
int heightRemainingRight = 1;
- int fx = rightRelOffset(y,ro, false, &heightRemainingRight);
- while (fx - leftRelOffset(y,lo, false, &heightRemainingLeft) < fwidth) {
+ int fx = rightRelOffset(y, ro, false, &heightRemainingRight);
+ while (fx - leftRelOffset(y, lo, false, &heightRemainingLeft) < fwidth) {
y += min(heightRemainingLeft, heightRemainingRight);
fx = rightRelOffset(y, ro, false, &heightRemainingRight);
}
@@ -2458,7 +2501,7 @@ void RenderBlock::newLine(EClear clear)
positionNewFloats();
// set y position
int newY = 0;
- switch(clear)
+ switch (clear)
{
case CLEFT:
newY = leftBottom();
@@ -2629,12 +2672,12 @@ int
RenderBlock::floatBottom() const
{
if (!m_floatingObjects) return 0;
- int bottom=0;
+ int bottom = 0;
FloatingObject* r;
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for ( ; (r = it.current()); ++it )
if (r->m_bottom>bottom)
- bottom=r->m_bottom;
+ bottom = r->m_bottom;
return bottom;
}
@@ -2919,12 +2962,12 @@ int
RenderBlock::leftBottom()
{
if (!m_floatingObjects) return 0;
- int bottom=0;
+ int bottom = 0;
FloatingObject* r;
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for ( ; (r = it.current()); ++it )
if (r->m_bottom > bottom && r->type() == FloatingObject::FloatLeft)
- bottom=r->m_bottom;
+ bottom = r->m_bottom;
return bottom;
}
@@ -2933,12 +2976,12 @@ int
RenderBlock::rightBottom()
{
if (!m_floatingObjects) return 0;
- int bottom=0;
+ int bottom = 0;
FloatingObject* r;
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for ( ; (r = it.current()); ++it )
if (r->m_bottom>bottom && r->type() == FloatingObject::FloatRight)
- bottom=r->m_bottom;
+ bottom = r->m_bottom;
return bottom;
}
@@ -3246,12 +3289,12 @@ void RenderBlock::addVisualOverflow(const IntRect& r)
m_overflowHeight = max(m_overflowHeight, r.bottom());
}
-bool RenderBlock::isPointInOverflowControl(HitTestResult& result, int, int, int, int)
+bool RenderBlock::isPointInOverflowControl(HitTestResult& result, int _x, int _y, int _tx, int _ty)
{
if (!scrollsOverflow())
return false;
- return layer()->hitTestOverflowControls(result);
+ return layer()->hitTestOverflowControls(result, IntPoint(_x - _tx, _y - _ty));
}
bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction)
@@ -3900,8 +3943,7 @@ void RenderBlock::calcPrefWidths()
setPrefWidthsDirty(false);
}
-struct InlineMinMaxIterator
-{
+struct InlineMinMaxIterator {
/* InlineMinMaxIterator is a class that will iterate over all render objects that contribute to
inline min/max width calculations. Note the following about the way it walks:
(1) Positioned content is skipped (since it does not contribute to min/max width of a block)
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h
index 31eae7c8..871e439 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h
@@ -35,7 +35,6 @@
namespace WebCore {
class InlineIterator;
-class Position;
class RenderInline;
class RootInlineBox;
@@ -142,23 +141,26 @@ public:
virtual void updateBeforeAfterContent(PseudoId);
- RootInlineBox* createRootInlineBox();
+ RootInlineBox* createAndAppendRootInlineBox();
+ virtual RootInlineBox* createRootInlineBox(); // Subclassed by SVG and Ruby.
// Called to lay out the legend for a fieldset.
virtual RenderObject* layoutLegend(bool /*relayoutChildren*/) { return 0; }
- // the implementation of the following functions is in bidi.cpp
struct FloatWithRect {
FloatWithRect(RenderBox* f)
: object(f)
, rect(IntRect(f->x() - f->marginLeft(), f->y() - f->marginTop(), f->width() + f->marginLeft() + f->marginRight(), f->height() + f->marginTop() + f->marginBottom()))
+ , everHadLayout(f->m_everHadLayout)
{
}
RenderBox* object;
IntRect rect;
+ bool everHadLayout;
};
+ // The following functions' implementations are in RenderBlockLineLayout.cpp.
void bidiReorderLine(InlineBidiResolver&, const InlineIterator& end, bool previousLineBrokeCleanly);
RootInlineBox* determineStartPosition(bool& firstLine, bool& fullLayout, bool& previousLineBrokeCleanly,
InlineBidiResolver&, Vector<FloatWithRect>& floats, unsigned& numCleanFloats);
@@ -179,7 +181,7 @@ public:
void checkLinesForOverflow();
void deleteEllipsisLineBoxes();
void checkLinesForTextOverflow();
- // end bidi.cpp functions
+ // End of functions defined in RenderBlockLineLayout.cpp.
virtual void paint(PaintInfo&, int tx, int ty);
virtual void paintObject(PaintInfo&, int tx, int ty);
@@ -328,6 +330,14 @@ public:
// style from this RenderBlock.
RenderBlock* createAnonymousBlock() const;
+ // Delay update scrollbar until finishDelayRepaint() will be
+ // called. This function is used when a flexbox is layouting its
+ // descendant. If multiple startDelayRepaint() is called,
+ // finishDelayRepaint() will do nothing until finishDelayRepaint()
+ // is called same times.
+ static void startDelayUpdateScrollInfo();
+ static void finishDelayUpdateScrollInfo();
+
private:
void adjustPointToColumnContents(IntPoint&) const;
void adjustForBorderFit(int x, int& left, int& right) const; // Helper function for borderFitAdjust
@@ -342,7 +352,6 @@ protected:
virtual bool hasLineIfEmpty() const;
bool layoutOnlyPositionedObjects();
- virtual RootInlineBox* createRootBox(); // Subclassed by SVG.
private:
Position positionForBox(InlineBox*, bool start = true) const;
@@ -357,6 +366,8 @@ private:
bool expandsToEncloseOverhangingFloats() const;
+ void updateScrollInfoAfterLayout();
+
protected:
struct FloatingObject {
enum Type {
diff --git a/src/3rdparty/webkit/WebCore/rendering/bidi.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBlockLineLayout.cpp
index 635ad9a..c243dc1 100644
--- a/src/3rdparty/webkit/WebCore/rendering/bidi.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All right reserved.
+ * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009 Apple Inc. All right reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,17 +20,13 @@
*/
#include "config.h"
-#include "bidi.h"
+#include "BidiResolver.h"
#include "CharacterNames.h"
-#include "Document.h"
-#include "Element.h"
-#include "FrameView.h"
#include "InlineTextBox.h"
#include "Logging.h"
#include "RenderArena.h"
#include "RenderInline.h"
-#include "RenderLayer.h"
#include "RenderListMarker.h"
#include "RenderView.h"
#include "break_lines.h"
@@ -70,7 +66,7 @@ public:
bool atEnd() const;
UChar current() const;
- WTF::Unicode::Direction direction() const;
+ Direction direction() const;
RenderBlock* block;
RenderObject* obj;
@@ -102,8 +98,35 @@ static int inlineWidth(RenderObject* child, bool start = true, bool end = true)
return extraWidth;
}
+struct BidiRun : BidiCharacterRun {
+ BidiRun(int start, int stop, RenderObject* object, BidiContext* context, Direction dir)
+ : BidiCharacterRun(start, stop, context, dir)
+ , m_object(object)
+ , m_box(0)
+ {
+ }
+
+ void destroy();
+
+ // Overloaded new operator.
+ void* operator new(size_t, RenderArena*) throw();
+
+ // Overridden to prevent the normal delete from being called.
+ void operator delete(void*, size_t);
+
+ BidiRun* next() { return static_cast<BidiRun*>(m_next); }
+
+private:
+ // The normal operator new is disallowed.
+ void* operator new(size_t) throw();
+
+public:
+ RenderObject* m_object;
+ InlineBox* m_box;
+};
+
#ifndef NDEBUG
-static WTF::RefCountedLeakCounter bidiRunCounter("BidiRun");
+static RefCountedLeakCounter bidiRunCounter("BidiRun");
static bool inBidiRunDestroy;
#endif
@@ -449,7 +472,7 @@ void InlineBidiResolver::appendRun()
static inline InlineBox* createInlineBoxForRenderer(RenderObject* obj, bool isRootLineBox, bool isOnlyRun = false)
{
if (isRootLineBox)
- return toRenderBlock(obj)->createRootInlineBox();
+ return toRenderBlock(obj)->createAndAppendRootInlineBox();
if (obj->isText()) {
InlineTextBox* textBox = toRenderText(obj)->createInlineTextBox();
@@ -463,7 +486,7 @@ static inline InlineBox* createInlineBoxForRenderer(RenderObject* obj, bool isRo
if (obj->isBox())
return toRenderBox(obj)->createInlineBox();
- return toRenderInline(obj)->createInlineFlowBox();
+ return toRenderInline(obj)->createAndAppendInlineFlowBox();
}
static inline void dirtyLineBoxesForRenderer(RenderObject* o, bool fullLayout)
@@ -641,7 +664,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool
// objects horizontally. The total width of the line can be increased if we end up
// justifying text.
int x = leftOffset(height(), firstLine);
- switch(textAlign) {
+ switch (textAlign) {
case LEFT:
case WEBKIT_LEFT:
// The direction of the block should determine what happens with wide lines. In
@@ -808,7 +831,6 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
// Figure out if we should clear out our line boxes.
// FIXME: Handle resize eventually!
- // FIXME: Do something better when floats are present.
bool fullLayout = !firstLineBox() || !firstChild() || selfNeedsLayout() || relayoutChildren;
if (fullLayout)
lineBoxes()->deleteLineBoxes(renderArena());
@@ -1120,6 +1142,17 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
}
lastFloat = m_floatingObjects->last();
}
+ size_t floatCount = floats.size();
+ // Floats that did not have layout did not repaint when we laid them out. They would have
+ // painted by now if they had moved, but if they stayed at (0, 0), they still need to be
+ // painted.
+ for (size_t i = 0; i < floatCount; ++i) {
+ if (!floats[i].everHadLayout) {
+ RenderBox* f = floats[i].object;
+ if (!f->x() && !f->y() && f->checkForRepaintDuringLayout())
+ f->repaint();
+ }
+ }
}
// Now add in the bottom border/padding.
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp
index ab0d153..4db5c55 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp
@@ -1562,7 +1562,7 @@ int RenderBox::calcReplacedWidthUsing(Length width) const
default:
return intrinsicSize().width();
}
- }
+}
int RenderBox::calcReplacedHeight() const
{
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBoxModelObject.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBoxModelObject.cpp
index 8973e64..ced5a78 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderBoxModelObject.cpp
@@ -1124,6 +1124,9 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
{
// FIXME: Deal with border-image. Would be great to use border-image as a mask.
+ if (context->paintingDisabled())
+ return;
+
IntRect rect(tx, ty, w, h);
bool hasBorderRadius = s->hasBorderRadius();
bool hasOpaqueBackground = s->backgroundColor().isValid() && s->backgroundColor().alpha() == 255;
@@ -1134,18 +1137,16 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
int shadowBlur = shadow->blur;
IntRect fillRect(rect);
- if (hasBorderRadius) {
- IntRect shadowRect(rect);
- shadowRect.inflate(shadowBlur);
- shadowRect.move(shadowOffset);
- context->clip(shadowRect);
-
- // Move the fill just outside the clip, adding 1 pixel separation so that the fill does not
- // bleed in (due to antialiasing) if the context is transformed.
- IntSize extraOffset(w + max(0, shadowOffset.width()) + shadowBlur + 1, 0);
- shadowOffset -= extraOffset;
- fillRect.move(extraOffset);
- }
+ IntRect shadowRect(rect);
+ shadowRect.inflate(shadowBlur);
+ shadowRect.move(shadowOffset);
+ context->clip(shadowRect);
+
+ // Move the fill just outside the clip, adding 1 pixel separation so that the fill does not
+ // bleed in (due to antialiasing) if the context is transformed.
+ IntSize extraOffset(w + max(0, shadowOffset.width()) + shadowBlur + 1, 0);
+ shadowOffset -= extraOffset;
+ fillRect.move(extraOffset);
context->setShadow(shadowOffset, shadowBlur, shadow->color);
if (hasBorderRadius) {
@@ -1157,12 +1158,50 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
IntSize bottomLeft = begin ? bottomLeftRadius : IntSize();
IntSize bottomRight = end ? bottomRightRadius : IntSize();
- if (!hasOpaqueBackground)
- context->clipOutRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight);
+ IntRect rectToClipOut = rect;
+ IntSize topLeftToClipOut = topLeft;
+ IntSize topRightToClipOut = topRight;
+ IntSize bottomLeftToClipOut = bottomLeft;
+ IntSize bottomRightToClipOut = bottomRight;
+
+ // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
+ // when painting the shadow. On the other hand, it introduces subpixel gaps along the
+ // corners. Those are avoided by insetting the clipping path by one pixel.
+ if (hasOpaqueBackground) {
+ rectToClipOut.inflate(-1);
+
+ topLeftToClipOut.expand(-1, -1);
+ topLeftToClipOut.clampNegativeToZero();
+
+ topRightToClipOut.expand(-1, -1);
+ topRightToClipOut.clampNegativeToZero();
+
+ bottomLeftToClipOut.expand(-1, -1);
+ bottomLeftToClipOut.clampNegativeToZero();
+
+ bottomRightToClipOut.expand(-1, -1);
+ bottomRightToClipOut.clampNegativeToZero();
+ }
+
+ if (!rectToClipOut.isEmpty())
+ context->clipOutRoundedRect(rectToClipOut, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut);
context->fillRoundedRect(fillRect, topLeft, topRight, bottomLeft, bottomRight, Color::black);
} else {
- if (!hasOpaqueBackground)
- context->clipOut(rect);
+ IntRect rectToClipOut = rect;
+
+ // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
+ // when painting the shadow. On the other hand, it introduces subpixel gaps along the
+ // edges if they are not pixel-aligned. Those are avoided by insetting the clipping path
+ // by one pixel.
+ if (hasOpaqueBackground) {
+ TransformationMatrix currentTransformation = context->getCTM();
+ if (currentTransformation.a() != 1 || (currentTransformation.d() != 1 && currentTransformation.d() != -1)
+ || currentTransformation.b() || currentTransformation.c())
+ rectToClipOut.inflate(-1);
+ }
+
+ if (!rectToClipOut.isEmpty())
+ context->clipOut(rectToClipOut);
context->fillRect(fillRect, Color::black);
}
context->restore();
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.cpp
index b207a31..bdf723f 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.cpp
@@ -24,12 +24,17 @@
*/
#include "config.h"
+
+#if ENABLE(DATAGRID)
+
#include "RenderDataGrid.h"
+#include "CSSStyleSelector.h"
#include "FocusController.h"
#include "Frame.h"
#include "GraphicsContext.h"
#include "Page.h"
+#include "RenderView.h"
#include "Scrollbar.h"
using std::min;
@@ -47,6 +52,42 @@ RenderDataGrid::~RenderDataGrid()
{
}
+void RenderDataGrid::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
+{
+ RenderBlock::styleDidChange(diff, oldStyle);
+ recalcStyleForColumns();
+}
+
+void RenderDataGrid::recalcStyleForColumns()
+{
+ DataGridColumnList* columns = gridElement()->columns();
+ unsigned length = columns->length();
+ for (unsigned i = 0; i < length; ++i)
+ recalcStyleForColumn(columns->item(i));
+}
+
+void RenderDataGrid::recalcStyleForColumn(DataGridColumn* column)
+{
+ if (!column->columnStyle())
+ column->setColumnStyle(document()->styleSelector()->pseudoStyleForDataGridColumn(column, style()));
+ if (!column->headerStyle())
+ column->setHeaderStyle(document()->styleSelector()->pseudoStyleForDataGridColumnHeader(column, style()));
+}
+
+RenderStyle* RenderDataGrid::columnStyle(DataGridColumn* column)
+{
+ if (!column->columnStyle())
+ recalcStyleForColumn(column);
+ return column->columnStyle();
+}
+
+RenderStyle* RenderDataGrid::headerStyle(DataGridColumn* column)
+{
+ if (!column->headerStyle())
+ recalcStyleForColumn(column);
+ return column->headerStyle();
+}
+
void RenderDataGrid::calcPrefWidths()
{
m_minPrefWidth = 0;
@@ -77,6 +118,17 @@ void RenderDataGrid::calcPrefWidths()
setPrefWidthsDirty(false);
}
+void RenderDataGrid::layout()
+{
+ RenderBlock::layout();
+ layoutColumns();
+}
+
+void RenderDataGrid::layoutColumns()
+{
+ // FIXME: Implement.
+}
+
void RenderDataGrid::paintObject(PaintInfo& paintInfo, int tx, int ty)
{
if (style()->visibility() != VISIBLE)
@@ -92,14 +144,29 @@ void RenderDataGrid::paintObject(PaintInfo& paintInfo, int tx, int ty)
paintColumnHeaders(paintInfo, tx, ty);
}
-void RenderDataGrid::paintColumnHeaders(PaintInfo&, int, int)
+void RenderDataGrid::paintColumnHeaders(PaintInfo& paintInfo, int tx, int ty)
{
- gridElement()->columns();
-
+ DataGridColumnList* columns = gridElement()->columns();
+ unsigned length = columns->length();
+ for (unsigned i = 0; i < length; ++i) {
+ DataGridColumn* column = columns->item(i);
+ RenderStyle* columnStyle = headerStyle(column);
+
+ // Don't render invisible columns.
+ if (!columnStyle || columnStyle->display() == NONE || columnStyle->visibility() != VISIBLE)
+ continue;
+
+ // Paint the column header if it intersects the dirty rect.
+ IntRect columnRect(column->rect());
+ columnRect.move(tx, ty);
+ if (columnRect.intersects(paintInfo.rect))
+ paintColumnHeader(column, paintInfo, tx, ty);
+ }
}
-void RenderDataGrid::rebuildColumns()
+void RenderDataGrid::paintColumnHeader(DataGridColumn*, PaintInfo&, int, int)
{
+ // FIXME: Implement.
}
// Scrolling implementation functions
@@ -119,4 +186,65 @@ bool RenderDataGrid::isActive() const
return page && page->focusController()->isActive();
}
+
+IntRect RenderDataGrid::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const
+{
+ RenderView* view = this->view();
+ if (!view)
+ return scrollbarRect;
+
+ IntRect rect = scrollbarRect;
+
+ int scrollbarLeft = width() - borderRight() - scrollbar->width();
+ int scrollbarTop = borderTop();
+ rect.move(scrollbarLeft, scrollbarTop);
+
+ return view->frameView()->convertFromRenderer(this, rect);
}
+
+IntRect RenderDataGrid::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
+{
+ RenderView* view = this->view();
+ if (!view)
+ return parentRect;
+
+ IntRect rect = view->frameView()->convertToRenderer(this, parentRect);
+
+ int scrollbarLeft = width() - borderRight() - scrollbar->width();
+ int scrollbarTop = borderTop();
+ rect.move(-scrollbarLeft, -scrollbarTop);
+ return rect;
+}
+
+IntPoint RenderDataGrid::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const
+{
+ RenderView* view = this->view();
+ if (!view)
+ return scrollbarPoint;
+
+ IntPoint point = scrollbarPoint;
+
+ int scrollbarLeft = width() - borderRight() - scrollbar->width();
+ int scrollbarTop = borderTop();
+ point.move(scrollbarLeft, scrollbarTop);
+
+ return view->frameView()->convertFromRenderer(this, point);
+}
+
+IntPoint RenderDataGrid::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
+{
+ RenderView* view = this->view();
+ if (!view)
+ return parentPoint;
+
+ IntPoint point = view->frameView()->convertToRenderer(this, parentPoint);
+
+ int scrollbarLeft = width() - borderRight() - scrollbar->width();
+ int scrollbarTop = borderTop();
+ point.move(-scrollbarLeft, -scrollbarTop);
+ return point;
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.h b/src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.h
index 6a4b32e..467edcc 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.h
@@ -26,6 +26,8 @@
#ifndef RenderDataGrid_h
#define RenderDataGrid_h
+#if ENABLE(DATAGRID)
+
#include "HTMLDataGridElement.h"
#include "RenderBlock.h"
#include "ScrollbarClient.h"
@@ -41,18 +43,24 @@ public:
~RenderDataGrid();
virtual const char* renderName() const { return "RenderDataGrid"; }
-
virtual bool canHaveChildren() const { return false; }
-
virtual void calcPrefWidths();
-
+ virtual void layout();
virtual void paintObject(PaintInfo&, int tx, int ty);
void columnsChanged();
private:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ RenderStyle* columnStyle(DataGridColumn*);
+ RenderStyle* headerStyle(DataGridColumn*);
+ void recalcStyleForColumns();
+ void recalcStyleForColumn(DataGridColumn*);
+
+ void layoutColumns();
void paintColumnHeaders(PaintInfo&, int tx, int ty);
- void rebuildColumns();
+ void paintColumnHeader(DataGridColumn*, PaintInfo&, int tx, int ty);
HTMLDataGridElement* gridElement() const { return static_cast<HTMLDataGridElement*>(node()); }
@@ -61,10 +69,16 @@ private:
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const;
virtual bool scrollbarCornerPresent() const { return false; } // We don't support resize on data grids yet. If we did this would have to change.
+ virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const;
+ virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const;
+ virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const;
+ virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;
RefPtr<Scrollbar> m_vBar;
};
}
+#endif
+
#endif // RenderDataGrid_h
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderFieldset.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderFieldset.cpp
index 1275882..393c237 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderFieldset.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderFieldset.cpp
@@ -99,7 +99,7 @@ RenderObject* RenderFieldset::layoutLegend(bool relayoutChildren)
int b = borderTop();
int h = legend->height();
legend->setLocation(xPos, max((b-h)/2, 0));
- setHeight(max(b,h) + paddingTop());
+ setHeight(max(b, h) + paddingTop());
}
return legend;
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderFlexibleBox.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderFlexibleBox.cpp
index 1dcef36..65990f2 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderFlexibleBox.cpp
@@ -36,7 +36,8 @@ namespace WebCore {
class FlexBoxIterator {
public:
- FlexBoxIterator(RenderFlexibleBox* parent) {
+ FlexBoxIterator(RenderFlexibleBox* parent)
+ {
box = parent;
if (box->style()->boxOrient() == HORIZONTAL && box->style()->direction() == RTL)
forward = box->style()->boxDirection() != BNORMAL;
@@ -56,17 +57,20 @@ public:
reset();
}
- void reset() {
+ void reset()
+ {
current = 0;
currentOrdinal = forward ? 0 : lastOrdinal+1;
}
- RenderBox* first() {
+ RenderBox* first()
+ {
reset();
return next();
}
- RenderBox* next() {
+ RenderBox* next()
+ {
do {
if (!current) {
if (forward) {
@@ -336,7 +340,9 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
}
child = iterator.next();
}
-
+
+ RenderBlock::startDelayUpdateScrollInfo();
+
// We do 2 passes. The first pass is simply to lay everyone out at
// their preferred widths. The second pass handles flexing the children.
do {
@@ -561,7 +567,9 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
} while (haveFlex);
m_flexingChildren = false;
-
+
+ RenderBlock::finishDelayUpdateScrollInfo();
+
if (remainingSpace > 0 && ((style()->direction() == LTR && style()->boxPack() != BSTART) ||
(style()->direction() == RTL && style()->boxPack() != BEND))) {
// Children must be repositioned.
@@ -648,7 +656,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
{
int xPos = borderLeft() + paddingLeft();
int yPos = borderTop() + paddingTop();
- if( style()->direction() == RTL )
+ if (style()->direction() == RTL)
xPos = width() - paddingRight() - borderRight();
int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight();
bool heightSpecified = false;
@@ -789,6 +797,8 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
}
}
+ RenderBlock::startDelayUpdateScrollInfo();
+
// We do 2 passes. The first pass is simply to lay everyone out at
// their preferred widths. The second pass handles flexing the children.
// Our first pass is done without flexing. We simply lay the children
@@ -977,6 +987,8 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
}
} while (haveFlex);
+ RenderBlock::finishDelayUpdateScrollInfo();
+
if (style()->boxPack() != BSTART && remainingSpace > 0) {
// Children must be repositioned.
int offset = 0;
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.cpp
index 5995117..57c8a2f 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.cpp
@@ -65,7 +65,7 @@ inline HTMLFrameSetElement* RenderFrameSet::frameSet() const
static Color borderStartEdgeColor()
{
- return Color(170,170,170);
+ return Color(170, 170, 170);
}
static Color borderEndEdgeColor()
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.h b/src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.h
index 294e5df..713a248 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.h
@@ -32,8 +32,7 @@ class MouseEvent;
enum FrameEdge { LeftFrameEdge, RightFrameEdge, TopFrameEdge, BottomFrameEdge };
-struct FrameEdgeInfo
-{
+struct FrameEdgeInfo {
FrameEdgeInfo(bool preventResize = false, bool allowBorder = true)
: m_preventResize(4)
, m_allowBorder(4)
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderImage.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderImage.cpp
index cd84a09..559406b 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderImage.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderImage.cpp
@@ -89,8 +89,7 @@ private:
Timer<RenderImage> m_highQualityRepaintTimer;
};
-class RenderImageScaleObserver
-{
+class RenderImageScaleObserver {
public:
static bool shouldImagePaintAtLowQuality(RenderImage*, const IntSize&);
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp
index 3965d94..f798a56 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp
@@ -749,14 +749,14 @@ void RenderInline::dirtyLineBoxes(bool fullLayout)
m_lineBoxes.dirtyLineBoxes();
}
-InlineFlowBox* RenderInline::createFlowBox()
+InlineFlowBox* RenderInline::createInlineFlowBox()
{
return new (renderArena()) InlineFlowBox(this);
}
-InlineFlowBox* RenderInline::createInlineFlowBox()
+InlineFlowBox* RenderInline::createAndAppendInlineFlowBox()
{
- InlineFlowBox* flowBox = createFlowBox();
+ InlineFlowBox* flowBox = createInlineFlowBox();
m_lineBoxes.appendLineBox(flowBox);
return flowBox;
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderInline.h b/src/3rdparty/webkit/WebCore/rendering/RenderInline.h
index cf6b84b..5a10068 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderInline.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderInline.h
@@ -93,7 +93,9 @@ public:
return IntRect(0, 0, boundingBox.width(), boundingBox.height());
}
- InlineFlowBox* createInlineFlowBox();
+ InlineFlowBox* createAndAppendInlineFlowBox();
+ virtual InlineFlowBox* createInlineFlowBox(); // Subclassed by SVG and Ruby
+
void dirtyLineBoxes(bool fullLayout);
virtual void dirtyLinesFromChangedChild(RenderObject* child) { m_lineBoxes.dirtyLinesFromChangedChild(this, child); }
@@ -132,7 +134,6 @@ public:
protected:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual void updateBoxModelInfoFromStyle();
- virtual InlineFlowBox* createFlowBox(); // Subclassed by SVG
static RenderInline* cloneInline(RenderInline* src);
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp
index ba85f1a..5de1bbf 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp
@@ -167,7 +167,7 @@ RenderLayer::RenderLayer(RenderBoxModelObject* renderer)
, m_has3DTransformedDescendant(false)
#if USE(ACCELERATED_COMPOSITING)
, m_hasCompositingDescendant(false)
- , m_mustOverlayCompositedLayers(false)
+ , m_mustOverlapCompositedLayers(false)
#endif
, m_marquee(0)
, m_staticX(0)
@@ -231,7 +231,7 @@ void RenderLayer::rendererContentChanged()
{
// This can get called when video becomes accelerated, so the layers may change.
if (compositor()->updateLayerCompositingState(this))
- compositor()->setCompositingLayersNeedUpdate();
+ compositor()->setCompositingLayersNeedRebuild();
if (m_backing)
m_backing->rendererContentChanged();
@@ -255,17 +255,17 @@ void RenderLayer::setStaticY(int staticY)
renderer()->setChildNeedsLayout(true, false);
}
-void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
+void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags)
{
- if (doFullRepaint) {
+ if (flags & DoFullRepaint) {
renderer()->repaint();
#if USE(ACCELERATED_COMPOSITING)
- checkForRepaint = false;
+ flags &= ~CheckForRepaint;
// We need the full repaint to propagate to child layers if we are hardware compositing.
if (!compositor()->inCompositingMode())
- doFullRepaint = false;
+ flags &= ~DoFullRepaint;
#else
- checkForRepaint = doFullRepaint = false;
+ flags &= ~(CheckForRepaint | DoFullRepaint);
#endif
}
@@ -292,7 +292,7 @@ void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint();
IntRect newRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);
IntRect newOutlineBox = renderer()->outlineBoundsForRepaint(repaintContainer);
- if (checkForRepaint) {
+ if (flags & CheckForRepaint) {
if (view && !view->printing()) {
if (m_needsFullRepaint) {
renderer()->repaintUsingContainer(repaintContainer, m_repaintRect);
@@ -316,11 +316,11 @@ void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
m_reflection->layout();
for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
- child->updateLayerPositions(doFullRepaint, checkForRepaint);
+ child->updateLayerPositions(flags);
#if USE(ACCELERATED_COMPOSITING)
- if (isComposited())
- backing()->updateAfterLayout();
+ if ((flags & UpdateCompositingLayers) && isComposited())
+ backing()->updateAfterLayout(RenderLayerBacking::CompositingChildren);
#endif
// With all our children positioned, now update our marquee if we need to.
@@ -328,6 +328,13 @@ void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
m_marquee->updateMarqueePosition();
}
+void RenderLayer::computeRepaintRects()
+{
+ RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint();
+ m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);
+ m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer);
+}
+
void RenderLayer::updateTransform()
{
// hasTransform() on the renderer is also true when there is transform-style: preserve-3d or perspective set,
@@ -453,7 +460,7 @@ void RenderLayer::updateVisibilityStatus()
else {
do {
r = r->parent();
- if (r==renderer())
+ if (r == renderer())
r = 0;
} while (r && !r->nextSibling());
if (r)
@@ -1057,14 +1064,15 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai
m_scrollX = newScrollX;
m_scrollY = y;
- // Update the positions of our child layers.
+ // Update the positions of our child layers. Don't have updateLayerPositions() update
+ // compositing layers, because we need to do a deep update from the compositing ancestor.
for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
- child->updateLayerPositions(false, false);
+ child->updateLayerPositions(0);
#if USE(ACCELERATED_COMPOSITING)
if (compositor()->inCompositingMode()) {
if (RenderLayer* compositingAncestor = ancestorCompositingLayer())
- compositingAncestor->backing()->updateAfterLayout();
+ compositingAncestor->backing()->updateAfterLayout(RenderLayerBacking::AllDescendants);
}
#endif
@@ -1423,6 +1431,66 @@ bool RenderLayer::scrollbarCornerPresent() const
return !scrollCornerRect(this, renderBox()->borderBoxRect()).isEmpty();
}
+IntRect RenderLayer::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const
+{
+ RenderView* view = renderer()->view();
+ if (!view)
+ return scrollbarRect;
+
+ IntRect rect = scrollbarRect;
+ rect.move(scrollbarOffset(scrollbar));
+
+ return view->frameView()->convertFromRenderer(renderer(), rect);
+}
+
+IntRect RenderLayer::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
+{
+ RenderView* view = renderer()->view();
+ if (!view)
+ return parentRect;
+
+ IntRect rect = view->frameView()->convertToRenderer(renderer(), parentRect);
+ rect.move(-scrollbarOffset(scrollbar));
+ return rect;
+}
+
+IntPoint RenderLayer::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const
+{
+ RenderView* view = renderer()->view();
+ if (!view)
+ return scrollbarPoint;
+
+ IntPoint point = scrollbarPoint;
+ point.move(scrollbarOffset(scrollbar));
+ return view->frameView()->convertFromRenderer(renderer(), point);
+}
+
+IntPoint RenderLayer::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
+{
+ RenderView* view = renderer()->view();
+ if (!view)
+ return parentPoint;
+
+ IntPoint point = view->frameView()->convertToRenderer(renderer(), parentPoint);
+
+ point.move(-scrollbarOffset(scrollbar));
+ return point;
+}
+
+IntSize RenderLayer::scrollbarOffset(const Scrollbar* scrollbar) const
+{
+ RenderBox* box = renderBox();
+
+ if (scrollbar == m_vBar.get())
+ return IntSize(box->width() - box->borderRight() - scrollbar->width(), box->borderTop());
+
+ if (scrollbar == m_hBar.get())
+ return IntSize(box->borderLeft(), box->height() - box->borderBottom() - scrollbar->height());
+
+ ASSERT_NOT_REACHED();
+ return IntSize();
+}
+
void RenderLayer::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
{
IntRect scrollRect = rect;
@@ -1834,34 +1902,29 @@ bool RenderLayer::isPointInResizeControl(const IntPoint& absolutePoint) const
return resizerCornerRect(this, localBounds).contains(localPoint);
}
-bool RenderLayer::hitTestOverflowControls(HitTestResult& result)
+bool RenderLayer::hitTestOverflowControls(HitTestResult& result, const IntPoint& localPoint)
{
if (!m_hBar && !m_vBar && (!renderer()->hasOverflowClip() || renderer()->style()->resize() == RESIZE_NONE))
return false;
RenderBox* box = renderBox();
ASSERT(box);
-
- int x = 0;
- int y = 0;
- convertToLayerCoords(root(), x, y);
- IntRect absBounds(x, y, box->width(), box->height());
IntRect resizeControlRect;
if (renderer()->style()->resize() != RESIZE_NONE) {
- resizeControlRect = resizerCornerRect(this, absBounds);
- if (resizeControlRect.contains(result.point()))
+ resizeControlRect = resizerCornerRect(this, box->borderBoxRect());
+ if (resizeControlRect.contains(localPoint))
return true;
}
int resizeControlSize = max(resizeControlRect.height(), 0);
if (m_vBar) {
- IntRect vBarRect(absBounds.right() - box->borderRight() - m_vBar->width(),
- absBounds.y() + box->borderTop(),
+ IntRect vBarRect(box->width() - box->borderRight() - m_vBar->width(),
+ box->borderTop(),
m_vBar->width(),
- absBounds.height() - (box->borderTop() + box->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize));
- if (vBarRect.contains(result.point())) {
+ box->height() - (box->borderTop() + box->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize));
+ if (vBarRect.contains(localPoint)) {
result.setScrollbar(m_vBar.get());
return true;
}
@@ -1869,11 +1932,11 @@ bool RenderLayer::hitTestOverflowControls(HitTestResult& result)
resizeControlSize = max(resizeControlRect.width(), 0);
if (m_hBar) {
- IntRect hBarRect(absBounds.x() + box->borderLeft(),
- absBounds.bottom() - box->borderBottom() - m_hBar->height(),
- absBounds.width() - (box->borderLeft() + box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),
+ IntRect hBarRect(box->borderLeft(),
+ box->height() - box->borderBottom() - m_hBar->height(),
+ box->width() - (box->borderLeft() + box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),
m_hBar->height());
- if (hBarRect.contains(result.point())) {
+ if (hBarRect.contains(localPoint)) {
result.setScrollbar(m_hBar.get());
return true;
}
@@ -2046,7 +2109,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
int ty = y - renderBoxY();
// Ensure our lists are up-to-date.
- updateLayerListsIfNeeded();
+ updateCompositingAndLayerListsIfNeeded();
bool selectionOnly = paintRestriction == PaintRestrictionSelectionOnly || paintRestriction == PaintRestrictionSelectionOnlyBlackText;
bool forceBlackText = paintRestriction == PaintRestrictionSelectionOnlyBlackText;
@@ -2336,7 +2399,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont
}
// Ensure our lists and 3d status are up-to-date.
- updateLayerListsIfNeeded();
+ updateCompositingAndLayerListsIfNeeded();
update3DTransformedDescendantStatus();
RefPtr<HitTestingTransformState> localTransformState;
@@ -2574,13 +2637,13 @@ void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, ClipRects& cl
}
if (renderer()->hasOverflowClip()) {
- IntRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(x,y);
+ IntRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(x, y);
clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
if (renderer()->isPositioned() || renderer()->isRelPositioned())
clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
}
if (renderer()->hasClip()) {
- IntRect newPosClip = toRenderBox(renderer())->clipRect(x,y);
+ IntRect newPosClip = toRenderBox(renderer())->clipRect(x, y);
clipRects.setPosClipRect(intersection(newPosClip, clipRects.posClipRect()));
clipRects.setOverflowClipRect(intersection(newPosClip, clipRects.overflowClipRect()));
clipRects.setFixedClipRect(intersection(newPosClip, clipRects.fixedClipRect()));
@@ -2630,10 +2693,10 @@ void RenderLayer::calculateRects(const RenderLayer* rootLayer, const IntRect& pa
if (renderer()->hasOverflowClip() || renderer()->hasClip()) {
// This layer establishes a clip of some kind.
if (renderer()->hasOverflowClip())
- foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(x,y));
+ foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(x, y));
if (renderer()->hasClip()) {
// Clip applies to *us* as well, so go ahead and update the damageRect.
- IntRect newPosClip = toRenderBox(renderer())->clipRect(x,y);
+ IntRect newPosClip = toRenderBox(renderer())->clipRect(x, y);
backgroundRect.intersect(newPosClip);
foregroundRect.intersect(newPosClip);
outlineRect.intersect(newPosClip);
@@ -2920,7 +2983,7 @@ void RenderLayer::dirtyZOrderLists()
#if USE(ACCELERATED_COMPOSITING)
if (!renderer()->documentBeingDestroyed())
- compositor()->setCompositingLayersNeedUpdate();
+ compositor()->setCompositingLayersNeedRebuild();
#endif
}
@@ -2939,7 +3002,7 @@ void RenderLayer::dirtyNormalFlowList()
#if USE(ACCELERATED_COMPOSITING)
if (!renderer()->documentBeingDestroyed())
- compositor()->setCompositingLayersNeedUpdate();
+ compositor()->setCompositingLayersNeedRebuild();
#endif
}
@@ -3009,6 +3072,12 @@ void RenderLayer::collectLayers(Vector<RenderLayer*>*& posBuffer, Vector<RenderL
void RenderLayer::updateLayerListsIfNeeded()
{
+ updateZOrderLists();
+ updateNormalFlowList();
+}
+
+void RenderLayer::updateCompositingAndLayerListsIfNeeded()
+{
#if USE(ACCELERATED_COMPOSITING)
if (compositor()->inCompositingMode()) {
if ((isStackingContext() && m_zOrderListsDirty) || m_normalFlowListDirty)
@@ -3016,8 +3085,7 @@ void RenderLayer::updateLayerListsIfNeeded()
return;
}
#endif
- updateZOrderLists();
- updateNormalFlowList();
+ updateLayerListsIfNeeded();
}
void RenderLayer::repaintIncludingDescendants()
@@ -3129,7 +3197,7 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle*)
updateTransform();
if (compositor()->updateLayerCompositingState(this))
- compositor()->setCompositingLayersNeedUpdate();
+ compositor()->setCompositingLayersNeedRebuild();
else if (m_backing)
m_backing->updateGraphicsLayerGeometry();
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h
index 4feede8..1772c66 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h
@@ -264,7 +264,7 @@ public:
void positionOverflowControls(int tx, int ty);
bool isPointInResizeControl(const IntPoint& absolutePoint) const;
- bool hitTestOverflowControls(HitTestResult&);
+ bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
void paintOverflowControls(GraphicsContext*, int tx, int ty, const IntRect& damageRect);
@@ -294,7 +294,14 @@ public:
bool hasAcceleratedCompositing() const;
void updateLayerPosition();
- void updateLayerPositions(bool doFullRepaint = false, bool checkForRepaint = true);
+
+ enum UpdateLayerPositionsFlag {
+ DoFullRepaint = 1,
+ CheckForRepaint = 1 << 1,
+ UpdateCompositingLayers = 1 << 2,
+ };
+ typedef unsigned UpdateLayerPositionsFlags;
+ void updateLayerPositions(UpdateLayerPositionsFlags = DoFullRepaint | UpdateCompositingLayers);
void updateTransform();
@@ -375,6 +382,7 @@ public:
// Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
IntRect repaintRect() const { return m_repaintRect; }
+ void computeRepaintRects();
void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; }
int staticX() const { return m_staticX; }
@@ -441,6 +449,7 @@ private:
void collectLayers(Vector<RenderLayer*>*&, Vector<RenderLayer*>*&);
void updateLayerListsIfNeeded();
+ void updateCompositingAndLayerListsIfNeeded();
enum PaintLayerFlag {
PaintLayerHaveTransparency = 1,
@@ -469,11 +478,18 @@ private:
bool shouldBeNormalFlowOnly() const;
+ // ScrollBarClient interface
virtual void valueChanged(Scrollbar*);
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const;
virtual bool scrollbarCornerPresent() const;
-
+ virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const;
+ virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const;
+ virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const;
+ virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;
+
+ IntSize scrollbarOffset(const Scrollbar*) const;
+
void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
void childVisibilityChanged(bool newVisibility);
@@ -509,8 +525,8 @@ private:
bool hasCompositingDescendant() const { return m_hasCompositingDescendant; }
void setHasCompositingDescendant(bool b) { m_hasCompositingDescendant = b; }
- bool mustOverlayCompositedLayers() const { return m_mustOverlayCompositedLayers; }
- void setMustOverlayCompositedLayers(bool b) { m_mustOverlayCompositedLayers = b; }
+ bool mustOverlapCompositedLayers() const { return m_mustOverlapCompositedLayers; }
+ void setMustOverlapCompositedLayers(bool b) { m_mustOverlapCompositedLayers = b; }
#endif
private:
@@ -603,7 +619,7 @@ protected:
// in a preserves3D hierarchy. Hint to do 3D-aware hit testing.
#if USE(ACCELERATED_COMPOSITING)
bool m_hasCompositingDescendant : 1;
- bool m_mustOverlayCompositedLayers : 1;
+ bool m_mustOverlapCompositedLayers : 1;
#endif
RenderMarquee* m_marquee; // Used by layers with overflow:marquee
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp
index 1c6d43c..ce0ffb1 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp
@@ -126,10 +126,10 @@ void RenderLayerBacking::updateLayerTransform()
m_graphicsLayer->setTransform(t);
}
-void RenderLayerBacking::updateAfterLayout()
+void RenderLayerBacking::updateAfterLayout(UpdateDepth updateDepth)
{
RenderLayerCompositor* layerCompositor = compositor();
- if (!layerCompositor->compositingLayersNeedUpdate()) {
+ if (!layerCompositor->compositingLayersNeedRebuild()) {
// Calling updateGraphicsLayerGeometry() here gives incorrect results, because the
// position of this layer's GraphicsLayer depends on the position of our compositing
// ancestor's GraphicsLayer. That cannot be determined until all the descendant
@@ -138,10 +138,12 @@ void RenderLayerBacking::updateAfterLayout()
// The solution is to update compositing children of this layer here,
// via updateCompositingChildrenGeometry().
setCompositedBounds(layerCompositor->calculateCompositedBounds(m_owningLayer, m_owningLayer));
- layerCompositor->updateCompositingChildrenGeometry(m_owningLayer, m_owningLayer);
+ layerCompositor->updateCompositingDescendantGeometry(m_owningLayer, m_owningLayer, updateDepth);
- if (!m_owningLayer->parent())
+ if (!m_owningLayer->parent()) {
+ updateGraphicsLayerGeometry();
layerCompositor->updateRootLayerPosition();
+ }
}
}
@@ -969,7 +971,11 @@ bool RenderLayerBacking::startAnimation(double beginTime, const Animation* anim,
if (hasOpacity && m_graphicsLayer->animateFloat(AnimatedPropertyOpacity, opacityVector, anim, beginTime))
didAnimateOpacity = true;
- return didAnimateTransform && didAnimateOpacity;
+ bool runningAcceleratedAnimation = didAnimateTransform && didAnimateOpacity;
+ if (runningAcceleratedAnimation)
+ compositor()->didStartAcceleratedAnimation();
+
+ return runningAcceleratedAnimation;
}
bool RenderLayerBacking::startTransition(double beginTime, int property, const RenderStyle* fromStyle, const RenderStyle* toStyle)
@@ -1003,6 +1009,9 @@ bool RenderLayerBacking::startTransition(double beginTime, int property, const R
didAnimate = true;
}
}
+
+ if (didAnimate)
+ compositor()->didStartAcceleratedAnimation();
return didAnimate;
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h
index 50a77db..25b1a31 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h
@@ -53,7 +53,8 @@ public:
RenderLayer* owningLayer() const { return m_owningLayer; }
- void updateAfterLayout();
+ enum UpdateDepth { CompositingChildren, AllDescendants };
+ void updateAfterLayout(UpdateDepth);
// Returns true if layer configuration changed.
bool updateGraphicsLayerConfiguration();
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp
index 8b07ca9..b7bccaa 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp
@@ -75,20 +75,14 @@ struct CompositingState {
#endif
};
-static TransformationMatrix flipTransform()
-{
- TransformationMatrix flipper;
- flipper.flipY();
- return flipper;
-}
-
RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView)
: m_renderView(renderView)
, m_rootPlatformLayer(0)
+ , m_hasAcceleratedCompositing(true)
+ , m_compositingConsultsOverlap(true)
, m_compositing(false)
, m_rootLayerAttached(false)
- , m_compositingLayersNeedUpdate(false)
- , m_hasAcceleratedCompositing(true)
+ , m_compositingLayersNeedRebuild(false)
#if PROFILE_LAYER_REBUILD
, m_rootLayerUpdateCount(0)
#endif // PROFILE_LAYER_REBUILD
@@ -120,21 +114,21 @@ void RenderLayerCompositor::cacheAcceleratedCompositingEnabledFlag()
{
bool hasAcceleratedCompositing = false;
if (Settings* settings = m_renderView->document()->settings())
- hasAcceleratedCompositing = settings-> acceleratedCompositingEnabled();
+ hasAcceleratedCompositing = settings->acceleratedCompositingEnabled();
if (hasAcceleratedCompositing != m_hasAcceleratedCompositing)
- setCompositingLayersNeedUpdate();
+ setCompositingLayersNeedRebuild();
m_hasAcceleratedCompositing = hasAcceleratedCompositing;
}
-void RenderLayerCompositor::setCompositingLayersNeedUpdate(bool needUpdate)
+void RenderLayerCompositor::setCompositingLayersNeedRebuild(bool needRebuild)
{
if (inCompositingMode()) {
- if (!m_compositingLayersNeedUpdate && needUpdate)
+ if (!m_compositingLayersNeedRebuild && needRebuild)
scheduleViewUpdate();
- m_compositingLayersNeedUpdate = needUpdate;
+ m_compositingLayersNeedRebuild = needRebuild;
}
}
@@ -150,14 +144,17 @@ void RenderLayerCompositor::scheduleViewUpdate()
void RenderLayerCompositor::updateCompositingLayers(RenderLayer* updateRoot)
{
- if (!m_compositingLayersNeedUpdate)
+ // When m_compositingConsultsOverlap is true, then layer positions affect compositing,
+ // so we can only bail here when we're not looking at overlap.
+ if (!m_compositingLayersNeedRebuild && !m_compositingConsultsOverlap)
return;
ASSERT(inCompositingMode());
+ bool needLayerRebuild = m_compositingLayersNeedRebuild;
if (!updateRoot) {
- // Only clear the flag if we're updating the entire hierarchy
- m_compositingLayersNeedUpdate = false;
+ // Only clear the flag if we're updating the entire hierarchy.
+ m_compositingLayersNeedRebuild = false;
updateRoot = rootRenderLayer();
}
@@ -173,13 +170,20 @@ void RenderLayerCompositor::updateCompositingLayers(RenderLayer* updateRoot)
// complex.
{
CompositingState compState(updateRoot);
- computeCompositingRequirements(updateRoot, compState);
+ bool layersChanged;
+ if (m_compositingConsultsOverlap) {
+ OverlapMap overlapTestRequestMap;
+ computeCompositingRequirements(updateRoot, &overlapTestRequestMap, compState, layersChanged);
+ } else
+ computeCompositingRequirements(updateRoot, 0, compState, layersChanged);
+
+ needLayerRebuild |= layersChanged;
}
// Now create and parent the compositing layers.
{
CompositingState compState(updateRoot);
- rebuildCompositingLayerTree(updateRoot, compState);
+ rebuildCompositingLayerTree(updateRoot, compState, needLayerRebuild);
}
#if PROFILE_LAYER_REBUILD
@@ -188,7 +192,7 @@ void RenderLayerCompositor::updateCompositingLayers(RenderLayer* updateRoot)
fprintf(stderr, "Update %d: computeCompositingRequirements for the world took %fms\n",
m_rootLayerUpdateCount, 1000.0 * (endTime - startTime));
#endif
- ASSERT(updateRoot || !m_compositingLayersNeedUpdate);
+ ASSERT(updateRoot || !m_compositingLayersNeedRebuild);
if (!hasAcceleratedCompositing())
enableCompositingMode(false);
@@ -200,6 +204,11 @@ bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeR
if (needsToBeComposited(layer)) {
enableCompositingMode();
+
+ // 3D transforms turn off the testing of overlap.
+ if (requiresCompositingForTransform(layer->renderer()))
+ setCompositingConsultsOverlap(false);
+
if (!layer->backing()) {
// If we need to repaint, do so before making backing
@@ -214,6 +223,10 @@ bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeR
layer->clearBacking();
layerChanged = true;
+ // The layer's cached repaints rects are relative to the repaint container, so change when
+ // compositing changes; we need to update them here.
+ layer->computeRepaintRects();
+
// If we need to repaint, do so now that we've removed the backing
if (shouldRepaint == CompositingChangeRepaintNow)
repaintOnCompositingChange(layer);
@@ -261,13 +274,20 @@ void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer)
// RenderLayers that are rendered by the composited RenderLayer.
IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer)
{
+ if (!layer->isSelfPaintingLayer())
+ return IntRect();
+
IntRect boundingBoxRect, unionBounds;
boundingBoxRect = unionBounds = layer->localBoundingBox();
- ASSERT(layer->isStackingContext() || (!layer->m_posZOrderList || layer->m_posZOrderList->size() == 0));
+ if (layer->renderer()->hasOverflowClip() || layer->renderer()->hasMask()) {
+ int ancestorRelX = 0, ancestorRelY = 0;
+ layer->convertToLayerCoords(ancestorLayer, ancestorRelX, ancestorRelY);
+ boundingBoxRect.move(ancestorRelX, ancestorRelY);
+ return boundingBoxRect;
+ }
- if (!layer->isSelfPaintingLayer())
- return IntRect();
+ ASSERT(layer->isStackingContext() || (!layer->m_posZOrderList || layer->m_posZOrderList->size() == 0));
if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
size_t listSize = negZOrderList->size();
@@ -317,7 +337,7 @@ IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* laye
void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer* /*child*/)
{
- setCompositingLayersNeedUpdate();
+ setCompositingLayersNeedRebuild();
}
void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer* child)
@@ -343,7 +363,7 @@ void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer*
m_renderView->frameView()->setNeedsOneShotDrawingSynchronization();
}
- setCompositingLayersNeedUpdate();
+ setCompositingLayersNeedRebuild();
}
RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const RenderLayer* layer) const
@@ -358,6 +378,31 @@ RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend
return 0;
}
+void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed)
+{
+ if (layer->isRootLayer())
+ return;
+
+ if (!boundsComputed) {
+ layerBounds = layer->renderer()->localToAbsoluteQuad(FloatRect(layer->localBoundingBox())).enclosingBoundingBox();
+ boundsComputed = true;
+ }
+
+ overlapMap.add(layer, layerBounds);
+}
+
+bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, const IntRect& layerBounds)
+{
+ RenderLayerCompositor::OverlapMap::const_iterator end = overlapMap.end();
+ for (RenderLayerCompositor::OverlapMap::const_iterator it = overlapMap.begin(); it != end; ++it) {
+ const IntRect& bounds = it->second;
+ if (layerBounds.intersects(bounds))
+ return true;
+ }
+
+ return false;
+}
+
// Recurse through the layers in z-index and overflow order (which is equivalent to painting order)
// For the z-order children of a compositing layer:
// If a child layers has a compositing layer, then all subsequent layers must
@@ -367,7 +412,7 @@ RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend
// must be compositing so that its contents render over that child.
// This implies that its positive z-index children must also be compositing.
//
-void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, struct CompositingState& compositingState)
+void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, OverlapMap* overlapMap, struct CompositingState& compositingState, bool& layersChanged)
{
layer->updateLayerPosition();
layer->updateZOrderLists();
@@ -375,7 +420,19 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, s
// Clear the flag
layer->setHasCompositingDescendant(false);
- layer->setMustOverlayCompositedLayers(compositingState.m_subtreeIsCompositing);
+
+ bool mustOverlapCompositedLayers = compositingState.m_subtreeIsCompositing;
+
+ bool haveComputedBounds = false;
+ IntRect absBounds;
+ if (overlapMap && mustOverlapCompositedLayers) {
+ // If we're testing for overlap, we only need to composite if we overlap something that is already composited.
+ absBounds = layer->renderer()->localToAbsoluteQuad(FloatRect(layer->localBoundingBox())).enclosingBoundingBox();
+ haveComputedBounds = true;
+ mustOverlapCompositedLayers &= overlapsCompositedLayers(*overlapMap, absBounds);
+ }
+
+ layer->setMustOverlapCompositedLayers(mustOverlapCompositedLayers);
// The children of this layer don't need to composite, unless there is
// a compositing layer among them, so start by inheriting the compositing
@@ -391,6 +448,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, s
compositingState.m_subtreeIsCompositing = true;
// This layer now acts as the ancestor for kids.
childState.m_compositingAncestor = layer;
+ if (overlapMap)
+ addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
}
#if ENABLE(VIDEO)
@@ -407,14 +466,16 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, s
size_t listSize = negZOrderList->size();
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = negZOrderList->at(i);
- computeCompositingRequirements(curLayer, childState);
+ computeCompositingRequirements(curLayer, overlapMap, childState, layersChanged);
// If we have to make a layer for this child, make one now so we can have a contents layer
// (since we need to ensure that the -ve z-order child renders underneath our contents).
if (childState.m_subtreeIsCompositing) {
// make layer compositing
- layer->setMustOverlayCompositedLayers(true);
+ layer->setMustOverlapCompositedLayers(true);
childState.m_compositingAncestor = layer;
+ if (overlapMap)
+ addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
}
}
}
@@ -425,7 +486,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, s
size_t listSize = normalFlowList->size();
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = normalFlowList->at(i);
- computeCompositingRequirements(curLayer, childState);
+ computeCompositingRequirements(curLayer, overlapMap, childState, layersChanged);
}
}
@@ -434,7 +495,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, s
size_t listSize = posZOrderList->size();
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = posZOrderList->at(i);
- computeCompositingRequirements(curLayer, childState);
+ computeCompositingRequirements(curLayer, overlapMap, childState, layersChanged);
}
}
}
@@ -443,8 +504,11 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, s
// be composited. Also, if we have opacity < 1, then we need to be a layer so that
// the child layers are opaque, then rendered with opacity on this layer.
if (childState.m_subtreeIsCompositing &&
- (layer->renderer()->hasTransform() || layer->renderer()->style()->opacity() < 1))
- layer->setMustOverlayCompositedLayers(true);
+ (layer->renderer()->hasTransform() || layer->renderer()->style()->opacity() < 1)) {
+ layer->setMustOverlapCompositedLayers(true);
+ if (overlapMap)
+ addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
+ }
// Subsequent layers in the parent stacking context also need to composite.
if (childState.m_subtreeIsCompositing)
@@ -460,7 +524,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, s
layer->setHasCompositingDescendant(childState.m_subtreeIsCompositing);
// Update backing now, so that we can use isComposited() reliably during tree traversal in rebuildCompositingLayerTree().
- updateBacking(layer, CompositingChangeRepaintNow);
+ if (updateBacking(layer, CompositingChangeRepaintNow))
+ layersChanged = true;
}
void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer)
@@ -515,7 +580,7 @@ bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const
}
#endif
-void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, struct CompositingState& compositingState)
+void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, struct CompositingState& compositingState, bool updateHierarchy)
{
// Make the layer compositing if necessary, and set up clipping and content layers.
// Note that we can only do work here that is independent of whether the descendant layers
@@ -533,11 +598,12 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, stru
updateRootLayerPosition();
// FIXME: make this more incremental
- layerBacking->parentForSublayers()->removeAllChildren();
+ if (updateHierarchy)
+ layerBacking->parentForSublayers()->removeAllChildren();
}
// host the document layer in the RenderView's root layer
- if (layer->isRootLayer() && layer->isComposited())
+ if (updateHierarchy && layer->isRootLayer() && layer->isComposited())
parentInRootLayer(layer);
CompositingState childState = compositingState;
@@ -559,13 +625,13 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, stru
size_t listSize = negZOrderList->size();
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = negZOrderList->at(i);
- rebuildCompositingLayerTree(curLayer, childState);
- if (curLayer->isComposited())
+ rebuildCompositingLayerTree(curLayer, childState, updateHierarchy);
+ if (updateHierarchy && curLayer->isComposited())
setCompositingParent(curLayer, childState.m_compositingAncestor);
}
}
- if (layerBacking && layerBacking->contentsLayer()) {
+ if (updateHierarchy && layerBacking && layerBacking->contentsLayer()) {
// we only have a contents layer if we have an m_layer
layerBacking->contentsLayer()->removeFromParent();
@@ -579,8 +645,8 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, stru
size_t listSize = normalFlowList->size();
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = normalFlowList->at(i);
- rebuildCompositingLayerTree(curLayer, childState);
- if (curLayer->isComposited())
+ rebuildCompositingLayerTree(curLayer, childState, updateHierarchy);
+ if (updateHierarchy && curLayer->isComposited())
setCompositingParent(curLayer, childState.m_compositingAncestor);
}
}
@@ -590,8 +656,8 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, stru
size_t listSize = posZOrderList->size();
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = posZOrderList->at(i);
- rebuildCompositingLayerTree(curLayer, childState);
- if (curLayer->isComposited())
+ rebuildCompositingLayerTree(curLayer, childState, updateHierarchy);
+ if (updateHierarchy && curLayer->isComposited())
setCompositingParent(curLayer, childState.m_compositingAncestor);
}
}
@@ -600,13 +666,14 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, stru
// Recurs down the RenderLayer tree until its finds the compositing descendants of compositingAncestor and updates their geometry.
-void RenderLayerCompositor::updateCompositingChildrenGeometry(RenderLayer* compositingAncestor, RenderLayer* layer)
+void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayer* compositingAncestor, RenderLayer* layer, RenderLayerBacking::UpdateDepth updateDepth)
{
if (layer != compositingAncestor) {
if (RenderLayerBacking* layerBacking = layer->backing()) {
layerBacking->setCompositedBounds(calculateCompositedBounds(layer, layer));
layerBacking->updateGraphicsLayerGeometry();
- return;
+ if (updateDepth == RenderLayerBacking::CompositingChildren)
+ return;
}
}
@@ -617,21 +684,21 @@ void RenderLayerCompositor::updateCompositingChildrenGeometry(RenderLayer* compo
if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
size_t listSize = negZOrderList->size();
for (size_t i = 0; i < listSize; ++i)
- updateCompositingChildrenGeometry(compositingAncestor, negZOrderList->at(i));
+ updateCompositingDescendantGeometry(compositingAncestor, negZOrderList->at(i), updateDepth);
}
}
if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
size_t listSize = normalFlowList->size();
for (size_t i = 0; i < listSize; ++i)
- updateCompositingChildrenGeometry(compositingAncestor, normalFlowList->at(i));
+ updateCompositingDescendantGeometry(compositingAncestor, normalFlowList->at(i), updateDepth);
}
if (layer->isStackingContext()) {
if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
size_t listSize = posZOrderList->size();
for (size_t i = 0; i < listSize; ++i)
- updateCompositingChildrenGeometry(compositingAncestor, posZOrderList->at(i));
+ updateCompositingDescendantGeometry(compositingAncestor, posZOrderList->at(i), updateDepth);
}
}
}
@@ -729,6 +796,14 @@ void RenderLayerCompositor::updateRootLayerPosition()
m_rootPlatformLayer->setSize(FloatSize(m_renderView->overflowWidth(), m_renderView->overflowHeight()));
}
+void RenderLayerCompositor::didStartAcceleratedAnimation()
+{
+ // If an accelerated animation or transition runs, we have to turn off overlap checking because
+ // we don't do layout for every frame, but we have to ensure that the layering is
+ // correct between the animating object and other objects on the page.
+ setCompositingConsultsOverlap(false);
+}
+
bool RenderLayerCompositor::has3DContent() const
{
return layerHas3DContent(rootRenderLayer());
@@ -739,7 +814,7 @@ bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const
if (!m_hasAcceleratedCompositing || !layer->isSelfPaintingLayer())
return false;
- return requiresCompositingLayer(layer) || layer->mustOverlayCompositedLayers();
+ return requiresCompositingLayer(layer) || layer->mustOverlapCompositedLayers();
}
// Note: this specifies whether the RL needs a compositing layer for intrinsic reasons.
@@ -847,9 +922,8 @@ void RenderLayerCompositor::ensureRootPlatformLayer()
m_rootPlatformLayer = GraphicsLayer::createGraphicsLayer(0);
m_rootPlatformLayer->setSize(FloatSize(m_renderView->overflowWidth(), m_renderView->overflowHeight()));
m_rootPlatformLayer->setPosition(FloatPoint(0, 0));
-
- if (GraphicsLayer::compositingCoordinatesOrientation() == GraphicsLayer::CompositingCoordinatesBottomUp)
- m_rootPlatformLayer->setChildrenTransform(flipTransform());
+ // The root layer does flipping if we need it on this platform.
+ m_rootPlatformLayer->setGeometryOrientation(GraphicsLayer::compositingCoordinatesOrientation());
// Need to clip to prevent transformed content showing outside this frame
m_rootPlatformLayer->setMasksToBounds(true);
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.h
index bcd6a3f..778eccc 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.h
@@ -27,6 +27,7 @@
#define RenderLayerCompositor_h
#include "RenderLayer.h"
+#include "RenderLayerBacking.h"
namespace WebCore {
@@ -63,9 +64,16 @@ public:
// Copy the acceleratedCompositingEnabledFlag from Settings
void cacheAcceleratedCompositingEnabledFlag();
- void setCompositingLayersNeedUpdate(bool needUpdate = true);
- bool compositingLayersNeedUpdate() const { return m_compositingLayersNeedUpdate; }
+ // Called when the layer hierarchy needs to be udpated (compositing layers have been
+ // created, destroyed or re-parented).
+ void setCompositingLayersNeedRebuild(bool needRebuild = true);
+ bool compositingLayersNeedRebuild() const { return m_compositingLayersNeedRebuild; }
+ // Controls whether or not to consult geometry when deciding which layers need
+ // to be composited. Defaults to true.
+ void setCompositingConsultsOverlap(bool b) { m_compositingConsultsOverlap = b; }
+ bool compositingConsultsOverlap() const { return m_compositingConsultsOverlap; }
+
void scheduleViewUpdate();
// Rebuild the tree of compositing layers
@@ -76,7 +84,7 @@ public:
bool updateLayerCompositingState(RenderLayer*, CompositingChangeRepaint = CompositingChangeRepaintNow);
// Update the geometry for compositing children of compositingAncestor.
- void updateCompositingChildrenGeometry(RenderLayer* compositingAncestor, RenderLayer* layer);
+ void updateCompositingDescendantGeometry(RenderLayer* compositingAncestor, RenderLayer* layer, RenderLayerBacking::UpdateDepth);
// Whether layer's backing needs a graphics layer to do clipping by an ancestor (non-stacking-context parent with overflow).
bool clippedByAncestor(RenderLayer*) const;
@@ -110,6 +118,8 @@ public:
void updateRootLayerPosition();
+ void didStartAcceleratedAnimation();
+
#if ENABLE(VIDEO)
// Use by RenderVideo to ask if it should try to use accelerated compositing.
bool canAccelerateVideoRendering(RenderVideo*) const;
@@ -131,8 +141,13 @@ private:
// Repaint the given rect (which is layer's coords), and regions of child layers that intersect that rect.
void recursiveRepaintLayerRect(RenderLayer* layer, const IntRect& rect);
- void computeCompositingRequirements(RenderLayer*, struct CompositingState&);
- void rebuildCompositingLayerTree(RenderLayer* layer, struct CompositingState&);
+ typedef HashMap<RenderLayer*, IntRect> OverlapMap;
+ static void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed);
+ static bool overlapsCompositedLayers(OverlapMap&, const IntRect& layerBounds);
+
+ // Returns true if any layer's compositing changed
+ void computeCompositingRequirements(RenderLayer*, OverlapMap*, struct CompositingState&, bool& layersChanged);
+ void rebuildCompositingLayerTree(RenderLayer* layer, struct CompositingState&, bool updateHierarchy);
// Hook compositing layers together
void setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer);
@@ -153,10 +168,11 @@ private:
private:
RenderView* m_renderView;
GraphicsLayer* m_rootPlatformLayer;
+ bool m_hasAcceleratedCompositing;
+ bool m_compositingConsultsOverlap;
bool m_compositing;
bool m_rootLayerAttached;
- bool m_compositingLayersNeedUpdate;
- bool m_hasAcceleratedCompositing;
+ bool m_compositingLayersNeedRebuild;
#if PROFILE_LAYER_REBUILD
int m_rootLayerUpdateCount;
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp
index 83c569e..e6c28f7 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp
@@ -370,7 +370,7 @@ bool RenderListBox::isPointInOverflowControl(HitTestResult& result, int _x, int
return false;
IntRect vertRect(_tx + width() - borderRight() - m_vBar->width(),
- _ty,
+ _ty + borderTop(),
m_vBar->width(),
height() - borderTop() - borderBottom());
@@ -416,22 +416,22 @@ void RenderListBox::panScroll(const IntPoint& panStartMousePosition)
int yDelta = currentMousePosition.y() - panStartMousePosition.y();
- // If the point is too far from the center we limit the speed
+ // If the point is too far from the center we limit the speed
yDelta = max(min(yDelta, maxSpeed), -maxSpeed);
- if(abs(yDelta) < iconRadius) // at the center we let the space for the icon
+ if (abs(yDelta) < iconRadius) // at the center we let the space for the icon
return;
if (yDelta > 0)
//offsetY = view()->viewHeight();
absOffset.move(0, listHeight());
- else if (yDelta < 0)
- yDelta--;
+ else if (yDelta < 0)
+ yDelta--;
// Let's attenuate the speed
yDelta /= speedReducer;
- IntPoint scrollPoint(0,0);
+ IntPoint scrollPoint(0, 0);
scrollPoint.setY(absOffset.y() + yDelta);
int newOffset = scrollToward(scrollPoint);
if (newOffset < 0)
@@ -623,6 +623,64 @@ void RenderListBox::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect&
repaintRectangle(scrollRect);
}
+IntRect RenderListBox::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const
+{
+ RenderView* view = this->view();
+ if (!view)
+ return scrollbarRect;
+
+ IntRect rect = scrollbarRect;
+
+ int scrollbarLeft = width() - borderRight() - scrollbar->width();
+ int scrollbarTop = borderTop();
+ rect.move(scrollbarLeft, scrollbarTop);
+
+ return view->frameView()->convertFromRenderer(this, rect);
+}
+
+IntRect RenderListBox::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
+{
+ RenderView* view = this->view();
+ if (!view)
+ return parentRect;
+
+ IntRect rect = view->frameView()->convertToRenderer(this, parentRect);
+
+ int scrollbarLeft = width() - borderRight() - scrollbar->width();
+ int scrollbarTop = borderTop();
+ rect.move(-scrollbarLeft, -scrollbarTop);
+ return rect;
+}
+
+IntPoint RenderListBox::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const
+{
+ RenderView* view = this->view();
+ if (!view)
+ return scrollbarPoint;
+
+ IntPoint point = scrollbarPoint;
+
+ int scrollbarLeft = width() - borderRight() - scrollbar->width();
+ int scrollbarTop = borderTop();
+ point.move(scrollbarLeft, scrollbarTop);
+
+ return view->frameView()->convertFromRenderer(this, point);
+}
+
+IntPoint RenderListBox::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
+{
+ RenderView* view = this->view();
+ if (!view)
+ return parentPoint;
+
+ IntPoint point = view->frameView()->convertToRenderer(this, parentPoint);
+
+ int scrollbarLeft = width() - borderRight() - scrollbar->width();
+ int scrollbarTop = borderTop();
+ point.move(-scrollbarLeft, -scrollbarTop);
+ return point;
+}
+
PassRefPtr<Scrollbar> RenderListBox::createScrollbar()
{
RefPtr<Scrollbar> widget;
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderListBox.h b/src/3rdparty/webkit/WebCore/rendering/RenderListBox.h
index b8c0540..dd257a8 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderListBox.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderListBox.h
@@ -101,6 +101,10 @@ private:
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const;
virtual bool scrollbarCornerPresent() const { return false; } // We don't support resize on list boxes yet. If we did this would have to change.
+ virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const;
+ virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const;
+ virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const;
+ virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;
void setHasVerticalScrollbar(bool hasScrollbar);
PassRefPtr<Scrollbar> createScrollbar();
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderMarquee.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderMarquee.cpp
index 48659f7..31a8305 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderMarquee.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderMarquee.cpp
@@ -235,7 +235,7 @@ void RenderMarquee::updateMarqueeStyle()
// to a marquee of 200px.
if (isHorizontal()) {
if (s->height().isFixed() && s->height().value() < s->fontSize())
- s->setHeight(Length(s->fontSize(),Fixed));
+ s->setHeight(Length(s->fontSize(), Fixed));
} else if (s->height().isAuto()) //vertical marquee with no specified height
s->setHeight(Length(200, Fixed));
@@ -309,4 +309,3 @@ void RenderMarquee::timerFired(Timer<RenderMarquee>*)
}
} // namespace WebCore
-
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp
index b0eb097..b87e99d 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp
@@ -45,7 +45,8 @@ using namespace HTMLNames;
static const double cTimeUpdateRepeatDelay = 0.2;
static const double cOpacityAnimationRepeatDelay = 0.05;
// FIXME get this from style
-static const double cOpacityAnimationDuration = 0.1;
+static const double cOpacityAnimationDurationFadeIn = 0.1;
+static const double cOpacityAnimationDurationFadeOut = 0.3;
RenderMedia::RenderMedia(HTMLMediaElement* video)
: RenderReplaced(video)
@@ -53,9 +54,9 @@ RenderMedia::RenderMedia(HTMLMediaElement* video)
, m_opacityAnimationTimer(this, &RenderMedia::opacityAnimationTimerFired)
, m_mouseOver(false)
, m_opacityAnimationStartTime(0)
+ , m_opacityAnimationDuration(cOpacityAnimationDurationFadeIn)
, m_opacityAnimationFrom(0)
, m_opacityAnimationTo(1.0f)
- , m_previousVisible(VISIBLE)
{
}
@@ -65,6 +66,7 @@ RenderMedia::RenderMedia(HTMLMediaElement* video, const IntSize& intrinsicSize)
, m_opacityAnimationTimer(this, &RenderMedia::opacityAnimationTimerFired)
, m_mouseOver(false)
, m_opacityAnimationStartTime(0)
+ , m_opacityAnimationDuration(cOpacityAnimationDurationFadeIn)
, m_opacityAnimationFrom(0)
, m_opacityAnimationTo(1.0f)
{
@@ -104,20 +106,32 @@ void RenderMedia::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
RenderReplaced::styleDidChange(diff, oldStyle);
if (m_controlsShadowRoot) {
- if (m_panel->renderer())
- m_panel->renderer()->setStyle(getCachedPseudoStyle(MEDIA_CONTROLS_PANEL));
-
- if (m_timelineContainer->renderer())
- m_timelineContainer->renderer()->setStyle(getCachedPseudoStyle(MEDIA_CONTROLS_TIMELINE_CONTAINER));
-
- m_muteButton->updateStyle();
- m_playButton->updateStyle();
- m_seekBackButton->updateStyle();
- m_seekForwardButton->updateStyle();
- m_timeline->updateStyle();
- m_fullscreenButton->updateStyle();
- m_currentTimeDisplay->updateStyle();
- m_timeRemainingDisplay->updateStyle();
+ if (m_panel)
+ m_panel->updateStyle();
+ if (m_muteButton)
+ m_muteButton->updateStyle();
+ if (m_playButton)
+ m_playButton->updateStyle();
+ if (m_seekBackButton)
+ m_seekBackButton->updateStyle();
+ if (m_seekForwardButton)
+ m_seekForwardButton->updateStyle();
+ if (m_rewindButton)
+ m_rewindButton->updateStyle();
+ if (m_returnToRealtimeButton)
+ m_returnToRealtimeButton->updateStyle();
+ if (m_statusDisplay)
+ m_statusDisplay->updateStyle();
+ if (m_timelineContainer)
+ m_timelineContainer->updateStyle();
+ if (m_timeline)
+ m_timeline->updateStyle();
+ if (m_fullscreenButton)
+ m_fullscreenButton->updateStyle();
+ if (m_currentTimeDisplay)
+ m_currentTimeDisplay->updateStyle();
+ if (m_timeRemainingDisplay)
+ m_timeRemainingDisplay->updateStyle();
}
}
@@ -132,6 +146,13 @@ void RenderMedia::layout()
return;
IntSize newSize = contentBoxRect().size();
if (newSize != oldSize || controlsRenderer->needsLayout()) {
+
+ if (m_currentTimeDisplay && m_timeRemainingDisplay) {
+ bool shouldShowTimeDisplays = shouldShowTimeDisplayControls();
+ m_currentTimeDisplay->setVisible(shouldShowTimeDisplays);
+ m_timeRemainingDisplay->setVisible(shouldShowTimeDisplays);
+ }
+
controlsRenderer->setLocation(borderLeft() + paddingLeft(), borderTop() + paddingTop());
controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
@@ -151,17 +172,8 @@ void RenderMedia::createControlsShadowRoot()
void RenderMedia::createPanel()
{
ASSERT(!m_panel);
- RenderStyle* style = getCachedPseudoStyle(MEDIA_CONTROLS_PANEL);
- m_panel = new HTMLDivElement(HTMLNames::divTag, document());
- RenderObject* renderer = m_panel->createRenderer(renderArena(), style);
- if (renderer) {
- m_panel->setRenderer(renderer);
- renderer->setStyle(style);
- m_panel->setAttached();
- m_panel->setInDocument(true);
- m_controlsShadowRoot->addChild(m_panel);
- m_controlsShadowRoot->renderer()->addChild(renderer);
- }
+ m_panel = new MediaControlElement(document(), MEDIA_CONTROLS_PANEL, mediaElement());
+ m_panel->attachToParent(m_controlsShadowRoot.get());
}
void RenderMedia::createMuteButton()
@@ -192,20 +204,32 @@ void RenderMedia::createSeekForwardButton()
m_seekForwardButton->attachToParent(m_panel.get());
}
+void RenderMedia::createRewindButton()
+{
+ ASSERT(!m_rewindButton);
+ m_rewindButton = new MediaControlRewindButtonElement(document(), mediaElement());
+ m_rewindButton->attachToParent(m_panel.get());
+}
+
+void RenderMedia::createReturnToRealtimeButton()
+{
+ ASSERT(!m_returnToRealtimeButton);
+ m_returnToRealtimeButton = new MediaControlReturnToRealtimeButtonElement(document(), mediaElement());
+ m_returnToRealtimeButton->attachToParent(m_panel.get());
+}
+
+void RenderMedia::createStatusDisplay()
+{
+ ASSERT(!m_statusDisplay);
+ m_statusDisplay = new MediaControlStatusDisplayElement(document(), mediaElement());
+ m_statusDisplay->attachToParent(m_panel.get());
+}
+
void RenderMedia::createTimelineContainer()
{
ASSERT(!m_timelineContainer);
- RenderStyle* style = getCachedPseudoStyle(MEDIA_CONTROLS_TIMELINE_CONTAINER);
- m_timelineContainer = new HTMLDivElement(HTMLNames::divTag, document());
- RenderObject* renderer = m_timelineContainer->createRenderer(renderArena(), style);
- if (renderer) {
- m_timelineContainer->setRenderer(renderer);
- renderer->setStyle(style);
- m_timelineContainer->setAttached();
- m_timelineContainer->setInDocument(true);
- m_panel->addChild(m_timelineContainer);
- m_panel->renderer()->addChild(renderer);
- }
+ m_timelineContainer = new MediaControlTimelineContainerElement(document(), mediaElement());
+ m_timelineContainer->attachToParent(m_panel.get());
}
void RenderMedia::createTimeline()
@@ -215,18 +239,18 @@ void RenderMedia::createTimeline()
m_timeline->setAttribute(precisionAttr, "float");
m_timeline->attachToParent(m_timelineContainer.get());
}
-
+
void RenderMedia::createCurrentTimeDisplay()
{
ASSERT(!m_currentTimeDisplay);
- m_currentTimeDisplay = new MediaTimeDisplayElement(document(), mediaElement(), true);
+ m_currentTimeDisplay = new MediaControlTimeDisplayElement(document(), MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, mediaElement());
m_currentTimeDisplay->attachToParent(m_timelineContainer.get());
}
void RenderMedia::createTimeRemainingDisplay()
{
ASSERT(!m_timeRemainingDisplay);
- m_timeRemainingDisplay = new MediaTimeDisplayElement(document(), mediaElement(), false);
+ m_timeRemainingDisplay = new MediaControlTimeDisplayElement(document(), MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, mediaElement());
m_timeRemainingDisplay->attachToParent(m_timelineContainer.get());
}
@@ -251,10 +275,13 @@ void RenderMedia::updateControls()
m_panel = 0;
m_muteButton = 0;
m_playButton = 0;
+ m_statusDisplay = 0;
m_timelineContainer = 0;
m_timeline = 0;
m_seekBackButton = 0;
m_seekForwardButton = 0;
+ m_rewindButton = 0;
+ m_returnToRealtimeButton = 0;
m_currentTimeDisplay = 0;
m_timeRemainingDisplay = 0;
m_fullscreenButton = 0;
@@ -269,34 +296,46 @@ void RenderMedia::updateControls()
if (!m_controlsShadowRoot) {
createControlsShadowRoot();
createPanel();
- if (m_panel && m_panel->renderer()) {
+ if (m_panel) {
+ createRewindButton();
createMuteButton();
createPlayButton();
+ createReturnToRealtimeButton();
+ createStatusDisplay();
createTimelineContainer();
createSeekBackButton();
createSeekForwardButton();
- createFullscreenButton();
- }
- if (m_timelineContainer && m_timelineContainer->renderer()) {
- createCurrentTimeDisplay();
- createTimeline();
- createTimeRemainingDisplay();
+ createFullscreenButton();
+ if (m_timelineContainer) {
+ createCurrentTimeDisplay();
+ createTimeline();
+ createTimeRemainingDisplay();
+ }
+ m_panel->attach();
}
}
if (media->canPlay()) {
if (m_timeUpdateTimer.isActive())
m_timeUpdateTimer.stop();
- } else if (style()->visibility() == VISIBLE && m_timeline && m_timeline->renderer() && m_timeline->renderer()->style()->display() != NONE ) {
+ } else if (style()->visibility() == VISIBLE && m_timeline && m_timeline->renderer() && m_timeline->renderer()->style()->display() != NONE) {
m_timeUpdateTimer.startRepeating(cTimeUpdateRepeatDelay);
}
- m_previousVisible = style()->visibility();
+ if (m_panel) {
+ // update() might alter the opacity of the element, especially if we are in the middle
+ // of an animation. This is the only element concerned as we animate only this element.
+ float opacityBeforeChangingStyle = m_panel->renderer() ? m_panel->renderer()->style()->opacity() : 0;
+ m_panel->update();
+ changeOpacity(m_panel.get(), opacityBeforeChangingStyle);
+ }
if (m_muteButton)
m_muteButton->update();
if (m_playButton)
m_playButton->update();
+ if (m_timelineContainer)
+ m_timelineContainer->update();
if (m_timeline)
m_timeline->update();
if (m_currentTimeDisplay)
@@ -307,8 +346,15 @@ void RenderMedia::updateControls()
m_seekBackButton->update();
if (m_seekForwardButton)
m_seekForwardButton->update();
+ if (m_rewindButton)
+ m_rewindButton->update();
+ if (m_returnToRealtimeButton)
+ m_returnToRealtimeButton->update();
+ if (m_statusDisplay)
+ m_statusDisplay->update();
if (m_fullscreenButton)
m_fullscreenButton->update();
+
updateTimeDisplay();
updateControlVisibility();
}
@@ -363,26 +409,34 @@ void RenderMedia::updateControlVisibility()
if (!media->hasVideo())
return;
- // do fading manually, css animations don't work well with shadow trees
- bool visible = style()->visibility() == VISIBLE && (m_mouseOver || media->canPlay());
- if (visible == (m_opacityAnimationTo > 0))
+ // Don't fade if the media element is not visible
+ if (style()->visibility() != VISIBLE)
return;
+
+ bool shouldHideController = !m_mouseOver && !media->canPlay();
+
+ // Do fading manually, css animations don't work with shadow trees
- if (style()->visibility() != m_previousVisible) {
- // don't fade gradually if it the element has just changed visibility
- m_previousVisible = style()->visibility();
- m_opacityAnimationTo = m_previousVisible == VISIBLE ? 1.0f : 0;
- changeOpacity(m_panel.get(), m_opacityAnimationTo);
+ float animateFrom = m_panel->renderer()->style()->opacity();
+ float animateTo = shouldHideController ? 0.0f : 1.0f;
+
+ if (animateFrom == animateTo)
return;
- }
- if (visible) {
- m_opacityAnimationFrom = m_panel->renderer()->style()->opacity();
- m_opacityAnimationTo = 1.0f;
- } else {
- m_opacityAnimationFrom = m_panel->renderer()->style()->opacity();
- m_opacityAnimationTo = 0;
+ if (m_opacityAnimationTimer.isActive()) {
+ if (m_opacityAnimationTo == animateTo)
+ return;
+ m_opacityAnimationTimer.stop();
}
+
+ if (animateFrom < animateTo)
+ m_opacityAnimationDuration = cOpacityAnimationDurationFadeIn;
+ else
+ m_opacityAnimationDuration = cOpacityAnimationDurationFadeOut;
+
+ m_opacityAnimationFrom = animateFrom;
+ m_opacityAnimationTo = animateTo;
+
m_opacityAnimationStartTime = currentTime();
m_opacityAnimationTimer.startRepeating(cOpacityAnimationRepeatDelay);
}
@@ -401,11 +455,11 @@ void RenderMedia::changeOpacity(HTMLElement* e, float opacity)
void RenderMedia::opacityAnimationTimerFired(Timer<RenderMedia>*)
{
double time = currentTime() - m_opacityAnimationStartTime;
- if (time >= cOpacityAnimationDuration) {
- time = cOpacityAnimationDuration;
+ if (time >= m_opacityAnimationDuration) {
+ time = m_opacityAnimationDuration;
m_opacityAnimationTimer.stop();
}
- float opacity = narrowPrecisionToFloat(m_opacityAnimationFrom + (m_opacityAnimationTo - m_opacityAnimationFrom) * time / cOpacityAnimationDuration);
+ float opacity = narrowPrecisionToFloat(m_opacityAnimationFrom + (m_opacityAnimationTo - m_opacityAnimationFrom) * time / m_opacityAnimationDuration);
changeOpacity(m_panel.get(), opacity);
}
@@ -426,6 +480,12 @@ void RenderMedia::forwardEvent(Event* event)
if (m_seekForwardButton && m_seekForwardButton->hitTest(point))
m_seekForwardButton->defaultEventHandler(event);
+ if (m_rewindButton && m_rewindButton->hitTest(point))
+ m_rewindButton->defaultEventHandler(event);
+
+ if (m_returnToRealtimeButton && m_returnToRealtimeButton->hitTest(point))
+ m_returnToRealtimeButton->defaultEventHandler(event);
+
if (m_timeline && m_timeline->hitTest(point))
m_timeline->defaultEventHandler(event);
@@ -473,6 +533,19 @@ int RenderMedia::leftmostPosition(bool includeOverflowInterior, bool includeSelf
return min(left, m_controlsShadowRoot->renderBox()->x() + m_controlsShadowRoot->renderBox()->leftmostPosition(includeOverflowInterior, includeSelf));
}
+
+// We want the timeline slider to be at least 100 pixels wide.
+static const int minWidthToDisplayTimeDisplays = 16 + 16 + 45 + 100 + 45 + 16 + 1;
+
+bool RenderMedia::shouldShowTimeDisplayControls() const
+{
+ if (!m_currentTimeDisplay && !m_timeRemainingDisplay)
+ return false;
+
+ int width = mediaElement()->renderBox()->width();
+ return width >= minWidthToDisplayTimeDisplays * style()->effectiveZoom();
+}
+
} // namespace WebCore
#endif
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderMedia.h b/src/3rdparty/webkit/WebCore/rendering/RenderMedia.h
index 6013d7b..e1149bb 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderMedia.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderMedia.h
@@ -38,9 +38,14 @@ class HTMLMediaElement;
class MediaControlMuteButtonElement;
class MediaControlPlayButtonElement;
class MediaControlSeekButtonElement;
+class MediaControlRewindButtonElement;
+class MediaControlReturnToRealtimeButtonElement;
class MediaControlTimelineElement;
class MediaControlFullscreenButtonElement;
-class MediaTimeDisplayElement;
+class MediaControlTimeDisplayElement;
+class MediaControlStatusDisplayElement;
+class MediaControlTimelineContainerElement;
+class MediaControlElement;
class MediaPlayer;
class RenderMedia : public RenderReplaced {
@@ -66,6 +71,8 @@ public:
static String formatTime(float time);
+ bool shouldShowTimeDisplayControls() const;
+
void updateFromElement();
void updatePlayer();
void updateControls();
@@ -85,6 +92,9 @@ private:
void createPlayButton();
void createSeekBackButton();
void createSeekForwardButton();
+ void createRewindButton();
+ void createReturnToRealtimeButton();
+ void createStatusDisplay();
void createTimelineContainer();
void createTimeline();
void createCurrentTimeDisplay();
@@ -100,16 +110,19 @@ private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
RefPtr<HTMLElement> m_controlsShadowRoot;
- RefPtr<HTMLElement> m_panel;
+ RefPtr<MediaControlElement> m_panel;
RefPtr<MediaControlMuteButtonElement> m_muteButton;
RefPtr<MediaControlPlayButtonElement> m_playButton;
RefPtr<MediaControlSeekButtonElement> m_seekBackButton;
RefPtr<MediaControlSeekButtonElement> m_seekForwardButton;
+ RefPtr<MediaControlRewindButtonElement> m_rewindButton;
+ RefPtr<MediaControlReturnToRealtimeButtonElement> m_returnToRealtimeButton;
RefPtr<MediaControlTimelineElement> m_timeline;
RefPtr<MediaControlFullscreenButtonElement> m_fullscreenButton;
- RefPtr<HTMLElement> m_timelineContainer;
- RefPtr<MediaTimeDisplayElement> m_currentTimeDisplay;
- RefPtr<MediaTimeDisplayElement> m_timeRemainingDisplay;
+ RefPtr<MediaControlTimelineContainerElement> m_timelineContainer;
+ RefPtr<MediaControlTimeDisplayElement> m_currentTimeDisplay;
+ RefPtr<MediaControlTimeDisplayElement> m_timeRemainingDisplay;
+ RefPtr<MediaControlStatusDisplayElement> m_statusDisplay;
RenderObjectChildList m_children;
Node* m_lastUnderNode;
Node* m_nodeUnderMouse;
@@ -118,9 +131,9 @@ private:
Timer<RenderMedia> m_opacityAnimationTimer;
bool m_mouseOver;
double m_opacityAnimationStartTime;
+ double m_opacityAnimationDuration;
float m_opacityAnimationFrom;
float m_opacityAnimationTo;
- EVisibility m_previousVisible;
};
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderMenuList.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderMenuList.cpp
index 4cd7b43..ed8c8ba 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderMenuList.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderMenuList.cpp
@@ -25,6 +25,7 @@
#include "RenderMenuList.h"
#include "CSSStyleSelector.h"
+#include "Frame.h"
#include "FrameView.h"
#include "HTMLNames.h"
#include "NodeRenderStyle.h"
@@ -296,6 +297,12 @@ void RenderMenuList::hidePopup()
void RenderMenuList::valueChanged(unsigned listIndex, bool fireOnChange)
{
+ // Check to ensure a page navigation has not occurred while
+ // the popup was up.
+ Document* doc = static_cast<Element*>(node())->document();
+ if (!doc || doc != doc->frame()->document())
+ return;
+
SelectElement* select = toSelectElement(static_cast<Element*>(node()));
select->setSelectedIndexByUser(select->listToOptionIndex(listIndex), true, fireOnChange);
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp
index 098932a..adf6deb 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp
@@ -774,7 +774,7 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
break;
case BSRight:
drawLineForBoxSide(graphicsContext, x1, y1 + max((adjbw1 * 2 + 1) / 3, 0),
- x1 + third, y2 - max(( adjbw2 * 2 + 1) / 3, 0),
+ x1 + third, y2 - max((adjbw2 * 2 + 1) / 3, 0),
s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
drawLineForBoxSide(graphicsContext, x2 - third, y1 + max((-adjbw1 * 2 + 1) / 3, 0),
x2, y2 - max((-adjbw2 * 2 + 1) / 3, 0),
@@ -1738,8 +1738,8 @@ IntSize RenderObject::offsetFromContainer(RenderObject* o) const
IntRect RenderObject::localCaretRect(InlineBox*, int, int* extraWidthToEndOfLine)
{
- if (extraWidthToEndOfLine)
- *extraWidthToEndOfLine = 0;
+ if (extraWidthToEndOfLine)
+ *extraWidthToEndOfLine = 0;
return IntRect();
}
@@ -1980,6 +1980,27 @@ void RenderObject::layout()
setNeedsLayout(false);
}
+PassRefPtr<RenderStyle> RenderObject::uncachedFirstLineStyle(RenderStyle* style) const
+{
+ if (!document()->usesFirstLineRules())
+ return 0;
+
+ ASSERT(!isText());
+
+ RefPtr<RenderStyle> result;
+
+ if (isBlockFlow()) {
+ if (RenderBlock* firstLineBlock = this->firstLineBlock())
+ result = firstLineBlock->getUncachedPseudoStyle(FIRST_LINE, style, firstLineBlock == this ? style : 0);
+ } else if (!isAnonymous() && isRenderInline()) {
+ RenderStyle* parentStyle = parent()->firstLineStyle();
+ if (parentStyle != parent()->style())
+ result = getUncachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle, style);
+ }
+
+ return result.release();
+}
+
RenderStyle* RenderObject::firstLineStyleSlowCase() const
{
ASSERT(document()->usesFirstLineRules());
@@ -2016,13 +2037,15 @@ RenderStyle* RenderObject::getCachedPseudoStyle(PseudoId pseudo, RenderStyle* pa
return 0;
}
-PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(PseudoId pseudo, RenderStyle* parentStyle) const
+PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(PseudoId pseudo, RenderStyle* parentStyle, RenderStyle* ownStyle) const
{
- if (pseudo < FIRST_INTERNAL_PSEUDOID && !style()->hasPseudoStyle(pseudo))
+ if (pseudo < FIRST_INTERNAL_PSEUDOID && !ownStyle && !style()->hasPseudoStyle(pseudo))
return 0;
- if (!parentStyle)
+ if (!parentStyle) {
+ ASSERT(!ownStyle);
parentStyle = style();
+ }
Node* n = node();
while (n && !n->isElementNode())
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderObject.h b/src/3rdparty/webkit/WebCore/rendering/RenderObject.h
index 311ef9c..911169d 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderObject.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderObject.h
@@ -382,7 +382,7 @@ public:
// The pseudo element style can be cached or uncached. Use the cached method if the pseudo element doesn't respect
// any pseudo classes (and therefore has no concept of changing state).
RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const;
- PassRefPtr<RenderStyle> getUncachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const;
+ PassRefPtr<RenderStyle> getUncachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0, RenderStyle* ownStyle = 0) const;
virtual void updateDragState(bool dragOn);
@@ -553,7 +553,11 @@ public:
RenderStyle* style() const { return m_style.get(); }
RenderStyle* firstLineStyle() const { return document()->usesFirstLineRules() ? firstLineStyleSlowCase() : style(); }
RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); }
-
+
+ // Used only by Element::pseudoStyleCacheIsInvalid to get a first line style based off of a
+ // given new style, without accessing the cache.
+ PassRefPtr<RenderStyle> uncachedFirstLineStyle(RenderStyle*) const;
+
// Anonymous blocks that are part of of a continuation chain will return their inline continuation's outline style instead.
// This is typically only relevant when repainting.
virtual RenderStyle* outlineStyleForRepaint() const { return style(); }
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderPart.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderPart.cpp
index bcf9ef9..cb56c0c 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderPart.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderPart.cpp
@@ -41,13 +41,11 @@ RenderPart::~RenderPart()
clearWidget();
}
-void RenderPart::setWidget(Widget* widget)
+void RenderPart::setWidget(PassRefPtr<Widget> widget)
{
if (widget == this->widget())
return;
- if (widget && widget->isFrameView())
- static_cast<FrameView*>(widget)->ref();
RenderWidget::setWidget(widget);
// make sure the scrollbars are set correctly for restore
@@ -59,16 +57,4 @@ void RenderPart::viewCleared()
{
}
-void RenderPart::deleteWidget(Widget* widget)
-{
- // Since deref ends up calling setWidget back on us, need to make sure
- // that widget is already 0 so it won't do any work.
- ASSERT(!this->widget());
-
- if (widget && widget->isFrameView())
- static_cast<FrameView*>(widget)->deref();
- else
- delete widget;
-}
-
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderPart.h b/src/3rdparty/webkit/WebCore/rendering/RenderPart.h
index e47ead0..a1d2e2b 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderPart.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderPart.h
@@ -34,7 +34,7 @@ public:
bool hasFallbackContent() const { return m_hasFallbackContent; }
- virtual void setWidget(Widget*);
+ virtual void setWidget(PassRefPtr<Widget>);
virtual void viewCleared();
protected:
@@ -43,8 +43,6 @@ protected:
private:
virtual bool isRenderPart() const { return true; }
virtual const char* renderName() const { return "RenderPart"; }
-
- virtual void deleteWidget(Widget*);
};
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderReplaced.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderReplaced.cpp
index e61ac8e..d9a0b62 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderReplaced.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderReplaced.cpp
@@ -127,8 +127,7 @@ void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty)
drawSelectionTint = false;
}
- bool clipToBorderRadius = style()->overflowX() != OVISIBLE && style()->hasBorderRadius();
- if (clipToBorderRadius) {
+ if (style()->hasBorderRadius()) {
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
@@ -141,7 +140,7 @@ void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty)
paintReplaced(paintInfo, tx, ty);
- if (clipToBorderRadius)
+ if (style()->hasBorderRadius())
paintInfo.context->restore();
// The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSVGImage.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderSVGImage.cpp
index b38352e..f494709 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderSVGImage.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderSVGImage.cpp
@@ -2,7 +2,7 @@
Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
Copyright (C) 2006 Apple Computer, Inc.
Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
+ Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org>
Copyright (C) 2009, Google, Inc.
This library is free software; you can redistribute it and/or
@@ -59,7 +59,7 @@ void RenderSVGImage::adjustRectsForAspectRatio(FloatRect& destRect, FloatRect& s
float widthToHeightMultiplier = srcRect.height() / srcRect.width();
if (origDestHeight > (origDestWidth * widthToHeightMultiplier)) {
destRect.setHeight(origDestWidth * widthToHeightMultiplier);
- switch(aspectRatio->align()) {
+ switch (aspectRatio->align()) {
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID:
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID:
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID:
@@ -74,7 +74,7 @@ void RenderSVGImage::adjustRectsForAspectRatio(FloatRect& destRect, FloatRect& s
}
if (origDestWidth > (origDestHeight / widthToHeightMultiplier)) {
destRect.setWidth(origDestHeight / widthToHeightMultiplier);
- switch(aspectRatio->align()) {
+ switch (aspectRatio->align()) {
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN:
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID:
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX:
@@ -93,7 +93,7 @@ void RenderSVGImage::adjustRectsForAspectRatio(FloatRect& destRect, FloatRect& s
if (origDestHeight < (origDestWidth * widthToHeightMultiplier)) {
float destToSrcMultiplier = srcRect.width() / destRect.width();
srcRect.setHeight(destRect.height() * destToSrcMultiplier);
- switch(aspectRatio->align()) {
+ switch (aspectRatio->align()) {
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID:
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID:
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID:
@@ -110,7 +110,7 @@ void RenderSVGImage::adjustRectsForAspectRatio(FloatRect& destRect, FloatRect& s
if (origDestWidth < (origDestHeight / widthToHeightMultiplier)) {
float destToSrcMultiplier = srcRect.height() / destRect.height();
srcRect.setWidth(destRect.width() * destToSrcMultiplier);
- switch(aspectRatio->align()) {
+ switch (aspectRatio->align()) {
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN:
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID:
case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX:
@@ -227,9 +227,7 @@ FloatRect RenderSVGImage::repaintRectInLocalCoordinates() const
void RenderSVGImage::imageChanged(WrappedImagePtr image, const IntRect* rect)
{
RenderImage::imageChanged(image, rect);
-
- // We override to invalidate a larger rect, since SVG images can draw outside their "bounds"
- repaintRectangle(absoluteClippedOverflowRect()); // FIXME: Isn't this just repaint()?
+ repaint();
}
IntRect RenderSVGImage::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.cpp
index 3c44dd8..cf97b52 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.cpp
@@ -39,10 +39,10 @@ RenderSVGInline::RenderSVGInline(Node* n)
{
}
-InlineFlowBox* RenderSVGInline::createFlowBox()
+InlineFlowBox* RenderSVGInline::createInlineFlowBox()
{
InlineFlowBox* box = new (renderArena()) SVGInlineFlowBox(this);
- box->setIsSVG(true);
+ box->setHasVirtualHeight();
return box;
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.h b/src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.h
index 1ff8d02..9f9f3f5 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.h
@@ -40,7 +40,7 @@ public:
virtual void absoluteQuads(Vector<FloatQuad>&);
private:
- virtual InlineFlowBox* createFlowBox();
+ virtual InlineFlowBox* createInlineFlowBox();
};
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSVGInlineText.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderSVGInlineText.cpp
index b1a21d7..48d01ae 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderSVGInlineText.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderSVGInlineText.cpp
@@ -134,7 +134,7 @@ FloatQuad RenderSVGInlineText::computeRepaintQuadForRange(RenderBoxModelObject*
InlineTextBox* RenderSVGInlineText::createTextBox()
{
InlineTextBox* box = new (renderArena()) SVGInlineTextBox(this);
- box->setIsSVG(true);
+ box->setHasVirtualHeight();
return box;
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp
index 9e9809d..3919d7f 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp
@@ -89,10 +89,10 @@ void RenderSVGText::layout()
setNeedsLayout(false);
}
-RootInlineBox* RenderSVGText::createRootBox()
+RootInlineBox* RenderSVGText::createRootInlineBox()
{
RootInlineBox* box = new (renderArena()) SVGRootInlineBox(this);
- box->setIsSVG(true);
+ box->setHasVirtualHeight();
return box;
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h b/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h
index c1f1430..088332e 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h
@@ -65,7 +65,7 @@ private:
// FIXME: This can be removed when localTransform() is removed from RenderObject
virtual TransformationMatrix localTransform() const { return m_localTransform; }
- virtual RootInlineBox* createRootBox();
+ virtual RootInlineBox* createRootInlineBox();
TransformationMatrix m_localTransform;
};
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSlider.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderSlider.cpp
index 610a060..7df7743 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderSlider.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderSlider.cpp
@@ -121,47 +121,57 @@ public:
bool inDragMode() const { return m_inDragMode; }
virtual void defaultEventHandler(Event*);
+ virtual void detach();
private:
virtual bool isShadowNode() const { return true; }
virtual Node* shadowParentNode() { return m_shadowParent; }
+ FloatPoint m_offsetToThumb;
Node* m_shadowParent;
- FloatPoint m_initialClickPoint; // initial click point in RenderSlider-local coordinates
- int m_initialPosition;
bool m_inDragMode;
};
SliderThumbElement::SliderThumbElement(Document* document, Node* shadowParent)
: HTMLDivElement(divTag, document)
, m_shadowParent(shadowParent)
- , m_initialPosition(0)
, m_inDragMode(false)
{
}
void SliderThumbElement::defaultEventHandler(Event* event)
{
+ if (!event->isMouseEvent()) {
+ HTMLDivElement::defaultEventHandler(event);
+ return;
+ }
+
+ MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
+ bool isLeftButton = mouseEvent->button() == LeftButton;
const AtomicString& eventType = event->type();
- if (eventType == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
- MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
- RenderSlider* slider;
- if (document()->frame() && renderer() &&
- (slider = static_cast<RenderSlider*>(renderer()->parent())) &&
- slider->mouseEventIsInThumb(mouseEvent)) {
-
- // Cache the initial point where the mouse down occurred, in slider coordinates
- m_initialClickPoint = slider->absoluteToLocal(mouseEvent->absoluteLocation(), false, true);
- // Cache the initial position of the thumb.
- m_initialPosition = slider->currentPosition();
- m_inDragMode = true;
-
- document()->frame()->eventHandler()->setCapturingMouseEventsNode(m_shadowParent);
-
- event->setDefaultHandled();
- return;
+
+ if (eventType == eventNames().mousedownEvent && isLeftButton) {
+ if (document()->frame() && renderer()) {
+ RenderSlider* slider = static_cast<RenderSlider*>(renderer()->parent());
+ if (slider) {
+ if (slider->mouseEventIsInThumb(mouseEvent)) {
+ // We selected the thumb, we want the cursor to always stay at
+ // the same position relative to the thumb.
+ m_offsetToThumb = slider->mouseEventOffsetToThumb(mouseEvent);
+ } else {
+ // We are outside the thumb, move the thumb to the point were
+ // we clicked. We'll be exactly at the center of the thumb.
+ m_offsetToThumb.setX(0);
+ m_offsetToThumb.setY(0);
+ }
+
+ m_inDragMode = true;
+ document()->frame()->eventHandler()->setCapturingMouseEventsNode(m_shadowParent);
+ event->setDefaultHandled();
+ return;
+ }
}
- } else if (eventType == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
+ } else if (eventType == eventNames().mouseupEvent && isLeftButton) {
if (m_inDragMode) {
if (Frame* frame = document()->frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
@@ -169,24 +179,31 @@ void SliderThumbElement::defaultEventHandler(Event* event)
event->setDefaultHandled();
return;
}
- } else if (eventType == eventNames().mousemoveEvent && event->isMouseEvent()) {
+ } else if (eventType == eventNames().mousemoveEvent) {
if (m_inDragMode && renderer() && renderer()->parent()) {
- // Move the slider
- MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
RenderSlider* slider = static_cast<RenderSlider*>(renderer()->parent());
-
- FloatPoint curPoint = slider->absoluteToLocal(mouseEvent->absoluteLocation(), false, true);
- IntPoint eventOffset(m_initialPosition + curPoint.x() - m_initialClickPoint.x() + renderBox()->width() / 2,
- m_initialPosition + curPoint.y() - m_initialClickPoint.y() + renderBox()->height() / 2);
- slider->setValueForPosition(slider->positionForOffset(eventOffset));
- event->setDefaultHandled();
- return;
+ if (slider) {
+ FloatPoint curPoint = slider->absoluteToLocal(mouseEvent->absoluteLocation(), false, true);
+ IntPoint eventOffset(curPoint.x() + m_offsetToThumb.x(), curPoint.y() + m_offsetToThumb.y());
+ slider->setValueForPosition(slider->positionForOffset(eventOffset));
+ event->setDefaultHandled();
+ return;
+ }
}
}
HTMLDivElement::defaultEventHandler(event);
}
+void SliderThumbElement::detach()
+{
+ if (m_inDragMode) {
+ if (Frame* frame = document()->frame())
+ frame->eventHandler()->setCapturingMouseEventsNode(0);
+ }
+ HTMLDivElement::detach();
+}
+
RenderSlider::RenderSlider(HTMLInputElement* element)
: RenderBlock(element)
{
@@ -387,6 +404,17 @@ bool RenderSlider::mouseEventIsInThumb(MouseEvent* evt)
return thumbBounds.contains(roundedIntPoint(localPoint));
}
+FloatPoint RenderSlider::mouseEventOffsetToThumb(MouseEvent* evt)
+{
+ ASSERT(m_thumb && m_thumb->renderer());
+ FloatPoint localPoint = m_thumb->renderBox()->absoluteToLocal(evt->absoluteLocation(), false, true);
+ IntRect thumbBounds = m_thumb->renderBox()->borderBoxRect();
+ FloatPoint offset;
+ offset.setX(thumbBounds.x() + thumbBounds.width() / 2 - localPoint.x());
+ offset.setY(thumbBounds.y() + thumbBounds.height() / 2 - localPoint.y());
+ return offset;
+}
+
void RenderSlider::setValueForPosition(int position)
{
if (!m_thumb || !m_thumb->renderer())
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSlider.h b/src/3rdparty/webkit/WebCore/rendering/RenderSlider.h
index f1eab9c..779d82f 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderSlider.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderSlider.h
@@ -41,12 +41,13 @@ namespace WebCore {
virtual const char* renderName() const { return "RenderSlider"; }
virtual bool isSlider() const { return true; }
- virtual int baselinePosition( bool, bool ) const;
+ virtual int baselinePosition(bool, bool) const;
virtual void calcPrefWidths();
virtual void layout();
virtual void updateFromElement();
bool mouseEventIsInThumb(MouseEvent*);
+ FloatPoint mouseEventOffsetToThumb(MouseEvent*);
void setValueForPosition(int position);
void setPositionFromValue();
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTable.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderTable.cpp
index 48b0d1c..5d70784 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderTable.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderTable.cpp
@@ -882,8 +882,7 @@ int RenderTable::outerBorderBottom() const
bottomSection = m_foot;
else {
RenderObject* child;
- for (child = lastChild(); child && !child->isTableSection(); child = child->previousSibling())
- ;
+ for (child = lastChild(); child && !child->isTableSection(); child = child->previousSibling()) { }
bottomSection = child ? static_cast<RenderTableSection*>(child) : 0;
}
if (bottomSection) {
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTableCol.h b/src/3rdparty/webkit/WebCore/rendering/RenderTableCol.h
index 6b17ec4..12b6d9d 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderTableCol.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderTableCol.h
@@ -33,8 +33,7 @@
namespace WebCore {
-class RenderTableCol : public RenderBox
-{
+class RenderTableCol : public RenderBox {
public:
RenderTableCol(Node*);
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp
index 29c8c8a..9acd9b2 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp
@@ -325,26 +325,14 @@ String RenderTextControl::text()
if (!m_innerText)
return "";
- Frame* frame = document()->frame();
- Text* compositionNode = frame ? frame->editor()->compositionNode() : 0;
-
Vector<UChar> result;
for (Node* n = m_innerText.get(); n; n = n->traverseNextNode(m_innerText.get())) {
if (n->hasTagName(brTag))
result.append(&newlineCharacter, 1);
else if (n->isTextNode()) {
- Text* text = static_cast<Text*>(n);
- String data = text->data();
- unsigned length = data.length();
- if (text != compositionNode)
- result.append(data.characters(), length);
- else {
- unsigned compositionStart = min(frame->editor()->compositionStart(), length);
- unsigned compositionEnd = min(max(compositionStart, frame->editor()->compositionEnd()), length);
- result.append(data.characters(), compositionStart);
- result.append(data.characters() + compositionEnd, length - compositionEnd);
- }
+ String data = static_cast<Text*>(n)->data();
+ result.append(data.characters(), data.length());
}
}
@@ -386,9 +374,6 @@ String RenderTextControl::textWithHardLineBreaks()
if (!box)
return "";
- Frame* frame = document()->frame();
- Text* compositionNode = frame ? frame->editor()->compositionNode() : 0;
-
Node* breakNode;
unsigned breakOffset;
RootInlineBox* line = box->root();
@@ -403,19 +388,7 @@ String RenderTextControl::textWithHardLineBreaks()
Text* text = static_cast<Text*>(n);
String data = text->data();
unsigned length = data.length();
- unsigned compositionStart = (text == compositionNode)
- ? min(frame->editor()->compositionStart(), length) : 0;
- unsigned compositionEnd = (text == compositionNode)
- ? min(max(compositionStart, frame->editor()->compositionEnd()), length) : 0;
unsigned position = 0;
- while (breakNode == n && breakOffset < compositionStart) {
- result.append(data.characters() + position, breakOffset - position);
- position = breakOffset;
- result.append(&newlineCharacter, 1);
- getNextSoftBreak(line, breakNode, breakOffset);
- }
- result.append(data.characters() + position, compositionStart - position);
- position = compositionEnd;
while (breakNode == n && breakOffset <= length) {
if (breakOffset > position) {
result.append(data.characters() + position, breakOffset - position);
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTextControlSingleLine.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderTextControlSingleLine.cpp
index a5db44e..9c022d6 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -744,8 +744,8 @@ int RenderTextControlSingleLine::selectedIndex() const
bool RenderTextControlSingleLine::itemIsSeparator(unsigned listIndex) const
{
- // The separator will be the second to last item in our list.
- return static_cast<int>(listIndex) == (listSize() - 2);
+ // The separator will be the second to last item in our list.
+ return static_cast<int>(listIndex) == (listSize() - 2);
}
bool RenderTextControlSingleLine::itemIsLabel(unsigned listIndex) const
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTheme.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderTheme.cpp
index 517d911..23b6343 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderTheme.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderTheme.cpp
@@ -42,6 +42,12 @@ namespace WebCore {
using namespace HTMLNames;
+static Color& customFocusRingColor()
+{
+ DEFINE_STATIC_LOCAL(Color, color, ());
+ return color;
+}
+
RenderTheme::RenderTheme()
#if USE(NEW_THEME)
: m_theme(platformTheme())
@@ -262,6 +268,10 @@ bool RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& paintInf
return paintMediaSeekBackButton(o, paintInfo, r);
case MediaSeekForwardButtonPart:
return paintMediaSeekForwardButton(o, paintInfo, r);
+ case MediaRewindButtonPart:
+ return paintMediaRewindButton(o, paintInfo, r);
+ case MediaReturnToRealtimeButtonPart:
+ return paintMediaReturnToRealtimeButton(o, paintInfo, r);
case MediaSliderPart:
return paintMediaSliderTrack(o, paintInfo, r);
case MediaSliderThumbPart:
@@ -272,8 +282,8 @@ bool RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& paintInf
return paintMediaTimeRemaining(o, paintInfo, r);
case MediaCurrentTimePart:
return paintMediaCurrentTime(o, paintInfo, r);
- case MediaTimelineContainerPart:
- return paintMediaTimelineContainer(o, paintInfo, r);
+ case MediaControlsBackgroundPart:
+ return paintMediaControlsBackground(o, paintInfo, r);
case MenulistButtonPart:
case TextFieldPart:
case TextAreaPart:
@@ -849,9 +859,14 @@ Color RenderTheme::platformInactiveTextSearchHighlightColor() const
return Color(255, 255, 0); // Yellow.
}
-Color RenderTheme::focusRingColor() const
+void RenderTheme::setCustomFocusRingColor(const Color& c)
+{
+ customFocusRingColor() = c;
+}
+
+Color RenderTheme::focusRingColor()
{
- return Color(0, 0, 0); // Black.
+ return customFocusRingColor().isValid() ? customFocusRingColor() : defaultTheme()->platformFocusRingColor();
}
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTheme.h b/src/3rdparty/webkit/WebCore/rendering/RenderTheme.h
index a1519ce..795daa2 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderTheme.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderTheme.h
@@ -78,7 +78,7 @@ public:
// RenderThemeMac.cpp for Mac OS X.
// These methods return the theme's extra style sheets rules, to let each platform
- // adjust the default CSS rules in html4.css, quirks.css, or mediaControls.css
+ // adjust the default CSS rules in html.css, quirks.css, or mediaControls.css
virtual String extraDefaultStyleSheet() { return String(); }
virtual String extraQuirksStyleSheet() { return String(); }
#if ENABLE(VIDEO)
@@ -137,7 +137,9 @@ public:
virtual Color platformActiveTextSearchHighlightColor() const;
virtual Color platformInactiveTextSearchHighlightColor() const;
- virtual Color focusRingColor() const;
+ static Color focusRingColor();
+ virtual Color platformFocusRingColor() const { return Color(0, 0, 0); }
+ static void setCustomFocusRingColor(const Color&);
virtual void platformColorsDidChange();
@@ -242,7 +244,9 @@ protected:
virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
- virtual bool paintMediaTimelineContainer(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaRewindButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaReturnToRealtimeButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaTimeRemaining(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h
index 5497d52..f8204cf 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h
@@ -64,7 +64,7 @@ namespace WebCore {
virtual Color platformInactiveSelectionBackgroundColor() const;
virtual Color activeListBoxSelectionBackgroundColor() const;
- virtual Color focusRingColor() const;
+ virtual Color platformFocusRingColor() const;
virtual void platformColorsDidChange();
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm
index bd90831..efd28d9 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm
@@ -46,6 +46,7 @@
#import "Image.h"
#import "LocalCurrentGraphicsContext.h"
#import "MediaControlElements.h"
+#import "RenderMedia.h"
#import "RenderSlider.h"
#import "RenderView.h"
#import "SharedBuffer.h"
@@ -172,7 +173,7 @@ Color RenderThemeChromiumMac::activeListBoxSelectionBackgroundColor() const
return Color(static_cast<int>(255.0 * [color redComponent]), static_cast<int>(255.0 * [color greenComponent]), static_cast<int>(255.0 * [color blueComponent]));
}
-Color RenderThemeChromiumMac::focusRingColor() const
+Color RenderThemeChromiumMac::platformFocusRingColor() const
{
if (ChromiumBridge::layoutTestMode())
return oldAquaFocusRingColor();
@@ -1800,6 +1801,12 @@ typedef enum {
MediaControllerThemeClassic = 1,
MediaControllerThemeQT = 2
} MediaControllerThemeStyle;
+
+enum WKMediaControllerThemeState {
+ MediaUIPartDisabledFlag = 1 << 0,
+ MediaUIPartPressedFlag = 1 << 1,
+ MediaUIPartDrawEndCapsFlag = 1 << 3,
+};
#endif
bool RenderThemeChromiumMac::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
@@ -1810,7 +1817,8 @@ bool RenderThemeChromiumMac::paintMediaFullscreenButton(RenderObject* o, const R
return false;
LocalCurrentGraphicsContext localContext(paintInfo.context);
- wkDrawMediaUIPart(MediaFullscreenButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, node->active());
+ wkDrawMediaUIPart(MediaFullscreenButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+ node->active() ? MediaUIPartPressedFlag : 0);
#endif
return false;
}
@@ -1828,7 +1836,8 @@ bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* o, const RenderO
return false;
LocalCurrentGraphicsContext localContext(paintInfo.context);
- wkDrawMediaUIPart(mediaElement->muted() ? MediaUnMuteButton : MediaMuteButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, node->active());
+ wkDrawMediaUIPart(mediaElement->muted() ? MediaUnMuteButton : MediaMuteButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+ node->active() ? MediaUIPartPressedFlag : 0);
#endif
return false;
}
@@ -1846,7 +1855,8 @@ bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* o, const RenderO
return false;
LocalCurrentGraphicsContext localContext(paintInfo.context);
- wkDrawMediaUIPart(mediaElement->canPlay() ? MediaPlayButton : MediaPauseButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, node->active());
+ wkDrawMediaUIPart(mediaElement->canPlay() ? MediaPlayButton : MediaPauseButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+ node->active() ? MediaUIPartPressedFlag : 0);
#endif
return false;
}
@@ -1859,7 +1869,8 @@ bool RenderThemeChromiumMac::paintMediaSeekBackButton(RenderObject* o, const Ren
return false;
LocalCurrentGraphicsContext localContext(paintInfo.context);
- wkDrawMediaUIPart(MediaSeekBackButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, node->active());
+ wkDrawMediaUIPart(MediaSeekBackButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+ node->active() ? MediaUIPartPressedFlag : 0);
#endif
return false;
}
@@ -1872,7 +1883,8 @@ bool RenderThemeChromiumMac::paintMediaSeekForwardButton(RenderObject* o, const
return false;
LocalCurrentGraphicsContext localContext(paintInfo.context);
- wkDrawMediaUIPart(MediaSeekForwardButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, node->active());
+ wkDrawMediaUIPart(MediaSeekForwardButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+ node->active() ? MediaUIPartPressedFlag : 0);
#endif
return false;
}
@@ -1898,7 +1910,8 @@ bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* o, const Render
currentTime = player->currentTime();
}
- wkDrawMediaSliderTrack(MediaControllerThemeClassic, paintInfo.context->platformContext(), r, timeLoaded, currentTime, duration);
+ bool shouldDrawEndCaps = !static_cast<RenderMedia*>(mediaElement->renderer())->shouldShowTimeDisplayControls();
+ wkDrawMediaSliderTrack(MediaControllerThemeClassic, paintInfo.context->platformContext(), r, timeLoaded, currentTime, duration, shouldDrawEndCaps ? MediaUIPartDrawEndCapsFlag : 0);
#endif
return false;
}
@@ -1911,7 +1924,8 @@ bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* o, const Render
return false;
LocalCurrentGraphicsContext localContext(paintInfo.context);
- wkDrawMediaUIPart(MediaSliderThumb, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, node->active());
+ wkDrawMediaUIPart(MediaSliderThumb, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+ node->active() ? MediaUIPartPressedFlag : 0);
#endif
return false;
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp
index 1fb0cb2..95ffd02 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp
@@ -133,7 +133,7 @@ String RenderThemeChromiumSkia::extraMediaControlsStyleSheet()
bool RenderThemeChromiumSkia::supportsHover(const RenderStyle* style) const
{
- return true;
+ return true;
}
bool RenderThemeChromiumSkia::supportsFocusRing(const RenderStyle* style) const
@@ -162,7 +162,7 @@ Color RenderThemeChromiumSkia::platformInactiveSelectionForegroundColor() const
return Color(0x32, 0x32, 0x32);
}
-Color RenderThemeChromiumSkia::focusRingColor() const
+Color RenderThemeChromiumSkia::platformFocusRingColor() const
{
static Color focusRingColor(229, 151, 0, 255);
return focusRingColor;
@@ -212,8 +212,16 @@ bool RenderThemeChromiumSkia::paintCheckbox(RenderObject* o, const RenderObject:
{
static Image* const checkedImage = Image::loadPlatformResource("linuxCheckboxOn").releaseRef();
static Image* const uncheckedImage = Image::loadPlatformResource("linuxCheckboxOff").releaseRef();
+ static Image* const disabledCheckedImage = Image::loadPlatformResource("linuxCheckboxDisabledOn").releaseRef();
+ static Image* const disabledUncheckedImage = Image::loadPlatformResource("linuxCheckboxDisabledOff").releaseRef();
+
+ Image* image;
+
+ if (this->isEnabled(o))
+ image = this->isChecked(o) ? checkedImage : uncheckedImage;
+ else
+ image = this->isChecked(o) ? disabledCheckedImage : disabledUncheckedImage;
- Image* image = this->isChecked(o) ? checkedImage : uncheckedImage;
i.context->drawImage(image, rect);
return false;
}
@@ -237,8 +245,15 @@ bool RenderThemeChromiumSkia::paintRadio(RenderObject* o, const RenderObject::Pa
{
static Image* const checkedImage = Image::loadPlatformResource("linuxRadioOn").releaseRef();
static Image* const uncheckedImage = Image::loadPlatformResource("linuxRadioOff").releaseRef();
+ static Image* const disabledCheckedImage = Image::loadPlatformResource("linuxRadioDisabledOn").releaseRef();
+ static Image* const disabledUncheckedImage = Image::loadPlatformResource("linuxRadioDisabledOff").releaseRef();
+
+ Image* image;
+ if (this->isEnabled(o))
+ image = this->isChecked(o) ? checkedImage : uncheckedImage;
+ else
+ image = this->isChecked(o) ? disabledCheckedImage : disabledUncheckedImage;
- Image* image = this->isChecked(o) ? checkedImage : uncheckedImage;
i.context->drawImage(image, rect);
return false;
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.h b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.h
index b81d4fa..8be64e5 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.h
@@ -54,7 +54,7 @@ namespace WebCore {
virtual Color platformInactiveSelectionBackgroundColor() const;
virtual Color platformActiveSelectionForegroundColor() const;
virtual Color platformInactiveSelectionForegroundColor() const;
- virtual Color focusRingColor() const;
+ virtual Color platformFocusRingColor() const;
// To change the blink interval, override caretBlinkIntervalInternal instead of this one so that we may share layout test code an intercepts.
virtual double caretBlinkInterval() const;
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp
index 4ed8d88..8459144 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp
@@ -204,11 +204,11 @@ PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
bool RenderThemeChromiumWin::supportsFocusRing(const RenderStyle* style) const
{
- // Let webkit draw one of its halo rings around any focused element,
- // except push buttons. For buttons we use the windows PBS_DEFAULTED
- // styling to give it a blue border.
- return style->appearance() == ButtonPart
- || style->appearance() == PushButtonPart;
+ // Let webkit draw one of its halo rings around any focused element,
+ // except push buttons. For buttons we use the windows PBS_DEFAULTED
+ // styling to give it a blue border.
+ return style->appearance() == ButtonPart
+ || style->appearance() == PushButtonPart;
}
Color RenderThemeChromiumWin::platformActiveSelectionBackgroundColor() const
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeMac.h b/src/3rdparty/webkit/WebCore/rendering/RenderThemeMac.h
index ba32105..85f141f 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeMac.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeMac.h
@@ -58,7 +58,7 @@ public:
virtual Color platformActiveListBoxSelectionForegroundColor() const;
virtual Color platformInactiveListBoxSelectionBackgroundColor() const;
virtual Color platformInactiveListBoxSelectionForegroundColor() const;
- virtual Color focusRingColor() const;
+ virtual Color platformFocusRingColor() const;
virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return SmallScrollbar; }
@@ -124,12 +124,13 @@ protected:
virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
- virtual bool paintMediaTimelineContainer(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaRewindButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaReturnToRealtimeButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaTimeRemaining(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
// Media controls
- virtual bool hitTestMediaControlPart(RenderObject*, const IntPoint& absPoint);
virtual String extraMediaControlsStyleSheet();
#endif
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.cpp
index 914f7ee..05facef 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.cpp
@@ -79,8 +79,10 @@ PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
// FIXME: This is called before Settings has been initialized by WebKit, so will return a
// potentially wrong answer the very first time it's called (see
// <https://bugs.webkit.org/show_bug.cgi?id=26493>).
- if (Settings::shouldPaintNativeControls())
+ if (Settings::shouldPaintNativeControls()) {
+ RenderTheme::setCustomFocusRingColor(safariTheme->platformFocusRingColor());
return windowsTheme; // keep the reference of one.
+ }
return safariTheme; // keep the reference of one.
}
@@ -160,7 +162,7 @@ Color RenderThemeSafari::activeListBoxSelectionBackgroundColor() const
return Color(56, 117, 215);
}
-Color RenderThemeSafari::focusRingColor() const
+Color RenderThemeSafari::platformFocusRingColor() const
{
static Color focusRingColor;
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.h b/src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.h
index 4685238..fb8ffb0 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.h
@@ -69,7 +69,7 @@ public:
virtual Color platformInactiveSelectionBackgroundColor() const;
virtual Color activeListBoxSelectionBackgroundColor() const;
- virtual Color focusRingColor() const;
+ virtual Color platformFocusRingColor() const;
// System fonts.
virtual void systemFont(int propId, FontDescription&) const;
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderView.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderView.cpp
index 05d40bc..3b8a4fb 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderView.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderView.cpp
@@ -343,8 +343,8 @@ void RenderView::setMaximalOutlineSize(int o)
if (o != m_maximalOutlineSize) {
m_maximalOutlineSize = o;
- if (m_frameView)
- m_frameView->updateCompositingLayers(FrameView::ForcedCompositingUpdate);
+ // maximalOutlineSize affects compositing layer dimensions.
+ compositor()->setCompositingLayersNeedRebuild(); // FIXME: this really just needs to be a geometry update.
}
}
#endif
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp
index ec2ee6a..16526ca 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp
@@ -73,8 +73,8 @@ void RenderWidget::destroy()
if (m_widget) {
if (m_frameView)
- m_frameView->removeChild(m_widget);
- widgetRendererMap().remove(m_widget);
+ m_frameView->removeChild(m_widget.get());
+ widgetRendererMap().remove(m_widget.get());
}
// removes from override size map
@@ -113,17 +113,17 @@ void RenderWidget::setWidgetGeometry(const IntRect& frame)
}
}
-void RenderWidget::setWidget(Widget* widget)
+void RenderWidget::setWidget(PassRefPtr<Widget> widget)
{
if (widget != m_widget) {
if (m_widget) {
m_widget->removeFromParent();
- widgetRendererMap().remove(m_widget);
+ widgetRendererMap().remove(m_widget.get());
clearWidget();
}
m_widget = widget;
if (m_widget) {
- widgetRendererMap().add(m_widget, this);
+ widgetRendererMap().add(m_widget.get(), this);
// if we've already received a layout, apply the calculated space to the
// widget immediately, but we have to have really been full constructed (with a non-null
// style pointer).
@@ -135,7 +135,7 @@ void RenderWidget::setWidget(Widget* widget)
else
m_widget->show();
}
- m_frameView->addChild(m_widget);
+ m_frameView->addChild(m_widget.get());
}
}
}
@@ -182,8 +182,7 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
paintCustomHighlight(tx - x(), ty - y(), style()->highlight(), true);
#endif
- bool clipToBorderRadius = style()->overflowX() != OVISIBLE && style()->hasBorderRadius();
- if (clipToBorderRadius) {
+ if (style()->hasBorderRadius()) {
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
@@ -204,13 +203,13 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
// to paint itself. That way it will composite properly with z-indexed layers.
m_widget->paint(paintInfo.context, paintInfo.rect);
- if (m_widget->isFrameView() && paintInfo.overlapTestRequests && !static_cast<FrameView*>(m_widget)->useSlowRepaints()) {
+ if (m_widget->isFrameView() && paintInfo.overlapTestRequests && !static_cast<FrameView*>(m_widget.get())->useSlowRepaints()) {
ASSERT(!paintInfo.overlapTestRequests->contains(this));
paintInfo.overlapTestRequests->set(this, m_widget->frameRect());
}
}
- if (clipToBorderRadius)
+ if (style()->hasBorderRadius())
paintInfo.context->restore();
// Paint a partially transparent wash over selected widgets.
@@ -224,7 +223,7 @@ void RenderWidget::setOverlapTestResult(bool isOverlapped)
{
ASSERT(m_widget);
ASSERT(m_widget->isFrameView());
- static_cast<FrameView*>(m_widget)->setIsOverlapped(isOverlapped);
+ static_cast<FrameView*>(m_widget.get())->setIsOverlapped(isOverlapped);
}
void RenderWidget::deref(RenderArena *arena)
@@ -259,7 +258,7 @@ void RenderWidget::updateWidgetPosition()
// if the frame bounds got changed, or if view needs layout (possibly indicating
// content size is wrong) we have to do a layout to set the right widget size
if (m_widget->isFrameView()) {
- FrameView* frameView = static_cast<FrameView*>(m_widget);
+ FrameView* frameView = static_cast<FrameView*>(m_widget.get());
if (boundsChanged || frameView->needsLayout())
frameView->layout();
}
@@ -276,15 +275,7 @@ void RenderWidget::setSelectionState(SelectionState state)
void RenderWidget::clearWidget()
{
- Widget* widget = m_widget;
m_widget = 0;
- if (widget)
- deleteWidget(widget);
-}
-
-void RenderWidget::deleteWidget(Widget* widget)
-{
- delete widget;
}
RenderWidget* RenderWidget::find(const Widget* widget)
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderWidget.h b/src/3rdparty/webkit/WebCore/rendering/RenderWidget.h
index d23dbb3..97d0b72 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderWidget.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderWidget.h
@@ -33,8 +33,8 @@ class RenderWidget : public RenderReplaced, private OverlapTestRequestClient {
public:
virtual ~RenderWidget();
- Widget* widget() const { return m_widget; }
- virtual void setWidget(Widget*);
+ Widget* widget() const { return m_widget.get(); }
+ virtual void setWidget(PassRefPtr<Widget>);
static RenderWidget* find(const Widget*);
@@ -57,7 +57,6 @@ private:
virtual void destroy();
virtual void setSelectionState(SelectionState);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
- virtual void deleteWidget(Widget*);
virtual void setOverlapTestResult(bool);
void setWidgetGeometry(const IntRect&);
@@ -65,7 +64,7 @@ private:
RenderArena* ref() { ++m_refCount; return renderArena(); }
void deref(RenderArena*);
- Widget* m_widget;
+ RefPtr<Widget> m_widget;
FrameView* m_frameView;
int m_refCount;
};
diff --git a/src/3rdparty/webkit/WebCore/rendering/RootInlineBox.cpp b/src/3rdparty/webkit/WebCore/rendering/RootInlineBox.cpp
index ed125ee..e8f04da 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RootInlineBox.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RootInlineBox.cpp
@@ -355,8 +355,8 @@ static bool isEditableLeaf(InlineBox* leaf)
InlineBox* RootInlineBox::closestLeafChildForXPos(int x, bool onlyEditableLeaves)
{
- InlineBox* firstLeaf = firstLeafChildAfterBox();
- InlineBox* lastLeaf = lastLeafChildBeforeBox();
+ InlineBox* firstLeaf = firstLeafChild();
+ InlineBox* lastLeaf = lastLeafChild();
if (firstLeaf == lastLeaf && (!onlyEditableLeaves || isEditableLeaf(firstLeaf)))
return firstLeaf;
diff --git a/src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.cpp b/src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.cpp
index 8871a75..b53e3d9 100644
--- a/src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.cpp
@@ -390,11 +390,11 @@ void SVGCharacterLayoutInfo::addStackContent(StackType type, const PositionedFlo
dyStackChanged = true;
dyStack.append(list);
break;
- case AngleStack:
+ case AngleStack:
angleStackChanged = true;
angleStack.append(list);
break;
- default:
+ default:
ASSERT_NOT_REACHED();
}
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.h b/src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.h
index 0188b9d..b5b4f3e 100644
--- a/src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.h
+++ b/src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.h
@@ -44,8 +44,7 @@ class SVGNumberList;
class SVGTextPositioningElement;
template<class Type>
-class PositionedVector : public Vector<Type>
-{
+class PositionedVector : public Vector<Type> {
public:
PositionedVector<Type>()
: m_position(0)
diff --git a/src/3rdparty/webkit/WebCore/rendering/SVGInlineFlowBox.h b/src/3rdparty/webkit/WebCore/rendering/SVGInlineFlowBox.h
index 1aa2637..f6eb87a 100644
--- a/src/3rdparty/webkit/WebCore/rendering/SVGInlineFlowBox.h
+++ b/src/3rdparty/webkit/WebCore/rendering/SVGInlineFlowBox.h
@@ -37,7 +37,7 @@ public:
{
}
- virtual int svgBoxHeight() const { return m_height; }
+ virtual int virtualHeight() const { return m_height; }
void setHeight(int h) { m_height = h; }
virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
diff --git a/src/3rdparty/webkit/WebCore/rendering/SVGInlineTextBox.h b/src/3rdparty/webkit/WebCore/rendering/SVGInlineTextBox.h
index 410218d..76837cc 100644
--- a/src/3rdparty/webkit/WebCore/rendering/SVGInlineTextBox.h
+++ b/src/3rdparty/webkit/WebCore/rendering/SVGInlineTextBox.h
@@ -38,7 +38,7 @@ namespace WebCore {
public:
SVGInlineTextBox(RenderObject* obj);
- virtual int svgBoxHeight() const { return m_height; }
+ virtual int virtualHeight() const { return m_height; }
void setHeight(int h) { m_height = h; }
virtual int selectionTop();
diff --git a/src/3rdparty/webkit/WebCore/rendering/SVGRootInlineBox.h b/src/3rdparty/webkit/WebCore/rendering/SVGRootInlineBox.h
index 735f755..65bade0 100644
--- a/src/3rdparty/webkit/WebCore/rendering/SVGRootInlineBox.h
+++ b/src/3rdparty/webkit/WebCore/rendering/SVGRootInlineBox.h
@@ -53,7 +53,7 @@ public:
virtual bool isSVGRootInlineBox() { return true; }
- virtual int svgBoxHeight() const { return m_height; }
+ virtual int virtualHeight() const { return m_height; }
void setHeight(int h) { m_height = h; }
virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
diff --git a/src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.cpp b/src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.cpp
index cd067de..e205882 100644
--- a/src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.cpp
@@ -172,6 +172,16 @@ SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document* doc)
{
}
+void SearchFieldCancelButtonElement::detach()
+{
+ if (m_capturing) {
+ if (Frame* frame = document()->frame())
+ frame->eventHandler()->setCapturingMouseEventsNode(0);
+ }
+ TextControlInnerElement::detach();
+}
+
+
void SearchFieldCancelButtonElement::defaultEventHandler(Event* evt)
{
// If the element is visible, on mouseup, clear the value, and set selection
diff --git a/src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.h b/src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.h
index 9e81ada..f72ddf2 100644
--- a/src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.h
+++ b/src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.h
@@ -32,8 +32,7 @@ namespace WebCore {
class String;
-class TextControlInnerElement : public HTMLDivElement
-{
+class TextControlInnerElement : public HTMLDivElement {
public:
TextControlInnerElement(Document*, Node* shadowParent = 0);
@@ -64,6 +63,7 @@ class SearchFieldCancelButtonElement : public TextControlInnerElement {
public:
SearchFieldCancelButtonElement(Document*);
virtual void defaultEventHandler(Event*);
+ virtual void detach();
private:
bool m_capturing;
};
diff --git a/src/3rdparty/webkit/WebCore/rendering/bidi.h b/src/3rdparty/webkit/WebCore/rendering/bidi.h
deleted file mode 100644
index 9058eeb..0000000
--- a/src/3rdparty/webkit/WebCore/rendering/bidi.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This file is part of the html renderer for KDE.
- *
- * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2003 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef bidi_h
-#define bidi_h
-
-#include "BidiResolver.h"
-
-namespace WebCore {
-
-class RenderArena;
-class RenderBlock;
-class RenderObject;
-class InlineBox;
-
-struct BidiRun : BidiCharacterRun {
- BidiRun(int start, int stop, RenderObject* object, BidiContext* context, WTF::Unicode::Direction dir)
- : BidiCharacterRun(start, stop, context, dir)
- , m_object(object)
- , m_box(0)
- {
- }
-
- void destroy();
-
- // Overloaded new operator.
- void* operator new(size_t, RenderArena*) throw();
-
- // Overridden to prevent the normal delete from being called.
- void operator delete(void*, size_t);
-
- BidiRun* next() { return static_cast<BidiRun*>(m_next); }
-
-private:
- // The normal operator new is disallowed.
- void* operator new(size_t) throw();
-
-public:
- RenderObject* m_object;
- InlineBox* m_box;
-};
-
-} // namespace WebCore
-
-#endif // bidi_h
diff --git a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.cpp b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.cpp
index e4027db..36255b8 100644
--- a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.cpp
@@ -225,6 +225,13 @@ RenderStyle* RenderStyle::addCachedPseudoStyle(PassRefPtr<RenderStyle> pseudo)
return m_cachedPseudoStyle.get();
}
+void RenderStyle::getPseudoStyleCache(PseudoStyleCache& cache) const
+{
+ ASSERT(cache.isEmpty());
+ for (RenderStyle* pseudoStyle = m_cachedPseudoStyle.get(); pseudoStyle; pseudoStyle = pseudoStyle->m_cachedPseudoStyle.get())
+ cache.append(pseudoStyle);
+}
+
bool RenderStyle::inheritedNotEqual(const RenderStyle* other) const
{
return inherited_flags != other->inherited_flags ||
diff --git a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h
index 46c91cd..6922c88 100644
--- a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h
+++ b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h
@@ -307,6 +307,9 @@ public:
RenderStyle* getCachedPseudoStyle(PseudoId) const;
RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
+ typedef Vector<RenderStyle*, 10> PseudoStyleCache;
+ void getPseudoStyleCache(PseudoStyleCache&) const;
+
bool affectedByHoverRules() const { return noninherited_flags._affectedByHover; }
bool affectedByActiveRules() const { return noninherited_flags._affectedByActive; }
bool affectedByDragRules() const { return noninherited_flags._affectedByDrag; }
@@ -788,7 +791,7 @@ public:
void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
- void setVerticalAlignLength(Length l) { SET_VAR(box, vertical_align, l ) }
+ void setVerticalAlignLength(Length l) { SET_VAR(box, vertical_align, l) }
void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b) }
void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v) }
@@ -797,7 +800,7 @@ public:
void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v) }
void setClip(Length top, Length right, Length bottom, Length left);
- void setUnicodeBidi( EUnicodeBidi b ) { noninherited_flags._unicodeBidi = b; }
+ void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; }
void setClear(EClear v) { noninherited_flags._clear = v; }
void setTableLayout(ETableLayout v) { noninherited_flags._table_layout = v; }
@@ -884,7 +887,7 @@ public:
void setPaddingLeft(Length v) { SET_VAR(surround, padding.m_left, v) }
void setPaddingRight(Length v) { SET_VAR(surround, padding.m_right, v) }
- void setCursor( ECursor c ) { inherited_flags._cursor_style = c; }
+ void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
void addCursor(CachedImage*, const IntPoint& = IntPoint());
void setCursorList(PassRefPtr<CursorList>);
void clearCursorList();
diff --git a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h
index 405cf7c..b08dd87 100644
--- a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h
+++ b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h
@@ -69,7 +69,8 @@ enum PseudoId {
SLIDER_THUMB, SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, MEDIA_CONTROLS_PANEL,
MEDIA_CONTROLS_PLAY_BUTTON, MEDIA_CONTROLS_MUTE_BUTTON, MEDIA_CONTROLS_TIMELINE, MEDIA_CONTROLS_TIMELINE_CONTAINER,
MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, MEDIA_CONTROLS_SEEK_BACK_BUTTON,
- MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON,
+ MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON, MEDIA_CONTROLS_REWIND_BUTTON,
+ MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, MEDIA_CONTROLS_STATUS_DISPLAY,
SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON
@@ -109,7 +110,7 @@ enum EVerticalAlign {
TEXT_BOTTOM, TOP, BOTTOM, BASELINE_MIDDLE, LENGTH
};
-enum EClear{
+enum EClear {
CNONE = 0, CLEFT = 1, CRIGHT = 2, CBOTH = 3
};
diff --git a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h
index cb504d2..b7bf026 100644
--- a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h
+++ b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h
@@ -60,13 +60,13 @@
#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(Data, Group, Variable, Type, Name, Initial) \
Data* Name() const { return Group->Variable.get(); } \
void set##Type(PassRefPtr<Data> obj) { \
- if(!(Group->Variable == obj)) \
+ if (!(Group->Variable == obj)) \
Group.access()->Variable = obj; \
} \
static Data* initial##Type() { return Initial; }
#define SVG_RS_SET_VARIABLE(Group, Variable, Value) \
- if(!(Group->Variable == Value)) \
+ if (!(Group->Variable == Value)) \
Group.access()->Variable = Value;
namespace WebCore {
diff --git a/src/3rdparty/webkit/WebCore/rendering/style/StyleInheritedData.h b/src/3rdparty/webkit/WebCore/rendering/style/StyleInheritedData.h
index 5f1077e..548ca72 100644
--- a/src/3rdparty/webkit/WebCore/rendering/style/StyleInheritedData.h
+++ b/src/3rdparty/webkit/WebCore/rendering/style/StyleInheritedData.h
@@ -44,7 +44,7 @@ public:
~StyleInheritedData();
bool operator==(const StyleInheritedData& o) const;
- bool operator!=( const StyleInheritedData& o) const
+ bool operator!=(const StyleInheritedData& o) const
{
return !(*this == o);
}
diff --git a/src/3rdparty/webkit/WebCore/storage/Database.cpp b/src/3rdparty/webkit/WebCore/storage/Database.cpp
index 53bccbe..2292a0a 100644
--- a/src/3rdparty/webkit/WebCore/storage/Database.cpp
+++ b/src/3rdparty/webkit/WebCore/storage/Database.cpp
@@ -40,7 +40,6 @@
#include "DatabaseTracker.h"
#include "Document.h"
#include "ExceptionCode.h"
-#include "FileSystem.h"
#include "Frame.h"
#include "InspectorController.h"
#include "Logging.h"
@@ -48,6 +47,7 @@
#include "Page.h"
#include "OriginQuotaManager.h"
#include "SQLiteDatabase.h"
+#include "SQLiteFileSystem.h"
#include "SQLiteStatement.h"
#include "SQLResultSet.h"
#include <wtf/MainThread.h>
@@ -60,6 +60,9 @@
namespace WebCore {
+// If we sleep for more the 30 seconds while blocked on SQLITE_BUSY, give up.
+static const int maxSqliteBusyWaitTime = 30000;
+
const String& Database::databaseInfoTableName()
{
DEFINE_STATIC_LOCAL(String, name, ("__WebKitDatabaseInfoTable__"));
@@ -132,6 +135,7 @@ Database::Database(Document* document, const String& name, const String& expecte
, m_expectedVersion(expectedVersion)
, m_deleted(false)
, m_stopped(false)
+ , m_opened(false)
{
ASSERT(document);
m_securityOrigin = document->securityOrigin();
@@ -316,7 +320,13 @@ void Database::markAsDeletedAndClose()
void Database::close()
{
- m_sqliteDatabase.close();
+ if (m_opened) {
+ ASSERT(m_document->databaseThread());
+ ASSERT(currentThread() == document()->databaseThread()->getThreadID());
+ m_sqliteDatabase.close();
+ m_document->databaseThread()->recordDatabaseClosed(this);
+ m_opened = false;
+ }
}
void Database::stop()
@@ -338,10 +348,7 @@ void Database::stop()
unsigned long long Database::databaseSize() const
{
- long long size;
- if (!getFileSize(m_filename, size))
- size = 0;
- return size;
+ return SQLiteFileSystem::getDatabaseFileSize(m_filename);
}
unsigned long long Database::maximumSize() const
@@ -426,8 +433,13 @@ bool Database::performOpenAndVerify(ExceptionCode& e)
return false;
}
+ m_opened = true;
+ if (m_document->databaseThread())
+ m_document->databaseThread()->recordDatabaseOpen(this);
+
ASSERT(m_databaseAuthorizer);
m_sqliteDatabase.setAuthorizer(m_databaseAuthorizer);
+ m_sqliteDatabase.setBusyTimeout(maxSqliteBusyWaitTime);
if (!m_sqliteDatabase.tableExists(databaseInfoTableName())) {
if (!m_sqliteDatabase.executeCommand("CREATE TABLE " + databaseInfoTableName() + " (key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE,value TEXT NOT NULL ON CONFLICT FAIL);")) {
diff --git a/src/3rdparty/webkit/WebCore/storage/Database.h b/src/3rdparty/webkit/WebCore/storage/Database.h
index 385485a..0bdb37b 100644
--- a/src/3rdparty/webkit/WebCore/storage/Database.h
+++ b/src/3rdparty/webkit/WebCore/storage/Database.h
@@ -100,6 +100,7 @@ public:
bool deleted() const { return m_deleted; }
void close();
+ bool opened() const { return m_opened; }
void stop();
bool stopped() const { return m_stopped; }
@@ -141,6 +142,8 @@ private:
bool m_stopped;
+ bool m_opened;
+
SQLiteDatabase m_sqliteDatabase;
RefPtr<DatabaseAuthorizer> m_databaseAuthorizer;
diff --git a/src/3rdparty/webkit/WebCore/storage/DatabaseTask.h b/src/3rdparty/webkit/WebCore/storage/DatabaseTask.h
index a3814d7..4aef892 100644
--- a/src/3rdparty/webkit/WebCore/storage/DatabaseTask.h
+++ b/src/3rdparty/webkit/WebCore/storage/DatabaseTask.h
@@ -45,8 +45,7 @@ class SQLCallback;
class SQLTransaction;
class VersionChangeCallback;
-class DatabaseTask : public ThreadSafeShared<DatabaseTask>
-{
+class DatabaseTask : public ThreadSafeShared<DatabaseTask> {
friend class Database;
public:
virtual ~DatabaseTask();
@@ -76,8 +75,7 @@ private:
OwnPtr<ThreadCondition> m_synchronousCondition;
};
-class DatabaseOpenTask : public DatabaseTask
-{
+class DatabaseOpenTask : public DatabaseTask {
public:
static PassRefPtr<DatabaseOpenTask> create(Database* db) { return adoptRef(new DatabaseOpenTask(db)); }
@@ -96,8 +94,7 @@ private:
bool m_success;
};
-class DatabaseCloseTask : public DatabaseTask
-{
+class DatabaseCloseTask : public DatabaseTask {
public:
static PassRefPtr<DatabaseCloseTask> create(Database* db) { return adoptRef(new DatabaseCloseTask(db)); }
@@ -110,8 +107,7 @@ private:
#endif
};
-class DatabaseTransactionTask : public DatabaseTask
-{
+class DatabaseTransactionTask : public DatabaseTask {
public:
static PassRefPtr<DatabaseTransactionTask> create(PassRefPtr<SQLTransaction> transaction) { return adoptRef(new DatabaseTransactionTask(transaction)); }
@@ -129,8 +125,7 @@ private:
RefPtr<SQLTransaction> m_transaction;
};
-class DatabaseTableNamesTask : public DatabaseTask
-{
+class DatabaseTableNamesTask : public DatabaseTask {
public:
static PassRefPtr<DatabaseTableNamesTask> create(Database* db) { return adoptRef(new DatabaseTableNamesTask(db)); }
diff --git a/src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp b/src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp
index fab02a2..b6c9b5d 100644
--- a/src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp
+++ b/src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp
@@ -99,6 +99,17 @@ void* DatabaseThread::databaseThread()
LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThread %p, which currently has %i ref(s)", m_threadID, this, refCount());
+ // Close the databases that we ran transactions on. This ensures that if any transactions are still open, they are rolled back and we don't leave the database in an
+ // inconsistent or locked state.
+ if (m_openDatabaseSet.size() > 0) {
+ // As the call to close will modify the original set, we must take a copy to iterate over.
+ DatabaseSet openSetCopy;
+ openSetCopy.swap(m_openDatabaseSet);
+ DatabaseSet::iterator end = openSetCopy.end();
+ for (DatabaseSet::iterator it = openSetCopy.begin(); it != end; ++it)
+ (*it)->close();
+ }
+
// Detach the thread so its resources are no longer of any concern to anyone else
detachThread(m_threadID);
@@ -108,6 +119,22 @@ void* DatabaseThread::databaseThread()
return 0;
}
+void DatabaseThread::recordDatabaseOpen(Database* database)
+{
+ ASSERT(currentThread() == m_threadID);
+ ASSERT(database);
+ ASSERT(!m_openDatabaseSet.contains(database));
+ m_openDatabaseSet.add(database);
+}
+
+void DatabaseThread::recordDatabaseClosed(Database* database)
+{
+ ASSERT(currentThread() == m_threadID);
+ ASSERT(database);
+ ASSERT(m_queue.killed() || m_openDatabaseSet.contains(database));
+ m_openDatabaseSet.remove(database);
+}
+
void DatabaseThread::scheduleTask(PassRefPtr<DatabaseTask> task)
{
m_queue.append(task);
diff --git a/src/3rdparty/webkit/WebCore/storage/DatabaseThread.h b/src/3rdparty/webkit/WebCore/storage/DatabaseThread.h
index 9f13c33..5aab5fd 100644
--- a/src/3rdparty/webkit/WebCore/storage/DatabaseThread.h
+++ b/src/3rdparty/webkit/WebCore/storage/DatabaseThread.h
@@ -56,6 +56,10 @@ public:
void scheduleImmediateTask(PassRefPtr<DatabaseTask>); // This just adds the task to the front of the queue - the caller needs to be extremely careful not to create deadlocks when waiting for completion.
void unscheduleDatabaseTasks(Database*);
+ void recordDatabaseOpen(Database*);
+ void recordDatabaseClosed(Database*);
+ ThreadIdentifier getThreadID() { return m_threadID; }
+
private:
DatabaseThread();
@@ -67,6 +71,10 @@ private:
RefPtr<DatabaseThread> m_selfRef;
MessageQueue<RefPtr<DatabaseTask> > m_queue;
+
+ // This set keeps track of the open databases that have been used on this thread.
+ typedef HashSet<RefPtr<Database> > DatabaseSet;
+ DatabaseSet m_openDatabaseSet;
};
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp b/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp
index 9311bc6..4a64fe6 100644
--- a/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp
+++ b/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp
@@ -35,12 +35,12 @@
#include "Database.h"
#include "DatabaseTrackerClient.h"
#include "Document.h"
-#include "FileSystem.h"
#include "Logging.h"
#include "OriginQuotaManager.h"
#include "Page.h"
#include "SecurityOrigin.h"
#include "SecurityOriginHash.h"
+#include "SQLiteFileSystem.h"
#include "SQLiteStatement.h"
#include <wtf/MainThread.h>
#include <wtf/StdLibExtras.h>
@@ -69,6 +69,7 @@ DatabaseTracker::DatabaseTracker()
, m_thread(currentThread())
#endif
{
+ SQLiteFileSystem::registerSQLiteVFS();
}
void DatabaseTracker::setDatabaseDirectoryPath(const String& path)
@@ -87,9 +88,7 @@ const String& DatabaseTracker::databaseDirectoryPath() const
String DatabaseTracker::trackerDatabasePath() const
{
ASSERT(currentThread() == m_thread);
- if (m_databaseDirectoryPath.isEmpty())
- return String();
- return pathByAppendingComponent(m_databaseDirectoryPath, "Databases.db");
+ return SQLiteFileSystem::appendDatabaseFileNameToPath(m_databaseDirectoryPath, "Databases.db");
}
void DatabaseTracker::openTrackerDatabase(bool createIfDoesNotExist)
@@ -100,13 +99,9 @@ void DatabaseTracker::openTrackerDatabase(bool createIfDoesNotExist)
return;
String databasePath = trackerDatabasePath();
- if (databasePath.isEmpty())
- return;
-
- if (!createIfDoesNotExist && !fileExists(databasePath))
+ if (!SQLiteFileSystem::ensureDatabaseFileExists(databasePath, createIfDoesNotExist))
return;
- makeAllDirectories(m_databaseDirectoryPath);
if (!m_database.open(databasePath)) {
// FIXME: What do do here?
return;
@@ -190,9 +185,7 @@ bool DatabaseTracker::hasEntryForDatabase(SecurityOrigin* origin, const String&
String DatabaseTracker::originPath(SecurityOrigin* origin) const
{
ASSERT(currentThread() == m_thread);
- if (m_databaseDirectoryPath.isEmpty())
- return String();
- return pathByAppendingComponent(m_databaseDirectoryPath, origin->databaseIdentifier());
+ return SQLiteFileSystem::appendDatabaseFileNameToPath(m_databaseDirectoryPath, origin->databaseIdentifier());
}
String DatabaseTracker::fullPathForDatabase(SecurityOrigin* origin, const String& name, bool createIfNotExists)
@@ -206,7 +199,7 @@ String DatabaseTracker::fullPathForDatabase(SecurityOrigin* origin, const String
String originPath = this->originPath(origin);
// Make sure the path for this SecurityOrigin exists
- if (createIfNotExists && !makeAllDirectories(originPath))
+ if (createIfNotExists && !SQLiteFileSystem::ensureDatabaseDirectoryExists(originPath))
return String();
// See if we have a path for this database yet
@@ -224,7 +217,7 @@ String DatabaseTracker::fullPathForDatabase(SecurityOrigin* origin, const String
int result = statement.step();
if (result == SQLResultRow)
- return pathByAppendingComponent(originPath, statement.getColumnText(0));
+ return SQLiteFileSystem::appendDatabaseFileNameToPath(originPath, statement.getColumnText(0));
if (!createIfNotExists)
return String();
@@ -241,33 +234,20 @@ String DatabaseTracker::fullPathForDatabase(SecurityOrigin* origin, const String
return String();
result = sequenceStatement.step();
- // This has a range of 2^63 and starts at 0 for every time a user resets Safari -
- // I can't imagine it'd over overflow
- int64_t seq = 0;
- if (result == SQLResultRow) {
- seq = sequenceStatement.getColumnInt64(0);
- } else if (result != SQLResultDone)
- return String();
- sequenceStatement.finalize();
-
- String filename;
- do {
- ++seq;
- filename = pathByAppendingComponent(originPath, String::format("%016llx.db", seq));
- } while (fileExists(filename));
-
- if (!addDatabase(origin, name, String::format("%016llx.db", seq)))
+ String fileName = SQLiteFileSystem::getFileNameForNewDatabase(originPath, origin->databaseIdentifier(), name, &m_database);
+ if (!addDatabase(origin, name, fileName))
return String();
// If this origin's quota is being tracked (open handle to a database in this origin), add this new database
// to the quota manager now
+ String fullFilePath = SQLiteFileSystem::appendDatabaseFileNameToPath(originPath, fileName);
{
Locker<OriginQuotaManager> locker(originQuotaManager());
if (originQuotaManager().tracksOrigin(origin))
- originQuotaManager().addDatabase(origin, name, filename);
+ originQuotaManager().addDatabase(origin, name, fullFilePath);
}
- return filename;
+ return fullFilePath;
}
void DatabaseTracker::populateOrigins()
@@ -423,8 +403,7 @@ unsigned long long DatabaseTracker::usageForDatabase(const String& name, Securit
if (path.isEmpty())
return 0;
- long long size;
- return getFileSize(path, size) ? size : 0;
+ return SQLiteFileSystem::getDatabaseFileSize(path);
}
void DatabaseTracker::addOpenDatabase(Database* database)
@@ -665,7 +644,7 @@ void DatabaseTracker::deleteOrigin(SecurityOrigin* origin)
return;
}
- deleteEmptyDirectory(originPath(origin));
+ SQLiteFileSystem::deleteEmptyDatabaseDirectory(originPath(origin));
RefPtr<SecurityOrigin> originPossiblyLastReference = origin;
{
@@ -679,8 +658,8 @@ void DatabaseTracker::deleteOrigin(SecurityOrigin* origin)
if (m_quotaMap->isEmpty()) {
if (m_database.isOpen())
m_database.close();
- deleteFile(trackerDatabasePath());
- deleteEmptyDirectory(m_databaseDirectoryPath);
+ SQLiteFileSystem::deleteDatabaseFile(trackerDatabasePath());
+ SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_databaseDirectoryPath);
}
}
@@ -763,7 +742,7 @@ bool DatabaseTracker::deleteDatabaseFile(SecurityOrigin* origin, const String& n
for (unsigned i = 0; i < deletedDatabases.size(); ++i)
deletedDatabases[i]->markAsDeletedAndClose();
- return deleteFile(fullPath);
+ return SQLiteFileSystem::deleteDatabaseFile(fullPath);
}
void DatabaseTracker::setClient(DatabaseTrackerClient* client)
diff --git a/src/3rdparty/webkit/WebCore/storage/OriginUsageRecord.cpp b/src/3rdparty/webkit/WebCore/storage/OriginUsageRecord.cpp
index 211ba69..5f4957f 100644
--- a/src/3rdparty/webkit/WebCore/storage/OriginUsageRecord.cpp
+++ b/src/3rdparty/webkit/WebCore/storage/OriginUsageRecord.cpp
@@ -30,7 +30,7 @@
#if ENABLE(DATABASE)
-#include "FileSystem.h"
+#include "SQLiteFileSystem.h"
namespace WebCore {
@@ -82,13 +82,9 @@ unsigned long long OriginUsageRecord::diskUsage()
const String& path = m_databaseMap.get(*iUnknown).filename;
ASSERT(!path.isEmpty());
- long long size;
- if (getFileSize(path, size))
- m_databaseMap.set(*iUnknown, DatabaseEntry(path, size));
- else {
- // When we can't determine the file size, we'll just have to assume the file is missing/inaccessible.
- m_databaseMap.set(*iUnknown, DatabaseEntry(path, 0));
- }
+ // When we can't determine the file size, we'll just have to assume the file is missing/inaccessible.
+ long long size = SQLiteFileSystem::getDatabaseFileSize(path);
+ m_databaseMap.set(*iUnknown, DatabaseEntry(path, size));
}
m_unknownSet.clear();
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageArea.cpp b/src/3rdparty/webkit/WebCore/storage/StorageArea.cpp
index ac41447..11b3517 100644
--- a/src/3rdparty/webkit/WebCore/storage/StorageArea.cpp
+++ b/src/3rdparty/webkit/WebCore/storage/StorageArea.cpp
@@ -26,228 +26,19 @@
#include "config.h"
#include "StorageArea.h"
+#if PLATFORM(CHROMIUM)
+#error "Chromium should not compile this file and instead define its own version of these factories that navigate the multi-process boundry."
+#endif
+
#if ENABLE(DOM_STORAGE)
-#include "EventNames.h"
-#include "ExceptionCode.h"
-#include "Frame.h"
-#include "Page.h"
-#include "PageGroup.h"
-#include "SecurityOrigin.h"
-#include "Settings.h"
-#include "StorageEvent.h"
-#include "StorageAreaSync.h"
-#include "StorageMap.h"
-#include "StorageSyncManager.h"
+#include "StorageAreaImpl.h"
namespace WebCore {
PassRefPtr<StorageArea> StorageArea::create(StorageType storageType, SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager)
{
- return adoptRef(new StorageArea(storageType, origin, syncManager));
-}
-
-StorageArea::StorageArea(StorageType storageType, SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager)
- : m_storageType(storageType)
- , m_securityOrigin(origin)
- , m_storageMap(StorageMap::create())
- , m_storageSyncManager(syncManager)
-#ifndef NDEBUG
- , m_isShutdown(false)
-#endif
-{
- ASSERT(m_securityOrigin);
- ASSERT(m_storageMap);
-
- // FIXME: If there's no backing storage for LocalStorage, the default WebKit behavior should be that of private browsing,
- // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894
- if (m_storageSyncManager) {
- m_storageAreaSync = StorageAreaSync::create(m_storageSyncManager, this);
- ASSERT(m_storageAreaSync);
- }
-}
-
-PassRefPtr<StorageArea> StorageArea::copy(SecurityOrigin* origin)
-{
- ASSERT(!m_isShutdown);
- return adoptRef(new StorageArea(origin, this));
-}
-
-StorageArea::StorageArea(SecurityOrigin* origin, StorageArea* area)
- : m_storageType(area->m_storageType)
- , m_securityOrigin(origin)
- , m_storageMap(area->m_storageMap)
- , m_storageSyncManager(area->m_storageSyncManager)
-#ifndef NDEBUG
- , m_isShutdown(area->m_isShutdown)
-#endif
-{
- ASSERT(m_securityOrigin);
- ASSERT(m_storageMap);
- ASSERT(!m_isShutdown);
-}
-
-unsigned StorageArea::length() const
-{
- ASSERT(!m_isShutdown);
- return m_storageMap->length();
-}
-
-String StorageArea::key(unsigned index, ExceptionCode& ec) const
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- String key;
-
- if (!m_storageMap->key(index, key)) {
- ec = INDEX_SIZE_ERR;
- return String();
- }
-
- return key;
-}
-
-String StorageArea::getItem(const String& key) const
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- return m_storageMap->getItem(key);
-}
-
-void StorageArea::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
-{
- ASSERT(!m_isShutdown);
- ASSERT(!value.isNull());
- blockUntilImportComplete();
-
- if (frame->page()->settings()->privateBrowsingEnabled()) {
- ec = QUOTA_EXCEEDED_ERR;
- return;
- }
-
- // FIXME: For LocalStorage where a disk quota will be enforced, here is where we need to do quota checking.
- // If we decide to enforce a memory quota for SessionStorage, this is where we'd do that, also.
- // if (<over quota>) {
- // ec = QUOTA_EXCEEDED_ERR;
- // return;
- // }
-
- String oldValue;
- RefPtr<StorageMap> newMap = m_storageMap->setItem(key, value, oldValue);
-
- if (newMap)
- m_storageMap = newMap.release();
-
- // Only notify the client if an item was actually changed
- if (oldValue != value) {
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleItemForSync(key, value);
- dispatchStorageEvent(key, oldValue, value, frame);
- }
-}
-
-void StorageArea::removeItem(const String& key, Frame* frame)
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- if (frame->page()->settings()->privateBrowsingEnabled())
- return;
-
- String oldValue;
- RefPtr<StorageMap> newMap = m_storageMap->removeItem(key, oldValue);
- if (newMap)
- m_storageMap = newMap.release();
-
- // Only notify the client if an item was actually removed
- if (!oldValue.isNull()) {
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleItemForSync(key, String());
- dispatchStorageEvent(key, oldValue, String(), frame);
- }
-}
-
-void StorageArea::clear(Frame* frame)
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- if (frame->page()->settings()->privateBrowsingEnabled())
- return;
-
- m_storageMap = StorageMap::create();
-
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleClear();
- dispatchStorageEvent(String(), String(), String(), frame);
-}
-
-bool StorageArea::contains(const String& key) const
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- return m_storageMap->contains(key);
-}
-
-void StorageArea::importItem(const String& key, const String& value)
-{
- ASSERT(!m_isShutdown);
- m_storageMap->importItem(key, value);
-}
-
-void StorageArea::close()
-{
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleFinalSync();
-
-#ifndef NDEBUG
- m_isShutdown = true;
-#endif
-}
-
-void StorageArea::blockUntilImportComplete() const
-{
- if (m_storageAreaSync)
- m_storageAreaSync->blockUntilImportComplete();
-}
-
-void StorageArea::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame)
-{
- // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree
- // of any given page in the group or mutate the page group itself.
- Vector<RefPtr<Frame> > frames;
-
- // FIXME: When can this occur?
- Page* page = sourceFrame->page();
- if (!page)
- return;
-
- if (m_storageType == SessionStorage) {
- // Send events only to our page.
- for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
- if (frame->document()->securityOrigin()->equal(securityOrigin()))
- frames.append(frame);
- }
-
- for (unsigned i = 0; i < frames.size(); ++i)
- frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow(), frames[i]->domWindow()->sessionStorage()));
- } else {
- // Send events to every page.
- const HashSet<Page*>& pages = page->group().pages();
- HashSet<Page*>::const_iterator end = pages.end();
- for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
- for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
- if (frame->document()->securityOrigin()->equal(securityOrigin()))
- frames.append(frame);
- }
- }
-
- for (unsigned i = 0; i < frames.size(); ++i)
- frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow(), frames[i]->domWindow()->localStorage()));
- }
+ return StorageAreaImpl::create(storageType, origin, syncManager);
}
}
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageArea.h b/src/3rdparty/webkit/WebCore/storage/StorageArea.h
index 69e7882..31f716a 100644
--- a/src/3rdparty/webkit/WebCore/storage/StorageArea.h
+++ b/src/3rdparty/webkit/WebCore/storage/StorageArea.h
@@ -50,45 +50,27 @@ namespace WebCore {
typedef int ExceptionCode;
enum StorageType { LocalStorage, SessionStorage };
+ // This interface is required for Chromium since these actions need to be proxied between processes.
class StorageArea : public ThreadSafeShared<StorageArea> {
public:
static PassRefPtr<StorageArea> create(StorageType, SecurityOrigin*, PassRefPtr<StorageSyncManager>);
- PassRefPtr<StorageArea> copy(SecurityOrigin*);
+ virtual ~StorageArea() { }
+ virtual PassRefPtr<StorageArea> copy(SecurityOrigin*) = 0;
// The HTML5 DOM Storage API
- unsigned length() const;
- String key(unsigned index, ExceptionCode& ec) const;
- String getItem(const String& key) const;
- void setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame);
- void removeItem(const String& key, Frame* sourceFrame);
- void clear(Frame* sourceFrame);
+ virtual unsigned length() const = 0;
+ virtual String key(unsigned index, ExceptionCode& ec) const = 0;
+ virtual String getItem(const String& key) const = 0;
+ virtual void setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame) = 0;
+ virtual void removeItem(const String& key, Frame* sourceFrame) = 0;
+ virtual void clear(Frame* sourceFrame) = 0;
- bool contains(const String& key) const;
- void close();
+ virtual bool contains(const String& key) const = 0;
+ virtual void close() = 0;
// Could be called from a background thread.
- void importItem(const String& key, const String& value);
- SecurityOrigin* securityOrigin() { return m_securityOrigin.get(); }
-
- protected:
- StorageArea(StorageType, SecurityOrigin*, PassRefPtr<StorageSyncManager>);
- StorageArea(SecurityOrigin*, StorageArea*);
-
- private:
- void blockUntilImportComplete() const;
-
- void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame);
-
- StorageType m_storageType;
- RefPtr<SecurityOrigin> m_securityOrigin;
- RefPtr<StorageMap> m_storageMap;
-
- RefPtr<StorageAreaSync> m_storageAreaSync;
- RefPtr<StorageSyncManager> m_storageSyncManager;
-
-#ifndef NDEBUG
- bool m_isShutdown;
-#endif
+ virtual void importItem(const String& key, const String& value) = 0;
+ virtual SecurityOrigin* securityOrigin() = 0;
};
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.cpp b/src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.cpp
new file mode 100644
index 0000000..ba31658
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.cpp
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2008 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.
+ */
+
+#include "config.h"
+#include "StorageAreaImpl.h"
+
+#if ENABLE(DOM_STORAGE)
+
+#include "DOMWindow.h"
+#include "EventNames.h"
+#include "ExceptionCode.h"
+#include "Frame.h"
+#include "Page.h"
+#include "PageGroup.h"
+#include "SecurityOrigin.h"
+#include "Settings.h"
+#include "StorageEvent.h"
+#include "StorageAreaSync.h"
+#include "StorageMap.h"
+#include "StorageSyncManager.h"
+
+namespace WebCore {
+
+PassRefPtr<StorageArea> StorageAreaImpl::create(StorageType storageType, SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager)
+{
+ return adoptRef(new StorageAreaImpl(storageType, origin, syncManager));
+}
+
+StorageAreaImpl::~StorageAreaImpl()
+{
+}
+
+StorageAreaImpl::StorageAreaImpl(StorageType storageType, SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager)
+ : m_storageType(storageType)
+ , m_securityOrigin(origin)
+ , m_storageMap(StorageMap::create())
+ , m_storageSyncManager(syncManager)
+#ifndef NDEBUG
+ , m_isShutdown(false)
+#endif
+{
+ ASSERT(m_securityOrigin);
+ ASSERT(m_storageMap);
+
+ // FIXME: If there's no backing storage for LocalStorage, the default WebKit behavior should be that of private browsing,
+ // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894
+ if (m_storageSyncManager) {
+ m_storageAreaSync = StorageAreaSync::create(m_storageSyncManager, this);
+ ASSERT(m_storageAreaSync);
+ }
+}
+
+PassRefPtr<StorageArea> StorageAreaImpl::copy(SecurityOrigin* origin)
+{
+ ASSERT(!m_isShutdown);
+ return adoptRef(new StorageAreaImpl(origin, this));
+}
+
+StorageAreaImpl::StorageAreaImpl(SecurityOrigin* origin, StorageAreaImpl* area)
+ : m_storageType(area->m_storageType)
+ , m_securityOrigin(origin)
+ , m_storageMap(area->m_storageMap)
+ , m_storageSyncManager(area->m_storageSyncManager)
+#ifndef NDEBUG
+ , m_isShutdown(area->m_isShutdown)
+#endif
+{
+ ASSERT(m_securityOrigin);
+ ASSERT(m_storageMap);
+ ASSERT(!m_isShutdown);
+}
+
+unsigned StorageAreaImpl::length() const
+{
+ ASSERT(!m_isShutdown);
+ return m_storageMap->length();
+}
+
+String StorageAreaImpl::key(unsigned index, ExceptionCode& ec) const
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ String key;
+
+ if (!m_storageMap->key(index, key)) {
+ ec = INDEX_SIZE_ERR;
+ return String();
+ }
+
+ return key;
+}
+
+String StorageAreaImpl::getItem(const String& key) const
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ return m_storageMap->getItem(key);
+}
+
+void StorageAreaImpl::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
+{
+ ASSERT(!m_isShutdown);
+ ASSERT(!value.isNull());
+ blockUntilImportComplete();
+
+ if (frame->page()->settings()->privateBrowsingEnabled()) {
+ ec = QUOTA_EXCEEDED_ERR;
+ return;
+ }
+
+ // FIXME: For LocalStorage where a disk quota will be enforced, here is where we need to do quota checking.
+ // If we decide to enforce a memory quota for SessionStorage, this is where we'd do that, also.
+ // if (<over quota>) {
+ // ec = QUOTA_EXCEEDED_ERR;
+ // return;
+ // }
+
+ String oldValue;
+ RefPtr<StorageMap> newMap = m_storageMap->setItem(key, value, oldValue);
+
+ if (newMap)
+ m_storageMap = newMap.release();
+
+ // Only notify the client if an item was actually changed
+ if (oldValue != value) {
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleItemForSync(key, value);
+ dispatchStorageEvent(key, oldValue, value, frame);
+ }
+}
+
+void StorageAreaImpl::removeItem(const String& key, Frame* frame)
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ if (frame->page()->settings()->privateBrowsingEnabled())
+ return;
+
+ String oldValue;
+ RefPtr<StorageMap> newMap = m_storageMap->removeItem(key, oldValue);
+ if (newMap)
+ m_storageMap = newMap.release();
+
+ // Only notify the client if an item was actually removed
+ if (!oldValue.isNull()) {
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleItemForSync(key, String());
+ dispatchStorageEvent(key, oldValue, String(), frame);
+ }
+}
+
+void StorageAreaImpl::clear(Frame* frame)
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ if (frame->page()->settings()->privateBrowsingEnabled())
+ return;
+
+ m_storageMap = StorageMap::create();
+
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleClear();
+ dispatchStorageEvent(String(), String(), String(), frame);
+}
+
+bool StorageAreaImpl::contains(const String& key) const
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ return m_storageMap->contains(key);
+}
+
+void StorageAreaImpl::importItem(const String& key, const String& value)
+{
+ ASSERT(!m_isShutdown);
+ m_storageMap->importItem(key, value);
+}
+
+SecurityOrigin* StorageAreaImpl::securityOrigin()
+{
+ return m_securityOrigin.get();
+}
+
+void StorageAreaImpl::close()
+{
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleFinalSync();
+
+#ifndef NDEBUG
+ m_isShutdown = true;
+#endif
+}
+
+void StorageAreaImpl::blockUntilImportComplete() const
+{
+ if (m_storageAreaSync)
+ m_storageAreaSync->blockUntilImportComplete();
+}
+
+void StorageAreaImpl::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame)
+{
+ // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree
+ // of any given page in the group or mutate the page group itself.
+ Vector<RefPtr<Frame> > frames;
+
+ // FIXME: When can this occur?
+ Page* page = sourceFrame->page();
+ if (!page)
+ return;
+
+ if (m_storageType == SessionStorage) {
+ // Send events only to our page.
+ for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ if (frame->document()->securityOrigin()->equal(securityOrigin()))
+ frames.append(frame);
+ }
+
+ for (unsigned i = 0; i < frames.size(); ++i)
+ frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow(), frames[i]->domWindow()->sessionStorage()));
+ } else {
+ // Send events to every page.
+ const HashSet<Page*>& pages = page->group().pages();
+ HashSet<Page*>::const_iterator end = pages.end();
+ for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
+ for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ if (frame->document()->securityOrigin()->equal(securityOrigin()))
+ frames.append(frame);
+ }
+ }
+
+ for (unsigned i = 0; i < frames.size(); ++i)
+ frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow(), frames[i]->domWindow()->localStorage()));
+ }
+}
+
+}
+
+#endif // ENABLE(DOM_STORAGE)
+
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.h b/src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.h
new file mode 100644
index 0000000..e2d14f1
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2008 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.
+ */
+
+#ifndef StorageAreaImpl_h
+#define StorageAreaImpl_h
+
+#if ENABLE(DOM_STORAGE)
+
+#include "StorageArea.h"
+
+namespace WebCore {
+
+ class StorageAreaImpl : public StorageArea {
+ public:
+ static PassRefPtr<StorageArea> create(StorageType, SecurityOrigin*, PassRefPtr<StorageSyncManager>);
+ virtual ~StorageAreaImpl();
+ virtual PassRefPtr<StorageArea> copy(SecurityOrigin*);
+
+ // The HTML5 DOM Storage API
+ virtual unsigned length() const;
+ virtual String key(unsigned index, ExceptionCode& ec) const;
+ virtual String getItem(const String& key) const;
+ virtual void setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame);
+ virtual void removeItem(const String& key, Frame* sourceFrame);
+ virtual void clear(Frame* sourceFrame);
+
+ virtual bool contains(const String& key) const;
+ virtual void close();
+
+ // Could be called from a background thread.
+ void importItem(const String& key, const String& value);
+ SecurityOrigin* securityOrigin();
+
+ private:
+ StorageAreaImpl(StorageType, SecurityOrigin*, PassRefPtr<StorageSyncManager>);
+ StorageAreaImpl(SecurityOrigin*, StorageAreaImpl*);
+
+ void blockUntilImportComplete() const;
+
+ void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame);
+
+ StorageType m_storageType;
+ RefPtr<SecurityOrigin> m_securityOrigin;
+ RefPtr<StorageMap> m_storageMap;
+
+ RefPtr<StorageAreaSync> m_storageAreaSync;
+ RefPtr<StorageSyncManager> m_storageSyncManager;
+
+#ifndef NDEBUG
+ bool m_isShutdown;
+#endif
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(DOM_STORAGE)
+
+#endif // StorageAreaImpl_h
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageAreaSync.h b/src/3rdparty/webkit/WebCore/storage/StorageAreaSync.h
index fa10e63..a7f1082 100644
--- a/src/3rdparty/webkit/WebCore/storage/StorageAreaSync.h
+++ b/src/3rdparty/webkit/WebCore/storage/StorageAreaSync.h
@@ -37,7 +37,7 @@
namespace WebCore {
class Frame;
- class StorageArea;
+ class StorageArea;
class StorageSyncManager;
class StorageAreaSync : public RefCounted<StorageAreaSync> {
@@ -57,7 +57,6 @@ namespace WebCore {
private:
StorageAreaSync(PassRefPtr<StorageSyncManager> storageSyncManager, PassRefPtr<StorageArea> storageArea);
-
void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame);
Timer<StorageAreaSync> m_syncTimer;
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageNamespace.cpp b/src/3rdparty/webkit/WebCore/storage/StorageNamespace.cpp
index d8d85a7..6fcae63 100644
--- a/src/3rdparty/webkit/WebCore/storage/StorageNamespace.cpp
+++ b/src/3rdparty/webkit/WebCore/storage/StorageNamespace.cpp
@@ -26,104 +26,26 @@
#include "config.h"
#include "StorageNamespace.h"
-#if ENABLE(DOM_STORAGE)
-
-#include <wtf/StdLibExtras.h>
+#include "StorageNamespaceImpl.h"
-namespace WebCore {
+#if PLATFORM(CHROMIUM)
+#error "Chromium should not compile this file and instead define its own version of these factories that navigate the multi-process boundry."
+#endif
-typedef HashMap<String, StorageNamespace*> LocalStorageNamespaceMap;
+#if ENABLE(DOM_STORAGE)
-static LocalStorageNamespaceMap& localStorageNamespaceMap()
-{
- DEFINE_STATIC_LOCAL(LocalStorageNamespaceMap, localStorageNamespaceMap, ());
- return localStorageNamespaceMap;
-}
+namespace WebCore {
PassRefPtr<StorageNamespace> StorageNamespace::localStorageNamespace(const String& path)
{
- const String lookupPath = path.isNull() ? String("") : path;
- LocalStorageNamespaceMap::iterator it = localStorageNamespaceMap().find(lookupPath);
- if (it == localStorageNamespaceMap().end()) {
- RefPtr<StorageNamespace> storageNamespace = adoptRef(new StorageNamespace(LocalStorage, lookupPath));
- localStorageNamespaceMap().set(lookupPath, storageNamespace.get());
- return storageNamespace.release();
- }
-
- return it->second;
+ return StorageNamespaceImpl::localStorageNamespace(path);
}
PassRefPtr<StorageNamespace> StorageNamespace::sessionStorageNamespace()
{
- return adoptRef(new StorageNamespace(SessionStorage, String()));
-}
-
-StorageNamespace::StorageNamespace(StorageType storageType, const String& path)
- : m_storageType(storageType)
- , m_path(path.copy()) // FIXME: Is the .copy necessary?
- , m_syncManager(0)
-#ifndef NDEBUG
- , m_isShutdown(false)
-#endif
-{
- if (m_storageType == LocalStorage && !m_path.isEmpty())
- m_syncManager = StorageSyncManager::create(m_path);
-}
-
-StorageNamespace::~StorageNamespace()
-{
- ASSERT(isMainThread());
-
- if (m_storageType == LocalStorage) {
- ASSERT(localStorageNamespaceMap().get(m_path) == this);
- localStorageNamespaceMap().remove(m_path);
- }
-}
-
-PassRefPtr<StorageNamespace> StorageNamespace::copy()
-{
- ASSERT(isMainThread());
- ASSERT(!m_isShutdown);
-
- RefPtr<StorageNamespace> newNamespace = adoptRef(new StorageNamespace(m_storageType, m_path));
-
- StorageAreaMap::iterator end = m_storageAreaMap.end();
- for (StorageAreaMap::iterator i = m_storageAreaMap.begin(); i != end; ++i) {
- RefPtr<StorageArea> areaCopy = i->second->copy(i->first.get());
- newNamespace->m_storageAreaMap.set(i->first, areaCopy.release());
- }
-
- return newNamespace.release();
-}
-
-PassRefPtr<StorageArea> StorageNamespace::storageArea(SecurityOrigin* origin)
-{
- ASSERT(isMainThread());
- ASSERT(!m_isShutdown);
-
- RefPtr<StorageArea> storageArea;
- if (storageArea = m_storageAreaMap.get(origin))
- return storageArea.release();
-
- storageArea = StorageArea::create(m_storageType, origin, m_syncManager);
- m_storageAreaMap.set(origin, storageArea);
- return storageArea.release();
+ return StorageNamespaceImpl::sessionStorageNamespace();
}
-void StorageNamespace::close()
-{
- ASSERT(isMainThread());
- ASSERT(!m_isShutdown);
-
- StorageAreaMap::iterator end = m_storageAreaMap.end();
- for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
- it->second->close();
-
-#ifndef NDEBUG
- m_isShutdown = true;
-#endif
-}
+} // namespace WebCore
#endif // ENABLE(DOM_STORAGE)
-
-} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageNamespace.h b/src/3rdparty/webkit/WebCore/storage/StorageNamespace.h
index 5621b01..687cea2 100644
--- a/src/3rdparty/webkit/WebCore/storage/StorageNamespace.h
+++ b/src/3rdparty/webkit/WebCore/storage/StorageNamespace.h
@@ -39,32 +39,16 @@ namespace WebCore {
class StorageArea;
class StorageSyncManager;
+ // This interface is required for Chromium since these actions need to be proxied between processes.
class StorageNamespace : public RefCounted<StorageNamespace> {
public:
- ~StorageNamespace();
-
static PassRefPtr<StorageNamespace> localStorageNamespace(const String& path);
static PassRefPtr<StorageNamespace> sessionStorageNamespace();
- PassRefPtr<StorageArea> storageArea(SecurityOrigin*);
- PassRefPtr<StorageNamespace> copy();
- void close();
-
- private:
- StorageNamespace(StorageType, const String& path);
-
- typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea>, SecurityOriginHash> StorageAreaMap;
- StorageAreaMap m_storageAreaMap;
-
- StorageType m_storageType;
-
- // Only used if m_storageType == LocalStorage and the path was not "" in our constructor.
- String m_path;
- RefPtr<StorageSyncManager> m_syncManager;
-
-#ifndef NDEBUG
- bool m_isShutdown;
-#endif
+ virtual ~StorageNamespace() { }
+ virtual PassRefPtr<StorageArea> storageArea(SecurityOrigin*) = 0;
+ virtual PassRefPtr<StorageNamespace> copy() = 0;
+ virtual void close() = 0;
};
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.cpp b/src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.cpp
new file mode 100644
index 0000000..39ec27b
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2008 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.
+ */
+
+#include "config.h"
+#include "StorageNamespaceImpl.h"
+
+#if ENABLE(DOM_STORAGE)
+
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+typedef HashMap<String, StorageNamespace*> LocalStorageNamespaceMap;
+
+static LocalStorageNamespaceMap& localStorageNamespaceMap()
+{
+ DEFINE_STATIC_LOCAL(LocalStorageNamespaceMap, localStorageNamespaceMap, ());
+ return localStorageNamespaceMap;
+}
+
+PassRefPtr<StorageNamespace> StorageNamespaceImpl::localStorageNamespace(const String& path)
+{
+ const String lookupPath = path.isNull() ? String("") : path;
+ LocalStorageNamespaceMap::iterator it = localStorageNamespaceMap().find(lookupPath);
+ if (it == localStorageNamespaceMap().end()) {
+ RefPtr<StorageNamespace> storageNamespace = adoptRef(new StorageNamespaceImpl(LocalStorage, lookupPath));
+ localStorageNamespaceMap().set(lookupPath, storageNamespace.get());
+ return storageNamespace.release();
+ }
+
+ return it->second;
+}
+
+PassRefPtr<StorageNamespace> StorageNamespaceImpl::sessionStorageNamespace()
+{
+ return adoptRef(new StorageNamespaceImpl(SessionStorage, String()));
+}
+
+StorageNamespaceImpl::StorageNamespaceImpl(StorageType storageType, const String& path)
+ : m_storageType(storageType)
+ , m_path(path.copy()) // FIXME: Is the .copy necessary?
+ , m_syncManager(0)
+#ifndef NDEBUG
+ , m_isShutdown(false)
+#endif
+{
+ if (m_storageType == LocalStorage && !m_path.isEmpty())
+ m_syncManager = StorageSyncManager::create(m_path);
+}
+
+StorageNamespaceImpl::~StorageNamespaceImpl()
+{
+ ASSERT(isMainThread());
+
+ if (m_storageType == LocalStorage) {
+ ASSERT(localStorageNamespaceMap().get(m_path) == this);
+ localStorageNamespaceMap().remove(m_path);
+ }
+}
+
+PassRefPtr<StorageNamespace> StorageNamespaceImpl::copy()
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_isShutdown);
+
+ StorageNamespaceImpl* newNamespace = new StorageNamespaceImpl(m_storageType, m_path);
+
+ StorageAreaMap::iterator end = m_storageAreaMap.end();
+ for (StorageAreaMap::iterator i = m_storageAreaMap.begin(); i != end; ++i) {
+ RefPtr<StorageArea> areaCopy = i->second->copy(i->first.get());
+ newNamespace->m_storageAreaMap.set(i->first, areaCopy.release());
+ }
+
+ return adoptRef(newNamespace);
+}
+
+PassRefPtr<StorageArea> StorageNamespaceImpl::storageArea(SecurityOrigin* origin)
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_isShutdown);
+
+ RefPtr<StorageArea> storageArea;
+ if (storageArea = m_storageAreaMap.get(origin))
+ return storageArea.release();
+
+ storageArea = StorageArea::create(m_storageType, origin, m_syncManager);
+ m_storageAreaMap.set(origin, storageArea);
+ return storageArea.release();
+}
+
+void StorageNamespaceImpl::close()
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_isShutdown);
+
+ StorageAreaMap::iterator end = m_storageAreaMap.end();
+ for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
+ it->second->close();
+
+#ifndef NDEBUG
+ m_isShutdown = true;
+#endif
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(DOM_STORAGE)
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.h b/src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.h
new file mode 100644
index 0000000..6c5a9dc
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2008 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.
+ */
+
+#ifndef StorageNamespaceImpl_h
+#define StorageNamespaceImpl_h
+
+#if ENABLE(DOM_STORAGE)
+
+#include "StorageNamespace.h"
+
+namespace WebCore {
+
+ class StorageNamespaceImpl : public StorageNamespace {
+ public:
+ static PassRefPtr<StorageNamespace> localStorageNamespace(const String& path);
+ static PassRefPtr<StorageNamespace> sessionStorageNamespace();
+
+ virtual ~StorageNamespaceImpl();
+ virtual PassRefPtr<StorageArea> storageArea(SecurityOrigin*);
+ virtual PassRefPtr<StorageNamespace> copy();
+ virtual void close();
+
+ private:
+ StorageNamespaceImpl(StorageType, const String& path);
+
+ typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea>, SecurityOriginHash> StorageAreaMap;
+ StorageAreaMap m_storageAreaMap;
+
+ StorageType m_storageType;
+
+ // Only used if m_storageType == LocalStorage and the path was not "" in our constructor.
+ String m_path;
+ RefPtr<StorageSyncManager> m_syncManager;
+
+#ifndef NDEBUG
+ bool m_isShutdown;
+#endif
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(DOM_STORAGE)
+
+#endif // StorageNamespaceImpl_h
diff --git a/src/3rdparty/webkit/WebCore/svg/GradientAttributes.h b/src/3rdparty/webkit/WebCore/svg/GradientAttributes.h
index 2d7c32a..6b3408e 100644
--- a/src/3rdparty/webkit/WebCore/svg/GradientAttributes.h
+++ b/src/3rdparty/webkit/WebCore/svg/GradientAttributes.h
@@ -24,8 +24,7 @@
#if ENABLE(SVG)
-namespace WebCore
-{
+namespace WebCore {
struct GradientAttributes {
GradientAttributes()
: m_spreadMethod(SpreadMethodPad)
diff --git a/src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h b/src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h
index e640c03..fc59465 100644
--- a/src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h
+++ b/src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h
@@ -26,8 +26,7 @@
#if ENABLE(SVG)
-namespace WebCore
-{
+namespace WebCore {
struct LinearGradientAttributes : GradientAttributes {
LinearGradientAttributes()
: m_x1(0.0)
diff --git a/src/3rdparty/webkit/WebCore/svg/PatternAttributes.h b/src/3rdparty/webkit/WebCore/svg/PatternAttributes.h
index 2940baf..b43d87e 100644
--- a/src/3rdparty/webkit/WebCore/svg/PatternAttributes.h
+++ b/src/3rdparty/webkit/WebCore/svg/PatternAttributes.h
@@ -24,8 +24,7 @@
#if ENABLE(SVG)
-namespace WebCore
-{
+namespace WebCore {
struct PatternAttributes {
PatternAttributes()
: m_x()
diff --git a/src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h b/src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h
index 782ab49..273cd29 100644
--- a/src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h
+++ b/src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h
@@ -26,8 +26,7 @@
#if ENABLE(SVG)
-namespace WebCore
-{
+namespace WebCore {
struct RadialGradientAttributes : GradientAttributes {
RadialGradientAttributes()
: m_cx(0.5)
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPathData.h b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPathData.h
index 6b3faf6..88b994b 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPathData.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPathData.h
@@ -25,12 +25,10 @@
#if ENABLE(SVG)
-namespace WebCore
-{
+namespace WebCore {
class SVGPathSegList;
- class SVGAnimatedPathData
- {
+ class SVGAnimatedPathData {
public:
SVGAnimatedPathData();
virtual ~SVGAnimatedPathData();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPoints.h b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPoints.h
index 58323c0..1e61057 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPoints.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPoints.h
@@ -25,12 +25,10 @@
#if ENABLE(SVG)
-namespace WebCore
-{
+namespace WebCore {
class SVGPointList;
- class SVGAnimatedPoints
- {
+ class SVGAnimatedPoints {
public:
SVGAnimatedPoints();
virtual ~SVGAnimatedPoints();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h b/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h
index 120beb4..d43ed57 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h
@@ -43,8 +43,7 @@ namespace WebCore {
class SVGAnimationElement : public SVGSMILElement,
public SVGTests,
public SVGExternalResourcesRequired,
- public ElementTimeControl
- {
+ public ElementTimeControl {
public:
SVGAnimationElement(const QualifiedName&, Document*);
virtual ~SVGAnimationElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h b/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h
index ab7ea68..4043554 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h
@@ -35,8 +35,7 @@ namespace WebCore {
class SVGClipPathElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
- public SVGExternalResourcesRequired
- {
+ public SVGExternalResourcesRequired {
public:
SVGClipPathElement(const QualifiedName&, Document*);
virtual ~SVGClipPathElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGDocumentExtensions.cpp b/src/3rdparty/webkit/WebCore/svg/SVGDocumentExtensions.cpp
index d7169e1..61645f4 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGDocumentExtensions.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGDocumentExtensions.cpp
@@ -89,13 +89,13 @@ void SVGDocumentExtensions::unpauseAnimations()
void SVGDocumentExtensions::reportWarning(const String& message)
{
if (Frame* frame = m_doc->frame())
- frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Warning: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
+ frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Warning: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
}
void SVGDocumentExtensions::reportError(const String& message)
{
if (Frame* frame = m_doc->frame())
- frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Error: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
+ frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
}
void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyledElement* obj)
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h b/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h
index 7c56792..c477718 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h
@@ -44,8 +44,7 @@ namespace WebCore {
// SVGElementInstance mimics Node, but without providing all its functionality
class SVGElementInstance : public TreeShared<SVGElementInstance>,
- public EventTarget
- {
+ public EventTarget {
public:
SVGElementInstance(SVGUseElement*, SVGElement* originalElement);
virtual ~SVGElementInstance();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.idl b/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.idl
index 3d88178..cd4213c 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.idl
+++ b/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.idl
@@ -31,7 +31,7 @@ module svg {
CustomListeners,
CustomMarkFunction,
CustomPushEventHandlerScope,
- GenerateToJS,
+ CustomToJS,
GenerateNativeConverter
] SVGElementInstance
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.cpp
index f78412c..0497ea9 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.cpp
@@ -69,7 +69,7 @@ bool SVGFEBlendElement::build(SVGResourceFilter* filterResource)
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
FilterEffect* input2 = filterResource->builder()->getEffectById(in2());
- if(!input1 || !input2)
+ if (!input1 || !input2)
return false;
RefPtr<FilterEffect> effect = FEBlend::create(input1, input2, static_cast<BlendModeType>(mode()));
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.h
index 70e5e06..bed649f 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.h
@@ -27,10 +27,8 @@
#include "FEBlend.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
-namespace WebCore
-{
- class SVGFEBlendElement : public SVGFilterPrimitiveStandardAttributes
- {
+namespace WebCore {
+ class SVGFEBlendElement : public SVGFilterPrimitiveStandardAttributes {
public:
SVGFEBlendElement(const QualifiedName&, Document*);
virtual ~SVGFEBlendElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEColorMatrixElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEColorMatrixElement.cpp
index 660f000..c2d605b 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEColorMatrixElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEColorMatrixElement.cpp
@@ -69,7 +69,7 @@ bool SVGFEColorMatrixElement::build(SVGResourceFilter* filterResource)
{
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- if(!input1)
+ if (!input1)
return false;
Vector<float> _values;
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEComponentTransferElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEComponentTransferElement.cpp
index cad60dc..691d5cd 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEComponentTransferElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEComponentTransferElement.cpp
@@ -60,7 +60,7 @@ bool SVGFEComponentTransferElement::build(SVGResourceFilter* filterResource)
{
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- if(!input1)
+ if (!input1)
return false;
ComponentTransferFunction red;
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.cpp
index 2205243..6eec6ea 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.cpp
@@ -85,7 +85,7 @@ bool SVGFECompositeElement::build(SVGResourceFilter* filterResource)
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
FilterEffect* input2 = filterResource->builder()->getEffectById(in2());
- if(!input1 || !input2)
+ if (!input1 || !input2)
return false;
RefPtr<FilterEffect> effect = FEComposite::create(input1, input2, static_cast<CompositeOperationType>(_operator()),
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEDiffuseLightingElement.cpp
index 00ff55a..edbd852 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEDiffuseLightingElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEDiffuseLightingElement.cpp
@@ -75,7 +75,7 @@ bool SVGFEDiffuseLightingElement::build(SVGResourceFilter* filterResource)
{
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- if(!input1)
+ if (!input1)
return false;
RefPtr<RenderStyle> filterStyle = styleForRenderer();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEDisplacementMapElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEDisplacementMapElement.cpp
index 8ac668c..adf02fe 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEDisplacementMapElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEDisplacementMapElement.cpp
@@ -77,7 +77,7 @@ bool SVGFEDisplacementMapElement::build(SVGResourceFilter* filterResource)
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
FilterEffect* input2 = filterResource->builder()->getEffectById(in2());
- if(!input1 || !input2)
+ if (!input1 || !input2)
return false;
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEDistantLightElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEDistantLightElement.h
index e340549..95f45c8 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEDistantLightElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEDistantLightElement.h
@@ -23,10 +23,8 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFELightElement.h"
-namespace WebCore
-{
- class SVGFEDistantLightElement : public SVGFELightElement
- {
+namespace WebCore {
+ class SVGFEDistantLightElement : public SVGFELightElement {
public:
SVGFEDistantLightElement(const QualifiedName&, Document*);
virtual ~SVGFEDistantLightElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp
index e12b4e1..ae5ce94 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp
@@ -55,7 +55,7 @@ bool SVGFEFloodElement::build(SVGResourceFilter* filterResource)
{
FilterEffect* input = filterResource->builder()->getEffectById(in1());
- if(!input)
+ if (!input)
return false;
RefPtr<RenderStyle> filterStyle = styleForRenderer();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h
index 4a4cffc..ca4e18b 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h
@@ -27,10 +27,8 @@
#include "SVGFEFlood.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
-namespace WebCore
-{
- class SVGFEFloodElement : public SVGFilterPrimitiveStandardAttributes
- {
+namespace WebCore {
+ class SVGFEFloodElement : public SVGFilterPrimitiveStandardAttributes {
public:
SVGFEFloodElement(const QualifiedName&, Document*);
virtual ~SVGFEFloodElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEFuncAElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEFuncAElement.h
index 2c24039..8ec6b1c 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEFuncAElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEFuncAElement.h
@@ -26,10 +26,8 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGComponentTransferFunctionElement.h"
-namespace WebCore
-{
- class SVGFEFuncAElement : public SVGComponentTransferFunctionElement
- {
+namespace WebCore {
+ class SVGFEFuncAElement : public SVGComponentTransferFunctionElement {
public:
SVGFEFuncAElement(const QualifiedName&, Document*);
virtual ~SVGFEFuncAElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEFuncBElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEFuncBElement.h
index 1eb0889..5d86f87 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEFuncBElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEFuncBElement.h
@@ -26,10 +26,8 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGComponentTransferFunctionElement.h"
-namespace WebCore
-{
- class SVGFEFuncBElement : public SVGComponentTransferFunctionElement
- {
+namespace WebCore {
+ class SVGFEFuncBElement : public SVGComponentTransferFunctionElement {
public:
SVGFEFuncBElement(const QualifiedName&, Document*);
virtual ~SVGFEFuncBElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEFuncGElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEFuncGElement.h
index 973360e..9f5d3d7 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEFuncGElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEFuncGElement.h
@@ -26,10 +26,8 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGComponentTransferFunctionElement.h"
-namespace WebCore
-{
- class SVGFEFuncGElement : public SVGComponentTransferFunctionElement
- {
+namespace WebCore {
+ class SVGFEFuncGElement : public SVGComponentTransferFunctionElement {
public:
SVGFEFuncGElement(const QualifiedName&, Document*);
virtual ~SVGFEFuncGElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEFuncRElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEFuncRElement.h
index 3553954..0a0d115 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEFuncRElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEFuncRElement.h
@@ -26,10 +26,8 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGComponentTransferFunctionElement.h"
-namespace WebCore
-{
- class SVGFEFuncRElement : public SVGComponentTransferFunctionElement
- {
+namespace WebCore {
+ class SVGFEFuncRElement : public SVGComponentTransferFunctionElement {
public:
SVGFEFuncRElement(const QualifiedName&, Document*);
virtual ~SVGFEFuncRElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.cpp
index be3554f..4cddb5a 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.cpp
@@ -71,7 +71,7 @@ bool SVGFEGaussianBlurElement::build(SVGResourceFilter* filterResource)
{
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- if(!input1)
+ if (!input1)
return false;
RefPtr<FilterEffect> effect = FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY());
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp
index ae69e0d..8122960 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp
@@ -86,7 +86,7 @@ void SVGFEImageElement::notifyFinished(CachedResource*)
bool SVGFEImageElement::build(SVGResourceFilter* filterResource)
{
- if(!m_cachedImage)
+ if (!m_cachedImage)
return false;
RefPtr<FilterEffect> effect = FEImage::create(m_cachedImage.get());
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp
index 0640066..cb3a781 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp
@@ -49,7 +49,7 @@ bool SVGFEMergeElement::build(SVGResourceFilter* filterResource)
}
}
- if(mergeInputs.isEmpty())
+ if (mergeInputs.isEmpty())
return false;
RefPtr<FilterEffect> effect = FEMerge::create(mergeInputs);
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEOffsetElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEOffsetElement.cpp
index c7e4e77..945a9da 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEOffsetElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEOffsetElement.cpp
@@ -60,7 +60,7 @@ bool SVGFEOffsetElement::build(SVGResourceFilter* filterResource)
{
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- if(!input1)
+ if (!input1)
return false;
RefPtr<FilterEffect> effect = FEOffset::create(input1, dx(), dy());
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEPointLightElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEPointLightElement.h
index edb9f9d..b39fffa 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFEPointLightElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFEPointLightElement.h
@@ -23,10 +23,8 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFELightElement.h"
-namespace WebCore
-{
- class SVGFEPointLightElement : public SVGFELightElement
- {
+namespace WebCore {
+ class SVGFEPointLightElement : public SVGFELightElement {
public:
SVGFEPointLightElement(const QualifiedName&, Document*);
virtual ~SVGFEPointLightElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFESpecularLightingElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFESpecularLightingElement.cpp
index 36dd453..7afa4cc 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFESpecularLightingElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFESpecularLightingElement.cpp
@@ -90,7 +90,7 @@ bool SVGFESpecularLightingElement::build(SVGResourceFilter* filterResource)
{
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- if(!input1)
+ if (!input1)
return false;
RefPtr<RenderStyle> filterStyle = styleForRenderer();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFESpotLightElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFESpotLightElement.h
index 629e51a..440c664 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFESpotLightElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFESpotLightElement.h
@@ -23,10 +23,8 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFELightElement.h"
-namespace WebCore
-{
- class SVGFESpotLightElement : public SVGFELightElement
- {
+namespace WebCore {
+ class SVGFESpotLightElement : public SVGFELightElement {
public:
SVGFESpotLightElement(const QualifiedName&, Document*);
virtual ~SVGFESpotLightElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFETileElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFETileElement.cpp
index d5828eb..14af25f 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFETileElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFETileElement.cpp
@@ -55,7 +55,7 @@ bool SVGFETileElement::build(SVGResourceFilter* filterResource)
{
FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- if(!input1)
+ if (!input1)
return false;
RefPtr<FilterEffect> effect = FETile::create(input1);
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp
index 17c110c..cb31178 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp
@@ -59,8 +59,7 @@ void SVGLineElement::parseMappedAttribute(MappedAttribute* attr)
setX2BaseValue(SVGLength(LengthModeWidth, attr->value()));
else if (attr->name() == SVGNames::y2Attr)
setY2BaseValue(SVGLength(LengthModeHeight, attr->value()));
- else
- {
+ else {
if (SVGTests::parseMappedAttribute(attr))
return;
if (SVGLangSpace::parseMappedAttribute(attr))
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGList.h b/src/3rdparty/webkit/WebCore/svg/SVGList.h
index 5381598..c04c200 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGList.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGList.h
@@ -165,8 +165,7 @@ namespace WebCore {
};
template<typename Item>
- class SVGPODList : public SVGList<RefPtr<SVGPODListItem<Item> > >
- {
+ class SVGPODList : public SVGList<RefPtr<SVGPODListItem<Item> > > {
public:
Item initialize(Item newItem, ExceptionCode& ec)
{
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGListTraits.h b/src/3rdparty/webkit/WebCore/svg/SVGListTraits.h
index b028ad5..d96bc67 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGListTraits.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGListTraits.h
@@ -34,14 +34,12 @@ namespace WebCore {
struct SVGListTraits { };
template<typename Item>
- struct SVGListTraits<true, Item>
- {
+ struct SVGListTraits<true, Item> {
static Item nullItem() { return Item(); }
};
template<>
- struct SVGListTraits<false, double>
- {
+ struct SVGListTraits<false, double> {
static double nullItem() { return 0.0; }
};
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h b/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h
index 1e84cc7..988cead 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h
@@ -32,8 +32,7 @@ namespace WebCore {
class SVGMPathElement : public SVGElement,
SVGURIReference,
- SVGExternalResourcesRequired
- {
+ SVGExternalResourcesRequired {
public:
SVGMPathElement(const QualifiedName&, Document*);
virtual ~SVGMPathElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGMetadataElement.h b/src/3rdparty/webkit/WebCore/svg/SVGMetadataElement.h
index 4bd87d6..63d0aae 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGMetadataElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGMetadataElement.h
@@ -26,10 +26,8 @@
#include "SVGElement.h"
-namespace WebCore
-{
- class SVGMetadataElement : public SVGElement
- {
+namespace WebCore {
+ class SVGMetadataElement : public SVGElement {
public:
SVGMetadataElement(const QualifiedName&, Document*);
virtual ~SVGMetadataElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGParserUtilities.cpp b/src/3rdparty/webkit/WebCore/svg/SVGParserUtilities.cpp
index 7d93f59..6f696e6 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGParserUtilities.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGParserUtilities.cpp
@@ -246,7 +246,7 @@ bool SVGPathParser::parseSVG(const String& s, bool process)
bool relative = false;
- switch(command)
+ switch (command)
{
case 'm':
relative = true;
@@ -625,7 +625,7 @@ void SVGPathParser::calculateArc(bool relative, double& curx, double& cury, doub
n_segs = (int) (int) ceil(fabs(th_arc / (piDouble * 0.5 + 0.001)));
- for(i = 0; i < n_segs; i++) {
+ for (i = 0; i < n_segs; i++) {
double sin_th, cos_th;
double a00, a01, a10, a11;
double x1, y1, x2, y2, x3, y3;
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGPathElement.h b/src/3rdparty/webkit/WebCore/svg/SVGPathElement.h
index a39e628..362a85b 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGPathElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGPathElement.h
@@ -56,8 +56,7 @@ namespace WebCore {
public SVGTests,
public SVGLangSpace,
public SVGExternalResourcesRequired,
- public SVGAnimatedPathData
- {
+ public SVGAnimatedPathData {
public:
SVGPathElement(const QualifiedName&, Document*);
virtual ~SVGPathElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl b/src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl
index 597b01d..6754d2a 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl
+++ b/src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl
@@ -26,7 +26,7 @@
module svg {
- interface [Conditional=SVG, GenerateConstructor, Polymorphic] SVGPathSeg {
+ interface [Conditional=SVG, CustomToJS, GenerateConstructor, Polymorphic] SVGPathSeg {
// Path Segment Types
const unsigned short PATHSEG_UNKNOWN = 0;
const unsigned short PATHSEG_CLOSEPATH = 1;
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGPathSegClosePath.h b/src/3rdparty/webkit/WebCore/svg/SVGPathSegClosePath.h
index eb74dea..190af9e 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGPathSegClosePath.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGPathSegClosePath.h
@@ -27,10 +27,8 @@
#include "SVGPathSeg.h"
-namespace WebCore
-{
- class SVGPathSegClosePath : public SVGPathSeg
- {
+namespace WebCore {
+ class SVGPathSegClosePath : public SVGPathSeg {
public:
static PassRefPtr<SVGPathSegClosePath> create() { return adoptRef(new SVGPathSegClosePath); }
virtual ~SVGPathSegClosePath();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h b/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h
index fe8575b..f92ed72 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h
@@ -33,8 +33,7 @@
#include "SVGTests.h"
#include "SVGZoomAndPan.h"
-namespace WebCore
-{
+namespace WebCore {
class SVGAngle;
class SVGLength;
class SVGTransform;
@@ -46,8 +45,7 @@ namespace WebCore
public SVGLangSpace,
public SVGExternalResourcesRequired,
public SVGFitToViewBox,
- public SVGZoomAndPan
- {
+ public SVGZoomAndPan {
public:
SVGSVGElement(const QualifiedName&, Document*);
virtual ~SVGSVGElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSetElement.h b/src/3rdparty/webkit/WebCore/svg/SVGSetElement.h
index d47e003..fda6919 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGSetElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGSetElement.h
@@ -26,11 +26,9 @@
#include "SVGAnimateElement.h"
-namespace WebCore
-{
+namespace WebCore {
// SVGAnimateElement implements superset of the functionality.
- class SVGSetElement : public SVGAnimateElement
- {
+ class SVGSetElement : public SVGAnimateElement {
public:
SVGSetElement(const QualifiedName&, Document*);
};
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h b/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h
index 82153d9..a2be835 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h
@@ -29,13 +29,11 @@
#include "SVGStyledTransformableElement.h"
#include "SVGTests.h"
-namespace WebCore
-{
+namespace WebCore {
class SVGSwitchElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
- public SVGExternalResourcesRequired
- {
+ public SVGExternalResourcesRequired {
public:
SVGSwitchElement(const QualifiedName&, Document*);
virtual ~SVGSwitchElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp
index 0d8560a..54a4aa2 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp
@@ -57,7 +57,7 @@ void SVGTextPathElement::parseMappedAttribute(MappedAttribute* attr)
else if (attr->name() == SVGNames::methodAttr) {
if (value == "align")
setSpacingBaseValue(SVG_TEXTPATH_METHODTYPE_ALIGN);
- else if(value == "stretch")
+ else if (value == "stretch")
setSpacingBaseValue(SVG_TEXTPATH_METHODTYPE_STRETCH);
} else if (attr->name() == SVGNames::spacingAttr) {
if (value == "auto")
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h b/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h
index e1dd938..4e8899a 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h
@@ -27,8 +27,7 @@
#include "SVGURIReference.h"
-namespace WebCore
-{
+namespace WebCore {
enum SVGTextPathMethodType {
SVG_TEXTPATH_METHODTYPE_UNKNOWN = 0,
SVG_TEXTPATH_METHODTYPE_ALIGN = 1,
@@ -42,8 +41,7 @@ namespace WebCore
};
class SVGTextPathElement : public SVGTextContentElement,
- public SVGURIReference
- {
+ public SVGURIReference {
public:
// Forward declare these enums in the w3c naming scheme, for IDL generation
enum {
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h b/src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h
index cd4768c..e053a42 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h
@@ -27,11 +27,9 @@
#include "SVGLangSpace.h"
#include "SVGStyledElement.h"
-namespace WebCore
-{
+namespace WebCore {
class SVGTitleElement : public SVGStyledElement,
- public SVGLangSpace
- {
+ public SVGLangSpace {
public:
SVGTitleElement(const QualifiedName&, Document*);
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTransformDistance.cpp b/src/3rdparty/webkit/WebCore/svg/SVGTransformDistance.cpp
index 34adc63..00b5387 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGTransformDistance.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGTransformDistance.cpp
@@ -35,6 +35,8 @@ namespace WebCore {
SVGTransformDistance::SVGTransformDistance()
: m_type(SVGTransform::SVG_TRANSFORM_UNKNOWN)
, m_angle(0)
+ , m_cx(0)
+ , m_cy(0)
{
}
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTransformList.cpp b/src/3rdparty/webkit/WebCore/svg/SVGTransformList.cpp
index ed457f4..648f1e9 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGTransformList.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGTransformList.cpp
@@ -26,7 +26,6 @@
#include "TransformationMatrix.h"
#include "SVGTransform.h"
#include "SVGSVGElement.h"
-#include "SVGTransformDistance.h"
#include "SVGTransformList.h"
using namespace WebCore;
@@ -65,23 +64,6 @@ SVGTransform SVGTransformList::concatenate() const
return SVGTransform(matrix);
}
-SVGTransform SVGTransformList::concatenateForType(SVGTransform::SVGTransformType type) const
-{
- unsigned int length = numberOfItems();
- if (!length)
- return SVGTransform();
-
- ExceptionCode ec = 0;
- SVGTransformDistance totalTransform;
- for (unsigned int i = 0; i < length; i++) {
- const SVGTransform& transform = getItem(i, ec);
- if (transform.type() == type)
- totalTransform.addSVGTransform(transform);
- }
-
- return totalTransform.addToSVGTransform(SVGTransform());
-}
-
String SVGTransformList::valueAsString() const
{
// TODO: We may want to build a real transform string, instead of concatting to a matrix(...).
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTransformList.h b/src/3rdparty/webkit/WebCore/svg/SVGTransformList.h
index 442016b..d095fe4 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGTransformList.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGTransformList.h
@@ -42,7 +42,6 @@ namespace WebCore {
// Internal use only
SVGTransform concatenate() const;
- SVGTransform concatenateForType(SVGTransform::SVGTransformType) const;
String valueAsString() const;
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTransformable.cpp b/src/3rdparty/webkit/WebCore/svg/SVGTransformable.cpp
index 6dbfc1a..17344ea 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGTransformable.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGTransformable.cpp
@@ -154,12 +154,12 @@ bool SVGTransformable::parseTransformValue(unsigned type, const UChar*& ptr, con
return true;
}
-static const UChar skewXDesc[] = {'s','k','e','w', 'X'};
-static const UChar skewYDesc[] = {'s','k','e','w', 'Y'};
-static const UChar scaleDesc[] = {'s','c','a','l', 'e'};
-static const UChar translateDesc[] = {'t','r','a','n', 's', 'l', 'a', 't', 'e'};
-static const UChar rotateDesc[] = {'r','o','t','a', 't', 'e'};
-static const UChar matrixDesc[] = {'m','a','t','r', 'i', 'x'};
+static const UChar skewXDesc[] = {'s', 'k', 'e', 'w', 'X'};
+static const UChar skewYDesc[] = {'s', 'k', 'e', 'w', 'Y'};
+static const UChar scaleDesc[] = {'s', 'c', 'a', 'l', 'e'};
+static const UChar translateDesc[] = {'t', 'r', 'a', 'n', 's', 'l', 'a', 't', 'e'};
+static const UChar rotateDesc[] = {'r', 'o', 't', 'a', 't', 'e'};
+static const UChar matrixDesc[] = {'m', 'a', 't', 'r', 'i', 'x'};
static inline bool parseAndSkipType(const UChar*& currTransform, const UChar* end, unsigned short& type)
{
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp b/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp
index 6aa3857..b12b1c2 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp
@@ -82,7 +82,7 @@ const SVGElement* SVGViewSpec::contextElement() const
return m_contextElement;
}
-static const UChar svgViewSpec[] = {'s','v','g','V', 'i', 'e', 'w'};
+static const UChar svgViewSpec[] = {'s', 'v', 'g', 'V', 'i', 'e', 'w'};
static const UChar viewBoxSpec[] = {'v', 'i', 'e', 'w', 'B', 'o', 'x'};
static const UChar preserveAspectRatioSpec[] = {'p', 'r', 'e', 's', 'e', 'r', 'v', 'e', 'A', 's', 'p', 'e', 'c', 't', 'R', 'a', 't', 'i', 'o'};
static const UChar transformSpec[] = {'t', 'r', 'a', 'n', 's', 'f', 'o', 'r', 'm'};
diff --git a/src/3rdparty/webkit/WebCore/svg/animation/SMILTime.cpp b/src/3rdparty/webkit/WebCore/svg/animation/SMILTime.cpp
index 70f9487..44e96a2 100644
--- a/src/3rdparty/webkit/WebCore/svg/animation/SMILTime.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/animation/SMILTime.cpp
@@ -35,7 +35,8 @@ const double SMILTime::unresolvedValue = DBL_MAX;
// Just a big value smaller than DBL_MAX. Our times are relative to 0, we don't really need the full range.
const double SMILTime::indefiniteValue = FLT_MAX;
-SMILTime WebCore::operator+(const SMILTime& a, const SMILTime& b) {
+SMILTime WebCore::operator+(const SMILTime& a, const SMILTime& b)
+{
if (a.isUnresolved() || b.isUnresolved())
return SMILTime::unresolved();
if (a.isIndefinite() || b.isIndefinite())
@@ -43,7 +44,8 @@ SMILTime WebCore::operator+(const SMILTime& a, const SMILTime& b) {
return a.value() + b.value();
}
-SMILTime WebCore::operator-(const SMILTime& a, const SMILTime& b) {
+SMILTime WebCore::operator-(const SMILTime& a, const SMILTime& b)
+{
if (a.isUnresolved() || b.isUnresolved())
return SMILTime::unresolved();
if (a.isIndefinite() || b.isIndefinite())
@@ -51,7 +53,8 @@ SMILTime WebCore::operator-(const SMILTime& a, const SMILTime& b) {
return a.value() - b.value();
}
-SMILTime WebCore::operator*(const SMILTime& a, const SMILTime& b) {
+SMILTime WebCore::operator*(const SMILTime& a, const SMILTime& b)
+{
if (a.isUnresolved() || b.isUnresolved())
return SMILTime::unresolved();
if (a.value() == 0 || b.value() == 0)
diff --git a/src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.h b/src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.h
index fac102e..b61f20d 100644
--- a/src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.h
+++ b/src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.h
@@ -38,8 +38,7 @@ namespace WebCore {
class SMILTimeContainer;
// This class implements SMIL interval timing model as needed for SVG animation.
- class SVGSMILElement : public SVGElement
- {
+ class SVGSMILElement : public SVGElement {
public:
SVGSMILElement(const QualifiedName&, Document*);
virtual ~SVGSMILElement();
diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp b/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp
index 227b570..4efcf2e 100644
--- a/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp
@@ -222,7 +222,7 @@ NativeImagePtr SVGImage::nativeImageForCurrentFrame()
bool SVGImage::dataChanged(bool allDataReceived)
{
// Don't do anything if is an empty image.
- if (!m_data->size())
+ if (!data()->size())
return true;
if (allDataReceived) {
@@ -251,7 +251,7 @@ bool SVGImage::dataChanged(bool allDataReceived)
loader->commitProvisionalLoad(0);
loader->setResponseMIMEType("image/svg+xml");
loader->begin(KURL()); // create the empty document
- loader->write(m_data->data(), m_data->size());
+ loader->write(data()->data(), data()->size());
loader->end();
frame->view()->setTransparent(true); // SVG Images are transparent.
}
diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/SVGResource.cpp b/src/3rdparty/webkit/WebCore/svg/graphics/SVGResource.cpp
index 82c10ba..049edc7 100644
--- a/src/3rdparty/webkit/WebCore/svg/graphics/SVGResource.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/graphics/SVGResource.cpp
@@ -50,7 +50,8 @@ struct ResourceSet {
typedef HashMap<SVGStyledElement*, ResourceSet*> ResourceClientMap;
-static ResourceClientMap& clientMap() {
+static ResourceClientMap& clientMap()
+{
DEFINE_STATIC_LOCAL(ResourceClientMap, map, ());
return map;
}
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp
index 3713c59..0f49bd7 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp
@@ -34,6 +34,7 @@
#include "WMLInputElement.h"
#include "WMLIntrinsicEventHandler.h"
#include "WMLNames.h"
+#include "WMLSelectElement.h"
#include "WMLTemplateElement.h"
#include "WMLTimerElement.h"
#include "WMLVariables.h"
@@ -165,17 +166,14 @@ void WMLCardElement::handleIntrinsicEventIfNeeded()
if (m_eventTimer)
m_eventTimer->start();
- // FIXME: Initialize select elements in this card
for (Node* node = traverseNextNode(); node != 0; node = node->traverseNextNode()) {
if (!node->isElementNode())
continue;
if (node->hasTagName(inputTag))
static_cast<WMLInputElement*>(node)->initialize();
- /*
else if (node->hasTagName(selectTag))
static_cast<WMLSelectElement*>(node)->selectInitialOptions();
- */
}
}
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLErrorHandling.cpp b/src/3rdparty/webkit/WebCore/wml/WMLErrorHandling.cpp
index a228299..87c8003 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLErrorHandling.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLErrorHandling.cpp
@@ -61,7 +61,7 @@ void reportWMLError(Document* doc, WMLErrorCode error)
if (!console)
return;
- console->addMessage(WMLMessageSource, ErrorMessageLevel, errorMessage, 0, String());
+ console->addMessage(WMLMessageSource, LogMessageType, ErrorMessageLevel, errorMessage, 0, String());
}
}
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp b/src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp
index 15ae9ca..1afc0c9 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp
@@ -54,7 +54,7 @@ void WMLPageState::reset()
m_page->backForwardList()->clearWmlPageHistory();
// reset implementation-specfic state if UA has
- m_historyLength = 1;
+ m_historyLength = 0;
}
bool WMLPageState::setNeedCheckDeckAccess(bool need)
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp
index 7d001e1..ca43f69 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp
@@ -59,7 +59,7 @@ String WMLPostfieldElement::name() const
String WMLPostfieldElement::value() const
{
- return parseValueSubstitutingVariableReferences(getAttribute(HTMLNames::valueAttr));
+ return parseValueSubstitutingVariableReferences(getAttribute(HTMLNames::valueAttr));
}
static inline CString encodedString(const TextEncoding& encoding, const String& data)
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp
index 5b5aed1..5e70098 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp
@@ -22,16 +22,21 @@
#if ENABLE(WML)
#include "WMLSelectElement.h"
-
+#include "CString.h"
#include "HTMLNames.h"
#include "MappedAttribute.h"
+#include "OptionElement.h"
#include "RenderListBox.h"
#include "RenderMenuList.h"
-
+#include "WMLDocument.h"
+#include "WMLNames.h"
+#include "WMLVariables.h"
#include <wtf/StdLibExtras.h>
namespace WebCore {
+using namespace WMLNames;
+
WMLSelectElement::WMLSelectElement(const QualifiedName& tagName, Document* document)
: WMLFormControlElement(tagName, document)
{
@@ -41,6 +46,17 @@ WMLSelectElement::~WMLSelectElement()
{
}
+String WMLSelectElement::title() const
+{
+ return substituteVariableReferences(getAttribute(HTMLNames::titleAttr), document());
+}
+
+const AtomicString& WMLSelectElement::formControlName() const
+{
+ AtomicString name = this->name();
+ return name.isNull() ? emptyAtom : name;
+}
+
const AtomicString& WMLSelectElement::formControlType() const
{
DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple"));
@@ -92,9 +108,14 @@ int WMLSelectElement::selectedIndex() const
return SelectElement::selectedIndex(m_data, this);
}
-void WMLSelectElement::setSelectedIndex(int index, bool deselect, bool fireOnChange)
+void WMLSelectElement::setSelectedIndex(int optionIndex, bool deselect)
+{
+ SelectElement::setSelectedIndex(m_data, this, optionIndex, deselect, false, false);
+}
+
+void WMLSelectElement::setSelectedIndexByUser(int optionIndex, bool deselect, bool fireOnChangeNow)
{
- SelectElement::setSelectedIndex(m_data, this, index, deselect, fireOnChange);
+ SelectElement::setSelectedIndex(m_data, this, optionIndex, deselect, fireOnChangeNow, true);
}
bool WMLSelectElement::saveFormControlState(String& value) const
@@ -151,6 +172,14 @@ void WMLSelectElement::reset()
void WMLSelectElement::defaultEventHandler(Event* event)
{
SelectElement::defaultEventHandler(m_data, this, event);
+
+ // FIXME: There must be a better place to update the page variable state. Investigate.
+ updateVariables();
+
+ if (event->defaultHandled())
+ return;
+
+ WMLFormControlElement::defaultEventHandler(event);
}
void WMLSelectElement::accessKeyAction(bool sendToAnyElement)
@@ -213,12 +242,311 @@ void WMLSelectElement::scrollToSelection()
SelectElement::scrollToSelection(m_data, this);
}
+void WMLSelectElement::selectInitialOptions()
+{
+ // Spec: Step 1 - the default option index is determined using iname and ivalue
+ calculateDefaultOptionIndices();
+
+ if (m_defaultOptionIndices.isEmpty())
+ return;
+
+ // Spec: Step 2 – initialise variables
+ initializeVariables();
+
+ // Spec: Step 3 – pre-select option(s) specified by the default option index
+ selectDefaultOptions();
+}
+
void WMLSelectElement::insertedIntoTree(bool deep)
{
SelectElement::insertedIntoTree(m_data, this);
WMLFormControlElement::insertedIntoTree(deep);
}
+void WMLSelectElement::calculateDefaultOptionIndices()
+{
+ WMLPageState* pageState = wmlPageStateForDocument(document());
+ if (!pageState)
+ return;
+
+ String variable;
+
+ // Spec: If the 'iname' attribute is specified and names a variable that is set,
+ // then the default option index is the validated value of that variable.
+ String iname = this->iname();
+ if (!iname.isEmpty()) {
+ variable = pageState->getVariable(iname);
+ if (!variable.isEmpty())
+ m_defaultOptionIndices = parseIndexValueString(variable);
+ }
+
+ // Spec: If the default option index is empty and the 'ivalue' attribute is specified,
+ // then the default option index is the validated attribute value.
+ String ivalue = this->ivalue();
+ if (m_defaultOptionIndices.isEmpty() && !ivalue.isEmpty())
+ m_defaultOptionIndices = parseIndexValueString(ivalue);
+
+ // Spec: If the default option index is empty, and the 'name' attribute is specified
+ // and the 'name' ttribute names a variable that is set, then for each value in the 'name'
+ // variable that is present as a value in the select's option elements, the index of the
+ // first option element containing that value is added to the default index if that
+ // index has not been previously added.
+ String name = this->name();
+ if (m_defaultOptionIndices.isEmpty() && !name.isEmpty()) {
+ variable = pageState->getVariable(name);
+ if (!variable.isEmpty())
+ m_defaultOptionIndices = valueStringToOptionIndices(variable);
+ }
+
+ String value = parseValueSubstitutingVariableReferences(getAttribute(HTMLNames::valueAttr));
+
+ // Spec: If the default option index is empty and the 'value' attribute is specified then
+ // for each value in the 'value' attribute that is present as a value in the select's
+ // option elements, the index of the first option element containing that value is added
+ // to the default index if that index has not been previously added.
+ if (m_defaultOptionIndices.isEmpty() && !value.isEmpty())
+ m_defaultOptionIndices = valueStringToOptionIndices(value);
+
+ // Spec: If the default option index is empty and the select is a multi-choice, then the
+ // default option index is set to zero. If the select is single-choice, then the default
+ // option index is set to one.
+ if (m_defaultOptionIndices.isEmpty())
+ m_defaultOptionIndices.append((unsigned) !m_data.multiple());
+}
+
+void WMLSelectElement::selectDefaultOptions()
+{
+ ASSERT(!m_defaultOptionIndices.isEmpty());
+
+ if (!m_data.multiple()) {
+ setSelectedIndex(m_defaultOptionIndices.first() - 1, false);
+ return;
+ }
+
+ Vector<unsigned>::const_iterator end = m_defaultOptionIndices.end();
+ for (Vector<unsigned>::const_iterator it = m_defaultOptionIndices.begin(); it != end; ++it)
+ setSelectedIndex((*it) - 1, false);
+}
+
+void WMLSelectElement::initializeVariables()
+{
+ ASSERT(!m_defaultOptionIndices.isEmpty());
+
+ WMLPageState* pageState = wmlPageStateForDocument(document());
+ if (!pageState)
+ return;
+
+ const Vector<Element*>& items = m_data.listItems(this);
+ if (items.isEmpty())
+ return;
+
+ // Spec: If the 'iname' attribute is specified, then the named variable is set with the default option index.
+ String iname = this->iname();
+ if (!iname.isEmpty())
+ pageState->storeVariable(iname, optionIndicesToString());
+
+ String name = this->name();
+ if (name.isEmpty())
+ return;
+
+ if (m_data.multiple()) {
+ // Spec: If the 'name' attribute is specified and the select is a multiple-choice element,
+ // then for each index greater than zero, the value of the 'value' attribute on the option
+ // element at the index is added to the name variable.
+ pageState->storeVariable(name, optionIndicesToValueString());
+ return;
+ }
+
+ // Spec: If the 'name' attribute is specified and the select is a single-choice element,
+ // then the named variable is set with the value of the 'value' attribute on the option
+ // element at the default option index.
+ unsigned optionIndex = m_defaultOptionIndices.first();
+ ASSERT(optionIndex >= 1);
+
+ int listIndex = optionToListIndex(optionIndex - 1);
+ ASSERT(listIndex >= 0);
+ ASSERT(listIndex < (int) items.size());
+
+ if (OptionElement* optionElement = toOptionElement(items[listIndex]))
+ pageState->storeVariable(name, optionElement->value());
+}
+
+void WMLSelectElement::updateVariables()
+{
+ WMLPageState* pageState = wmlPageStateForDocument(document());
+ if (!pageState)
+ return;
+
+ String name = this->name();
+ String iname = this->iname();
+ if (iname.isEmpty() && name.isEmpty())
+ return;
+
+ String nameString;
+ String inameString;
+
+ unsigned optionIndex = 0;
+ const Vector<Element*>& items = m_data.listItems(this);
+
+ for (unsigned i = 0; i < items.size(); ++i) {
+ OptionElement* optionElement = toOptionElement(items[i]);
+ if (!optionElement)
+ continue;
+
+ ++optionIndex;
+ if (!optionElement->selected())
+ continue;
+
+ if (!nameString.isEmpty())
+ nameString += ";";
+
+ if (!inameString.isEmpty())
+ inameString += ";";
+
+ nameString += optionElement->value();
+ inameString += String::number(optionIndex);
+ }
+
+ if (!name.isEmpty())
+ pageState->storeVariable(name, nameString);
+
+ if (!iname.isEmpty())
+ pageState->storeVariable(iname, inameString);
+}
+
+Vector<unsigned> WMLSelectElement::parseIndexValueString(const String& indexValue) const
+{
+ Vector<unsigned> indices;
+ if (indexValue.isEmpty())
+ return indices;
+
+ Vector<String> indexStrings;
+ indexValue.split(';', indexStrings);
+
+ bool ok = false;
+ unsigned optionCount = SelectElement::optionCount(m_data, this);
+
+ Vector<String>::const_iterator end = indexStrings.end();
+ for (Vector<String>::const_iterator it = indexStrings.begin(); it != end; ++it) {
+ unsigned parsedValue = (*it).toUIntStrict(&ok);
+ // Spec: Remove all non-integer indices from the value. Remove all out-of-range indices
+ // from the value, where out-of-range is defined as any index with a value greater than
+ // the number of options in the select or with a value less than one.
+ if (!ok || parsedValue < 1 || parsedValue > optionCount)
+ continue;
+
+ // Spec: Remove duplicate indices.
+ if (indices.find(parsedValue) == notFound)
+ indices.append(parsedValue);
+ }
+
+ return indices;
+}
+
+Vector<unsigned> WMLSelectElement::valueStringToOptionIndices(const String& value) const
+{
+ Vector<unsigned> indices;
+ if (value.isEmpty())
+ return indices;
+
+ const Vector<Element*>& items = m_data.listItems(this);
+ if (items.isEmpty())
+ return indices;
+
+ Vector<String> indexStrings;
+ value.split(';', indexStrings);
+
+ unsigned optionIndex = 0;
+
+ Vector<String>::const_iterator end = indexStrings.end();
+ for (Vector<String>::const_iterator it = indexStrings.begin(); it != end; ++it) {
+ String value = *it;
+
+ for (unsigned i = 0; i < items.size(); ++i) {
+ if (!isOptionElement(items[i]))
+ continue;
+
+ ++optionIndex;
+ if (OptionElement* optionElement = toOptionElement(items[i])) {
+ if (optionElement->value() == value) {
+ indices.append(optionIndex);
+ break;
+ }
+ }
+ }
+ }
+
+ return indices;
+}
+
+String WMLSelectElement::optionIndicesToValueString() const
+{
+ String valueString;
+ if (m_defaultOptionIndices.isEmpty())
+ return valueString;
+
+ const Vector<Element*>& items = m_data.listItems(this);
+ if (items.isEmpty())
+ return valueString;
+
+ Vector<unsigned>::const_iterator end = m_defaultOptionIndices.end();
+ for (Vector<unsigned>::const_iterator it = m_defaultOptionIndices.begin(); it != end; ++it) {
+ unsigned optionIndex = (*it);
+ if (optionIndex < 1 || optionIndex > items.size())
+ continue;
+
+ int listIndex = optionToListIndex((*it) - 1);
+ ASSERT(listIndex >= 0);
+ ASSERT(listIndex < (int) items.size());
+
+ if (OptionElement* optionElement = toOptionElement(items[listIndex])) {
+ if (!valueString.isEmpty())
+ valueString += ";";
+
+ valueString += optionElement->value();
+ }
+ }
+
+ return valueString;
+}
+
+String WMLSelectElement::optionIndicesToString() const
+{
+ String valueString;
+ if (m_defaultOptionIndices.isEmpty())
+ return valueString;
+
+ Vector<unsigned>::const_iterator end = m_defaultOptionIndices.end();
+ for (Vector<unsigned>::const_iterator it = m_defaultOptionIndices.begin(); it != end; ++it) {
+ if (!valueString.isEmpty())
+ valueString += ";";
+
+ valueString += String::number(*it);
+ }
+
+ return valueString;
+}
+
+String WMLSelectElement::name() const
+{
+ return parseValueForbiddingVariableReferences(getAttribute(HTMLNames::nameAttr));
+}
+
+String WMLSelectElement::value() const
+{
+ return parseValueSubstitutingVariableReferences(getAttribute(HTMLNames::valueAttr));
+}
+
+String WMLSelectElement::iname() const
+{
+ return parseValueForbiddingVariableReferences(getAttribute(inameAttr));
+}
+
+String WMLSelectElement::ivalue() const
+{
+ return parseValueSubstitutingVariableReferences(getAttribute(ivalueAttr));
+}
+
}
#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h b/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h
index 8d3e0f9..6cd3bcb 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h
+++ b/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h
@@ -32,6 +32,9 @@ public:
WMLSelectElement(const QualifiedName&, Document*);
virtual ~WMLSelectElement();
+ virtual String title() const;
+
+ virtual const AtomicString& formControlName() const;
virtual const AtomicString& formControlType() const;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
@@ -47,7 +50,8 @@ public:
virtual bool canStartSelection() const { return false; }
virtual int selectedIndex() const;
- virtual void setSelectedIndex(int index, bool deselect = true, bool fireOnChange = false);
+ virtual void setSelectedIndex(int index, bool deselect = true);
+ virtual void setSelectedIndexByUser(int index, bool deselect = true, bool fireOnChangeNow = false);
virtual int size() const { return m_data.size(); }
virtual bool multiple() const { return m_data.multiple(); }
@@ -81,11 +85,28 @@ public:
void accessKeySetSelectedIndex(int);
void setRecalcListItems();
void scrollToSelection();
+ void selectInitialOptions();
private:
virtual void insertedIntoTree(bool);
+ void calculateDefaultOptionIndices();
+ void selectDefaultOptions();
+ void initializeVariables();
+ void updateVariables();
+
+ Vector<unsigned> parseIndexValueString(const String&) const;
+ Vector<unsigned> valueStringToOptionIndices(const String&) const;
+ String optionIndicesToValueString() const;
+ String optionIndicesToString() const;
+
+ String name() const;
+ String value() const;
+ String iname() const;
+ String ivalue() const;
+
SelectElementData m_data;
+ Vector<unsigned> m_defaultOptionIndices;
};
}
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp
index f0c50cc..e59b070 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp
@@ -72,7 +72,7 @@ String WMLSetvarElement::name() const
String WMLSetvarElement::value() const
{
- return parseValueSubstitutingVariableReferences(getAttribute(HTMLNames::valueAttr));
+ return parseValueSubstitutingVariableReferences(getAttribute(HTMLNames::valueAttr));
}
}
diff --git a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp
new file mode 100644
index 0000000..120f78a
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "AbstractWorker.h"
+
+#include "Event.h"
+#include "EventException.h"
+#include "EventNames.h"
+
+namespace WebCore {
+
+AbstractWorker::AbstractWorker(ScriptExecutionContext* context)
+ : ActiveDOMObject(context, this)
+{
+}
+
+AbstractWorker::~AbstractWorker()
+{
+}
+
+void AbstractWorker::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool)
+{
+ EventListenersMap::iterator iter = m_eventListeners.find(eventType);
+ if (iter == m_eventListeners.end()) {
+ ListenerVector listeners;
+ listeners.append(eventListener);
+ m_eventListeners.add(eventType, listeners);
+ } else {
+ ListenerVector& listeners = iter->second;
+ for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
+ if (*listenerIter == eventListener)
+ return;
+ }
+
+ listeners.append(eventListener);
+ m_eventListeners.add(eventType, listeners);
+ }
+}
+
+void AbstractWorker::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool)
+{
+ EventListenersMap::iterator iter = m_eventListeners.find(eventType);
+ if (iter == m_eventListeners.end())
+ return;
+
+ ListenerVector& listeners = iter->second;
+ for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
+ if (*listenerIter == eventListener) {
+ listeners.remove(listenerIter - listeners.begin());
+ return;
+ }
+ }
+}
+
+bool AbstractWorker::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
+{
+ if (!event || event->type().isEmpty()) {
+ ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
+ return true;
+ }
+
+ ListenerVector listenersCopy = m_eventListeners.get(event->type());
+ for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) {
+ event->setTarget(this);
+ event->setCurrentTarget(this);
+ listenerIter->get()->handleEvent(event.get(), false);
+ }
+
+ return !event->defaultPrevented();
+}
+
+void AbstractWorker::dispatchLoadErrorEvent()
+{
+ RefPtr<Event> evt = Event::create(eventNames().errorEvent, false, true);
+ if (m_onErrorListener) {
+ evt->setTarget(this);
+ evt->setCurrentTarget(this);
+ m_onErrorListener->handleEvent(evt.get(), true);
+ }
+
+ ExceptionCode ec = 0;
+ dispatchEvent(evt.release(), ec);
+ ASSERT(!ec);
+}
+
+void AbstractWorker::dispatchScriptErrorEvent(const String&, const String&, int)
+{
+ //FIXME: Generate an ErrorEvent instead of a simple event
+ dispatchLoadErrorEvent();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h
new file mode 100644
index 0000000..89e4258
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#ifndef AbstractWorker_h
+#define AbstractWorker_h
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "ActiveDOMObject.h"
+#include "AtomicStringHash.h"
+#include "EventListener.h"
+#include "EventTarget.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class ScriptExecutionContext;
+
+ class AbstractWorker : public RefCounted<AbstractWorker>, public ActiveDOMObject, public EventTarget {
+ public:
+ // EventTarget APIs
+ virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
+
+ virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+ virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
+ virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&);
+
+ // Utility routines to generate appropriate error events for loading and script exceptions.
+ void dispatchLoadErrorEvent();
+ void dispatchScriptErrorEvent(const String& errorMessage, const String& sourceURL, int);
+
+ void setOnerror(PassRefPtr<EventListener> eventListener) { m_onErrorListener = eventListener; }
+ EventListener* onerror() const { return m_onErrorListener.get(); }
+ typedef Vector<RefPtr<EventListener> > ListenerVector;
+ typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
+ EventListenersMap& eventListeners() { return m_eventListeners; }
+
+ using RefCounted<AbstractWorker>::ref;
+ using RefCounted<AbstractWorker>::deref;
+
+ AbstractWorker(ScriptExecutionContext*);
+ virtual ~AbstractWorker();
+
+ private:
+
+ virtual void refEventTarget() { ref(); }
+ virtual void derefEventTarget() { deref(); }
+
+ RefPtr<EventListener> m_onErrorListener;
+ EventListenersMap m_eventListeners;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
+
+#endif // AbstractWorker_h
diff --git a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl
new file mode 100644
index 0000000..1234c0d
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+module threads {
+
+ interface [
+ Conditional=SHARED_WORKERS,
+ CustomMarkFunction,
+ CustomToJS,
+ GenerateConstructor
+ ] AbstractWorker {
+
+ attribute EventListener onerror;
+
+ [Custom] void addEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
+ [Custom] void removeEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
+ boolean dispatchEvent(in Event evt)
+ raises(EventException);
+ };
+
+}
diff --git a/src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h b/src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h
index 96b0e70..d6a9994 100644
--- a/src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h
+++ b/src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h
@@ -36,6 +36,7 @@
#include "CrossThreadCopier.h"
#include "ScriptExecutionContext.h"
#include <memory>
+#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/TypeTraits.h>
@@ -58,6 +59,10 @@ namespace WebCore {
typedef PassRefPtr<T> ParamType;
};
+ template<typename T> struct GenericWorkerTaskTraits<PassOwnPtr<T> > {
+ typedef PassOwnPtr<T> ParamType;
+ };
+
template<typename P1, typename MP1>
class GenericWorkerTask1 : public ScriptExecutionContext::Task {
public:
@@ -323,6 +328,56 @@ namespace WebCore {
P6 m_parameter6;
P7 m_parameter7;
};
+
+ template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
+ class GenericWorkerTask8 : public ScriptExecutionContext::Task {
+ public:
+ typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8);
+ typedef GenericWorkerTask8<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7, P8, MP8> GenericWorkerTask;
+ typedef typename GenericWorkerTaskTraits<P1>::ParamType Param1;
+ typedef typename GenericWorkerTaskTraits<P2>::ParamType Param2;
+ typedef typename GenericWorkerTaskTraits<P3>::ParamType Param3;
+ typedef typename GenericWorkerTaskTraits<P4>::ParamType Param4;
+ typedef typename GenericWorkerTaskTraits<P5>::ParamType Param5;
+ typedef typename GenericWorkerTaskTraits<P6>::ParamType Param6;
+ typedef typename GenericWorkerTaskTraits<P7>::ParamType Param7;
+ typedef typename GenericWorkerTaskTraits<P8>::ParamType Param8;
+
+ static PassRefPtr<GenericWorkerTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
+ {
+ return adoptRef(new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8));
+ }
+
+ private:
+ GenericWorkerTask8(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
+ : m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ , m_parameter3(parameter3)
+ , m_parameter4(parameter4)
+ , m_parameter5(parameter5)
+ , m_parameter6(parameter6)
+ , m_parameter7(parameter7)
+ , m_parameter8(parameter8)
+ {
+ }
+
+ virtual void performTask(ScriptExecutionContext* context)
+ {
+ (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6, m_parameter7, m_parameter8);
+ }
+
+ private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+ P3 m_parameter3;
+ P4 m_parameter4;
+ P5 m_parameter5;
+ P6 m_parameter6;
+ P7 m_parameter7;
+ P8 m_parameter8;
+ };
template<typename P1, typename MP1>
PassRefPtr<ScriptExecutionContext::Task> createCallbackTask(
@@ -408,6 +463,21 @@ namespace WebCore {
CrossThreadCopier<P7>::copy(parameter7));
}
+ template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
+ PassRefPtr<ScriptExecutionContext::Task> createCallbackTask(
+ void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8),
+ const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7, const P8& parameter8)
+ {
+ return GenericWorkerTask8<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
+ typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6,
+ typename CrossThreadCopier<P7>::Type, MP7, typename CrossThreadCopier<P8>::Type, MP8>::create(
+ method,
+ CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
+ CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4),
+ CrossThreadCopier<P5>::copy(parameter5), CrossThreadCopier<P6>::copy(parameter6),
+ CrossThreadCopier<P7>::copy(parameter7), CrossThreadCopier<P8>::copy(parameter8));
+ }
+
} // namespace WebCore
#endif // ENABLE(WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp b/src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp
new file mode 100644
index 0000000..e1d30d3
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+#include "config.h"
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "SharedWorker.h"
+
+#include "MessagePort.h"
+
+namespace WebCore {
+
+SharedWorker::SharedWorker(const String&, const String&, ScriptExecutionContext* context, ExceptionCode&)
+ : AbstractWorker(context)
+{
+ // Placeholder - ultimately we'll look up the worker in the SharedWorkerRepository.
+}
+
+SharedWorker::~SharedWorker()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/workers/SharedWorker.h b/src/3rdparty/webkit/WebCore/workers/SharedWorker.h
new file mode 100644
index 0000000..36c7d85
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/SharedWorker.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#ifndef SharedWorker_h
+#define SharedWorker_h
+
+#include "AbstractWorker.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+
+namespace WebCore {
+
+ class SharedWorker : public AbstractWorker {
+ public:
+ static PassRefPtr<SharedWorker> create(const String& url, const String& name, ScriptExecutionContext* context, ExceptionCode& ec)
+ {
+ return adoptRef(new SharedWorker(url, name, context, ec));
+ }
+ ~SharedWorker();
+ MessagePort* port() const { return m_port.get(); }
+
+ virtual SharedWorker* toSharedWorker() { return this; }
+
+ private:
+ SharedWorker(const String& url, const String& name, ScriptExecutionContext*, ExceptionCode&);
+
+ RefPtr<MessagePort> m_port;
+ };
+
+} // namespace WebCore
+
+#endif // SharedWorker_h
diff --git a/src/3rdparty/webkit/WebCore/workers/SharedWorker.idl b/src/3rdparty/webkit/WebCore/workers/SharedWorker.idl
new file mode 100644
index 0000000..09475f7
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/SharedWorker.idl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+module threads {
+
+ interface [
+ Conditional=SHARED_WORKERS,
+ CustomMarkFunction,
+ GenerateNativeConverter,
+ GenerateToJS
+ ] SharedWorker : AbstractWorker {
+ readonly attribute MessagePort port;
+ };
+
+}
diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.cpp b/src/3rdparty/webkit/WebCore/workers/Worker.cpp
index a810dda..2e03e3d 100644
--- a/src/3rdparty/webkit/WebCore/workers/Worker.cpp
+++ b/src/3rdparty/webkit/WebCore/workers/Worker.cpp
@@ -77,9 +77,18 @@ Worker::~Worker()
m_contextProxy->workerObjectDestroyed();
}
-void Worker::postMessage(const String& message)
+void Worker::postMessage(const String& message, ExceptionCode& ec)
{
- m_contextProxy->postMessageToWorkerContext(message);
+ postMessage(message, 0, ec);
+}
+
+void Worker::postMessage(const String& message, MessagePort* messagePort, ExceptionCode& ec)
+{
+ // Disentangle the port in preparation for sending it to the remote context.
+ OwnPtr<MessagePortChannel> channel = messagePort ? messagePort->disentangle(ec) : 0;
+ if (ec)
+ return;
+ m_contextProxy->postMessageToWorkerContext(message, channel.release());
}
void Worker::terminate()
@@ -180,9 +189,9 @@ bool Worker::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
return !event->defaultPrevented();
}
-void Worker::dispatchMessage(const String& message)
+void Worker::dispatchMessage(const String& message, PassRefPtr<MessagePort> port)
{
- RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, 0);
+ RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, port);
if (m_onMessageListener.get()) {
evt->setTarget(this);
diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.h b/src/3rdparty/webkit/WebCore/workers/Worker.h
index bd9e556..1fcc8be 100644
--- a/src/3rdparty/webkit/WebCore/workers/Worker.h
+++ b/src/3rdparty/webkit/WebCore/workers/Worker.h
@@ -58,11 +58,12 @@ namespace WebCore {
virtual Worker* toWorker() { return this; }
- void postMessage(const String& message);
+ void postMessage(const String&, ExceptionCode&);
+ void postMessage(const String&, MessagePort*, ExceptionCode&);
void terminate();
- void dispatchMessage(const String&);
+ void dispatchMessage(const String&, PassRefPtr<MessagePort>);
void dispatchErrorEvent();
virtual bool canSuspend() const;
diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.idl b/src/3rdparty/webkit/WebCore/workers/Worker.idl
index 2ef9b62..e078e7c 100644
--- a/src/3rdparty/webkit/WebCore/workers/Worker.idl
+++ b/src/3rdparty/webkit/WebCore/workers/Worker.idl
@@ -30,7 +30,8 @@ module threads {
attribute EventListener onerror;
attribute EventListener onmessage;
- void postMessage(in DOMString message);
+ void postMessage(in DOMString message, in [Optional] MessagePort messagePort)
+ raises(DOMException);
void terminate();
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp
index fd05062..8e9fb97 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp
@@ -130,6 +130,14 @@ bool WorkerContext::hasPendingActivity() const
if (iter->first->hasPendingActivity())
return true;
}
+
+ // Keep the worker active as long as there is a MessagePort with pending activity or that is remotely entangled.
+ HashSet<MessagePort*>::const_iterator messagePortsEnd = messagePorts().end();
+ for (HashSet<MessagePort*>::const_iterator iter = messagePorts().begin(); iter != messagePortsEnd; ++iter) {
+ if ((*iter)->hasPendingActivity() || ((*iter)->isEntangled() && !(*iter)->locallyEntangledPort()))
+ return true;
+ }
+
return false;
}
@@ -138,9 +146,9 @@ void WorkerContext::reportException(const String& errorMessage, int lineNumber,
m_thread->workerObjectProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL);
}
-void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
{
- m_thread->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, level, message, lineNumber, sourceURL);
+ m_thread->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL);
}
void WorkerContext::resourceRetrievedByXMLHttpRequest(unsigned long, const ScriptString&)
@@ -155,12 +163,20 @@ void WorkerContext::scriptImported(unsigned long, const String&)
notImplemented();
}
-void WorkerContext::postMessage(const String& message)
+void WorkerContext::postMessage(const String& message, ExceptionCode& ec)
+{
+ postMessage(message, 0, ec);
+}
+
+void WorkerContext::postMessage(const String& message, MessagePort* port, ExceptionCode& ec)
{
if (m_closing)
return;
-
- m_thread->workerObjectProxy().postMessageToWorkerObject(message);
+ // Disentangle the port in preparation for sending it to the remote context.
+ OwnPtr<MessagePortChannel> channel = port ? port->disentangle(ec) : 0;
+ if (ec)
+ return;
+ m_thread->workerObjectProxy().postMessageToWorkerObject(message, channel.release());
}
void WorkerContext::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool)
@@ -239,11 +255,11 @@ void WorkerContext::clearInterval(int timeoutId)
DOMTimer::removeById(scriptExecutionContext(), timeoutId);
}
-void WorkerContext::dispatchMessage(const String& message)
+void WorkerContext::dispatchMessage(const String& message, PassRefPtr<MessagePort> port)
{
// Since close() stops the thread event loop, this should not ever get called while closing.
ASSERT(!m_closing);
- RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, 0);
+ RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, port);
if (m_onmessageListener.get()) {
evt->setTarget(this);
@@ -283,7 +299,7 @@ void WorkerContext::importScripts(const Vector<String>& urls, const String& call
}
scriptExecutionContext()->scriptImported(scriptLoader.identifier(), scriptLoader.script());
- scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageLevel, "Worker script imported: \"" + *it + "\".", callerLine, callerURL);
+ scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageType, LogMessageLevel, "Worker script imported: \"" + *it + "\".", callerLine, callerURL);
ScriptValue exception;
m_script->evaluate(ScriptSourceCode(scriptLoader.script(), *it), &exception);
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.h b/src/3rdparty/webkit/WebCore/workers/WorkerContext.h
index ce782f8..16f43fd 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.h
@@ -74,13 +74,12 @@ namespace WebCore {
bool hasPendingActivity() const;
virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
- virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+ virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
virtual void scriptImported(unsigned long identifier, const String& sourceString);
virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously.
-
// WorkerGlobalScope
WorkerContext* self() { return this; }
WorkerLocation* location() const;
@@ -90,9 +89,9 @@ namespace WebCore {
void importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode&);
WorkerNavigator* navigator() const;
-
// DedicatedWorkerGlobalScope
- void postMessage(const String& message);
+ void postMessage(const String&, ExceptionCode&);
+ void postMessage(const String&, MessagePort*, ExceptionCode&);
void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessageListener = eventListener; }
EventListener* onmessage() const { return m_onmessageListener.get(); }
@@ -111,7 +110,7 @@ namespace WebCore {
typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
EventListenersMap& eventListeners() { return m_eventListeners; }
- void dispatchMessage(const String&);
+ void dispatchMessage(const String&, PassRefPtr<MessagePort>);
// These methods are used for GC marking. See JSWorkerContext::mark() in
// JSWorkerContextCustom.cpp.
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl b/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl
index 9d5aa79..709410a 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl
@@ -41,7 +41,6 @@ module threads {
#endif
attribute [Replaceable] WorkerLocation location;
void close();
- // attribute EventListener onclose;
// attribute EventListener onerror;
// WorkerUtils
@@ -52,10 +51,10 @@ module threads {
// DedicatedWorkerGlobalScope
- void postMessage(in DOMString message);
+ void postMessage(in DOMString message, in [Optional] MessagePort messagePort)
+ raises(DOMException);
attribute EventListener onmessage;
-
// Timers
[Custom] long setTimeout(in TimeoutHandler handler, in long timeout);
// [Custom] long setTimeout(in DOMString code, in long timeout);
@@ -80,6 +79,9 @@ module threads {
attribute MessageEventConstructor MessageEvent;
attribute WorkerLocationConstructor WorkerLocation;
+#if ENABLE_CHANNEL_MESSAGING
+ attribute [JSCCustomGetter] MessageChannelConstructor MessageChannel;
+#endif
attribute [JSCCustomGetter] XMLHttpRequestConstructor XMLHttpRequest;
};
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h b/src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h
index c8f5761..f42527e 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h
@@ -33,9 +33,12 @@
#if ENABLE(WORKERS)
+#include <wtf/PassOwnPtr.h>
+
namespace WebCore {
class KURL;
+ class MessagePortChannel;
class String;
class Worker;
@@ -50,7 +53,7 @@ namespace WebCore {
virtual void terminateWorkerContext() = 0;
- virtual void postMessageToWorkerContext(const String&) = 0;
+ virtual void postMessageToWorkerContext(const String&, PassOwnPtr<MessagePortChannel>) = 0;
virtual bool hasPendingActivity() const = 0;
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h b/src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h
index b51f480..ac7cda1 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h
@@ -33,11 +33,11 @@
#if ENABLE(WORKERS)
+#include "ScriptExecutionContext.h"
#include <wtf/PassRefPtr.h>
namespace WebCore {
- class ScriptExecutionContext::Task;
class String;
// A proxy to talk to the loader context. Normally, the document on the main thread
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp
index a6d0d5d..b6e1642 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp
@@ -44,14 +44,15 @@ namespace WebCore {
class MessageWorkerContextTask : public ScriptExecutionContext::Task {
public:
- static PassRefPtr<MessageWorkerContextTask> create(const String& message)
+ static PassRefPtr<MessageWorkerContextTask> create(const String& message, PassOwnPtr<MessagePortChannel> channel)
{
- return adoptRef(new MessageWorkerContextTask(message));
+ return adoptRef(new MessageWorkerContextTask(message, channel));
}
private:
- MessageWorkerContextTask(const String& message)
+ MessageWorkerContextTask(const String& message, PassOwnPtr<MessagePortChannel> channel)
: m_message(message.copy())
+ , m_channel(channel)
{
}
@@ -59,41 +60,52 @@ private:
{
ASSERT(scriptContext->isWorkerContext());
WorkerContext* context = static_cast<WorkerContext*>(scriptContext);
-
- context->dispatchMessage(m_message);
-
+ RefPtr<MessagePort> port;
+ if (m_channel) {
+ port = MessagePort::create(*scriptContext);
+ port->entangle(m_channel.release());
+ }
+ context->dispatchMessage(m_message, port.release());
context->thread()->workerObjectProxy().confirmMessageFromWorkerObject(context->hasPendingActivity());
}
private:
String m_message;
+ OwnPtr<MessagePortChannel> m_channel;
};
class MessageWorkerTask : public ScriptExecutionContext::Task {
public:
- static PassRefPtr<MessageWorkerTask> create(const String& message, WorkerMessagingProxy* messagingProxy)
+ static PassRefPtr<MessageWorkerTask> create(const String& message, PassOwnPtr<MessagePortChannel> channel, WorkerMessagingProxy* messagingProxy)
{
- return adoptRef(new MessageWorkerTask(message, messagingProxy));
+ return adoptRef(new MessageWorkerTask(message, channel, messagingProxy));
}
private:
- MessageWorkerTask(const String& message, WorkerMessagingProxy* messagingProxy)
+ MessageWorkerTask(const String& message, PassOwnPtr<MessagePortChannel> channel, WorkerMessagingProxy* messagingProxy)
: m_message(message.copy())
+ , m_channel(channel)
, m_messagingProxy(messagingProxy)
{
}
- virtual void performTask(ScriptExecutionContext*)
+ virtual void performTask(ScriptExecutionContext* scriptContext)
{
Worker* workerObject = m_messagingProxy->workerObject();
if (!workerObject || m_messagingProxy->askedToTerminate())
return;
- workerObject->dispatchMessage(m_message);
+ RefPtr<MessagePort> port;
+ if (m_channel) {
+ port = MessagePort::create(*scriptContext);
+ port->entangle(m_channel.release());
+ }
+ workerObject->dispatchMessage(m_message, port.release());
}
private:
String m_message;
+ OwnPtr<MessagePortChannel> m_channel;
WorkerMessagingProxy* m_messagingProxy;
};
@@ -205,21 +217,21 @@ void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const Strin
thread->start();
}
-void WorkerMessagingProxy::postMessageToWorkerObject(const String& message)
+void WorkerMessagingProxy::postMessageToWorkerObject(const String& message, PassOwnPtr<MessagePortChannel> channel)
{
- m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, this));
+ m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, channel, this));
}
-void WorkerMessagingProxy::postMessageToWorkerContext(const String& message)
+void WorkerMessagingProxy::postMessageToWorkerContext(const String& message, PassOwnPtr<MessagePortChannel> channel)
{
if (m_askedToTerminate)
return;
if (m_workerThread) {
++m_unconfirmedMessageCount;
- m_workerThread->runLoop().postTask(MessageWorkerContextTask::create(message));
+ m_workerThread->runLoop().postTask(MessageWorkerContextTask::create(message, channel));
} else
- m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message));
+ m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message, channel));
}
void WorkerMessagingProxy::postTaskForModeToWorkerContext(PassRefPtr<ScriptExecutionContext::Task> task, const String& mode)
@@ -243,16 +255,16 @@ void WorkerMessagingProxy::postExceptionToWorkerObject(const String& errorMessag
m_scriptExecutionContext->postTask(WorkerExceptionTask::create(errorMessage, lineNumber, sourceURL, this));
}
-static void postConsoleMessageTask(ScriptExecutionContext* context, WorkerMessagingProxy* messagingProxy, MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+static void postConsoleMessageTask(ScriptExecutionContext* context, WorkerMessagingProxy* messagingProxy, MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
{
if (messagingProxy->askedToTerminate())
return;
- context->addMessage(destination, source, level, message, lineNumber, sourceURL);
+ context->addMessage(destination, source, type, level, message, lineNumber, sourceURL);
}
-void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageDestination destination, MessageSource source, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
+void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
{
- m_scriptExecutionContext->postTask(createCallbackTask(&postConsoleMessageTask, this, destination, source, level, message, lineNumber, sourceURL));
+ m_scriptExecutionContext->postTask(createCallbackTask(&postConsoleMessageTask, this, destination, source, type, level, message, lineNumber, sourceURL));
}
void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<WorkerThread> workerThread)
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h
index 7fc9797..f9e1cd4 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h
@@ -34,12 +34,14 @@
#include "WorkerLoaderProxy.h"
#include "WorkerObjectProxy.h"
#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
+ class MessagePortChannel;
class ScriptExecutionContext;
class String;
class Worker;
@@ -53,15 +55,15 @@ namespace WebCore {
// (Only use these methods in the worker object thread.)
virtual void startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode);
virtual void terminateWorkerContext();
- virtual void postMessageToWorkerContext(const String& message);
+ virtual void postMessageToWorkerContext(const String&, PassOwnPtr<MessagePortChannel>);
virtual bool hasPendingActivity() const;
virtual void workerObjectDestroyed();
// Implementations of WorkerObjectProxy.
// (Only use these methods in the worker context thread.)
- virtual void postMessageToWorkerObject(const String& message);
+ virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannel>);
virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL);
- virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
+ virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
virtual void confirmMessageFromWorkerObject(bool hasPendingActivity);
virtual void reportPendingActivity(bool hasPendingActivity);
virtual void workerContextDestroyed();
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h b/src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h
index 3b86028..c5f4456 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h
@@ -35,8 +35,11 @@
#include "Console.h"
+#include <wtf/PassOwnPtr.h>
+
namespace WebCore {
+ class MessagePortChannel;
class String;
// A proxy to talk to the worker object.
@@ -44,11 +47,11 @@ namespace WebCore {
public:
virtual ~WorkerObjectProxy() {}
- virtual void postMessageToWorkerObject(const String&) = 0;
+ virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannel>) = 0;
virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
- virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0;
+ virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0;
virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0;
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp
index 1e5e510..b6f6487 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp
@@ -125,8 +125,7 @@ String WorkerRunLoop::defaultMode()
return String();
}
-class RunLoopSetup : Noncopyable
-{
+class RunLoopSetup : Noncopyable {
public:
RunLoopSetup(WorkerRunLoop& runLoop)
: m_runLoop(runLoop)
diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp
index 59cacbd..5e20252 100644
--- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp
+++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp
@@ -22,6 +22,7 @@
#include "config.h"
#include "XMLHttpRequest.h"
+#include "Cache.h"
#include "CString.h"
#include "CrossOriginAccessControl.h"
#include "CrossOriginPreflightResultCache.h"
@@ -145,6 +146,7 @@ XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context)
, m_uploadComplete(false)
, m_sameOriginRequest(true)
, m_inPreflight(false)
+ , m_didTellLoaderAboutRequest(false)
, m_receivedLength(0)
, m_lastSendLineNumber(0)
, m_exceptionCode(0)
@@ -154,6 +156,10 @@ XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context)
XMLHttpRequest::~XMLHttpRequest()
{
+ if (m_didTellLoaderAboutRequest) {
+ cache()->loader()->nonCacheRequestComplete(m_url);
+ m_didTellLoaderAboutRequest = false;
+ }
if (m_upload)
m_upload->disconnectXMLHttpRequest();
}
@@ -681,6 +687,16 @@ void XMLHttpRequest::loadRequestAsynchronously(ResourceRequest& request)
// a request is in progress because we need to keep the listeners alive,
// and they are referenced by the JavaScript wrapper.
setPendingActivity(this);
+
+ // For now we should only balance the nonCached request count for main-thread XHRs and not
+ // Worker XHRs, as the Cache is not thread-safe.
+ // This will become irrelevant after https://bugs.webkit.org/show_bug.cgi?id=27165 is resolved.
+ if (!scriptExecutionContext()->isWorkerContext()) {
+ ASSERT(isMainThread());
+ ASSERT(!m_didTellLoaderAboutRequest);
+ cache()->loader()->nonCacheRequestInFlight(m_url);
+ m_didTellLoaderAboutRequest = true;
+ }
}
}
@@ -788,9 +804,9 @@ void XMLHttpRequest::dropProtection()
// can't be recouped until the load is done, so only
// report the extra cost at that point.
- if (JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext()))
- if (DOMObject* wrapper = getCachedDOMObjectWrapper(*globalObject->globalData(), this))
- JSC::Heap::heap(wrapper)->reportExtraMemoryCost(m_responseText.size() * 2);
+ if (JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext()))
+ if (DOMObject* wrapper = getCachedDOMObjectWrapper(*globalObject->globalData(), this))
+ JSC::Heap::heap(wrapper)->reportExtraMemoryCost(m_responseText.size() * 2);
#endif
unsetPendingActivity(this);
@@ -807,7 +823,7 @@ static void reportUnsafeUsage(ScriptExecutionContext* context, const String& mes
return;
// FIXME: It's not good to report the bad usage without indicating what source line it came from.
// We should pass additional parameters so we can tell the console where the mistake occurred.
- context->addMessage(ConsoleDestination, JSMessageSource, ErrorMessageLevel, message, 1, String());
+ context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String());
}
void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& value, ExceptionCode& ec)
@@ -961,6 +977,11 @@ String XMLHttpRequest::statusText(ExceptionCode& ec) const
void XMLHttpRequest::didFail(const ResourceError& error)
{
+ if (m_didTellLoaderAboutRequest) {
+ cache()->loader()->nonCacheRequestComplete(m_url);
+ m_didTellLoaderAboutRequest = false;
+ }
+
// If we are already in an error state, for instance we called abort(), bail out early.
if (m_error)
return;
@@ -982,6 +1003,11 @@ void XMLHttpRequest::didFailRedirectCheck()
void XMLHttpRequest::didFinishLoading(unsigned long identifier)
{
+ if (m_didTellLoaderAboutRequest) {
+ cache()->loader()->nonCacheRequestComplete(m_url);
+ m_didTellLoaderAboutRequest = false;
+ }
+
if (m_error)
return;
@@ -997,7 +1023,7 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier)
m_responseText += m_decoder->flush();
scriptExecutionContext()->resourceRetrievedByXMLHttpRequest(identifier, m_responseText);
- scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageLevel, "XHR finished loading: \"" + m_url + "\".", m_lastSendLineNumber, m_lastSendURL);
+ scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + m_url + "\".", m_lastSendLineNumber, m_lastSendURL);
bool hadLoader = m_loader;
m_loader = 0;
diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h
index 6955c11..d581d3d 100644
--- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h
+++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h
@@ -225,6 +225,7 @@ private:
bool m_sameOriginRequest;
bool m_allowAccess;
bool m_inPreflight;
+ bool m_didTellLoaderAboutRequest;
// Used for onprogress tracking
long long m_receivedLength;
diff --git a/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp b/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp
index 1f1d985..da39443 100644
--- a/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp
+++ b/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp
@@ -667,12 +667,12 @@ Value FunRound::evaluate() const
return round(arg(0)->evaluate().toNumber());
}
-struct FunctionMapping {
- const char *name;
- FunctionRec function;
-};
static void createFunctionMap()
{
+ struct FunctionMapping {
+ const char *name;
+ FunctionRec function;
+ };
static const FunctionMapping functions[] = {
{ "boolean", { &createFunBoolean, 1 } },
{ "ceiling", { &createFunCeiling, 1 } },
diff --git a/src/3rdparty/webkit/WebCore/xml/XPathPath.h b/src/3rdparty/webkit/WebCore/xml/XPathPath.h
index dc77971..7dd17d9 100644
--- a/src/3rdparty/webkit/WebCore/xml/XPathPath.h
+++ b/src/3rdparty/webkit/WebCore/xml/XPathPath.h
@@ -72,8 +72,7 @@ namespace WebCore {
bool m_absolute;
};
- class Path : public Expression
- {
+ class Path : public Expression {
public:
Path(Filter*, LocationPath*);
virtual ~Path();
diff --git a/src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp b/src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp
index 3865124..a26fe77 100644
--- a/src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp
+++ b/src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp
@@ -99,7 +99,7 @@ void XSLTProcessor::parseErrorFunc(void* userData, xmlError* error)
break;
}
- console->addMessage(XMLMessageSource, level, error->message, error->line, error->file);
+ console->addMessage(XMLMessageSource, LogMessageType, level, error->message, error->line, error->file);
}
// FIXME: There seems to be no way to control the ctxt pointer for loading here, thus we have globals.
diff --git a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri
index 73a5e5c..73288ab 100644
--- a/src/3rdparty/webkit/WebKit.pri
+++ b/src/3rdparty/webkit/WebKit.pri
@@ -21,7 +21,11 @@ building-libs {
LIBS += -framework QtWebKit
QMAKE_FRAMEWORKPATH = $$OUTPUT_DIR/lib $$QMAKE_FRAMEWORKPATH
} else {
- LIBS += -lQtWebKit
+ win32-*|wince* {
+ LIBS += -lQtWebKit$${QT_MAJOR_VERSION}
+ } else {
+ LIBS += -lQtWebKit
+ }
}
}
DEPENDPATH += $$PWD/WebKit/qt/Api
diff --git a/src/3rdparty/webkit/WebKit/ChangeLog b/src/3rdparty/webkit/WebKit/ChangeLog
index f07a75c..cabdf46 100644
--- a/src/3rdparty/webkit/WebKit/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/ChangeLog
@@ -1,3 +1,42 @@
+2009-07-10 Adam Roben <aroben@apple.com>
+
+ Sort all our Xcode projects
+
+ Accomplished using sort-Xcode-project-file.
+
+ Requested by Dave Kilzer.
+
+ * WebKit.xcodeproj/project.pbxproj:
+
+2009-07-02 Adam Roben <aroben@apple.com>
+
+ Fix warnings from update-webkit-localizable-strings
+
+ Rubber-stamped by Eric Carlson.
+
+ * English.lproj/Localizable.strings: Updated.
+
+2009-07-02 Adam Roben <aroben@apple.com>
+
+ Update StringsNotToBeLocalized.txt for (not so) recent changes
+
+ Bug 26926: StringsNotToBeLocalized.txt is out-of-date
+ <https://bugs.webkit.org/show_bug.cgi?id=26926>
+
+ Reviewed by John Sullivan.
+
+ * StringsNotToBeLocalized.txt:
+
+2009-07-02 Pierre d'Herbemont <pdherbemont@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/6518119>
+
+ Add localized strings for media controller status messages.
+
+ * English.lproj/Localizable.strings: Localized text.
+
2009-06-08 Dan Bernstein <mitz@apple.com>
Rubber-stamped by Mark Rowe.
diff --git a/src/3rdparty/webkit/WebKit/StringsNotToBeLocalized.txt b/src/3rdparty/webkit/WebKit/StringsNotToBeLocalized.txt
index 003de11..7e593ca 100644
--- a/src/3rdparty/webkit/WebKit/StringsNotToBeLocalized.txt
+++ b/src/3rdparty/webkit/WebKit/StringsNotToBeLocalized.txt
@@ -402,7 +402,6 @@
"WebViewDidChangeTypingStyleNotification"
"WebViewDidEndEditingNotification"
"WebViewWindowClass"
-"WhatsNewPanel"
"Windows %d.%d"
"Windows 95"
"Windows 98"
@@ -465,7 +464,6 @@
"com.adobe.dreamweaver-9.0"
"com.alientechnology.Proteus"
"com.app4mac.KidsBrowsercom.app4mac.wKiosk"
-"com.apple."
"com.apple.Aperture"
"com.apple.AppKit"
"com.apple.Automator"
@@ -477,6 +475,7 @@
"com.apple.JavaAppletPlugin"
"com.apple.JavaPluginCocoa"
"com.apple.KeyboardUIModeDidChange"
+"com.apple.Mail"
"com.apple.QuickTime Plugin.plugin"
"com.apple.Safari"
"com.apple.WebCore"
@@ -496,7 +495,9 @@
"com.barebones.textwrangler"
"com.barebones.yojimbo"
"com.culturedcode.xyle"
+"com.e-frontier.shade10"
"com.equinux.iSale4"
+"com.equinux.iSale5"
"com.freeverse.bumpercar"
"com.growl.growlframework"
"com.intrarts.PandoraMan"
@@ -539,7 +540,6 @@
"https"
"https:"
"i"
-"iLifeWelcomePanel"
"icon.db"
"image.pict"
"image.png"
@@ -690,6 +690,8 @@ WebKit/mac/WebCoreSupport/WebEditorClient.mm:"Enter"
WebKit/mac/WebCoreSupport/WebEditorClient.mm:"Up"
WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:"height"
WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:"width"
+WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"Menlo"
+WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"Monaco"
WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"Web Inspector 2"
WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"inspector"
WebKit/mac/WebView/WebHTMLView.mm:"'%@'"
@@ -742,6 +744,7 @@ WebKit/win/ProgIDMacros.h:"WebKit."
WebKit/win/WebCache.cpp:"images"
WebKit/win/WebCache.cpp:"scripts"
WebKit/win/WebCache.cpp:"style sheets"
+WebKit/win/WebCoreSupport/WebInspectorClient.cpp:"Courier New"
WebKit/win/WebCoreSupport/WebInspectorClient.cpp:"Web Inspector "
WebKit/win/WebCoreSupport/WebInspectorClient.cpp:"Web Inspector"
WebKit/win/WebCoreSupport/WebInspectorClient.cpp:"inspector"
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri
index e4bb618..d92eb1c 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri
+++ b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri
@@ -6,4 +6,6 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \
$$PWD/qwebhistoryinterface.h \
$$PWD/qwebdatabase.h \
$$PWD/qwebsecurityorigin.h \
- $$PWD/qwebelement.h
+ $$PWD/qwebelement.h \
+ $$PWD/qwebpluginfactory.h \
+ $$PWD/qwebhistory.h
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp
index 2db9cd0..0d11381 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp
@@ -34,9 +34,20 @@ using namespace WebCore;
\brief The QWebDatabase class provides access to HTML 5 databases created with JavaScript.
The upcoming HTML 5 standard includes support for SQL databases that web sites can create and
- access on a local computer through JavaScript. QWebDatabase is the C++ interface to these databases.
+ access on a local computer through JavaScript. QWebDatabase is the C++ interface to these
+ databases.
- For more information refer to the \l{http://www.w3.org/html/wg/html5/#sql}{HTML 5 Draft Standard}.
+ To get access to all databases defined by a security origin, use QWebSecurityOrigin::databases().
+ Each database has an internal name(), as well as a user-friendly name, provided by displayName().
+
+ WebKit uses SQLite to create and access the local SQL databases. The location of the database
+ file in the local file system is returned by fileName(). You can access the database directly
+ through the QtSql database module.
+
+ For each database the web site can define an expectedSize(). The current size of the database
+ in bytes is returned by size().
+
+ For more information refer to the \l{http://dev.w3.org/html5/webdatabase/}{HTML 5 Draft Standard}.
\sa QWebSecurityOrigin
*/
@@ -127,7 +138,7 @@ QWebDatabase::QWebDatabase(QWebDatabasePrivate* priv)
\endcode
\note Concurrent access to a database from multiple threads or processes
- is not very efficient because Sqlite is used as WebKit's database backend.
+ is not very efficient because SQLite is used as WebKit's database backend.
*/
QString QWebDatabase::fileName() const
{
@@ -149,8 +160,8 @@ QWebSecurityOrigin QWebDatabase::origin() const
}
/*!
- Removes the database, \a db, from its security origin. All data stored in this database
- will be destroyed.
+ Removes the database \a db from its security origin. All data stored in the
+ database \a db will be destroyed.
*/
void QWebDatabase::removeDatabase(const QWebDatabase &db)
{
@@ -160,6 +171,20 @@ void QWebDatabase::removeDatabase(const QWebDatabase &db)
}
/*!
+ \since 4.6
+
+ Deletes all web databases in the configured offline storage path.
+
+ \sa QWebSettings::setOfflineStoragePath()
+*/
+void QWebDatabase::removeAllDatabases()
+{
+#if ENABLE(DATABASE)
+ DatabaseTracker::tracker().deleteAllDatabases();
+#endif
+}
+
+/*!
Destroys the web database object. The data within this database is \b not destroyed.
*/
QWebDatabase::~QWebDatabase()
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h
index 4e832bb..5b4f704 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h
@@ -46,6 +46,7 @@ public:
QWebSecurityOrigin origin() const;
static void removeDatabase(const QWebDatabase &db);
+ static void removeAllDatabases();
private:
QWebDatabase(QWebDatabasePrivate* priv);
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
index 381251d..29d380d 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
@@ -20,73 +20,71 @@
#include "config.h"
#include "qwebframe.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
-#include "qwebframe_p.h"
-#include "qwebsecurityorigin.h"
-#include "qwebsecurityorigin_p.h"
-#include "qwebelement.h"
+#include "CallFrame.h"
+#include "Document.h"
#include "DocumentLoader.h"
+#include "DragData.h"
+#include "Element.h"
#include "FocusController.h"
-#include "FrameLoaderClientQt.h"
#include "Frame.h"
+#include "FrameLoaderClientQt.h"
#include "FrameTree.h"
#include "FrameView.h"
+#include "GCController.h"
+#include "GraphicsContext.h"
+#include "HTMLMetaElement.h"
+#include "HitTestResult.h"
#include "IconDatabase.h"
#include "InspectorController.h"
+#include "JSDOMBinding.h"
+#include "JSDOMWindowBase.h"
+#include "JSLock.h"
+#include "JSObject.h"
+#include "NodeList.h"
#include "Page.h"
+#include "PlatformMouseEvent.h"
+#include "PlatformWheelEvent.h"
+#include "PrintContext.h"
#include "PutPropertySlot.h"
-#include "ResourceRequest.h"
+#include "RenderTreeAsText.h"
#include "RenderView.h"
-#include "SelectionController.h"
+#include "ResourceRequest.h"
+#include "ScriptController.h"
+#include "ScriptSourceCode.h"
+#include "ScriptValue.h"
#include "Scrollbar.h"
-#include "PrintContext.h"
+#include "SelectionController.h"
#include "SubstituteData.h"
-
-#include "markup.h"
#include "htmlediting.h"
-#include "RenderTreeAsText.h"
-#include "Element.h"
-#include "Document.h"
-#include "DragData.h"
-#include "RenderView.h"
-#include "GraphicsContext.h"
-#include "PlatformMouseEvent.h"
-#include "PlatformWheelEvent.h"
-#include "GraphicsContext.h"
-#include "HitTestResult.h"
-
-#include "CallFrame.h"
-#include "JSDOMBinding.h"
-#include "JSDOMWindow.h"
-#include "JSLock.h"
-#include "JSObject.h"
+#include "markup.h"
#include "qt_instance.h"
#include "qt_runtime.h"
+#include "qwebelement.h"
+#include "qwebframe_p.h"
+#include "qwebpage.h"
+#include "qwebpage_p.h"
+#include "qwebsecurityorigin.h"
+#include "qwebsecurityorigin_p.h"
#include "runtime.h"
#include "runtime_object.h"
#include "runtime_root.h"
-#include "ScriptController.h"
-#include "ScriptSourceCode.h"
-#include "ScriptValue.h"
-
#include "wtf/HashMap.h"
-
+#include <QMultiMap>
#include <qdebug.h>
#include <qevent.h>
#include <qfileinfo.h>
#include <qpainter.h>
-#include <QMultiMap>
+#include <qprinter.h>
+#include <qregion.h>
+
+#if QT_VERSION < 0x040400
+#include "qwebnetworkinterface.h"
+#endif
+
#if QT_VERSION >= 0x040400
#include <qnetworkrequest.h>
-#else
-#include "qwebnetworkinterface.h"
#endif
-#include <qregion.h>
-#include <qprinter.h>
-#include "HTMLMetaElement.h"
-#include "NodeList.h"
using namespace WebCore;
@@ -166,27 +164,56 @@ int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame *qframe)
return controller->numberOfActiveAnimations();
}
-void QWebFramePrivate::init(QWebFrame *qframe, WebCore::Page *webcorePage, QWebFrameData *frameData)
+void QWEBKIT_EXPORT qt_drt_clearFrameName(QWebFrame* qFrame)
{
- q = qframe;
+ Frame* frame = QWebFramePrivate::core(qFrame);
+ frame->tree()->clearName();
+}
- allowsScrolling = frameData->allowsScrolling;
- marginWidth = frameData->marginWidth;
- marginHeight = frameData->marginHeight;
+int QWEBKIT_EXPORT qt_drt_javaScriptObjectsCount()
+{
+ return JSDOMWindowBase::commonJSGlobalData()->heap.globalObjectCount();
+}
+
+void QWEBKIT_EXPORT qt_drt_garbageCollector_collect()
+{
+ gcController().garbageCollectNow();
+}
+void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUntilDone)
+{
+ gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone);
+}
+
+QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame,
+ WebCore::HTMLFrameOwnerElement* ownerFrameElement,
+ const WebCore::String& frameName)
+ : name(frameName)
+ , ownerElement(ownerFrameElement)
+ , page(parentPage)
+ , allowsScrolling(true)
+ , marginWidth(0)
+ , marginHeight(0)
+{
frameLoaderClient = new FrameLoaderClientQt();
- RefPtr<Frame> newFrame = Frame::create(webcorePage, frameData->ownerElement, frameLoaderClient);
- frame = newFrame.get();
- frameLoaderClient->setFrame(qframe, frame);
+ frame = Frame::create(page, ownerElement, frameLoaderClient);
// FIXME: All of the below should probably be moved over into WebCore
- frame->tree()->setName(frameData->name);
- if (QWebFrame* _parentFrame = parentFrame())
- QWebFramePrivate::core(_parentFrame)->tree()->appendChild(frame);
+ frame->tree()->setName(name);
+ if (parentFrame)
+ parentFrame->tree()->appendChild(frame);
+}
- // balanced by adoptRef in FrameLoaderClientQt::createFrame
- if (frameData->ownerElement)
- frame->ref();
+void QWebFramePrivate::init(QWebFrame *qframe, QWebFrameData *frameData)
+{
+ q = qframe;
+
+ allowsScrolling = frameData->allowsScrolling;
+ marginWidth = frameData->marginWidth;
+ marginHeight = frameData->marginHeight;
+ frame = frameData->frame.get();
+ frameLoaderClient = frameData->frameLoaderClient;
+ frameLoaderClient->setFrame(qframe, frame);
frame->init();
}
@@ -280,7 +307,7 @@ QWebFrame::QWebFrame(QWebPage *parent, QWebFrameData *frameData)
, d(new QWebFramePrivate)
{
d->page = parent;
- d->init(this, parent->d->page, frameData);
+ d->init(this, frameData);
if (!frameData->url.isEmpty()) {
WebCore::ResourceRequest request(frameData->url, frameData->referrer);
@@ -293,7 +320,7 @@ QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData)
, d(new QWebFramePrivate)
{
d->page = parent->d->page;
- d->init(this, parent->d->page->d->page, frameData);
+ d->init(this, frameData);
}
QWebFrame::~QWebFrame()
@@ -316,6 +343,8 @@ QWebFrame::~QWebFrame()
new URL, you should add them in a slot connected to the
javaScriptWindowObjectCleared() signal.
+ If Javascript is not enabled for this page, then this method does nothing.
+
The \a object will never be explicitly deleted by QtWebKit.
*/
void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object)
@@ -338,10 +367,15 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object
new URL, you should add them in a slot connected to the
javaScriptWindowObjectCleared() signal.
+ If Javascript is not enabled for this page, then this method does nothing.
+
The ownership of \a object is specified using \a own.
*/
void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership)
{
+ if (!page()->settings()->testAttribute(QWebSettings::JavascriptEnabled))
+ return;
+
JSC::JSLock lock(false);
JSDOMWindow* window = toJSDOMWindow(d->frame);
JSC::Bindings::RootObject* root = d->frame->script()->bindingRootObject();
@@ -487,6 +521,17 @@ QUrl QWebFrame::url() const
}
/*!
+ \property QWebFrame::baseUrl
+ \brief the base URL of the frame, can be used to resolve relative URLs
+ \since 4.6
+*/
+
+QUrl QWebFrame::baseUrl() const
+{
+ return d->frame->loader()->baseURL();
+}
+
+/*!
\property QWebFrame::icon
\brief the icon associated with this frame
@@ -933,6 +978,27 @@ qreal QWebFrame::zoomFactor() const
}
/*!
+ \property QWebFrame::focus
+ \since 4.6
+
+ Returns true if this frame has keyboard input focus; otherwise, returns false.
+*/
+bool QWebFrame::hasFocus() const
+{
+ return QWebFramePrivate::kit(d->frame->page()->focusController()->focusedFrame()) == this;
+}
+
+/*!
+ \since 4.6
+
+ Gives keyboard input focus to this frame.
+*/
+void QWebFrame::setFocus()
+{
+ QWebFramePrivate::core(this)->page()->focusController()->setFocusedFrame(QWebFramePrivate::core(this));
+}
+
+/*!
Returns the position of the frame relative to it's parent frame.
*/
QPoint QWebFrame::pos() const
@@ -1229,6 +1295,25 @@ QWebFrame* QWebFramePrivate::kit(WebCore::Frame* coreFrame)
*/
/*!
+ \fn void QWebFrame::loadStarted()
+ \since 4.6
+
+ This signal is emitted when a new load of this frame is started.
+
+ \sa loadFinished()
+*/
+
+/*!
+ \fn void QWebFrame::loadFinished(bool ok)
+ \since 4.6
+
+ This signal is emitted when a load of this frame is finished.
+ \a ok will indicate whether the load was successful or any error occurred.
+
+ \sa loadStarted()
+*/
+
+/*!
\class QWebHitTestResult
\since 4.4
\brief The QWebHitTestResult class provides information about the web
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h
index 3ed453e..2c5309a 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h
@@ -109,9 +109,11 @@ class QWEBKIT_EXPORT QWebFrame : public QObject
Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
Q_PROPERTY(QString title READ title)
Q_PROPERTY(QUrl url READ url WRITE setUrl)
+ Q_PROPERTY(QUrl baseUrl READ baseUrl)
Q_PROPERTY(QIcon icon READ icon)
Q_PROPERTY(QSize contentsSize READ contentsSize)
Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition)
+ Q_PROPERTY(bool focus READ hasFocus)
private:
QWebFrame(QWebPage *parent, QWebFrameData *frameData);
QWebFrame(QWebFrame *parent, QWebFrameData *frameData);
@@ -140,6 +142,7 @@ public:
QString title() const;
void setUrl(const QUrl &url);
QUrl url() const;
+ QUrl baseUrl() const;
QIcon icon() const;
QMultiMap<QString, QString> metaData() const;
@@ -171,6 +174,9 @@ public:
qreal zoomFactor() const;
void setZoomFactor(qreal factor);
+ bool hasFocus() const;
+ void setFocus();
+
QPoint pos() const;
QRect geometry() const;
QSize contentsSize() const;
@@ -204,6 +210,9 @@ Q_SIGNALS:
void contentsSizeChanged(const QSize &size);
+ void loadStarted();
+ void loadFinished(bool ok);
+
private:
friend class QWebPage;
friend class QWebPagePrivate;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h
index 0c7da90..2b5c187 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h
@@ -43,9 +43,16 @@ class QWebPage;
class QWebFrameData
{
public:
+ QWebFrameData(WebCore::Page*, WebCore::Frame* parentFrame = 0,
+ WebCore::HTMLFrameOwnerElement* = 0,
+ const WebCore::String& frameName = WebCore::String());
+
WebCore::KURL url;
WebCore::String name;
WebCore::HTMLFrameOwnerElement* ownerElement;
+ WebCore::Page* page;
+ RefPtr<WebCore::Frame> frame;
+ WebCore::FrameLoaderClientQt* frameLoaderClient;
WebCore::String referrer;
bool allowsScrolling;
@@ -67,8 +74,7 @@ public:
, marginWidth(-1)
, marginHeight(-1)
{}
- void init(QWebFrame *qframe, WebCore::Page *page,
- QWebFrameData *frameData);
+ void init(QWebFrame* qframe, QWebFrameData* frameData);
inline QWebFrame *parentFrame() { return qobject_cast<QWebFrame*>(q->parent()); }
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 5899a1b..3c2151b 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -325,11 +325,7 @@ bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QNetworkRe
void QWebPagePrivate::createMainFrame()
{
if (!mainFrame) {
- QWebFrameData frameData;
- frameData.ownerElement = 0;
- frameData.allowsScrolling = true;
- frameData.marginWidth = 0;
- frameData.marginHeight = 0;
+ QWebFrameData frameData(page);
mainFrame = new QWebFrame(q, &frameData);
emit q->frameCreated(mainFrame);
@@ -420,23 +416,6 @@ QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMen
}
#endif // QT_NO_CONTEXTMENU
-QWebFrame *QWebPagePrivate::frameAt(const QPoint &pos) const
-{
- QWebFrame *frame = mainFrame;
-
-redo:
- QList<QWebFrame*> children = frame->childFrames();
- for (int i = 0; i < children.size(); ++i) {
- if (children.at(i)->geometry().contains(pos)) {
- frame = children.at(i);
- goto redo;
- }
- }
- if (frame->geometry().contains(pos))
- return frame;
- return 0;
-}
-
void QWebPagePrivate::_q_webActionTriggered(bool checked)
{
QAction *a = qobject_cast<QAction *>(q->sender());
@@ -844,7 +823,7 @@ void QWebPagePrivate::focusInEvent(QFocusEvent *ev)
Frame *frame = focusController->focusedFrame();
focusController->setActive(true);
if (frame) {
- frame->selection()->setFocused(true);
+ focusController->setFocused(true);
} else {
focusController->setFocusedFrame(QWebFramePrivate::core(mainFrame));
}
@@ -857,10 +836,7 @@ void QWebPagePrivate::focusOutEvent(QFocusEvent *ev)
// focusInEvent() we can re-activate the frame.
FocusController *focusController = page->focusController();
focusController->setActive(false);
- Frame *frame = focusController->focusedFrame();
- if (frame) {
- frame->selection()->setFocused(false);
- }
+ focusController->setFocused(false);
}
void QWebPagePrivate::dragEnterEvent(QDragEnterEvent *ev)
@@ -1337,6 +1313,23 @@ QWebFrame *QWebPage::currentFrame() const
return static_cast<WebCore::FrameLoaderClientQt *>(d->page->focusController()->focusedOrMainFrame()->loader()->client())->webFrame();
}
+
+/*!
+ \since 4.6
+
+ Returns the frame at the given point \a pos.
+
+ \sa mainFrame(), currentFrame()
+*/
+QWebFrame* QWebPage::frameAt(const QPoint& pos) const
+{
+ QWebFrame* webFrame = mainFrame();
+ if (!webFrame->geometry().contains(pos))
+ return 0;
+ QWebHitTestResult hitTestResult = webFrame->hitTestContent(pos);
+ return hitTestResult.frame();
+}
+
/*!
Returns a pointer to the view's history of navigated web pages.
*/
@@ -1430,6 +1423,28 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr
}
/*!
+ \fn bool QWebPage::shouldInterruptJavaScript()
+ \since 4.6
+ This function is called when a JavaScript program is running for a long period of time.
+
+ If the user wanted to stop the JavaScript the implementation should return true; otherwise false.
+
+ The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons.
+
+ \warning Because of binary compatibility constraints, this function is not virtual. If you want to
+ provide your own implementation in a QWebPage subclass, reimplement the shouldInterruptJavaScript()
+ slot in your subclass instead. QtWebKit will dynamically detect the slot and call it.
+*/
+bool QWebPage::shouldInterruptJavaScript()
+{
+#ifdef QT_NO_MESSAGEBOX
+ return false;
+#else
+ return QMessageBox::Yes == QMessageBox::information(d->view, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No);
+#endif
+}
+
+/*!
This function is called whenever WebKit wants to create a new window of the given \a type, for
example when a JavaScript program requests to open a document in a new window.
@@ -2193,9 +2208,9 @@ bool QWebPage::swallowContextMenuEvent(QContextMenuEvent *event)
{
d->page->contextMenuController()->clearContextMenu();
- if (QWebFrame* webFrame = d->frameAt(event->pos())) {
+ if (QWebFrame* webFrame = frameAt(event->pos())) {
Frame* frame = QWebFramePrivate::core(webFrame);
- if (Scrollbar* scrollbar = frame->view()->scrollbarUnderPoint(PlatformMouseEvent(event, 1).pos())) {
+ if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(PlatformMouseEvent(event, 1).pos())) {
return scrollbar->contextMenu(PlatformMouseEvent(event, 1));
}
}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
index 86822d2..517a77c 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
@@ -193,6 +193,7 @@ public:
QWebFrame *mainFrame() const;
QWebFrame *currentFrame() const;
+ QWebFrame* frameAt(const QPoint& pos) const;
QWebHistory *history() const;
QWebSettings *settings() const;
@@ -287,6 +288,9 @@ public:
inline QWebPagePrivate* handle() const { return d; }
+public Q_SLOTS:
+ bool shouldInterruptJavaScript();
+
Q_SIGNALS:
void loadStarted();
void loadProgress(int progress);
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
index 984bec1..3a3a674 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
@@ -75,9 +75,6 @@ public:
#ifndef QT_NO_CONTEXTMENU
QMenu *createContextMenu(const WebCore::ContextMenu *webcoreMenu, const QList<WebCore::ContextMenuItem> *items, QBitArray *visitedWebActions);
#endif
-
- QWebFrame *frameAt(const QPoint &pos) const;
-
void _q_onLoadProgressChanged(int);
void _q_webActionTriggered(bool checked);
#ifndef NDEBUG
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp
index da9278c..d2eaf10 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp
@@ -36,10 +36,9 @@ using namespace WebCore;
\brief The QWebSecurityOrigin class defines a security boundary for web sites.
QWebSecurityOrigin provides access to the security domains defined by web sites.
- An origin consists of a host name, a scheme, and a port number. Web sites with the same
- security origin can access each other's resources for client-side scripting or databases.
-
- ### diagram
+ An origin consists of a host name, a scheme, and a port number. Web sites
+ with the same security origin can access each other's resources for client-side
+ scripting or databases.
For example the site \c{http://www.example.com/my/page.html} is allowed to share the same
database as \c{http://www.example.com/my/overview.html}, or access each other's
@@ -47,7 +46,13 @@ using namespace WebCore;
\c{http://www.malicious.com/evil.html} from accessing \c{http://www.example.com/}'s resources,
because they are of a different security origin.
- QWebSecurity also provides access to all databases defined within a security origin.
+ Call QWebFrame::securityOrigin() to get the QWebSecurityOrigin for a frame in a
+ web page, and use host(), scheme() and port() to identify the security origin.
+
+ Use databases() to access the databases defined within a security origin. The
+ disk usage of the origin's databases can be limited with setDatabaseQuota().
+ databaseQuota() and databaseUsage() report the current limit as well as the
+ current usage.
For more information refer to the
\l{http://en.wikipedia.org/wiki/Same_origin_policy}{"Same origin policy" Wikipedia Article}.
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
index c634a7f..34da644 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
@@ -270,19 +270,24 @@ void QWebView::setPage(QWebPage *page)
'ftp'. The result is then passed through QUrl's tolerant parser, and
in the case or success, a valid QUrl is returned, or else a QUrl().
- Examples
- - webkit.org becomes http://webkit.org
- - ftp.webkit.org becomes ftp://ftp.webkit.org
- - localhost becomes http://localhost
- - /home/user/test.html becomes file:///home/user/test.html (if exists)
-
- Tips when dealing with URLs and strings
- - When creating a QString from a QByteArray or a char*, always use
- QString::fromUtf8().
- - Do not use QUrl(string), nor QUrl::toString() anywhere where the URL might
- be used, such as in the location bar, as those functions loose data.
- Instead use QUrl::fromEncoded() and QUrl::toEncoded(), respectively.
+ \section1 Examples:
+
+ \list
+ \o webkit.org becomes http://webkit.org
+ \o ftp.webkit.org becomes ftp://ftp.webkit.org
+ \o localhost becomes http://localhost
+ \o /home/user/test.html becomes file:///home/user/test.html (if exists)
+ \endlist
+ \section2 Tips when dealing with URLs and strings:
+
+ \list
+ \o When creating a QString from a QByteArray or a char*, always use
+ QString::fromUtf8().
+ \o Do not use QUrl(string), nor QUrl::toString() anywhere where the URL might
+ be used, such as in the location bar, as those functions loose data.
+ Instead use QUrl::fromEncoded() and QUrl::toEncoded(), respectively.
+ \endlist
*/
QUrl QWebView::guessUrlFromString(const QString &string)
{
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index dffa5e5..02aab77 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,341 @@
+2009-07-13 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Fix qdoc warnings for QWebPage::shouldInterruptJavaScript() and mention
+ how to re-implement it.
+
+ * Api/qwebpage.cpp:
+
+2009-07-13 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Fix crash with plugins when the plugin stream is cancelled.
+
+ Similar to r26667 handle the case where didReceiveResponse on the
+ plugin view results in failure to set up the stream and
+ setMainDocumentError being called instead. This will set the
+ m_pluginView back to 0 and we need check for it before calling
+ didReceiveData.
+
+ This was triggered by consecutive execution of
+ LayoutTests/plugins/return-error-from-new-stream-callback-in-full-frame-plugin.html
+ followed by LayoutTests/scrollbars/scrollbar-crash-on-refresh.html
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::committedLoad):
+
+2009-07-13 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Added QWebDatabase::removeAllDatabases, as a way to delete all
+ databases from the offline storage path.
+
+ Used by the Qt DRT.
+
+ * Api/qwebdatabase.cpp:
+ (QWebDatabase::removeAllDatabases):
+ * Api/qwebdatabase.h:
+
+2009-07-13 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Added loadStarted() and loadFinished() signals to QWebFrame,
+ to allow load tracking of individual frames, as opposed to
+ QWebPage's loadStarted/loadFinished signals that are emitted
+ whenever _any_ child frame loads/finishes.
+
+ * Api/qwebframe.cpp: Document new signals.
+ * Api/qwebframe.h: Add new signals.
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::setFrame): Connect new signals.
+
+2009-07-13 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Add hooks for the GCController JavaScript interface needed by the
+ Qt DRT.
+
+ Fixed sort order of includes in qwebframe.cpp.
+
+ * Api/qwebframe.cpp:
+ (qt_drt_javaScriptObjectsCount):
+ (qt_drt_garbageCollector_collect):
+ (qt_drt_garbageCollector_collectOnAlternateThread):
+
+2009-07-13 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Add hooks for the GCController JavaScript interface needed by the
+ Qt DRT.
+
+ Fixed sort order of includes in qwebframe.cpp.
+
+ * Api/qwebframe.cpp:
+ (qt_drt_javaScriptObjectsCount):
+ (qt_drt_garbageCollector_collect):
+ (qt_drt_garbageCollector_collectOnAlternateThread):
+
+2009-07-12 Brent Fulgham <bfulgham@gmail.com>
+
+ Speculative build fix after http://trac.webkit.org/changeset/45786.
+
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::addMessageToConsole):
+ * WebCoreSupport/ChromeClientQt.h:
+
+2009-07-10 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27136
+
+ Fix a bug where webkit hangs when executing infinite JavaScript loop.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::shouldInterruptJavaScript):
+ * Api/qwebpage.h:
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::shouldInterruptJavaScript):
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (JSTestPage::JSTestPage):
+ (JSTestPage::shouldInterruptJavaScript):
+ (tst_QWebPage::infiniteLoopJS):
+
+2009-07-10 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27108
+
+ Fix crash when in frame tree of a new frame before the new frame
+ has been installed in the frame tree, similar to r35088.
+
+ After calling Frame::init() the frame it may have been removed from the
+ frame tree again through JavaScript. Detect this by checking the page()
+ afterwards.
+
+ To make this check safe the Frame::init() code was moved into
+ QWebFrameData's constructor, where a RefPtr holds a reference to the frame.
+ After the check back in FrameLoaderClientQt we would hold the single
+ reference left and after release() the frame, its frame loader, its
+ client as well as the QWebFrame should have disappeared then.
+
+ * Api/qwebframe.cpp:
+ (QWebFramePrivate::init): Only call Frame::init here, the rest is
+ done in QWebFrameData's constructor.
+ (QWebFrame::QWebFrame):
+ * Api/qwebframe_p.h: Adjust declaration.
+ (QWebFrameData::QWebFrameData): Create the Frame here.
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::createMainFrame): Adjust and simplify
+ to new QWebFrame constructor.
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::createFrame): Adjust to
+ new QWebFrame construction using QWebFrameData and add the
+ check like in r35088.
+
+2009-07-09 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Make Widget RefCounted to fix:
+
+ <rdar://problem/7038831> REGRESSION (TOT): In Mail, a crash occurs
+ at WebCore::Widget::afterMouseDown() after clicking To Do's close
+ box
+ <rdar://problem/6978804> WER #16: Repro Access Violation in
+ WebCore::PluginView::bindingInstance (1310178023)
+ -and-
+ <rdar://problem/6991251> WER #13: Crash in WebKit!
+ WebCore::PluginView::performRequest+203 (1311461169)
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::createPlugin):
+ (WebCore::FrameLoaderClientQt::createJavaAppletWidget):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
+2009-07-08 Pradeepto Bhattacharya <pradeepto@kde.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Build fix.
+
+ * WebCoreSupport/FrameLoaderClientQt.h: Removed the slot slotCallPolicyFunction().
+
+2009-07-08 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27080
+
+ Fix DRT instability issues with fast/loader/submit-form-while-parsing-2.html
+
+ When the form is submitted we call the policy function in the frame
+ loader delayed with a queued connection. That queued connection
+ sometimes interferes with the javascript timeout set in the testcase.
+
+ Eliminate the entire delayed policy function mechanism and instead always
+ call back directly, like in the other ports. In most other places we called
+ the slot directly anyway.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::FrameLoaderClientQt): Remove m_policyFunction.
+ (WebCore::FrameLoaderClientQt::callPolicyFunction): Call the policy function directly instead
+ of emitting the queued signal.
+ (WebCore::FrameLoaderClientQt::cancelPolicyCheck): Call callPolicyFunction directly.
+ (WebCore::FrameLoaderClientQt::dispatchWillSubmitForm): Ditto.
+ (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType): Ditto.
+ (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): Ditto.
+ (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): Ditto.
+ * WebCoreSupport/FrameLoaderClientQt.h: Remove m_policyFunction as well as the associated
+ signal.
+
+2009-07-07 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Holger Freyther.
+
+ Add Qt DRT hook for clearing the frame name.
+
+ * Api/qwebframe.cpp:
+ (qt_drt_clearFrameName):
+
+2009-07-05 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Holger Freyther.
+
+ Fix two qdoc warnings.
+
+ Added missing \property for QWebFrame::hasFocus and added \a
+ tag for pos of QWebPage::frameAt.
+
+ * Api/qwebframe.cpp:
+ * Api/qwebpage.cpp:
+
+2009-07-04 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Simon Hausmann.
+
+ Use the recently introduced FocusController::setFocused
+
+ Use the recently introduced FocusController::setFocused
+ in the Qt platform. The SelectionController will be updated
+ from within the FocusController now.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::focusInEvent):
+ (QWebPagePrivate::focusOutEvent):
+
+2009-07-02 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Improve documentation of QWebFrame::setFocus and hasFocus()
+ Added missing Q_PROPERTY for QWebFrame::hasFocus.
+
+ * Api/qwebframe.cpp: Clarify the docs.
+ * Api/qwebframe.h: add Q_PROPERTY(focus).
+
+2009-07-02 Joe Ligman <joseph.ligman@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Bug 26855: [Qt] New methods for QWebFrame to check and set focus.
+
+ Added new public methods QWebFrame::hasFocus() and QWebFrame::setFocus()
+ Added auto test.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::hasFocus):
+ (QWebFrame::setFocus):
+ * Api/qwebframe.h:
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2009-07-01 Robert Hogan <robert@roberthogan.net>
+
+ Reviewed by NOBODY.
+
+ Fix Qt segfault when javascript disabled.
+ If clients call addToJavaScriptWindowObject even though JavascriptEnabled is false
+ webkit will segfault on the assert:
+ ASSERTION FAILED: _rootObject
+ (../../../WebCore/bridge/runtime.cpp:52
+ JSC::Bindings::Instance::Instance(WTF::PassRefPtr<JSC::Bindings::RootObject>))
+ Fix is to ensure JavaScript is enabled when client calls addToJavaScriptWindowObject.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26906
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::addToJavaScriptWindowObject):
+
+2009-07-01 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Move some API headers from WebCore.pro to headers.pri so that they
+ get installed when running make install from the build directory.
+
+ * Api/headers.pri:
+
+2009-07-01 Balazs Kelemen <kelemen.balazs.3@stud.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Fixed robotized QtLauncher to work when there is no index.html in the user's home.
+
+ * QtLauncher/main.cpp:
+ (main):
+
+2009-06-30 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Renamed scrollbarUnderPoint to scrollbarAtPoint to follow conventions.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::swallowContextMenuEvent):
+
+2009-06-30 Joe Ligman <joseph.ligman@nokia.com>
+
+ Reviewed by Adam Treat.
+
+ Bug 26422: [Qt] QWebPagePrivate::frameAt calculates wrong frame
+
+ Added a public method QWebPage::frameAt
+ Removed QWebPagePrivate::frameAt, which calcuated the wrong frame
+ Modified QWebPage::swallowContextMenuEvent to use the new frameAt method
+ New test case for frameAt added to tst_qwebpage.cpp
+
+ * Api/qwebpage.cpp:
+ (QWebPage::frameAt):
+ (QWebPage::swallowContextMenuEvent):
+ * Api/qwebpage.h:
+ * Api/qwebpage_p.h:
+ * tests/qwebpage/frametest/iframe.html: Added.
+ * tests/qwebpage/frametest/iframe2.html: Added.
+ * tests/qwebpage/frametest/iframe3.html: Added.
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (frameAtHelper):
+ (tst_QWebPage::frameAt):
+ * tests/qwebpage/tst_qwebpage.qrc:
+
+2009-06-30 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ Add QWebFrame::baseUrl() function that exposes the base URL of a frame.
+ Autotests included.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::baseUrl):
+ * Api/qwebframe.h:
+ * tests/qwebframe/tst_qwebframe.cpp:
+
2009-06-29 Simon Hausmann <simon.hausmann@nokia.com>
Fix the Qt build, add missing isSpeaking() implementation to
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index d001035..c169a9f 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -228,7 +228,7 @@ void ChromeClientQt::setResizable(bool)
notImplemented();
}
-void ChromeClientQt::addMessageToConsole(MessageSource, MessageLevel, const String& message,
+void ChromeClientQt::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message,
unsigned int lineNumber, const String& sourceID)
{
QString x = message;
@@ -288,8 +288,9 @@ void ChromeClientQt::setStatusbarText(const String& msg)
bool ChromeClientQt::shouldInterruptJavaScript()
{
- notImplemented();
- return false;
+ bool shouldInterrupt = false;
+ QMetaObject::invokeMethod(m_webPage, "shouldInterruptJavaScript", Qt::DirectConnection, Q_RETURN_ARG(bool, shouldInterrupt));
+ return shouldInterrupt;
}
bool ChromeClientQt::tabsToLinks() const
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index 9f2c1b5..67663fb 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -83,7 +83,7 @@ namespace WebCore {
virtual void setResizable(bool);
- virtual void addMessageToConsole(MessageSource, MessageLevel, const String& message,
+ virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message,
unsigned int lineNumber, const String& sourceID);
virtual bool canRunBeforeUnloadConfirmPanel();
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index c6c4b9e..8e6ffed 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -144,10 +144,8 @@ FrameLoaderClientQt::FrameLoaderClientQt()
, m_pluginView(0)
, m_hasSentResponseToPlugin(false)
, m_firstData(false)
- , m_policyFunction(0)
, m_loadSucceeded(false)
{
- connect(this, SIGNAL(sigCallPolicyFunction(int)), this, SLOT(slotCallPolicyFunction(int)), Qt::QueuedConnection);
}
@@ -166,10 +164,14 @@ void FrameLoaderClientQt::setFrame(QWebFrame* webFrame, Frame* frame)
connect(this, SIGNAL(loadStarted()),
m_webFrame->page(), SIGNAL(loadStarted()));
+ connect(this, SIGNAL(loadStarted()),
+ m_webFrame, SIGNAL(loadStarted()));
connect(this, SIGNAL(loadProgress(int)),
m_webFrame->page(), SIGNAL(loadProgress(int)));
connect(this, SIGNAL(loadFinished(bool)),
m_webFrame->page(), SIGNAL(loadFinished(bool)));
+ connect(this, SIGNAL(loadFinished(bool)),
+ m_webFrame, SIGNAL(loadFinished(bool)));
connect(this, SIGNAL(titleChanged(const QString&)),
m_webFrame, SIGNAL(titleChanged(const QString&)));
}
@@ -181,20 +183,7 @@ QWebFrame* FrameLoaderClientQt::webFrame() const
void FrameLoaderClientQt::callPolicyFunction(FramePolicyFunction function, PolicyAction action)
{
- ASSERT(!m_policyFunction);
- ASSERT(function);
-
- m_policyFunction = function;
- emit sigCallPolicyFunction(action);
-}
-
-void FrameLoaderClientQt::slotCallPolicyFunction(int action)
-{
- if (!m_frame || !m_policyFunction)
- return;
- FramePolicyFunction function = m_policyFunction;
- m_policyFunction = 0;
- (m_frame->loader()->*function)(WebCore::PolicyAction(action));
+ (m_frame->loader()->*function)(action);
}
bool FrameLoaderClientQt::hasWebView() const
@@ -415,7 +404,6 @@ void FrameLoaderClientQt::dispatchShow()
void FrameLoaderClientQt::cancelPolicyCheck()
{
// qDebug() << "FrameLoaderClientQt::cancelPolicyCheck";
- m_policyFunction = 0;
}
@@ -423,7 +411,6 @@ void FrameLoaderClientQt::dispatchWillSubmitForm(FramePolicyFunction function,
PassRefPtr<FormState>)
{
notImplemented();
- Q_ASSERT(!m_policyFunction);
// FIXME: This is surely too simple
callPolicyFunction(function, PolicyUse);
}
@@ -692,6 +679,11 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c
if (m_pluginView) {
if (!m_hasSentResponseToPlugin) {
m_pluginView->didReceiveResponse(loader->response());
+ // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in
+ // setting up this stream can cause the main document load to be cancelled, setting m_pluginView
+ // to null
+ if (!m_pluginView)
+ return;
m_hasSentResponseToPlugin = true;
}
m_pluginView->didReceiveData(data, length);
@@ -887,19 +879,15 @@ WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage()
void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const WebCore::String& MIMEType, const WebCore::ResourceRequest&)
{
// we need to call directly here
- Q_ASSERT(!m_policyFunction);
- m_policyFunction = function;
if (canShowMIMEType(MIMEType))
- slotCallPolicyFunction(PolicyUse);
+ callPolicyFunction(function, PolicyUse);
else
- slotCallPolicyFunction(PolicyDownload);
+ callPolicyFunction(function, PolicyDownload);
}
void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState>, const WebCore::String&)
{
- Q_ASSERT(!m_policyFunction);
Q_ASSERT(m_webFrame);
- m_policyFunction = function;
#if QT_VERSION < 0x040400
QWebNetworkRequest r(request);
#else
@@ -916,17 +904,15 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc
m_frame->loader()->activeDocumentLoader()->setLastCheckedRequest(emptyRequest);
}
- slotCallPolicyFunction(PolicyIgnore);
+ callPolicyFunction(function, PolicyIgnore);
return;
}
- slotCallPolicyFunction(PolicyUse);
+ callPolicyFunction(function, PolicyUse);
}
void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState>)
{
- Q_ASSERT(!m_policyFunction);
Q_ASSERT(m_webFrame);
- m_policyFunction = function;
#if QT_VERSION < 0x040400
QWebNetworkRequest r(request);
#else
@@ -943,10 +929,10 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
m_frame->loader()->activeDocumentLoader()->setLastCheckedRequest(emptyRequest);
}
- slotCallPolicyFunction(PolicyIgnore);
+ callPolicyFunction(function, PolicyIgnore);
return;
}
- slotCallPolicyFunction(PolicyUse);
+ callPolicyFunction(function, PolicyUse);
}
void FrameLoaderClientQt::dispatchUnableToImplementPolicy(const WebCore::ResourceError&)
@@ -971,32 +957,35 @@ PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String
if (!m_webFrame)
return 0;
- QWebFrameData frameData;
+ QWebFrameData frameData(m_frame->page(), m_frame, ownerElement, name);
frameData.url = url;
- frameData.name = name;
- frameData.ownerElement = ownerElement;
frameData.referrer = referrer;
frameData.allowsScrolling = allowsScrolling;
frameData.marginWidth = marginWidth;
frameData.marginHeight = marginHeight;
- QWebFrame* webFrame = new QWebFrame(m_webFrame, &frameData);
- emit m_webFrame->page()->frameCreated(webFrame);
+ QPointer<QWebFrame> webFrame = new QWebFrame(m_webFrame, &frameData);
+ // The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
+ if (!webFrame->d->frame->page()) {
+ frameData.frame.release();
+ ASSERT(webFrame.isNull());
+ return 0;
+ }
- RefPtr<Frame> childFrame = adoptRef(webFrame->d->frame);
+ emit m_webFrame->page()->frameCreated(webFrame);
// ### set override encoding if we have one
FrameLoadType loadType = m_frame->loader()->loadType();
FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList;
- childFrame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, childFrame.get());
+ frameData.frame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, frameData.frame.get());
// The frame's onload handler may have removed it from the document.
- if (!childFrame->tree()->parent())
+ if (!frameData.frame->tree()->parent())
return 0;
- return childFrame.release();
+ return frameData.frame.release();
}
ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& _mimeType)
@@ -1085,7 +1074,7 @@ public:
}
};
-Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames,
+PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames,
const Vector<String>& paramValues, const String& mimeType, bool loadManually)
{
// qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType;
@@ -1149,7 +1138,7 @@ Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInE
QWidget* view = m_webFrame->page()->view();
if (view)
widget->setParent(view);
- QtPluginWidget* w = new QtPluginWidget();
+ RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget());
w->setPlatformWidget(widget);
// Make sure it's invisible until properly placed into the layout
w->setFrameRect(IntRect(0, 0, 0, 0));
@@ -1158,7 +1147,7 @@ Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInE
// FIXME: make things work for widgetless plugins as well
delete object;
} else { // NPAPI Plugins
- PluginView* pluginView = PluginView::create(m_frame, pluginSize, element, url,
+ RefPtr<PluginView> pluginView = PluginView::create(m_frame, pluginSize, element, url,
paramNames, paramValues, mimeType, loadManually);
return pluginView;
}
@@ -1173,7 +1162,7 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget)
m_hasSentResponseToPlugin = false;
}
-Widget* FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL,
+PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL,
const Vector<String>& paramNames, const Vector<String>& paramValues)
{
notImplemented();
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index 4d2dcbc..754d8bc 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -59,10 +59,7 @@ namespace WebCore {
friend class ::QWebFrame;
void callPolicyFunction(FramePolicyFunction function, PolicyAction action);
- private slots:
- void slotCallPolicyFunction(int);
signals:
- void sigCallPolicyFunction(int);
void loadStarted();
void loadProgress(int d);
void loadFinished(bool);
@@ -188,10 +185,10 @@ namespace WebCore {
virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) ;
- virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
+ virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
virtual void redirectDataToPlugin(Widget* pluginWidget);
- virtual Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
+ virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
virtual String overrideMediaType() const;
@@ -209,7 +206,6 @@ namespace WebCore {
QWebFrame *m_webFrame;
ResourceResponse m_response;
bool m_firstData;
- FramePolicyFunction m_policyFunction;
// Plugin view to redirect data to
WebCore::PluginView* m_pluginView;
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index cc4d313..c0e72be 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -582,6 +582,10 @@ private slots:
void jsByteArray();
void ownership();
void nullValue();
+ void baseUrl_data();
+ void baseUrl();
+ void hasSetFocus();
+
private:
QString evalJS(const QString&s) {
// Convert an undefined return variant to the string "undefined"
@@ -2413,5 +2417,61 @@ void tst_QWebFrame::nullValue()
QVERIFY(v.isNull());
}
+void tst_QWebFrame::baseUrl_data()
+{
+ QTest::addColumn<QString>("html");
+ QTest::addColumn<QUrl>("loadUrl");
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<QUrl>("baseUrl");
+
+ QTest::newRow("null") << QString() << QUrl()
+ << QUrl("about:blank") << QUrl("about:blank");
+
+ QTest::newRow("foo") << QString() << QUrl("http://foobar.baz/")
+ << QUrl("http://foobar.baz/") << QUrl("http://foobar.baz/");
+
+ QString html = "<html>"
+ "<head>"
+ "<base href=\"http://foobaz.bar/\" />"
+ "</head>"
+ "</html>";
+ QTest::newRow("customBaseUrl") << html << QUrl("http://foobar.baz/")
+ << QUrl("http://foobar.baz/") << QUrl("http://foobaz.bar/");
+}
+
+void tst_QWebFrame::baseUrl()
+{
+ QFETCH(QString, html);
+ QFETCH(QUrl, loadUrl);
+ QFETCH(QUrl, url);
+ QFETCH(QUrl, baseUrl);
+
+ m_page->mainFrame()->setHtml(html, loadUrl);
+ QCOMPARE(m_page->mainFrame()->url(), url);
+ QCOMPARE(m_page->mainFrame()->baseUrl(), baseUrl);
+}
+
+void tst_QWebFrame::hasSetFocus()
+{
+ QSignalSpy loadSpy(m_page, SIGNAL(loadFinished(bool)));
+ QUrl url = QUrl("qrc:///frametest/iframe.html");
+ m_page->mainFrame()->load(url);
+
+ ::waitForSignal(m_page, SIGNAL(loadFinished(bool)));
+
+ m_page->mainFrame()->setFocus();
+ QVERIFY(m_page->mainFrame()->hasFocus());
+
+ QList<QWebFrame*> children = m_page->mainFrame()->childFrames();
+ for (int i = 0; i < children.size(); ++i) {
+ children.at(i)->setFocus();
+ QVERIFY(children.at(i)->hasFocus());
+ QVERIFY(!m_page->mainFrame()->hasFocus());
+ }
+
+ m_page->mainFrame()->setFocus();
+ QVERIFY(m_page->mainFrame()->hasFocus());
+}
+
QTEST_MAIN(tst_QWebFrame)
#include "tst_qwebframe.moc"
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html
new file mode 100644
index 0000000..f17027c
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html
@@ -0,0 +1,6 @@
+<html>
+<body>
+<p>top</p>
+<iframe src="iframe2.html" width="80%" height="30%"/>
+</body>
+</html>
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html
new file mode 100644
index 0000000..5017435
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html
@@ -0,0 +1,7 @@
+<html>
+<body>
+<p>another iframe</p>
+<iframe src="iframe3.html" width="80%" height="30%"></iframe>
+</body>
+</html>
+
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html
new file mode 100644
index 0000000..ed6ac5b
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>inner</p>
+</body>
+</html>
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 1d6a48e..6c3b296 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -92,6 +92,7 @@ private slots:
void cleanupTestCase();
void acceptNavigationRequest();
+ void infiniteLoopJS();
void loadFinished();
void acceptNavigationRequestWithNewWindow();
void userStyleSheet();
@@ -106,7 +107,7 @@ private slots:
void textSelection();
void textEditing();
void backActionUpdate();
-
+ void frameAt();
void requestCache();
private:
@@ -192,6 +193,26 @@ void tst_QWebPage::acceptNavigationRequest()
m_view->setPage(0);
}
+class JSTestPage : public QWebPage
+{
+Q_OBJECT
+public:
+ JSTestPage(QObject* parent = 0)
+ : QWebPage(parent) {}
+
+public slots:
+ bool shouldInterruptJavaScript() {
+ return true;
+ }
+};
+
+void tst_QWebPage::infiniteLoopJS()
+{
+ JSTestPage* newPage = new JSTestPage(m_view);
+ m_view->setPage(newPage);
+ m_view->setHtml(QString("<html><bodytest</body></html>"), QUrl());
+ m_view->page()->mainFrame()->evaluateJavaScript("var run = true;var a = 1;while(run){a++;}");
+}
void tst_QWebPage::loadFinished()
{
@@ -1116,5 +1137,32 @@ void tst_QWebPage::backActionUpdate()
QVERIFY(action->isEnabled());
}
+void frameAtHelper(QWebPage* webPage, QWebFrame* webFrame, QPoint framePosition)
+{
+ if (!webFrame)
+ return;
+
+ framePosition += QPoint(webFrame->pos());
+ QList<QWebFrame*> children = webFrame->childFrames();
+ for (int i = 0; i < children.size(); ++i) {
+ if (children.at(i)->childFrames().size() > 0)
+ frameAtHelper(webPage, children.at(i), framePosition);
+
+ QRect frameRect(children.at(i)->pos() + framePosition, children.at(i)->geometry().size());
+ QVERIFY(children.at(i) == webPage->frameAt(frameRect.topLeft()));
+ }
+}
+
+void tst_QWebPage::frameAt()
+{
+ QWebView webView;
+ QWebPage* webPage = webView.page();
+ QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool)));
+ QUrl url = QUrl("qrc:///frametest/iframe.html");
+ webPage->mainFrame()->load(url);
+ QTRY_COMPARE(loadSpy.count(), 1);
+ frameAtHelper(webPage, webPage->mainFrame(), webPage->mainFrame()->pos());
+}
+
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc
index 38c5232..3085ce2 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc
@@ -2,6 +2,9 @@
<qresource>
<file>frametest/index.html</file>
<file>frametest/frame_a.html</file>
+ <file>frametest/iframe.html</file>
+ <file>frametest/iframe2.html</file>
+ <file>frametest/iframe3.html</file>
</qresource>
</RCC>
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index 62dad6b..4fc9926 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -39,10 +39,6 @@
//#define QAX_NO_CLASSINFO
-#ifndef UNICODE
-#define UNICODE
-#endif
-
#define QT_CHECK_STATE
#include "qaxobject.h"
@@ -174,7 +170,7 @@ inline DISPID QAxMetaObject::dispIDofName(const QByteArray &name, IDispatch *dis
if (dispid == DISPID_UNKNOWN) {
// get the Dispatch ID from the object
QString unicodeName = QLatin1String(name);
- OLECHAR *names = (TCHAR*)unicodeName.utf16();
+ OLECHAR *names = (wchar_t*)unicodeName.utf16();
disp->GetIDsOfNames(IID_NULL, &names, 1, LOCALE_USER_DEFAULT, &dispid);
if (dispid != DISPID_UNKNOWN)
dispIDs.insert(name, dispid);
@@ -638,7 +634,7 @@ QByteArray QAxEventSink::findProperty(DISPID dispID)
UINT cNames;
typeinfo->GetNames(dispID, &names, 1, &cNames);
if (cNames) {
- propname = QString::fromUtf16((const ushort *)names).toLatin1();
+ propname = QString::fromWCharArray(names).toLatin1();
SysFreeString(names);
}
typeinfo->Release();
@@ -972,7 +968,7 @@ bool QAxBase::setControl(const QString &c)
QUuid uuid(search);
if (uuid.isNull()) {
CLSID clsid;
- HRESULT res = CLSIDFromProgID((WCHAR*)c.utf16(), &clsid);
+ HRESULT res = CLSIDFromProgID((wchar_t*)c.utf16(), &clsid);
if (res == S_OK)
search = QUuid(clsid).toString();
else {
@@ -1137,7 +1133,7 @@ QStringList QAxBase::verbs() const
while (enumVerbs->Next(1, &verb, &c) == S_OK) {
if (!verb.lpszVerbName)
continue;
- QString verbName = QString::fromUtf16((const ushort *)verb.lpszVerbName);
+ QString verbName = QString::fromWCharArray(verb.lpszVerbName);
if (!verbName.isEmpty())
d->verbs.insert(verbName, verb.lVerb);
}
@@ -1265,7 +1261,7 @@ bool QAxBase::initializeLicensedHelper(void *f, const QString &key, IUnknown **p
} else if (licinfo.fRuntimeKeyAvail) {
BSTR licenseKey;
factory2->RequestLicKey(0, &licenseKey);
- QString qlicenseKey = QString::fromUtf16((const ushort *)licenseKey);
+ QString qlicenseKey = QString::fromWCharArray(licenseKey);
SysFreeString(licenseKey);
qWarning("Use license key is '%s' to create object on unlicensed machine.",
qlicenseKey.toLatin1().constData());
@@ -1275,7 +1271,7 @@ bool QAxBase::initializeLicensedHelper(void *f, const QString &key, IUnknown **p
if (licinfo.fRuntimeKeyAvail) {
BSTR licenseKey;
factory2->RequestLicKey(0, &licenseKey);
- QString qlicenseKey = QString::fromUtf16((const ushort *)licenseKey);
+ QString qlicenseKey = QString::fromWCharArray(licenseKey);
SysFreeString(licenseKey);
if (qlicenseKey != key)
@@ -1435,7 +1431,7 @@ bool QAxBase::initializeRemote(IUnknown** ptr)
serverInfo.dwReserved1 = 0;
serverInfo.dwReserved2 = 0;
serverInfo.pAuthInfo = &authInfo;
- serverInfo.pwszName = (WCHAR*)server.utf16();
+ serverInfo.pwszName = (wchar_t*)server.utf16();
IClassFactory *factory = 0;
HRESULT res = CoGetClassObject(QUuid(clsid), CLSCTX_REMOTE_SERVER, &serverInfo, IID_IClassFactory, (void**)&factory);
@@ -1747,7 +1743,7 @@ QMetaObject *qax_readInterfaceInfo(ITypeLib *typeLib, ITypeInfo *typeInfo, const
if (S_OK != typeInfo->GetDocumentation(-1, &bstr, 0, 0, 0))
return 0;
- className = QString::fromUtf16((const ushort *)bstr);
+ className = QString::fromWCharArray(bstr);
SysFreeString(bstr);
generator.readEnumInfo();
@@ -1768,7 +1764,7 @@ QMetaObject *qax_readClassInfo(ITypeLib *typeLib, ITypeInfo *classInfo, const QM
if (S_OK != classInfo->GetDocumentation(-1, &bstr, 0, 0, 0))
return 0;
- className = QString::fromUtf16((const ushort *)bstr);
+ className = QString::fromWCharArray(bstr);
SysFreeString(bstr);
generator.readEnumInfo();
@@ -1795,7 +1791,7 @@ QMetaObject *qax_readClassInfo(ITypeLib *typeLib, ITypeInfo *classInfo, const QM
continue;
interfaceInfo->GetDocumentation(-1, &bstr, 0, 0, 0);
- QString interfaceName = QString::fromUtf16((const ushort *)bstr);
+ QString interfaceName = QString::fromWCharArray(bstr);
SysFreeString(bstr);
QByteArray key;
@@ -1843,7 +1839,7 @@ MetaObjectGenerator::MetaObjectGenerator(ITypeLib *tlib, ITypeInfo *tinfo)
typelib->AddRef();
BSTR bstr;
typelib->GetDocumentation(-1, &bstr, 0, 0, 0);
- current_typelib = QString::fromUtf16((const ushort *)bstr).toLatin1();
+ current_typelib = QString::fromWCharArray(bstr).toLatin1();
SysFreeString(bstr);
}
readClassInfo();
@@ -1891,13 +1887,13 @@ QByteArray MetaObjectGenerator::usertypeToString(const TYPEDESC &tdesc, ITypeInf
// get type library name
BSTR typelibname = 0;
usertypelib->GetDocumentation(-1, &typelibname, 0, 0, 0);
- QByteArray typeLibName = QString::fromUtf16((const ushort *)typelibname).toLatin1();
+ QByteArray typeLibName = QString::fromWCharArray(typelibname).toLatin1();
SysFreeString(typelibname);
// get type name
BSTR usertypename = 0;
usertypelib->GetDocumentation(index, &usertypename, 0, 0, 0);
- QByteArray userTypeName = QString::fromUtf16((const ushort *)usertypename).toLatin1();
+ QByteArray userTypeName = QString::fromWCharArray(usertypename).toLatin1();
SysFreeString(usertypename);
if (hasEnum(userTypeName)) // known enum?
@@ -2287,7 +2283,7 @@ void MetaObjectGenerator::readEnumInfo()
BSTR enumname;
QByteArray enumName;
if (typelib->GetDocumentation(i, &enumname, 0, 0, 0) == S_OK) {
- enumName = QString::fromUtf16((const ushort *)enumname).toLatin1();
+ enumName = QString::fromWCharArray(enumname).toLatin1();
SysFreeString(enumname);
} else {
enumName = "enum" + QByteArray::number(++enum_serial);
@@ -2310,7 +2306,7 @@ void MetaObjectGenerator::readEnumInfo()
UINT maxNamesOut;
enuminfo->GetNames(memid, &valuename, 1, &maxNamesOut);
if (maxNamesOut) {
- valueName = QString::fromUtf16((const ushort *)valuename).toLatin1();
+ valueName = QString::fromWCharArray(valuename).toLatin1();
SysFreeString(valuename);
} else {
valueName = "value" + QByteArray::number(valueindex++);
@@ -2467,7 +2463,7 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs)
QList<QByteArray> names;
int p;
for (p = 0; p < (int)maxNamesOut; ++p) {
- names << QString::fromUtf16((const ushort *)bstrNames[p]).toLatin1();
+ names << QString::fromWCharArray(bstrNames[p]).toLatin1();
SysFreeString(bstrNames[p]);
}
@@ -2594,7 +2590,7 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs)
// get function documentation
BSTR bstrDocu;
info->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0);
- QString strDocu = QString::fromUtf16((const ushort*)bstrDocu);
+ QString strDocu = QString::fromWCharArray(bstrDocu);
SysFreeString(bstrDocu);
if (!!strDocu)
desc += '[' + strDocu + ']';
@@ -2641,7 +2637,7 @@ void MetaObjectGenerator::readVarsInfo(ITypeInfo *typeinfo, ushort nVars)
QByteArray variableName;
uint flags = 0;
- variableName = QString::fromUtf16((const ushort *)bstrName).toLatin1();
+ variableName = QString::fromWCharArray(bstrName).toLatin1();
SysFreeString(bstrName);
// get variable type
@@ -2677,7 +2673,7 @@ void MetaObjectGenerator::readVarsInfo(ITypeInfo *typeinfo, ushort nVars)
// get function documentation
BSTR bstrDocu;
info->GetDocumentation(vardesc->memid, 0, &bstrDocu, 0, 0);
- QString strDocu = QString::fromUtf16((const ushort*)bstrDocu);
+ QString strDocu = QString::fromWCharArray(bstrDocu);
SysFreeString(bstrDocu);
if (!!strDocu)
desc += '[' + strDocu + ']';
@@ -2800,7 +2796,7 @@ void MetaObjectGenerator::readEventInterface(ITypeInfo *eventinfo, IConnectionPo
QList<QByteArray> names;
int p;
for (p = 0; p < (int)maxNamesOut; ++p) {
- names << QString::fromUtf16((const ushort *)bstrNames[p]).toLatin1();
+ names << QString::fromWCharArray(bstrNames[p]).toLatin1();
SysFreeString(bstrNames[p]);
}
@@ -2824,7 +2820,7 @@ void MetaObjectGenerator::readEventInterface(ITypeInfo *eventinfo, IConnectionPo
// get function documentation
BSTR bstrDocu;
eventinfo->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0);
- QString strDocu = QString::fromUtf16((const ushort*)bstrDocu);
+ QString strDocu = QString::fromWCharArray(bstrDocu);
SysFreeString(bstrDocu);
if (!!strDocu)
desc += '[' + strDocu + ']';
@@ -2982,7 +2978,7 @@ QMetaObject *MetaObjectGenerator::metaObject(const QMetaObject *parentObject, co
if (typelib) {
BSTR bstr;
typelib->GetDocumentation(-1, &bstr, 0, 0, 0);
- current_typelib = QString::fromUtf16((const ushort *)bstr).toLatin1();
+ current_typelib = QString::fromWCharArray(bstr).toLatin1();
SysFreeString(bstr);
}
if (d->tryCache && tryCache())
@@ -3391,9 +3387,9 @@ static bool checkHRESULT(HRESULT hres, EXCEPINFO *exc, QAxBase *that, const QStr
exc->pfnDeferredFillIn(exc);
code = exc->wCode ? exc->wCode : exc->scode;
- source = QString::fromUtf16((const ushort *)exc->bstrSource);
- desc = QString::fromUtf16((const ushort *)exc->bstrDescription);
- help = QString::fromUtf16((const ushort *)exc->bstrHelpFile);
+ source = QString::fromWCharArray(exc->bstrSource);
+ desc = QString::fromWCharArray(exc->bstrDescription);
+ help = QString::fromWCharArray(exc->bstrHelpFile);
uint helpContext = exc->dwHelpContext;
if (helpContext && !help.isEmpty())
@@ -4228,7 +4224,7 @@ public:
if (!var)
return E_POINTER;
- QString property = QString::fromUtf16((const ushort *)name);
+ QString property = QString::fromWCharArray(name);
QVariant qvar = map.value(property);
QVariantToVARIANT(qvar, *var);
return S_OK;
@@ -4237,7 +4233,7 @@ public:
{
if (!var)
return E_POINTER;
- QString property = QString::fromUtf16((const ushort *)name);
+ QString property = QString::fromWCharArray(name);
QVariant qvar = VARIANTToQVariant(*var, 0);
map[property] = qvar;
diff --git a/src/activeqt/container/qaxdump.cpp b/src/activeqt/container/qaxdump.cpp
index 39d5121..a654a8f 100644
--- a/src/activeqt/container/qaxdump.cpp
+++ b/src/activeqt/container/qaxdump.cpp
@@ -66,8 +66,8 @@ QString qax_docuFromName(ITypeInfo *typeInfo, const QString &name)
BSTR docStringBstr, helpFileBstr;
ulong helpContext;
HRESULT hres = typeInfo->GetDocumentation(memId, 0, &docStringBstr, &helpContext, &helpFileBstr);
- QString docString = QString::fromUtf16((const ushort *)docStringBstr);
- QString helpFile = QString::fromUtf16((const ushort *)helpFileBstr);
+ QString docString = QString::fromWCharArray(docStringBstr);
+ QString helpFile = QString::fromWCharArray(helpFileBstr);
SysFreeString(docStringBstr);
SysFreeString(helpFileBstr);
if (hres == S_OK) {
diff --git a/src/activeqt/container/qaxobject.cpp b/src/activeqt/container/qaxobject.cpp
index 3526f93..63bdd5e 100644
--- a/src/activeqt/container/qaxobject.cpp
+++ b/src/activeqt/container/qaxobject.cpp
@@ -37,10 +37,6 @@
**
****************************************************************************/
-#ifndef UNICODE
-#define UNICODE
-#endif
-
#include "qaxobject.h"
#ifndef QT_NO_WIN_ACTIVEQT
@@ -126,7 +122,7 @@ QAxObject::~QAxObject()
}
/*!
- \reimp
+ \internal
*/
const QMetaObject *QAxObject::metaObject() const
{
@@ -134,7 +130,7 @@ const QMetaObject *QAxObject::metaObject() const
}
/*!
- \reimp
+ \internal
*/
const QMetaObject *QAxObject::parentMetaObject() const
{
@@ -152,7 +148,7 @@ void *QAxObject::qt_metacast(const char *cname)
}
/*!
- \reimp
+ \internal
*/
const char *QAxObject::className() const
{
@@ -160,7 +156,7 @@ const char *QAxObject::className() const
}
/*!
- \reimp
+ \internal
*/
int QAxObject::qt_metacall(QMetaObject::Call call, int id, void **v)
{
diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp
index dcfc84b..2ee08b3 100644
--- a/src/activeqt/container/qaxscript.cpp
+++ b/src/activeqt/container/qaxscript.cpp
@@ -37,10 +37,6 @@
**
****************************************************************************/
-#ifndef UNICODE
-#define UNICODE
-#endif
-
#include "qaxscript.h"
#ifndef QT_NO_WIN_ACTIVEQT
@@ -194,7 +190,7 @@ HRESULT WINAPI QAxScriptSite::GetItemInfo(LPCOLESTR pstrName, DWORD mask, IUnkno
else if (mask & SCRIPTINFO_ITYPEINFO)
return E_POINTER;
- QAxBase *object = script->findObject(QString::fromUtf16((const ushort*)pstrName));
+ QAxBase *object = script->findObject(QString::fromWCharArray(pstrName));
if (!object)
return TYPE_E_ELEMENTNOTFOUND;
@@ -236,9 +232,9 @@ HRESULT WINAPI QAxScriptSite::OnScriptTerminate(const VARIANT *result, const EXC
emit script->finished(VARIANTToQVariant(*result, 0));
if (exception)
emit script->finished(exception->wCode,
- QString::fromUtf16((const ushort*)exception->bstrSource),
- QString::fromUtf16((const ushort*)exception->bstrDescription),
- QString::fromUtf16((const ushort*)exception->bstrHelpFile)
+ QString::fromWCharArray(exception->bstrSource),
+ QString::fromWCharArray(exception->bstrDescription),
+ QString::fromWCharArray(exception->bstrHelpFile)
);
return S_OK;
}
@@ -287,14 +283,14 @@ HRESULT WINAPI QAxScriptSite::OnScriptError(IActiveScriptError *error)
error->GetSourcePosition(&context, &lineNumber, &charPos);
HRESULT hres = error->GetSourceLineText(&bstrLineText);
if (hres == S_OK) {
- lineText = QString::fromUtf16((const ushort*)bstrLineText);
+ lineText = QString::fromWCharArray(bstrLineText);
SysFreeString(bstrLineText);
}
SysFreeString(exception.bstrSource);
SysFreeString(exception.bstrDescription);
SysFreeString(exception.bstrHelpFile);
- emit script->error(exception.wCode, QString::fromUtf16((const ushort*)exception.bstrDescription), lineNumber, lineText);
+ emit script->error(exception.wCode, QString::fromWCharArray(exception.bstrDescription), lineNumber, lineText);
return S_OK;
}
@@ -463,7 +459,7 @@ bool QAxScriptEngine::initialize(IUnknown **ptr)
return false;
CLSID clsid;
- HRESULT hres = CLSIDFromProgID((WCHAR*)script_language.utf16(), &clsid);
+ HRESULT hres = CLSIDFromProgID((wchar_t*)script_language.utf16(), &clsid);
if(FAILED(hres))
return false;
@@ -609,7 +605,7 @@ void QAxScriptEngine::addItem(const QString &name)
if (!engine)
return;
- engine->AddNamedItem((WCHAR*)name.utf16(), SCRIPTITEM_ISSOURCE|SCRIPTITEM_ISVISIBLE);
+ engine->AddNamedItem((wchar_t*)name.utf16(), SCRIPTITEM_ISSOURCE|SCRIPTITEM_ISVISIBLE);
#endif
}
@@ -1173,7 +1169,7 @@ bool QAxScriptManager::registerEngine(const QString &name, const QString &extens
return false;
CLSID clsid;
- HRESULT hres = CLSIDFromProgID((WCHAR*)name.utf16(), &clsid);
+ HRESULT hres = CLSIDFromProgID((wchar_t*)name.utf16(), &clsid);
if (hres != S_OK)
return false;
diff --git a/src/activeqt/container/qaxselect.cpp b/src/activeqt/container/qaxselect.cpp
index 5de39e4..a0c725d 100644
--- a/src/activeqt/container/qaxselect.cpp
+++ b/src/activeqt/container/qaxselect.cpp
@@ -52,54 +52,46 @@ public:
: QAbstractListModel(parent)
{
HKEY classes_key;
- QT_WA_INLINE(
- RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ, &classes_key),
- RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &classes_key));
+ RegOpenKeyEx(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ, &classes_key);
if (!classes_key)
return;
DWORD index = 0;
LONG result = 0;
- TCHAR buffer[256];
- DWORD szBuffer = sizeof(buffer);
+ wchar_t buffer[256];
+ DWORD szBuffer = sizeof(buffer) / sizeof(wchar_t);
FILETIME ft;
do {
- result = QT_WA_INLINE(
- RegEnumKeyExW(classes_key, index, (wchar_t*)&buffer, &szBuffer, 0, 0, 0, &ft),
- RegEnumKeyExA(classes_key, index, (char*)&buffer, &szBuffer, 0, 0, 0, &ft));
- szBuffer = sizeof(buffer);
+ result = RegEnumKeyEx(classes_key, index, buffer, &szBuffer, 0, 0, 0, &ft);
+ szBuffer = sizeof(buffer) / sizeof(wchar_t);
if (result == ERROR_SUCCESS) {
HKEY sub_key;
- QString clsid = QT_WA_INLINE(QString::fromUtf16((ushort*)buffer), QString::fromLocal8Bit((char*)buffer));
- result = QT_WA_INLINE(
- RegOpenKeyExW(classes_key, reinterpret_cast<const wchar_t *>(QString(clsid + "\\Control").utf16()), 0, KEY_READ, &sub_key),
- RegOpenKeyA(classes_key, QString(clsid + QLatin1String("\\Control")).toLocal8Bit(), &sub_key));
+ QString clsid = QString::fromWCharArray(buffer);
+ result = RegOpenKeyEx(classes_key, reinterpret_cast<const wchar_t *>(QString(clsid + "\\Control").utf16()), 0, KEY_READ, &sub_key);
if (result == ERROR_SUCCESS) {
RegCloseKey(sub_key);
- QT_WA_INLINE(
- RegistryQueryValueW(classes_key, buffer, (LPBYTE)buffer, &szBuffer),
- RegQueryValueA(classes_key, (char*)buffer, (char*)buffer, (LONG*)&szBuffer));
- QString name = QT_WA_INLINE(QString::fromUtf16((ushort*)buffer, szBuffer / sizeof(TCHAR)) , QString::fromLocal8Bit((char*)buffer, szBuffer));
+ RegistryQueryValue(classes_key, buffer, (LPBYTE)buffer, &szBuffer);
+ QString name = QString::fromWCharArray(buffer);
controls << name;
clsids.insert(name, clsid);
}
result = ERROR_SUCCESS;
}
- szBuffer = sizeof(buffer);
+ szBuffer = sizeof(buffer) / sizeof(wchar_t);
++index;
} while (result == ERROR_SUCCESS);
RegCloseKey(classes_key);
controls.sort();
}
- LONG RegistryQueryValueW(HKEY hKey, LPCWSTR lpSubKey, LPBYTE lpData, LPDWORD lpcbData)
+ LONG RegistryQueryValue(HKEY hKey, LPCWSTR lpSubKey, LPBYTE lpData, LPDWORD lpcbData)
{
LONG ret = ERROR_FILE_NOT_FOUND;
HKEY hSubKey = NULL;
- RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ, &hSubKey);
+ RegOpenKeyEx(hKey, lpSubKey, 0, KEY_READ, &hSubKey);
if (hSubKey) {
- ret = RegQueryValueExW(hSubKey, 0, 0, 0, lpData, lpcbData);
+ ret = RegQueryValueEx(hSubKey, 0, 0, 0, lpData, lpcbData);
RegCloseKey(hSubKey);
}
return ret;
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index ebec872..ae468ef 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -37,11 +37,6 @@
**
****************************************************************************/
-#ifndef UNICODE
-#define UNICODE
-#endif
-
-
#include "qaxwidget.h"
#ifndef QT_NO_WIN_ACTIVEQT
@@ -470,7 +465,7 @@ static QAbstractEventDispatcher::EventFilter previous_filter = 0;
#if defined(Q_WS_WINCE)
static int filter_ref = 0;
#else
-static const char *qaxatom = "QAxContainer4_Atom";
+static const wchar_t *qaxatom = L"QAxContainer4_Atom";
#endif
// The filter procedure listening to user interaction on the control
@@ -714,7 +709,7 @@ bool QAxClientSite::activateObject(bool initialized, const QByteArray &data)
BSTR userType;
HRESULT result = m_spOleObject->GetUserType(USERCLASSTYPE_SHORT, &userType);
if (result == S_OK) {
- widget->setWindowTitle(QString::fromUtf16((const ushort *)userType));
+ widget->setWindowTitle(QString::fromWCharArray(userType));
CoTaskMemFree(userType);
}
} else {
@@ -984,10 +979,7 @@ HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, DWORD /*grfModif
eventTranslated = false;
if (lpMsg->message == WM_KEYDOWN && !lpMsg->wParam)
return S_OK;
- QT_WA_INLINE(
- SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam),
- SendMessageA(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam)
- );
+ SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam);
return S_OK;
}
@@ -1173,15 +1165,15 @@ HRESULT WINAPI QAxClientSite::InsertMenus(HMENU /*hmenuShared*/, LPOLEMENUGROUPW
#endif
}
-static int menuItemEntry(HMENU menu, int index, MENUITEMINFOA item, QString &text, QPixmap &/*icon*/)
+static int menuItemEntry(HMENU menu, int index, MENUITEMINFO item, QString &text, QPixmap &/*icon*/)
{
if (item.fType == MFT_STRING && item.cch) {
- char *titlebuf = new char[item.cch+1];
+ wchar_t *titlebuf = new wchar_t[item.cch + 1];
item.dwTypeData = titlebuf;
item.cch++;
- ::GetMenuItemInfoA(menu, index, true, &item);
- text = QString::fromLocal8Bit(titlebuf);
- delete []titlebuf;
+ ::GetMenuItemInfo(menu, index, true, &item);
+ text = QString::fromWCharArray(titlebuf);
+ delete [] titlebuf;
return MFT_STRING;
}
#if 0
@@ -1191,7 +1183,7 @@ static int menuItemEntry(HMENU menu, int index, MENUITEMINFOA item, QString &tex
GetBitmapDimensionEx(hbm, &bmsize);
QPixmap pixmap(1,1);
QSize sz(MAP_LOGHIM_TO_PIX(bmsize.cx, pixmap.logicalDpiX()),
- MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY()));
+ MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY()));
pixmap.resize(bmsize.cx, bmsize.cy);
if (!pixmap.isNull()) {
@@ -1215,11 +1207,11 @@ QMenu *QAxClientSite::generatePopup(HMENU subMenu, QWidget *parent)
if (count)
popup = new QMenu(parent);
for (int i = 0; i < count; ++i) {
- MENUITEMINFOA item;
- memset(&item, 0, sizeof(MENUITEMINFOA));
- item.cbSize = sizeof(MENUITEMINFOA);
+ MENUITEMINFO item;
+ memset(&item, 0, sizeof(MENUITEMINFO));
+ item.cbSize = sizeof(MENUITEMINFO);
item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU;
- ::GetMenuItemInfoA(subMenu, i, true, &item);
+ ::GetMenuItemInfo(subMenu, i, true, &item);
QAction *action = 0;
QMenu *popupMenu = 0;
@@ -1295,11 +1287,11 @@ HRESULT WINAPI QAxClientSite::SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND
int count = GetMenuItemCount(hmenuShared);
for (int i = 0; i < count; ++i) {
- MENUITEMINFOA item;
- memset(&item, 0, sizeof(MENUITEMINFOA));
- item.cbSize = sizeof(MENUITEMINFOA);
+ MENUITEMINFO item;
+ memset(&item, 0, sizeof(MENUITEMINFO));
+ item.cbSize = sizeof(MENUITEMINFO);
item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU;
- ::GetMenuItemInfoA(hmenuShared, i, true, &item);
+ ::GetMenuItemInfo(hmenuShared, i, true, &item);
QAction *action = 0;
QMenu *popupMenu = 0;
@@ -1379,7 +1371,7 @@ int QAxClientSite::qt_metacall(QMetaObject::Call call, int isignal, void **argv)
OleMenuItem oleItem = menuItemMap.value(action);
if (oleItem.hMenu)
- ::PostMessageA(m_menuOwner, WM_COMMAND, oleItem.id, 0);
+ ::PostMessage(m_menuOwner, WM_COMMAND, oleItem.id, 0);
return -1;
#endif
}
@@ -1404,7 +1396,7 @@ HRESULT WINAPI QAxClientSite::RemoveMenus(HMENU /*hmenuShared*/)
HRESULT WINAPI QAxClientSite::SetStatusText(LPCOLESTR pszStatusText)
{
- QStatusTipEvent tip(QString::fromUtf16((const ushort *)(BSTR)pszStatusText));
+ QStatusTipEvent tip(QString::fromWCharArray(pszStatusText));
QApplication::sendEvent(widget, &tip);
return S_OK;
}
@@ -1513,7 +1505,7 @@ HRESULT WINAPI QAxClientSite::SetActiveObject(IOleInPlaceActiveObject *pActiveOb
AX_DEBUG(QAxClientSite::SetActiveObject);
if (pszObjName && widget)
- widget->setWindowTitle(QString::fromUtf16((const ushort *)(BSTR)pszObjName));
+ widget->setWindowTitle(QString::fromWCharArray(pszObjName));
if (m_spInPlaceActiveObject) {
if (!inPlaceModelessEnabled)
@@ -1952,12 +1944,12 @@ bool QAxWidget::createHostWindow(bool initialized, const QByteArray &data)
container->activateObject(initialized, data);
#if !defined(Q_OS_WINCE)
- ATOM filter_ref = FindAtomA(qaxatom);
+ ATOM filter_ref = FindAtom(qaxatom);
#endif
if (!filter_ref)
previous_filter = QAbstractEventDispatcher::instance()->setEventFilter(axc_FilterProc);
#if !defined(Q_OS_WINCE)
- AddAtomA(qaxatom);
+ AddAtom(qaxatom);
#else
++filter_ref;
#endif
@@ -1992,10 +1984,10 @@ void QAxWidget::clear()
return;
if (!control().isEmpty()) {
#if !defined(Q_OS_WINCE)
- ATOM filter_ref = FindAtomA(qaxatom);
+ ATOM filter_ref = FindAtom(qaxatom);
if (filter_ref)
DeleteAtom(filter_ref);
- filter_ref = FindAtomA(qaxatom);
+ filter_ref = FindAtom(qaxatom);
if (!filter_ref) {
#else
if (!filter_ref && !--filter_ref) {
@@ -2042,7 +2034,7 @@ bool QAxWidget::doVerb(const QString &verb)
*/
/*!
- \reimp
+ \internal
*/
const QMetaObject *QAxWidget::metaObject() const
{
@@ -2050,7 +2042,7 @@ const QMetaObject *QAxWidget::metaObject() const
}
/*!
- \reimp
+ \internal
*/
const QMetaObject *QAxWidget::parentMetaObject() const
{
@@ -2068,7 +2060,7 @@ void *QAxWidget::qt_metacast(const char *cname)
}
/*!
- \reimp
+ \internal
*/
const char *QAxWidget::className() const
{
@@ -2076,7 +2068,7 @@ const char *QAxWidget::className() const
}
/*!
- \reimp
+ \internal
*/
int QAxWidget::qt_metacall(QMetaObject::Call call, int id, void **v)
{
diff --git a/src/activeqt/control/qaxfactory.cpp b/src/activeqt/control/qaxfactory.cpp
index c65fbb8..742e93e 100644
--- a/src/activeqt/control/qaxfactory.cpp
+++ b/src/activeqt/control/qaxfactory.cpp
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
-extern char qAxModuleFilename[MAX_PATH];
+extern wchar_t qAxModuleFilename[MAX_PATH];
/*!
\class QAxFactory
@@ -277,7 +277,7 @@ bool QAxFactory::validateLicenseKey(const QString &key, const QString &licenseKe
return true;
if (licenseKey.isEmpty()) {
- QString licFile(QFile::decodeName(qAxModuleFilename));
+ QString licFile(QString::fromWCharArray(qAxModuleFilename));
int lastDot = licFile.lastIndexOf(QLatin1Char('.'));
licFile = licFile.left(lastDot) + QLatin1String(".lic");
if (QFile::exists(licFile))
@@ -360,7 +360,7 @@ bool QAxFactory::isServer()
return qAxIsServer;
}
-extern char qAxModuleFilename[MAX_PATH];
+extern wchar_t qAxModuleFilename[MAX_PATH];
/*!
Returns the directory that contains the server binary.
@@ -372,7 +372,7 @@ extern char qAxModuleFilename[MAX_PATH];
*/
QString QAxFactory::serverDirPath()
{
- return QFileInfo(QString::fromLocal8Bit(qAxModuleFilename)).absolutePath();
+ return QFileInfo(QString::fromWCharArray(qAxModuleFilename)).absolutePath();
}
/*!
@@ -384,7 +384,7 @@ QString QAxFactory::serverDirPath()
*/
QString QAxFactory::serverFilePath()
{
- return QString::fromLocal8Bit(qAxModuleFilename);
+ return QString::fromWCharArray(qAxModuleFilename);
}
/*!
@@ -492,7 +492,7 @@ bool QAxFactory::registerActiveObject(QObject *object)
if (qstricmp(object->metaObject()->classInfo(object->metaObject()->indexOfClassInfo("RegisterObject")).value(), "yes"))
return false;
- if (!QString::fromLocal8Bit(qAxModuleFilename).toLower().endsWith(QLatin1String(".exe")))
+ if (!QString::fromWCharArray(qAxModuleFilename).toLower().endsWith(QLatin1String(".exe")))
return false;
ActiveObject *active = new ActiveObject(object, qAxFactory());
diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp
index a9b3271..e6b0c17 100644
--- a/src/activeqt/control/qaxserver.cpp
+++ b/src/activeqt/control/qaxserver.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
bool qAxIsServer = false;
HANDLE qAxInstance = 0;
ITypeLib *qAxTypeLibrary = 0;
-char qAxModuleFilename[MAX_PATH];
+wchar_t qAxModuleFilename[MAX_PATH];
bool qAxOutProcServer = false;
// The QAxFactory instance
@@ -116,19 +116,19 @@ QString qAxInit()
InitializeCriticalSection(&qAxModuleSection);
- libFile = QString::fromLocal8Bit(qAxModuleFilename);
+ libFile = QString::fromWCharArray(qAxModuleFilename);
libFile = libFile.toLower();
- if (LoadTypeLibEx((TCHAR*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
+ if (LoadTypeLibEx((wchar_t*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
return libFile;
int lastDot = libFile.lastIndexOf(QLatin1Char('.'));
libFile = libFile.left(lastDot) + QLatin1String(".tlb");
- if (LoadTypeLibEx((TCHAR*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
+ if (LoadTypeLibEx((wchar_t*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
return libFile;
lastDot = libFile.lastIndexOf(QLatin1Char('.'));
libFile = libFile.left(lastDot) + QLatin1String(".olb");
- if (LoadTypeLibEx((TCHAR*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
+ if (LoadTypeLibEx((wchar_t*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
return libFile;
libFile = QString();
@@ -207,7 +207,7 @@ QString qax_clean_type(const QString &type, const QMetaObject *mo)
HRESULT UpdateRegistry(BOOL bRegister)
{
qAxIsServer = false;
- QString file = QString::fromLocal8Bit(qAxModuleFilename);
+ QString file = QString::fromWCharArray(qAxModuleFilename);
QString path = file.left(file.lastIndexOf(QLatin1Char('\\'))+1);
QString module = file.right(file.length() - path.length());
module = module.left(module.lastIndexOf(QLatin1Char('.')));
@@ -229,7 +229,7 @@ HRESULT UpdateRegistry(BOOL bRegister)
typeLibVersion = QString::number((uint)major) + QLatin1Char('.') + QString::number((uint)minor);
if (bRegister)
- RegisterTypeLib(qAxTypeLibrary, (TCHAR*)libFile.utf16(), 0);
+ RegisterTypeLib(qAxTypeLibrary, (wchar_t*)libFile.utf16(), 0);
else
UnRegisterTypeLib(libAttr->guid, libAttr->wMajorVerNum, libAttr->wMinorVerNum, libAttr->lcid, libAttr->syskind);
@@ -1071,7 +1071,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver)
QFile file(outfile);
file.remove();
- QString filebase = QString::fromLocal8Bit(qAxModuleFilename);
+ QString filebase = QString::fromWCharArray(qAxModuleFilename);
filebase = filebase.left(filebase.lastIndexOf(QLatin1Char('.')));
QString appID = qAxFactory()->appID().toString().toUpper();
@@ -1107,7 +1107,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver)
out << "/****************************************************************************" << endl;
out << "** Interface definition generated for ActiveQt project" << endl;
out << "**" << endl;
- out << "** '" << qAxModuleFilename << '\'' << endl;
+ out << "** '" << QString::fromWCharArray(qAxModuleFilename) << '\'' << endl;
out << "**" << endl;
out << "** Created: " << QDateTime::currentDateTime().toString() << endl;
out << "**" << endl;
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index 2cac004..d7a8e07 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -788,17 +788,9 @@ bool qax_winEventFilter(void *message)
QAxServerBase *axbase = 0;
while (!axbase && baseHwnd) {
#ifdef GWLP_USERDATA
- QT_WA({
- axbase = (QAxServerBase*)GetWindowLongPtrW(baseHwnd, GWLP_USERDATA);
- }, {
- axbase = (QAxServerBase*)GetWindowLongPtrA(baseHwnd, GWLP_USERDATA);
- });
+ axbase = (QAxServerBase*)GetWindowLongPtr(baseHwnd, GWLP_USERDATA);
#else
- QT_WA({
- axbase = (QAxServerBase*)GetWindowLongW(baseHwnd, GWL_USERDATA);
- }, {
- axbase = (QAxServerBase*)GetWindowLongA(baseHwnd, GWL_USERDATA);
- });
+ axbase = (QAxServerBase*)GetWindowLong(baseHwnd, GWL_USERDATA);
#endif
baseHwnd = ::GetParent(baseHwnd);
@@ -905,11 +897,7 @@ public:
// hook into eventloop; this allows a server to create his own QApplication object
if (!qax_hhook && qax_ownQApp) {
- QT_WA({
- qax_hhook = SetWindowsHookExW(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId());
- }, {
- qax_hhook = SetWindowsHookExA(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId());
- });
+ qax_hhook = SetWindowsHookEx(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId());
}
HRESULT res;
@@ -983,7 +971,7 @@ public:
HRESULT WINAPI CreateInstanceLic(IUnknown *pUnkOuter, IUnknown *pUnkReserved, REFIID iid, BSTR bKey, PVOID *ppObject)
{
- QString licenseKey = QString::fromUtf16((const ushort *)bKey);
+ QString licenseKey = QString::fromWCharArray(bKey);
if (!qAxFactory()->validateLicenseKey(className, licenseKey))
return CLASS_E_NOTLICENSED;
return CreateInstanceHelper(pUnkOuter, iid, ppObject);
@@ -1303,15 +1291,11 @@ bool QAxServerBase::internalCreate()
internalBind();
if (isWidget) {
- if (!stayTopLevel) {
- QEvent e(QEvent::EmbeddingControl);
- QApplication::sendEvent(qt.widget, &e);
- QT_WA({
- ::SetWindowLongW(qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
- }, {
- ::SetWindowLongA(qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
- });
- }
+ if (!stayTopLevel) {
+ QEvent e(QEvent::EmbeddingControl);
+ QApplication::sendEvent(qt.widget, &e);
+ ::SetWindowLong(qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
+ }
qt.widget->setAttribute(Qt::WA_QuitOnClose, false);
qt.widget->move(0, 0);
@@ -1368,52 +1352,26 @@ class HackWidget : public QWidget
LRESULT CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_CREATE) {
- QAxServerBase *that;
- QT_WA({
- CREATESTRUCTW *cs = (CREATESTRUCTW*)lParam;
- that = (QAxServerBase*)cs->lpCreateParams;
- }, {
- CREATESTRUCTA *cs = (CREATESTRUCTA*)lParam;
- that = (QAxServerBase*)cs->lpCreateParams;
- });
+ CREATESTRUCT *cs = (CREATESTRUCT*)lParam;
+ QAxServerBase *that = (QAxServerBase*)cs->lpCreateParams;
#ifdef GWLP_USERDATA
- QT_WA({
- SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)that);
- }, {
- SetWindowLongPtrA(hWnd, GWLP_USERDATA, (LONG_PTR)that);
- });
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)that);
#else
- QT_WA({
- SetWindowLongW(hWnd, GWL_USERDATA, (LONG)that);
- }, {
- SetWindowLongA(hWnd, GWL_USERDATA, (LONG)that);
- });
+ SetWindowLong(hWnd, GWL_USERDATA, (LONG)that);
#endif
- that->m_hWnd = hWnd;
+ that->m_hWnd = hWnd;
- QT_WA({
- return ::DefWindowProcW(hWnd, uMsg, wParam, lParam);
- }, {
- return ::DefWindowProcA(hWnd, uMsg, wParam, lParam);
- });
+ return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
}
QAxServerBase *that = 0;
#ifdef GWLP_USERDATA
- QT_WA({
- that = (QAxServerBase*)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
- }, {
- that = (QAxServerBase*)GetWindowLongPtrA(hWnd, GWLP_USERDATA);
- });
+ that = (QAxServerBase*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
#else
- QT_WA({
- that = (QAxServerBase*)GetWindowLongW(hWnd, GWL_USERDATA);
- }, {
- that = (QAxServerBase*)GetWindowLongA(hWnd, GWL_USERDATA);
- });
+ that = (QAxServerBase*)GetWindowLong(hWnd, GWL_USERDATA);
#endif
if (that) {
@@ -1563,11 +1521,7 @@ LRESULT CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam,
}
}
- QT_WA({
- return ::DefWindowProcW(hWnd, uMsg, wParam, lParam);
- }, {
- return ::DefWindowProcA(hWnd, uMsg, wParam, lParam);
- });
+ return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
}
/*!
@@ -1583,54 +1537,29 @@ HWND QAxServerBase::create(HWND hWndParent, RECT& rcPos)
QString cn(QLatin1String("QAxControl"));
cn += QString::number((int)ActiveXProc);
if (!atom) {
- QT_WA({
- WNDCLASSW wcTemp;
- wcTemp.style = CS_DBLCLKS;
- wcTemp.cbClsExtra = 0;
- wcTemp.cbWndExtra = 0;
- wcTemp.hbrBackground = 0;
- wcTemp.hCursor = 0;
- wcTemp.hIcon = 0;
- wcTemp.hInstance = hInst;
- wcTemp.lpszClassName = (wchar_t*)cn.utf16();
- wcTemp.lpszMenuName = 0;
- wcTemp.lpfnWndProc = ActiveXProc;
-
- atom = RegisterClassW(&wcTemp);
- }, {
- QByteArray cna = cn.toLatin1();
- WNDCLASSA wcTemp;
- wcTemp.style = CS_DBLCLKS;
- wcTemp.cbClsExtra = 0;
- wcTemp.cbWndExtra = 0;
- wcTemp.hbrBackground = 0;
- wcTemp.hCursor = 0;
- wcTemp.hIcon = 0;
- wcTemp.hInstance = hInst;
- wcTemp.lpszClassName = cna.data();
- wcTemp.lpszMenuName = 0;
- wcTemp.lpfnWndProc = ActiveXProc;
-
- atom = RegisterClassA(&wcTemp);
- });
+ WNDCLASS wcTemp;
+ wcTemp.style = CS_DBLCLKS;
+ wcTemp.cbClsExtra = 0;
+ wcTemp.cbWndExtra = 0;
+ wcTemp.hbrBackground = 0;
+ wcTemp.hCursor = 0;
+ wcTemp.hIcon = 0;
+ wcTemp.hInstance = hInst;
+ wcTemp.lpszClassName = (wchar_t*)cn.utf16();
+ wcTemp.lpszMenuName = 0;
+ wcTemp.lpfnWndProc = ActiveXProc;
+
+ atom = RegisterClass(&wcTemp);
}
LeaveCriticalSection(&createWindowSection);
if (!atom && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
return 0;
Q_ASSERT(!m_hWnd);
- HWND hWnd = 0;
- QT_WA({
- hWnd = ::CreateWindowW((wchar_t*)cn.utf16(), 0,
- WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
- rcPos.left, rcPos.top, rcPos.right - rcPos.left,
- rcPos.bottom - rcPos.top, hWndParent, 0, hInst, this);
- }, {
- hWnd = ::CreateWindowA(cn.toLatin1().data(), 0,
- WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
- rcPos.left, rcPos.top, rcPos.right - rcPos.left,
- rcPos.bottom - rcPos.top, hWndParent, 0, hInst, this);
- });
+ HWND hWnd = ::CreateWindow((wchar_t*)cn.utf16(), 0,
+ WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
+ rcPos.left, rcPos.top, rcPos.right - rcPos.left,
+ rcPos.bottom - rcPos.top, hWndParent, 0, hInst, this);
Q_ASSERT(m_hWnd == hWnd);
@@ -1676,11 +1605,7 @@ HMENU QAxServerBase::createPopup(QMenu *popup, HMENU oldMenu)
actionMap.remove(itemId);
actionMap.insert(itemId, action);
}
- QT_WA({
- AppendMenuW(popupMenu, flags, itemId, (TCHAR*)action->text().utf16());
- }, {
- AppendMenuA(popupMenu, flags, itemId, action->text().toLocal8Bit());
- });
+ AppendMenu(popupMenu, flags, itemId, (const wchar_t *)action->text().utf16());
}
if (oldMenu)
DrawMenuBar(hwndMenuOwner);
@@ -1726,11 +1651,7 @@ void QAxServerBase::createMenu(QMenuBar *menuBar)
itemId = static_cast<ushort>(reinterpret_cast<ulong>(action));
actionMap.insert(itemId, action);
}
- QT_WA({
- AppendMenuW(hmenuShared, flags, itemId, (TCHAR*)action->text().utf16());
- } , {
- AppendMenuA(hmenuShared, flags, itemId, action->text().toLocal8Bit());
- });
+ AppendMenu(hmenuShared, flags, itemId, (const wchar_t *)action->text().utf16());
}
OLEMENUGROUPWIDTHS menuWidths = {0,edit,0,object,0,help};
@@ -2397,7 +2318,7 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid,
if (!cname)
return res;
- name = QString::fromUtf16((const ushort *)bname).toLatin1();
+ name = QString::fromWCharArray(bname).toLatin1();
SysFreeString(bname);
}
}
@@ -2799,7 +2720,7 @@ HRESULT WINAPI QAxServerBase::Load(IStream *pStm)
bool openAsText = false;
QByteArray qtarray;
if (hres == S_OK) {
- QString streamName = QString::fromUtf16((const ushort *)stat.pwcsName);
+ QString streamName = QString::fromWCharArray(stat.pwcsName);
CoTaskMemFree(stat.pwcsName);
openAsText = streamName == QLatin1String("SomeStreamName");
if (stat.cbSize.HighPart) // more than 4GB - too large!
@@ -2940,7 +2861,7 @@ HRESULT WINAPI QAxServerBase::Load(IStorage *pStg)
*/
streamName += QLatin1String("_Stream4.2");
- pStg->OpenStream((const WCHAR *)streamName.utf16(), 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &spStream);
+ pStg->OpenStream((const wchar_t *)streamName.utf16(), 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &spStream);
if (!spStream) // support for streams saved with 4.1 and earlier
pStg->OpenStream(L"SomeStreamName", 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &spStream);
if (!spStream)
@@ -2963,7 +2884,7 @@ HRESULT WINAPI QAxServerBase::Save(IStorage *pStg, BOOL fSameAsLoad)
*/
streamName += QLatin1String("_Stream4.2");
- pStg->CreateStream((const WCHAR *)streamName.utf16(), STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &spStream);
+ pStg->CreateStream((const wchar_t *)streamName.utf16(), STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &spStream);
if (!spStream)
return E_FAIL;
@@ -3079,7 +3000,7 @@ HRESULT WINAPI QAxServerBase::SaveCompleted(LPCOLESTR fileName)
if (qt.object->metaObject()->indexOfClassInfo("MIME") == -1)
return E_NOTIMPL;
- currentFileName = QString::fromUtf16(reinterpret_cast<const ushort *>(fileName));
+ currentFileName = QString::fromWCharArray(fileName);
return S_OK;
}
@@ -3097,7 +3018,7 @@ HRESULT WINAPI QAxServerBase::GetCurFile(LPOLESTR *currentFile)
if (!malloc)
return E_OUTOFMEMORY;
- *currentFile = static_cast<WCHAR *>(malloc->Alloc(currentFileName.length() * 2));
+ *currentFile = static_cast<wchar_t *>(malloc->Alloc(currentFileName.length() * 2));
malloc->Release();
memcpy(*currentFile, currentFileName.unicode(), currentFileName.length() * 2);
@@ -3117,7 +3038,7 @@ HRESULT WINAPI QAxServerBase::Load(LPCOLESTR fileName, DWORD mode)
return E_NOTIMPL;
}
- QString loadFileName = QString::fromUtf16(reinterpret_cast<const ushort *>(fileName));
+ QString loadFileName = QString::fromWCharArray(fileName);
QString fileExtension = loadFileName.mid(loadFileName.lastIndexOf(QLatin1Char('.')) + 1);
QFile file(loadFileName);
@@ -3162,7 +3083,7 @@ HRESULT WINAPI QAxServerBase::Save(LPCOLESTR fileName, BOOL fRemember)
return E_NOTIMPL;
}
- QString saveFileName = QString::fromUtf16(reinterpret_cast<const ushort *>(fileName));
+ QString saveFileName = QString::fromWCharArray(fileName);
QString fileExtension = saveFileName.mid(saveFileName.lastIndexOf(QLatin1Char('.')) + 1);
QFile file(saveFileName);
@@ -3220,7 +3141,7 @@ HRESULT WINAPI QAxServerBase::Draw(DWORD dwAspect, LONG lindex, void *pvAspect,
bool bDeleteDC = false;
if (!hicTargetDev) {
- hicTargetDev = ::CreateDCA("DISPLAY", NULL, NULL, NULL);
+ hicTargetDev = ::CreateDC(L"DISPLAY", NULL, NULL, NULL);
bDeleteDC = (hicTargetDev != hdcDraw);
}
@@ -3383,7 +3304,7 @@ HRESULT WINAPI QAxServerBase::OnAmbientPropertyChange(DISPID dispID)
case DISPID_AMBIENT_DISPLAYNAME:
if (var.vt != VT_BSTR || !isWidget)
break;
- qt.widget->setWindowTitle(QString::fromUtf16((const ushort *)var.bstrVal));
+ qt.widget->setWindowTitle(QString::fromWCharArray(var.bstrVal));
break;
case DISPID_AMBIENT_FONT:
if (var.vt != VT_DISPATCH || !isWidget)
diff --git a/src/activeqt/control/qaxserverdll.cpp b/src/activeqt/control/qaxserverdll.cpp
index 375028d..512c408 100644
--- a/src/activeqt/control/qaxserverdll.cpp
+++ b/src/activeqt/control/qaxserverdll.cpp
@@ -50,7 +50,7 @@ bool qax_ownQApp = false;
HHOOK qax_hhook = 0;
// in qaxserver.cpp
-extern char qAxModuleFilename[MAX_PATH];
+extern wchar_t qAxModuleFilename[MAX_PATH];
extern bool qAxIsServer;
extern ITypeLib *qAxTypeLibrary;
extern unsigned long qAxLockCount();
@@ -120,7 +120,7 @@ STDAPI DllCanUnloadNow()
EXTERN_C BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved)
{
- GetModuleFileNameA(hInstance, qAxModuleFilename, MAX_PATH-1);
+ GetModuleFileName(hInstance, qAxModuleFilename, MAX_PATH);
qAxInstance = hInstance;
qAxIsServer = true;
diff --git a/src/activeqt/control/qaxservermain.cpp b/src/activeqt/control/qaxservermain.cpp
index 8f20d97..d465746 100644
--- a/src/activeqt/control/qaxservermain.cpp
+++ b/src/activeqt/control/qaxservermain.cpp
@@ -66,7 +66,7 @@ extern bool qAxActivity;
extern HANDLE qAxInstance;
extern bool qAxIsServer;
extern bool qAxOutProcServer;
-extern char qAxModuleFilename[MAX_PATH];
+extern wchar_t qAxModuleFilename[MAX_PATH];
extern QString qAxInit();
extern void qAxCleanup();
extern HRESULT UpdateRegistry(BOOL bRegister);
@@ -105,7 +105,7 @@ static DWORD WINAPI MonitorProc(void* pv)
static bool StartMonitor()
{
dwThreadID = GetCurrentThreadId();
- hEventShutdown = CreateEventA(0, false, false, 0);
+ hEventShutdown = CreateEvent(0, false, false, 0);
if (hEventShutdown == 0)
return false;
DWORD dwThreadID;
@@ -203,17 +203,10 @@ EXTERN_C int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR,
QT_USE_NAMESPACE
qAxOutProcServer = true;
- GetModuleFileNameA(0, qAxModuleFilename, MAX_PATH-1);
+ GetModuleFileName(0, qAxModuleFilename, MAX_PATH);
qAxInstance = hInstance;
- QByteArray cmdParam;
- QT_WA({
- LPTSTR cmdline = GetCommandLineW();
- cmdParam = QString::fromUtf16((const ushort *)cmdline).toLocal8Bit();
- }, {
- cmdParam = GetCommandLineA();
- });
-
+ QByteArray cmdParam = QString::fromWCharArray(GetCommandLine()).toLocal8Bit();
QList<QByteArray> cmds = cmdParam.split(' ');
QByteArray unprocessed;
diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp
index 916fcca..49aa99c 100644
--- a/src/activeqt/shared/qaxtypes.cpp
+++ b/src/activeqt/shared/qaxtypes.cpp
@@ -37,11 +37,6 @@
**
****************************************************************************/
-#ifndef UNICODE
-#define UNICODE
-#endif
-
-
#include <ocidl.h>
#include <olectl.h>
@@ -123,7 +118,7 @@ static QFont IFontToQFont(IFont *f)
f->get_Strikethrough(&strike);
f->get_Underline(&underline);
f->get_Weight(&weight);
- QFont font(QString::fromUtf16((const ushort *)name), size.Lo/9750, weight / 97, italic);
+ QFont font(QString::fromWCharArray(name), size.Lo/9750, weight / 97, italic);
font.setBold(bold);
font.setStrikeOut(strike);
font.setUnderline(underline);
@@ -925,10 +920,10 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint
QVariant var;
switch(arg.vt) {
case VT_BSTR:
- var = QString::fromUtf16((const ushort *)arg.bstrVal);
+ var = QString::fromWCharArray(arg.bstrVal);
break;
case VT_BSTR|VT_BYREF:
- var = QString::fromUtf16((const ushort *)*arg.pbstrVal);
+ var = QString::fromWCharArray(*arg.pbstrVal);
break;
case VT_BOOL:
var = QVariant((bool)arg.boolVal);
@@ -1245,7 +1240,7 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint
for (long i = lBound; i <= uBound; ++i) {
BSTR bstr;
SafeArrayGetElement(array, &i, &bstr);
- strings << QString::fromUtf16((const ushort *)bstr);
+ strings << QString::fromWCharArray(bstr);
SysFreeString(bstr);
}
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 3720984..ced86d2 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -254,8 +254,17 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
int oldCurrentLoop = currentLoop;
QAbstractAnimation::Direction oldDirection = direction;
- state = newState;
+ // check if we should Rewind
+ if ((newState == QAbstractAnimation::Paused || newState == QAbstractAnimation::Running)
+ && oldState == QAbstractAnimation::Stopped) {
+ //here we reset the time if needed
+ //we don't call setCurrentTime because this might change the way the animation
+ //behaves: changing the state or changing the current value
+ totalCurrentTime = currentTime =(direction == QAbstractAnimation::Forward) ?
+ 0 : (loopCount == -1 ? q->duration() : q->totalDuration());
+ }
+ state = newState;
QPointer<QAbstractAnimation> guard(q);
guard->updateState(oldState, newState);
@@ -268,36 +277,22 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
if (guard)
emit guard->stateChanged(oldState, newState);
- // Enter running state.
switch (state)
{
case QAbstractAnimation::Paused:
case QAbstractAnimation::Running:
- {
- // Rewind
- if (oldState == QAbstractAnimation::Stopped) {
- if (guard) {
- if (direction == QAbstractAnimation::Forward)
- q->setCurrentTime(0);
- else
- q->setCurrentTime(loopCount == -1 ? q->duration() : q->totalDuration());
- }
-
- // Check if the setCurrentTime() function called stop().
- // This can happen for a 0-duration animation
- if (state == QAbstractAnimation::Stopped)
- return;
- }
-
- // Register timer if our parent is not running.
- if (state == QAbstractAnimation::Running && guard) {
- if (!group || group->state() == QAbstractAnimation::Stopped) {
- QUnifiedTimer::instance()->registerAnimation(q);
- }
- } else {
- //new state is paused
- QUnifiedTimer::instance()->unregisterAnimation(q);
+ //this ensures that the value is updated now that the animation is running
+ if(oldState == QAbstractAnimation::Stopped && guard)
+ guard->setCurrentTime(currentTime);
+
+ // Register timer if our parent is not running.
+ if (state == QAbstractAnimation::Running && guard) {
+ if (!group || group->state() == QAbstractAnimation::Stopped) {
+ QUnifiedTimer::instance()->registerAnimation(q);
}
+ } else {
+ //new state is paused
+ QUnifiedTimer::instance()->unregisterAnimation(q);
}
break;
case QAbstractAnimation::Stopped:
@@ -625,8 +620,8 @@ void QAbstractAnimation::start(DeletionPolicy policy)
Q_D(QAbstractAnimation);
if (d->state == Running)
return;
- d->setState(Running);
d->deleteWhenStopped = policy;
+ d->setState(Running);
}
/*!
@@ -648,9 +643,8 @@ void QAbstractAnimation::stop()
/*!
Pauses the animation. When the animation is paused, state() returns Paused.
- The currenttime will remain unchanged until resume() or start() is called.
- If you want to continue from the current time, call resume().
-
+ The value of currentTime will remain unchanged until resume() or start()
+ is called. If you want to continue from the current time, call resume().
\sa start(), state(), resume()
*/
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index 00def55..0d8402e 100644
--- a/src/corelib/animation/qabstractanimation_p.h
+++ b/src/corelib/animation/qabstractanimation_p.h
@@ -58,6 +58,8 @@
#include <QtCore/qtimer.h>
#include <private/qobject_p.h>
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QAnimationGroup;
@@ -147,4 +149,7 @@ private:
};
QT_END_NAMESPACE
-#endif
+
+#endif //QT_NO_ANIMATION
+
+#endif //QABSTRACTANIMATION_P_H
diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h
index 8e668f0..01252c5 100644
--- a/src/corelib/animation/qanimationgroup_p.h
+++ b/src/corelib/animation/qanimationgroup_p.h
@@ -59,6 +59,8 @@
#include "private/qabstractanimation_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QAnimationGroupPrivate : public QAbstractAnimationPrivate
@@ -76,4 +78,6 @@ public:
QT_END_NAMESPACE
+#endif //QT_NO_ANIMATION
+
#endif //QANIMATIONGROUP_P_H
diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h
index 201eb16..949a9b2 100644
--- a/src/corelib/animation/qparallelanimationgroup_p.h
+++ b/src/corelib/animation/qparallelanimationgroup_p.h
@@ -57,6 +57,8 @@
#include "private/qanimationgroup_p.h"
#include <QtCore/QHash>
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QParallelAnimationGroupPrivate : public QAnimationGroupPrivate
@@ -82,4 +84,6 @@ public:
QT_END_NAMESPACE
+#endif //QT_NO_ANIMATION
+
#endif //QPARALLELANIMATIONGROUP_P_H
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 7526a81..5f224aa 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -100,10 +100,6 @@
QT_BEGIN_NAMESPACE
-typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
-typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;
-Q_GLOBAL_STATIC(QPropertyAnimationHash, _q_runningAnimations)
-
void QPropertyAnimationPrivate::updateMetaProperty()
{
if (!target || propertyName.isEmpty())
@@ -286,19 +282,21 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState,
QPropertyAnimation *animToStop = 0;
{
- QPropertyAnimationHash * hash = _q_runningAnimations();
- QMutexLocker locker(QMutexPool::globalInstanceGet(hash));
+ QMutexLocker locker(QMutexPool::globalInstanceGet(&staticMetaObject));
+ typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
+ typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;
+ static QPropertyAnimationHash hash;
QPropertyAnimationPair key(d->target, d->propertyName);
if (newState == Running) {
d->updateMetaProperty();
- animToStop = hash->value(key, 0);
- hash->insert(key, this);
+ animToStop = hash.value(key, 0);
+ hash.insert(key, this);
// update the default start value
if (oldState == Stopped) {
d->setDefaultStartValue(d->target->property(d->propertyName.constData()));
}
- } else if (hash->value(key) == this) {
- hash->remove(key);
+ } else if (hash.value(key) == this) {
+ hash.remove(key);
}
}
diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h
index 68b2519..a2ae5ec 100644
--- a/src/corelib/animation/qpropertyanimation_p.h
+++ b/src/corelib/animation/qpropertyanimation_p.h
@@ -58,6 +58,8 @@
#include "private/qvariantanimation_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QPropertyAnimationPrivate : public QVariantAnimationPrivate
@@ -86,4 +88,6 @@ public:
QT_END_NAMESPACE
-#endif
+#endif //QT_NO_ANIMATION
+
+#endif //QPROPERTYANIMATION_P_H
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 5932e7c..05dc307 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -269,8 +269,10 @@ QSequentialAnimationGroup::~QSequentialAnimationGroup()
/*!
Adds a pause of \a msecs to this animation group.
- The pause is considered as a special type of animation, thus count() will be
+ The pause is considered as a special type of animation, thus
+ \l{QAnimationGroup::animationCount()}{animationCount} will be
increased by one.
+
\sa insertPauseAt(), QAnimationGroup::addAnimation()
*/
QPauseAnimation *QSequentialAnimationGroup::addPause(int msecs)
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index 555b696..8db79a0 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -56,6 +56,7 @@
#include "qsequentialanimationgroup.h"
#include "private/qanimationgroup_p.h"
+#ifndef QT_NO_ANIMATION
QT_BEGIN_NAMESPACE
@@ -108,4 +109,6 @@ public:
QT_END_NAMESPACE
+#endif //QT_NO_ANIMATION
+
#endif //QSEQUENTIALANIMATIONGROUP_P_H
diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h
index b2d52d5..3e397ca 100644
--- a/src/corelib/animation/qvariantanimation.h
+++ b/src/corelib/animation/qvariantanimation.h
@@ -62,7 +62,7 @@ class Q_CORE_EXPORT QVariantAnimation : public QAbstractAnimation
Q_OBJECT
Q_PROPERTY(QVariant startValue READ startValue WRITE setStartValue)
Q_PROPERTY(QVariant endValue READ endValue WRITE setEndValue)
- Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY currentValueChanged)
+ Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY valueChanged)
Q_PROPERTY(int duration READ duration WRITE setDuration)
Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve)
diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h
index b848e12..69e23dc 100644
--- a/src/corelib/animation/qvariantanimation_p.h
+++ b/src/corelib/animation/qvariantanimation_p.h
@@ -60,6 +60,8 @@
#include "private/qabstractanimation_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QVariantAnimationPrivate : public QAbstractAnimationPrivate
@@ -120,4 +122,6 @@ template<typename T > inline QVariant _q_interpolateVariant(const T &from, const
QT_END_NAMESPACE
+#endif //QT_NO_ANIMATION
+
#endif //QANIMATION_P_H
diff --git a/src/corelib/arch/qatomic_powerpc.h b/src/corelib/arch/qatomic_powerpc.h
index ea3f458..c3b31f9 100644
--- a/src/corelib/arch/qatomic_powerpc.h
+++ b/src/corelib/arch/qatomic_powerpc.h
@@ -101,8 +101,6 @@ template <typename T>
Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree()
{ return false; }
-QT_BEGIN_NAMESPACE
-
#if defined(Q_CC_GNU)
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2) \
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index 1bf76ea..188ac8c 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -225,10 +225,11 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState
char *inBytes = const_cast<char *>(chars);
#endif
+ QByteArray in;
if (remainingCount) {
// we have to prepend the remaining bytes from the previous conversion
inBytesLeft += remainingCount;
- QByteArray in(inBytesLeft, Qt::Uninitialized);
+ in.resize(inBytesLeft);
inBytes = in.data();
memcpy(in.data(), remainingBuffer, remainingCount);
@@ -362,9 +363,10 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
inBytes = const_cast<char *>(reinterpret_cast<const char *>(uc));
inBytesLeft = len * sizeof(QChar);
+ QByteArray in;
if (convState && convState->remainingChars) {
// we have one surrogate char to be prepended
- QByteArray in(sizeof(QChar) + len, Qt::Uninitialized);
+ in.resize(sizeof(QChar) + len);
inBytes = in.data();
QChar remaining = convState->state_data[0];
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index bca36a6..354f29b 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -104,6 +104,10 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QTextCodecFactoryInterface_iid, QLatin1String("/codecs")))
#endif
+static char qtolower(register char c)
+{ if (c >= 'A' && c <= 'Z') return c + 0x20; return c; }
+static bool qisalnum(register char c)
+{ return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'z'); }
static bool nameMatch(const QByteArray &name, const QByteArray &test)
{
@@ -116,21 +120,21 @@ static bool nameMatch(const QByteArray &name, const QByteArray &test)
// if the letters and numbers are the same, we have a match
while (*n != '\0') {
- if (isalnum((uchar)*n)) {
+ if (qisalnum(*n)) {
for (;;) {
if (*h == '\0')
return false;
- if (isalnum((uchar)*h))
+ if (qisalnum(*h))
break;
++h;
}
- if (tolower((uchar)*n) != tolower((uchar)*h))
+ if (qtolower(*n) != qtolower(*h))
return false;
++h;
}
++n;
}
- while (*h && !isalnum((uchar)*h))
+ while (*h && !qisalnum(*h))
++h;
return (*h == '\0');
}
@@ -246,9 +250,9 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv
return QString();
const int wclen_auto = 4096;
- WCHAR wc_auto[wclen_auto];
+ wchar_t wc_auto[wclen_auto];
int wclen = wclen_auto;
- WCHAR *wc = wc_auto;
+ wchar_t *wc = wc_auto;
int len;
QString sp;
bool prepend = false;
@@ -288,7 +292,7 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv
} else {
wclen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
mb, mblen, 0, 0);
- wc = new WCHAR[wclen];
+ wc = new wchar_t[wclen];
// and try again...
}
} else if (r == ERROR_NO_UNICODE_TRANSLATION) {
@@ -354,7 +358,7 @@ QString QWindowsLocalCodec::convertToUnicodeCharByChar(const char *chars, int le
const char *next = 0;
QString s;
while((next = CharNextExA(CP_ACP, mb, 0)) != mb) {
- WCHAR wc[2] ={0};
+ wchar_t wc[2] ={0};
int charlength = next - mb;
int len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, mb, charlength, wc, 2);
if (len>0) {
@@ -1059,16 +1063,10 @@ QList<int> QTextCodec::availableMibs()
This might be needed for some applications that want to use their
own mechanism for setting the locale.
- Setting this codec is not supported on DOS based Windows.
-
\sa codecForLocale()
*/
void QTextCodec::setCodecForLocale(QTextCodec *c)
{
-#ifdef Q_WS_WIN
- if (QSysInfo::WindowsVersion& QSysInfo::WV_DOS_based)
- return;
-#endif
localeMapper = c;
if (!localeMapper)
setupLocaleMapper();
@@ -1555,9 +1553,13 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba, QTextCodec *defaultCo
}
/*!
- \overload
+ \overload
- If the codec cannot be detected, this overload returns a Latin-1 QTextCodec.
+ Tries to detect the encoding of the provided snippet of HTML in
+ the given byte array, \a ba, by checking the BOM (Byte Order Mark)
+ and the content-type meta header and returns a QTextCodec instance
+ that is capable of decoding the html to unicode. If the codec cannot
+ be detected, this overload returns a Latin-1 QTextCodec.
*/
QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba)
{
@@ -1569,10 +1571,13 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba)
Tries to detect the encoding of the provided snippet \a ba by
using the BOM (Byte Order Mark) and returns a QTextCodec instance
- that is capable of decoding the text to unicode. If the codec
+ that is capable of decoding the text to unicode. If the codec
cannot be detected from the content provided, \a defaultCodec is
returned.
+ The behavior of this function is undefined if \a ba is not
+ encoded in unicode.
+
\sa codecForHtml()
*/
QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec)
@@ -1610,9 +1615,17 @@ QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaul
}
/*!
- \overload
+ \overload
- If the codec cannot be detected, this overload returns a Latin-1 QTextCodec.
+ Tries to detect the encoding of the provided snippet \a ba by
+ using the BOM (Byte Order Mark) and returns a QTextCodec instance
+ that is capable of decoding the text to unicode. If the codec
+ cannot be detected, this overload returns a Latin-1 QTextCodec.
+
+ The behavior of this function is undefined if \a ba is not
+ encoded in unicode.
+
+ \sa codecForHtml()
*/
QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba)
{
diff --git a/src/corelib/codecs/qtextcodec_p.h b/src/corelib/codecs/qtextcodec_p.h
index 499c0f9..5c82735 100644
--- a/src/corelib/codecs/qtextcodec_p.h
+++ b/src/corelib/codecs/qtextcodec_p.h
@@ -77,6 +77,33 @@ struct QTextCodecUnalignedPointer
}
};
+#else
+
+class QTextCodec
+{
+public:
+ enum ConversionFlag {
+ DefaultConversion,
+ ConvertInvalidToNull = 0x80000000,
+ IgnoreHeader = 0x1,
+ FreeFunction = 0x2
+ };
+ Q_DECLARE_FLAGS(ConversionFlags, ConversionFlag)
+
+ struct ConverterState {
+ ConverterState(ConversionFlags f = DefaultConversion)
+ : flags(f), remainingChars(0), invalidChars(0), d(0) { state_data[0] = state_data[1] = state_data[2] = 0; }
+ ~ConverterState() { }
+ ConversionFlags flags;
+ int remainingChars;
+ int invalidChars;
+ uint state_data[3];
+ void *d;
+ private:
+ Q_DISABLE_COPY(ConverterState)
+ };
+};
+
#endif //QT_NO_TEXTCODEC
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index abae6f7..abcc07c 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -44,23 +44,19 @@
#include "qendian.h"
#include "qchar.h"
-#ifndef QT_NO_TEXTCODEC
-
QT_BEGIN_NAMESPACE
-QUtf8Codec::~QUtf8Codec()
-{
-}
+enum { Endian = 0, Data = 1 };
-QByteArray QUtf8Codec::convertFromUnicode(const QChar *uc, int len, ConverterState *state) const
+QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len, QTextCodec::ConverterState *state)
{
uchar replacement = '?';
int rlen = 3*len;
int surrogate_high = -1;
if (state) {
- if (state->flags & ConvertInvalidToNull)
+ if (state->flags & QTextCodec::ConvertInvalidToNull)
replacement = 0;
- if (!(state->flags & IgnoreHeader))
+ if (!(state->flags & QTextCodec::IgnoreHeader))
rlen += 3;
if (state->remainingChars)
surrogate_high = state->state_data[0];
@@ -71,7 +67,7 @@ QByteArray QUtf8Codec::convertFromUnicode(const QChar *uc, int len, ConverterSta
uchar* cursor = (uchar*)rstr.data();
const QChar *ch = uc;
int invalid = 0;
- if (state && !(state->flags & IgnoreHeader)) {
+ if (state && !(state->flags & QTextCodec::IgnoreHeader)) {
*cursor++ = 0xef;
*cursor++ = 0xbb;
*cursor++ = 0xbf;
@@ -133,7 +129,7 @@ QByteArray QUtf8Codec::convertFromUnicode(const QChar *uc, int len, ConverterSta
rstr.resize(cursor - (const uchar*)rstr.constData());
if (state) {
state->invalidChars += invalid;
- state->flags |= IgnoreHeader;
+ state->flags |= QTextCodec::IgnoreHeader;
state->remainingChars = 0;
if (surrogate_high >= 0) {
state->remainingChars = 1;
@@ -143,18 +139,18 @@ QByteArray QUtf8Codec::convertFromUnicode(const QChar *uc, int len, ConverterSta
return rstr;
}
-void QUtf8Codec::convertToUnicode(QString *target, const char *chars, int len, ConverterState *state) const
+QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::ConverterState *state)
{
bool headerdone = false;
- QChar replacement = QChar::ReplacementCharacter;
+ ushort replacement = QChar::ReplacementCharacter;
int need = 0;
int error = -1;
uint uc = 0;
uint min_uc = 0;
if (state) {
- if (state->flags & IgnoreHeader)
+ if (state->flags & QTextCodec::IgnoreHeader)
headerdone = true;
- if (state->flags & ConvertInvalidToNull)
+ if (state->flags & QTextCodec::ConvertInvalidToNull)
replacement = QChar::Null;
need = state->remainingChars;
if (need) {
@@ -170,40 +166,28 @@ void QUtf8Codec::convertToUnicode(QString *target, const char *chars, int len, C
headerdone = true;
}
- int originalLength = target->length();
- QString &result = *target;
- result.resize(originalLength + len + 1); // worst case
- QChar *qch = result.data() + originalLength;
+ QString result(need + len + 1, Qt::Uninitialized); // worst case
+ ushort *qch = (ushort *)result.unicode();
uchar ch;
int invalid = 0;
- for (int i=0; i<len; i++) {
+ for (int i = 0; i < len; ++i) {
ch = chars[i];
if (need) {
if ((ch&0xc0) == 0x80) {
uc = (uc << 6) | (ch & 0x3f);
- need--;
+ --need;
if (!need) {
// utf-8 bom composes into 0xfeff code point
if (!headerdone && uc == 0xfeff) {
// dont do anything, just skip the BOM
} else if (uc > 0xffff && uc < 0x110000) {
// surrogate pair
- uc -= 0x10000;
- unsigned short high = uc/0x400 + 0xd800;
- unsigned short low = uc%0x400 + 0xdc00;
-
- // resize if necessary
- long where = qch - result.unicode();
- if (where + 2 >= result.length()) {
- result.resize(where + 2);
- qch = result.data() + where;
- }
-
- *qch++ = QChar(high);
- *qch++ = QChar(low);
+ Q_ASSERT((qch - (ushort*)result.unicode()) + 2 < result.length());
+ *qch++ = QChar::highSurrogate(uc);
+ *qch++ = QChar::lowSurrogate(uc);
} else if ((uc < min_uc) || (uc >= 0xd800 && uc <= 0xdfff) || (uc >= 0xfffe)) {
- // error
+ // error: overlong sequence, UTF16 surrogate or BOM
*qch++ = replacement;
++invalid;
} else {
@@ -221,7 +205,7 @@ void QUtf8Codec::convertToUnicode(QString *target, const char *chars, int len, C
}
} else {
if (ch < 128) {
- *qch++ = QLatin1Char(ch);
+ *qch++ = ushort(ch);
headerdone = true;
} else if ((ch & 0xe0) == 0xc0) {
uc = ch & 0x1f;
@@ -255,57 +239,35 @@ void QUtf8Codec::convertToUnicode(QString *target, const char *chars, int len, C
++invalid;
}
}
- result.truncate(qch - result.unicode());
+ result.truncate(qch - (ushort *)result.unicode());
if (state) {
state->invalidChars += invalid;
state->remainingChars = need;
if (headerdone)
- state->flags |= IgnoreHeader;
+ state->flags |= QTextCodec::IgnoreHeader;
state->state_data[0] = need ? uc : 0;
state->state_data[1] = need ? min_uc : 0;
}
-}
-
-QString QUtf8Codec::convertToUnicode(const char *chars, int len, ConverterState *state) const
-{
- QString result;
- convertToUnicode(&result, chars, len, state);
return result;
}
-QByteArray QUtf8Codec::name() const
-{
- return "UTF-8";
-}
-
-int QUtf8Codec::mibEnum() const
-{
- return 106;
-}
-
-enum { Endian = 0, Data = 1 };
-
-QUtf16Codec::~QUtf16Codec()
-{
-}
-
-QByteArray QUtf16Codec::convertFromUnicode(const QChar *uc, int len, ConverterState *state) const
+QByteArray QUtf16::convertFromUnicode(const QChar *uc, int len, QTextCodec::ConverterState *state, DataEndianness e)
{
- Endianness endian = e;
+ DataEndianness endian = e;
int length = 2*len;
- if (!state || (!(state->flags & IgnoreHeader))) {
+ if (!state || (!(state->flags & QTextCodec::IgnoreHeader))) {
length += 2;
}
- if (e == Detect) {
- endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BE : LE;
+ if (e == DetectEndianness) {
+ endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BigEndianness : LittleEndianness;
}
QByteArray d;
d.resize(length);
char *data = d.data();
- if (!state || !(state->flags & IgnoreHeader)) {
+ if (!state || !(state->flags & QTextCodec::IgnoreHeader)) {
QChar bom(QChar::ByteOrderMark);
- if (endian == BE) {
+ if (endian == BigEndianness) {
data[0] = bom.row();
data[1] = bom.cell();
} else {
@@ -314,7 +276,7 @@ QByteArray QUtf16Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt
}
data += 2;
}
- if (endian == BE) {
+ if (endian == BigEndianness) {
for (int i = 0; i < len; ++i) {
*(data++) = uc[i].row();
*(data++) = uc[i].cell();
@@ -328,35 +290,35 @@ QByteArray QUtf16Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt
if (state) {
state->remainingChars = 0;
- state->flags |= IgnoreHeader;
+ state->flags |= QTextCodec::IgnoreHeader;
}
return d;
}
-QString QUtf16Codec::convertToUnicode(const char *chars, int len, ConverterState *state) const
+QString QUtf16::convertToUnicode(const char *chars, int len, QTextCodec::ConverterState *state, DataEndianness e)
{
- Endianness endian = e;
+ DataEndianness endian = e;
bool half = false;
uchar buf = 0;
bool headerdone = false;
if (state) {
- headerdone = state->flags & IgnoreHeader;
- if (endian == Detect)
- endian = (Endianness)state->state_data[Endian];
+ headerdone = state->flags & QTextCodec::IgnoreHeader;
+ if (endian == DetectEndianness)
+ endian = (DataEndianness)state->state_data[Endian];
if (state->remainingChars) {
half = true;
buf = state->state_data[Data];
}
}
- if (headerdone && endian == Detect)
- endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BE : LE;
+ if (headerdone && endian == DetectEndianness)
+ endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BigEndianness : LittleEndianness;
QString result(len, Qt::Uninitialized); // worst case
QChar *qch = (QChar *)result.unicode();
while (len--) {
if (half) {
QChar ch;
- if (endian == LE) {
+ if (endian == LittleEndianness) {
ch.setRow(*chars++);
ch.setCell(buf);
} else {
@@ -364,17 +326,17 @@ QString QUtf16Codec::convertToUnicode(const char *chars, int len, ConverterState
ch.setCell(*chars++);
}
if (!headerdone) {
- if (endian == Detect) {
- if (ch == QChar::ByteOrderSwapped && endian != BE) {
- endian = LE;
- } else if (ch == QChar::ByteOrderMark && endian != LE) {
+ if (endian == DetectEndianness) {
+ if (ch == QChar::ByteOrderSwapped && endian != BigEndianness) {
+ endian = LittleEndianness;
+ } else if (ch == QChar::ByteOrderMark && endian != LittleEndianness) {
// ignore BOM
- endian = BE;
+ endian = BigEndianness;
} else {
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
- endian = BE;
+ endian = BigEndianness;
} else {
- endian = LE;
+ endian = LittleEndianness;
ch = QChar((ch.unicode() >> 8) | ((ch.unicode() & 0xff) << 8));
}
*qch++ = ch;
@@ -396,7 +358,7 @@ QString QUtf16Codec::convertToUnicode(const char *chars, int len, ConverterState
if (state) {
if (headerdone)
- state->flags |= IgnoreHeader;
+ state->flags |= QTextCodec::IgnoreHeader;
state->state_data[Endian] = endian;
if (half) {
state->remainingChars = 1;
@@ -409,72 +371,21 @@ QString QUtf16Codec::convertToUnicode(const char *chars, int len, ConverterState
return result;
}
-int QUtf16Codec::mibEnum() const
-{
- return 1015;
-}
-
-QByteArray QUtf16Codec::name() const
-{
- return "UTF-16";
-}
-
-QList<QByteArray> QUtf16Codec::aliases() const
-{
- return QList<QByteArray>();
-}
-
-int QUtf16BECodec::mibEnum() const
-{
- return 1013;
-}
-
-QByteArray QUtf16BECodec::name() const
-{
- return "UTF-16BE";
-}
-
-QList<QByteArray> QUtf16BECodec::aliases() const
-{
- QList<QByteArray> list;
- return list;
-}
-
-int QUtf16LECodec::mibEnum() const
-{
- return 1014;
-}
-
-QByteArray QUtf16LECodec::name() const
-{
- return "UTF-16LE";
-}
-
-QList<QByteArray> QUtf16LECodec::aliases() const
-{
- QList<QByteArray> list;
- return list;
-}
-
-QUtf32Codec::~QUtf32Codec()
-{
-}
-
-QByteArray QUtf32Codec::convertFromUnicode(const QChar *uc, int len, ConverterState *state) const
+QByteArray QUtf32::convertFromUnicode(const QChar *uc, int len, QTextCodec::ConverterState *state, DataEndianness e)
{
- Endianness endian = e;
+ DataEndianness endian = e;
int length = 4*len;
- if (!state || (!(state->flags & IgnoreHeader))) {
+ if (!state || (!(state->flags & QTextCodec::IgnoreHeader))) {
length += 4;
}
- if (e == Detect) {
- endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BE : LE;
+ if (e == DetectEndianness) {
+ endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BigEndianness : LittleEndianness;
}
QByteArray d(length, Qt::Uninitialized);
char *data = d.data();
- if (!state || !(state->flags & IgnoreHeader)) {
- if (endian == BE) {
+ if (!state || !(state->flags & QTextCodec::IgnoreHeader)) {
+ if (endian == BigEndianness) {
data[0] = 0;
data[1] = 0;
data[2] = (char)0xfe;
@@ -487,7 +398,7 @@ QByteArray QUtf32Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt
}
data += 4;
}
- if (endian == BE) {
+ if (endian == BigEndianness) {
for (int i = 0; i < len; ++i) {
uint cp = uc[i].unicode();
if (uc[i].isHighSurrogate() && i < len - 1)
@@ -511,59 +422,59 @@ QByteArray QUtf32Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt
if (state) {
state->remainingChars = 0;
- state->flags |= IgnoreHeader;
+ state->flags |= QTextCodec::IgnoreHeader;
}
return d;
}
-QString QUtf32Codec::convertToUnicode(const char *chars, int len, ConverterState *state) const
+QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::ConverterState *state, DataEndianness e)
{
- Endianness endian = e;
+ DataEndianness endian = e;
uchar tuple[4];
int num = 0;
bool headerdone = false;
if (state) {
- headerdone = state->flags & IgnoreHeader;
- if (endian == Detect) {
- endian = (Endianness)state->state_data[Endian];
+ headerdone = state->flags & QTextCodec::IgnoreHeader;
+ if (endian == DetectEndianness) {
+ endian = (DataEndianness)state->state_data[Endian];
}
num = state->remainingChars;
memcpy(tuple, &state->state_data[Data], 4);
}
- if (headerdone && endian == Detect)
- endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BE : LE;
+ if (headerdone && endian == DetectEndianness)
+ endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BigEndianness : LittleEndianness;
QString result;
result.resize((num + len) >> 2 << 1); // worst case
QChar *qch = (QChar *)result.unicode();
-
+
const char *end = chars + len;
while (chars < end) {
tuple[num++] = *chars++;
if (num == 4) {
if (!headerdone) {
- if (endian == Detect) {
- if (endian == Detect) {
- if (tuple[0] == 0xff && tuple[1] == 0xfe && tuple[2] == 0 && tuple[3] == 0 && endian != BE) {
- endian = LE;
+ if (endian == DetectEndianness) {
+ if (endian == DetectEndianness) {
+ if (tuple[0] == 0xff && tuple[1] == 0xfe && tuple[2] == 0 && tuple[3] == 0 && endian != BigEndianness) {
+ endian = LittleEndianness;
num = 0;
continue;
- } else if (tuple[0] == 0 && tuple[1] == 0 && tuple[2] == 0xfe && tuple[3] == 0xff && endian != LE) {
- endian = BE;
+ } else if (tuple[0] == 0 && tuple[1] == 0 && tuple[2] == 0xfe && tuple[3] == 0xff && endian != LittleEndianness) {
+ endian = BigEndianness;
num = 0;
continue;
} else if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
- endian = BE;
+ endian = BigEndianness;
} else {
- endian = LE;
+ endian = LittleEndianness;
}
}
- } else if (((endian == BE) ? qFromBigEndian<quint32>(tuple) : qFromLittleEndian<quint32>(tuple)) == QChar::ByteOrderMark) {
+ } else if (((endian == BigEndianness) ? qFromBigEndian<quint32>(tuple) : qFromLittleEndian<quint32>(tuple)) == QChar::ByteOrderMark) {
num = 0;
continue;
}
}
- uint code = (endian == BE) ? qFromBigEndian<quint32>(tuple) : qFromLittleEndian<quint32>(tuple);
+ uint code = (endian == BigEndianness) ? qFromBigEndian<quint32>(tuple) : qFromLittleEndian<quint32>(tuple);
if (code >= 0x10000) {
*qch++ = QChar::highSurrogate(code);
*qch++ = QChar::lowSurrogate(code);
@@ -574,10 +485,10 @@ QString QUtf32Codec::convertToUnicode(const char *chars, int len, ConverterState
}
}
result.truncate(qch - result.unicode());
-
+
if (state) {
if (headerdone)
- state->flags |= IgnoreHeader;
+ state->flags |= QTextCodec::IgnoreHeader;
state->state_data[Endian] = endian;
state->remainingChars = num;
memcpy(&state->state_data[Data], tuple, 4);
@@ -585,6 +496,113 @@ QString QUtf32Codec::convertToUnicode(const char *chars, int len, ConverterState
return result;
}
+
+#ifndef QT_NO_TEXTCODEC
+
+QUtf8Codec::~QUtf8Codec()
+{
+}
+
+QByteArray QUtf8Codec::convertFromUnicode(const QChar *uc, int len, ConverterState *state) const
+{
+ return QUtf8::convertFromUnicode(uc, len, state);
+}
+
+void QUtf8Codec::convertToUnicode(QString *target, const char *chars, int len, ConverterState *state) const
+{
+ *target += QUtf8::convertToUnicode(chars, len, state);
+}
+
+QString QUtf8Codec::convertToUnicode(const char *chars, int len, ConverterState *state) const
+{
+ return QUtf8::convertToUnicode(chars, len, state);
+}
+
+QByteArray QUtf8Codec::name() const
+{
+ return "UTF-8";
+}
+
+int QUtf8Codec::mibEnum() const
+{
+ return 106;
+}
+
+QUtf16Codec::~QUtf16Codec()
+{
+}
+
+QByteArray QUtf16Codec::convertFromUnicode(const QChar *uc, int len, ConverterState *state) const
+{
+ return QUtf16::convertFromUnicode(uc, len, state, e);
+}
+
+QString QUtf16Codec::convertToUnicode(const char *chars, int len, ConverterState *state) const
+{
+ return QUtf16::convertToUnicode(chars, len, state, e);
+}
+
+int QUtf16Codec::mibEnum() const
+{
+ return 1015;
+}
+
+QByteArray QUtf16Codec::name() const
+{
+ return "UTF-16";
+}
+
+QList<QByteArray> QUtf16Codec::aliases() const
+{
+ return QList<QByteArray>();
+}
+
+int QUtf16BECodec::mibEnum() const
+{
+ return 1013;
+}
+
+QByteArray QUtf16BECodec::name() const
+{
+ return "UTF-16BE";
+}
+
+QList<QByteArray> QUtf16BECodec::aliases() const
+{
+ QList<QByteArray> list;
+ return list;
+}
+
+int QUtf16LECodec::mibEnum() const
+{
+ return 1014;
+}
+
+QByteArray QUtf16LECodec::name() const
+{
+ return "UTF-16LE";
+}
+
+QList<QByteArray> QUtf16LECodec::aliases() const
+{
+ QList<QByteArray> list;
+ return list;
+}
+
+QUtf32Codec::~QUtf32Codec()
+{
+}
+
+QByteArray QUtf32Codec::convertFromUnicode(const QChar *uc, int len, ConverterState *state) const
+{
+ return QUtf32::convertFromUnicode(uc, len, state, e);
+}
+
+QString QUtf32Codec::convertToUnicode(const char *chars, int len, ConverterState *state) const
+{
+ return QUtf32::convertToUnicode(chars, len, state, e);
+}
+
int QUtf32Codec::mibEnum() const
{
return 1017;
@@ -633,7 +651,6 @@ QList<QByteArray> QUtf32LECodec::aliases() const
return list;
}
+#endif //QT_NO_TEXTCODEC
QT_END_NAMESPACE
-
-#endif //QT_NO_TEXTCODEC
diff --git a/src/corelib/codecs/qutfcodec_p.h b/src/corelib/codecs/qutfcodec_p.h
index 749f5be..4f8f92e 100644
--- a/src/corelib/codecs/qutfcodec_p.h
+++ b/src/corelib/codecs/qutfcodec_p.h
@@ -54,9 +54,35 @@
//
#include "QtCore/qtextcodec.h"
+#include "private/qtextcodec_p.h"
QT_BEGIN_NAMESPACE
+enum DataEndianness
+{
+ DetectEndianness,
+ BigEndianness,
+ LittleEndianness
+};
+
+struct QUtf8
+{
+ static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *);
+ static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *);
+};
+
+struct QUtf16
+{
+ static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness);
+ static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness);
+};
+
+struct QUtf32
+{
+ static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness);
+ static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness);
+};
+
#ifndef QT_NO_TEXTCODEC
class QUtf8Codec : public QTextCodec {
@@ -73,13 +99,8 @@ public:
class QUtf16Codec : public QTextCodec {
protected:
- enum Endianness {
- Detect,
- BE,
- LE
- };
public:
- QUtf16Codec() { e = Detect; }
+ QUtf16Codec() { e = DetectEndianness; }
~QUtf16Codec();
QByteArray name() const;
@@ -90,12 +111,12 @@ public:
QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const;
protected:
- Endianness e;
+ DataEndianness e;
};
class QUtf16BECodec : public QUtf16Codec {
public:
- QUtf16BECodec() : QUtf16Codec() { e = BE; }
+ QUtf16BECodec() : QUtf16Codec() { e = BigEndianness; }
QByteArray name() const;
QList<QByteArray> aliases() const;
int mibEnum() const;
@@ -103,21 +124,15 @@ public:
class QUtf16LECodec : public QUtf16Codec {
public:
- QUtf16LECodec() : QUtf16Codec() { e = LE; }
+ QUtf16LECodec() : QUtf16Codec() { e = LittleEndianness; }
QByteArray name() const;
QList<QByteArray> aliases() const;
int mibEnum() const;
};
class QUtf32Codec : public QTextCodec {
-protected:
- enum Endianness {
- Detect,
- BE,
- LE
- };
public:
- QUtf32Codec() { e = Detect; }
+ QUtf32Codec() { e = DetectEndianness; }
~QUtf32Codec();
QByteArray name() const;
@@ -128,12 +143,12 @@ public:
QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const;
protected:
- Endianness e;
+ DataEndianness e;
};
class QUtf32BECodec : public QUtf32Codec {
public:
- QUtf32BECodec() : QUtf32Codec() { e = BE; }
+ QUtf32BECodec() : QUtf32Codec() { e = BigEndianness; }
QByteArray name() const;
QList<QByteArray> aliases() const;
int mibEnum() const;
@@ -141,7 +156,7 @@ public:
class QUtf32LECodec : public QUtf32Codec {
public:
- QUtf32LECodec() : QUtf32Codec() { e = LE; }
+ QUtf32LECodec() : QUtf32Codec() { e = LittleEndianness; }
QByteArray name() const;
QList<QByteArray> aliases() const;
int mibEnum() const;
diff --git a/src/corelib/concurrent/qfuture.h b/src/corelib/concurrent/qfuture.h
index 47015ee..f2db5ac 100644
--- a/src/corelib/concurrent/qfuture.h
+++ b/src/corelib/concurrent/qfuture.h
@@ -210,7 +210,7 @@ public:
bool operator==(const QFuture &other) const { return (d == other.d); }
bool operator!=(const QFuture &other) const { return (d != other.d); }
-#ifndef QT_NO_MEMBER_TEMPLATES
+#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(Q_CC_XLC)
template <typename T>
QFuture(const QFuture<T> &other)
: d(other.d)
diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp
index ffbb479..caf8bac 100644
--- a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp
+++ b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp
@@ -42,20 +42,14 @@
#include "qtconcurrentiteratekernel.h"
#if defined(Q_OS_MAC)
-
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <unistd.h>
-
#elif defined(Q_OS_UNIX)
-
#include <time.h>
#include <unistd.h>
-
#elif defined(Q_OS_WIN)
-
-#include <windows.h>
-
+#include <qt_windows.h>
#endif
diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/corelib/concurrent/qtconcurrentmap.cpp
index b8c753a..797f335 100644
--- a/src/corelib/concurrent/qtconcurrentmap.cpp
+++ b/src/corelib/concurrent/qtconcurrentmap.cpp
@@ -41,13 +41,14 @@
/*!
\namespace QtConcurrent
+ \inmodule QtCore
\since 4.4
\brief The QtConcurrent namespace provides high-level APIs that make it
possible to write multi-threaded programs without using low-level
threading primitives.
See the \l {threads.html#qtconcurrent-intro}{Qt Concurrent} section in the \l{threads.html}{threading} documentation.
-
+ \inheaderfile QtCore
\ingroup thread
*/
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 76ffb6a..0a8f5b9 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -922,7 +922,7 @@ QT_BEGIN_NAMESPACE
\fn bool qt_winUnicode()
\relates <QtGlobal>
- Use QSysInfo::WindowsVersion and QSysInfo::WV_DOS_based instead.
+ This function always returns true.
\sa QSysInfo
*/
@@ -1673,15 +1673,11 @@ QSysInfo::WinVersion QSysInfo::windowsVersion()
if (winver)
return winver;
winver = QSysInfo::WV_NT;
-#ifndef Q_OS_WINCE
- OSVERSIONINFOA osver;
- osver.dwOSVersionInfoSize = sizeof(osver);
- GetVersionExA(&osver);
-#else
- DWORD qt_cever = 0;
OSVERSIONINFOW osver;
osver.dwOSVersionInfoSize = sizeof(osver);
GetVersionEx(&osver);
+#ifdef Q_OS_WINCE
+ DWORD qt_cever = 0;
qt_cever = osver.dwMajorVersion * 100;
qt_cever += osver.dwMinorVersion * 10;
#endif
@@ -1725,7 +1721,7 @@ QSysInfo::WinVersion QSysInfo::windowsVersion()
winver = QSysInfo::WV_WINDOWS7;
} else {
qWarning("Qt: Untested Windows version %d.%d detected!",
- osver.dwMajorVersion, osver.dwMinorVersion);
+ int(osver.dwMajorVersion), int(osver.dwMinorVersion));
winver = QSysInfo::WV_NT_based;
}
}
@@ -2049,29 +2045,16 @@ QString qt_error_string(int errorCode)
break;
default: {
#ifdef Q_OS_WIN
- QT_WA({
- unsigned short *string = 0;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- errorCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)&string,
- 0,
- NULL);
- ret = QString::fromUtf16(string);
- LocalFree((HLOCAL)string);
- }, {
- char *string = 0;
- FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- errorCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPSTR)&string,
- 0,
- NULL);
- ret = QString::fromLocal8Bit(string);
- LocalFree((HLOCAL)string);
- });
+ wchar_t *string = 0;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ errorCode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ string,
+ 0,
+ NULL);
+ ret = QString::fromWCharArray(string);
+ LocalFree((HLOCAL)string);
if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)
ret = QString::fromLatin1("The specified module could not be found.");
@@ -2672,6 +2655,62 @@ int qrand()
*/
/*!
+ \fn QString qtTrId(const char *id, int n = -1)
+ \relates <QtGlobal>
+ \reentrant
+ \since 4.6
+
+ Returns a translated string identified by \a id.
+ If no matching string is found, the id itself is returned. This
+ should not happen under normal conditions.
+
+ If \a n >= 0, all occurrences of \c %n in the resulting string
+ are replaced with a decimal representation of \a n. In addition,
+ depending on \a n's value, the translation text may vary.
+
+ Meta data and comments can be passed as documented for QObject::tr().
+ In addition, it is possible to supply a source string template like that:
+
+ \tt{//% <C string>}
+
+ or
+
+ \tt{\begincomment% <C string> \endcomment}
+
+ Example:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qttrid
+
+ Creating QM files suitable for use with this function requires passing
+ the \c -idbased option to the \c lrelease tool.
+
+ \warning This method is reentrant only if all translators are
+ installed \e before calling this method. Installing or removing
+ translators while performing translations is not supported. Doing
+ so will probably result in crashes or other undesirable behavior.
+
+ \sa QObject::tr(), QCoreApplication::translate(), {Internationalization with Qt}
+*/
+
+/*!
+ \macro QT_TRID_NOOP(id)
+ \relates <QtGlobal>
+ \since 4.6
+
+ Marks \a id for dynamic translation.
+ The only purpose of this macro is to provide an anchor for attaching
+ meta data like to qtTrId().
+
+ The macro expands to \a id.
+
+ Example:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qttrid_noop
+
+ \sa qtTrId(), {Internationalization with Qt}
+*/
+
+/*!
\macro QT_POINTER_SIZE
\relates <QtGlobal>
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index e6508a8..fb708b5 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -148,7 +148,7 @@ namespace QT_NAMESPACE {}
MSDOS - MS-DOS and Windows
OS2 - OS/2
OS2EMX - XFree86 on OS/2 (not PM)
- WIN32 - Win32 (Windows 95/98/ME and Windows NT/2000/XP)
+ WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)
WINCE - WinCE (Windows CE 5.0)
CYGWIN - Cygwin
SOLARIS - Sun Solaris
@@ -684,7 +684,8 @@ namespace QT_NAMESPACE {}
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
-# define Q_DECL_EXPORT __attribute__((__visibility__("default")))
+// using CC 5.9: Warning: attribute visibility is unsupported and will be skipped..
+//# define Q_DECL_EXPORT __attribute__((__visibility__("default")))
# endif
# if !defined(_BOOL)
# define Q_NO_BOOL_TYPE
@@ -724,7 +725,7 @@ namespace QT_NAMESPACE {}
# define Q_DECL_ALIGNED(n) __attribute__((aligned(n)))
# endif
# if __HP_aCC-0 >= 062000
-# define Q_DECL_EXPORT __attribute__((visibility("default"))
+# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_IMPORT Q_DECL_EXPORT
# endif
# else
@@ -1503,24 +1504,13 @@ inline QT3_SUPPORT bool qSysInfo(int *wordSize, bool *bigEndian)
#if defined(Q_WS_WIN) || defined(Q_OS_CYGWIN)
#if defined(QT3_SUPPORT)
-inline QT3_SUPPORT bool qt_winUnicode() { return !(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based); }
+inline QT3_SUPPORT bool qt_winUnicode() { return true; }
inline QT3_SUPPORT int qWinVersion() { return QSysInfo::WindowsVersion; }
#endif
-#ifdef Q_OS_WINCE
-#define QT_WA(uni, ansi) uni
-#define QT_WA_INLINE(uni, ansi) (uni)
-#elif defined(Q_CC_MWERKS)
-#define QT_WA(uni, ansi) ansi
-#define QT_WA_INLINE(uni, ansi) (ansi)
-#elif defined(UNICODE)
-#define QT_WA(uni, ansi) if (!(QSysInfo::windowsVersion() & QSysInfo::WV_DOS_based)) { uni } else { ansi }
+#define QT_WA(unicode, ansi) unicode
+#define QT_WA_INLINE(unicode, ansi) (unicode)
-#define QT_WA_INLINE(uni, ansi) (!(QSysInfo::windowsVersion() & QSysInfo::WV_DOS_based) ? uni : ansi)
-#else
-#define QT_WA(uni, ansi) ansi
-#define QT_WA_INLINE(uni, ansi) ansi
-#endif
#endif /* Q_WS_WIN */
#ifndef Q_OUTOFLINE_TEMPLATE
@@ -2170,7 +2160,7 @@ public:
inline bool operator!() const { return !i; }
- inline bool testFlag(Enum f) const { return (i & f) == f; }
+ inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == f ); }
};
#define Q_DECLARE_FLAGS(Flags, Enum)\
@@ -2306,6 +2296,18 @@ inline const QForeachContainer<T> *qForeachContainer(const QForeachContainerBase
#define QT_TRANSLATE_NOOP_UTF8(scope, x) (x)
#define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment}
#define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment}
+
+#ifndef QT_NO_TRANSLATION // ### This should enclose the NOOPs above
+
+// Defined in qcoreapplication.cpp
+// The better name qTrId() is reserved for an upcoming function which would
+// return a much more powerful QStringFormatter instead of a QString.
+Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
+
+#define QT_TRID_NOOP(id) id
+
+#endif // QT_NO_TRANSLATION
+
#define QDOC_PROPERTY(text)
/*
@@ -2546,28 +2548,15 @@ QT_LICENSED_MODULE(DBus)
# define QT_NO_QFUTURE
#endif
-/*
- Turn off certain features for compilers that have problems parsing
- the code.
-*/
-#if (defined(Q_CC_HPACC) && defined(QT_ARCH_PARISC)) \
- || defined(Q_CC_MIPS) \
- || defined(Q_CC_XLC)
-// HP aCC A.03.*, MIPSpro, and xlC cannot handle
-// the template function declarations for the QtConcurrent functions
-# define QT_NO_QFUTURE
-# define QT_NO_CONCURRENT
-#endif
-
-// MSVC 6.0, MSVC .NET 2002, and old versions of Sun CC can`t handle the map(), etc templates,
+// MSVC 6.0 and MSVC .NET 2002, can`t handle the map(), etc templates,
// but the QFuture class compiles.
-#if (defined(Q_CC_MSVC) && _MSC_VER <= 1300) || (defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x590)
+#if (defined(Q_CC_MSVC) && _MSC_VER <= 1300)
# define QT_NO_CONCURRENT
#endif
-// Mingw uses a gcc 3 version which has problems with some of the
-// map/filter overloads. So does IRIX and Solaris.
-#if (defined(Q_OS_IRIX) || defined(Q_CC_MINGW) || defined (Q_OS_SOLARIS)) && (__GNUC__ < 4)
+// gcc 3 version has problems with some of the
+// map/filter overloads.
+#if defined(Q_CC_GNU) && (__GNUC__ < 4)
# define QT_NO_CONCURRENT_MAP
# define QT_NO_CONCURRENT_FILTER
#endif
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index fdd7eee..ceec078 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1435,7 +1435,8 @@ public:
ToolButtonIconOnly,
ToolButtonTextOnly,
ToolButtonTextBesideIcon,
- ToolButtonTextUnderIcon
+ ToolButtonTextUnderIcon,
+ ToolButtonFollowStyle
};
enum LayoutDirection {
@@ -1589,18 +1590,6 @@ public:
};
Q_DECLARE_FLAGS(TouchPointStates, TouchPointState)
- enum GestureType
- {
- UnknownGesture,
- TapGesture,
- DoubleTapGesture,
- TrippleTapGesture,
- TapAndHoldGesture,
- PanGesture,
- PinchGesture
- };
-
-
enum GestureState
{
NoGesture,
@@ -1609,23 +1598,6 @@ public:
GestureFinished = 3
};
- enum DirectionType
- {
- NoDirection = 0,
- LeftDownDirection = 1,
- DownLeftDirection = LeftDownDirection,
- DownDirection = 2,
- RightDownDirection = 3,
- DownRightDirection = RightDownDirection,
- LeftDirection = 4,
- RightDirection = 6,
- LeftUpDirection = 7,
- UpLeftDirection = LeftUpDirection,
- UpDirection = 8,
- RightUpDirection = 9,
- UpRightDirection = RightUpDirection
- };
-
}
#ifdef Q_MOC_RUN
;
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index 5df57e5..fc7d75e 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -53,6 +53,13 @@
#endif
#endif
+#if defined(Q_CC_MINGW)
+// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
+#ifndef WINVER
+#define WINVER 0x500
+#endif
+#endif
+
#include <windows.h>
#ifdef _WIN32_WCE
@@ -60,7 +67,6 @@
#endif
// already defined when compiled with WINVER >= 0x0500
-// and we only use them in Qt::WV_2000 and Qt::WV_98
#ifndef SPI_SETMENUANIMATION
#define SPI_SETMENUANIMATION 0x1003
#endif
@@ -100,6 +106,9 @@
#ifndef SPI_GETKEYBOARDCUES
#define SPI_GETKEYBOARDCUES 0x100A
#endif
+#ifndef SPI_GETGRADIENTCAPTIONS
+#define SPI_GETGRADIENTCAPTIONS 0x1008
+#endif
#ifndef IDC_HAND
#define IDC_HAND MAKEINTRESOURCE(32649)
#endif
@@ -112,5 +121,31 @@
#ifndef ETO_PDY
#define ETO_PDY 0x2000
#endif
+#ifndef COLOR_GRADIENTACTIVECAPTION
+#define COLOR_GRADIENTACTIVECAPTION 27
+#endif
+#ifndef COLOR_GRADIENTINACTIVECAPTION
+#define COLOR_GRADIENTINACTIVECAPTION 28
+#endif
+
+// already defined when compiled with WINVER >= 0x0600
+#ifndef SPI_GETFLATMENU
+#define SPI_GETFLATMENU 0x1022
+#endif
+#ifndef CS_DROPSHADOW
+#define CS_DROPSHADOW 0x00020000
+#endif
+#ifndef CLEARTYPE_QUALITY
+#define CLEARTYPE_QUALITY 5
+#endif
+
+#ifdef Q_WS_WINCE
+#ifndef LR_DEFAULTSIZE
+#define LR_DEFAULTSIZE 0
+#endif
+#ifndef LR_SHARED
+#define LR_SHARED 0
+#endif
+#endif // Q_WS_WINCE
#endif // QT_WINDOWS_H
diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp
index d2fb768..fbd838a 100644
--- a/src/corelib/io/qabstractfileengine.cpp
+++ b/src/corelib/io/qabstractfileengine.cpp
@@ -42,7 +42,7 @@
#include "qabstractfileengine.h"
#include "private/qabstractfileengine_p.h"
#include "qdatetime.h"
-#include "qmutex.h"
+#include "qreadwritelock.h"
#include "qvariant.h"
// built-in handlers
#include "qfsfileengine.h"
@@ -98,14 +98,14 @@ QT_BEGIN_NAMESPACE
All application-wide handlers are stored in this list. The mutex must be
acquired to ensure thread safety.
*/
-Q_GLOBAL_STATIC_WITH_ARGS(QMutex, fileEngineHandlerMutex, (QMutex::Recursive))
+Q_GLOBAL_STATIC_WITH_ARGS(QReadWriteLock, fileEngineHandlerMutex, (QReadWriteLock::Recursive))
static bool qt_abstractfileenginehandlerlist_shutDown = false;
class QAbstractFileEngineHandlerList : public QList<QAbstractFileEngineHandler *>
{
public:
~QAbstractFileEngineHandlerList()
{
- QMutexLocker locker(fileEngineHandlerMutex());
+ QWriteLocker locker(fileEngineHandlerMutex());
qt_abstractfileenginehandlerlist_shutDown = true;
}
};
@@ -122,7 +122,7 @@ Q_GLOBAL_STATIC(QAbstractFileEngineHandlerList, fileEngineHandlers)
*/
QAbstractFileEngineHandler::QAbstractFileEngineHandler()
{
- QMutexLocker locker(fileEngineHandlerMutex());
+ QWriteLocker locker(fileEngineHandlerMutex());
fileEngineHandlers()->prepend(this);
}
@@ -132,7 +132,7 @@ QAbstractFileEngineHandler::QAbstractFileEngineHandler()
*/
QAbstractFileEngineHandler::~QAbstractFileEngineHandler()
{
- QMutexLocker locker(fileEngineHandlerMutex());
+ QWriteLocker locker(fileEngineHandlerMutex());
// Remove this handler from the handler list only if the list is valid.
if (!qt_abstractfileenginehandlerlist_shutDown)
fileEngineHandlers()->removeAll(this);
@@ -166,12 +166,14 @@ QAbstractFileEngineHandler::~QAbstractFileEngineHandler()
*/
QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName)
{
- QMutexLocker locker(fileEngineHandlerMutex());
+ {
+ QReadLocker locker(fileEngineHandlerMutex());
- // check for registered handlers that can load the file
- for (int i = 0; i < fileEngineHandlers()->size(); i++) {
- if (QAbstractFileEngine *ret = fileEngineHandlers()->at(i)->create(fileName))
- return ret;
+ // check for registered handlers that can load the file
+ for (int i = 0; i < fileEngineHandlers()->size(); i++) {
+ if (QAbstractFileEngine *ret = fileEngineHandlers()->at(i)->create(fileName))
+ return ret;
+ }
}
#ifdef QT_BUILD_CORE_LIB
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index 582d657..30d2558 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -106,26 +106,29 @@ public:
QDir::Filters filters, QDirIterator::IteratorFlags flags);
~QDirIteratorPrivate();
- void pushSubDirectory(const QString &path, const QStringList &nameFilters,
- QDir::Filters filters);
void advance();
- bool shouldFollowDirectory(const QFileInfo &);
+
+ void pushDirectory(const QFileInfo &fileInfo);
+ void checkAndPushDirectory(const QFileInfo &);
bool matchesFilters(const QString &fileName, const QFileInfo &fi) const;
- QSet<QString> visitedLinks;
- QAbstractFileEngine *engine;
+ QAbstractFileEngine * const engine;
+
+ const QString path;
+ const QStringList nameFilters;
+ const QDir::Filters filters;
+ const QDirIterator::IteratorFlags iteratorFlags;
+
+#ifndef QT_NO_REGEXP
+ QVector<QRegExp> nameRegExps;
+#endif
+
QStack<QAbstractFileEngineIterator *> fileEngineIterators;
- QString path;
- QFileInfo nextFileInfo;
- //This fileinfo is the current that we will return from the public API
QFileInfo currentFileInfo;
- QString currentFilePath;
- QDirIterator::IteratorFlags iteratorFlags;
- QDir::Filters filters;
- QStringList nameFilters;
- bool followNextDir;
- bool first;
- bool done;
+ QFileInfo nextFileInfo;
+
+ // Loop protection
+ QSet<QString> visitedLinks;
QDirIterator *q;
};
@@ -135,15 +138,24 @@ public:
*/
QDirIteratorPrivate::QDirIteratorPrivate(const QString &path, const QStringList &nameFilters,
QDir::Filters filters, QDirIterator::IteratorFlags flags)
- : engine(0), path(path), nextFileInfo(path), iteratorFlags(flags), followNextDir(false), first(true), done(false)
+ : engine(QAbstractFileEngine::create(path))
+ , path(path)
+ , nameFilters(nameFilters.contains(QLatin1String("*")) ? QStringList() : nameFilters)
+ , filters(QDir::NoFilter == filters ? QDir::AllEntries : filters)
+ , iteratorFlags(flags)
{
- if (filters == QDir::NoFilter)
- filters = QDir::AllEntries;
- this->filters = filters;
- this->nameFilters = nameFilters;
+#ifndef QT_NO_REGEXP
+ nameRegExps.reserve(nameFilters.size());
+ for (int i = 0; i < nameFilters.size(); ++i)
+ nameRegExps.append(
+ QRegExp(nameFilters.at(i),
+ (filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive,
+ QRegExp::Wildcard));
+#endif
- pushSubDirectory(nextFileInfo.isSymLink() ? nextFileInfo.canonicalFilePath() : path,
- nameFilters, filters);
+ // Populate fields for hasNext() and next()
+ pushDirectory(QFileInfo(path));
+ advance();
}
/*!
@@ -157,20 +169,19 @@ QDirIteratorPrivate::~QDirIteratorPrivate()
/*!
\internal
*/
-void QDirIteratorPrivate::pushSubDirectory(const QString &path, const QStringList &nameFilters,
- QDir::Filters filters)
+void QDirIteratorPrivate::pushDirectory(const QFileInfo &fileInfo)
{
- if (iteratorFlags & QDirIterator::FollowSymlinks) {
- if (nextFileInfo.filePath() != path)
- nextFileInfo.setFile(path);
- if (nextFileInfo.isSymLink()) {
- visitedLinks << nextFileInfo.canonicalFilePath();
- } else {
- visitedLinks << nextFileInfo.absoluteFilePath();
- }
- }
-
- if (engine || (engine = QAbstractFileEngine::create(this->path))) {
+ QString path = fileInfo.filePath();
+
+#ifdef Q_OS_WIN
+ if (fileInfo.isSymLink())
+ path = fileInfo.canonicalFilePath();
+#endif
+
+ if (iteratorFlags & QDirIterator::FollowSymlinks)
+ visitedLinks << fileInfo.canonicalFilePath();
+
+ if (engine) {
engine->setFileName(path);
QAbstractFileEngineIterator *it = engine->beginEntryList(filters, nameFilters);
if (it) {
@@ -187,95 +198,64 @@ void QDirIteratorPrivate::pushSubDirectory(const QString &path, const QStringLis
*/
void QDirIteratorPrivate::advance()
{
- // Store the current entry
- if (!fileEngineIterators.isEmpty())
- currentFilePath = fileEngineIterators.top()->currentFilePath();
-
- // Advance to the next entry
- if (followNextDir) {
- // Start by navigating into the current directory.
- followNextDir = false;
-
- QAbstractFileEngineIterator *it = fileEngineIterators.top();
-
- QString subDir = it->currentFilePath();
-#ifdef Q_OS_WIN
- if (nextFileInfo.isSymLink())
- subDir = nextFileInfo.canonicalFilePath();
-#endif
- pushSubDirectory(subDir, it->nameFilters(), it->filters());
- }
-
while (!fileEngineIterators.isEmpty()) {
- QAbstractFileEngineIterator *it = fileEngineIterators.top();
// Find the next valid iterator that matches the filters.
- bool foundDirectory = false;
- while (it->hasNext()) {
+ while (fileEngineIterators.top()->hasNext()) {
+ QAbstractFileEngineIterator *it = fileEngineIterators.top();
it->next();
+
const QFileInfo info = it->currentFileInfo();
+ checkAndPushDirectory(it->currentFileInfo());
+
if (matchesFilters(it->currentFileName(), info)) {
currentFileInfo = nextFileInfo;
nextFileInfo = info;
- // Signal that we want to follow this entry.
- followNextDir = shouldFollowDirectory(nextFileInfo);
+
//We found a matching entry.
return;
-
- } else if (iteratorFlags & QDirIterator::Subdirectories) {
-
- if (!shouldFollowDirectory(info))
- continue;
- QString subDir = it->currentFilePath();
-#ifdef Q_OS_WIN
- if (info.isSymLink())
- subDir = info.canonicalFilePath();
-#endif
- pushSubDirectory(subDir, it->nameFilters(), it->filters());
-
- foundDirectory = true;
- break;
}
}
- if (!foundDirectory)
- delete fileEngineIterators.pop();
+
+ delete fileEngineIterators.pop();
}
+
currentFileInfo = nextFileInfo;
- done = true;
+ nextFileInfo = QFileInfo();
}
/*!
\internal
*/
-bool QDirIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo)
+void QDirIteratorPrivate::checkAndPushDirectory(const QFileInfo &fileInfo)
{
// If we're doing flat iteration, we're done.
if (!(iteratorFlags & QDirIterator::Subdirectories))
- return false;
-
+ return;
+
// Never follow non-directory entries
if (!fileInfo.isDir())
- return false;
+ return;
+ // Follow symlinks only when asked
+ if (!(iteratorFlags & QDirIterator::FollowSymlinks) && fileInfo.isSymLink())
+ return;
// Never follow . and ..
- if (fileInfo.fileName() == QLatin1String(".") || fileInfo.fileName() == QLatin1String(".."))
- return false;
+ QString fileName = fileInfo.fileName();
+ if (QLatin1String(".") == fileName || QLatin1String("..") == fileName)
+ return;
-
- // Check symlinks
- if (fileInfo.isSymLink() && !(iteratorFlags & QDirIterator::FollowSymlinks)) {
- // Follow symlinks only if FollowSymlinks was passed
- return false;
- }
+ // No hidden directories unless requested
+ if (!(filters & QDir::AllDirs) && !(filters & QDir::Hidden) && fileInfo.isHidden())
+ return;
// Stop link loops
if (visitedLinks.contains(fileInfo.canonicalFilePath()))
- return false;
-
- return true;
+ return;
+
+ pushDirectory(fileInfo);
}
-
/*!
\internal
@@ -289,10 +269,7 @@ bool QDirIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo)
*/
bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInfo &fi) const
{
- if (fileName.isEmpty()) {
- // invalid entry
- return false;
- }
+ Q_ASSERT(!fileName.isEmpty());
// filter . and ..?
const int fileNameSize = fileName.size();
@@ -303,16 +280,15 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
return false;
// name filter
-#ifndef QT_NO_REGEXP
- const bool hasNameFilters = !nameFilters.isEmpty() && !(nameFilters.contains(QLatin1String("*")));
+#ifndef QT_NO_REGEXP
// Pass all entries through name filters, except dirs if the AllDirs
- if (hasNameFilters && !((filters & QDir::AllDirs) && fi.isDir())) {
+ if (!nameFilters.isEmpty() && !((filters & QDir::AllDirs) && fi.isDir())) {
bool matched = false;
- for (int i = 0; i < nameFilters.size(); ++i) {
- QRegExp regexp(nameFilters.at(i),
- (filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive,
- QRegExp::Wildcard);
- if (regexp.exactMatch(fileName)) {
+ for (QVector<QRegExp>::const_iterator iter = nameRegExps.constBegin(),
+ end = nameRegExps.constEnd();
+ iter != end; ++iter) {
+
+ if (iter->exactMatch(fileName)) {
matched = true;
break;
}
@@ -333,17 +309,11 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
|| (!fi.exists() && fi.isSymLink())))
return false;
-
- if (!includeSystem && !dotOrDotDot && ((fi.exists() && !fi.isFile() && !fi.isDir() && !fi.isSymLink())
- || (!fi.exists() && fi.isSymLink()))) {
- return false;
- }
-
// skip directories
const bool skipDirs = !(filters & (QDir::Dirs | QDir::AllDirs));
if (skipDirs && fi.isDir()) {
- if (!(includeHidden && !dotOrDotDot && fi.isHidden())
- || (includeSystem && !fi.exists() && fi.isSymLink()))
+ if (!((includeHidden && !dotOrDotDot && fi.isHidden())
+ || (includeSystem && !fi.exists() && fi.isSymLink())))
return false;
}
@@ -368,7 +338,7 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
|| (doExecutable && !fi.isExecutable()))) {
return false;
}
-
+
return true;
}
@@ -410,7 +380,7 @@ QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags)
\sa hasNext(), next(), IteratorFlags
*/
QDirIterator::QDirIterator(const QString &path, QDir::Filters filters, IteratorFlags flags)
- : d(new QDirIteratorPrivate(path, QStringList(QLatin1String("*")), filters, flags))
+ : d(new QDirIteratorPrivate(path, QStringList(), filters, flags))
{
d->q = this;
}
@@ -428,7 +398,7 @@ QDirIterator::QDirIterator(const QString &path, QDir::Filters filters, IteratorF
\sa hasNext(), next(), IteratorFlags
*/
QDirIterator::QDirIterator(const QString &path, IteratorFlags flags)
- : d(new QDirIteratorPrivate(path, QStringList(QLatin1String("*")), QDir::NoFilter, flags))
+ : d(new QDirIteratorPrivate(path, QStringList(), QDir::NoFilter, flags))
{
d->q = this;
}
@@ -445,7 +415,7 @@ QDirIterator::QDirIterator(const QString &path, IteratorFlags flags)
passed to the flags.
\warning This constructor expects \c flags to be left at its default value. Use the
- constructors that do not take the \a filters argument instead.
+ constructors that do not take the \a filters argument instead.
\sa hasNext(), next(), IteratorFlags
*/
@@ -477,8 +447,6 @@ QDirIterator::~QDirIterator()
*/
QString QDirIterator::next()
{
- if (!hasNext())
- return QString();
d->advance();
return filePath();
}
@@ -491,22 +459,17 @@ QString QDirIterator::next()
*/
bool QDirIterator::hasNext() const
{
- if (d->first) {
- d->first = false;
- d->advance();
- }
- return !d->done;
+ return !d->fileEngineIterators.isEmpty();
}
/*!
Returns the file name for the current directory entry, without the path
- prepended. If the current entry is invalid (i.e., isValid() returns
- false), a null QString is returned.
+ prepended.
+
+ This function is convenient when iterating a single directory. When using
+ the QDirIterator::Subdirectories flag, you can use filePath() to get the
+ full path.
- This function is provided for the convenience when iterating single
- directories. For recursive iteration, you should call filePath() or
- fileInfo() instead.
-
\sa filePath(), fileInfo()
*/
QString QDirIterator::fileName() const
@@ -515,20 +478,17 @@ QString QDirIterator::fileName() const
}
/*!
- Returns the full file path for the current directory entry. If the current
- entry is invalid (i.e., isValid() returns false), a null QString is
- returned.
+ Returns the full file path for the current directory entry.
\sa fileInfo(), fileName()
*/
QString QDirIterator::filePath() const
{
- return d->currentFilePath;
+ return d->currentFileInfo.filePath();
}
/*!
- Returns a QFileInfo for the current directory entry. If the current entry
- is invalid (i.e., isValid() returns false), a null QFileInfo is returned.
+ Returns a QFileInfo for the current directory entry.
\sa filePath(), fileName()
*/
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index afc7c31..c568369 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -117,11 +117,7 @@ bool QFileInfoPrivate::hasAccess(Access access) const
if (access == ExecuteAccess)
return getFileFlags(QAbstractFileEngine::ExeUserPerm);
- QT_WA( {
- return ::_waccess((TCHAR *)QFSFileEnginePrivate::longFileName(data->fileName).utf16(), mode) == 0;
- } , {
- return QT_ACCESS(QFSFileEnginePrivate::win95Name(data->fileName), mode) == 0;
- } );
+ return ::_waccess((wchar_t*)QFSFileEnginePrivate::longFileName(data->fileName).utf16(), mode) == 0;
#endif
return false;
}
diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
index c68af85..6df3746 100644
--- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
@@ -59,6 +59,8 @@
#include <fcntl.h>
#include <time.h>
+#include "private/qcore_unix_p.h"
+
#ifdef QT_LINUXBASE
/* LSB doesn't standardize these */
@@ -80,7 +82,7 @@ static void (*qfswd_old_sigio_handler)(int) = 0;
static void (*qfswd_old_sigio_action)(int, siginfo_t *, void *) = 0;
static void qfswd_sigio_monitor(int signum, siginfo_t *i, void *v)
{
- ::write(qfswd_fileChanged_pipe[1], &i->si_fd, sizeof(int));
+ qt_safe_write(qfswd_fileChanged_pipe[1], reinterpret_cast<char*>(&i->si_fd), sizeof(int));
if (qfswd_old_sigio_handler && qfswd_old_sigio_handler != SIG_IGN)
qfswd_old_sigio_handler(signum);
@@ -121,9 +123,7 @@ QDnotifySignalThread::QDnotifySignalThread()
{
moveToThread(this);
- ::pipe(qfswd_fileChanged_pipe);
- ::fcntl(qfswd_fileChanged_pipe[0], F_SETFL,
- ::fcntl(qfswd_fileChanged_pipe[0], F_GETFL) | O_NONBLOCK);
+ qt_safe_pipe(qfswd_fileChanged_pipe, O_NONBLOCK);
struct sigaction oldAction;
struct sigaction action;
@@ -181,7 +181,7 @@ void QDnotifySignalThread::run()
void QDnotifySignalThread::readFromDnotify()
{
int fd;
- int readrv = ::read(qfswd_fileChanged_pipe[0], &fd,sizeof(int));
+ int readrv = qt_safe_read(qfswd_fileChanged_pipe[0], reinterpret_cast<char*>(&fd), sizeof(int));
// Only expect EAGAIN or EINTR. Other errors are assumed to be impossible.
if(readrv != -1) {
Q_ASSERT(readrv == sizeof(int));
@@ -207,9 +207,9 @@ QDnotifyFileSystemWatcherEngine::~QDnotifyFileSystemWatcherEngine()
for(QHash<int, Directory>::ConstIterator iter = fdToDirectory.constBegin();
iter != fdToDirectory.constEnd();
++iter) {
- ::close(iter->fd);
+ qt_safe_close(iter->fd);
if(iter->parentFd)
- ::close(iter->parentFd);
+ qt_safe_close(iter->parentFd);
}
}
@@ -353,7 +353,7 @@ QStringList QDnotifyFileSystemWatcherEngine::removePaths(const QStringList &path
if(!directory.isMonitored && directory.files.isEmpty()) {
// No longer needed
- ::close(directory.fd);
+ qt_safe_close(directory.fd);
pathToFD.remove(directory.path);
fdToDirectory.remove(fd);
}
@@ -419,9 +419,9 @@ void QDnotifyFileSystemWatcherEngine::refresh(int fd)
}
if(!directory.isMonitored && directory.files.isEmpty()) {
- ::close(directory.fd);
+ qt_safe_close(directory.fd);
if(directory.parentFd) {
- ::close(directory.parentFd);
+ qt_safe_close(directory.parentFd);
parentToFD.remove(directory.parentFd);
}
fdToDirectory.erase(iter);
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 401e545..9d08228 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -44,6 +44,8 @@
#ifndef QT_NO_FILESYSTEMWATCHER
+#include "private/qcore_unix_p.h"
+
#include <qdebug.h>
#include <qfile.h>
#include <qfileinfo.h>
@@ -62,62 +64,80 @@
# define __NR_inotify_init 291
# define __NR_inotify_add_watch 292
# define __NR_inotify_rm_watch 293
+# define __NR_inotify_init1 332
#elif defined(__x86_64__)
# define __NR_inotify_init 253
# define __NR_inotify_add_watch 254
# define __NR_inotify_rm_watch 255
+# define __NR_inotify_init1 294
#elif defined(__powerpc__) || defined(__powerpc64__)
# define __NR_inotify_init 275
# define __NR_inotify_add_watch 276
# define __NR_inotify_rm_watch 277
+# define __NR_inotify_init1 318
#elif defined (__ia64__)
# define __NR_inotify_init 1277
# define __NR_inotify_add_watch 1278
# define __NR_inotify_rm_watch 1279
+# define __NR_inotify_init1 1318
#elif defined (__s390__) || defined (__s390x__)
# define __NR_inotify_init 284
# define __NR_inotify_add_watch 285
# define __NR_inotify_rm_watch 286
+# define __NR_inotify_init1 324
#elif defined (__alpha__)
# define __NR_inotify_init 444
# define __NR_inotify_add_watch 445
# define __NR_inotify_rm_watch 446
+// no inotify_init1 for the Alpha
#elif defined (__sparc__) || defined (__sparc64__)
# define __NR_inotify_init 151
# define __NR_inotify_add_watch 152
# define __NR_inotify_rm_watch 156
+# define __NR_inotify_init1 322
#elif defined (__arm__)
# define __NR_inotify_init 316
# define __NR_inotify_add_watch 317
# define __NR_inotify_rm_watch 318
+# define __NR_inotify_init1 360
#elif defined (__sh__)
# define __NR_inotify_init 290
# define __NR_inotify_add_watch 291
# define __NR_inotify_rm_watch 292
+# define __NR_inotify_init1 332
#elif defined (__sh64__)
# define __NR_inotify_init 318
# define __NR_inotify_add_watch 319
# define __NR_inotify_rm_watch 320
+# define __NR_inotify_init1 360
#elif defined (__mips__)
# define __NR_inotify_init 284
# define __NR_inotify_add_watch 285
# define __NR_inotify_rm_watch 286
+# define __NR_inotify_init1 329
#elif defined (__hppa__)
# define __NR_inotify_init 269
# define __NR_inotify_add_watch 270
# define __NR_inotify_rm_watch 271
+# define __NR_inotify_init1 314
#elif defined (__avr32__)
# define __NR_inotify_init 240
# define __NR_inotify_add_watch 241
# define __NR_inotify_rm_watch 242
+// no inotify_init1 for AVR32
#elif defined (__mc68000__)
# define __NR_inotify_init 284
# define __NR_inotify_add_watch 285
# define __NR_inotify_rm_watch 286
+# define __NR_inotify_init1 328
#else
# error "This architecture is not supported. Please talk to qt-bugs@trolltech.com"
#endif
+#if !defined(IN_CLOEXEC) && defined(O_CLOEXEC) && defined(__NR_inotify_init1)
+# define IN_CLOEXEC O_CLOEXEC
+#endif
+
QT_BEGIN_NAMESPACE
#ifdef QT_LINUXBASE
@@ -140,6 +160,13 @@ static inline int inotify_rm_watch(int fd, __u32 wd)
return syscall(__NR_inotify_rm_watch, fd, wd);
}
+#ifdef IN_CLOEXEC
+static inline int inotify_init1(int flags)
+{
+ return syscall(__NR_inotify_init1, flags);
+}
+#endif
+
// the following struct and values are documented in linux/inotify.h
extern "C" {
@@ -185,9 +212,16 @@ QT_BEGIN_NAMESPACE
QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create()
{
- int fd = inotify_init();
- if (fd <= 0)
- return 0;
+ register int fd = -1;
+#ifdef IN_CLOEXEC
+ fd = inotify_init1(IN_CLOEXEC);
+#endif
+ if (fd == -1) {
+ fd = inotify_init();
+ if (fd == -1)
+ return 0;
+ ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+ }
return new QInotifyFileSystemWatcherEngine(fd);
}
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
index ed42c34..dfed6a4 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp
+++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
@@ -43,6 +43,7 @@
#include "qfilesystemwatcher.h"
#include "qfilesystemwatcher_kqueue_p.h"
+#include "private/qcore_unix_p.h"
#include <qdebug.h>
#include <qfile.h>
@@ -124,9 +125,9 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths,
QString path = it.next();
int fd;
#if defined(O_EVTONLY)
- fd = ::open(QFile::encodeName(path), O_EVTONLY);
+ fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY);
#else
- fd = ::open(QFile::encodeName(path), O_RDONLY);
+ fd = qt_safe_open(QFile::encodeName(path), O_RDONLY);
#endif
if (fd == -1) {
perror("QKqueueFileSystemWatcherEngine::addPaths: open");
diff --git a/src/corelib/io/qfilesystemwatcher_p.h b/src/corelib/io/qfilesystemwatcher_p.h
index 850e150..83be197 100644
--- a/src/corelib/io/qfilesystemwatcher_p.h
+++ b/src/corelib/io/qfilesystemwatcher_p.h
@@ -69,13 +69,14 @@ class QFileSystemWatcherEngine : public QThread
Q_OBJECT
protected:
- inline QFileSystemWatcherEngine()
+ inline QFileSystemWatcherEngine(bool move = true)
{
- moveToThread(this);
+ if (move)
+ moveToThread(this);
}
public:
- // fills \a files and \a directires with the \a paths it could
+ // fills \a files and \a directories with the \a paths it could
// watch, and returns a list of paths this engine could not watch
virtual QStringList addPaths(const QStringList &paths,
QStringList *files,
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index 9a3aeae..9eeef02 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -53,25 +53,268 @@
QT_BEGIN_NAMESPACE
+void QWindowsFileSystemWatcherEngine::stop()
+{
+ foreach(QWindowsFileSystemWatcherEngineThread *thread, threads)
+ thread->stop();
+}
+
QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine()
- : msg(0)
+ : QFileSystemWatcherEngine(false)
{
- HANDLE h = QT_WA_INLINE(CreateEventW(0, false, false, 0),
- CreateEventA(0, false, false, 0));
- if (h != INVALID_HANDLE_VALUE) {
- handles.reserve(MAXIMUM_WAIT_OBJECTS);
- handles.append(h);
- }
}
QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine()
{
- if (handles.isEmpty())
+ if (threads.isEmpty())
return;
- stop();
- wait();
+ foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) {
+ thread->stop();
+ thread->wait();
+ delete thread;
+ }
+}
+
+QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
+ QStringList *files,
+ QStringList *directories)
+{
+ // qDebug()<<"Adding"<<paths.count()<<"to existing"<<(files->count() + directories->count())<<"watchers";
+ QStringList p = paths;
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ QString normalPath = path;
+ if ((normalPath.endsWith(QLatin1Char('/')) || normalPath.endsWith(QLatin1Char('\\')))
+#ifdef Q_OS_WINCE
+ && normalPath.size() > 1)
+#else
+ )
+#endif
+ normalPath.chop(1);
+ QFileInfo fileInfo(normalPath.toLower());
+ if (!fileInfo.exists())
+ continue;
+
+ bool isDir = fileInfo.isDir();
+ if (isDir) {
+ if (directories->contains(path))
+ continue;
+ } else {
+ if (files->contains(path))
+ continue;
+ }
+
+ // qDebug()<<"Looking for a thread/handle for"<<normalPath;
+
+ const QString absolutePath = isDir ? fileInfo.absoluteFilePath() : fileInfo.absolutePath();
+ const uint flags = isDir
+ ? (FILE_NOTIFY_CHANGE_DIR_NAME
+ | FILE_NOTIFY_CHANGE_FILE_NAME)
+ : (FILE_NOTIFY_CHANGE_DIR_NAME
+ | FILE_NOTIFY_CHANGE_FILE_NAME
+ | FILE_NOTIFY_CHANGE_ATTRIBUTES
+ | FILE_NOTIFY_CHANGE_SIZE
+ | FILE_NOTIFY_CHANGE_LAST_WRITE
+ | FILE_NOTIFY_CHANGE_SECURITY);
+
+ QWindowsFileSystemWatcherEngine::PathInfo pathInfo;
+ pathInfo.absolutePath = absolutePath;
+ pathInfo.isDir = isDir;
+ pathInfo.path = path;
+ pathInfo = fileInfo;
+
+ // Look for a thread
+ QWindowsFileSystemWatcherEngineThread *thread = 0;
+ QWindowsFileSystemWatcherEngine::Handle handle;
+ QList<QWindowsFileSystemWatcherEngineThread *>::const_iterator jt, end;
+ end = threads.constEnd();
+ for(jt = threads.constBegin(); jt != end; ++jt) {
+ thread = *jt;
+ QMutexLocker locker(&(thread->mutex));
+
+ handle = thread->handleForDir.value(absolutePath);
+ if (handle.handle != INVALID_HANDLE_VALUE && handle.flags == flags) {
+ // found a thread now insert...
+ // qDebug()<<" Found a thread"<<thread;
+
+ QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> &h
+ = thread->pathInfoForHandle[handle.handle];
+ if (!h.contains(fileInfo.absoluteFilePath())) {
+ thread->pathInfoForHandle[handle.handle].insert(fileInfo.absoluteFilePath(), pathInfo);
+ if (isDir)
+ directories->append(path);
+ else
+ files->append(path);
+ }
+ it.remove();
+ thread->wakeup();
+ break;
+ }
+ }
+
+ // no thread found, first create a handle
+ if (handle.handle == INVALID_HANDLE_VALUE || handle.flags != flags) {
+ // qDebug()<<" No thread found";
+ // Volume and folder paths need a trailing slash for proper notification
+ // (e.g. "c:" -> "c:/").
+ const QString effectiveAbsolutePath =
+ isDir ? (absolutePath + QLatin1Char('/')) : absolutePath;
+
+ handle.handle = FindFirstChangeNotification((wchar_t*) QDir::toNativeSeparators(effectiveAbsolutePath).utf16(), false, flags);
+ handle.flags = flags;
+ if (handle.handle == INVALID_HANDLE_VALUE)
+ continue;
+
+ // now look for a thread to insert
+ bool found = false;
+ foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) {
+ QMutexLocker(&(thread->mutex));
+ if (thread->handles.count() < MAXIMUM_WAIT_OBJECTS) {
+ // qDebug() << " Added handle" << handle.handle << "for" << absolutePath << "to watch" << fileInfo.absoluteFilePath();
+ // qDebug()<< " to existing thread"<<thread;
+ thread->handles.append(handle.handle);
+ thread->handleForDir.insert(absolutePath, handle);
+
+ thread->pathInfoForHandle[handle.handle].insert(fileInfo.absoluteFilePath(), pathInfo);
+ if (isDir)
+ directories->append(path);
+ else
+ files->append(path);
+
+ it.remove();
+ found = true;
+ thread->wakeup();
+ break;
+ }
+ }
+ if (!found) {
+ QWindowsFileSystemWatcherEngineThread *thread = new QWindowsFileSystemWatcherEngineThread();
+ //qDebug()<<" ###Creating new thread"<<thread<<"("<<(threads.count()+1)<<"threads)";
+ thread->handles.append(handle.handle);
+ thread->handleForDir.insert(absolutePath, handle);
+
+ thread->pathInfoForHandle[handle.handle].insert(fileInfo.absoluteFilePath(), pathInfo);
+ if (isDir)
+ directories->append(path);
+ else
+ files->append(path);
+
+ connect(thread, SIGNAL(fileChanged(const QString &, bool)),
+ this, SIGNAL(fileChanged(const QString &, bool)));
+ connect(thread, SIGNAL(directoryChanged(const QString &, bool)),
+ this, SIGNAL(directoryChanged(const QString &, bool)));
+
+ thread->msg = '@';
+ thread->start();
+ threads.append(thread);
+ it.remove();
+ }
+ }
+ }
+ return p;
+}
+
+QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &paths,
+ QStringList *files,
+ QStringList *directories)
+{
+ // qDebug()<<"removePaths"<<paths;
+ QStringList p = paths;
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ QString normalPath = path;
+ if (normalPath.endsWith(QLatin1Char('/')) || normalPath.endsWith(QLatin1Char('\\')))
+ normalPath.chop(1);
+ QFileInfo fileInfo(normalPath.toLower());
+ // qDebug()<<"removing"<<normalPath;
+ QString absolutePath = fileInfo.absoluteFilePath();
+ QList<QWindowsFileSystemWatcherEngineThread *>::iterator jt, end;
+ end = threads.end();
+ for(jt = threads.begin(); jt!= end; ++jt) {
+ QWindowsFileSystemWatcherEngineThread *thread = *jt;
+ if (*jt == 0)
+ continue;
+
+ QMutexLocker locker(&(thread->mutex));
+
+ QWindowsFileSystemWatcherEngine::Handle handle = thread->handleForDir.value(absolutePath);
+ if (handle.handle == INVALID_HANDLE_VALUE) {
+ // perhaps path is a file?
+ absolutePath = fileInfo.absolutePath();
+ handle = thread->handleForDir.value(absolutePath);
+ }
+ if (handle.handle != INVALID_HANDLE_VALUE) {
+ QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> &h =
+ thread->pathInfoForHandle[handle.handle];
+ if (h.remove(fileInfo.absoluteFilePath())) {
+ // ###
+ files->removeAll(path);
+ directories->removeAll(path);
+
+ if (h.isEmpty()) {
+ // qDebug() << "Closing handle" << handle.handle;
+ FindCloseChangeNotification(handle.handle); // This one might generate a notification
+
+ int indexOfHandle = thread->handles.indexOf(handle.handle);
+ Q_ASSERT(indexOfHandle != -1);
+ thread->handles.remove(indexOfHandle);
+
+ thread->handleForDir.remove(absolutePath);
+ // h is now invalid
+
+ it.remove();
+
+ if (thread->handleForDir.isEmpty()) {
+ // qDebug()<<"Stopping thread "<<thread;
+ locker.unlock();
+ thread->stop();
+ thread->wait();
+ locker.relock();
+ // We can't delete the thread until the mutex locker is
+ // out of scope
+ }
+ }
+ }
+ // Found the file, go to next one
+ break;
+ }
+ }
+ }
+
+ // Remove all threads that we stopped
+ QList<QWindowsFileSystemWatcherEngineThread *>::iterator jt, end;
+ end = threads.end();
+ for(jt = threads.begin(); jt != end; ++jt) {
+ if (!(*jt)->isRunning()) {
+ delete *jt;
+ *jt = 0;
+ }
+ }
+
+ threads.removeAll(0);
+ return p;
+}
+
+///////////
+// QWindowsFileSystemWatcherEngineThread
+///////////
+QWindowsFileSystemWatcherEngineThread::QWindowsFileSystemWatcherEngineThread()
+ : msg(0)
+{
+ if (HANDLE h = CreateEvent(0, false, false, 0)) {
+ handles.reserve(MAXIMUM_WAIT_OBJECTS);
+ handles.append(h);
+ }
+ moveToThread(this);
+}
+
+
+QWindowsFileSystemWatcherEngineThread::~QWindowsFileSystemWatcherEngineThread()
+{
CloseHandle(handles.at(0));
handles[0] = INVALID_HANDLE_VALUE;
@@ -82,13 +325,13 @@ QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine()
}
}
-void QWindowsFileSystemWatcherEngine::run()
+void QWindowsFileSystemWatcherEngineThread::run()
{
QMutexLocker locker(&mutex);
forever {
QVector<HANDLE> handlesCopy = handles;
locker.unlock();
- // qDebug() << "QWindowsFileSystemWatcherEngine: waiting on" << handlesCopy.count() << "handles";
+ // qDebug() << "QWindowsFileSystemWatcherThread"<<this<<"waiting on" << handlesCopy.count() << "handles";
DWORD r = WaitForMultipleObjects(handlesCopy.count(), handlesCopy.constData(), false, INFINITE);
locker.relock();
do {
@@ -96,7 +339,7 @@ void QWindowsFileSystemWatcherEngine::run()
int m = msg;
msg = 0;
if (m == 'q') {
- // qDebug() << "thread told to quit";
+ // qDebug() << "thread"<<this<<"told to quit";
return;
}
if (m != '@') {
@@ -111,15 +354,15 @@ void QWindowsFileSystemWatcherEngine::run()
// When removing a path, FindCloseChangeNotification might actually fire a notification
// for some reason, so we must check if the handle exist in the handles vector
if (handles.contains(handle)) {
- // qDebug("Acknowledged handle: %d, %p", at, handle);
+ // qDebug()<<"thread"<<this<<"Acknowledged handle:"<<at<<handle;
if (!FindNextChangeNotification(handle)) {
- qErrnoWarning("QFileSystemWatcher: FindNextChangeNotification failed");
+ qErrnoWarning("QFileSystemWatcher: FindNextChangeNotification failed!!");
}
- QHash<QString, PathInfo> &h = pathInfoForHandle[handle];
- QMutableHashIterator<QString, PathInfo> it(h);
+ QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> &h = pathInfoForHandle[handle];
+ QMutableHashIterator<QString, QWindowsFileSystemWatcherEngine::PathInfo> it(h);
while (it.hasNext()) {
- QHash<QString, PathInfo>::iterator x = it.next();
+ QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo>::iterator x = it.next();
QString absolutePath = x.value().absolutePath;
QFileInfo fileInfo(x.value().path);
// qDebug() << "checking" << x.key();
@@ -164,166 +407,14 @@ void QWindowsFileSystemWatcherEngine::run()
}
}
-QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
- QStringList *files,
- QStringList *directories)
-{
- if (handles.isEmpty() || handles.count() == MAXIMUM_WAIT_OBJECTS)
- return paths;
-
- QMutexLocker locker(&mutex);
-
- QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- QString normalPath = path;
- if ((normalPath.endsWith(QLatin1Char('/')) || normalPath.endsWith(QLatin1Char('\\')))
-#ifdef Q_OS_WINCE
- && normalPath.size() > 1)
-#else
- )
-#endif
- normalPath.chop(1);
- QFileInfo fileInfo(normalPath.toLower());
- if (!fileInfo.exists())
- continue;
-
- bool isDir = fileInfo.isDir();
- if (isDir) {
- if (directories->contains(path))
- continue;
- } else {
- if (files->contains(path))
- continue;
- }
-
- const QString absolutePath = isDir ? fileInfo.absoluteFilePath() : fileInfo.absolutePath();
- const uint flags = isDir
- ? (FILE_NOTIFY_CHANGE_DIR_NAME
- | FILE_NOTIFY_CHANGE_FILE_NAME)
- : (FILE_NOTIFY_CHANGE_DIR_NAME
- | FILE_NOTIFY_CHANGE_FILE_NAME
- | FILE_NOTIFY_CHANGE_ATTRIBUTES
- | FILE_NOTIFY_CHANGE_SIZE
- | FILE_NOTIFY_CHANGE_LAST_WRITE
- | FILE_NOTIFY_CHANGE_SECURITY);
-
- Handle handle = handleForDir.value(absolutePath);
- if (handle.handle == INVALID_HANDLE_VALUE || handle.flags != flags) {
- // Volume and folder paths need a trailing slash for proper notification
- // (e.g. "c:" -> "c:/").
- const QString effectiveAbsolutePath =
- isDir ? (absolutePath + QLatin1Char('/')) : absolutePath;
-
- QT_WA({
- handle.handle = FindFirstChangeNotificationW((TCHAR *) QDir::toNativeSeparators(effectiveAbsolutePath).utf16(),
- false, flags);
- },{
- handle.handle = FindFirstChangeNotificationA(QDir::toNativeSeparators(effectiveAbsolutePath).toLocal8Bit(),
- false, flags);
- })
- handle.flags = flags;
- if (handle.handle == INVALID_HANDLE_VALUE)
- continue;
- // qDebug() << "Added handle" << handle << "for" << absolutePath << "to watch" << fileInfo.absoluteFilePath();
- handles.append(handle.handle);
- handleForDir.insert(absolutePath, handle);
- }
-
- PathInfo pathInfo;
- pathInfo.absolutePath = absolutePath;
- pathInfo.isDir = isDir;
- pathInfo.path = path;
- pathInfo = fileInfo;
- QHash<QString, PathInfo> &h = pathInfoForHandle[handle.handle];
- if (!h.contains(fileInfo.absoluteFilePath())) {
- pathInfoForHandle[handle.handle].insert(fileInfo.absoluteFilePath(), pathInfo);
- if (isDir)
- directories->append(path);
- else
- files->append(path);
- }
-
- it.remove();
- }
-
- if (!isRunning()) {
- msg = '@';
- start();
- } else {
- wakeup();
- }
-
- return p;
-}
-
-QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &paths,
- QStringList *files,
- QStringList *directories)
-{
- QMutexLocker locker(&mutex);
-
- QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- QString normalPath = path;
- if (normalPath.endsWith(QLatin1Char('/')) || normalPath.endsWith(QLatin1Char('\\')))
- normalPath.chop(1);
- QFileInfo fileInfo(normalPath.toLower());
-
- QString absolutePath = fileInfo.absoluteFilePath();
- Handle handle = handleForDir.value(absolutePath);
- if (handle.handle == INVALID_HANDLE_VALUE) {
- // perhaps path is a file?
- absolutePath = fileInfo.absolutePath();
- handle = handleForDir.value(absolutePath);
- if (handle.handle == INVALID_HANDLE_VALUE)
- continue;
- }
-
- QHash<QString, PathInfo> &h = pathInfoForHandle[handle.handle];
- if (h.remove(fileInfo.absoluteFilePath())) {
- // ###
- files->removeAll(path);
- directories->removeAll(path);
-
- if (h.isEmpty()) {
- // qDebug() << "Closing handle" << handle;
- FindCloseChangeNotification(handle.handle); // This one might generate a notification
-
- int indexOfHandle = handles.indexOf(handle.handle);
- Q_ASSERT(indexOfHandle != -1);
- handles.remove(indexOfHandle);
-
- handleForDir.remove(absolutePath);
- // h is now invalid
-
- it.remove();
- }
- }
- }
-
- if (handleForDir.isEmpty()) {
- stop();
- locker.unlock();
- wait();
- locker.relock();
- } else {
- wakeup();
- }
-
- return p;
-}
-void QWindowsFileSystemWatcherEngine::stop()
+void QWindowsFileSystemWatcherEngineThread::stop()
{
msg = 'q';
SetEvent(handles.at(0));
}
-void QWindowsFileSystemWatcherEngine::wakeup()
+void QWindowsFileSystemWatcherEngineThread::wakeup()
{
msg = '@';
SetEvent(handles.at(0));
diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index d0eecfc..405d255 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -57,7 +57,7 @@
#ifndef QT_NO_FILESYSTEMWATCHER
-#include <windows.h>
+#include <qt_windows.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qfile.h>
@@ -68,27 +68,24 @@
QT_BEGIN_NAMESPACE
+class QWindowsFileSystemWatcherEngineThread;
+
+// Even though QWindowsFileSystemWatcherEngine is derived of QThread
+// via QFileSystemWatcher, it does not start a thread.
+// Instead QWindowsFileSystemWatcher creates QWindowsFileSystemWatcherEngineThreads
+// to do the actually watching.
class QWindowsFileSystemWatcherEngine : public QFileSystemWatcherEngine
{
Q_OBJECT
-
public:
QWindowsFileSystemWatcherEngine();
~QWindowsFileSystemWatcherEngine();
- void run();
-
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
void stop();
-private:
- void wakeup();
-
- QMutex mutex;
- QVector<HANDLE> handles;
- int msg;
class Handle
{
@@ -97,13 +94,12 @@ private:
uint flags;
Handle()
- : handle(INVALID_HANDLE_VALUE), flags(0u)
+ : handle(INVALID_HANDLE_VALUE), flags(0u)
{ }
Handle(const Handle &other)
- : handle(other.handle), flags(other.flags)
+ : handle(other.handle), flags(other.flags)
{ }
};
- QHash<QString, Handle> handleForDir;
class PathInfo {
public:
@@ -118,7 +114,7 @@ private:
QDateTime lastModified;
PathInfo &operator=(const QFileInfo &fileInfo)
- {
+ {
ownerId = fileInfo.ownerId();
groupId = fileInfo.groupId();
permissions = fileInfo.permissions();
@@ -134,8 +130,35 @@ private:
|| lastModified != fileInfo.lastModified());
}
};
- QHash<HANDLE, QHash<QString, PathInfo> > pathInfoForHandle;
+private:
+ QList<QWindowsFileSystemWatcherEngineThread *> threads;
+
+};
+
+class QWindowsFileSystemWatcherEngineThread : public QThread
+{
+ Q_OBJECT
+
+public:
+ QWindowsFileSystemWatcherEngineThread();
+ ~QWindowsFileSystemWatcherEngineThread();
+ void run();
+ void stop();
+ void wakeup();
+
+ QMutex mutex;
+ QVector<HANDLE> handles;
+ int msg;
+
+ QHash<QString, QWindowsFileSystemWatcherEngine::Handle> handleForDir;
+
+ QHash<HANDLE, QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> > pathInfoForHandle;
+
+Q_SIGNALS:
+ void fileChanged(const QString &path, bool removed);
+ void directoryChanged(const QString &path, bool removed);
};
+
#endif // QT_NO_FILESYSTEMWATCHER
QT_END_NAMESPACE
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index e32b818..3a43ec7 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -44,12 +44,16 @@
#include "qdatetime.h"
#include "qdiriterator.h"
#include "qset.h"
+#include <QtCore/qdebug.h>
#ifndef QT_NO_FSFILEENGINE
#if !defined(Q_OS_WINCE)
#include <errno.h>
#endif
+#if defined(Q_OS_UNIX)
+#include "private/qcore_unix_p.h"
+#endif
#include <stdio.h>
QT_BEGIN_NAMESPACE
@@ -568,7 +572,7 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos)
} else {
// Unbuffered stdio mode.
if (QT_LSEEK(fd, pos, SEEK_SET) == -1) {
- qWarning("QFile::at: Cannot set file position %lld", pos);
+ qWarning() << "QFile::at: Cannot set file position" << pos;
q->setError(QFile::PositionError, qt_error_string(errno));
return false;
}
diff --git a/src/corelib/io/qfsfileengine_iterator_win.cpp b/src/corelib/io/qfsfileengine_iterator_win.cpp
index 2336542..dd4ddf3 100644
--- a/src/corelib/io/qfsfileengine_iterator_win.cpp
+++ b/src/corelib/io/qfsfileengine_iterator_win.cpp
@@ -79,11 +79,7 @@ void QFSFileEngineIteratorPlatformSpecificData::saveCurrentFileName()
it->currentEntry = uncShares.at(uncShareIndex - 1);
} else {
// Local directory
- QT_WA({
- it->currentEntry = QString::fromUtf16((unsigned short *)findData.cFileName);
- } , {
- it->currentEntry = QString::fromLocal8Bit((const char *)findData.cFileName);
- });
+ it->currentEntry = QString::fromWCharArray(findData.cFileName);
}
}
@@ -97,17 +93,10 @@ void QFSFileEngineIterator::advance()
if (platform->uncFallback) {
++platform->uncShareIndex;
} else if (platform->findFileHandle != INVALID_HANDLE_VALUE) {
- QT_WA({
- if (!FindNextFile(platform->findFileHandle, &platform->findData)) {
- platform->done = true;
- FindClose(platform->findFileHandle);
- }
- } , {
- if (!FindNextFileA(platform->findFileHandle, (WIN32_FIND_DATAA *)&platform->findData)) {
- platform->done = true;
- FindClose(platform->findFileHandle);
- }
- });
+ if (!FindNextFile(platform->findFileHandle, &platform->findData)) {
+ platform->done = true;
+ FindClose(platform->findFileHandle);
+ }
}
}
@@ -141,15 +130,8 @@ bool QFSFileEngineIterator::hasNext() const
path.append(QLatin1Char('/'));
path.append(QLatin1String("*.*"));
- QT_WA({
- QString fileName = QFSFileEnginePrivate::longFileName(path);
- platform->findFileHandle = FindFirstFileW((TCHAR *)fileName.utf16(),
- &platform->findData);
- }, {
- // Cast is safe, since char is at end of WIN32_FIND_DATA
- platform->findFileHandle = FindFirstFileA(QFSFileEnginePrivate::win95Name(path),
- (WIN32_FIND_DATAA*)&platform->findData);
- });
+ QString fileName = QFSFileEnginePrivate::longFileName(path);
+ platform->findFileHandle = FindFirstFile((const wchar_t *)fileName.utf16(), &platform->findData);
if (platform->findFileHandle == INVALID_HANDLE_VALUE) {
if (path.startsWith(QLatin1String("//"))) {
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index 5aef229..864599f 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -72,7 +72,6 @@ class QFSFileEnginePrivate : public QAbstractFileEnginePrivate
public:
#ifdef Q_WS_WIN
- static QByteArray win95Name(const QString &path);
static QString longFileName(const QString &path);
#endif
static QString canonicalized(const QString &path);
@@ -151,8 +150,7 @@ public:
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
static void resolveLibs();
- static bool resolveUNCLibs_NT();
- static bool resolveUNCLibs_9x();
+ static bool resolveUNCLibs();
static bool uncListSharesOnServer(const QString &server, QStringList *list);
#endif
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 84394fe..6a0e7ad 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -42,6 +42,7 @@
#include "qplatformdefs.h"
#include "qabstractfileengine.h"
#include "private/qfsfileengine_p.h"
+#include "private/qcore_unix_p.h"
#ifndef QT_NO_FSFILEENGINE
@@ -110,6 +111,12 @@ static QByteArray openModeToFopenMode(QIODevice::OpenMode flags, const QString &
if (flags & QIODevice::ReadOnly)
mode += '+';
}
+
+#if defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0207
+ // must be glibc >= 2.7
+ mode += 'e';
+#endif
+
return mode;
}
@@ -138,12 +145,6 @@ static int openModeToOpenFlags(QIODevice::OpenMode mode)
oflags |= QT_OPEN_TRUNC;
}
-#ifdef O_CLOEXEC
- // supported on Linux >= 2.6.23; avoids one extra system call
- // and avoids a race condition: if another thread forks, we could
- // end up leaking a file descriptor...
- oflags |= O_CLOEXEC;
-#endif
return oflags;
}
@@ -197,11 +198,6 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
}
}
-#ifndef O_CLOEXEC
- // not needed on Linux >= 2.6.23
- setCloseOnExec(fd); // ignore failure
-#endif
-
// Seek to the end when in Append mode.
if (flags & QFile::Append) {
int ret;
@@ -521,7 +517,7 @@ bool QFSFileEngine::caseSensitive() const
bool QFSFileEngine::setCurrentPath(const QString &path)
{
int r;
- r = ::chdir(QFile::encodeName(path));
+ r = QT_CHDIR(QFile::encodeName(path));
return r >= 0;
}
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 3b2bc60..27f4aef 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -109,9 +109,9 @@ static QString qfsPrivateCurrentDir = QLatin1String("");
QT_BEGIN_INCLUDE_NAMESPACE
typedef DWORD (WINAPI *PtrGetNamedSecurityInfoW)(LPWSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*);
static PtrGetNamedSecurityInfoW ptrGetNamedSecurityInfoW = 0;
-typedef DECLSPEC_IMPORT BOOL (WINAPI *PtrLookupAccountSidW)(LPCWSTR, PSID, LPWSTR, LPDWORD, LPWSTR, LPDWORD, PSID_NAME_USE);
+typedef BOOL (WINAPI *PtrLookupAccountSidW)(LPCWSTR, PSID, LPWSTR, LPDWORD, LPWSTR, LPDWORD, PSID_NAME_USE);
static PtrLookupAccountSidW ptrLookupAccountSidW = 0;
-typedef DECLSPEC_IMPORT BOOL (WINAPI *PtrAllocateAndInitializeSid)(PSID_IDENTIFIER_AUTHORITY, BYTE, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, PSID*);
+typedef BOOL (WINAPI *PtrAllocateAndInitializeSid)(PSID_IDENTIFIER_AUTHORITY, BYTE, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, PSID*);
static PtrAllocateAndInitializeSid ptrAllocateAndInitializeSid = 0;
typedef VOID (WINAPI *PtrBuildTrusteeWithSidW)(PTRUSTEE_W, PSID);
static PtrBuildTrusteeWithSidW ptrBuildTrusteeWithSidW = 0;
@@ -119,7 +119,7 @@ typedef VOID (WINAPI *PtrBuildTrusteeWithNameW)(PTRUSTEE_W, unsigned short*);
static PtrBuildTrusteeWithNameW ptrBuildTrusteeWithNameW = 0;
typedef DWORD (WINAPI *PtrGetEffectiveRightsFromAclW)(PACL, PTRUSTEE_W, OUT PACCESS_MASK);
static PtrGetEffectiveRightsFromAclW ptrGetEffectiveRightsFromAclW = 0;
-typedef DECLSPEC_IMPORT PVOID (WINAPI *PtrFreeSid)(PSID);
+typedef PVOID (WINAPI *PtrFreeSid)(PSID);
static PtrFreeSid ptrFreeSid = 0;
static TRUSTEE_W currentUserTrusteeW;
@@ -152,66 +152,64 @@ void QFSFileEnginePrivate::resolveLibs()
triedResolve = true;
#if !defined(Q_OS_WINCE)
- if(QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) {
- HINSTANCE advapiHnd = LoadLibraryW(L"advapi32");
- if (advapiHnd) {
- ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW");
- ptrLookupAccountSidW = (PtrLookupAccountSidW)GetProcAddress(advapiHnd, "LookupAccountSidW");
- ptrAllocateAndInitializeSid = (PtrAllocateAndInitializeSid)GetProcAddress(advapiHnd, "AllocateAndInitializeSid");
- ptrBuildTrusteeWithSidW = (PtrBuildTrusteeWithSidW)GetProcAddress(advapiHnd, "BuildTrusteeWithSidW");
- ptrBuildTrusteeWithNameW = (PtrBuildTrusteeWithNameW)GetProcAddress(advapiHnd, "BuildTrusteeWithNameW");
- ptrGetEffectiveRightsFromAclW = (PtrGetEffectiveRightsFromAclW)GetProcAddress(advapiHnd, "GetEffectiveRightsFromAclW");
- ptrFreeSid = (PtrFreeSid)GetProcAddress(advapiHnd, "FreeSid");
- }
- if (ptrBuildTrusteeWithNameW) {
- HINSTANCE versionHnd = LoadLibraryW(L"version");
- if (versionHnd) {
- typedef DWORD (WINAPI *PtrGetFileVersionInfoSizeW)(LPWSTR lptstrFilename,LPDWORD lpdwHandle);
- PtrGetFileVersionInfoSizeW ptrGetFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)GetProcAddress(versionHnd, "GetFileVersionInfoSizeW");
- typedef BOOL (WINAPI *PtrGetFileVersionInfoW)(LPWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData);
- PtrGetFileVersionInfoW ptrGetFileVersionInfoW = (PtrGetFileVersionInfoW)GetProcAddress(versionHnd, "GetFileVersionInfoW");
- typedef BOOL (WINAPI *PtrVerQueryValueW)(const LPVOID pBlock,LPWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen);
- PtrVerQueryValueW ptrVerQueryValueW = (PtrVerQueryValueW)GetProcAddress(versionHnd, "VerQueryValueW");
- if(ptrGetFileVersionInfoSizeW && ptrGetFileVersionInfoW && ptrVerQueryValueW) {
- DWORD fakeHandle;
- DWORD versionSize = ptrGetFileVersionInfoSizeW(L"secur32.dll", &fakeHandle);
- if(versionSize) {
- LPVOID versionData;
- versionData = malloc(versionSize);
- if(ptrGetFileVersionInfoW(L"secur32.dll", 0, versionSize, versionData)) {
- UINT puLen;
- VS_FIXEDFILEINFO *pLocalInfo;
- if(ptrVerQueryValueW(versionData, L"\\", (void**)&pLocalInfo, &puLen)) {
- WORD wVer1, wVer2, wVer3, wVer4;
- wVer1 = HIWORD(pLocalInfo->dwFileVersionMS);
- wVer2 = LOWORD(pLocalInfo->dwFileVersionMS);
- wVer3 = HIWORD(pLocalInfo->dwFileVersionLS);
- wVer4 = LOWORD(pLocalInfo->dwFileVersionLS);
- // It will not work with secur32.dll version 5.0.2195.2862
- if(!(wVer1 == 5 && wVer2 == 0 && wVer3 == 2195 && (wVer4 == 2862 || wVer4 == 4587))) {
- HINSTANCE userHnd = LoadLibraryW(L"secur32");
- if (userHnd) {
- typedef BOOL (WINAPI *PtrGetUserNameExW)(EXTENDED_NAME_FORMAT nameFormat, ushort* lpBuffer, LPDWORD nSize);
- PtrGetUserNameExW ptrGetUserNameExW = (PtrGetUserNameExW)GetProcAddress(userHnd, "GetUserNameExW");
- if(ptrGetUserNameExW) {
- static TCHAR buffer[258];
- DWORD bufferSize = 257;
- ptrGetUserNameExW(NameSamCompatible, (ushort*)buffer, &bufferSize);
- ptrBuildTrusteeWithNameW(&currentUserTrusteeW, (ushort*)buffer);
- }
- FreeLibrary(userHnd);
+ HINSTANCE advapiHnd = LoadLibraryW(L"advapi32");
+ if (advapiHnd) {
+ ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW");
+ ptrLookupAccountSidW = (PtrLookupAccountSidW)GetProcAddress(advapiHnd, "LookupAccountSidW");
+ ptrAllocateAndInitializeSid = (PtrAllocateAndInitializeSid)GetProcAddress(advapiHnd, "AllocateAndInitializeSid");
+ ptrBuildTrusteeWithSidW = (PtrBuildTrusteeWithSidW)GetProcAddress(advapiHnd, "BuildTrusteeWithSidW");
+ ptrBuildTrusteeWithNameW = (PtrBuildTrusteeWithNameW)GetProcAddress(advapiHnd, "BuildTrusteeWithNameW");
+ ptrGetEffectiveRightsFromAclW = (PtrGetEffectiveRightsFromAclW)GetProcAddress(advapiHnd, "GetEffectiveRightsFromAclW");
+ ptrFreeSid = (PtrFreeSid)GetProcAddress(advapiHnd, "FreeSid");
+ }
+ if (ptrBuildTrusteeWithNameW) {
+ HINSTANCE versionHnd = LoadLibraryW(L"version");
+ if (versionHnd) {
+ typedef DWORD (WINAPI *PtrGetFileVersionInfoSizeW)(LPCWSTR lptstrFilename,LPDWORD lpdwHandle);
+ PtrGetFileVersionInfoSizeW ptrGetFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)GetProcAddress(versionHnd, "GetFileVersionInfoSizeW");
+ typedef BOOL (WINAPI *PtrGetFileVersionInfoW)(LPCWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData);
+ PtrGetFileVersionInfoW ptrGetFileVersionInfoW = (PtrGetFileVersionInfoW)GetProcAddress(versionHnd, "GetFileVersionInfoW");
+ typedef BOOL (WINAPI *PtrVerQueryValueW)(const LPVOID pBlock,LPCWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen);
+ PtrVerQueryValueW ptrVerQueryValueW = (PtrVerQueryValueW)GetProcAddress(versionHnd, "VerQueryValueW");
+ if(ptrGetFileVersionInfoSizeW && ptrGetFileVersionInfoW && ptrVerQueryValueW) {
+ DWORD fakeHandle;
+ DWORD versionSize = ptrGetFileVersionInfoSizeW(L"secur32.dll", &fakeHandle);
+ if(versionSize) {
+ LPVOID versionData;
+ versionData = malloc(versionSize);
+ if(ptrGetFileVersionInfoW(L"secur32.dll", 0, versionSize, versionData)) {
+ UINT puLen;
+ VS_FIXEDFILEINFO *pLocalInfo;
+ if(ptrVerQueryValueW(versionData, L"\\", (void**)&pLocalInfo, &puLen)) {
+ WORD wVer1, wVer2, wVer3, wVer4;
+ wVer1 = HIWORD(pLocalInfo->dwFileVersionMS);
+ wVer2 = LOWORD(pLocalInfo->dwFileVersionMS);
+ wVer3 = HIWORD(pLocalInfo->dwFileVersionLS);
+ wVer4 = LOWORD(pLocalInfo->dwFileVersionLS);
+ // It will not work with secur32.dll version 5.0.2195.2862
+ if(!(wVer1 == 5 && wVer2 == 0 && wVer3 == 2195 && (wVer4 == 2862 || wVer4 == 4587))) {
+ HINSTANCE userHnd = LoadLibraryW(L"secur32");
+ if (userHnd) {
+ typedef BOOL (WINAPI *PtrGetUserNameExW)(EXTENDED_NAME_FORMAT nameFormat, ushort* lpBuffer, LPDWORD nSize);
+ PtrGetUserNameExW ptrGetUserNameExW = (PtrGetUserNameExW)GetProcAddress(userHnd, "GetUserNameExW");
+ if(ptrGetUserNameExW) {
+ static wchar_t buffer[258];
+ DWORD bufferSize = 257;
+ ptrGetUserNameExW(NameSamCompatible, (ushort*)buffer, &bufferSize);
+ ptrBuildTrusteeWithNameW(&currentUserTrusteeW, (ushort*)buffer);
}
+ FreeLibrary(userHnd);
}
}
}
- free(versionData);
}
+ free(versionData);
}
- FreeLibrary(versionHnd);
}
+ FreeLibrary(versionHnd);
}
ptrOpenProcessToken = (PtrOpenProcessToken)GetProcAddress(advapiHnd, "OpenProcessToken");
- HINSTANCE userenvHnd = LoadLibraryW(L"userenv");
+ HINSTANCE userenvHnd = LoadLibraryW(L"userenv");
if (userenvHnd) {
ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW");
}
@@ -225,120 +223,60 @@ void QFSFileEnginePrivate::resolveLibs()
#endif // QT_NO_LIBRARY
// UNC functions NT
-typedef DWORD (WINAPI *PtrNetShareEnum_NT)(LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD);
-static PtrNetShareEnum_NT ptrNetShareEnum_NT = 0;
-typedef DWORD (WINAPI *PtrNetApiBufferFree_NT)(LPVOID);
-static PtrNetApiBufferFree_NT ptrNetApiBufferFree_NT = 0;
-typedef struct _SHARE_INFO_1_NT {
+typedef DWORD (WINAPI *PtrNetShareEnum)(LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD);
+static PtrNetShareEnum ptrNetShareEnum = 0;
+typedef DWORD (WINAPI *PtrNetApiBufferFree)(LPVOID);
+static PtrNetApiBufferFree ptrNetApiBufferFree = 0;
+typedef struct _SHARE_INFO_1 {
LPWSTR shi1_netname;
DWORD shi1_type;
LPWSTR shi1_remark;
-} SHARE_INFO_1_NT;
+} SHARE_INFO_1;
-bool QFSFileEnginePrivate::resolveUNCLibs_NT()
+bool QFSFileEnginePrivate::resolveUNCLibs()
{
static bool triedResolve = false;
if (!triedResolve) {
#ifndef QT_NO_THREAD
QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve));
if (triedResolve) {
- return ptrNetShareEnum_NT && ptrNetApiBufferFree_NT;
+ return ptrNetShareEnum && ptrNetApiBufferFree;
}
#endif
triedResolve = true;
#if !defined(Q_OS_WINCE)
HINSTANCE hLib = LoadLibraryW(L"Netapi32");
if (hLib) {
- ptrNetShareEnum_NT = (PtrNetShareEnum_NT)GetProcAddress(hLib, "NetShareEnum");
- if (ptrNetShareEnum_NT)
- ptrNetApiBufferFree_NT = (PtrNetApiBufferFree_NT)GetProcAddress(hLib, "NetApiBufferFree");
- }
-#endif
- }
- return ptrNetShareEnum_NT && ptrNetApiBufferFree_NT;
-}
-
-// UNC functions 9x
-typedef DWORD (WINAPI *PtrNetShareEnum_9x)(const char FAR *, short, char FAR *, unsigned short, unsigned short FAR *, unsigned short FAR *);
-static PtrNetShareEnum_9x ptrNetShareEnum_9x = 0;
-#ifdef LM20_NNLEN
-# define LM20_NNLEN_9x LM20_NNLEN
-#else
-# define LM20_NNLEN_9x 12
-#endif
-typedef struct _SHARE_INFO_1_9x {
- char shi1_netname[LM20_NNLEN_9x+1];
- char shi1_pad1;
- unsigned short shi1_type;
- char FAR* shi1_remark;
-} SHARE_INFO_1_9x;
-
-bool QFSFileEnginePrivate::resolveUNCLibs_9x()
-{
- static bool triedResolve = false;
- if (!triedResolve) {
-#ifndef QT_NO_THREAD
- QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve));
- if (triedResolve) {
- return ptrNetShareEnum_9x;
+ ptrNetShareEnum = (PtrNetShareEnum)GetProcAddress(hLib, "NetShareEnum");
+ if (ptrNetShareEnum)
+ ptrNetApiBufferFree = (PtrNetApiBufferFree)GetProcAddress(hLib, "NetApiBufferFree");
}
#endif
- triedResolve = true;
-#if !defined(Q_OS_WINCE)
- HINSTANCE hLib = LoadLibraryA("Svrapi");
- if (hLib)
- ptrNetShareEnum_9x = (PtrNetShareEnum_9x)GetProcAddress(hLib, "NetShareEnum");
-#endif
}
- return ptrNetShareEnum_9x;
+ return ptrNetShareEnum && ptrNetApiBufferFree;
}
bool QFSFileEnginePrivate::uncListSharesOnServer(const QString &server, QStringList *list)
{
- if (resolveUNCLibs_NT()) {
- SHARE_INFO_1_NT *BufPtr, *p;
+ if (resolveUNCLibs()) {
+ SHARE_INFO_1 *BufPtr, *p;
DWORD res;
DWORD er=0,tr=0,resume=0, i;
do {
- res = ptrNetShareEnum_NT((wchar_t*)server.utf16(), 1, (LPBYTE *)&BufPtr, DWORD(-1), &er, &tr, &resume);
+ res = ptrNetShareEnum((wchar_t*)server.utf16(), 1, (LPBYTE *)&BufPtr, DWORD(-1), &er, &tr, &resume);
if (res == ERROR_SUCCESS || res == ERROR_MORE_DATA) {
p=BufPtr;
for (i = 1; i <= er; ++i) {
if (list && p->shi1_type == 0)
- list->append(QString::fromUtf16((unsigned short *)p->shi1_netname));
+ list->append(QString::fromWCharArray(p->shi1_netname));
p++;
}
}
- ptrNetApiBufferFree_NT(BufPtr);
+ ptrNetApiBufferFree(BufPtr);
} while (res==ERROR_MORE_DATA);
return res == ERROR_SUCCESS;
- } else if (resolveUNCLibs_9x()) {
- SHARE_INFO_1_9x *pBuf = 0;
- short cbBuffer;
- unsigned short nEntriesRead = 0;
- unsigned short nTotalEntries = 0;
- short numBuffs = 20;
- DWORD nStatus = 0;
- do {
- cbBuffer = numBuffs * sizeof(SHARE_INFO_1_9x);
- pBuf = (SHARE_INFO_1_9x *)malloc(cbBuffer);
- if (pBuf) {
- nStatus = ptrNetShareEnum_9x(server.toLocal8Bit().constData(), 1, (char FAR *)pBuf, cbBuffer, &nEntriesRead, &nTotalEntries);
- if ((nStatus == ERROR_SUCCESS)) {
- for (int i = 0; i < nEntriesRead; ++i) {
- if (list && pBuf[i].shi1_type == 0)
- list->append(QString::fromLocal8Bit(pBuf[i].shi1_netname));
- }
- free(pBuf);
- break;
- }
- free(pBuf);
- numBuffs *=2;
- }
- } while (nStatus == ERROR_MORE_DATA);
- return nStatus == ERROR_SUCCESS;
}
return false;
}
@@ -399,39 +337,19 @@ static bool uncShareExists(const QString &server)
return false;
}
-#if !defined(Q_OS_WINCE)
-// If you change this function, remember to also change the UNICODE version
-static QString nativeAbsoluteFilePathA(const QString &path)
-{
- QString ret;
- QVarLengthArray<char, MAX_PATH> buf(MAX_PATH);
- char *fileName = 0;
- QByteArray ba = path.toLocal8Bit();
- DWORD retLen = GetFullPathNameA(ba.constData(), buf.size(), buf.data(), &fileName);
- if (retLen > (DWORD)buf.size()) {
- buf.resize(retLen);
- retLen = GetFullPathNameA(ba.constData(), buf.size(), buf.data(), &fileName);
- }
- if (retLen != 0)
- ret = QString::fromLocal8Bit(buf.data(), retLen);
- return ret;
-}
-#endif
-
-// If you change this function, remember to also change the NON-UNICODE version
-static QString nativeAbsoluteFilePathW(const QString &path)
+static QString nativeAbsoluteFilePathCore(const QString &path)
{
QString ret;
#if !defined(Q_OS_WINCE)
QVarLengthArray<wchar_t, MAX_PATH> buf(MAX_PATH);
wchar_t *fileName = 0;
- DWORD retLen = GetFullPathNameW((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName);
+ DWORD retLen = GetFullPathName((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName);
if (retLen > (DWORD)buf.size()) {
buf.resize(retLen);
- retLen = GetFullPathNameW((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName);
+ retLen = GetFullPathName((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName);
}
if (retLen != 0)
- ret = QString::fromUtf16((unsigned short *)buf.data(), retLen);
+ ret = QString::fromWCharArray(buf.data(), retLen);
#else
if (path.startsWith(QLatin1Char('/')) || path.startsWith(QLatin1Char('\\')))
ret = QDir::toNativeSeparators(path);
@@ -443,7 +361,7 @@ static QString nativeAbsoluteFilePathW(const QString &path)
static QString nativeAbsoluteFilePath(const QString &path)
{
- QString absPath = QT_WA_INLINE(nativeAbsoluteFilePathW(path), nativeAbsoluteFilePathA(path));
+ QString absPath = nativeAbsoluteFilePathCore(path);
// This is really ugly, but GetFullPathName strips off whitespace at the end.
// If you for instance write ". " in the lineedit of QFileDialog,
// (which is an invalid filename) this function will strip the space off and viola,
@@ -461,26 +379,6 @@ static QString nativeAbsoluteFilePath(const QString &path)
return absPath;
}
-QByteArray QFSFileEnginePrivate::win95Name(const QString &path)
-{
- QString ret(path);
- if(path.length() > 1 && path[0] == QLatin1Char('/') && path[1] == QLatin1Char('/')) {
- // Win95 cannot handle slash-slash needs slosh-slosh.
- ret[0] = QLatin1Char('\\');
- ret[1] = QLatin1Char('\\');
- int n = ret.indexOf(QLatin1Char('/'));
- if(n >= 0)
- ret[n] = QLatin1Char('\\');
- } else if(path.length() > 3 && path[2] == QLatin1Char('/') && path[3] == QLatin1Char('/')) {
- ret[2] = QLatin1Char('\\');
- ret.remove(3, 1);
- int n = ret.indexOf(QLatin1Char('/'));
- if(n >= 0)
- ret[n] = QLatin1Char('\\');
- }
- return ret.toLocal8Bit();
-}
-
/*!
\internal
*/
@@ -507,13 +405,8 @@ QString QFSFileEnginePrivate::longFileName(const QString &path)
*/
void QFSFileEnginePrivate::nativeInitFileName()
{
- QT_WA({
- QString path = longFileName(QDir::toNativeSeparators(fixIfRelativeUncPath(filePath)));
- nativeFilePath = QByteArray((const char *)path.utf16(), path.size() * 2 + 1);
- }, {
- QString path = fixIfRelativeUncPath(filePath);
- nativeFilePath = win95Name(path).replace('/', '\\');
- });
+ QString path = longFileName(QDir::toNativeSeparators(fixIfRelativeUncPath(filePath)));
+ nativeFilePath = QByteArray((const char *)path.utf16(), path.size() * 2 + 1);
}
/*
@@ -539,23 +432,13 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
? OPEN_ALWAYS : OPEN_EXISTING;
// Create the file handle.
- QT_WA({
- fileHandle = CreateFileW((TCHAR *)nativeFilePath.constData(),
- accessRights,
- shareMode,
- &securityAtts,
- creationDisp,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- }, {
- fileHandle = CreateFileA(nativeFilePath.constData(),
- accessRights,
- shareMode,
- &securityAtts,
- creationDisp,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- });
+ fileHandle = CreateFile((const wchar_t*)nativeFilePath.constData(),
+ accessRights,
+ shareMode,
+ &securityAtts,
+ creationDisp,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
// Bail out on error.
if (fileHandle == INVALID_HANDLE_VALUE) {
@@ -641,15 +524,32 @@ qint64 QFSFileEnginePrivate::nativeSize() const
// Not-open mode, where the file name is known: We'll check the
// file system directly.
if (openMode == QIODevice::NotOpen && !nativeFilePath.isEmpty()) {
- bool ok = false;
WIN32_FILE_ATTRIBUTE_DATA attribData;
- QT_WA({
- ok = ::GetFileAttributesExW((TCHAR *)nativeFilePath.constData(),
+ bool ok = ::GetFileAttributesEx((const wchar_t*)nativeFilePath.constData(),
GetFileExInfoStandard, &attribData);
- } , {
- ok = ::GetFileAttributesExA(nativeFilePath.constData(),
- GetFileExInfoStandard, &attribData);
- });
+ if (!ok) {
+ int errorCode = GetLastError();
+ if (errorCode != ERROR_INVALID_NAME
+ && errorCode != ERROR_FILE_NOT_FOUND && errorCode != ERROR_PATH_NOT_FOUND) {
+ QByteArray path = nativeFilePath;
+ // path for the FindFirstFile should not end with a trailing slash
+ while (path.endsWith('\\'))
+ path.chop(1);
+
+ // FindFirstFile can not handle drives
+ if (!path.endsWith(':')) {
+ WIN32_FIND_DATA findData;
+ HANDLE hFind = ::FindFirstFile((const wchar_t*)path.constData(),
+ &findData);
+ if (hFind != INVALID_HANDLE_VALUE) {
+ ::FindClose(hFind);
+ ok = true;
+ attribData.nFileSizeHigh = findData.nFileSizeHigh;
+ attribData.nFileSizeLow = findData.nFileSizeLow;
+ }
+ }
+ }
+ }
if (ok) {
qint64 size = attribData.nFileSizeHigh;
size <<= 32;
@@ -711,28 +611,28 @@ qint64 QFSFileEnginePrivate::nativePos() const
if (fileHandle == INVALID_HANDLE_VALUE)
return 0;
-#if !defined(QT_NO_LIBRARY)
+#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
QFSFileEnginePrivate::resolveLibs();
if (!ptrSetFilePointerEx) {
#endif
- DWORD newFilePointer = SetFilePointer(fileHandle, 0, NULL, FILE_CURRENT);
- if (newFilePointer == 0xFFFFFFFF) {
+ LARGE_INTEGER filepos;
+ filepos.HighPart = 0;
+ DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT);
+ if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
thatQ->setError(QFile::UnspecifiedError, qt_error_string());
return 0;
}
- // Note: returns <4GB; does not work with large files. This is the
- // case for MOC, UIC, qmake and other bootstrapped tools, and for
- // Win9x/ME.
- return qint64(newFilePointer);
-#if !defined(QT_NO_LIBRARY)
+ // Note: This is the case for MOC, UIC, qmake and other
+ // bootstrapped tools, and for Windows CE.
+ filepos.LowPart = newFilePointer;
+ return filepos.QuadPart;
+#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
}
- // This approach supports large files.
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
- offset.LowPart = 0;
- offset.HighPart = 0;
+ offset.QuadPart = 0;
if (!ptrSetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_CURRENT)) {
thatQ->setError(QFile::UnspecifiedError, qt_error_string());
return 0;
@@ -755,28 +655,27 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos)
return seekFdFh(pos);
}
-#if !defined(QT_NO_LIBRARY)
+#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
QFSFileEnginePrivate::resolveLibs();
if (!ptrSetFilePointerEx) {
#endif
- LONG seekToPos = LONG(pos); // <- lossy
- DWORD newFilePointer = SetFilePointer(fileHandle, seekToPos, NULL, FILE_BEGIN);
- if (newFilePointer == 0xFFFFFFFF) {
- thatQ->setError(QFile::UnspecifiedError, qt_error_string());
+ DWORD newFilePointer;
+ LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos);
+ newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN);
+ if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+ thatQ->setError(QFile::PositionError, qt_error_string());
return false;
}
- // Note: does not work with large files. This is the case for MOC,
- // UIC, qmake and other bootstrapped tools, and for Win9x/ME.
+ // Note: This is the case for MOC, UIC, qmake and other
+ // bootstrapped tools, and for Windows CE.
return true;
-#if !defined(QT_NO_LIBRARY)
+#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
}
- // This approach supports large files.
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
- offset.LowPart = (unsigned int)(quint64(pos) & Q_UINT64_C(0xffffffff));
- offset.HighPart = (unsigned int)((quint64(pos) >> 32) & Q_UINT64_C(0xffffffff));
+ offset.QuadPart = pos;
if (ptrSetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_BEGIN) == 0) {
thatQ->setError(QFile::UnspecifiedError, qt_error_string());
return false;
@@ -949,35 +848,21 @@ bool QFSFileEnginePrivate::nativeIsSequential() const
bool QFSFileEngine::remove()
{
Q_D(QFSFileEngine);
- QT_WA({
- return ::DeleteFileW((TCHAR*)QFSFileEnginePrivate::longFileName(d->filePath).utf16()) != 0;
- } , {
- return ::DeleteFileA(QFSFileEnginePrivate::win95Name(d->filePath)) != 0;
- });
+ return ::DeleteFile((wchar_t*)QFSFileEnginePrivate::longFileName(d->filePath).utf16()) != 0;
}
bool QFSFileEngine::copy(const QString &copyName)
{
Q_D(QFSFileEngine);
- QT_WA({
- return ::CopyFileW((TCHAR*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(),
- (TCHAR*)QFSFileEnginePrivate::longFileName(copyName).utf16(), true) != 0;
- } , {
- return ::CopyFileA(QFSFileEnginePrivate::win95Name(d->filePath),
- QFSFileEnginePrivate::win95Name(copyName), true) != 0;
- });
+ return ::CopyFile((wchar_t*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(),
+ (wchar_t*)QFSFileEnginePrivate::longFileName(copyName).utf16(), true) != 0;
}
bool QFSFileEngine::rename(const QString &newName)
{
Q_D(QFSFileEngine);
- QT_WA({
- return ::MoveFileW((TCHAR*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(),
- (TCHAR*)QFSFileEnginePrivate::longFileName(newName).utf16()) != 0;
- } , {
- return ::MoveFileA(QFSFileEnginePrivate::win95Name(d->filePath),
- QFSFileEnginePrivate::win95Name(newName)) != 0;
- });
+ return ::MoveFile((wchar_t*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(),
+ (wchar_t*)QFSFileEnginePrivate::longFileName(newName).utf16()) != 0;
}
static inline bool mkDir(const QString &path)
@@ -1001,20 +886,12 @@ static inline bool mkDir(const QString &path)
if (platformId == 1 && QFSFileEnginePrivate::longFileName(path).size() > 256)
return false;
#endif
- QT_WA({
- return ::CreateDirectoryW((TCHAR*)QFSFileEnginePrivate::longFileName(path).utf16(), 0);
- } , {
- return ::CreateDirectoryA(QFSFileEnginePrivate::win95Name(QFileInfo(path).absoluteFilePath()), 0);
- });
+ return ::CreateDirectory((wchar_t*)QFSFileEnginePrivate::longFileName(path).utf16(), 0);
}
static inline bool rmDir(const QString &path)
{
- QT_WA({
- return ::RemoveDirectoryW((TCHAR*)QFSFileEnginePrivate::longFileName(path).utf16());
- } , {
- return ::RemoveDirectoryA(QFSFileEnginePrivate::win95Name(QFileInfo(path).absoluteFilePath()));
- });
+ return ::RemoveDirectory((wchar_t*)QFSFileEnginePrivate::longFileName(path).utf16());
}
static inline bool isDirPath(const QString &dirPath, bool *existed)
@@ -1023,12 +900,27 @@ static inline bool isDirPath(const QString &dirPath, bool *existed)
if (path.length() == 2 &&path.at(1) == QLatin1Char(':'))
path += QLatin1Char('\\');
- DWORD fileAttrib = INVALID_FILE_ATTRIBUTES;
- QT_WA({
- fileAttrib = ::GetFileAttributesW((TCHAR*)QFSFileEnginePrivate::longFileName(path).utf16());
- } , {
- fileAttrib = ::GetFileAttributesA(QFSFileEnginePrivate::win95Name(QFileInfo(path).absoluteFilePath()));
- });
+ DWORD fileAttrib = ::GetFileAttributes((wchar_t*)QFSFileEnginePrivate::longFileName(path).utf16());
+ if (fileAttrib == INVALID_FILE_ATTRIBUTES) {
+ int errorCode = GetLastError();
+ if (errorCode != ERROR_INVALID_NAME
+ && errorCode != ERROR_FILE_NOT_FOUND && errorCode != ERROR_PATH_NOT_FOUND) {
+ // path for the FindFirstFile should not end with a trailing slash
+ while (path.endsWith(QLatin1Char('\\')))
+ path.chop(1);
+
+ // FindFirstFile can not handle drives
+ if (!path.endsWith(QLatin1Char(':'))) {
+ WIN32_FIND_DATA findData;
+ HANDLE hFind = ::FindFirstFile((wchar_t*)QFSFileEnginePrivate::longFileName(path).utf16(),
+ &findData);
+ if (hFind != INVALID_HANDLE_VALUE) {
+ ::FindClose(hFind);
+ fileAttrib = findData.dwFileAttributes;
+ }
+ }
+ }
+ }
if (existed)
*existed = fileAttrib != INVALID_FILE_ATTRIBUTES;
@@ -1110,16 +1002,10 @@ bool QFSFileEngine::setCurrentPath(const QString &path)
return false;
#if !defined(Q_OS_WINCE)
- int r;
- QT_WA({
- r = ::SetCurrentDirectoryW((WCHAR*)path.utf16());
- } , {
- r = ::SetCurrentDirectoryA(QFSFileEnginePrivate::win95Name(path));
- });
- return r != 0;
+ return ::SetCurrentDirectory((wchar_t*)path.utf16()) != 0;
#else
- qfsPrivateCurrentDir = QFSFileEnginePrivate::longFileName(path);
- return true;
+ qfsPrivateCurrentDir = QFSFileEnginePrivate::longFileName(path);
+ return true;
#endif
}
@@ -1132,48 +1018,34 @@ QString QFSFileEngine::currentPath(const QString &fileName)
fileName.at(0).isLetter() && fileName.at(1) == QLatin1Char(':')) {
int drv = fileName.toUpper().at(0).toLatin1() - 'A' + 1;
if (_getdrive() != drv) {
- QT_WA({
- TCHAR buf[PATH_MAX];
- ::_wgetdcwd(drv, buf, PATH_MAX);
- ret.setUtf16((ushort*)buf, uint(::wcslen(buf)));
- }, {
- char buf[PATH_MAX];
- ::_getdcwd(drv, buf, PATH_MAX);
- ret = QString::fromLatin1(buf);
- });
+ wchar_t buf[PATH_MAX];
+ ::_wgetdcwd(drv, buf, PATH_MAX);
+ ret = QString::fromWCharArray(buf);
}
}
if (ret.isEmpty()) {
//just the pwd
- QT_WA({
- DWORD size = 0;
- WCHAR currentName[PATH_MAX];
- size = ::GetCurrentDirectoryW(PATH_MAX, currentName);
- if (size !=0) {
- if (size > PATH_MAX) {
- WCHAR * newCurrentName = new WCHAR[size];
- if (::GetCurrentDirectoryW(PATH_MAX, newCurrentName) != 0)
- ret = QString::fromUtf16((ushort*)newCurrentName);
- delete [] newCurrentName;
- } else {
- ret = QString::fromUtf16((ushort*)currentName);
- }
+ DWORD size = 0;
+ wchar_t currentName[PATH_MAX];
+ size = ::GetCurrentDirectory(PATH_MAX, currentName);
+ if (size != 0) {
+ if (size > PATH_MAX) {
+ wchar_t *newCurrentName = new wchar_t[size];
+ if (::GetCurrentDirectory(PATH_MAX, newCurrentName) != 0)
+ ret = QString::fromWCharArray(newCurrentName);
+ delete [] newCurrentName;
+ } else {
+ ret = QString::fromWCharArray(currentName);
}
- } , {
- DWORD size = 0;
- char currentName[PATH_MAX];
- size = ::GetCurrentDirectoryA(PATH_MAX, currentName);
- if (size !=0)
- ret = QString::fromLocal8Bit(currentName);
- });
+ }
}
if (ret.length() >= 2 && ret[1] == QLatin1Char(':'))
ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters.
return QDir::fromNativeSeparators(ret);
#else
- Q_UNUSED(fileName);
- if (qfsPrivateCurrentDir.isEmpty())
- qfsPrivateCurrentDir = QCoreApplication::applicationDirPath();
+ Q_UNUSED(fileName);
+ if (qfsPrivateCurrentDir.isEmpty())
+ qfsPrivateCurrentDir = QCoreApplication::applicationDirPath();
return QDir::fromNativeSeparators(qfsPrivateCurrentDir);
#endif
@@ -1183,35 +1055,27 @@ QString QFSFileEngine::homePath()
{
QString ret;
#if !defined(QT_NO_LIBRARY)
- QT_WA (
- {
- QFSFileEnginePrivate::resolveLibs();
- if (ptrOpenProcessToken && ptrGetUserProfileDirectoryW) {
- HANDLE hnd = ::GetCurrentProcess();
- HANDLE token = 0;
- BOOL ok = ::ptrOpenProcessToken(hnd, TOKEN_QUERY, &token);
- if (ok) {
- DWORD dwBufferSize = 0;
- // First call, to determine size of the strings (with '\0').
- ok = ::ptrGetUserProfileDirectoryW(token, NULL, &dwBufferSize);
- if (!ok && dwBufferSize != 0) { // We got the required buffer size
- wchar_t *userDirectory = new wchar_t[dwBufferSize];
- // Second call, now we can fill the allocated buffer.
- ok = ::ptrGetUserProfileDirectoryW(token, userDirectory, &dwBufferSize);
- if (ok)
- ret = QString::fromUtf16((ushort*)userDirectory);
-
- delete [] userDirectory;
- }
- ::CloseHandle(token);
- }
- }
- }
- ,
- {
- // GetUserProfileDirectory is only available from NT 4.0,
- // so fall through for Win98 and friends version.
- })
+ QFSFileEnginePrivate::resolveLibs();
+ if (ptrOpenProcessToken && ptrGetUserProfileDirectoryW) {
+ HANDLE hnd = ::GetCurrentProcess();
+ HANDLE token = 0;
+ BOOL ok = ::ptrOpenProcessToken(hnd, TOKEN_QUERY, &token);
+ if (ok) {
+ DWORD dwBufferSize = 0;
+ // First call, to determine size of the strings (with '\0').
+ ok = ::ptrGetUserProfileDirectoryW(token, NULL, &dwBufferSize);
+ if (!ok && dwBufferSize != 0) { // We got the required buffer size
+ wchar_t *userDirectory = new wchar_t[dwBufferSize];
+ // Second call, now we can fill the allocated buffer.
+ ok = ::ptrGetUserProfileDirectoryW(token, userDirectory, &dwBufferSize);
+ if (ok)
+ ret = QString::fromWCharArray(userDirectory);
+
+ delete [] userDirectory;
+ }
+ ::CloseHandle(token);
+ }
+ }
#endif
if(ret.isEmpty() || !QFile::exists(ret)) {
ret = QString::fromLocal8Bit(qgetenv("USERPROFILE").constData());
@@ -1251,17 +1115,10 @@ QString QFSFileEngine::rootPath()
QString QFSFileEngine::tempPath()
{
- QString ret;
- int success;
- QT_WA({
- wchar_t tempPath[MAX_PATH];
- success = GetTempPathW(MAX_PATH, tempPath);
- ret = QString::fromUtf16((ushort*)tempPath);
- } , {
- char tempPath[MAX_PATH];
- success = GetTempPathA(MAX_PATH, tempPath);
- ret = QString::fromLocal8Bit(tempPath);
- });
+ wchar_t tempPath[MAX_PATH];
+ int success = GetTempPath(MAX_PATH, tempPath);
+ QString ret = QString::fromWCharArray(tempPath);
+
if (ret.isEmpty() || !success) {
#if !defined(Q_OS_WINCE)
ret = QString::fromLatin1("c:/tmp");
@@ -1285,7 +1142,7 @@ QFileInfoList QFSFileEngine::drives()
#elif defined(Q_OS_OS2EMX)
quint32 driveBits, cur;
if(DosQueryCurrentDisk(&cur,&driveBits) != NO_ERROR)
- exit(1);
+ exit(1);
driveBits &= 0x3ffffff;
#endif
char driveName[] = "A:/";
@@ -1327,18 +1184,35 @@ bool QFSFileEnginePrivate::doStat() const
}
}
#else
- DWORD tmpAttributes = GetFileAttributesW((TCHAR*)QFSFileEnginePrivate::longFileName(fname).utf16());
+ DWORD tmpAttributes = GetFileAttributes((wchar_t*)QFSFileEnginePrivate::longFileName(fname).utf16());
if (tmpAttributes != -1) {
fileAttrib = tmpAttributes;
could_stat = true;
}
#endif
} else {
- QT_WA({
- fileAttrib = GetFileAttributesW((TCHAR*)QFSFileEnginePrivate::longFileName(fname).utf16());
- } , {
- fileAttrib = GetFileAttributesA(QFSFileEnginePrivate::win95Name(QFileInfo(fname).absoluteFilePath()));
- });
+ fileAttrib = GetFileAttributes((wchar_t*)QFSFileEnginePrivate::longFileName(fname).utf16());
+ if (fileAttrib == INVALID_FILE_ATTRIBUTES) {
+ int errorCode = GetLastError();
+ if (errorCode != ERROR_INVALID_NAME
+ && errorCode != ERROR_FILE_NOT_FOUND && errorCode != ERROR_PATH_NOT_FOUND) {
+ QString path = QDir::toNativeSeparators(fname);
+ // path for the FindFirstFile should not end with a trailing slash
+ while (path.endsWith(QLatin1Char('\\')))
+ path.chop(1);
+
+ // FindFirstFile can not handle drives
+ if (!path.endsWith(QLatin1Char(':'))) {
+ WIN32_FIND_DATA findData;
+ HANDLE hFind = ::FindFirstFile((wchar_t*)QFSFileEnginePrivate::longFileName(path).utf16(),
+ &findData);
+ if (hFind != INVALID_HANDLE_VALUE) {
+ ::FindClose(hFind);
+ fileAttrib = findData.dwFileAttributes;
+ }
+ }
+ }
+ }
could_stat = fileAttrib != INVALID_FILE_ATTRIBUTES;
if (!could_stat) {
#if !defined(Q_OS_WINCE)
@@ -1398,74 +1272,39 @@ static QString readLink(const QString &link)
#if !defined(Q_OS_WINCE)
#if !defined(QT_NO_LIBRARY) && !defined(Q_CC_MWERKS)
QString ret;
- QT_WA({
- bool neededCoInit = false;
- IShellLink *psl; // pointer to IShellLink i/f
- HRESULT hres;
- WIN32_FIND_DATA wfd;
- TCHAR szGotPath[MAX_PATH];
- // Get pointer to the IShellLink interface.
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
- IID_IShellLink, (LPVOID *)&psl);
- if(hres == CO_E_NOTINITIALIZED) { // COM was not initialized
- neededCoInit = true;
- CoInitialize(NULL);
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
- IID_IShellLink, (LPVOID *)&psl);
- }
- if(SUCCEEDED(hres)) { // Get pointer to the IPersistFile interface.
- IPersistFile *ppf;
- hres = psl->QueryInterface(IID_IPersistFile, (LPVOID *)&ppf);
- if(SUCCEEDED(hres)) {
- hres = ppf->Load((LPOLESTR)link.utf16(), STGM_READ);
- //The original path of the link is retrieved. If the file/folder
- //was moved, the return value still have the old path.
- if(SUCCEEDED(hres)) {
- if (psl->GetPath(szGotPath, MAX_PATH, &wfd, SLGP_UNCPRIORITY) == NOERROR)
- ret = QString::fromUtf16((ushort*)szGotPath);
- }
- ppf->Release();
- }
- psl->Release();
- }
- if(neededCoInit)
- CoUninitialize();
- } , {
- bool neededCoInit = false;
- IShellLinkA *psl; // pointer to IShellLink i/f
- HRESULT hres;
- WIN32_FIND_DATAA wfd;
- char szGotPath[MAX_PATH];
- // Get pointer to the IShellLink interface.
+ bool neededCoInit = false;
+ IShellLink *psl; // pointer to IShellLink i/f
+ WIN32_FIND_DATA wfd;
+ wchar_t szGotPath[MAX_PATH];
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
- IID_IShellLinkA, (LPVOID *)&psl);
+ // Get pointer to the IShellLink interface.
+ HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *)&psl);
- if(hres == CO_E_NOTINITIALIZED) { // COM was not initialized
- neededCoInit = true;
- CoInitialize(NULL);
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
- IID_IShellLinkA, (LPVOID *)&psl);
- }
- if(SUCCEEDED(hres)) { // Get pointer to the IPersistFile interface.
- IPersistFile *ppf;
- hres = psl->QueryInterface(IID_IPersistFile, (LPVOID *)&ppf);
- if(SUCCEEDED(hres)) {
- hres = ppf->Load((LPOLESTR)QFileInfo(link).absoluteFilePath().utf16(), STGM_READ);
- //The original path of the link is retrieved. If the file/folder
- //was moved, the return value still have the old path.
- if(SUCCEEDED(hres)) {
- if (psl->GetPath((char*)szGotPath, MAX_PATH, &wfd, SLGP_UNCPRIORITY) == NOERROR)
- ret = QString::fromLocal8Bit(szGotPath);
- }
- ppf->Release();
+ if (hres == CO_E_NOTINITIALIZED) { // COM was not initialized
+ neededCoInit = true;
+ CoInitialize(NULL);
+ hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
+ IID_IShellLink, (LPVOID *)&psl);
+ }
+ if (SUCCEEDED(hres)) { // Get pointer to the IPersistFile interface.
+ IPersistFile *ppf;
+ hres = psl->QueryInterface(IID_IPersistFile, (LPVOID *)&ppf);
+ if(SUCCEEDED(hres)) {
+ hres = ppf->Load((LPOLESTR)link.utf16(), STGM_READ);
+ //The original path of the link is retrieved. If the file/folder
+ //was moved, the return value still have the old path.
+ if(SUCCEEDED(hres)) {
+ if (psl->GetPath(szGotPath, MAX_PATH, &wfd, SLGP_UNCPRIORITY) == NOERROR)
+ ret = QString::fromWCharArray(szGotPath);
}
- psl->Release();
+ ppf->Release();
}
- if(neededCoInit)
- CoUninitialize();
- });
+ psl->Release();
+ }
+ if (neededCoInit)
+ CoUninitialize();
+
return ret;
#else
Q_UNUSED(link);
@@ -1475,7 +1314,7 @@ static QString readLink(const QString &link)
wchar_t target[MAX_PATH];
QString result;
if (SHGetShortcutTarget((wchar_t*)QFileInfo(link).absoluteFilePath().replace(QLatin1Char('/'),QLatin1Char('\\')).utf16(), target, MAX_PATH)) {
- result = QString::fromUtf16(reinterpret_cast<const ushort *> (target));
+ result = QString::fromWCharArray(target);
if (result.startsWith(QLatin1Char('"')))
result.remove(0,1);
if (result.endsWith(QLatin1Char('"')))
@@ -1502,76 +1341,37 @@ bool QFSFileEngine::link(const QString &newName)
QString linkName = newName;
//### assume that they add .lnk
- QT_WA({
- HRESULT hres;
- IShellLink *psl;
- bool neededCoInit = false;
+ IShellLink *psl;
+ bool neededCoInit = false;
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
- if(hres == CO_E_NOTINITIALIZED) { // COM was not initialized
- neededCoInit = true;
- CoInitialize(NULL);
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
- }
- if (SUCCEEDED(hres)) {
- hres = psl->SetPath((wchar_t *)fileName(AbsoluteName).replace(QLatin1Char('/'), QLatin1Char('\\')).utf16());
- if (SUCCEEDED(hres)) {
- hres = psl->SetWorkingDirectory((wchar_t *)fileName(AbsolutePathName).replace(QLatin1Char('/'), QLatin1Char('\\')).utf16());
- if (SUCCEEDED(hres)) {
- IPersistFile *ppf;
- hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
- if (SUCCEEDED(hres)) {
- hres = ppf->Save((TCHAR*)linkName.utf16(), TRUE);
- if (SUCCEEDED(hres))
- ret = true;
- ppf->Release();
- }
- }
- }
- psl->Release();
- }
- if(neededCoInit)
- CoUninitialize();
- } , {
- // the SetPath() call _sometimes_ changes the current path and when it does it sometimes
- // does not let us change it back unless we call currentPath() many times.
- QString cwd = currentPath();
- HRESULT hres;
- IShellLinkA *psl;
- bool neededCoInit = false;
+ HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
+ if (hres == CO_E_NOTINITIALIZED) { // COM was not initialized
+ neededCoInit = true;
+ CoInitialize(NULL);
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
- if(hres == CO_E_NOTINITIALIZED) { // COM was not initialized
- neededCoInit = true;
- CoInitialize(NULL);
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
- }
+ }
+
+ if (SUCCEEDED(hres)) {
+ hres = psl->SetPath((wchar_t *)fileName(AbsoluteName).replace(QLatin1Char('/'), QLatin1Char('\\')).utf16());
if (SUCCEEDED(hres)) {
- currentPath();
- hres = psl->SetPath((char *)QString::fromLocal8Bit(QFSFileEnginePrivate::win95Name(fileName(AbsoluteName))).utf16());
- currentPath();
+ hres = psl->SetWorkingDirectory((wchar_t *)fileName(AbsolutePathName).replace(QLatin1Char('/'), QLatin1Char('\\')).utf16());
if (SUCCEEDED(hres)) {
- hres = psl->SetWorkingDirectory((char *)QString::fromLocal8Bit(QFSFileEnginePrivate::win95Name(fileName(AbsolutePathName))).utf16());
- currentPath();
+ IPersistFile *ppf;
+ hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
if (SUCCEEDED(hres)) {
- IPersistFile *ppf;
- hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
- if (SUCCEEDED(hres)) {
- currentPath();
- hres = ppf->Save((LPCOLESTR)linkName.utf16(), TRUE);
- currentPath();
- if (SUCCEEDED(hres))
- ret = true;
- ppf->Release();
- }
+ hres = ppf->Save((wchar_t*)linkName.utf16(), TRUE);
+ if (SUCCEEDED(hres))
+ ret = true;
+ ppf->Release();
}
- psl->Release();
}
}
- if(neededCoInit)
+ psl->Release();
+ }
+ if(neededCoInit)
CoUninitialize();
- setCurrentPath(cwd);
- });
+
return ret;
#else
Q_UNUSED(newName);
@@ -1598,9 +1398,9 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const
#if !defined(QT_NO_LIBRARY)
if((qt_ntfs_permission_lookup > 0) && ((QSysInfo::WindowsVersion&QSysInfo::WV_NT_based) > QSysInfo::WV_NT)) {
- PSID pOwner = 0;
- PSID pGroup = 0;
- PACL pDacl;
+ PSID pOwner = 0;
+ PSID pGroup = 0;
+ PACL pDacl;
PSECURITY_DESCRIPTOR pSD;
ACCESS_MASK access_mask;
@@ -1610,42 +1410,42 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const
QString fname = filePath.endsWith(QLatin1String(".lnk")) ? readLink(filePath) : filePath;
DWORD res = ptrGetNamedSecurityInfoW((wchar_t*)fname.utf16(), SE_FILE_OBJECT,
- OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
- &pOwner, &pGroup, &pDacl, 0, &pSD);
+ OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
+ &pOwner, &pGroup, &pDacl, 0, &pSD);
if(res == ERROR_SUCCESS) {
TRUSTEE_W trustee;
{ //user
if(ptrGetEffectiveRightsFromAclW(pDacl, &currentUserTrusteeW, &access_mask) != ERROR_SUCCESS)
access_mask = (ACCESS_MASK)-1;
- if(access_mask & ReadMask)
- ret |= QAbstractFileEngine::ReadUserPerm;
- if(access_mask & WriteMask)
- ret |= QAbstractFileEngine::WriteUserPerm;
- if(access_mask & ExecMask)
- ret |= QAbstractFileEngine::ExeUserPerm;
+ if(access_mask & ReadMask)
+ ret |= QAbstractFileEngine::ReadUserPerm;
+ if(access_mask & WriteMask)
+ ret |= QAbstractFileEngine::WriteUserPerm;
+ if(access_mask & ExecMask)
+ ret |= QAbstractFileEngine::ExeUserPerm;
}
{ //owner
ptrBuildTrusteeWithSidW(&trustee, pOwner);
if(ptrGetEffectiveRightsFromAclW(pDacl, &trustee, &access_mask) != ERROR_SUCCESS)
access_mask = (ACCESS_MASK)-1;
- if(access_mask & ReadMask)
- ret |= QAbstractFileEngine::ReadOwnerPerm;
- if(access_mask & WriteMask)
- ret |= QAbstractFileEngine::WriteOwnerPerm;
- if(access_mask & ExecMask)
- ret |= QAbstractFileEngine::ExeOwnerPerm;
+ if(access_mask & ReadMask)
+ ret |= QAbstractFileEngine::ReadOwnerPerm;
+ if(access_mask & WriteMask)
+ ret |= QAbstractFileEngine::WriteOwnerPerm;
+ if(access_mask & ExecMask)
+ ret |= QAbstractFileEngine::ExeOwnerPerm;
}
{ //group
ptrBuildTrusteeWithSidW(&trustee, pGroup);
if(ptrGetEffectiveRightsFromAclW(pDacl, &trustee, &access_mask) != ERROR_SUCCESS)
access_mask = (ACCESS_MASK)-1;
- if(access_mask & ReadMask)
- ret |= QAbstractFileEngine::ReadGroupPerm;
- if(access_mask & WriteMask)
- ret |= QAbstractFileEngine::WriteGroupPerm;
- if(access_mask & ExecMask)
- ret |= QAbstractFileEngine::ExeGroupPerm;
+ if(access_mask & ReadMask)
+ ret |= QAbstractFileEngine::ReadGroupPerm;
+ if(access_mask & WriteMask)
+ ret |= QAbstractFileEngine::WriteGroupPerm;
+ if(access_mask & ExecMask)
+ ret |= QAbstractFileEngine::ExeGroupPerm;
}
{ //other (world)
// Create SID for Everyone (World)
@@ -1655,12 +1455,12 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const
ptrBuildTrusteeWithSidW(&trustee, pWorld);
if(ptrGetEffectiveRightsFromAclW(pDacl, &trustee, &access_mask) != ERROR_SUCCESS)
access_mask = (ACCESS_MASK)-1; // ###
- if(access_mask & ReadMask)
- ret |= QAbstractFileEngine::ReadOtherPerm;
- if(access_mask & WriteMask)
- ret |= QAbstractFileEngine::WriteOtherPerm;
- if(access_mask & ExecMask)
- ret |= QAbstractFileEngine::ExeOtherPerm;
+ if(access_mask & ReadMask)
+ ret |= QAbstractFileEngine::ReadOtherPerm;
+ if(access_mask & WriteMask)
+ ret |= QAbstractFileEngine::WriteOtherPerm;
+ if(access_mask & ExecMask)
+ ret |= QAbstractFileEngine::ExeOtherPerm;
}
ptrFreeSid(pWorld);
}
@@ -1670,13 +1470,13 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const
} else
#endif
{
- //### what to do with permissions if we don't use ntfs or are not on a NT system
- // for now just add all permissions and what about exe missions ??
- // also qt_ntfs_permission_lookup is now not set by defualt ... should it ?
- ret |= QAbstractFileEngine::ReadOtherPerm | QAbstractFileEngine::ReadGroupPerm
- | QAbstractFileEngine::ReadOwnerPerm | QAbstractFileEngine::ReadUserPerm
- | QAbstractFileEngine::WriteUserPerm | QAbstractFileEngine::WriteOwnerPerm
- | QAbstractFileEngine::WriteGroupPerm | QAbstractFileEngine::WriteOtherPerm;
+ //### what to do with permissions if we don't use NTFS
+ // for now just add all permissions and what about exe missions ??
+ // also qt_ntfs_permission_lookup is now not set by defualt ... should it ?
+ ret |= QAbstractFileEngine::ReadOtherPerm | QAbstractFileEngine::ReadGroupPerm
+ | QAbstractFileEngine::ReadOwnerPerm | QAbstractFileEngine::ReadUserPerm
+ | QAbstractFileEngine::WriteUserPerm | QAbstractFileEngine::WriteOwnerPerm
+ | QAbstractFileEngine::WriteGroupPerm | QAbstractFileEngine::WriteOtherPerm;
}
if (doStat()) {
@@ -1783,8 +1583,8 @@ QString QFSFileEngine::fileName(FileName file) const
if (!isRelativePath()) {
#if !defined(Q_OS_WINCE)
- if (d->filePath.size() > 2 && d->filePath.at(1) == QLatin1Char(':')
- && d->filePath.at(2) != QLatin1Char('/') || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt
+ if ((d->filePath.size() > 2 && d->filePath.at(1) == QLatin1Char(':')
+ && d->filePath.at(2) != QLatin1Char('/')) || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt
d->filePath.startsWith(QLatin1Char('/')) // It's a absolute path to the current drive, so \a.txt -> Z:\a.txt
) {
ret = QDir::fromNativeSeparators(nativeAbsoluteFilePath(d->filePath));
@@ -1911,13 +1711,9 @@ bool QFSFileEngine::setPermissions(uint perms)
return false;
#if !defined(Q_OS_WINCE)
- QT_WA({
- ret = ::_wchmod((TCHAR*)d->filePath.utf16(), mode) == 0;
- } , {
- ret = ::_chmod(d->filePath.toLocal8Bit(), mode) == 0;
- });
+ ret = ::_wchmod((wchar_t*)d->filePath.utf16(), mode) == 0;
#else
- ret = ::_wchmod((TCHAR*)d->longFileName(d->filePath).utf16(), mode);
+ ret = ::_wchmod((wchar_t*)d->longFileName(d->filePath).utf16(), mode);
#endif
return ret;
}
@@ -1960,34 +1756,33 @@ bool QFSFileEngine::setSize(qint64 size)
static inline QDateTime fileTimeToQDateTime(const FILETIME *time)
{
QDateTime ret;
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based || QSysInfo::WindowsVersion & QSysInfo::WV_CE_based) {
- // SystemTimeToTzSpecificLocalTime is not available on Win98/ME so we have to pull it off ourselves.
- SYSTEMTIME systime;
- FILETIME ftime;
- systime.wYear = 1970;
- systime.wMonth = 1;
- systime.wDay = 1;
- systime.wHour = 0;
- systime.wMinute = 0;
- systime.wSecond = 0;
- systime.wMilliseconds = 0;
- systime.wDayOfWeek = 4;
- SystemTimeToFileTime(&systime, &ftime);
- unsigned __int64 acttime = (unsigned __int64)time->dwHighDateTime << 32 | time->dwLowDateTime;
- FileTimeToSystemTime(time, &systime);
- unsigned __int64 time1970 = (unsigned __int64)ftime.dwHighDateTime << 32 | ftime.dwLowDateTime;
- unsigned __int64 difftime = acttime - time1970;
- difftime /= 10000000;
- ret.setTime_t((unsigned int)difftime);
- } else {
-#ifndef Q_OS_WINCE
- SYSTEMTIME sTime, lTime;
- FileTimeToSystemTime(time, &sTime);
- SystemTimeToTzSpecificLocalTime(0, &sTime, &lTime);
- ret.setDate(QDate(lTime.wYear, lTime.wMonth, lTime.wDay));
- ret.setTime(QTime(lTime.wHour, lTime.wMinute, lTime.wSecond, lTime.wMilliseconds));
+
+#if defined(Q_OS_WINCE)
+ SYSTEMTIME systime;
+ FILETIME ftime;
+ systime.wYear = 1970;
+ systime.wMonth = 1;
+ systime.wDay = 1;
+ systime.wHour = 0;
+ systime.wMinute = 0;
+ systime.wSecond = 0;
+ systime.wMilliseconds = 0;
+ systime.wDayOfWeek = 4;
+ SystemTimeToFileTime(&systime, &ftime);
+ unsigned __int64 acttime = (unsigned __int64)time->dwHighDateTime << 32 | time->dwLowDateTime;
+ FileTimeToSystemTime(time, &systime);
+ unsigned __int64 time1970 = (unsigned __int64)ftime.dwHighDateTime << 32 | ftime.dwLowDateTime;
+ unsigned __int64 difftime = acttime - time1970;
+ difftime /= 10000000;
+ ret.setTime_t((unsigned int)difftime);
+#else
+ SYSTEMTIME sTime, lTime;
+ FileTimeToSystemTime(time, &sTime);
+ SystemTimeToTzSpecificLocalTime(0, &sTime, &lTime);
+ ret.setDate(QDate(lTime.wYear, lTime.wMonth, lTime.wDay));
+ ret.setTime(QTime(lTime.wHour, lTime.wMinute, lTime.wSecond, lTime.wMilliseconds));
#endif
- }
+
return ret;
}
@@ -2011,13 +1806,32 @@ QDateTime QFSFileEngine::fileTime(FileTime time) const
}
#endif
} else {
- bool ok = false;
WIN32_FILE_ATTRIBUTE_DATA attribData;
- QT_WA({
- ok = ::GetFileAttributesExW((TCHAR*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(), GetFileExInfoStandard, &attribData);
- } , {
- ok = ::GetFileAttributesExA(QFSFileEnginePrivate::win95Name(QFileInfo(d->filePath).absoluteFilePath()), GetFileExInfoStandard, &attribData);
- });
+ bool ok = ::GetFileAttributesEx((wchar_t*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(), GetFileExInfoStandard, &attribData);
+ if (!ok) {
+ int errorCode = GetLastError();
+ if (errorCode != ERROR_INVALID_NAME
+ && errorCode != ERROR_FILE_NOT_FOUND && errorCode != ERROR_PATH_NOT_FOUND) {
+ QString path = QDir::toNativeSeparators(d->filePath);
+ // path for the FindFirstFile should not end with a trailing slash
+ while (path.endsWith(QLatin1Char('\\')))
+ path.chop(1);
+
+ // FindFirstFile can not handle drives
+ if (!path.endsWith(QLatin1Char(':'))) {
+ WIN32_FIND_DATA findData;
+ HANDLE hFind = ::FindFirstFile((wchar_t*)QFSFileEnginePrivate::longFileName(path).utf16(),
+ &findData);
+ if (hFind != INVALID_HANDLE_VALUE) {
+ ::FindClose(hFind);
+ ok = true;
+ attribData.ftCreationTime = findData.ftCreationTime;
+ attribData.ftLastWriteTime = findData.ftLastWriteTime;
+ attribData.ftLastAccessTime = findData.ftLastAccessTime;
+ }
+ }
+ }
+ }
if (ok) {
if(time == CreationTime)
ret = fileTimeToQDateTime(&attribData.ftCreationTime);
@@ -2037,11 +1851,11 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
Q_UNUSED(flags);
if (openMode == QFile::NotOpen) {
q->setError(QFile::PermissionsError, qt_error_string());
- return 0;
+ return 0;
}
if (offset == 0 && size == 0) {
q->setError(QFile::UnspecifiedError, qt_error_string());
- return 0;
+ return 0;
}
@@ -2054,7 +1868,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
#ifdef Q_USE_DEPRECATED_MAP_API
nativeClose();
if (fileMapHandle == INVALID_HANDLE_VALUE) {
- fileMapHandle = CreateFileForMappingW((TCHAR *)nativeFilePath.constData(),
+ fileMapHandle = CreateFileForMapping((const wchar_t*)nativeFilePath.constData(),
GENERIC_READ | (openMode & QIODevice::WriteOnly ? GENERIC_WRITE : 0),
0,
NULL,
@@ -2069,21 +1883,14 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
#endif
// first create the file mapping handle
- HANDLE mapHandle = 0;
DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY;
- QT_WA({
- mapHandle = ::CreateFileMappingW(handle, 0, protection,
- 0, 0, 0);
- },{
- mapHandle = ::CreateFileMappingA(handle, 0, protection,
- 0, 0, 0);
- });
+ HANDLE mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0);
if (mapHandle == NULL) {
q->setError(QFile::PermissionsError, qt_error_string());
#ifdef Q_USE_DEPRECATED_MAP_API
mapHandleClose();
#endif
- return 0;
+ return 0;
}
// setup args to map
@@ -2112,7 +1919,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
switch(GetLastError()) {
case ERROR_ACCESS_DENIED:
q->setError(QFile::PermissionsError, qt_error_string());
- break;
+ break;
case ERROR_INVALID_PARAMETER:
// size are out of bounds
default:
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 49869a4..fafce07 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -84,6 +84,7 @@ QT_END_NAMESPACE
#include "qprocess.h"
#include "qprocess_p.h"
+#include "private/qcore_unix_p.h"
#ifdef Q_OS_MAC
#include <private/qcore_mac_p.h>
@@ -114,78 +115,11 @@ static inline char *strdup(const char *data)
}
#endif
-static qint64 qt_native_read(int fd, char *data, qint64 maxlen)
-{
- qint64 ret = 0;
- do {
- ret = ::read(fd, data, maxlen);
- } while (ret == -1 && errno == EINTR);
- return ret;
-}
-
-static qint64 qt_native_write(int fd, const char *data, qint64 len)
-{
- qint64 ret = 0;
- do {
- ret = ::write(fd, data, len);
- } while (ret == -1 && errno == EINTR);
- return ret;
-}
-
-static void qt_native_close(int fd)
-{
- int ret;
- do {
- ret = ::close(fd);
- } while (ret == -1 && errno == EINTR);
-}
-
-static void qt_native_dup2(int oldfd, int newfd)
-{
- int ret;
- do {
- ret = ::dup2(oldfd, newfd);
- } while (ret == -1 && errno == EINTR);
-}
-
-static void qt_native_chdir(const char *path)
-{
- int ret;
- do {
- ret = ::chdir(path);
- } while (ret == -1 && errno == EINTR);
-}
-
-static void qt_native_execve(const char *filename, char *const argv[],
- char *const envp[])
-{
- int ret;
- do {
- ret = ::execve(filename, argv, envp);
- } while (ret == -1 && errno == EINTR);
-}
-
-static void qt_native_execv(const char *path, char *const argv[])
-{
- int ret;
- do {
- ret = ::execv(path, argv);
- } while (ret == -1 && errno == EINTR);
-}
-
-static void qt_native_execvp(const char *file, char *const argv[])
-{
- int ret;
- do {
- ret = ::execvp(file, argv);
- } while (ret == -1 && errno == EINTR);
-}
-
static int qt_qprocess_deadChild_pipe[2];
static void (*qt_sa_old_sigchld_handler)(int) = 0;
static void qt_sa_sigchld_handler(int signum)
{
- qt_native_write(qt_qprocess_deadChild_pipe[1], "", 1);
+ qt_safe_write(qt_qprocess_deadChild_pipe[1], "", 1);
#if defined (QPROCESS_DEBUG)
fprintf(stderr, "*** SIGCHLD\n");
#endif
@@ -194,6 +128,13 @@ static void qt_sa_sigchld_handler(int signum)
qt_sa_old_sigchld_handler(signum);
}
+static inline void add_fd(int &nfds, int fd, fd_set *fdset)
+{
+ FD_SET(fd, fdset);
+ if ((fd) > nfds)
+ nfds = fd;
+}
+
struct QProcessInfo {
QProcess *process;
int deathPipe;
@@ -231,13 +172,7 @@ QProcessManager::QProcessManager()
// initialize the dead child pipe and make it non-blocking. in the
// extremely unlikely event that the pipe fills up, we do not under any
// circumstances want to block.
- ::pipe(qt_qprocess_deadChild_pipe);
- ::fcntl(qt_qprocess_deadChild_pipe[0], F_SETFD, FD_CLOEXEC);
- ::fcntl(qt_qprocess_deadChild_pipe[1], F_SETFD, FD_CLOEXEC);
- ::fcntl(qt_qprocess_deadChild_pipe[0], F_SETFL,
- ::fcntl(qt_qprocess_deadChild_pipe[0], F_GETFL) | O_NONBLOCK);
- ::fcntl(qt_qprocess_deadChild_pipe[1], F_SETFL,
- ::fcntl(qt_qprocess_deadChild_pipe[1], F_GETFL) | O_NONBLOCK);
+ qt_safe_pipe(qt_qprocess_deadChild_pipe, O_NONBLOCK);
// set up the SIGCHLD handler, which writes a single byte to the dead
// child pipe every time a child dies.
@@ -254,13 +189,13 @@ QProcessManager::QProcessManager()
QProcessManager::~QProcessManager()
{
// notify the thread that we're shutting down.
- qt_native_write(qt_qprocess_deadChild_pipe[1], "@", 1);
- qt_native_close(qt_qprocess_deadChild_pipe[1]);
+ qt_safe_write(qt_qprocess_deadChild_pipe[1], "@", 1);
+ qt_safe_close(qt_qprocess_deadChild_pipe[1]);
wait();
// on certain unixes, closing the reading end of the pipe will cause
// select in run() to block forever, rather than return with EBADF.
- qt_native_close(qt_qprocess_deadChild_pipe[0]);
+ qt_safe_close(qt_qprocess_deadChild_pipe[0]);
qt_qprocess_deadChild_pipe[0] = -1;
qt_qprocess_deadChild_pipe[1] = -1;
@@ -304,7 +239,7 @@ void QProcessManager::run()
// signals may have been delivered in the meantime, to avoid race
// conditions.
char c;
- if (qt_native_read(qt_qprocess_deadChild_pipe[0], &c, 1) < 0 || c == '@')
+ if (qt_safe_read(qt_qprocess_deadChild_pipe[0], &c, 1) < 0 || c == '@')
break;
// catch any and all children that we can.
@@ -323,7 +258,7 @@ void QProcessManager::catchDeadChildren()
// notify all children that they may have died. they need to run
// waitpid() in their own thread.
QProcessInfo *info = it.value();
- qt_native_write(info->deathPipe, "", 1);
+ qt_safe_write(info->deathPipe, "", 1);
#if defined (QPROCESS_DEBUG)
qDebug() << "QProcessManager::run() sending death notice to" << info->process;
@@ -382,25 +317,23 @@ void QProcessManager::unlock()
static void qt_create_pipe(int *pipe)
{
if (pipe[0] != -1)
- qt_native_close(pipe[0]);
+ qt_safe_close(pipe[0]);
if (pipe[1] != -1)
- qt_native_close(pipe[1]);
- if (::pipe(pipe) != 0) {
+ qt_safe_close(pipe[1]);
+ if (qt_safe_pipe(pipe) != 0) {
qWarning("QProcessPrivate::createPipe: Cannot create pipe %p: %s",
pipe, qPrintable(qt_error_string(errno)));
}
- ::fcntl(pipe[0], F_SETFD, FD_CLOEXEC);
- ::fcntl(pipe[1], F_SETFD, FD_CLOEXEC);
}
void QProcessPrivate::destroyPipe(int *pipe)
{
if (pipe[1] != -1) {
- qt_native_close(pipe[1]);
+ qt_safe_close(pipe[1]);
pipe[1] = -1;
}
if (pipe[0] != -1) {
- qt_native_close(pipe[0]);
+ qt_safe_close(pipe[0]);
pipe[0] = -1;
}
}
@@ -453,7 +386,7 @@ bool QProcessPrivate::createChannel(Channel &channel)
if (&channel == &stdinChannel) {
// try to open in read-only mode
channel.pipe[1] = -1;
- if ( (channel.pipe[0] = QT_OPEN(fname, O_RDONLY)) != -1)
+ if ( (channel.pipe[0] = qt_safe_open(fname, O_RDONLY)) != -1)
return true; // success
q->setErrorString(QProcess::tr("Could not open input redirection for reading"));
@@ -465,7 +398,7 @@ bool QProcessPrivate::createChannel(Channel &channel)
mode |= O_TRUNC;
channel.pipe[0] = -1;
- if ( (channel.pipe[1] = QT_OPEN(fname, mode, 0666)) != -1)
+ if ( (channel.pipe[1] = qt_safe_open(fname, mode, 0666)) != -1)
return true; // success
q->setErrorString(QProcess::tr("Could not open output redirection for writing"));
@@ -586,8 +519,6 @@ void QProcessPrivate::startProcess()
return;
qt_create_pipe(childStartedPipe);
qt_create_pipe(deathPipe);
- ::fcntl(deathPipe[0], F_SETFD, FD_CLOEXEC);
- ::fcntl(deathPipe[1], F_SETFD, FD_CLOEXEC);
if (threadData->eventDispatcher) {
startupSocketNotifier = new QSocketNotifier(childStartedPipe[0],
@@ -728,11 +659,11 @@ void QProcessPrivate::startProcess()
// parent
// close the ends we don't use and make all pipes non-blocking
::fcntl(deathPipe[0], F_SETFL, ::fcntl(deathPipe[0], F_GETFL) | O_NONBLOCK);
- qt_native_close(childStartedPipe[1]);
+ qt_safe_close(childStartedPipe[1]);
childStartedPipe[1] = -1;
if (stdinChannel.pipe[0] != -1) {
- qt_native_close(stdinChannel.pipe[0]);
+ qt_safe_close(stdinChannel.pipe[0]);
stdinChannel.pipe[0] = -1;
}
@@ -740,7 +671,7 @@ void QProcessPrivate::startProcess()
::fcntl(stdinChannel.pipe[1], F_SETFL, ::fcntl(stdinChannel.pipe[1], F_GETFL) | O_NONBLOCK);
if (stdoutChannel.pipe[1] != -1) {
- qt_native_close(stdoutChannel.pipe[1]);
+ qt_safe_close(stdoutChannel.pipe[1]);
stdoutChannel.pipe[1] = -1;
}
@@ -748,7 +679,7 @@ void QProcessPrivate::startProcess()
::fcntl(stdoutChannel.pipe[0], F_SETFL, ::fcntl(stdoutChannel.pipe[0], F_GETFL) | O_NONBLOCK);
if (stderrChannel.pipe[1] != -1) {
- qt_native_close(stderrChannel.pipe[1]);
+ qt_safe_close(stderrChannel.pipe[1]);
stderrChannel.pipe[1] = -1;
}
if (stderrChannel.pipe[0] != -1)
@@ -761,35 +692,34 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv
Q_Q(QProcess);
- // copy the stdin socket
- qt_native_dup2(stdinChannel.pipe[0], fileno(stdin));
+ // copy the stdin socket (without closing on exec)
+ qt_safe_dup2(stdinChannel.pipe[0], fileno(stdin), 0);
// copy the stdout and stderr if asked to
if (processChannelMode != QProcess::ForwardedChannels) {
- qt_native_dup2(stdoutChannel.pipe[1], fileno(stdout));
+ qt_safe_dup2(stdoutChannel.pipe[1], fileno(stdout), 0);
// merge stdout and stderr if asked to
if (processChannelMode == QProcess::MergedChannels) {
- qt_native_dup2(fileno(stdout), fileno(stderr));
+ qt_safe_dup2(fileno(stdout), fileno(stderr), 0);
} else {
- qt_native_dup2(stderrChannel.pipe[1], fileno(stderr));
+ qt_safe_dup2(stderrChannel.pipe[1], fileno(stderr), 0);
}
}
// make sure this fd is closed if execvp() succeeds
- qt_native_close(childStartedPipe[0]);
- ::fcntl(childStartedPipe[1], F_SETFD, FD_CLOEXEC);
+ qt_safe_close(childStartedPipe[0]);
// enter the working directory
if (workingDir)
- qt_native_chdir(workingDir);
+ QT_CHDIR(workingDir);
// this is a virtual call, and it base behavior is to do nothing.
q->setupChildProcess();
// execute the process
if (!envp) {
- qt_native_execvp(argv[0], argv);
+ qt_safe_execvp(argv[0], argv);
} else {
if (path) {
char **arg = path;
@@ -798,14 +728,14 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv
#if defined (QPROCESS_DEBUG)
fprintf(stderr, "QProcessPrivate::execChild() searching / starting %s\n", argv[0]);
#endif
- qt_native_execve(argv[0], argv, envp);
+ qt_safe_execve(argv[0], argv, envp);
++arg;
}
} else {
#if defined (QPROCESS_DEBUG)
fprintf(stderr, "QProcessPrivate::execChild() starting %s\n", argv[0]);
#endif
- qt_native_execve(argv[0], argv, envp);
+ qt_safe_execve(argv[0], argv, envp);
}
}
@@ -813,21 +743,21 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv
#if defined (QPROCESS_DEBUG)
fprintf(stderr, "QProcessPrivate::execChild() failed, notifying parent process\n");
#endif
- qt_native_write(childStartedPipe[1], "", 1);
- qt_native_close(childStartedPipe[1]);
+ qt_safe_write(childStartedPipe[1], "", 1);
+ qt_safe_close(childStartedPipe[1]);
childStartedPipe[1] = -1;
}
bool QProcessPrivate::processStarted()
{
char c;
- int i = qt_native_read(childStartedPipe[0], &c, 1);
+ int i = qt_safe_read(childStartedPipe[0], &c, 1);
if (startupSocketNotifier) {
startupSocketNotifier->setEnabled(false);
startupSocketNotifier->deleteLater();
startupSocketNotifier = 0;
}
- qt_native_close(childStartedPipe[0]);
+ qt_safe_close(childStartedPipe[0]);
childStartedPipe[0] = -1;
#if defined (QPROCESS_DEBUG)
@@ -862,7 +792,7 @@ qint64 QProcessPrivate::bytesAvailableFromStderr() const
qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen)
{
- qint64 bytesRead = qt_native_read(stdoutChannel.pipe[0], data, maxlen);
+ qint64 bytesRead = qt_safe_read(stdoutChannel.pipe[0], data, maxlen);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::readFromStdout(%p \"%s\", %lld) == %lld",
data, qt_prettyDebug(data, bytesRead, 16).constData(), maxlen, bytesRead);
@@ -872,7 +802,7 @@ qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen)
qint64 QProcessPrivate::readFromStderr(char *data, qint64 maxlen)
{
- qint64 bytesRead = qt_native_read(stderrChannel.pipe[0], data, maxlen);
+ qint64 bytesRead = qt_safe_read(stderrChannel.pipe[0], data, maxlen);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::readFromStderr(%p \"%s\", %lld) == %lld",
data, qt_prettyDebug(data, bytesRead, 16).constData(), maxlen, bytesRead);
@@ -896,7 +826,7 @@ qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen)
{
qt_ignore_sigpipe();
- qint64 written = qt_native_write(stdinChannel.pipe[1], data, maxlen);
+ qint64 written = qt_safe_write(stdinChannel.pipe[1], data, maxlen);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::writeToStdin(%p \"%s\", %lld) == %lld",
data, qt_prettyDebug(data, maxlen, 16).constData(), maxlen, written);
@@ -922,17 +852,15 @@ void QProcessPrivate::killProcess()
::kill(pid_t(pid), SIGKILL);
}
-static int qt_native_select(fd_set *fdread, fd_set *fdwrite, int timeout)
+static int select_msecs(int nfds, fd_set *fdread, fd_set *fdwrite, int timeout)
{
+ if (timeout < 0)
+ return qt_safe_select(nfds, fdread, fdwrite, 0, 0);
+
struct timeval tv;
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
-
- int ret;
- do {
- ret = select(FD_SETSIZE, fdread, fdwrite, 0, timeout < 0 ? 0 : &tv);
- } while (ret < 0 && (errno == EINTR));
- return ret;
+ return qt_safe_select(nfds, fdread, fdwrite, 0, &tv);
}
/*
@@ -960,11 +888,7 @@ bool QProcessPrivate::waitForStarted(int msecs)
fd_set fds;
FD_ZERO(&fds);
FD_SET(childStartedPipe[0], &fds);
- int ret;
- do {
- ret = qt_native_select(&fds, 0, msecs);
- } while (ret < 0 && errno == EINTR);
- if (ret == 0) {
+ if (select_msecs(childStartedPipe[0] + 1, &fds, 0, msecs) == 0) {
processError = QProcess::Timedout;
q->setErrorString(QProcess::tr("Process operation timed out"));
#if defined (QPROCESS_DEBUG)
@@ -997,24 +921,23 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
+ int nfds = deathPipe[0];
+ FD_SET(deathPipe[0], &fdread);
+
if (processState == QProcess::Starting)
- FD_SET(childStartedPipe[0], &fdread);
+ add_fd(nfds, childStartedPipe[0], &fdread);
if (stdoutChannel.pipe[0] != -1)
- FD_SET(stdoutChannel.pipe[0], &fdread);
+ add_fd(nfds, stdoutChannel.pipe[0], &fdread);
if (stderrChannel.pipe[0] != -1)
- FD_SET(stderrChannel.pipe[0], &fdread);
-
- FD_SET(deathPipe[0], &fdread);
+ add_fd(nfds, stderrChannel.pipe[0], &fdread);
if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
- FD_SET(stdinChannel.pipe[1], &fdwrite);
+ add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
- int ret = qt_native_select(&fdread, &fdwrite, timeout);
+ int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
if (ret < 0) {
- if (errno == EINTR)
- continue;
break;
}
if (ret == 0) {
@@ -1070,24 +993,24 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
+ int nfds = deathPipe[0];
+ FD_SET(deathPipe[0], &fdread);
+
if (processState == QProcess::Starting)
- FD_SET(childStartedPipe[0], &fdread);
+ add_fd(nfds, childStartedPipe[0], &fdread);
if (stdoutChannel.pipe[0] != -1)
- FD_SET(stdoutChannel.pipe[0], &fdread);
+ add_fd(nfds, stdoutChannel.pipe[0], &fdread);
if (stderrChannel.pipe[0] != -1)
- FD_SET(stderrChannel.pipe[0], &fdread);
+ add_fd(nfds, stderrChannel.pipe[0], &fdread);
- FD_SET(deathPipe[0], &fdread);
if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
- FD_SET(stdinChannel.pipe[1], &fdwrite);
+ add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
- int ret = qt_native_select(&fdread, &fdwrite, timeout);
+ int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
if (ret < 0) {
- if (errno == EINTR)
- continue;
break;
}
@@ -1133,29 +1056,28 @@ bool QProcessPrivate::waitForFinished(int msecs)
forever {
fd_set fdread;
fd_set fdwrite;
+ int nfds = -1;
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
if (processState == QProcess::Starting)
- FD_SET(childStartedPipe[0], &fdread);
+ add_fd(nfds, childStartedPipe[0], &fdread);
if (stdoutChannel.pipe[0] != -1)
- FD_SET(stdoutChannel.pipe[0], &fdread);
+ add_fd(nfds, stdoutChannel.pipe[0], &fdread);
if (stderrChannel.pipe[0] != -1)
- FD_SET(stderrChannel.pipe[0], &fdread);
+ add_fd(nfds, stderrChannel.pipe[0], &fdread);
if (processState == QProcess::Running)
- FD_SET(deathPipe[0], &fdread);
+ add_fd(nfds, deathPipe[0], &fdread);
if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
- FD_SET(stdinChannel.pipe[1], &fdwrite);
+ add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
- int ret = qt_native_select(&fdread, &fdwrite, timeout);
+ int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
if (ret < 0) {
- if (errno == EINTR)
- continue;
break;
}
if (ret == 0) {
@@ -1190,12 +1112,7 @@ bool QProcessPrivate::waitForWrite(int msecs)
fd_set fdwrite;
FD_ZERO(&fdwrite);
FD_SET(stdinChannel.pipe[1], &fdwrite);
-
- int ret;
- do {
- ret = qt_native_select(0, &fdwrite, msecs < 0 ? 0 : msecs) == 1;
- } while (ret < 0 && errno == EINTR);
- return ret == 1;
+ return select_msecs(stdinChannel.pipe[1] + 1, 0, &fdwrite, msecs < 0 ? 0 : msecs) == 1;
}
void QProcessPrivate::findExitCode()
@@ -1210,15 +1127,11 @@ bool QProcessPrivate::waitForDeadChild()
// read a byte from the death pipe
char c;
- qt_native_read(deathPipe[0], &c, 1);
+ qt_safe_read(deathPipe[0], &c, 1);
// check if our process is dead
int exitStatus;
- pid_t waitResult = 0;
- do {
- waitResult = waitpid(pid_t(pid), &exitStatus, WNOHANG);
- } while ((waitResult == -1 && errno == EINTR));
- if (waitResult > 0) {
+ if (qt_safe_waitpid(pid_t(pid), &exitStatus, WNOHANG) > 0) {
processManager()->remove(q);
crashed = !WIFEXITED(exitStatus);
exitCode = WEXITSTATUS(exitStatus);
@@ -1262,16 +1175,15 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
::setsid();
- qt_native_close(startedPipe[0]);
- qt_native_close(pidPipe[0]);
+ qt_safe_close(startedPipe[0]);
+ qt_safe_close(pidPipe[0]);
pid_t doubleForkPid = qt_fork();
if (doubleForkPid == 0) {
- ::fcntl(startedPipe[1], F_SETFD, FD_CLOEXEC);
- qt_native_close(pidPipe[1]);
+ qt_safe_close(pidPipe[1]);
if (!encodedWorkingDirectory.isEmpty())
- qt_native_chdir(encodedWorkingDirectory.constData());
+ QT_CHDIR(encodedWorkingDirectory.constData());
char **argv = new char *[arguments.size() + 2];
for (int i = 0; i < arguments.size(); ++i) {
@@ -1292,13 +1204,13 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
if (!tmp.endsWith('/')) tmp += '/';
tmp += QFile::encodeName(program);
argv[0] = tmp.data();
- qt_native_execv(argv[0], argv);
+ qt_safe_execv(argv[0], argv);
}
}
} else {
QByteArray tmp = QFile::encodeName(program);
argv[0] = tmp.data();
- qt_native_execv(argv[0], argv);
+ qt_safe_execv(argv[0], argv);
}
struct sigaction noaction;
@@ -1308,8 +1220,8 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
// '\1' means execv failed
char c = '\1';
- qt_native_write(startedPipe[1], &c, 1);
- qt_native_close(startedPipe[1]);
+ qt_safe_write(startedPipe[1], &c, 1);
+ qt_safe_close(startedPipe[1]);
::_exit(1);
} else if (doubleForkPid == -1) {
struct sigaction noaction;
@@ -1319,40 +1231,39 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
// '\2' means internal error
char c = '\2';
- qt_native_write(startedPipe[1], &c, 1);
+ qt_safe_write(startedPipe[1], &c, 1);
}
- qt_native_close(startedPipe[1]);
- qt_native_write(pidPipe[1], (const char *)&doubleForkPid, sizeof(pid_t));
- qt_native_chdir("/");
+ qt_safe_close(startedPipe[1]);
+ qt_safe_write(pidPipe[1], (const char *)&doubleForkPid, sizeof(pid_t));
+ QT_CHDIR("/");
::_exit(1);
}
- qt_native_close(startedPipe[1]);
- qt_native_close(pidPipe[1]);
+ qt_safe_close(startedPipe[1]);
+ qt_safe_close(pidPipe[1]);
if (childPid == -1) {
- qt_native_close(startedPipe[0]);
- qt_native_close(pidPipe[0]);
+ qt_safe_close(startedPipe[0]);
+ qt_safe_close(pidPipe[0]);
return false;
}
char reply = '\0';
- int startResult = qt_native_read(startedPipe[0], &reply, 1);
+ int startResult = qt_safe_read(startedPipe[0], &reply, 1);
int result;
- qt_native_close(startedPipe[0]);
- while (::waitpid(childPid, &result, 0) == -1 && errno == EINTR)
- { }
+ qt_safe_close(startedPipe[0]);
+ qt_safe_waitpid(childPid, &result, 0);
bool success = (startResult != -1 && reply == '\0');
if (success && pid) {
pid_t actualPid = 0;
- if (qt_native_read(pidPipe[0], (char *)&actualPid, sizeof(pid_t)) == sizeof(pid_t)) {
+ if (qt_safe_read(pidPipe[0], (char *)&actualPid, sizeof(pid_t)) == sizeof(pid_t)) {
*pid = actualPid;
} else {
*pid = 0;
}
}
- qt_native_close(pidPipe[0]);
+ qt_safe_close(pidPipe[0]);
return success;
}
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index d028df1..eae17b4 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -54,7 +54,7 @@
#include <private/qthread_p.h>
#include <qdebug.h>
-#include "private/qfsfileengine_p.h" // for longFileName and win95FileName
+#include "private/qfsfileengine_p.h" // for longFileName
#ifndef QT_NO_PROCESS
@@ -122,25 +122,15 @@ bool QProcessPrivate::createChannel(Channel &channel)
if (&channel == &stdinChannel) {
// try to open in read-only mode
channel.pipe[1] = INVALID_Q_PIPE;
- QT_WA({
- channel.pipe[0] =
- CreateFileW((TCHAR*)QFSFileEnginePrivate::longFileName(channel.file).utf16(),
- GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &secAtt,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- }, {
- channel.pipe[0] =
- CreateFileA(QFSFileEnginePrivate::win95Name(channel.file),
- GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &secAtt,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- });
+ channel.pipe[0] =
+ CreateFile((const wchar_t*)QFSFileEnginePrivate::longFileName(channel.file).utf16(),
+ GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ &secAtt,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
if (channel.pipe[0] != INVALID_Q_PIPE)
return true;
@@ -148,31 +138,15 @@ bool QProcessPrivate::createChannel(Channel &channel)
} else {
// open in write mode
channel.pipe[0] = INVALID_Q_PIPE;
- DWORD creation;
- if (channel.append)
- creation = OPEN_ALWAYS;
- else
- creation = CREATE_ALWAYS;
-
- QT_WA({
- channel.pipe[1] =
- CreateFileW((TCHAR*)QFSFileEnginePrivate::longFileName(channel.file).utf16(),
- GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &secAtt,
- creation,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- }, {
- channel.pipe[1] =
- CreateFileA(QFSFileEnginePrivate::win95Name(channel.file),
- GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &secAtt,
- creation,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- });
+ channel.pipe[1] =
+ CreateFile((const wchar_t *)QFSFileEnginePrivate::longFileName(channel.file).utf16(),
+ GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ &secAtt,
+ channel.append ? OPEN_ALWAYS : CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
if (channel.pipe[1] != INVALID_Q_PIPE) {
if (channel.append) {
SetFilePointer(channel.pipe[1], 0, NULL, FILE_END);
@@ -327,56 +301,37 @@ static QByteArray qt_create_environment(const QHash<QString, QString> *environme
int pos = 0;
QHash<QString, QString>::ConstIterator it = copy.constBegin(),
end = copy.constEnd();
-#ifdef UNICODE
- if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) {
- static const TCHAR equal = L'=';
- static const TCHAR nul = L'\0';
-
- for ( ; it != end; ++it) {
- uint tmpSize = sizeof(TCHAR) * (it.key().length() + it.value().length() + 2);
- // ignore empty strings
- if (tmpSize == sizeof(TCHAR)*2)
- continue;
- envlist.resize(envlist.size() + tmpSize);
-
- tmpSize = it.key().length() * sizeof(TCHAR);
- memcpy(envlist.data()+pos, it.key().utf16(), tmpSize);
- pos += tmpSize;
-
- memcpy(envlist.data()+pos, &equal, sizeof(TCHAR));
- pos += sizeof(TCHAR);
-
- tmpSize = it.value().length() * sizeof(TCHAR);
- memcpy(envlist.data()+pos, it.value().utf16(), tmpSize);
- pos += tmpSize;
-
- memcpy(envlist.data()+pos, &nul, sizeof(TCHAR));
- pos += sizeof(TCHAR);
- }
- // add the 2 terminating 0 (actually 4, just to be on the safe side)
- envlist.resize( envlist.size()+4 );
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- } else
-#endif // UNICODE
- {
- for ( ; it != end; it++) {
- QByteArray tmp = it.key().toLocal8Bit();
- tmp.append('=');
- tmp.append(it.value().toLocal8Bit());
-
- uint tmpSize = tmp.length() + 1;
- envlist.resize(envlist.size() + tmpSize);
- memcpy(envlist.data()+pos, tmp.data(), tmpSize);
- pos += tmpSize;
- }
- // add the terminating 0 (actually 2, just to be on the safe side)
- envlist.resize(envlist.size()+2);
- envlist[pos++] = 0;
- envlist[pos++] = 0;
+
+ static const wchar_t equal = L'=';
+ static const wchar_t nul = L'\0';
+
+ for ( ; it != end; ++it) {
+ uint tmpSize = sizeof(wchar_t) * (it.key().length() + it.value().length() + 2);
+ // ignore empty strings
+ if (tmpSize == sizeof(wchar_t) * 2)
+ continue;
+ envlist.resize(envlist.size() + tmpSize);
+
+ tmpSize = it.key().length() * sizeof(wchar_t);
+ memcpy(envlist.data()+pos, it.key().utf16(), tmpSize);
+ pos += tmpSize;
+
+ memcpy(envlist.data()+pos, &equal, sizeof(wchar_t));
+ pos += sizeof(wchar_t);
+
+ tmpSize = it.value().length() * sizeof(wchar_t);
+ memcpy(envlist.data()+pos, it.value().utf16(), tmpSize);
+ pos += tmpSize;
+
+ memcpy(envlist.data()+pos, &nul, sizeof(wchar_t));
+ pos += sizeof(wchar_t);
}
+ // add the 2 terminating 0 (actually 4, just to be on the safe side)
+ envlist.resize( envlist.size()+4 );
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
}
return envlist;
}
@@ -417,58 +372,33 @@ void QProcessPrivate::startProcess()
qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes");
#endif
- DWORD dwCreationFlags = 0;
- if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based))
- dwCreationFlags |= CREATE_NO_WINDOW;
+ DWORD dwCreationFlags = CREATE_NO_WINDOW;
-#ifdef UNICODE
- if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) {
#if defined(Q_OS_WINCE)
QString fullPathProgram = program;
if (!QDir::isAbsolutePath(fullPathProgram))
fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath();
fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
- success = CreateProcessW((WCHAR*)fullPathProgram.utf16(),
- (WCHAR*)args.utf16(),
- 0, 0, false, 0, 0, 0, 0, pid);
+ success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
+ (wchar_t*)args.utf16(),
+ 0, 0, false, 0, 0, 0, 0, pid);
#else
dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- 0, 0, 0,
- STARTF_USESTDHANDLES,
- 0, 0, 0,
- stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1]
+ (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
+ 0, 0, 0,
+ STARTF_USESTDHANDLES,
+ 0, 0, 0,
+ stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1]
};
- success = CreateProcessW(0, (WCHAR*)args.utf16(),
- 0, 0, TRUE, dwCreationFlags,
- environment ? envlist.data() : 0,
- workingDirectory.isEmpty() ? 0
- : (WCHAR*)QDir::toNativeSeparators(workingDirectory).utf16(),
- &startupInfo, pid);
-#endif
- } else
-#endif // UNICODE
- {
-#ifndef Q_OS_WINCE
- STARTUPINFOA startupInfo = { sizeof( STARTUPINFOA ), 0, 0, 0,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- 0, 0, 0,
- STARTF_USESTDHANDLES,
- 0, 0, 0,
- stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1]
- };
-
- success = CreateProcessA(0, args.toLocal8Bit().data(),
- 0, 0, TRUE, dwCreationFlags, environment ? envlist.data() : 0,
- workingDirectory.isEmpty() ? 0
- : QDir::toNativeSeparators(workingDirectory).toLocal8Bit().data(),
- &startupInfo, pid);
-#endif // Q_OS_WINCE
- }
-#ifndef Q_OS_WINCE
+ success = CreateProcess(0, (wchar_t*)args.utf16(),
+ 0, 0, TRUE, dwCreationFlags,
+ environment ? envlist.data() : 0,
+ workingDirectory.isEmpty() ? 0
+ : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(),
+ &startupInfo, pid);
+
if (stdinChannel.pipe[0] != INVALID_Q_PIPE) {
CloseHandle(stdinChannel.pipe[0]);
stdinChannel.pipe[0] = INVALID_Q_PIPE;
@@ -508,7 +438,7 @@ void QProcessPrivate::startProcess()
}
// give the process a chance to start ...
- Sleep(SLEEPMIN*2);
+ Sleep(SLEEPMIN * 2);
_q_startupNotification();
}
@@ -882,42 +812,25 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
PROCESS_INFORMATION pinfo;
-#ifdef UNICODE
- if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) {
#if defined(Q_OS_WINCE)
QString fullPathProgram = program;
if (!QDir::isAbsolutePath(fullPathProgram))
fullPathProgram.prepend(QDir::currentPath().append(QLatin1Char('/')));
fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
- success = CreateProcessW((WCHAR*)fullPathProgram.utf16(),
- (WCHAR*)args.utf16(),
- 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo);
+ success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
+ (wchar_t*)args.utf16(),
+ 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo);
#else
STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
- success = CreateProcessW(0, (WCHAR*)args.utf16(),
- 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
- workingDir.isEmpty() ? (const WCHAR *)0 : (const WCHAR *)workingDir.utf16(),
- &startupInfo, &pinfo);
-#endif
- } else
-#endif // UNICODE
- {
-#ifndef Q_OS_WINCE
- STARTUPINFOA startupInfo = { sizeof( STARTUPINFOA ), 0, 0, 0,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
- success = CreateProcessA(0, args.toLocal8Bit().data(),
- 0, 0, FALSE, CREATE_NEW_CONSOLE, 0,
- workingDir.isEmpty() ? (LPCSTR)0 : workingDir.toLocal8Bit().constData(),
+ success = CreateProcess(0, (wchar_t*)args.utf16(),
+ 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
+ workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(),
&startupInfo, &pinfo);
#endif // Q_OS_WINCE
- }
if (success) {
CloseHandle(pinfo.hThread);
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index f59be7b..0899eef 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -56,6 +56,10 @@
#include <qplatformdefs.h>
#include "private/qabstractfileengine_p.h"
+#ifdef Q_OS_UNIX
+# include "private/qcore_unix_p.h"
+#endif
+
//#define DEBUG_RESOURCE_MATCH
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qresource_iterator.cpp b/src/corelib/io/qresource_iterator.cpp
index e97ac59..11f4acf 100644
--- a/src/corelib/io/qresource_iterator.cpp
+++ b/src/corelib/io/qresource_iterator.cpp
@@ -73,13 +73,11 @@ bool QResourceFileEngineIterator::hasNext() const
return false;
// Initialize and move to the next entry.
- QResourceFileEngineIterator *that = const_cast<QResourceFileEngineIterator *>(this);
- that->entries = resource.children();
- if (!that->entries.isEmpty())
- that->index = 0;
+ entries = resource.children();
+ index = 0;
}
- return index <= entries.size();
+ return index < entries.size();
}
QString QResourceFileEngineIterator::currentFileName() const
diff --git a/src/corelib/io/qresource_iterator_p.h b/src/corelib/io/qresource_iterator_p.h
index b5e8382..5165157 100644
--- a/src/corelib/io/qresource_iterator_p.h
+++ b/src/corelib/io/qresource_iterator_p.h
@@ -71,8 +71,8 @@ public:
QString currentFileName() const;
private:
- QStringList entries;
- int index;
+ mutable QStringList entries;
+ mutable int index;
};
QT_END_NAMESPACE
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index b324441..4e44261 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1037,33 +1037,16 @@ static QString windowsConfigPath(int type)
// This only happens when bootstrapping qmake.
#ifndef Q_OS_WINCE
QLibrary library(QLatin1String("shell32"));
- QT_WA( {
- typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPTSTR, int, BOOL);
- GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW");
- if (SHGetSpecialFolderPath) {
- TCHAR path[MAX_PATH];
- SHGetSpecialFolderPath(0, path, type, FALSE);
- result = QString::fromUtf16((ushort*)path);
- }
- } , {
- typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, char*, int, BOOL);
- GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathA");
- if (SHGetSpecialFolderPath) {
- char path[MAX_PATH];
- SHGetSpecialFolderPath(0, path, type, FALSE);
- result = QString::fromLocal8Bit(path);
- }
- } );
#else
QLibrary library(QLatin1String("coredll"));
- typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPTSTR, int, BOOL);
- GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPath");
+#endif // Q_OS_WINCE
+ typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL);
+ GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW");
if (SHGetSpecialFolderPath) {
wchar_t path[MAX_PATH];
SHGetSpecialFolderPath(0, path, type, FALSE);
- result = QString::fromUtf16((ushort*)path);
+ result = QString::fromWCharArray(path);
}
-#endif // Q_OS_WINCE
#endif // QT_NO_QOBJECT
@@ -1462,11 +1445,7 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo)
QString writeSemName = QLatin1String("QSettingsWriteSem ");
writeSemName.append(file.fileName());
- QT_WA( {
- writeSemaphore = CreateSemaphoreW(0, 1, 1, reinterpret_cast<const wchar_t *>(writeSemName.utf16()));
- } , {
- writeSemaphore = CreateSemaphoreA(0, 1, 1, writeSemName.toLocal8Bit());
- } );
+ writeSemaphore = CreateSemaphore(0, 1, 1, reinterpret_cast<const wchar_t *>(writeSemName.utf16()));
if (writeSemaphore) {
WaitForSingleObject(writeSemaphore, INFINITE);
@@ -1482,11 +1461,7 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo)
QString readSemName(QLatin1String("QSettingsReadSem "));
readSemName.append(file.fileName());
- QT_WA( {
- readSemaphore = CreateSemaphoreW(0, FileLockSemMax, FileLockSemMax, reinterpret_cast<const wchar_t *>(readSemName.utf16()));
- } , {
- readSemaphore = CreateSemaphoreA(0, FileLockSemMax, FileLockSemMax, readSemName.toLocal8Bit());
- } );
+ readSemaphore = CreateSemaphore(0, FileLockSemMax, FileLockSemMax, reinterpret_cast<const wchar_t *>(readSemName.utf16()));
if (readSemaphore) {
for (int i = 0; i < numReadLocks; ++i)
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index 0cbcc10..1e1509d 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -130,24 +130,13 @@ static void mergeKeySets(NameSet *dest, const QStringList &src)
static QString errorCodeToString(DWORD errorCode)
{
- QString result;
- QT_WA({
- wchar_t *data = 0;
- FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- 0, errorCode, 0,
- data, 0, 0);
- result = QString::fromUtf16(reinterpret_cast<const ushort *> (data));
- if (data != 0)
- LocalFree(data);
- }, {
- char *data = 0;
- FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- 0, errorCode, 0,
- (char *)&data, 0, 0);
- result = QString::fromLocal8Bit(data);
- if (data != 0)
- LocalFree(data);
- })
+ wchar_t *data = 0;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 0, errorCode, 0, data, 0, 0);
+ QString result = QString::fromWCharArray(data);
+
+ if (data != 0)
+ LocalFree(data);
+
if (result.endsWith(QLatin1Char('\n')))
result.truncate(result.length() - 1);
@@ -158,15 +147,8 @@ static QString errorCodeToString(DWORD errorCode)
static HKEY openKey(HKEY parentHandle, REGSAM perms, const QString &rSubKey)
{
HKEY resultHandle = 0;
-
- LONG res;
- QT_WA( {
- res = RegOpenKeyExW(parentHandle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()),
- 0, perms, &resultHandle);
- } , {
- res = RegOpenKeyExA(parentHandle, rSubKey.toLocal8Bit(),
+ LONG res = RegOpenKeyEx(parentHandle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()),
0, perms, &resultHandle);
- } );
if (res == ERROR_SUCCESS)
return resultHandle;
@@ -183,14 +165,8 @@ static HKEY createOrOpenKey(HKEY parentHandle, REGSAM perms, const QString &rSub
return resultHandle;
// try to create it
- LONG res;
- QT_WA( {
- res = RegCreateKeyExW(parentHandle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()), 0, 0,
- REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0);
- } , {
- res = RegCreateKeyExA(parentHandle, rSubKey.toLocal8Bit(), 0, 0,
+ LONG res = RegCreateKeyEx(parentHandle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()), 0, 0,
REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0);
- } );
if (res == ERROR_SUCCESS)
return resultHandle;
@@ -225,20 +201,14 @@ static HKEY createOrOpenKey(HKEY parentHandle, const QString &rSubKey, bool *rea
static QStringList childKeysOrGroups(HKEY parentHandle, QSettingsPrivate::ChildSpec spec)
{
QStringList result;
- LONG res;
DWORD numKeys;
DWORD maxKeySize;
DWORD numSubgroups;
DWORD maxSubgroupSize;
// Find the number of keys and subgroups, as well as the max of their lengths.
- QT_WA( {
- res = RegQueryInfoKeyW(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0,
+ LONG res = RegQueryInfoKey(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0,
&numKeys, &maxKeySize, 0, 0, 0);
- }, {
- res = RegQueryInfoKeyA(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0,
- &numKeys, &maxKeySize, 0, 0, 0);
- } );
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegQueryInfoKey() failed: %s", errorCodeToString(res).toLatin1().data());
@@ -258,36 +228,21 @@ static QStringList childKeysOrGroups(HKEY parentHandle, QSettingsPrivate::ChildS
m = maxSubgroupSize;
}
- /* Windows NT/2000/XP: The size does not include the terminating null character.
- Windows Me/98/95: The size includes the terminating null character. */
+ /* The size does not include the terminating null character. */
++m;
// Get the list
- QByteArray buff(m*sizeof(ushort), 0);
+ QByteArray buff(m * sizeof(wchar_t), 0);
for (int i = 0; i < n; ++i) {
QString item;
- QT_WA( {
- DWORD l = buff.size() / sizeof(ushort);
- if (spec == QSettingsPrivate::ChildKeys) {
- res = RegEnumValueW(parentHandle, i,
- reinterpret_cast<wchar_t *>(buff.data()),
- &l, 0, 0, 0, 0);
- } else {
- res = RegEnumKeyExW(parentHandle, i,
- reinterpret_cast<wchar_t *>(buff.data()),
- &l, 0, 0, 0, 0);
- }
- if (res == ERROR_SUCCESS)
- item = QString::fromUtf16(reinterpret_cast<ushort*>(buff.data()), l);
- }, {
- DWORD l = buff.size();
- if (spec == QSettingsPrivate::ChildKeys)
- res = RegEnumValueA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
- else
- res = RegEnumKeyExA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
- if (res == ERROR_SUCCESS)
- item = QString::fromLocal8Bit(buff.data(), l);
- } );
+ DWORD l = buff.size() / sizeof(wchar_t);
+ if (spec == QSettingsPrivate::ChildKeys) {
+ res = RegEnumValue(parentHandle, i, reinterpret_cast<wchar_t *>(buff.data()), &l, 0, 0, 0, 0);
+ } else {
+ res = RegEnumKeyEx(parentHandle, i, reinterpret_cast<wchar_t *>(buff.data()), &l, 0, 0, 0, 0);
+ }
+ if (res == ERROR_SUCCESS)
+ item = QString::fromWCharArray((const wchar_t *)buff.constData(), l);
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegEnumValue failed: %s", errorCodeToString(res).toLatin1().data());
@@ -342,12 +297,7 @@ static void deleteChildGroups(HKEY parentHandle)
RegCloseKey(childGroupHandle);
// delete group itself
- LONG res;
- QT_WA( {
- res = RegDeleteKeyW(parentHandle, reinterpret_cast<const wchar_t *>(group.utf16()));
- }, {
- res = RegDeleteKeyA(parentHandle, group.toLocal8Bit());
- } );
+ LONG res = RegDeleteKey(parentHandle, reinterpret_cast<const wchar_t *>(group.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegDeleteKey failed on subkey \"%s\": %s",
group.toLatin1().data(), errorCodeToString(res).toLatin1().data());
@@ -519,12 +469,7 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa
// get the size and type of the value
DWORD dataType;
DWORD dataSize;
- LONG res;
- QT_WA( {
- res = RegQueryValueExW(handle, reinterpret_cast<const wchar_t *>(rSubkeyName.utf16()), 0, &dataType, 0, &dataSize);
- }, {
- res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize);
- } );
+ LONG res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(rSubkeyName.utf16()), 0, &dataType, 0, &dataSize);
if (res != ERROR_SUCCESS) {
RegCloseKey(handle);
return false;
@@ -532,13 +477,8 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa
// get the value
QByteArray data(dataSize, 0);
- QT_WA( {
- res = RegQueryValueExW(handle, reinterpret_cast<const wchar_t *>(rSubkeyName.utf16()), 0, 0,
- reinterpret_cast<unsigned char*>(data.data()), &dataSize);
- }, {
- res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0,
- reinterpret_cast<unsigned char*>(data.data()), &dataSize);
- } );
+ res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(rSubkeyName.utf16()), 0, 0,
+ reinterpret_cast<unsigned char*>(data.data()), &dataSize);
if (res != ERROR_SUCCESS) {
RegCloseKey(handle);
return false;
@@ -549,11 +489,7 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa
case REG_SZ: {
QString s;
if (dataSize) {
- QT_WA( {
- s = QString::fromUtf16(((const ushort*)data.constData()));
- }, {
- s = QString::fromLocal8Bit(data.constData());
- } );
+ s = QString::fromWCharArray(((const wchar_t *)data.constData()));
}
if (value != 0)
*value = stringToVariant(s);
@@ -565,12 +501,7 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa
if (dataSize) {
int i = 0;
for (;;) {
- QString s;
- QT_WA( {
- s = QString::fromUtf16((const ushort*)data.constData() + i);
- }, {
- s = QString::fromLocal8Bit(data.constData() + i);
- } );
+ QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i);
i += s.length() + 1;
if (s.isEmpty())
@@ -587,11 +518,7 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa
case REG_BINARY: {
QString s;
if (dataSize) {
- QT_WA( {
- s = QString::fromUtf16((const ushort*)data.constData(), data.size()/2);
- }, {
- s = QString::fromLocal8Bit(data.constData(), data.size());
- } );
+ s = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2);
}
if (value != 0)
*value = stringToVariant(s);
@@ -635,13 +562,8 @@ QWinSettingsPrivate::~QWinSettingsPrivate()
#if defined(Q_OS_WINCE)
remove(regList.at(0).key());
#else
- DWORD res;
QString emptyKey;
- QT_WA( {
- res = RegDeleteKeyW(writeHandle(), reinterpret_cast<const wchar_t *>(emptyKey.utf16()));
- }, {
- res = RegDeleteKeyA(writeHandle(), emptyKey.toLocal8Bit());
- } );
+ DWORD res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(emptyKey.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: Failed to delete key \"%s\": %s",
regList.at(0).key().toLatin1().data(), errorCodeToString(res).toLatin1().data());
@@ -666,11 +588,7 @@ void QWinSettingsPrivate::remove(const QString &uKey)
LONG res;
HKEY handle = openKey(writeHandle(), registryPermissions, keyPath(rKey));
if (handle != 0) {
- QT_WA( {
- res = RegDeleteValueW(handle, reinterpret_cast<const wchar_t *>(keyName(rKey).utf16()));
- }, {
- res = RegDeleteValueA(handle, keyName(rKey).toLocal8Bit());
- } );
+ res = RegDeleteValue(handle, reinterpret_cast<const wchar_t *>(keyName(rKey).utf16()));
RegCloseKey(handle);
}
@@ -685,12 +603,7 @@ void QWinSettingsPrivate::remove(const QString &uKey)
for (int i = 0; i < childKeys.size(); ++i) {
QString group = childKeys.at(i);
- LONG res;
- QT_WA( {
- res = RegDeleteValueW(handle, reinterpret_cast<const wchar_t *>(group.utf16()));
- }, {
- res = RegDeleteValueA(handle, group.toLocal8Bit());
- } );
+ LONG res = RegDeleteValue(handle, reinterpret_cast<const wchar_t *>(group.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegDeleteValue failed on subkey \"%s\": %s",
group.toLatin1().data(), errorCodeToString(res).toLatin1().data());
@@ -701,11 +614,7 @@ void QWinSettingsPrivate::remove(const QString &uKey)
// For WinCE always Close the handle first.
RegCloseKey(handle);
#endif
- QT_WA( {
- res = RegDeleteKeyW(writeHandle(), reinterpret_cast<const wchar_t *>(rKey.utf16()));
- }, {
- res = RegDeleteKeyA(writeHandle(), rKey.toLocal8Bit());
- } );
+ res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(rKey.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegDeleteKey failed on key \"%s\": %s",
@@ -761,27 +670,15 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
if (type == REG_BINARY) {
QString s = variantToString(value);
- QT_WA( {
- regValueBuff = QByteArray((const char*)s.utf16(), s.length()*2);
- }, {
- regValueBuff = QByteArray((const char*)s.toLocal8Bit(), s.length());
- } );
+ regValueBuff = QByteArray((const char*)s.utf16(), s.length() * 2);
} else {
QStringList::const_iterator it = l.constBegin();
for (; it != l.constEnd(); ++it) {
const QString &s = *it;
- QT_WA( {
- regValueBuff += QByteArray((const char*)s.utf16(), (s.length() + 1)*2);
- }, {
- regValueBuff += QByteArray((const char*)s.toLocal8Bit(), s.length() + 1);
- } );
+ regValueBuff += QByteArray((const char*)s.utf16(), (s.length() + 1) * 2);
}
- QT_WA( {
- regValueBuff.append((char)0);
- regValueBuff.append((char)0);
- }, {
- regValueBuff.append((char)0);
- } );
+ regValueBuff.append((char)0);
+ regValueBuff.append((char)0);
}
break;
}
@@ -794,21 +691,6 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
}
case QVariant::ByteArray:
- // On Win95/98/Me QString::toLocal8Bit() fails to handle chars > 0x7F. So we don't go through variantToString() at all.
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
- QByteArray ba = value.toByteArray();
- regValueBuff = "@ByteArray(";
- regValueBuff += ba;
- regValueBuff += ')';
- if (ba.contains('\0')) {
- type = REG_BINARY;
- } else {
- type = REG_SZ;
- regValueBuff += '\0';
- }
-
- break;
- }
// fallthrough intended
default: {
@@ -817,33 +699,18 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
QString s = variantToString(value);
type = stringContainsNullChar(s) ? REG_BINARY : REG_SZ;
if (type == REG_BINARY) {
- QT_WA( {
- regValueBuff = QByteArray((const char*)s.utf16(), s.length()*2);
- }, {
- regValueBuff = QByteArray((const char*)s.toLocal8Bit(), s.length());
- } );
+ regValueBuff = QByteArray((const char*)s.utf16(), s.length() * 2);
} else {
- QT_WA( {
- regValueBuff = QByteArray((const char*)s.utf16(), (s.length() + 1)*2);
- }, {
- regValueBuff = QByteArray((const char*)s.toLocal8Bit(), s.length() + 1);
- } );
+ regValueBuff = QByteArray((const char*)s.utf16(), (s.length() + 1) * 2);
}
break;
}
}
// set the value
- LONG res;
- QT_WA( {
- res = RegSetValueExW(handle, reinterpret_cast<const wchar_t *>(keyName(rKey).utf16()), 0, type,
- reinterpret_cast<const unsigned char*>(regValueBuff.constData()),
- regValueBuff.size());
- }, {
- res = RegSetValueExA(handle, keyName(rKey).toLocal8Bit(), 0, type,
+ LONG res = RegSetValueEx(handle, reinterpret_cast<const wchar_t *>(keyName(rKey).utf16()), 0, type,
reinterpret_cast<const unsigned char*>(regValueBuff.constData()),
regValueBuff.size());
- } );
if (res == ERROR_SUCCESS) {
deleteWriteHandleOnExit = false;
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 2d5bea6..e098064 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -60,6 +60,10 @@
#include <time.h>
#include <ctype.h>
+#if defined(Q_OS_UNIX)
+# include "private/qcore_unix_p.h" // overrides QT_OPEN
+#endif
+
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
# include <process.h>
# if defined(_MSC_VER) && _MSC_VER >= 1400
@@ -72,7 +76,6 @@
# include "qfunctions_wince.h"
#endif
-
QT_BEGIN_NAMESPACE
/*
@@ -208,8 +211,9 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen)
if ((*doopen =
QT_OPEN(targetPath.toLocal8Bit(), O_CREAT|O_EXCL|O_RDWR
# else // CE
+ // this is Unix or older MSVC
if ((*doopen =
- open(path, QT_OPEN_CREAT|O_EXCL|QT_OPEN_RDWR
+ QT_OPEN(path, QT_OPEN_CREAT|O_EXCL|QT_OPEN_RDWR
# endif
# ifdef QT_LARGEFILE_SUPPORT
|QT_OPEN_LARGEFILE
@@ -219,18 +223,9 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen)
# elif defined(Q_OS_WIN)
|O_BINARY
# endif
-# ifdef O_CLOEXEC
- // supported on Linux >= 2.6.23; avoids one extra system call
- // and avoids a race condition: if another thread forks, we could
- // end up leaking a file descriptor...
- |O_CLOEXEC
-# endif
, 0600)) >= 0)
#endif // WIN && !CE
{
-#if defined(Q_OS_UNIX) && !defined(O_CLOEXEC)
- fcntl(*doopen, F_SETFD, FD_CLOEXEC);
-#endif
return 1;
}
if (errno != EEXIST)
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 180e9ec..79cd2f0 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -2336,12 +2336,12 @@ static const NameprepCaseFoldingEntry NameprepCaseFolding[] = {
{ 0x1D7BB, { 0x03C3, 0x0000, 0x0000, 0x0000 } }
};
-static void mapToLowerCase(QString *str)
+static void mapToLowerCase(QString *str, int from)
{
int N = sizeof(NameprepCaseFolding) / sizeof(NameprepCaseFolding[0]);
QChar *d = 0;
- for (int i = 0; i < str->size(); ++i) {
+ for (int i = from; i < str->size(); ++i) {
int uc = str->at(i).unicode();
if (uc < 0x80) {
if (uc <= 'Z' && uc >= 'A') {
@@ -2388,11 +2388,11 @@ static bool isMappedToNothing(const QChar &ch)
}
-static void stripProhibitedOutput(QString *str)
+static void stripProhibitedOutput(QString *str, int from)
{
- ushort *out = (ushort *)str->data();
+ ushort *out = (ushort *)str->data() + from;
const ushort *in = out;
- const ushort *end = out + str->size();
+ const ushort *end = (ushort *)str->data() + str->size();
while (in < end) {
ushort uc = *in;
if (uc < 0x80 ||
@@ -2901,66 +2901,99 @@ static bool isBidirectionalL(const QChar &ch)
return false;
}
+#ifdef QT_BUILD_INTERNAL
+// export for tst_qurl.cpp
+Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from);
+Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len);
+#else
+// non-test build, keep the symbols for ourselves
+static void qt_nameprep(QString *source, int from);
+static bool qt_check_std3rules(const QChar *uc, int len);
+#endif
-Q_AUTOTEST_EXPORT QString qt_nameprep(const QString &source)
+void qt_nameprep(QString *source, int from)
{
- QString mapped = source;
-
- bool simple = true;
- for (int i = 0; i < mapped.size(); ++i) {
- ushort uc = mapped.at(i).unicode();
+ QChar *src = source->data(); // causes a detach, so we're sure the only one using it
+ QChar *out = src + from;
+ const QChar *e = src + source->size();
+
+ for ( ; out < e; ++out) {
+ register ushort uc = out->unicode();
if (uc > 0x80) {
- simple = false;
break;
} else if (uc >= 'A' && uc <= 'Z') {
- mapped[i] = QChar(uc | 0x20);
+ *out = QChar(uc | 0x20);
}
}
- if (simple)
- return mapped;
-
+ if (out == e)
+ return; // everything was mapped easily (lowercased, actually)
+ int firstNonAscii = out - src;
+
// Characters commonly mapped to nothing are simply removed
// (Table B.1)
- QChar *out = mapped.data();
const QChar *in = out;
- const QChar *e = in + mapped.size();
while (in < e) {
if (!isMappedToNothing(*in))
*out++ = *in;
++in;
}
if (out != in)
- mapped.truncate(out - mapped.constData());
+ source->truncate(out - src);
// Map to lowercase (Table B.2)
- mapToLowerCase(&mapped);
+ mapToLowerCase(source, firstNonAscii);
// Normalize to Unicode 3.2 form KC
- mapped = mapped.normalized(QString::NormalizationForm_KC, QChar::Unicode_3_2);
+ extern void qt_string_normalize(QString *data, QString::NormalizationForm mode,
+ QChar::UnicodeVersion version, int from);
+ qt_string_normalize(source, QString::NormalizationForm_KC, QChar::Unicode_3_2, firstNonAscii);
// Strip prohibited output
- stripProhibitedOutput(&mapped);
+ stripProhibitedOutput(source, firstNonAscii);
// Check for valid bidirectional characters
bool containsLCat = false;
bool containsRandALCat = false;
- for (int j = 0; j < mapped.size() && (!containsLCat || !containsRandALCat); ++j) {
- if (isBidirectionalL(mapped.at(j)))
+ src = source->data();
+ e = src + source->size();
+ for (in = src + from; in < e && (!containsLCat || !containsRandALCat); ++in) {
+ if (isBidirectionalL(*in))
containsLCat = true;
- else if (isBidirectionalRorAL(mapped.at(j)))
+ else if (isBidirectionalRorAL(*in))
containsRandALCat = true;
}
if (containsRandALCat) {
- if (containsLCat || (!isBidirectionalRorAL(mapped.at(0))
- || !isBidirectionalRorAL(mapped.at(mapped.size() - 1))))
- mapped.clear();
+ if (containsLCat || (!isBidirectionalRorAL(src[from])
+ || !isBidirectionalRorAL(e[-1])))
+ source->resize(from); // not allowed, clear the label
}
+}
+
+bool qt_check_std3rules(const QChar *uc, int len)
+{
+ if (len > 63)
+ return false;
- return mapped;
+ for (int i = 0; i < len; ++i) {
+ register ushort c = uc[i].unicode();
+ if (c == '-' && (i == 0 || i == len - 1))
+ return false;
+
+ // verifying the absence of LDH is the same as verifying that
+ // only LDH is present
+ if (c == '-' || (c >= '0' && c <= '9')
+ || (c >= 'A' && c <= 'Z')
+ || (c >= 'a' && c <= 'z'))
+ continue;
+
+ return false;
+ }
+
+ return true;
}
-static inline char encodeDigit(uint digit)
+static inline uint encodeDigit(uint digit)
{
return digit + 22 + 75 * (digit < 26);
}
@@ -2977,7 +3010,7 @@ static inline uint adapt(uint delta, uint numpoints, bool firsttime)
return k + (((base - tmin + 1) * delta) / (delta + skew));
}
-static inline void appendEncode(QByteArray* output, uint& delta, uint& bias, uint& b, uint& h)
+static inline void appendEncode(QString* output, uint& delta, uint& bias, uint& b, uint& h)
{
uint qq;
uint k;
@@ -2991,17 +3024,17 @@ static inline void appendEncode(QByteArray* output, uint& delta, uint& bias, uin
t = (k <= bias) ? tmin : (k >= bias + tmax) ? tmax : k - bias;
if (qq < t) break;
- *output += encodeDigit(t + (qq - t) % (base - t));
+ *output += QChar(encodeDigit(t + (qq - t) % (base - t)));
qq = (qq - t) / (base - t);
}
- *output += encodeDigit(qq);
+ *output += QChar(encodeDigit(qq));
bias = adapt(delta, h + 1, h == b);
delta = 0;
++h;
}
-static void toPunycodeHelper(const QChar *s, int ucLength, QByteArray *output)
+static void toPunycodeHelper(const QChar *s, int ucLength, QString *output)
{
uint n = initial_n;
uint delta = 0;
@@ -3010,7 +3043,7 @@ static void toPunycodeHelper(const QChar *s, int ucLength, QByteArray *output)
int outLen = output->length();
output->resize(outLen + ucLength);
- char *d = output->data() + outLen;
+ QChar *d = output->data() + outLen;
bool skipped = false;
// copy all basic code points verbatim to output.
for (uint j = 0; j < (uint) ucLength; ++j) {
@@ -3035,7 +3068,7 @@ static void toPunycodeHelper(const QChar *s, int ucLength, QByteArray *output)
// if basic code points were copied, add the delimiter character.
if (h > 0)
- *output += 0x2d;
+ *output += QChar(0x2d);
// while there are still unprocessed non-basic code points left in
// the input string...
@@ -3083,7 +3116,7 @@ static void toPunycodeHelper(const QChar *s, int ucLength, QByteArray *output)
}
// prepend ACE prefix
- output->insert(outLen, "xn--");
+ output->insert(outLen, QLatin1String("xn--"));
return;
}
@@ -3144,11 +3177,15 @@ static bool qt_is_idn_enabled(const QString &domain)
int idx = domain.lastIndexOf(QLatin1Char('.'));
if (idx == -1)
return false;
- const QChar *tld = domain.constData() + idx + 1;
+
int len = domain.size() - idx - 1;
+ QString tldString(domain.constData() + idx + 1, len);
+ qt_nameprep(&tldString, 0);
+
+ const QChar *tld = tldString.constData();
if (user_idn_whitelist)
- return user_idn_whitelist->contains(QString(tld, len));
+ return user_idn_whitelist->contains(tldString);
int l = 0;
int r = sizeof(idn_whitelist)/sizeof(const char *) - 1;
@@ -3164,46 +3201,127 @@ static bool qt_is_idn_enabled(const QString &domain)
return equal(tld, len, idn_whitelist[i]);
}
-static QString qt_from_ACE(const QString &domainMC)
+static inline bool isDotDelimiter(ushort uc)
{
- QString domain = domainMC.toLower();
- int idx = domain.indexOf(QLatin1Char('.'));
- if (idx != -1) {
- if (!domain.contains(QLatin1String("xn--"))) {
- bool simple = true;
- for (int i = 0; i < domain.size(); ++i) {
- ushort ch = domain.at(i).unicode();
- if (ch > 'z' || ch < '-' || ch == '/' || (ch > '9' && ch < 'A') || (ch > 'Z' && ch < 'a')) {
+ // IDNA / rfc3490 describes these four delimiters used for
+ // separating labels in unicode international domain
+ // names.
+ return uc == 0x2e || uc == 0x3002 || uc == 0xff0e || uc == 0xff61;
+}
+
+static int nextDotDelimiter(const QString &domain, int from = 0)
+{
+ const QChar *b = domain.unicode();
+ const QChar *ch = b + from;
+ const QChar *e = b + domain.length();
+ while (ch < e) {
+ if (isDotDelimiter(ch->unicode()))
+ break;
+ else
+ ++ch;
+ }
+ return ch - b;
+}
+
+enum AceOperation { ToAceOnly, NormalizeAce };
+static QString qt_ACE_do(const QString &domain, AceOperation op)
+{
+ if (domain.isEmpty())
+ return domain;
+
+ QString result;
+ result.reserve(domain.length());
+
+ const bool isIdnEnabled = op == NormalizeAce ? qt_is_idn_enabled(domain) : false;
+ int lastIdx = 0;
+ QString aceForm; // this variable is here for caching
+
+ while (1) {
+ int idx = nextDotDelimiter(domain, lastIdx);
+ int labelLength = idx - lastIdx;
+ if (labelLength == 0)
+ return QString(); // two delimiters in a row -- empty label not allowed
+
+ // RFC 3490 says, about the ToASCII operation:
+ // 3. If the UseSTD3ASCIIRules flag is set, then perform these checks:
+ //
+ // (a) Verify the absence of non-LDH ASCII code points; that is, the
+ // absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
+ //
+ // (b) Verify the absence of leading and trailing hyphen-minus; that
+ // is, the absence of U+002D at the beginning and end of the
+ // sequence.
+ // and:
+ // 8. Verify that the number of code points is in the range 1 to 63
+ // inclusive.
+
+ // copy the label to the destination, which also serves as our scratch area, lowercasing it
+ int prevLen = result.size();
+ bool simple = true;
+ result.resize(prevLen + labelLength);
+ {
+ QChar *out = result.data() + prevLen;
+ const QChar *in = domain.constData() + lastIdx;
+ const QChar *e = in + labelLength;
+ for (; in < e; ++in, ++out) {
+ register ushort uc = in->unicode();
+ if (uc > 0x7f)
simple = false;
- break;
- }
+ if (uc >= 'A' && uc <= 'Z')
+ *out = QChar(uc | 0x20);
+ else
+ *out = *in;
}
- if (simple)
- return domain;
}
-
- const bool isIdnEnabled = qt_is_idn_enabled(domain);
- int lastIdx = 0;
- QString result;
- while (1) {
- // Nameprep the host. If the labels in the hostname are Punycode
- // encoded, we decode them immediately, then nameprep them.
- QByteArray label;
- toPunycodeHelper(domain.constData() + lastIdx, idx - lastIdx, &label);
- result += qt_nameprep(isIdnEnabled ? QUrl::fromPunycode(label) : QString::fromLatin1(label));
- lastIdx = idx + 1;
- if (lastIdx < domain.size() + 1)
- result += QLatin1Char('.');
- else
- break;
- idx = domain.indexOf(QLatin1Char('.'), lastIdx);
- if (idx == -1)
- idx = domain.size();
+
+ if (simple && labelLength > 6) {
+ // ACE form domains contain only ASCII characters, but we can't consider them simple
+ // is this an ACE form?
+ // the shortest valid ACE domain is 6 characters long (U+0080 would be 1, but it's not allowed)
+ static const ushort acePrefixUtf16[] = { 'x', 'n', '-', '-' };
+ if (memcmp(result.constData() + prevLen, acePrefixUtf16, sizeof acePrefixUtf16) == 0)
+ simple = false;
}
- return result;
- } else {
- return qt_nameprep(domain);
+
+ if (simple) {
+ // fastest case: this is the common case (non IDN-domains)
+ // so we're done
+ if (!qt_check_std3rules(result.constData() + prevLen, labelLength))
+ return QString();
+ } else {
+ // Punycode encoding and decoding cannot be done in-place
+ // That means we need one or two temporaries
+ qt_nameprep(&result, prevLen);
+ labelLength = result.length() - prevLen;
+ register int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes
+ if (toReserve > aceForm.capacity())
+ aceForm.reserve(toReserve);
+ toPunycodeHelper(result.constData() + prevLen, result.size() - prevLen, &aceForm);
+
+ // We use resize()+memcpy() here because we're overwriting the data we've copied
+ if (isIdnEnabled) {
+ QString tmp = QUrl::fromPunycode(aceForm.toLatin1());
+ if (tmp.isEmpty())
+ return QString(); // shouldn't happen, since we've just punycode-encoded it
+ result.resize(prevLen + tmp.size());
+ memcpy(result.data() + prevLen, tmp.constData(), tmp.size() * sizeof(QChar));
+ } else {
+ result.resize(prevLen + aceForm.size());
+ memcpy(result.data() + prevLen, aceForm.constData(), aceForm.size() * sizeof(QChar));
+ }
+
+ if (!qt_check_std3rules(aceForm.constData(), aceForm.size()))
+ return QString();
+ }
+
+
+ lastIdx = idx + 1;
+ if (lastIdx < domain.size() + 1)
+ result += QLatin1Char('.');
+ else
+ break;
}
+ return result;
}
@@ -3246,12 +3364,27 @@ QUrlPrivate::QUrlPrivate(const QUrlPrivate &copy)
QString QUrlPrivate::canonicalHost() const
{
- if (QURL_HASFLAG(stateFlags, HostCanonicalized))
+ if (QURL_HASFLAG(stateFlags, HostCanonicalized) || host.isEmpty())
return host;
QUrlPrivate *that = const_cast<QUrlPrivate *>(this);
QURL_SETFLAG(that->stateFlags, HostCanonicalized);
- that->host = qt_from_ACE(host);
+ if (host.contains(QLatin1Char(':'))) {
+ // This is an IP Literal, use _IPLiteral to validate
+ QByteArray ba = host.toLatin1();
+ if (!ba.startsWith('[')) {
+ // surround the IP Literal with [ ] if it's not already done so
+ ba.reserve(ba.length() + 2);
+ ba.prepend('[');
+ ba.append(']');
+ }
+
+ const char *ptr = ba.constData();
+ if (!_IPLiteral(&ptr))
+ that->host.clear();
+ } else {
+ that->host = qt_ACE_do(host, NormalizeAce);
+ }
return that->host;
}
@@ -3737,7 +3870,10 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const
}
}
- url += QUrl::toAce(host);
+ if (host.startsWith(QLatin1Char('[')))
+ url += host.toLatin1();
+ else
+ url += QUrl::toAce(host);
if (!(options & QUrl::RemovePort) && port != -1) {
url += ':';
url += QString::number(port).toAscii();
@@ -4412,8 +4548,6 @@ void QUrl::setHost(const QString &host)
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized | QUrlPrivate::HostCanonicalized);
d->host = host;
- if (d->host.contains(QLatin1Char(':')))
- d->host = QLatin1Char('[') + d->host + QLatin1Char(']');
}
/*!
@@ -5425,9 +5559,9 @@ QByteArray QUrl::toPercentEncoding(const QString &input, const QByteArray &exclu
*/
QByteArray QUrl::toPunycode(const QString &uc)
{
- QByteArray output;
+ QString output;
toPunycodeHelper(uc.constData(), uc.size(), &output);
- return output;
+ return output.toLatin1();
}
/*!
@@ -5528,7 +5662,7 @@ QString QUrl::fromPunycode(const QByteArray &pc)
*/
QString QUrl::fromAce(const QByteArray &domain)
{
- return qt_from_ACE(QString::fromLatin1(domain));
+ return qt_ACE_do(QString::fromLatin1(domain), NormalizeAce);
}
/*!
@@ -5545,26 +5679,8 @@ QString QUrl::fromAce(const QByteArray &domain)
*/
QByteArray QUrl::toAce(const QString &domain)
{
- // IDNA / rfc3490 describes these four delimiters used for
- // separating labels in unicode international domain
- // names.
- QString nameprepped = qt_nameprep(domain);
- int lastIdx = 0;
- QByteArray result;
- for (int i = 0; i < nameprepped.size(); ++i) {
- ushort uc = nameprepped.at(i).unicode();
- if (uc == 0x2e || uc == 0x3002 || uc == 0xff0e || uc == 0xff61) {
- if (lastIdx)
- result += '.';
- toPunycodeHelper(nameprepped.constData() + lastIdx, i - lastIdx, &result);
- lastIdx = i + 1;
- }
- }
- if (lastIdx)
- result += '.';
- toPunycodeHelper(nameprepped.constData() + lastIdx, nameprepped.size() - lastIdx, &result);
-
- return result;
+ QString result = qt_ACE_do(domain, ToAceOnly);
+ return result.toLatin1();
}
/*!
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index f7d4208..4b7baef 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -86,10 +86,14 @@ mac {
kernel/qcore_mac.cpp
}
-unix {
+unix:!symbian {
SOURCES += \
- kernel/qcrashhandler.cpp
+ kernel/qcore_unix.cpp \
+ kernel/qcrashhandler.cpp \
+ kernel/qsharedmemory_unix.cpp \
+ kernel/qsystemsemaphore_unix.cpp
HEADERS += \
+ kernel/qcore_unix_p.h \
kernel/qcrashhandler_p.h
contains(QT_CONFIG, glib) {
@@ -100,25 +104,27 @@ unix {
QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
LIBS +=$$QT_LIBS_GLIB
}
-
- symbian {
SOURCES += \
+ kernel/qeventdispatcher_unix.cpp
+ HEADERS += \
+ kernel/qeventdispatcher_unix_p.h
+
+ contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
+}
+
+symbian {
+ SOURCES += \
+ kernel/qcore_unix.cpp \
+ kernel/qcrashhandler.cpp \
kernel/qeventdispatcher_symbian.cpp \
kernel/qcore_symbian_p.cpp \
kernel/qsharedmemory_symbian.cpp \
kernel/qsystemsemaphore_symbian.cpp
- HEADERS += \
+
+ HEADERS += \
+ kernel/qcore_unix_p.h \
+ kernel/qcrashhandler_p.h \
kernel/qeventdispatcher_symbian_p.h \
kernel/qcore_symbian_p.h
- } else {
- SOURCES += \
- kernel/qeventdispatcher_unix.cpp \
- kernel/qsharedmemory_unix.cpp \
- kernel/qsystemsemaphore_unix.cpp
- HEADERS += \
- kernel/qeventdispatcher_unix_p.h
- }
-
- contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
}
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
index a98d005..e2682f5 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.cpp
+++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
@@ -398,20 +398,23 @@ void QAbstractEventDispatcher::closingDown()
*/
/*!
- Sets the event filter \a filter. Returns a pointer to the filter
- function previously defined.
-
- The event filter is a function that receives all messages taken
- from the system event loop before the event is dispatched to the
- respective target. This includes messages that are not sent to Qt
+ Replaces the event filter function for this
+ QAbstractEventDispatcher with \a filter and returns the replaced
+ event filter function. Only the current event filter function is
+ called. If you want to use both filter functions, save the
+ replaced EventFilter in a place where yours can call it.
+
+ The event filter function set here is called for all messages
+ taken from the system event loop before the event is dispatched to
+ the respective target, including the messages not meant for Qt
objects.
- The function can return true to stop the event to be processed by
- Qt, or false to continue with the standard event processing.
+ The event filter function should return true if the message should
+ be filtered, (i.e. stopped). It should return false to allow
+ processing the message to continue.
- Only one filter can be defined, but the filter can use the return
- value to call the previously set event filter. By default, no
- filter is set (i.e. the function returns 0).
+ By default, no event filter function is set (i.e., this function
+ returns a null EventFilter the first time it is called).
*/
QAbstractEventDispatcher::EventFilter QAbstractEventDispatcher::setEventFilter(EventFilter filter)
{
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 914f44f..1c3371f 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -1407,7 +1407,7 @@ QMap<int, QVariant> QAbstractItemModel::itemData(const QModelIndex &index) const
QMap<int, QVariant> roles;
for (int i = 0; i < Qt::UserRole; ++i) {
QVariant variantData = data(index, i);
- if (variantData.type() != QVariant::Invalid)
+ if (variantData.isValid())
roles.insert(i, variantData);
}
return roles;
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
new file mode 100644
index 0000000..c5b0fc7
--- /dev/null
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -0,0 +1,194 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcore_unix_p.h"
+
+#include <sys/select.h>
+#include <sys/time.h>
+#include <stdlib.h>
+
+#include "qeventdispatcher_unix_p.h" // for the timeval operators
+
+#if !defined(QT_NO_CLOCK_MONOTONIC)
+# if defined(QT_BOOTSTRAPPED)
+# define QT_NO_CLOCK_MONOTONIC
+# endif
+#endif
+
+QT_BEGIN_NAMESPACE
+
+static inline timeval gettime()
+{
+ timeval tv;
+#ifndef QT_NO_CLOCK_MONOTONIC
+ // use the monotonic clock
+ static volatile bool monotonicClockDisabled = false;
+ struct timespec ts;
+ if (!monotonicClockDisabled) {
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) {
+ monotonicClockDisabled = true;
+ } else {
+ tv.tv_sec = ts.tv_sec;
+ tv.tv_usec = ts.tv_nsec / 1000;
+ return tv;
+ }
+ }
+#endif
+ // use gettimeofday
+ ::gettimeofday(&tv, 0);
+ return tv;
+}
+
+static inline bool time_update(struct timeval *tv, const struct timeval &start,
+ const struct timeval &timeout)
+{
+ struct timeval now = gettime();
+ if (now < start) {
+ // clock reset, give up
+ return false;
+ }
+
+ *tv = timeout + start - now;
+ return true;
+}
+
+int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
+ const struct timeval *orig_timeout)
+{
+ if (!orig_timeout) {
+ // no timeout -> block forever
+ register int ret;
+ EINTR_LOOP(ret, select(nfds, fdread, fdwrite, fdexcept, 0));
+ return ret;
+ }
+
+ timeval start = gettime();
+ timeval timeout = *orig_timeout;
+
+ // loop and recalculate the timeout as needed
+ int ret;
+ forever {
+ ret = ::select(nfds, fdread, fdwrite, fdexcept, &timeout);
+ if (ret != -1 || errno != EINTR)
+ return ret;
+
+ // recalculate the timeout
+ if (!time_update(&timeout, start, *orig_timeout)) {
+ // clock reset, fake timeout error
+ return 0;
+ }
+ }
+}
+
+QT_END_NAMESPACE
+
+#ifdef Q_OS_LINUX
+// Don't wait for libc to supply the calls we need
+// Make syscalls directly
+
+# if defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0204
+// glibc 2.4 has syscall(...)
+# include <sys/syscall.h>
+# include <asm/unistd.h>
+# else
+// no syscall(...)
+static inline int syscall(...) { errno = ENOSYS; return -1;}
+# endif
+
+# ifndef __NR_dup3
+# if defined(__i386__)
+# define __NR_dup3 330
+# define __NR_pipe2 331
+# elif defined(__x86_64__)
+# define __NR_dup3 292
+# define __NR_pipe2 293
+# elif defined(__ia64__)
+# define __NR_dup3 1316
+# define __NR_pipe2 1317
+# else
+// set the syscalls to absurd numbers so that they'll cause ENOSYS errors
+# warning "Please port the pipe2/dup3 code to this platform"
+# define __NR_dup3 -1
+# define __NR_pipe2 -1
+# endif
+# endif
+
+# if !defined(__NR_socketcall) && !defined(__NR_accept4)
+# if defined(__x86_64__)
+# define __NR_accept4 288
+# elif defined(__ia64__)
+// not assigned yet to IA-64
+# define __NR_accept4 -1
+# else
+// set the syscalls to absurd numbers so that they'll cause ENOSYS errors
+# warning "Please port the accept4 code to this platform"
+# define __NR_accept4 -1
+# endif
+# endif
+
+QT_BEGIN_NAMESPACE
+namespace QtLibcSupplement {
+ int pipe2(int pipes[], int flags)
+ {
+ return syscall(__NR_pipe2, pipes, flags);
+ }
+
+ int dup3(int oldfd, int newfd, int flags)
+ {
+ return syscall(__NR_dup3, oldfd, newfd, flags);
+ }
+
+ int accept4(int s, sockaddr *addr, QT_SOCKLEN_T *addrlen, int flags)
+ {
+# if defined(__NR_socketcall)
+ // This platform uses socketcall() instead of raw syscalls
+ // the SYS_ACCEPT4 number is cross-platform: 18
+ return syscall(__NR_socketcall, 18, &s);
+# else
+ return syscall(__NR_accept4, s, addr, addrlen, flags);
+# endif
+
+ Q_UNUSED(addr); Q_UNUSED(addrlen); Q_UNUSED(flags); // they're actually used
+ }
+}
+QT_END_NAMESPACE
+#endif // Q_OS_LINUX
+
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
new file mode 100644
index 0000000..dd97841
--- /dev/null
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -0,0 +1,275 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCORE_UNIX_P_H
+#define QCORE_UNIX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of Qt code on Unix. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qplatformdefs.h"
+
+#ifndef Q_OS_UNIX
+# error "qcore_unix_p.h included on a non-Unix system"
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <sys/wait.h>
+#include <errno.h>
+#include <fcntl.h>
+
+struct sockaddr;
+
+#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0204
+// Linux supports thread-safe FD_CLOEXEC
+# define QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC 1
+
+// add defines for the consts for Linux
+# ifndef O_CLOEXEC
+# define O_CLOEXEC 02000000
+# endif
+# ifndef FD_DUPFD_CLOEXEC
+# define F_DUPFD_CLOEXEC 1030
+# endif
+# ifndef SOCK_CLOEXEC
+# define SOCK_CLOEXEC O_CLOEXEC
+# endif
+# ifndef SOCK_NONBLOCK
+# define SOCK_NONBLOCK O_NONBLOCK
+# endif
+# ifndef MSG_CMSG_CLOEXEC
+# define MSG_CMSG_CLOEXEC 0x40000000
+# endif
+
+QT_BEGIN_NAMESPACE
+namespace QtLibcSupplement {
+ Q_CORE_EXPORT int accept4(int, sockaddr *, QT_SOCKLEN_T *, int flags);
+ Q_CORE_EXPORT int dup3(int oldfd, int newfd, int flags);
+ Q_CORE_EXPORT int pipe2(int pipes[], int flags);
+}
+QT_END_NAMESPACE
+using namespace QT_PREPEND_NAMESPACE(QtLibcSupplement);
+
+#else
+# define QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC 0
+#endif
+
+#define EINTR_LOOP(var, cmd) \
+ do { \
+ var = cmd; \
+ } while (var == -1 && errno == EINTR)
+
+QT_BEGIN_NAMESPACE
+
+// don't call QT_OPEN or ::open
+// call qt_safe_open
+static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 0777)
+{
+#ifdef O_CLOEXEC
+ flags |= O_CLOEXEC;
+#endif
+ register int fd;
+ EINTR_LOOP(fd, QT_OPEN(pathname, flags, mode));
+
+ // unknown flags are ignored, so we have no way of verifying if
+ // O_CLOEXEC was accepted
+ if (fd != -1)
+ ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+ return fd;
+}
+#undef QT_OPEN
+#define QT_OPEN qt_safe_open
+
+// don't call ::pipe
+// call qt_safe_pipe
+static inline int qt_safe_pipe(int pipefd[2], int flags = 0)
+{
+#ifdef O_CLOEXEC
+ Q_ASSERT((flags & ~(O_CLOEXEC | O_NONBLOCK)) == 0);
+#else
+ Q_ASSERT((flags & ~O_NONBLOCK) == 0);
+#endif
+
+ register int ret;
+#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC
+ // use pipe2
+ flags |= O_CLOEXEC;
+ ret = ::pipe2(pipefd, flags); // pipe2 is Linux-specific and is documented not to return EINTR
+ if (ret == 0 || errno != ENOSYS)
+ return ret;
+#endif
+
+ ret = ::pipe(pipefd);
+ if (ret == -1)
+ return -1;
+
+ ::fcntl(pipefd[0], F_SETFD, FD_CLOEXEC);
+ ::fcntl(pipefd[1], F_SETFD, FD_CLOEXEC);
+
+ // set non-block too?
+ if (flags & O_NONBLOCK) {
+ ::fcntl(pipefd[0], F_SETFL, ::fcntl(pipefd[0], F_GETFL) | O_NONBLOCK);
+ ::fcntl(pipefd[1], F_SETFL, ::fcntl(pipefd[1], F_GETFL) | O_NONBLOCK);
+ }
+
+ return 0;
+}
+
+// don't call dup or fcntl(F_DUPFD)
+static inline int qt_safe_dup(int oldfd, int atleast = 0, int flags = FD_CLOEXEC)
+{
+ Q_ASSERT(flags == FD_CLOEXEC || flags == 0);
+
+ register int ret;
+#ifdef F_DUPFD_CLOEXEC
+ // use this fcntl
+ if (flags & FD_CLOEXEC) {
+ ret = ::fcntl(oldfd, F_DUPFD_CLOEXEC, atleast);
+ if (ret != -1 || errno != EINVAL)
+ return ret;
+ }
+#endif
+
+ // use F_DUPFD
+ ret = ::fcntl(oldfd, F_DUPFD, atleast);
+
+ if (flags && ret != -1)
+ ::fcntl(ret, F_SETFD, flags);
+ return ret;
+}
+
+// don't call dup2
+// call qt_safe_dup2
+static inline int qt_safe_dup2(int oldfd, int newfd, int flags = FD_CLOEXEC)
+{
+ Q_ASSERT(flags == FD_CLOEXEC || flags == 0);
+
+ register int ret;
+#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC
+ // use dup3
+ if (flags & FD_CLOEXEC) {
+ EINTR_LOOP(ret, ::dup3(oldfd, newfd, O_CLOEXEC));
+ if (ret == 0 || errno != ENOSYS)
+ return ret;
+ }
+#endif
+ EINTR_LOOP(ret, ::dup2(oldfd, newfd));
+ if (ret == -1)
+ return -1;
+
+ if (flags)
+ ::fcntl(newfd, F_SETFD, flags);
+ return 0;
+}
+
+static inline qint64 qt_safe_read(int fd, void *data, qint64 maxlen)
+{
+ qint64 ret = 0;
+ EINTR_LOOP(ret, QT_READ(fd, data, maxlen));
+ return ret;
+}
+#undef QT_READ
+#define QT_READ qt_safe_read
+
+static inline qint64 qt_safe_write(int fd, const void *data, qint64 len)
+{
+ qint64 ret = 0;
+ EINTR_LOOP(ret, QT_WRITE(fd, data, len));
+ return ret;
+}
+#undef QT_WRITE
+#define QT_WRITE qt_safe_write
+
+static inline int qt_safe_close(int fd)
+{
+ register int ret;
+ EINTR_LOOP(ret, QT_CLOSE(fd));
+ return ret;
+}
+#undef QT_CLOSE
+#define QT_CLOSE qt_safe_close
+
+static inline int qt_safe_execve(const char *filename, char *const argv[],
+ char *const envp[])
+{
+ register int ret;
+ EINTR_LOOP(ret, ::execve(filename, argv, envp));
+ return ret;
+}
+
+static inline int qt_safe_execv(const char *path, char *const argv[])
+{
+ register int ret;
+ EINTR_LOOP(ret, ::execv(path, argv));
+ return ret;
+}
+
+static inline int qt_safe_execvp(const char *file, char *const argv[])
+{
+ register int ret;
+ EINTR_LOOP(ret, ::execvp(file, argv));
+ return ret;
+}
+
+static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
+{
+ register int ret;
+ EINTR_LOOP(ret, ::waitpid(pid, status, options));
+ return ret;
+}
+
+Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
+ const struct timeval *tv);
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index c07a6e9..5865dc3 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1729,6 +1729,12 @@ QString QCoreApplication::translate(const char *context, const char *sourceText,
return result;
}
+// Declared in qglobal.h
+QString qtTrId(const char *id, int n)
+{
+ return QCoreApplication::translate(0, id, 0, QCoreApplication::UnicodeUTF8, n);
+}
+
bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator)
{
return QCoreApplication::self
@@ -1824,21 +1830,8 @@ QString QCoreApplication::applicationFilePath()
if (!d->cachedApplicationFilePath.isNull())
return d->cachedApplicationFilePath;
-#if defined( Q_WS_WIN )
- QFileInfo filePath;
- QT_WA({
- wchar_t module_name[MAX_PATH+1];
- GetModuleFileNameW(0, module_name, MAX_PATH);
- module_name[MAX_PATH] = 0;
- filePath = QString::fromUtf16((ushort *)module_name);
- }, {
- char module_name[MAX_PATH+1];
- GetModuleFileNameA(0, module_name, MAX_PATH);
- module_name[MAX_PATH] = 0;
- filePath = QString::fromLocal8Bit(module_name);
- });
-
- d->cachedApplicationFilePath = filePath.filePath();
+#if defined(Q_WS_WIN)
+ d->cachedApplicationFilePath = QFileInfo(qAppFileName()).filePath();
return d->cachedApplicationFilePath;
#elif defined(Q_WS_MAC)
QString qAppFileName_str = qAppFileName();
@@ -1998,13 +1991,13 @@ QStringList QCoreApplication::arguments()
return list;
}
#ifdef Q_OS_WIN
- QString cmdline = QT_WA_INLINE(QString::fromUtf16((unsigned short *)GetCommandLineW()), QString::fromLocal8Bit(GetCommandLineA()));
+ QString cmdline = QString::fromWCharArray(GetCommandLine());
#if defined(Q_OS_WINCE)
wchar_t tempFilename[MAX_PATH+1];
- if (GetModuleFileNameW(0, tempFilename, MAX_PATH)) {
+ if (GetModuleFileName(0, tempFilename, MAX_PATH)) {
tempFilename[MAX_PATH] = 0;
- cmdline.prepend(QLatin1Char('\"') + QString::fromUtf16((unsigned short *)tempFilename) + QLatin1String("\" "));
+ cmdline.prepend(QLatin1Char('\"') + QString::fromWCharArray(tempFilename) + QLatin1String("\" "));
}
#endif // Q_OS_WINCE
@@ -2311,21 +2304,37 @@ void QCoreApplication::removeLibraryPath(const QString &path)
/*!
\fn EventFilter QCoreApplication::setEventFilter(EventFilter filter)
- Sets the event filter \a filter. Returns a pointer to the filter
- function previously defined.
-
- The event filter is a function that is called for every message
- received in all threads. This does \e not include messages to
+ Replaces the event filter function for the QCoreApplication with
+ \a filter and returns the pointer to the replaced event filter
+ function. Only the current event filter function is called. If you
+ want to use both filter functions, save the replaced EventFilter
+ in a place where yours can call it.
+
+ The event filter function set here is called for all messages
+ received by all threads meant for all Qt objects. It is \e not
+ called for messages that are not meant for Qt objects.
+
+ The event filter function should return true if the message should
+ be filtered, (i.e. stopped). It should return false to allow
+ processing the message to continue.
+
+ By default, no event filter function is set (i.e., this function
+ returns a null EventFilter the first time it is called).
+
+ \note The filter function set here receives native messages,
+ i.e. MSG or XEvent structs, that are going to Qt objects. It is
+ called by QCoreApplication::filterEvent(). If the filter function
+ returns false to indicate the message should be processed further,
+ the native message can then be translated into a QEvent and
+ handled by the standard Qt \l{QEvent} {event} filering, e.g.
+ QObject::installEventFilter().
+
+ \note The filter function set here is different form the filter
+ function set via QAbstractEventDispatcher::setEventFilter(), which
+ gets all messages received by its thread, even messages meant for
objects that are not handled by Qt.
- The function can return true to stop the event to be processed by
- Qt, or false to continue with the standard event processing.
-
- Only one filter can be defined, but the filter can use the return
- value to call the previously set event filter. By default, no
- filter is set (i.e., the function returns 0).
-
- \sa installEventFilter()
+ \sa QObject::installEventFilter(), QAbstractEventDispatcher::setEventFilter()
*/
QCoreApplication::EventFilter
QCoreApplication::setEventFilter(QCoreApplication::EventFilter filter)
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 7a35340..bf5716a 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -45,14 +45,15 @@
#include "qt_windows.h"
#include "qvector.h"
#include "qmutex.h"
+#include "qfileinfo.h"
#include "qcorecmdlineargs_p.h"
#include <private/qthread_p.h>
#include <ctype.h>
QT_BEGIN_NAMESPACE
-char appFileName[MAX_PATH+1]; // application file name
-char theAppName[MAX_PATH+1]; // application name
+char appFileName[MAX_PATH]; // application file name
+char theAppName[MAX_PATH]; // application name
HINSTANCE appInst = 0; // handle to app instance
HINSTANCE appPrevInst = 0; // handle to prev app instance
int appCmdShow = 0;
@@ -73,48 +74,69 @@ Q_CORE_EXPORT int qWinAppCmdShow() // get main window sho
return appCmdShow;
}
+Q_CORE_EXPORT QString qAppFileName() // get application file name
+{
+ // We do MAX_PATH + 2 here, and request with MAX_PATH + 1, so we can handle all paths
+ // up to, and including MAX_PATH size perfectly fine with string termination, as well
+ // as easily detect if the file path is indeed larger than MAX_PATH, in which case we
+ // need to use the heap instead. This is a work-around, since contrary to what the
+ // MSDN documentation states, GetModuleFileName sometimes doesn't set the
+ // ERROR_INSUFFICIENT_BUFFER error number, and we thus cannot rely on this value if
+ // GetModuleFileName(0, buffer, MAX_PATH) == MAX_PATH.
+ // GetModuleFileName(0, buffer, MAX_PATH + 1) == MAX_PATH just means we hit the normal
+ // file path limit, and we handle it normally, if the result is MAX_PATH + 1, we use
+ // heap (even if the result _might_ be exactly MAX_PATH + 1, but that's ok).
+ wchar_t buffer[MAX_PATH + 2];
+ DWORD v = GetModuleFileName(0, buffer, MAX_PATH + 1);
+ buffer[MAX_PATH + 1] = 0;
+
+ if (v == 0)
+ return QString();
+ else if (v <= MAX_PATH)
+ return QString::fromWCharArray(buffer);
+
+ // MAX_PATH sized buffer wasn't large enough to contain the full path, use heap
+ wchar_t *b = 0;
+ int i = 1;
+ size_t size;
+ do {
+ ++i;
+ size = MAX_PATH * i;
+ b = reinterpret_cast<wchar_t *>(realloc(b, (size + 1) * sizeof(wchar_t)));
+ if (b)
+ v = GetModuleFileName(NULL, b, size);
+ } while (b && v == size);
+
+ if (b)
+ *(b + size) = 0;
+ QString res = QString::fromWCharArray(b);
+ free(b);
+
+ return res;
+}
void set_winapp_name()
{
static bool already_set = false;
if (!already_set) {
already_set = true;
-#ifndef Q_OS_WINCE
- GetModuleFileNameA(0, appFileName, sizeof(appFileName));
- appFileName[sizeof(appFileName)-1] = 0;
-#else
- QString afm;
- afm.resize(sizeof(appFileName));
- afm.resize(GetModuleFileName(0, (wchar_t *) (afm.unicode()), sizeof(appFileName)));
- memcpy(appFileName, afm.toLatin1(), sizeof(appFileName));
-#endif
- const char *p = strrchr(appFileName, '\\'); // skip path
- if (p)
- memcpy(theAppName, p+1, qstrlen(p));
- int l = qstrlen(theAppName);
- if ((l > 4) && !qstricmp(theAppName + l - 4, ".exe"))
- theAppName[l-4] = '\0'; // drop .exe extension
-
- if (appInst == 0) {
- QT_WA({
- appInst = GetModuleHandle(0);
- }, {
- appInst = GetModuleHandleA(0);
- });
- }
- }
-}
-Q_CORE_EXPORT QString qAppFileName() // get application file name
-{
- return QString::fromLatin1(appFileName);
+ QString moduleName = qAppFileName();
+
+ QByteArray filePath = moduleName.toLocal8Bit();
+ QByteArray fileName = QFileInfo(moduleName).baseName().toLocal8Bit();
+
+ memcpy(appFileName, filePath.constData(), filePath.length());
+ memcpy(theAppName, fileName.constData(), fileName.length());
+
+ if (appInst == 0)
+ appInst = GetModuleHandle(0);
+ }
}
QString QCoreApplicationPrivate::appName() const
{
- if (!theAppName[0])
- set_winapp_name();
- return QString::fromLatin1(theAppName);
+ return QFileInfo(qAppFileName()).baseName();
}
class QWinMsgHandlerCriticalSection
@@ -145,15 +167,11 @@ Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char* str)
str = "(null)";
staticCriticalSection.lock();
- QT_WA({
- QString s(QString::fromLocal8Bit(str));
- s += QLatin1Char('\n');
- OutputDebugStringW((TCHAR*)s.utf16());
- }, {
- QByteArray s(str);
- s += '\n';
- OutputDebugStringA(s.data());
- })
+
+ QString s(QString::fromLocal8Bit(str));
+ s += QLatin1Char('\n');
+ OutputDebugString((wchar_t*)s.utf16());
+
staticCriticalSection.unlock();
}
@@ -262,7 +280,7 @@ QT_END_INCLUDE_NAMESPACE
// The values below should never change. Note that none of the usual
// WM_...FIRST & WM_...LAST values are in the list, as they normally have other
// WM_... representations
-struct {
+struct KnownWM {
uint WM;
const char* str;
} knownWM[] =
@@ -564,7 +582,7 @@ struct {
{ 0,0 }}; // End of known messages
// Looks up the WM_ message in the table above
-const char* findWMstr(uint msg)
+static const char* findWMstr(uint msg)
{
uint i = 0;
const char* result = 0;
diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h
index c0dd813..a012b4e 100644
--- a/src/corelib/kernel/qcorecmdlineargs_p.h
+++ b/src/corelib/kernel/qcorecmdlineargs_p.h
@@ -135,9 +135,9 @@ static inline QStringList qWinCmdArgs(QString cmdLine) // not const-ref: this mi
QStringList args;
int argc = 0;
- QVector<ushort*> argv = qWinCmdLine<ushort>((ushort*)cmdLine.utf16(), cmdLine.length(), argc);
+ QVector<wchar_t*> argv = qWinCmdLine<wchar_t>((wchar_t *)cmdLine.utf16(), cmdLine.length(), argc);
for (int a = 0; a < argc; ++a) {
- args << QString::fromUtf16(argv[a]);
+ args << QString::fromWCharArray(argv[a]);
}
return args;
@@ -147,10 +147,7 @@ static inline QStringList qCmdLineArgs(int argc, char *argv[])
{
Q_UNUSED(argc)
Q_UNUSED(argv)
- QString cmdLine = QT_WA_INLINE(
- QString::fromUtf16((unsigned short*)GetCommandLineW()),
- QString::fromLocal8Bit(GetCommandLineA())
- );
+ QString cmdLine = QString::fromWCharArray(GetCommandLine());
return qWinCmdArgs(cmdLine);
}
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 0ffd6f7..3cb8fe6 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -221,14 +221,13 @@ QT_BEGIN_NAMESPACE
\value WindowStateChange The \l{QWidget::windowState()}{window's state} (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent).
\value WindowTitleChange The window title has changed.
\value WindowUnblocked The window is unblocked after a modal dialog exited.
+ \value Wrapped The event is a wrapper for, i.e., contains, another event (QWrappedEvent).
\value ZOrderChange The widget's z-order has changed. This event is never sent to top level windows.
\value KeyboardLayoutChange The keyboard layout has changed.
\value DynamicPropertyChange A dynamic property was added, changed or removed from the object.
\value TouchBegin Beginning of a sequence of touch-screen and/or track-pad events (QTouchEvent)
\value TouchUpdate Touch-screen event (QTouchEvent)
\value TouchEnd End of touch-event sequence (QTouchEvent)
- \value Gesture A gesture has occured.
- \value GraphicsSceneGesture A gesture has occured on a graphics scene.
User events should have values between \c User and \c{MaxUser}:
@@ -271,9 +270,9 @@ QT_BEGIN_NAMESPACE
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
\omitvalue CocoaRequestModal
- \omitvalue Wrapped
\omitvalue Signal
\omitvalue SymbianDeferredFocusChanged
+ \omitvalue WinGesture
*/
/*!
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index efa9fd3..c361fd5 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -276,8 +276,7 @@ public:
TouchUpdate = 195,
TouchEnd = 196,
- Gesture = 197,
- GraphicsSceneGesture = 198,
+ WinGesture = 197,
RequestSoftwareInputPanel = 199,
CloseSoftwareInputPanel = 200,
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 67f2cd0..288b381 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -49,6 +49,7 @@
#include "qeventdispatcher_unix_p.h"
#include <private/qthread_p.h>
#include <private/qcoreapplication_p.h>
+#include <private/qcore_unix_p.h>
#include <errno.h>
#include <stdio.h>
@@ -58,10 +59,33 @@
# include <sys/times.h>
#endif
+#ifdef Q_OS_MAC
+#include <mach/mach_time.h>
+#endif
+
QT_BEGIN_NAMESPACE
Q_CORE_EXPORT bool qt_disable_lowpriority_timers=false;
+// check for _POSIX_MONOTONIC_CLOCK support
+static bool supportsMonotonicClock()
+{
+ bool returnValue;
+
+#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC)
+ returnValue = false;
+# if (_POSIX_MONOTONIC_CLOCK == 0)
+ // detect if the system support monotonic timers
+ long x = sysconf(_SC_MONOTONIC_CLOCK);
+ returnValue = x >= 200112L;
+# endif
+#else
+ returnValue = true;
+#endif
+
+ return returnValue;
+}
+
/*****************************************************************************
UNIX signal handling
*****************************************************************************/
@@ -76,6 +100,7 @@ static void signalHandler(int sig)
}
+#ifdef Q_OS_INTEGRITY
static void initThreadPipeFD(int fd)
{
int ret = fcntl(fd, F_SETFD, FD_CLOEXEC);
@@ -90,7 +115,7 @@ static void initThreadPipeFD(int fd)
if (ret == -1)
perror("QEventDispatcherUNIXPrivate: Unable to set flags on thread pipe");
}
-
+#endif
QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate()
{
@@ -102,13 +127,13 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate()
// INTEGRITY doesn't like a "select" on pipes, so use socketpair instead
if (socketpair(AF_INET, SOCK_STREAM, PF_INET, thread_pipe) == -1)
perror("QEventDispatcherUNIXPrivate(): Unable to create socket pair");
-#else
- if (pipe(thread_pipe) == -1)
- perror("QEventDispatcherUNIXPrivate(): Unable to create thread pipe");
-#endif
initThreadPipeFD(thread_pipe[0]);
initThreadPipeFD(thread_pipe[1]);
+#else
+ if (qt_safe_pipe(thread_pipe, O_NONBLOCK) == -1)
+ perror("QEventDispatcherUNIXPrivate(): Unable to create thread pipe");
+#endif
sn_highest = -1;
@@ -256,18 +281,11 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags,
*/
QTimerInfoList::QTimerInfoList()
+ : useMonotonicTimers(supportsMonotonicClock())
{
-#if (_POSIX_MONOTONIC_CLOCK-0 <= 0)
- useMonotonicTimers = false;
-
-# if (_POSIX_MONOTONIC_CLOCK == 0)
- // detect if the system support monotonic timers
- long x = sysconf(_SC_MONOTONIC_CLOCK);
- useMonotonicTimers = x != -1;
-# endif
-
getTime(currentTime);
+#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC)
if (!useMonotonicTimers) {
// not using monotonic timers, initialize the timeChanged() machinery
previousTime = currentTime;
@@ -284,9 +302,6 @@ QTimerInfoList::QTimerInfoList()
ticksPerSecond = 0;
msPerTick = 0;
}
-#else
- // using monotonic timers unconditionally
- getTime(currentTime);
#endif
firstTimerInfo = currentTimerInfo = 0;
@@ -298,7 +313,21 @@ timeval QTimerInfoList::updateCurrentTime()
return currentTime;
}
-#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED)
+#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC)) || defined(QT_BOOTSTRAPPED)
+
+template <>
+timeval qAbs(const timeval &t)
+{
+ timeval tmp = t;
+ if (tmp.tv_sec < 0) {
+ tmp.tv_sec = -tmp.tv_sec - 1;
+ tmp.tv_usec -= 1000000;
+ }
+ if (tmp.tv_sec == 0 && tmp.tv_usec < 0) {
+ tmp.tv_usec = -tmp.tv_usec;
+ }
+ return normalizedTimeval(tmp);
+}
/*
Returns true if the real time clock has changed by more than 10%
@@ -312,23 +341,27 @@ bool QTimerInfoList::timeChanged(timeval *delta)
tms unused;
clock_t currentTicks = times(&unused);
- int elapsedTicks = currentTicks - previousTicks;
+ clock_t elapsedTicks = currentTicks - previousTicks;
timeval elapsedTime = currentTime - previousTime;
- int elapsedMsecTicks = (elapsedTicks * 1000) / ticksPerSecond;
- int deltaMsecs = (elapsedTime.tv_sec * 1000 + elapsedTime.tv_usec / 1000)
- - elapsedMsecTicks;
- if (delta) {
- delta->tv_sec = deltaMsecs / 1000;
- delta->tv_usec = (deltaMsecs % 1000) * 1000;
- }
+ timeval elapsedTimeTicks;
+ elapsedTimeTicks.tv_sec = elapsedTicks / ticksPerSecond;
+ elapsedTimeTicks.tv_usec = (((elapsedTicks * 1000) / ticksPerSecond) % 1000) * 1000;
+
+ timeval dummy;
+ if (!delta)
+ delta = &dummy;
+ *delta = elapsedTime - elapsedTimeTicks;
+
previousTicks = currentTicks;
previousTime = currentTime;
// If tick drift is more than 10% off compared to realtime, we assume that the clock has
// been set. Of course, we have to allow for the tick granularity as well.
-
- return (qAbs(deltaMsecs) - msPerTick) * 10 > elapsedMsecTicks;
+ timeval tickGranularity;
+ tickGranularity.tv_sec = 0;
+ tickGranularity.tv_usec = msPerTick * 1000;
+ return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10);
}
void QTimerInfoList::getTime(timeval &t)
@@ -373,10 +406,21 @@ void QTimerInfoList::repairTimersIfNeeded()
void QTimerInfoList::getTime(timeval &t)
{
+#if defined(Q_OS_MAC)
+ static mach_timebase_info_data_t info = {0,0};
+ if (info.denom == 0)
+ mach_timebase_info(&info);
+
+ uint64_t cpu_time = mach_absolute_time();
+ uint64_t nsecs = cpu_time * (info.numer / info.denom);
+ t.tv_sec = nsecs * 1e-9;
+ t.tv_usec = nsecs * 1e-3 - (t.tv_sec * 1e6);
+#else
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
t.tv_sec = ts.tv_sec;
t.tv_usec = ts.tv_nsec / 1000;
+#endif
}
void QTimerInfoList::repairTimersIfNeeded()
@@ -407,7 +451,7 @@ void QTimerInfoList::timerRepair(const timeval &diff)
// repair all timers
for (int i = 0; i < size(); ++i) {
register QTimerInfo *t = at(i);
- t->timeout = t->timeout - diff;
+ t->timeout = t->timeout + diff;
}
}
@@ -608,7 +652,7 @@ int QEventDispatcherUNIX::select(int nfds, fd_set *readfds, fd_set *writefds, fd
timeval *timeout)
{
Q_D(QEventDispatcherUNIX);
- if (timeout) {
+ if (timeout && d->timerList.useMonotonicTimers) {
// handle the case where select returns with a timeout, too
// soon.
timeval tvStart = d->timerList.currentTime;
diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h
index e0ac5da..88d645e 100644
--- a/src/corelib/kernel/qeventdispatcher_unix_p.h
+++ b/src/corelib/kernel/qeventdispatcher_unix_p.h
@@ -72,6 +72,18 @@ QT_BEGIN_NAMESPACE
#endif
// Internal operator functions for timevals
+inline timeval &normalizedTimeval(timeval &t)
+{
+ while (t.tv_usec > 1000000l) {
+ ++t.tv_sec;
+ t.tv_usec -= 1000000l;
+ }
+ while (t.tv_usec < 0l) {
+ --t.tv_sec;
+ t.tv_usec += 1000000l;
+ }
+ return t;
+}
inline bool operator<(const timeval &t1, const timeval &t2)
{ return t1.tv_sec < t2.tv_sec || (t1.tv_sec == t2.tv_sec && t1.tv_usec < t2.tv_usec); }
inline bool operator==(const timeval &t1, const timeval &t2)
@@ -79,31 +91,29 @@ inline bool operator==(const timeval &t1, const timeval &t2)
inline timeval &operator+=(timeval &t1, const timeval &t2)
{
t1.tv_sec += t2.tv_sec;
- if ((t1.tv_usec += t2.tv_usec) >= 1000000l) {
- ++t1.tv_sec;
- t1.tv_usec -= 1000000l;
- }
- return t1;
+ t1.tv_usec += t2.tv_usec;
+ return normalizedTimeval(t1);
}
inline timeval operator+(const timeval &t1, const timeval &t2)
{
timeval tmp;
tmp.tv_sec = t1.tv_sec + t2.tv_sec;
- if ((tmp.tv_usec = t1.tv_usec + t2.tv_usec) >= 1000000l) {
- ++tmp.tv_sec;
- tmp.tv_usec -= 1000000l;
- }
- return tmp;
+ tmp.tv_usec = t1.tv_usec + t2.tv_usec;
+ return normalizedTimeval(tmp);
}
inline timeval operator-(const timeval &t1, const timeval &t2)
{
timeval tmp;
- tmp.tv_sec = t1.tv_sec - t2.tv_sec;
- if ((tmp.tv_usec = t1.tv_usec - t2.tv_usec) < 0l) {
- --tmp.tv_sec;
- tmp.tv_usec += 1000000l;
- }
- return tmp;
+ tmp.tv_sec = t1.tv_sec - (t2.tv_sec - 1);
+ tmp.tv_usec = t1.tv_usec - (t2.tv_usec + 1000000);
+ return normalizedTimeval(tmp);
+}
+inline timeval operator*(const timeval &t1, int mul)
+{
+ timeval tmp;
+ tmp.tv_sec = t1.tv_sec * mul;
+ tmp.tv_usec = t1.tv_usec * mul;
+ return normalizedTimeval(tmp);
}
// internal timer info
@@ -117,9 +127,7 @@ struct QTimerInfo {
class QTimerInfoList : public QList<QTimerInfo*>
{
-#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED)
- bool useMonotonicTimers;
-
+#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC)) || defined(QT_BOOTSTRAPPED)
timeval previousTime;
clock_t previousTicks;
int ticksPerSecond;
@@ -134,6 +142,8 @@ class QTimerInfoList : public QList<QTimerInfo*>
public:
QTimerInfoList();
+ const bool useMonotonicTimers;
+
void getTime(timeval &t);
timeval currentTime;
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index cb1549c..33b66f5 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -355,8 +355,7 @@ QEventDispatcherWin32Private::QEventDispatcherWin32Private()
{
resolveTimerAPI();
- wakeUpNotifier.setHandle(QT_WA_INLINE(CreateEventW(0, FALSE, FALSE, 0),
- CreateEventA(0, FALSE, FALSE, 0)));
+ wakeUpNotifier.setHandle(CreateEvent(0, FALSE, FALSE, 0));
if (!wakeUpNotifier.handle())
qWarning("QEventDispatcher: Creating QEventDispatcherWin32Private wakeup event failed");
}
@@ -367,13 +366,8 @@ QEventDispatcherWin32Private::~QEventDispatcherWin32Private()
CloseHandle(wakeUpNotifier.handle());
if (internalHwnd)
DestroyWindow(internalHwnd);
- QByteArray className = "QEventDispatcherWin32_Internal_Widget" + QByteArray::number(quintptr(qt_internal_proc));
-#if !defined(Q_OS_WINCE)
- UnregisterClassA(className.constData(), qWinAppInst());
-#else
- UnregisterClassW(reinterpret_cast<const wchar_t *> (QString::fromLatin1(className.constData()).utf16())
- , qWinAppInst());
-#endif
+ QString className = QLatin1String("QEventDispatcherWin32_Internal_Widget") + QString::number(quintptr(qt_internal_proc));
+ UnregisterClass((wchar_t*)className.utf16(), qWinAppInst());
}
void QEventDispatcherWin32Private::activateEventNotifier(QWinEventNotifier * wen)
@@ -382,18 +376,24 @@ void QEventDispatcherWin32Private::activateEventNotifier(QWinEventNotifier * wen
QCoreApplication::sendEvent(wen, &event);
}
-
+// ### Qt 5: remove
Q_CORE_EXPORT bool winPeekMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin,
UINT wMsgFilterMax, UINT wRemoveMsg)
{
- QT_WA({ return PeekMessage(msg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg); } ,
- { return PeekMessageA(msg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg); });
+ return PeekMessage(msg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
}
+// ### Qt 5: remove
Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- QT_WA({ return PostMessage(hWnd, msg, wParam, lParam); } ,
- { return PostMessageA(hWnd, msg, wParam, lParam); });
+ return PostMessage(hWnd, msg, wParam, lParam);
+}
+
+// ### Qt 5: remove
+Q_CORE_EXPORT bool winGetMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin,
+ UINT wMsgFilterMax)
+{
+ return GetMessage(msg, hWnd, wMsgFilterMin, wMsgFilterMax);
}
// This function is called by a workerthread
@@ -443,10 +443,10 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
#ifdef GWLP_USERDATA
QEventDispatcherWin32 *eventDispatcher =
- (QEventDispatcherWin32 *) GetWindowLongPtrA(hwnd, GWLP_USERDATA);
+ (QEventDispatcherWin32 *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
#else
QEventDispatcherWin32 *eventDispatcher =
- (QEventDispatcherWin32 *) GetWindowLongA(hwnd, GWL_USERDATA);
+ (QEventDispatcherWin32 *) GetWindowLong(hwnd, GWL_USERDATA);
#endif
if (eventDispatcher) {
QEventDispatcherWin32Private *d = eventDispatcher->d_func();
@@ -494,54 +494,35 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher)
{
- HINSTANCE hi = qWinAppInst();
-#if defined(Q_OS_WINCE)
+ // make sure that multiple Qt's can coexist in the same process
+ QString className = QLatin1String("QEventDispatcherWin32_Internal_Widget") + QString::number(quintptr(qt_internal_proc));
+
WNDCLASS wc;
-#else
- WNDCLASSA wc;
-#endif
wc.style = 0;
wc.lpfnWndProc = qt_internal_proc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
- wc.hInstance = hi;
+ wc.hInstance = qWinAppInst();
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground = 0;
wc.lpszMenuName = NULL;
+ wc.lpszClassName = reinterpret_cast<const wchar_t *> (className.utf16());
- // make sure that multiple Qt's can coexist in the same process
- QByteArray className = "QEventDispatcherWin32_Internal_Widget" + QByteArray::number(quintptr(qt_internal_proc));
-#if defined(Q_OS_WINCE)
- QString tmp = QString::fromLatin1(className.data());
- wc.lpszClassName = reinterpret_cast<const wchar_t *> (tmp.utf16());
RegisterClass(&wc);
HWND wnd = CreateWindow(wc.lpszClassName, // classname
- wc.lpszClassName, // window name
- 0, // style
- 0, 0, 0, 0, // geometry
- 0, // parent
- 0, // menu handle
- hi, // application
- 0); // windows creation data.
-#else
- wc.lpszClassName = className.constData();
- RegisterClassA(&wc);
- HWND wnd = CreateWindowA(wc.lpszClassName, // classname
- wc.lpszClassName, // window name
- 0, // style
- 0, 0, 0, 0, // geometry
- 0, // parent
- 0, // menu handle
- hi, // application
- 0); // windows creation data.
-#endif
-
+ wc.lpszClassName, // window name
+ 0, // style
+ 0, 0, 0, 0, // geometry
+ 0, // parent
+ 0, // menu handle
+ qWinAppInst(), // application
+ 0); // windows creation data.
#ifdef GWLP_USERDATA
- SetWindowLongPtrA(wnd, GWLP_USERDATA, (LONG_PTR)eventDispatcher);
+ SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)eventDispatcher);
#else
- SetWindowLongA(wnd, GWL_USERDATA, (LONG)eventDispatcher);
+ SetWindowLong(wnd, GWL_USERDATA, (LONG)eventDispatcher);
#endif
if (!wnd) {
@@ -690,7 +671,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
haveMessage = true;
msg = d->queuedSocketEvents.takeFirst();
} else {
- haveMessage = winPeekMessage(&msg, 0, 0, 0, PM_REMOVE);
+ haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
if (haveMessage && (flags & QEventLoop::ExcludeUserInputEvents)
&& ((msg.message >= WM_KEYFIRST
&& msg.message <= WM_KEYLAST)
@@ -738,11 +719,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
if (!filterEvent(&msg)) {
TranslateMessage(&msg);
- QT_WA({
- DispatchMessage(&msg);
- } , {
- DispatchMessageA(&msg);
- });
+ DispatchMessage(&msg);
}
} else if (waitRet >= WAIT_OBJECT_0 && waitRet < WAIT_OBJECT_0 + nCount) {
d->activateEventNotifier(d->winEventNotifierList.at(waitRet - WAIT_OBJECT_0));
@@ -781,7 +758,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
bool QEventDispatcherWin32::hasPendingEvents()
{
MSG msg;
- return qGlobalPostedEventsCount() || winPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
+ return qGlobalPostedEventsCount() || PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
}
void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp
index 2c47adb..5680ad5 100644
--- a/src/corelib/kernel/qfunctions_wince.cpp
+++ b/src/corelib/kernel/qfunctions_wince.cpp
@@ -108,7 +108,7 @@ int qt_wince__getdrive( void )
return 1;
}
-int qt_wince__waccess( const WCHAR *path, int pmode )
+int qt_wince__waccess( const wchar_t *path, int pmode )
{
DWORD res = GetFileAttributes( path );
if ( 0xFFFFFFFF == res )
@@ -118,7 +118,7 @@ int qt_wince__waccess( const WCHAR *path, int pmode )
return -1;
if ( (pmode & X_OK) && !(res & FILE_ATTRIBUTE_DIRECTORY) ) {
- QString file = QString::fromUtf16(reinterpret_cast<const ushort *> (path));
+ QString file = QString::fromWCharArray(path);
if ( !(file.endsWith(QString::fromLatin1(".exe")) ||
file.endsWith(QString::fromLatin1(".com"))) )
return -1;
@@ -130,12 +130,12 @@ int qt_wince__waccess( const WCHAR *path, int pmode )
int qt_wince_open( const char *filename, int oflag, int pmode )
{
QString fn( QString::fromLatin1(filename) );
- return _wopen( (WCHAR*)fn.utf16(), oflag, pmode );
+ return _wopen( (wchar_t*)fn.utf16(), oflag, pmode );
}
-int qt_wince__wopen( const WCHAR *filename, int oflag, int /*pmode*/ )
+int qt_wince__wopen( const wchar_t *filename, int oflag, int /*pmode*/ )
{
- WCHAR *flag;
+ wchar_t *flag;
if ( oflag & _O_APPEND ) {
if ( oflag & _O_WRONLY ) {
@@ -290,7 +290,7 @@ bool qt_wince__chmod(const char *file, int mode)
return _wchmod( reinterpret_cast<const wchar_t *> (QString::fromLatin1(file).utf16()), mode);
}
-bool qt_wince__wchmod(const WCHAR *file, int mode)
+bool qt_wince__wchmod(const wchar_t *file, int mode)
{
// ### Does not work properly, what about just adding one property?
if(mode&_S_IWRITE) {
diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h
index 307e17b..41cb641 100644
--- a/src/corelib/kernel/qfunctions_wince.h
+++ b/src/corelib/kernel/qfunctions_wince.h
@@ -175,8 +175,8 @@ typedef int mode_t;
extern int errno;
int qt_wince__getdrive( void );
-int qt_wince__waccess( const WCHAR *path, int pmode );
-int qt_wince__wopen( const WCHAR *filename, int oflag, int pmode );
+int qt_wince__waccess( const wchar_t *path, int pmode );
+int qt_wince__wopen( const wchar_t *filename, int oflag, int pmode );
long qt_wince__lseek( int handle, long offset, int origin );
int qt_wince__read( int handle, void *buffer, unsigned int count );
int qt_wince__write( int handle, const void *buffer, unsigned int count );
@@ -204,7 +204,7 @@ int qt_wince_SetErrorMode(int);
#endif
bool qt_wince__chmod(const char *file, int mode);
-bool qt_wince__wchmod(const WCHAR *file, int mode);
+bool qt_wince__wchmod(const wchar_t *file, int mode);
#pragma warning(disable: 4273)
HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index 348957f..7a77d56 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -132,6 +132,10 @@ inline qreal qPow(qreal x, qreal y)
return pow(x, y);
}
+#ifndef M_PI
+#define M_PI (3.14159265358979323846)
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 215f6ae..08cecaf 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -2136,8 +2136,15 @@ QVariant QMetaProperty::read(const QObject *object) const
return QVariant();
}
}
+
+ // the status variable is changed by qt_metacall to indicate what it did
+ // this feature is currently only used by QtDBus and should not be depended
+ // upon. Don't change it without looking into QDBusAbstractInterface first
+ // -1 (unchanged): normal qt_metacall, result stored in argv[0]
+ // changed: result stored directly in value
+ int status = -1;
QVariant value;
- void *argv[2] = { 0, &value };
+ void *argv[] = { 0, &value, &status };
if (t == QVariant::LastType) {
argv[0] = &value;
} else {
@@ -2147,8 +2154,8 @@ QVariant QMetaProperty::read(const QObject *object) const
const_cast<QObject*>(object)->qt_metacall(QMetaObject::ReadProperty,
idx + mobj->propertyOffset(),
argv);
- if (argv[1] == 0)
- // "value" was changed
+
+ if (status != -1)
return value;
if (t != QVariant::LastType && argv[0] != value.data())
// pointer or reference
@@ -2206,13 +2213,19 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
return false;
}
- void *argv[2] = { 0, &v };
+ // the status variable is changed by qt_metacall to indicate what it did
+ // this feature is currently only used by QtDBus and should not be depended
+ // upon. Don't change it without looking into QDBusAbstractInterface first
+ // -1 (unchanged): normal qt_metacall, result stored in argv[0]
+ // changed: result stored directly in value, return the value of status
+ int status = -1;
+ void *argv[] = { 0, &v, &status };
if (t == QVariant::LastType)
argv[0] = &v;
else
argv[0] = v.data();
object->qt_metacall(QMetaObject::WriteProperty, idx + mobj->propertyOffset(), argv);
- return true;
+ return status;
}
/*!
@@ -2291,6 +2304,8 @@ QMetaMethod QMetaProperty::notifySignal() const
}
/*!
+ \since 4.6
+
Returns the index of the property change notifying signal if one was
specified, otherwise returns -1.
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 91266db..bd27ec2 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -171,6 +171,11 @@ QT_BEGIN_NAMESPACE
\value QBitmap QBitmap
\value QMatrix QMatrix
\value QTransform QTransform
+ \value QMatrix4x4 QMatrix4x4
+ \value QVector2D QVector2D
+ \value QVector3D QVector3D
+ \value QVector4D QVector4D
+ \value QQuaternion QQuaternion
\value User Base value for user types
@@ -272,6 +277,11 @@ static const struct { const char * typeName; int type; } types[] = {
{"QTextFormat", QMetaType::QTextFormat},
{"QMatrix", QMetaType::QMatrix},
{"QTransform", QMetaType::QTransform},
+ {"QMatrix4x4", QMetaType::QMatrix4x4},
+ {"QVector2D", QMetaType::QVector2D},
+ {"QVector3D", QMetaType::QVector3D},
+ {"QVector4D", QMetaType::QVector4D},
+ {"QQuaternion", QMetaType::QQuaternion},
/* All Metatype builtins */
{"void*", QMetaType::VoidStar},
@@ -430,16 +440,15 @@ int QMetaType::registerType(const char *typeName, Destructor destructor,
#endif
QWriteLocker locker(customTypesLock());
- static int currentIdx = User;
int idx = qMetaTypeType_unlocked(normalizedTypeName);
if (!idx) {
- idx = currentIdx++;
- ct->resize(ct->count() + 1);
- QCustomTypeInfo &inf = (*ct)[idx - User];
+ QCustomTypeInfo inf;
inf.typeName = normalizedTypeName;
inf.constr = constructor;
inf.destr = destructor;
+ idx = ct->size() + User;
+ ct->append(inf);
}
return idx;
}
@@ -671,6 +680,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
case QMetaType::QTextFormat:
case QMetaType::QMatrix:
case QMetaType::QTransform:
+ case QMetaType::QMatrix4x4:
+ case QMetaType::QVector2D:
+ case QMetaType::QVector3D:
+ case QMetaType::QVector4D:
+ case QMetaType::QQuaternion:
if (!qMetaTypeGuiHelper)
return false;
qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data);
@@ -863,6 +877,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
case QMetaType::QTextFormat:
case QMetaType::QMatrix:
case QMetaType::QTransform:
+ case QMetaType::QMatrix4x4:
+ case QMetaType::QVector2D:
+ case QMetaType::QVector3D:
+ case QMetaType::QVector4D:
+ case QMetaType::QQuaternion:
if (!qMetaTypeGuiHelper)
return false;
qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data);
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 497c014..052312c 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -79,7 +79,9 @@ public:
QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73,
QCursor = 74, QSizePolicy = 75, QKeySequence = 76, QPen = 77,
QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81,
- LastGuiType = 81 /* QTransform */,
+ QMatrix4x4 = 82, QVector2D = 83, QVector3D = 84, QVector4D = 85,
+ QQuaternion = 86,
+ LastGuiType = 86 /* QQuaternion */,
FirstCoreExtType = 128 /* VoidStar */,
VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132,
@@ -292,6 +294,11 @@ class QTextLength;
class QTextFormat;
class QMatrix;
class QTransform;
+class QMatrix4x4;
+class QVector2D;
+class QVector3D;
+class QVector4D;
+class QQuaternion;
QT_END_NAMESPACE
@@ -354,6 +361,11 @@ Q_DECLARE_BUILTIN_METATYPE(QTextLength, QTextLength)
Q_DECLARE_BUILTIN_METATYPE(QTextFormat, QTextFormat)
Q_DECLARE_BUILTIN_METATYPE(QMatrix, QMatrix)
Q_DECLARE_BUILTIN_METATYPE(QTransform, QTransform)
+Q_DECLARE_BUILTIN_METATYPE(QMatrix4x4, QMatrix4x4)
+Q_DECLARE_BUILTIN_METATYPE(QVector2D, QVector2D)
+Q_DECLARE_BUILTIN_METATYPE(QVector3D, QVector3D)
+Q_DECLARE_BUILTIN_METATYPE(QVector4D, QVector4D)
+Q_DECLARE_BUILTIN_METATYPE(QQuaternion, QQuaternion)
QT_END_HEADER
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp
index 3d2a7cb..4a1ba9f 100644
--- a/src/corelib/kernel/qmimedata.cpp
+++ b/src/corelib/kernel/qmimedata.cpp
@@ -105,7 +105,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
Q_Q(const QMimeData);
QVariant data = q->retrieveData(format, type);
- if (data.type() == type || data.type() == QVariant::Invalid)
+ if (data.type() == type || !data.isValid())
return data;
// provide more conversion possiblities than just what QVariant provides
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 85e0ed1..3aa9193 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -577,7 +577,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object)
\l uic generates code that invokes this function to enable
auto-connection to be performed between widgets on forms created
with \QD. More information about using auto-connection with \QD is
- given in the \l{Using a Designer .ui File in Your Application} section of
+ given in the \l{Using a Designer UI File in Your Application} section of
the \QD manual.
\section2 Dynamic Properties
@@ -870,7 +870,7 @@ QObject::~QObject()
QObjectPrivate::Connection::~Connection()
{
if (argumentTypes != &DIRECT_CONNECTION_ONLY)
- delete [] argumentTypes;
+ delete [] static_cast<int *>(argumentTypes);
}
@@ -2104,6 +2104,34 @@ void QObject::deleteLater()
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 17
+ \section1 Meta Data
+
+ Additional data can be attached to each translatable message.
+ The syntax:
+
+ \tt{//= <id>}
+
+ can be used to give the message a unique identifier to support tools
+ which need it.
+ The syntax:
+
+ \tt{//~ <field name> <field contents>}
+
+ can be used to attach meta data to the message. The field name should consist
+ of a domain prefix (possibly the conventional file extension of the file format
+ the field is inspired by), a hyphen and the actual field name in
+ underscore-delimited notation. For storage in TS files, the field name together
+ with the prefix "extra-" will form an XML element name. The field contents will
+ be XML-escaped, but otherwise appear verbatim as the element's contents.
+ Any number of unique fields can be added to each message.
+
+ Example:
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp meta data
+
+ Meta data appearing right in front of a magic TRANSLATOR comment applies to the
+ whole TS file.
+
\section1 Character Encodings
You can set the encoding for \a sourceText by calling QTextCodec::setCodecForTr().
diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp
index 7e8dc23..61f7727 100644
--- a/src/corelib/kernel/qsharedmemory_unix.cpp
+++ b/src/corelib/kernel/qsharedmemory_unix.cpp
@@ -56,7 +56,7 @@
#include <fcntl.h>
#include <unistd.h>
-#ifndef QT_NO_SHAREDMEMORY
+#include "private/qcore_unix_p.h"
QT_BEGIN_NAMESPACE
@@ -82,7 +82,7 @@ void QSharedMemoryPrivate::setErrorString(const QString &function)
error = QSharedMemory::AlreadyExists;
break;
case ENOENT:
- errorString = QSharedMemory::tr("%1: doesn't exists").arg(function);
+ errorString = QSharedMemory::tr("%1: doesn't exist").arg(function);
error = QSharedMemory::NotFound;
break;
case EMFILE:
@@ -121,7 +121,7 @@ key_t QSharedMemoryPrivate::handle()
// ftok requires that an actual file exists somewhere
QString fileName = makePlatformSafeKey(key);
if (!QFile::exists(fileName)) {
- errorString = QSharedMemory::tr("%1: unix key file doesn't exists").arg(QLatin1String("QSharedMemory::handle:"));
+ errorString = QSharedMemory::tr("%1: UNIX key file doesn't exist").arg(QLatin1String("QSharedMemory::handle:"));
error = QSharedMemory::NotFound;
return 0;
}
@@ -152,7 +152,7 @@ int QSharedMemoryPrivate::createUnixKeyFile(const QString &fileName)
if (QFile::exists(fileName))
return 0;
- int fd = open(QFile::encodeName(fileName).constData(),
+ int fd = qt_safe_open(QFile::encodeName(fileName).constData(),
O_EXCL | O_CREAT | O_RDWR, 0640);
if (-1 == fd) {
if (errno == EEXIST)
diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp
index d963a6d..ae64806 100644
--- a/src/corelib/kernel/qsharedmemory_win.cpp
+++ b/src/corelib/kernel/qsharedmemory_win.cpp
@@ -71,7 +71,7 @@ void QSharedMemoryPrivate::setErrorString(const QString &function)
case ERROR_INVALID_PARAMETER:
#endif
error = QSharedMemory::NotFound;
- errorString = QSharedMemory::tr("%1: doesn't exists").arg(function);
+ errorString = QSharedMemory::tr("%1: doesn't exist").arg(function);
break;
case ERROR_COMMITMENT_LIMIT:
error = QSharedMemory::InvalidSize;
@@ -106,16 +106,11 @@ HANDLE QSharedMemoryPrivate::handle()
return false;
}
#ifndef Q_OS_WINCE
- QT_WA({
- hand = OpenFileMappingW(FILE_MAP_ALL_ACCESS, false, (TCHAR*)safeKey.utf16());
- }, {
- hand = OpenFileMappingA(FILE_MAP_ALL_ACCESS, false, safeKey.toLocal8Bit().constData());
- });
+ hand = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, (wchar_t*)safeKey.utf16());
#else
// This works for opening a mapping too, but always opens it with read/write access in
// attach as it seems.
- hand = CreateFileMappingW(INVALID_HANDLE_VALUE,
- 0, PAGE_READWRITE, 0, 0, (TCHAR*)safeKey.utf16());
+ hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 0, (wchar_t*)safeKey.utf16());
#endif
if (!hand) {
setErrorString(function);
@@ -148,13 +143,7 @@ bool QSharedMemoryPrivate::create(int size)
}
// Create the file mapping.
- QT_WA( {
- hand = CreateFileMappingW(INVALID_HANDLE_VALUE,
- 0, PAGE_READWRITE, 0, size, (TCHAR*)safeKey.utf16());
- }, {
- hand = CreateFileMappingA(INVALID_HANDLE_VALUE,
- 0, PAGE_READWRITE, 0, size, safeKey.toLocal8Bit().constData());
- } );
+ hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size, (wchar_t*)safeKey.utf16());
setErrorString(function);
// hand is valid when it already exists unlike unix so explicitly check
diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp
index 4e03ddf..1102258 100644
--- a/src/corelib/kernel/qsystemsemaphore_win.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_win.cpp
@@ -87,11 +87,7 @@ HANDLE QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode)
// Create it if it doesn't already exists.
if (semaphore == 0) {
QString safeName = makeKeyFileName();
- QT_WA({
- semaphore = CreateSemaphoreW(0, initialValue, MAXLONG, (TCHAR*)safeName.utf16());
- }, {
- semaphore = CreateSemaphoreA(0, initialValue, MAXLONG, safeName.toLocal8Bit().constData());
- });
+ semaphore = CreateSemaphore(0, initialValue, MAXLONG, (wchar_t*)safeName.utf16());
if (semaphore == NULL)
setErrorString(QLatin1String("QSystemSemaphore::handle"));
}
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index d2a0b3a..2ee9d26 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -103,9 +103,8 @@ QT_BEGIN_NAMESPACE
Note that QTimer's accuracy depends on the underlying operating
system and hardware. Most platforms support an accuracy of
- 1 millisecond, but Windows 98 supports only 55. If Qt is
- unable to deliver the requested number of timer clicks, it will
- silently discard some.
+ 1 millisecond. If Qt is unable to deliver the requested number of
+ timer clicks, it will silently discard some.
An alternative to using QTimer is to call QObject::startTimer()
for your object and reimplement the QObject::timerEvent() event
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 64cf16e..dc1b530 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -58,6 +58,7 @@
#if defined(Q_OS_UNIX)
#define QT_USE_MMAP
+#include "private/qcore_unix_p.h"
#endif
// most of the headers below are already included in qplatformdefs.h
@@ -502,7 +503,7 @@ bool QTranslator::load(const QString & filename, const QString & directory,
\overload load()
\fn bool QTranslator::load(const uchar *data, int len)
- Loads the .qm file data \a data of length \a len into the
+ Loads the QM file data \a data of length \a len into the
translator.
The data is not copied. The caller must be able to guarantee that \a data
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 2b57d2f..b487615 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1291,6 +1291,7 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler;
\value Map a QVariantMap
\value Matrix a QMatrix
\value Transform a QTransform
+ \value Matrix4x4 a QMatrix4x4
\value Palette a QPalette
\value Pen a QPen
\value Pixmap a QPixmap
@@ -1298,6 +1299,7 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler;
\value PointArray a QPointArray
\value PointF a QPointF
\value Polygon a QPolygon
+ \value Quaternion a QQuaternion
\value Rect a QRect
\value RectF a QRectF
\value RegExp a QRegExp
@@ -1313,6 +1315,9 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler;
\value UInt a \l uint
\value ULongLong a \l qulonglong
\value Url a QUrl
+ \value Vector2D a QVector2D
+ \value Vector3D a QVector3D
+ \value Vector4D a QVector4D
\value UserType Base value for user-defined types.
@@ -1704,7 +1709,7 @@ QVariant::QVariant(Qt::GlobalColor color) { create(62, &color); }
Note that return values in the ranges QVariant::Char through
QVariant::RegExp and QVariant::Font through QVariant::Transform
correspond to the values in the ranges QMetaType::QChar through
- QMetaType::QRegExp and QMetaType::QFont through QMetaType::QTransform.
+ QMetaType::QRegExp and QMetaType::QFont through QMetaType::QQuaternion.
Pay particular attention when working with char and QChar
variants. Note that there is no QVariant constructor specifically
@@ -1932,7 +1937,7 @@ void QVariant::load(QDataStream &s)
create(static_cast<int>(u), 0);
d.is_null = is_null;
- if (d.type == QVariant::Invalid) {
+ if (!isValid()) {
// Since we wrote something, we should read something
QString x;
s >> x;
@@ -1976,7 +1981,7 @@ void QVariant::save(QDataStream &s) const
s << QMetaType::typeName(userType());
}
- if (d.type == QVariant::Invalid) {
+ if (!isValid()) {
s << QString();
return;
}
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index e923844..a68939d 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -154,7 +154,12 @@ class Q_CORE_EXPORT QVariant
TextFormat = 79,
Matrix = 80,
Transform = 81,
- LastGuiType = Transform,
+ Matrix4x4 = 82,
+ Vector2D = 83,
+ Vector3D = 84,
+ Vector4D = 85,
+ Quaternion = 86,
+ LastGuiType = Quaternion,
UserType = 127,
#ifdef QT3_SUPPORT
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 3f42311..772655e 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -637,11 +637,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
#endif
if (!pHnd) {
#ifdef Q_OS_WIN
- QT_WA({
- hTempModule = ::LoadLibraryExW((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, DONT_RESOLVE_DLL_REFERENCES);
- } , {
- temporary_load = load_sys();
- });
+ hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, DONT_RESOLVE_DLL_REFERENCES);
#else
# if defined(Q_OS_SYMBIAN)
//Guard against accidentally trying to load non-plugin libraries by making sure the stub exists
@@ -659,7 +655,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = hTempModule
? (QtPluginQueryVerificationDataFunction)
#ifdef Q_OS_WINCE
- ::GetProcAddressW(hTempModule, L"qt_plugin_query_verification_data")
+ ::GetProcAddress(hTempModule, L"qt_plugin_query_verification_data")
#else
::GetProcAddress(hTempModule, "qt_plugin_query_verification_data")
#endif
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index 43eeafa..847c0d2 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -67,30 +67,18 @@ bool QLibraryPrivate::load_sys()
//avoid 'Bad Image' message box
UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
- QT_WA({
- pHnd = LoadLibraryW((TCHAR*)QDir::toNativeSeparators(attempt).utf16());
- } , {
- pHnd = LoadLibraryA(QFile::encodeName(QDir::toNativeSeparators(attempt)).data());
- });
-
+ pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(attempt).utf16());
+
if (pluginState != IsAPlugin) {
#if defined(Q_OS_WINCE)
if (!pHnd && ::GetLastError() == ERROR_MOD_NOT_FOUND) {
QString secondAttempt = fileName;
- QT_WA({
- pHnd = LoadLibraryW((TCHAR*)QDir::toNativeSeparators(secondAttempt).utf16());
- } , {
- pHnd = LoadLibraryA(QFile::encodeName(QDir::toNativeSeparators(secondAttempt)).data());
- });
+ pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(secondAttempt).utf16());
}
#endif
if (!pHnd && ::GetLastError() == ERROR_MOD_NOT_FOUND) {
attempt += QLatin1String(".dll");
- QT_WA({
- pHnd = LoadLibraryW((TCHAR*)QDir::toNativeSeparators(attempt).utf16());
- } , {
- pHnd = LoadLibraryA(QFile::encodeName(QDir::toNativeSeparators(attempt)).data());
- });
+ pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(attempt).utf16());
}
}
@@ -100,15 +88,11 @@ bool QLibraryPrivate::load_sys()
}
if (pHnd) {
errorString.clear();
- QT_WA({
- TCHAR buffer[MAX_PATH + 1];
- ::GetModuleFileNameW(pHnd, buffer, MAX_PATH);
- attempt = QString::fromUtf16(reinterpret_cast<const ushort *>(&buffer));
- }, {
- char buffer[MAX_PATH + 1];
- ::GetModuleFileNameA(pHnd, buffer, MAX_PATH);
- attempt = QString::fromLocal8Bit(buffer);
- });
+
+ wchar_t buffer[MAX_PATH];
+ ::GetModuleFileName(pHnd, buffer, MAX_PATH);
+ attempt = QString::fromWCharArray(buffer);
+
const QDir dir = QFileInfo(fileName).dir();
const QString realfilename = attempt.mid(attempt.lastIndexOf(QLatin1Char('\\')) + 1);
if (dir.path() == QLatin1String("."))
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index ff2b412..233b4f9 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -63,21 +63,6 @@ typedef QObject *(*QtPluginInstanceFunction)();
void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function);
-struct qt_plugin_instance_deleter
-{
- qt_plugin_instance_deleter(QPointer<QObject> &instance)
- : instance_(instance)
- {
- }
-
- ~qt_plugin_instance_deleter()
- {
- delete instance_;
- }
-
- QPointer<QObject> &instance_;
-};
-
#define Q_IMPORT_PLUGIN(PLUGIN) \
extern QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGIN(); \
class Static##PLUGIN##PluginInstance{ \
@@ -91,10 +76,8 @@ struct qt_plugin_instance_deleter
#define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \
{ \
static QT_PREPEND_NAMESPACE(QPointer)<QT_PREPEND_NAMESPACE(QObject)> _instance; \
- if (!_instance) { \
- static QT_PREPEND_NAMESPACE(qt_plugin_instance_deleter) deleter(_instance); \
+ if (!_instance) \
_instance = new IMPLEMENTATION; \
- } \
return _instance; \
}
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index 670aa7d..0004d3e 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -115,13 +115,10 @@ QAbstractTransitionPrivate *QAbstractTransitionPrivate::get(QAbstractTransition
QStateMachine *QAbstractTransitionPrivate::machine() const
{
- QObject *par = parent;
- while (par != 0) {
- if (QStateMachine *mach = qobject_cast<QStateMachine*>(par))
- return mach;
- par = par->parent();
- }
- return 0;
+ QState *source = sourceState();
+ if (!source)
+ return 0;
+ return source->machine();
}
bool QAbstractTransitionPrivate::callEventTest(QEvent *e)
@@ -256,10 +253,6 @@ void QAbstractTransition::setTargetStates(const QList<QAbstractState*> &targets)
qWarning("QAbstractTransition::setTargetStates: target state(s) cannot be null");
return;
}
- if (target->machine() != 0 && target->machine()->rootState() == target) {
- qWarning("QAbstractTransition::setTargetStates: root state cannot be target of transition");
- return;
- }
}
d->targetStates.clear();
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 83dd869..2042288 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
The assignProperty() function is used for defining property assignments that
should be performed when a state is entered.
- Top-level states must be passed QStateMachine::rootState() as their parent
+ Top-level states must be passed a QStateMachine object as their parent
state, or added to a state machine using QStateMachine::addState().
\section1 States with Child States
@@ -215,6 +215,8 @@ QList<QAbstractTransition*> QStatePrivate::transitions() const
return result;
}
+#ifndef QT_NO_PROPERTIES
+
/*!
Instructs this state to set the property with the given \a name of the given
\a object to the given \a value when the state is entered.
@@ -239,10 +241,12 @@ void QState::assignProperty(QObject *object, const char *name,
d->propertyAssignments.append(QPropertyAssignment(object, name, value));
}
+#endif // QT_NO_PROPERTIES
+
/*!
Returns this state's error state.
- \sa QStateMachine::errorState(), QStateMachine::setErrorState()
+ \sa QStateMachine::error()
*/
QAbstractState *QState::errorState() const
{
@@ -256,19 +260,17 @@ QAbstractState *QState::errorState() const
state recursively. If no error state is set for the state itself or any of
its ancestors, an error will cause the machine to stop executing and an error
will be printed to the console.
-
- \sa QStateMachine::setErrorState(), QStateMachine::errorState()
*/
void QState::setErrorState(QAbstractState *state)
{
Q_D(QState);
- if (state != 0 && state->machine() != machine()) {
- qWarning("QState::setErrorState: error state cannot belong "
- "to a different state machine");
+ if (state != 0 && qobject_cast<QStateMachine*>(state)) {
+ qWarning("QStateMachine::setErrorState: root state cannot be error state");
return;
}
- if (state != 0 && state->machine() != 0 && state->machine()->rootState() == state) {
- qWarning("QStateMachine::setErrorState: root state cannot be error state");
+ if (state != 0 && (!state->machine() || ((state->machine() != machine()) && !qobject_cast<QStateMachine*>(this)))) {
+ qWarning("QState::setErrorState: error state cannot belong "
+ "to a different state machine");
return;
}
@@ -288,12 +290,7 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition)
return 0;
}
- // machine() will always be non-null for root state
- if (machine() != 0 && machine()->rootState() == this) {
- qWarning("QState::addTransition: cannot add transition from root state");
- return 0;
- }
-
+ transition->setParent(this);
const QList<QPointer<QAbstractState> > &targets = QAbstractTransitionPrivate::get(transition)->targetStates;
for (int i = 0; i < targets.size(); ++i) {
QAbstractState *t = targets.at(i);
@@ -308,7 +305,6 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition)
return 0;
}
}
- transition->setParent(this);
if (machine() != 0 && machine()->configuration().contains(this))
QStateMachinePrivate::get(machine())->registerTransitions(this);
return transition;
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index 41d32be..ce88b25 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -87,8 +87,10 @@ public:
ChildMode childMode() const;
void setChildMode(ChildMode mode);
+#ifndef QT_NO_PROPERTIES
void assignProperty(QObject *object, const char *name,
const QVariant &value);
+#endif
Q_SIGNALS:
void finished();
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index b519107..1780d90 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -102,14 +102,9 @@ QT_BEGIN_NAMESPACE
Framework}{overview} gives several state graphs and the code to
build them.
- The rootState() is the parent of all top-level states in the
- machine; it is used, for instance, when the state graph is
- deleted. It is created by the machine.
-
- Use the addState() function to add a state to the state machine.
- All top-level states are added to the root state. States are
- removed with the removeState() function. Removing states while the
- machine is running is discouraged.
+ Use the addState() function to add a top-level state to the state machine.
+ States are removed with the removeState() function. Removing states while
+ the machine is running is discouraged.
Before the machine can be started, the \l{initialState}{initial
state} must be set. The initial state is the state that the
@@ -179,26 +174,6 @@ This is
*/
/*!
- \property QStateMachine::rootState
-
- \brief the root state of this state machine
-*/
-
-/*!
- \property QStateMachine::initialState
-
- \brief the initial state of this state machine
-
- The initial state must be one of the rootState()'s child states.
-*/
-
-/*!
- \property QStateMachine::errorState
-
- \brief the error state of this state machine
-*/
-
-/*!
\property QStateMachine::errorString
\brief the error string of this state machine
@@ -235,7 +210,6 @@ QStateMachinePrivate::QStateMachinePrivate()
stop = false;
error = QStateMachine::NoError;
globalRestorePolicy = QStateMachine::DoNotRestoreProperties;
- rootState = 0;
signalEventGenerator = 0;
#ifndef QT_NO_ANIMATION
animationsEnabled = true;
@@ -255,6 +229,11 @@ QStateMachinePrivate *QStateMachinePrivate::get(QStateMachine *q)
return 0;
}
+QState *QStateMachinePrivate::rootState() const
+{
+ return const_cast<QStateMachine*>(q_func());
+}
+
static QEvent *cloneEvent(QEvent *e)
{
switch (e->type()) {
@@ -302,7 +281,9 @@ bool QStateMachinePrivate::stateEntryLessThan(QAbstractState *s1, QAbstractState
} else if (isDescendantOf(s2, s1)) {
return true;
} else {
- QState *lca = findLCA(QList<QAbstractState*>() << s1 << s2);
+ Q_ASSERT(s1->machine() != 0);
+ QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());
+ QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);
Q_ASSERT(lca != 0);
return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
}
@@ -318,17 +299,19 @@ bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState
} else if (isDescendantOf(s2, s1)) {
return false;
} else {
- QState *lca = findLCA(QList<QAbstractState*>() << s1 << s2);
+ Q_ASSERT(s1->machine() != 0);
+ QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());
+ QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);
Q_ASSERT(lca != 0);
return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
}
}
-QState *QStateMachinePrivate::findLCA(const QList<QAbstractState*> &states)
+QState *QStateMachinePrivate::findLCA(const QList<QAbstractState*> &states) const
{
if (states.isEmpty())
return 0;
- QList<QState*> ancestors = properAncestors(states.at(0), 0);
+ QList<QState*> ancestors = properAncestors(states.at(0), rootState()->parentState());
for (int i = 0; i < ancestors.size(); ++i) {
QState *anc = ancestors.at(i);
bool ok = true;
@@ -376,7 +359,7 @@ QSet<QAbstractTransition*> QStateMachinePrivate::selectTransitions(QEvent *event
continue;
if (isPreempted(state, enabledTransitions))
continue;
- QList<QState*> lst = properAncestors(state, 0);
+ QList<QState*> lst = properAncestors(state, rootState()->parentState());
if (QState *grp = qobject_cast<QState*>(state))
lst.prepend(grp);
bool found = false;
@@ -412,7 +395,9 @@ void QStateMachinePrivate::microstep(QEvent *event, const QList<QAbstractTransit
#endif
executeTransitionContent(event, enabledTransitions);
QList<QAbstractState*> enteredStates = enterStates(event, enabledTransitions);
+#ifndef QT_NO_PROPERTIES
applyProperties(enabledTransitions, exitedStates, enteredStates);
+#endif
#ifdef QSTATEMACHINE_DEBUG
qDebug() << q_func() << ": configuration after entering states:" << configuration;
qDebug() << q_func() << ": end microstep";
@@ -557,11 +542,13 @@ QList<QAbstractState*> QStateMachinePrivate::enterStates(QEvent *event, const QL
if (isFinal(s)) {
QState *parent = s->parentState();
if (parent) {
- QState *grandparent = parent->parentState();
+ if (parent != rootState()) {
#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": emitting finished signal for" << parent;
+ qDebug() << q << ": emitting finished signal for" << parent;
#endif
- QStatePrivate::get(parent)->emitFinished();
+ QStatePrivate::get(parent)->emitFinished();
+ }
+ QState *grandparent = parent->parentState();
if (grandparent && isParallel(grandparent)) {
bool allChildStatesFinal = true;
QList<QAbstractState*> childStates = QStatePrivate::get(grandparent)->childStates();
@@ -572,7 +559,7 @@ QList<QAbstractState*> QStateMachinePrivate::enterStates(QEvent *event, const QL
break;
}
}
- if (allChildStatesFinal) {
+ if (allChildStatesFinal && (grandparent != rootState())) {
#ifdef QSTATEMACHINE_DEBUG
qDebug() << q << ": emitting finished signal for" << grandparent;
#endif
@@ -585,7 +572,7 @@ QList<QAbstractState*> QStateMachinePrivate::enterStates(QEvent *event, const QL
{
QSet<QAbstractState*>::const_iterator it;
for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) {
- if (isFinal(*it) && (*it)->parentState() == rootState) {
+ if (isFinal(*it) && (*it)->parentState() == rootState()) {
processing = false;
stopProcessingReason = Finished;
break;
@@ -630,6 +617,11 @@ void QStateMachinePrivate::addStatesToEnter(QAbstractState *s, QState *root,
}
}
} else {
+ if (s == rootState()) {
+ // Error has already been set by exitStates().
+ Q_ASSERT(error != QStateMachine::NoError);
+ return;
+ }
statesToEnter.insert(s);
if (isParallel(s)) {
QState *grp = qobject_cast<QState*>(s);
@@ -643,6 +635,7 @@ void QStateMachinePrivate::addStatesToEnter(QAbstractState *s, QState *root,
QState *grp = qobject_cast<QState*>(s);
QAbstractState *initial = grp->initialState();
if (initial != 0) {
+ Q_ASSERT(initial->machine() == q_func());
addStatesToEnter(initial, grp, statesToEnter, statesForDefaultEntry);
} else {
setError(QStateMachine::NoInitialStateError, grp);
@@ -675,6 +668,8 @@ void QStateMachinePrivate::addStatesToEnter(QAbstractState *s, QState *root,
}
}
+#ifndef QT_NO_PROPERTIES
+
void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &transitionList,
const QList<QAbstractState*> &exitedStates,
const QList<QAbstractState*> &enteredStates)
@@ -862,6 +857,8 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr
}
}
+#endif // QT_NO_PROPERTIES
+
bool QStateMachinePrivate::isFinal(const QAbstractState *s)
{
return qobject_cast<const QFinalState*>(s) != 0;
@@ -873,20 +870,26 @@ bool QStateMachinePrivate::isParallel(const QAbstractState *s)
return ss && (QStatePrivate::get(ss)->childMode == QState::ParallelStates);
}
-bool QStateMachinePrivate::isCompound(const QAbstractState *s)
+bool QStateMachinePrivate::isCompound(const QAbstractState *s) const
{
const QState *group = qobject_cast<const QState*>(s);
if (!group)
return false;
+ bool isMachine = (qobject_cast<const QStateMachine*>(group) != 0);
+ // Don't treat the machine as compound if it's a sub-state of this machine
+ if (isMachine && (group != rootState()))
+ return false;
return (!isParallel(group) && !QStatePrivate::get(group)->childStates().isEmpty())
- || (qobject_cast<QStateMachine*>(group->parent()) != 0);
+ || isMachine;
}
-bool QStateMachinePrivate::isAtomic(const QAbstractState *s)
+bool QStateMachinePrivate::isAtomic(const QAbstractState *s) const
{
const QState *ss = qobject_cast<const QState*>(s);
return (ss && QStatePrivate::get(ss)->childStates().isEmpty())
- || isFinal(s);
+ || isFinal(s)
+ // Treat the machine as atomic if it's a sub-state of this machine
+ || (ss && (qobject_cast<const QStateMachine*>(ss) != 0) && (ss != rootState()));
}
@@ -935,6 +938,8 @@ bool QStateMachinePrivate::isInFinalState(QAbstractState* s) const
return false;
}
+#ifndef QT_NO_PROPERTIES
+
void QStateMachinePrivate::registerRestorable(QObject *object, const QByteArray &propertyName)
{
RestorableId id(object, propertyName);
@@ -979,6 +984,8 @@ void QStateMachinePrivate::unregisterRestorable(QObject *object, const QByteArra
registeredRestorables.remove(id);
}
+#endif // QT_NO_PROPERTIES
+
QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context)
{
// Find error state recursively in parent hierarchy if not set explicitly for context state
@@ -1034,7 +1041,7 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
if (currentContext == currentErrorState)
currentErrorState = 0;
- Q_ASSERT(currentErrorState != rootState);
+ Q_ASSERT(currentErrorState != rootState());
if (currentErrorState != 0) {
QState *lca = findLCA(QList<QAbstractState*>() << currentErrorState << currentContext);
@@ -1091,12 +1098,14 @@ void QStateMachinePrivate::_q_animationFinished()
resetAnimationEndValues.remove(anim);
}
+#ifndef QT_NO_PROPERTIES
// Set the final property value.
QPropertyAssignment assn = propertyForAnimation.take(anim);
Q_ASSERT(assn.object != 0);
assn.object->setProperty(assn.propertyName, assn.value);
if (!assn.explicitlySet)
unregisterRestorable(assn.object, assn.propertyName);
+#endif
QAbstractState *state = stateForAnimation.take(anim);
Q_ASSERT(state != 0);
@@ -1141,11 +1150,8 @@ void QStateMachinePrivate::_q_start()
{
Q_Q(QStateMachine);
Q_ASSERT(state == Starting);
- if (!rootState) {
- state = NotRunning;
- return;
- }
- QAbstractState *initial = rootState->initialState();
+ Q_ASSERT(rootState() != 0);
+ QAbstractState *initial = rootState()->initialState();
configuration.clear();
qDeleteAll(internalEventQueue);
internalEventQueue.clear();
@@ -1159,7 +1165,7 @@ void QStateMachinePrivate::_q_start()
processingScheduled = true; // we call _q_process() below
emit q->started();
- StartState *start = new StartState(rootState);
+ StartState *start = new StartState(rootState());
QAbstractTransition *initialTransition = new InitialTransition(initial);
start->addTransition(initialTransition);
QList<QAbstractTransition*> transitions;
@@ -1167,8 +1173,10 @@ void QStateMachinePrivate::_q_start()
QEvent nullEvent(QEvent::None);
executeTransitionContent(&nullEvent, transitions);
QList<QAbstractState*> enteredStates = enterStates(&nullEvent, transitions);
+#ifndef QT_NO_PROPERTIES
applyProperties(transitions, QList<QAbstractState*>() << start,
enteredStates);
+#endif
delete start;
#ifdef QSTATEMACHINE_DEBUG
@@ -1371,15 +1379,22 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit
void QStateMachinePrivate::unregisterAllTransitions()
{
+ Q_Q(QStateMachine);
{
- QList<QSignalTransition*> transitions = qFindChildren<QSignalTransition*>(rootState);
- for (int i = 0; i < transitions.size(); ++i)
- unregisterSignalTransition(transitions.at(i));
+ QList<QSignalTransition*> transitions = qFindChildren<QSignalTransition*>(rootState());
+ for (int i = 0; i < transitions.size(); ++i) {
+ QSignalTransition *t = transitions.at(i);
+ if (t->machine() == q)
+ unregisterSignalTransition(t);
+ }
}
{
- QList<QEventTransition*> transitions = qFindChildren<QEventTransition*>(rootState);
- for (int i = 0; i < transitions.size(); ++i)
- unregisterEventTransition(transitions.at(i));
+ QList<QEventTransition*> transitions = qFindChildren<QEventTransition*>(rootState());
+ for (int i = 0; i < transitions.size(); ++i) {
+ QEventTransition *t = transitions.at(i);
+ if (t->machine() == q)
+ unregisterEventTransition(t);
+ }
}
}
@@ -1457,16 +1472,20 @@ void QStateMachinePrivate::handleTransitionSignal(const QObject *sender, int sig
Constructs a new state machine with the given \a parent.
*/
QStateMachine::QStateMachine(QObject *parent)
- : QObject(*new QStateMachinePrivate, parent)
+ : QState(*new QStateMachinePrivate, /*parentState=*/0)
{
+ // Can't pass the parent to the QState constructor, as it expects a QState
+ // But this works as expected regardless of whether parent is a QState or not
+ setParent(parent);
}
/*!
\internal
*/
QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent)
- : QObject(dd, parent)
+ : QState(dd, /*parentState=*/0)
{
+ setParent(parent);
}
/*!
@@ -1476,69 +1495,6 @@ QStateMachine::~QStateMachine()
{
}
-namespace {
-
-class RootState : public QState
-{
-public:
- RootState(QState *parent)
- : QState(parent)
- {
- }
-
- void onEntry(QEvent *) {}
- void onExit(QEvent *) {}
-};
-
-} // namespace
-
-/*!
- Returns this state machine's root state.
-*/
-QState *QStateMachine::rootState() const
-{
- Q_D(const QStateMachine);
- if (!d->rootState) {
- const_cast<QStateMachinePrivate*>(d)->rootState = new RootState(0);
- d->rootState->setParent(const_cast<QStateMachine*>(this));
- }
- return d->rootState;
-}
-
-/*!
- Returns the error state of the state machine's root state.
-
- \sa QState::errorState()
-*/
-QAbstractState *QStateMachine::errorState() const
-{
- return rootState()->errorState();
-}
-
-/*!
- Sets the error state of this state machine's root state to be \a state. When a running state
- machine encounters an error which puts it in an undefined state, it will enter an error state
- based on the context of the error that occurred. It will enter this state regardless of what
- is currently in the event queue.
-
- If the erroneous state has an error state set, this will be entered by the machine. If no error
- state has been set, the state machine will search the parent hierarchy recursively for an
- error state. The error state of the root state can thus be seen as a global error state that
- applies for all states for which a more specific error state has not been set.
-
- Before entering the error state, the state machine will set the error code returned by error() and
- error message returned by errorString().
-
- If there is no error state available for the erroneous state, the state machine will print a
- warning message on the console and stop executing.
-
- \sa QState::setErrorState(), rootState()
-*/
-void QStateMachine::setErrorState(QAbstractState *state)
-{
- rootState()->setErrorState(state);
-}
-
/*! \enum QStateMachine::Error
This enum type defines errors that can occur in the state machine at run time. When the state
@@ -1640,39 +1596,13 @@ void QStateMachine::setGlobalRestorePolicy(QStateMachine::RestorePolicy restoreP
}
/*!
- Returns this state machine's initial state, or 0 if no initial state has
- been set.
-*/
-QAbstractState *QStateMachine::initialState() const
-{
- Q_D(const QStateMachine);
- if (!d->rootState)
- return 0;
- return d->rootState->initialState();
-}
-
-/*!
- Sets this state machine's initial \a state.
-*/
-void QStateMachine::setInitialState(QAbstractState *state)
-{
- Q_D(QStateMachine);
- if (!d->rootState) {
- if (!state)
- return;
- rootState()->setInitialState(state);
- }
- d->rootState->setInitialState(state);
-}
-
-/*!
Adds the given \a state to this state machine. The state becomes a top-level
- state (i.e. a child of the rootState()).
+ state.
If the state is already in a different machine, it will first be removed
from its old machine, and then added to this machine.
- \sa removeState(), rootState(), setInitialState()
+ \sa removeState(), setInitialState()
*/
void QStateMachine::addState(QAbstractState *state)
{
@@ -1684,7 +1614,7 @@ void QStateMachine::addState(QAbstractState *state)
qWarning("QStateMachine::addState: state has already been added to this machine");
return;
}
- state->setParent(rootState());
+ state->setParent(this);
}
/*!
@@ -1730,7 +1660,7 @@ void QStateMachine::start()
{
Q_D(QStateMachine);
- if (rootState()->initialState() == 0) {
+ if (initialState() == 0) {
qWarning("QStateMachine::start: No initial state set for machine. Refusing to start.");
return;
}
@@ -1821,7 +1751,7 @@ void QStateMachine::postInternalEvent(QEvent *event)
Returns the maximal consistent set of states (including parallel and final
states) that this state machine is currently in. If a state \c s is in the
configuration, it is always the case that the parent of \c s is also in
- c. Note, however, that the rootState() is not an explicit member of the
+ c. Note, however, that the machine itself is not an explicit member of the
configuration.
*/
QSet<QAbstractState*> QStateMachine::configuration() const
@@ -1840,15 +1770,6 @@ QSet<QAbstractState*> QStateMachine::configuration() const
*/
/*!
- \fn QStateMachine::finished()
-
- This signal is emitted when the state machine has reached a top-level final
- state (QFinalState).
-
- \sa QStateMachine::started()
-*/
-
-/*!
\fn QStateMachine::stopped()
This signal is emitted when the state machine has stopped.
@@ -1872,14 +1793,6 @@ bool QStateMachine::event(QEvent *e)
d->scheduleProcess();
return true;
}
- } else if (e->type() == QEvent::ChildAdded) {
- QChildEvent *ce = static_cast<QChildEvent*>(e);
- if (QAbstractState *state = qobject_cast<QAbstractState*>(ce->child())) {
- if (state != rootState()) {
- state->setParent(rootState());
- return true;
- }
- }
}
return QObject::event(e);
}
@@ -1949,6 +1862,24 @@ void QStateMachine::endMicrostep(QEvent *event)
Q_UNUSED(event);
}
+/*!
+ \reimp
+*/
+void QStateMachine::onEntry(QEvent *event)
+{
+ start();
+ QState::onEntry(event);
+}
+
+/*!
+ \reimp
+*/
+void QStateMachine::onExit(QEvent *event)
+{
+ stop();
+ QState::onExit(event);
+}
+
#ifndef QT_NO_ANIMATION
/*!
@@ -2155,6 +2086,8 @@ QSignalEvent::~QSignalEvent()
Constructs a new QWrappedEvent object with the given \a object
and \a event.
+
+ The QWrappedEvent object takes ownership of \a event.
*/
QWrappedEvent::QWrappedEvent(QObject *object, QEvent *event)
: QEvent(QEvent::Wrapped), m_object(object), m_event(event)
@@ -2166,6 +2099,7 @@ QWrappedEvent::QWrappedEvent(QObject *object, QEvent *event)
*/
QWrappedEvent::~QWrappedEvent()
{
+ delete m_event;
}
/*!
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index 30d0e3a..230d852 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -42,7 +42,7 @@
#ifndef QSTATEMACHINE_H
#define QSTATEMACHINE_H
-#include <QtCore/qabstractstate.h>
+#include <QtCore/qstate.h>
#include <QtCore/qlist.h>
#include <QtCore/qobject.h>
@@ -57,18 +57,12 @@ QT_MODULE(Core)
#ifndef QT_NO_STATEMACHINE
class QEvent;
-class QAbstractState;
-class QState;
class QStateMachinePrivate;
class QAbstractAnimation;
-class QAbstractState;
-class Q_CORE_EXPORT QStateMachine : public QObject
+class Q_CORE_EXPORT QStateMachine : public QState
{
Q_OBJECT
- Q_PROPERTY(QState* rootState READ rootState)
- Q_PROPERTY(QAbstractState* initialState READ initialState WRITE setInitialState)
- Q_PROPERTY(QAbstractState* errorState READ errorState WRITE setErrorState)
Q_PROPERTY(QString errorString READ errorString)
Q_PROPERTY(RestorePolicy globalRestorePolicy READ globalRestorePolicy WRITE setGlobalRestorePolicy)
Q_ENUMS(RestorePolicy)
@@ -94,14 +88,6 @@ public:
void addState(QAbstractState *state);
void removeState(QAbstractState *state);
- QState *rootState() const;
-
- QAbstractState *initialState() const;
- void setInitialState(QAbstractState *state);
-
- QAbstractState *errorState() const;
- void setErrorState(QAbstractState *state);
-
Error error() const;
QString errorString() const;
void clearError();
@@ -135,9 +121,11 @@ public Q_SLOTS:
Q_SIGNALS:
void started();
void stopped();
- void finished();
protected:
+ void onEntry(QEvent *event);
+ void onExit(QEvent *event);
+
void postInternalEvent(QEvent *event);
virtual void beginSelectTransitions(QEvent *event);
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index 1335b93..cae21aa 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -53,7 +53,8 @@
// We mean it.
//
-#include <private/qobject_p.h>
+#include "private/qstate_p.h"
+
#include <QtCore/qcoreevent.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
@@ -61,9 +62,6 @@
#include <QtCore/qset.h>
#include <QtCore/qvector.h>
-#include "qstate.h"
-#include "private/qstate_p.h"
-
QT_BEGIN_NAMESPACE
class QEvent;
@@ -81,7 +79,7 @@ class QAbstractAnimation;
#endif
class QStateMachine;
-class QStateMachinePrivate : public QObjectPrivate
+class QStateMachinePrivate : public QStatePrivate
{
Q_DECLARE_PUBLIC(QStateMachine)
public:
@@ -101,7 +99,7 @@ public:
static QStateMachinePrivate *get(QStateMachine *q);
- static QState *findLCA(const QList<QAbstractState*> &states);
+ QState *findLCA(const QList<QAbstractState*> &states) const;
static bool stateEntryLessThan(QAbstractState *s1, QAbstractState *s2);
static bool stateExitLessThan(QAbstractState *s1, QAbstractState *s2);
@@ -116,6 +114,8 @@ public:
void _q_animationFinished();
#endif
+ QState *rootState() const;
+
void microstep(QEvent *event, const QList<QAbstractTransition*> &transitionList);
bool isPreempted(const QAbstractState *s, const QSet<QAbstractTransition*> &transitions) const;
QSet<QAbstractTransition*> selectTransitions(QEvent *event) const;
@@ -133,8 +133,8 @@ public:
bool isInFinalState(QAbstractState *s) const;
static bool isFinal(const QAbstractState *s);
static bool isParallel(const QAbstractState *s);
- static bool isCompound(const QAbstractState *s);
- static bool isAtomic(const QAbstractState *s);
+ bool isCompound(const QAbstractState *s) const;
+ bool isAtomic(const QAbstractState *s) const;
static bool isDescendantOf(const QAbstractState *s, const QAbstractState *other);
static QList<QState*> properAncestors(const QAbstractState *s, const QState *upperBound);
@@ -151,6 +151,7 @@ public:
void **args);
void scheduleProcess();
+#ifndef QT_NO_PROPERTIES
typedef QPair<QObject *, QByteArray> RestorableId;
QHash<RestorableId, QVariant> registeredRestorables;
void registerRestorable(QObject *object, const QByteArray &propertyName);
@@ -158,13 +159,13 @@ public:
bool hasRestorable(QObject *object, const QByteArray &propertyName) const;
QVariant restorableValue(QObject *object, const QByteArray &propertyName) const;
QList<QPropertyAssignment> restorablesToPropertyList(const QHash<RestorableId, QVariant> &restorables) const;
+#endif
State state;
bool processing;
bool processingScheduled;
bool stop;
StopProcessingReason stopProcessingReason;
- QState *rootState;
QSet<QAbstractState*> configuration;
QList<QEvent*> internalEventQueue;
QList<QEvent*> externalEventQueue;
diff --git a/src/corelib/thread/qmutex_win.cpp b/src/corelib/thread/qmutex_win.cpp
index f2022a5..ae79735 100644
--- a/src/corelib/thread/qmutex_win.cpp
+++ b/src/corelib/thread/qmutex_win.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <windows.h>
+#include <qt_windows.h>
#include "qmutex.h"
#include <qatomic.h>
@@ -50,19 +50,7 @@ QT_BEGIN_NAMESPACE
QMutexPrivate::QMutexPrivate(QMutex::RecursionMode mode)
: recursive(mode == QMutex::Recursive), contenders(0), lastSpinCount(0), owner(0), count(0)
{
- if (QSysInfo::WindowsVersion == 0) {
- // mutex was created before initializing WindowsVersion. this
- // can happen when creating the resource file engine handler,
- // for example. try again with just the A version
-#ifdef Q_OS_WINCE
- event = CreateEventW(0, FALSE, FALSE, 0);
-#else
- event = CreateEventA(0, FALSE, FALSE, 0);
-#endif
- } else {
- event = QT_WA_INLINE(CreateEventW(0, FALSE, FALSE, 0),
- CreateEventA(0, FALSE, FALSE, 0));
- }
+ event = CreateEvent(0, FALSE, FALSE, 0);
if (!event)
qWarning("QMutexPrivate::QMutexPrivate: Cannot create event");
}
diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h
index 51d42b5..4742bea 100644
--- a/src/corelib/thread/qreadwritelock.h
+++ b/src/corelib/thread/qreadwritelock.h
@@ -190,7 +190,8 @@ inline QWriteLocker::QWriteLocker(QReadWriteLock *areadWriteLock)
class Q_CORE_EXPORT QReadWriteLock
{
public:
- inline explicit QReadWriteLock() { }
+ enum RecursionMode { NonRecursive, Recursive };
+ inline explicit QReadWriteLock(RecursionMode = NonRecursive) { }
inline ~QReadWriteLock() { }
static inline void lockForRead() { }
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index fac50ee..1cf4bc9 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -264,9 +264,14 @@ QThreadPrivate::~QThreadPrivate()
Returns the thread handle of the currently executing thread.
\warning The handle returned by this function is used for internal
- purposes and should not be used in any application code. On
- Windows, the returned value is a pseudo-handle for the current
- thread that cannot be used for numerical comparison.
+ purposes and should not be used in any application code.
+
+ \warning On Windows, the returned value is a pseudo-handle for the
+ current thread. It can't be used for numerical comparison. i.e.,
+ this function returns the DWORD (Windows-Thread ID) returned by
+ the Win32 function getCurrentThreadId(), not the HANDLE
+ (Windows-Thread HANDLE) returned by the Win32 function
+ getCurrentThread().
*/
/*!
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 8bf6269..d8a1876 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -54,7 +54,7 @@
#include <private/qcoreapplication_p.h>
#include <private/qeventdispatcher_win_p.h>
-#include <windows.h>
+#include <qt_windows.h>
#ifndef Q_OS_WINCE
@@ -170,8 +170,7 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread)
// Start watcher thread if it is not already running.
if (qt_adopted_thread_watcher_handle == 0) {
if (qt_adopted_thread_wakeup == 0) {
- qt_adopted_thread_wakeup = QT_WA_INLINE(CreateEventW(0, false, false, 0),
- CreateEventA(0, false, false, 0));
+ qt_adopted_thread_wakeup = CreateEvent(0, false, false, 0);
qt_adopted_thread_handles.prepend(qt_adopted_thread_wakeup);
}
@@ -371,11 +370,10 @@ int QThread::idealThreadCount()
void QThread::yieldCurrentThread()
{
#ifndef Q_OS_WINCE
- if (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
- SwitchToThread();
- else
+ SwitchToThread();
+#else
+ ::Sleep(0);
#endif
- ::Sleep(0);
}
void QThread::sleep(unsigned long secs)
@@ -426,17 +424,11 @@ void QThread::start(Priority priority)
return;
}
- // Since Win 9x will have problems if the priority is idle or time critical
- // we have to use the closest one instead
int prio;
d->priority = priority;
switch (d->priority) {
case IdlePriority:
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
- prio = THREAD_PRIORITY_LOWEST;
- } else {
- prio = THREAD_PRIORITY_IDLE;
- }
+ prio = THREAD_PRIORITY_IDLE;
break;
case LowestPriority:
@@ -460,11 +452,7 @@ void QThread::start(Priority priority)
break;
case TimeCriticalPriority:
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
- prio = THREAD_PRIORITY_HIGHEST;
- } else {
- prio = THREAD_PRIORITY_TIME_CRITICAL;
- }
+ prio = THREAD_PRIORITY_TIME_CRITICAL;
break;
case InheritPriority:
@@ -570,17 +558,11 @@ void QThread::setPriority(Priority priority)
// copied from start() with a few modifications:
- // Since Win 9x will have problems if the priority is idle or time critical
- // we have to use the closest one instead
int prio;
d->priority = priority;
switch (d->priority) {
case IdlePriority:
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
- prio = THREAD_PRIORITY_LOWEST;
- } else {
- prio = THREAD_PRIORITY_IDLE;
- }
+ prio = THREAD_PRIORITY_IDLE;
break;
case LowestPriority:
@@ -604,11 +586,7 @@ void QThread::setPriority(Priority priority)
break;
case TimeCriticalPriority:
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
- prio = THREAD_PRIORITY_HIGHEST;
- } else {
- prio = THREAD_PRIORITY_TIME_CRITICAL;
- }
+ prio = THREAD_PRIORITY_TIME_CRITICAL;
break;
case InheritPriority:
diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp
index 9129fb6..b0146d2 100644
--- a/src/corelib/thread/qwaitcondition_win.cpp
+++ b/src/corelib/thread/qwaitcondition_win.cpp
@@ -64,11 +64,7 @@ class QWaitConditionEvent
public:
inline QWaitConditionEvent() : priority(0), wokenUp(false)
{
- QT_WA ({
- event = CreateEvent(NULL, TRUE, FALSE, NULL);
- }, {
- event = CreateEventA(NULL, TRUE, FALSE, NULL);
- });
+ event = CreateEvent(NULL, TRUE, FALSE, NULL);
}
inline ~QWaitConditionEvent() { CloseHandle(event); }
int priority;
diff --git a/src/corelib/tools/qbytedata_p.h b/src/corelib/tools/qbytedata_p.h
new file mode 100644
index 0000000..cc10ea2
--- /dev/null
+++ b/src/corelib/tools/qbytedata_p.h
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBYTEDATA_H
+#define QBYTEDATA_H
+
+#include <qbytearray.h>
+
+
+QT_BEGIN_NAMESPACE
+
+// this class handles a list of QByteArrays. It is a variant of QRingBuffer
+// that avoid malloc/realloc/memcpy.
+class QByteDataBuffer
+{
+private:
+ QList<QByteArray> buffers;
+ qint64 bufferCompleteSize;
+public:
+ QByteDataBuffer() : bufferCompleteSize(0)
+ {
+ }
+
+ ~QByteDataBuffer()
+ {
+ clear();
+ }
+
+ inline void append(QByteDataBuffer& other)
+ {
+ if (other.isEmpty())
+ return;
+
+ buffers.append(other.buffers);
+ bufferCompleteSize += other.byteAmount();
+ }
+
+
+ inline void append(QByteArray& bd)
+ {
+ if (bd.isEmpty())
+ return;
+
+ buffers.append(bd);
+ bufferCompleteSize += bd.size();
+ }
+
+ inline void prepend(QByteArray& bd)
+ {
+ if (bd.isEmpty())
+ return;
+
+ buffers.prepend(bd);
+ bufferCompleteSize += bd.size();
+ }
+
+ // return the first QByteData. User of this function has to qFree() its .data!
+ // preferably use this function to read data.
+ inline QByteArray read()
+ {
+ bufferCompleteSize -= buffers.first().size();
+ return buffers.takeFirst();
+ }
+
+ // return everything. User of this function has to qFree() its .data!
+ // avoid to use this, it might malloc and memcpy.
+ inline QByteArray readAll()
+ {
+ return read(byteAmount());
+ }
+
+ // return amount. User of this function has to qFree() its .data!
+ // avoid to use this, it might malloc and memcpy.
+ inline QByteArray read(qint64 amount)
+ {
+ amount = qMin(byteAmount(), amount);
+ QByteArray byteData;
+ byteData.resize(amount);
+ read(byteData.data(), byteData.size());
+ return byteData;
+ }
+
+ // return amount bytes. User of this function has to qFree() its .data!
+ // avoid to use this, it will memcpy.
+ qint64 read(char* dst, qint64 amount)
+ {
+ amount = qMin(amount, byteAmount());
+ qint64 originalAmount = amount;
+ char *writeDst = dst;
+
+ while (amount > 0) {
+ QByteArray first = buffers.takeFirst();
+ if (amount >= first.size()) {
+ // take it completely
+ bufferCompleteSize -= first.size();
+ amount -= first.size();
+ memcpy(writeDst, first.constData(), first.size());
+ writeDst += first.size();
+ first.clear();
+ } else {
+ // take a part of it & it is the last one to take
+ bufferCompleteSize -= amount;
+ memcpy(writeDst, first.constData(), amount);
+
+ qint64 newFirstSize = first.size() - amount;
+ QByteArray newFirstData;
+ newFirstData.resize(newFirstSize);
+ memcpy(newFirstData.data(), first.constData() + amount, newFirstSize);
+ buffers.prepend(newFirstData);
+
+ amount = 0;
+ first.clear();
+ }
+ }
+
+ return originalAmount;
+ }
+
+ inline char getChar()
+ {
+ char c;
+ read(&c, 1);
+ return c;
+ }
+
+ inline void clear()
+ {
+ buffers.clear();
+ bufferCompleteSize = 0;
+ }
+
+ // The byte count of all QByteArrays
+ inline qint64 byteAmount() const
+ {
+ return bufferCompleteSize;
+ }
+
+ // the number of QByteArrays
+ inline qint64 bufferCount() const
+ {
+ return buffers.length();
+ }
+
+ inline bool isEmpty() const
+ {
+ return byteAmount() == 0;
+ }
+
+ inline qint64 sizeNextBlock() const
+ {
+ if(buffers.isEmpty())
+ return 0;
+ else
+ return buffers.first().size();
+ }
+
+ inline QByteArray& operator[](int i)
+ {
+ return buffers[i];
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif // QBYTEDATA_H
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 88053d6..458a383 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1421,16 +1421,15 @@ QDataStream &operator>>(QDataStream &in, QChar &chr)
// ---------------------------------------------------------------------------
-static QString decomposeHelper
- (const QString &str, bool canonical, QChar::UnicodeVersion version)
+static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion version, int from)
{
unsigned short buffer[3];
- QString s = str;
+ QString &s = *str;
- const unsigned short *utf16 = s.utf16();
+ const unsigned short *utf16 = reinterpret_cast<unsigned short *>(s.data());
const unsigned short *uc = utf16 + s.length();
- while (uc != utf16) {
+ while (uc != utf16 + from) {
uint ucs4 = *(--uc);
if (QChar(ucs4).isLowSurrogate() && uc != utf16) {
ushort high = *(uc - 1);
@@ -1450,11 +1449,9 @@ static QString decomposeHelper
s.replace(uc - utf16, ucs4 > 0x10000 ? 2 : 1, (const QChar *)d, length);
// since the insert invalidates the pointers and we do decomposition recursive
int pos = uc - utf16;
- utf16 = s.utf16();
+ utf16 = reinterpret_cast<unsigned short *>(s.data());
uc = utf16 + pos + length;
}
-
- return s;
}
@@ -1489,21 +1486,21 @@ static ushort ligatureHelper(ushort u1, ushort u2)
return 0;
}
-static QString composeHelper(const QString &str)
+static void composeHelper(QString *str, int from)
{
- QString s = str;
+ QString &s = *str;
- if (s.length() < 2)
- return s;
+ if (s.length() - from < 2)
+ return;
// the loop can partly ignore high Unicode as all ligatures are in the BMP
int starter = 0;
int lastCombining = 0;
- int pos = 0;
+ int pos = from;
while (pos < s.length()) {
- uint uc = s.utf16()[pos];
+ uint uc = s.at(pos).unicode();
if (QChar(uc).isHighSurrogate() && pos < s.length()-1) {
- ushort low = s.utf16()[pos+1];
+ ushort low = s.at(pos+1).unicode();
if (QChar(low).isLowSurrogate()) {
uc = QChar::surrogateToUcs4(uc, low);
++pos;
@@ -1512,7 +1509,7 @@ static QString composeHelper(const QString &str)
int combining = QChar::combiningClass(uc);
if (starter == pos - 1 || combining > lastCombining) {
// allowed to form ligature with S
- QChar ligature = ligatureHelper(s.utf16()[starter], uc);
+ QChar ligature = ligatureHelper(s.at(starter).unicode(), uc);
if (ligature.unicode()) {
s[starter] = ligature;
s.remove(pos, 1);
@@ -1524,16 +1521,14 @@ static QString composeHelper(const QString &str)
lastCombining = combining;
++pos;
}
- return s;
}
-static QString canonicalOrderHelper
- (const QString &str, QChar::UnicodeVersion version)
+static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, int from)
{
- QString s = str;
+ QString &s = *str;
const int l = s.length()-1;
- int pos = 0;
+ int pos = from;
while (pos < l) {
int p2 = pos+1;
uint u1 = s.at(pos).unicode();
@@ -1593,7 +1588,6 @@ static QString canonicalOrderHelper
++pos;
}
}
- return s;
}
int QT_FASTCALL QUnicodeTables::script(unsigned int uc)
diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp
index e738ec8..f42b7a0 100644
--- a/src/corelib/tools/qcontiguouscache.cpp
+++ b/src/corelib/tools/qcontiguouscache.cpp
@@ -61,6 +61,7 @@ void QContiguousCacheData::dump() const
\ingroup tools
\ingroup shared
\reentrant
+ \since 4.6
The QContiguousCache class provides an efficient way of caching items for
display in a user interface view. Unlike QCache, it adds a restriction
@@ -95,7 +96,7 @@ MyRecord record(int row) const
in the case where the requested row is a long way from the currently cached
items. If there is a gap between where the new item is inserted and the currently
cached items then the existing cached items are first removed to retain
- the contiguous nature of the cache. Hence it is important to take some care then
+ the contiguous nature of the cache. Hence it is important to take some care then
when using insert() in order to avoid unwanted clearing of the cache.
The range of valid indexes for the QContiguousCache class are from
@@ -104,9 +105,9 @@ MyRecord record(int row) const
than INT_MAX can result in the indexes of the cache being invalid.
When the cache indexes are invalid it is important to call
normalizeIndexes() before calling any of containsIndex(), firstIndex(),
- lastIndex(), at() or the [] operator. Calling these
- functions when the cache has invalid indexes will result in undefined
- behavior. The indexes can be checked by using areIndexesValid()
+ lastIndex(), at() or \l{QContiguousCache::operator[]()}{operator[]()}.
+ Calling these functions when the cache has invalid indexes will result in
+ undefined behavior. The indexes can be checked by using areIndexesValid()
In most cases the indexes will not exceed 0 to INT_MAX, and
normalizeIndexes() will not need to be used.
@@ -190,8 +191,6 @@ MyRecord record(int row) const
/*! \fn int QContiguousCache::count() const
- \overload
-
Same as size().
*/
@@ -258,14 +257,15 @@ MyRecord record(int row) const
/*! \fn T &QContiguousCache::operator[](int i)
- Returns the item at index position \a i as a modifiable reference. If
+ Returns the item at index position \a i as a modifiable reference. If
the cache does not contain an item at the given index position \a i
then it will first insert an empty item at that position.
In most cases it is better to use either at() or insert().
- Note that using non-const operators can cause QContiguousCache to do a deep
- copy.
+ \note This non-const overload of operator[] requires QContiguousCache
+ to make a deep copy. Use at() for read-only access to a non-const
+ QContiguousCache.
\sa insert(), at()
*/
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h
index 7d52f1e..0020d22 100644
--- a/src/corelib/tools/qcontiguouscache.h
+++ b/src/corelib/tools/qcontiguouscache.h
@@ -166,8 +166,8 @@ void QContiguousCache<T>::detach_helper()
T *dest = x.d->array + x.d->start;
T *src = d->array + d->start;
- int count = x.d->count;
- while (count--) {
+ int oldcount = x.d->count;
+ while (oldcount--) {
if (QTypeInfo<T>::isComplex) {
new (dest) T(*src);
} else {
@@ -200,8 +200,8 @@ void QContiguousCache<T>::setCapacity(int asize)
x.d->start = x.d->offset % x.d->alloc;
T *dest = x.d->array + (x.d->start + x.d->count-1) % x.d->alloc;
T *src = d->array + (d->start + d->count-1) % d->alloc;
- int count = x.d->count;
- while (count--) {
+ int oldcount = x.d->count;
+ while (oldcount--) {
if (QTypeInfo<T>::isComplex) {
new (dest) T(*src);
} else {
@@ -224,10 +224,10 @@ void QContiguousCache<T>::clear()
{
if (d->ref == 1) {
if (QTypeInfo<T>::isComplex) {
- int count = d->count;
+ int oldcount = d->count;
T * i = d->array + d->start;
T * e = d->array + d->alloc;
- while (count--) {
+ while (oldcount--) {
i->~T();
i++;
if (i == e)
@@ -254,11 +254,11 @@ inline QContiguousCacheData *QContiguousCache<T>::malloc(int aalloc)
}
template <typename T>
-QContiguousCache<T>::QContiguousCache(int capacity)
+QContiguousCache<T>::QContiguousCache(int cap)
{
- p = malloc(capacity);
+ p = malloc(cap);
d->ref = 1;
- d->alloc = capacity;
+ d->alloc = cap;
d->count = d->start = d->offset = 0;
d->sharable = true;
}
@@ -295,10 +295,10 @@ template <typename T>
void QContiguousCache<T>::free(Data *x)
{
if (QTypeInfo<T>::isComplex) {
- int count = d->count;
+ int oldcount = d->count;
T * i = d->array + d->start;
T * e = d->array + d->alloc;
- while (count--) {
+ while (oldcount--) {
i->~T();
i++;
if (i == e)
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 5dc7693..74fbe0a 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -49,7 +49,7 @@
#include "qregexp.h"
#include "qdebug.h"
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
-#include <windows.h>
+#include <qt_windows.h>
#endif
#ifndef Q_WS_WIN
#include <locale.h>
@@ -2501,16 +2501,9 @@ QString QDateTime::toString(Qt::DateFormat f) const
buf += QLatin1Char(' ');
buf += QString::number(d->date.day());
#else
- QString winstr;
- QT_WA({
- TCHAR out[255];
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILDATE, out, 255);
- winstr = QString::fromUtf16((ushort*)out);
- } , {
- char out[255];
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ILDATE, (char*)&out, 255);
- winstr = QString::fromLocal8Bit(out);
- });
+ wchar_t out[255];
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILDATE, out, 255);
+ QString winstr = QString::fromWCharArray(out);
switch (winstr.toInt()) {
case 1:
buf = d->date.shortDayName(d->date.dayOfWeek());
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 18a252a..0828c61 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -60,8 +60,10 @@
Easing curves describe a function that controls how the speed of the interpolation
between 0 and 1 should be. Easing curves allow transitions from
one value to another to appear more natural than a simple constant speed would allow.
- The QEasingCurve class is usually used in conjunction with the QAnimation class,
- but can be used on its own.
+ The QEasingCurve class is usually used in conjunction with the QVariantAnimation and
+ QPropertyAnimation classes but can be used on its own. It is usually used to accelerate
+ the interpolation from zero velocity (ease in) or decelerate to zero velocity (ease out).
+ Ease in and ease out can also be combined in the same easing curve.
To calculate the speed of the interpolation, the easing curve provides the function
valueForProgress(), where the \a progress argument specifies the progress of the
@@ -80,10 +82,10 @@
\endcode
will print the effective progress of the interpolation between 0 and 1.
- When using a QAnimation, the easing curve will be used to control the
+ When using a QPropertyAnimation, the associated easing curve will be used to control the
progress of the interpolation between startValue and endValue:
\code
- QAnimation animation;
+ QPropertyAnimation animation;
animation.setStartValue(0);
animation.setEndValue(1000);
animation.setDuration(1000);
@@ -98,189 +100,191 @@
\value Linear \inlineimage qeasingcurve-linear.png
\br
- Easing equation function for a simple linear tweening,
- with no easing.
+ Easing curve for a linear (t) function:
+ velocity is constant.
\value InQuad \inlineimage qeasingcurve-inquad.png
\br
- Easing equation function for a quadratic (t^2) easing
- in: accelerating from zero velocity.
+ Easing curve for a quadratic (t^2) function:
+ accelerating from zero velocity.
\value OutQuad \inlineimage qeasingcurve-outquad.png
\br
- Easing equation function for a quadratic (t^2) easing
- out: decelerating to zero velocity.
+ Easing curve for a quadratic (t^2) function:
+ decelerating to zero velocity.
\value InOutQuad \inlineimage qeasingcurve-inoutquad.png
\br
- Easing equation function for a quadratic (t^2) easing
- in/out: acceleration until halfway, then deceleration.
+ Easing curve for a quadratic (t^2) function:
+ acceleration until halfway, then deceleration.
\value OutInQuad \inlineimage qeasingcurve-outinquad.png
\br
- Easing equation function for a quadratic (t^2) easing
- out/in: deceleration until halfway, then acceleration.
+ Easing curve for a quadratic (t^2) function:
+ deceleration until halfway, then acceleration.
\value InCubic \inlineimage qeasingcurve-incubic.png
\br
- Easing equation function for a cubic (t^3) easing
- in: accelerating from zero velocity.
+ Easing curve for a cubic (t^3) function:
+ accelerating from zero velocity.
\value OutCubic \inlineimage qeasingcurve-outcubic.png
\br
- Easing equation function for a cubic (t^3) easing
- out: decelerating from zero velocity.
+ Easing curve for a cubic (t^3) function:
+ decelerating from zero velocity.
\value InOutCubic \inlineimage qeasingcurve-inoutcubic.png
\br
- Easing equation function for a cubic (t^3) easing
- in/out: acceleration until halfway, then deceleration.
+ Easing curve for a cubic (t^3) function:
+ acceleration until halfway, then deceleration.
\value OutInCubic \inlineimage qeasingcurve-outincubic.png
\br
- Easing equation function for a cubic (t^3) easing
- out/in: deceleration until halfway, then acceleration.
+ Easing curve for a cubic (t^3) function:
+ deceleration until halfway, then acceleration.
\value InQuart \inlineimage qeasingcurve-inquart.png
\br
- Easing equation function for a quartic (t^4) easing
- in: accelerating from zero velocity.
+ Easing curve for a quartic (t^4) function:
+ accelerating from zero velocity.
\value OutQuart \inlineimage qeasingcurve-outquart.png
\br
- Easing equation function for a quartic (t^4) easing
- out: decelerating from zero velocity.
+ Easing curve for a cubic (t^4) function:
+ decelerating from zero velocity.
\value InOutQuart \inlineimage qeasingcurve-inoutquart.png
\br
- Easing equation function for a quartic (t^4) easing
- in/out: acceleration until halfway, then deceleration.
+ Easing curve for a cubic (t^4) function:
+ acceleration until halfway, then deceleration.
\value OutInQuart \inlineimage qeasingcurve-outinquart.png
\br
- Easing equation function for a quartic (t^4) easing
- out/in: deceleration until halfway, then acceleration.
+ Easing curve for a cubic (t^4) function:
+ deceleration until halfway, then acceleration.
\value InQuint \inlineimage qeasingcurve-inquint.png
\br
- Easing equation function for a quintic (t^5) easing
+ Easing curve for a quintic (t^5) easing
in: accelerating from zero velocity.
\value OutQuint \inlineimage qeasingcurve-outquint.png
\br
- Easing equation function for a quintic (t^5) easing
- out: decelerating from zero velocity.
+ Easing curve for a cubic (t^5) function:
+ decelerating from zero velocity.
\value InOutQuint \inlineimage qeasingcurve-inoutquint.png
\br
- Easing equation function for a quintic (t^5) easing
- in/out: acceleration until halfway, then deceleration.
+ Easing curve for a cubic (t^5) function:
+ acceleration until halfway, then deceleration.
\value OutInQuint \inlineimage qeasingcurve-outinquint.png
\br
- Easing equation function for a quintic (t^5) easing
- out/in: deceleration until halfway, then acceleration.
+ Easing curve for a cubic (t^5) function:
+ deceleration until halfway, then acceleration.
\value InSine \inlineimage qeasingcurve-insine.png
\br
- Easing equation function for a sinusoidal (sin(t)) easing
- in: accelerating from zero velocity.
+ Easing curve for a sinusoidal (sin(t)) function:
+ accelerating from zero velocity.
\value OutSine \inlineimage qeasingcurve-outsine.png
\br
- Easing equation function for a sinusoidal (sin(t)) easing
- out: decelerating from zero velocity.
+ Easing curve for a sinusoidal (sin(t)) function:
+ decelerating from zero velocity.
\value InOutSine \inlineimage qeasingcurve-inoutsine.png
\br
- Easing equation function for a sinusoidal (sin(t)) easing
- in/out: acceleration until halfway, then deceleration.
+ Easing curve for a sinusoidal (sin(t)) function:
+ acceleration until halfway, then deceleration.
\value OutInSine \inlineimage qeasingcurve-outinsine.png
\br
- Easing equation function for a sinusoidal (sin(t)) easing
- out/in: deceleration until halfway, then acceleration.
+ Easing curve for a sinusoidal (sin(t)) function:
+ deceleration until halfway, then acceleration.
\value InExpo \inlineimage qeasingcurve-inexpo.png
\br
- Easing equation function for an exponential (2^t) easing
- in: accelerating from zero velocity.
+ Easing curve for an exponential (2^t) function:
+ accelerating from zero velocity.
\value OutExpo \inlineimage qeasingcurve-outexpo.png
\br
- Easing equation function for an exponential (2^t) easing
- out: decelerating from zero velocity.
+ Easing curve for an exponential (2^t) function:
+ decelerating from zero velocity.
\value InOutExpo \inlineimage qeasingcurve-inoutexpo.png
\br
- Easing equation function for an exponential (2^t) easing
- in/out: acceleration until halfway, then deceleration.
+ Easing curve for an exponential (2^t) function:
+ acceleration until halfway, then deceleration.
\value OutInExpo \inlineimage qeasingcurve-outinexpo.png
\br
- Easing equation function for an exponential (2^t) easing
- out/in: deceleration until halfway, then acceleration.
+ Easing curve for an exponential (2^t) function:
+ deceleration until halfway, then acceleration.
\value InCirc \inlineimage qeasingcurve-incirc.png
\br
- Easing equation function for a circular (sqrt(1-t^2)) easing
- in: accelerating from zero velocity.
+ Easing curve for a circular (sqrt(1-t^2)) function:
+ accelerating from zero velocity.
\value OutCirc \inlineimage qeasingcurve-outcirc.png
\br
- Easing equation function for a circular (sqrt(1-t^2)) easing
- out: decelerating from zero velocity.
+ Easing curve for a circular (sqrt(1-t^2)) function:
+ decelerating from zero velocity.
\value InOutCirc \inlineimage qeasingcurve-inoutcirc.png
\br
- Easing equation function for a circular (sqrt(1-t^2)) easing
- in/out: acceleration until halfway, then deceleration.
+ Easing curve for a circular (sqrt(1-t^2)) function:
+ acceleration until halfway, then deceleration.
\value OutInCirc \inlineimage qeasingcurve-outincirc.png
\br
- Easing equation function for a circular (sqrt(1-t^2)) easing
- out/in: deceleration until halfway, then acceleration.
+ Easing curve for a circular (sqrt(1-t^2)) function:
+ deceleration until halfway, then acceleration.
\value InElastic \inlineimage qeasingcurve-inelastic.png
\br
- Easing equation function for an elastic
- (exponentially decaying sine wave) easing in:
+ Easing curve for an elastic
+ (exponentially decaying sine wave) function:
accelerating from zero velocity. The peak amplitude
can be set with the \e amplitude parameter, and the
period of decay by the \e period parameter.
\value OutElastic \inlineimage qeasingcurve-outelastic.png
\br
- Easing equation function for an elastic
- (exponentially decaying sine wave) easing out:
+ Easing curve for an elastic
+ (exponentially decaying sine wave) function:
decelerating from zero velocity. The peak amplitude
can be set with the \e amplitude parameter, and the
period of decay by the \e period parameter.
\value InOutElastic \inlineimage qeasingcurve-inoutelastic.png
\br
- Easing equation function for an elastic
- (exponentially decaying sine wave) easing in/out:
+ Easing curve for an elastic
+ (exponentially decaying sine wave) function:
acceleration until halfway, then deceleration.
\value OutInElastic \inlineimage qeasingcurve-outinelastic.png
\br
- Easing equation function for an elastic
- (exponentially decaying sine wave) easing out/in:
+ Easing curve for an elastic
+ (exponentially decaying sine wave) function:
deceleration until halfway, then acceleration.
\value InBack \inlineimage qeasingcurve-inback.png
\br
- Easing equation function for a back (overshooting
- cubic easing: (s+1)*t^3 - s*t^2) easing in:
+ Easing curve for a back (overshooting
+ cubic function: (s+1)*t^3 - s*t^2) easing in:
accelerating from zero velocity.
\value OutBack \inlineimage qeasingcurve-outback.png
\br
- Easing equation function for a back (overshooting
- cubic easing: (s+1)*t^3 - s*t^2) easing out:
- decelerating from zero velocity.
+ Easing curve for a back (overshooting
+ cubic function: (s+1)*t^3 - s*t^2) easing out:
+ decelerating to zero velocity.
\value InOutBack \inlineimage qeasingcurve-inoutback.png
\br
- Easing equation function for a back (overshooting
- cubic easing: (s+1)*t^3 - s*t^2) easing in/out:
+ Easing curve for a back (overshooting
+ cubic function: (s+1)*t^3 - s*t^2) easing in/out:
acceleration until halfway, then deceleration.
\value OutInBack \inlineimage qeasingcurve-outinback.png
\br
- Easing equation function for a back (overshooting
+ Easing curve for a back (overshooting
cubic easing: (s+1)*t^3 - s*t^2) easing out/in:
deceleration until halfway, then acceleration.
\value InBounce \inlineimage qeasingcurve-inbounce.png
\br
- Easing equation function for a bounce (exponentially
- decaying parabolic bounce) easing in: accelerating
+ Easing curve for a bounce (exponentially
+ decaying parabolic bounce) function: accelerating
from zero velocity.
\value OutBounce \inlineimage qeasingcurve-outbounce.png
\br
- Easing equation function for a bounce (exponentially
- decaying parabolic bounce) easing out: decelerating
+ Easing curve for a bounce (exponentially
+ decaying parabolic bounce) function: decelerating
from zero velocity.
\value InOutBounce \inlineimage qeasingcurve-inoutbounce.png
\br
- Easing equation function for a bounce (exponentially
- decaying parabolic bounce) easing in/out:
+ Easing curve for a bounce (exponentially
+ decaying parabolic bounce) function easing in/out:
acceleration until halfway, then deceleration.
\value OutInBounce \inlineimage qeasingcurve-outinbounce.png
\br
- Easing equation function for a bounce (exponentially
- decaying parabolic bounce) easing out/in:
+ Easing curve for a bounce (exponentially
+ decaying parabolic bounce) function easing out/in:
deceleration until halfway, then acceleration.
\omitvalue InCurve
\omitvalue OutCurve
\omitvalue SineCurve
\omitvalue CosineCurve
- \value Custom This is returned if the user have specified a custom curve type with setCustomType(). Note that you cannot call setType() with this value, but type() can return it.
+ \value Custom This is returned if the user specified a custom curve type with
+ setCustomType(). Note that you cannot call setType() with this value,
+ but type() can return it.
\omitvalue NCurveTypes
*/
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 17634c1..a7cc95b 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -393,15 +393,8 @@ static QString winIso3116CtryName(LCID id = LOCALE_USER_DEFAULT);
static QString getWinLocaleInfo(LCTYPE type)
{
- int cnt = 0;
-
LCID id = GetUserDefaultLCID();
-
- QT_WA({
- cnt = GetLocaleInfoW(id, type, 0, 0)*2;
- } , {
- cnt = GetLocaleInfoA(id, type, 0, 0);
- });
+ int cnt = GetLocaleInfo(id, type, 0, 0) * 2;
if (cnt == 0) {
qWarning("QLocale: empty windows locale info (%d)", (int)type);
@@ -410,27 +403,14 @@ static QString getWinLocaleInfo(LCTYPE type)
QByteArray buff(cnt, 0);
- QT_WA({
- cnt = GetLocaleInfoW(id, type,
- reinterpret_cast<wchar_t*>(buff.data()),
- buff.size()/2);
- } , {
- cnt = GetLocaleInfoA(id, type,
- buff.data(), buff.size());
- });
+ cnt = GetLocaleInfo(id, type, reinterpret_cast<wchar_t*>(buff.data()), buff.size() / 2);
if (cnt == 0) {
qWarning("QLocale: empty windows locale info (%d)", (int)type);
return QString();
}
- QString result;
- QT_WA({
- result = QString::fromUtf16(reinterpret_cast<ushort*>(buff.data()));
- } , {
- result = QString::fromLocal8Bit(buff.data());
- });
- return result;
+ return QString::fromWCharArray(reinterpret_cast<const wchar_t *>(buff.data()));
}
QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT)
@@ -440,8 +420,8 @@ QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT)
result = envVarLocale();
QChar lang[3];
QChar cntry[2];
- if ( result == "C" || !result.isEmpty()
- && splitLocaleName(QString::fromLocal8Bit(result), lang, cntry) ) {
+ if ( result == "C" || (!result.isEmpty()
+ && splitLocaleName(QString::fromLocal8Bit(result), lang, cntry)) ) {
long id = 0;
bool ok = false;
id = qstrtoll(result.data(), 0, 0, &ok);
@@ -452,20 +432,19 @@ QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT)
}
}
- if (QSysInfo::WindowsVersion == QSysInfo::WV_95
- || (QSysInfo::WindowsVersion & QSysInfo::WV_CE_based)) {
- result = winLangCodeToIsoName(id != LOCALE_USER_DEFAULT ? id : GetUserDefaultLCID());
- } else {
- if (id == LOCALE_USER_DEFAULT)
- id = GetUserDefaultLCID();
- QString resultuage = winIso639LangName(id);
- QString country = winIso3116CtryName(id);
- result = resultuage.toLatin1();
- if (!country.isEmpty()) {
- result += '_';
- result += country.toLatin1();
- }
+#if defined(Q_OS_WINCE)
+ result = winLangCodeToIsoName(id != LOCALE_USER_DEFAULT ? id : GetUserDefaultLCID());
+#else
+ if (id == LOCALE_USER_DEFAULT)
+ id = GetUserDefaultLCID();
+ QString resultuage = winIso639LangName(id);
+ QString country = winIso3116CtryName(id);
+ result = resultuage.toLatin1();
+ if (!country.isEmpty()) {
+ result += '_';
+ result += country.toLatin1();
}
+#endif
return result;
}
@@ -551,15 +530,9 @@ static QString winDateToString(const QDate &date, DWORD flags)
LCID id = GetUserDefaultLCID();
- QT_WA({
- TCHAR buf[255];
- if (GetDateFormatW(id, flags, &st, 0, buf, 255))
- return QString::fromUtf16((ushort*)buf);
- } , {
- char buf[255];
- if (GetDateFormatA(id, flags, &st, 0, (char*)&buf, 255))
- return QString::fromLocal8Bit(buf);
- });
+ wchar_t buf[255];
+ if (GetDateFormat(id, flags, &st, 0, buf, 255))
+ return QString::fromWCharArray(buf);
return QString();
}
@@ -576,15 +549,9 @@ static QString winTimeToString(const QTime &time)
DWORD flags = 0;
LCID id = GetUserDefaultLCID();
- QT_WA({
- TCHAR buf[255];
- if (GetTimeFormatW(id, flags, &st, 0, buf, 255))
- return QString::fromUtf16((ushort*)buf);
- } , {
- char buf[255];
- if (GetTimeFormatA(id, flags, &st, 0, (char*)&buf, 255))
- return QString::fromLocal8Bit(buf);
- });
+ wchar_t buf[255];
+ if (GetTimeFormat(id, flags, &st, 0, buf, 255))
+ return QString::fromWCharArray(buf);
return QString();
}
@@ -633,12 +600,10 @@ static QString winMonthName(int month, bool short_format)
static QLocale::MeasurementSystem winSystemMeasurementSystem()
{
LCID id = GetUserDefaultLCID();
- TCHAR output[2];
+ wchar_t output[2];
if (GetLocaleInfo(id, LOCALE_IMEASURE, output, 2)) {
- QString iMeasure = QT_WA_INLINE(
- QString::fromUtf16(reinterpret_cast<ushort*>(output)),
- QString::fromLocal8Bit(reinterpret_cast<char*>(output)));
+ QString iMeasure = QString::fromWCharArray(output);
if (iMeasure == QLatin1String("1")) {
return QLocale::ImperialSystem;
}
@@ -650,12 +615,10 @@ static QLocale::MeasurementSystem winSystemMeasurementSystem()
static QString winSystemAMText()
{
LCID id = GetUserDefaultLCID();
- TCHAR output[15]; // maximum length including terminating zero character for Win2003+
+ wchar_t output[15]; // maximum length including terminating zero character for Win2003+
if (GetLocaleInfo(id, LOCALE_S1159, output, 15)) {
- return QT_WA_INLINE(
- QString::fromUtf16(reinterpret_cast<ushort*>(output)),
- QString::fromLocal8Bit(reinterpret_cast<char*>(output)));
+ return QString::fromWCharArray(output);
}
return QString();
@@ -664,12 +627,10 @@ static QString winSystemAMText()
static QString winSystemPMText()
{
LCID id = GetUserDefaultLCID();
- TCHAR output[15]; // maximum length including terminating zero character for Win2003+
+ wchar_t output[15]; // maximum length including terminating zero character for Win2003+
if (GetLocaleInfo(id, LOCALE_S2359, output, 15)) {
- return QT_WA_INLINE(
- QString::fromUtf16(reinterpret_cast<ushort*>(output)),
- QString::fromLocal8Bit(reinterpret_cast<char*>(output)));
+ return QString::fromWCharArray(output);
}
return QString();
@@ -773,9 +734,6 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
return QVariant();
}
-/* Win95 doesn't have a function to return the ISO lang/country name of the user's locale.
- Instead it can return a "Windows code". This maps windows codes to ISO country names. */
-
struct WindowsToISOListElt {
ushort windows_code;
char iso_name[6];
@@ -931,15 +889,9 @@ static QString winIso639LangName(LCID id)
// Windows returns the wrong ISO639 for some languages, we need to detect them here using
// the language code
QString lang_code;
- QT_WA({
- TCHAR out[256];
- if (GetLocaleInfoW(id, LOCALE_ILANGUAGE, out, 255))
- lang_code = QString::fromUtf16((ushort*)out);
- } , {
- char out[256];
- if (GetLocaleInfoA(id, LOCALE_ILANGUAGE, out, 255))
- lang_code = QString::fromLocal8Bit(out);
- });
+ wchar_t out[256];
+ if (GetLocaleInfo(id, LOCALE_ILANGUAGE, out, 255))
+ lang_code = QString::fromWCharArray(out);
if (!lang_code.isEmpty()) {
const char *endptr;
@@ -961,15 +913,8 @@ static QString winIso639LangName(LCID id)
return result;
// not one of the problematic languages - do the usual lookup
- QT_WA({
- TCHAR out[256];
- if (GetLocaleInfoW(id, LOCALE_SISO639LANGNAME , out, 255))
- result = QString::fromUtf16((ushort*)out);
- } , {
- char out[256];
- if (GetLocaleInfoA(id, LOCALE_SISO639LANGNAME, out, 255))
- result = QString::fromLocal8Bit(out);
- });
+ if (GetLocaleInfo(id, LOCALE_SISO639LANGNAME , out, 255))
+ result = QString::fromWCharArray(out);
return result;
}
@@ -978,15 +923,9 @@ static QString winIso3116CtryName(LCID id)
{
QString result;
- QT_WA({
- TCHAR out[256];
- if (GetLocaleInfoW(id, LOCALE_SISO3166CTRYNAME, out, 255))
- result = QString::fromUtf16((ushort*)out);
- } , {
- char out[256];
- if (GetLocaleInfoA(id, LOCALE_SISO3166CTRYNAME, out, 255))
- result = QString::fromLocal8Bit(out);
- });
+ wchar_t out[256];
+ if (GetLocaleInfo(id, LOCALE_SISO3166CTRYNAME, out, 255))
+ result = QString::fromWCharArray(out);
return result;
}
@@ -2696,7 +2635,7 @@ static QString timeZone()
DWORD res = GetTimeZoneInformation(&info);
if (res == TIME_ZONE_ID_UNKNOWN)
return QString();
- return QString::fromUtf16(reinterpret_cast<const ushort *> (info.StandardName));
+ return QString::fromWCharArray(info.StandardName);
#elif defined(Q_OS_WIN)
_tzset();
# if defined(_MSC_VER) && _MSC_VER >= 1400
@@ -5368,7 +5307,11 @@ struct p5s_deleter
{
~p5s_deleter()
{
- Bfree(p5s);
+ while (p5s) {
+ Bigint *next = p5s->next;
+ Bfree(p5s);
+ p5s = next;
+ }
}
};
diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp
index 49afdca..af60f52 100644
--- a/src/corelib/tools/qpoint.cpp
+++ b/src/corelib/tools/qpoint.cpp
@@ -444,6 +444,8 @@ QDebug operator<<(QDebug d, const QPointF &p)
/*!
+ \since 4.6
+
Returns the sum of the absolute values of x() and y(),
traditionally known as the "Manhattan length" of the vector from
the origin to the point.
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index d7d347f..adca703 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -70,6 +70,8 @@ int qFindString(const QChar *haystack, int haystackLen, int from,
#define RXERR_LEFTDELIM QT_TRANSLATE_NOOP("QRegExp", "missing left delim")
#define RXERR_END QT_TRANSLATE_NOOP("QRegExp", "unexpected end")
#define RXERR_LIMIT QT_TRANSLATE_NOOP("QRegExp", "met internal limit")
+#define RXERR_INTERVAL QT_TRANSLATE_NOOP("QRegExp", "invalid interval")
+#define RXERR_CATEGORY QT_TRANSLATE_NOOP("QRegExp", "invalid category")
/*
WARNING! Be sure to read qregexp.tex before modifying this file.
@@ -1116,6 +1118,7 @@ private:
bool valid; // is the regular expression valid?
Qt::CaseSensitivity cs; // case sensitive?
bool greedyQuantifiers; // RegExp2?
+ bool xmlSchemaExtensions;
#ifndef QT_NO_REGEXP_BACKREF
int nbrefs; // number of back-references
#endif
@@ -1193,6 +1196,8 @@ private:
friend class Box;
+ void setupCategoriesRangeMap();
+
/*
This is the lexical analyzer for regular expressions.
*/
@@ -1232,6 +1237,7 @@ private:
int yyTok; // the last token read
bool yyMayCapture; // set this to false to disable capturing
+ QHash<QByteArray, QPair<int, int> > categoriesRangeMap; // fast lookup hash for xml schema extensions
friend struct QRegExpMatchState;
};
@@ -1253,7 +1259,8 @@ struct QRegExpLookahead
#endif
QRegExpEngine::QRegExpEngine(const QRegExpEngineKey &key)
- : cs(key.cs), greedyQuantifiers(key.patternSyntax == QRegExp::RegExp2)
+ : cs(key.cs), greedyQuantifiers(key.patternSyntax == QRegExp::RegExp2),
+ xmlSchemaExtensions(false)
{
setup();
@@ -1268,6 +1275,8 @@ QRegExpEngine::QRegExpEngine(const QRegExpEngineKey &key)
case QRegExp::FixedString:
rx = QRegExp::escape(key.pattern);
break;
+ case QRegExp::W3CXmlSchema11:
+ xmlSchemaExtensions = true;
default:
rx = key.pattern;
}
@@ -1485,9 +1494,8 @@ int QRegExpEngine::anchorAlternation(int a, int b)
return Anchor_Alternation | (n - 1);
#endif
- aa.resize(n + 1);
- aa[n].a = a;
- aa[n].b = b;
+ QRegExpAnchorAlternation element = {a, b};
+ aa.append(element);
return Anchor_Alternation | n;
}
@@ -2627,6 +2635,152 @@ void QRegExpEngine::Box::addAnchorsToEngine(const Box &to) const
}
}
+void QRegExpEngine::setupCategoriesRangeMap()
+{
+ categoriesRangeMap.insert("IsBasicLatin", qMakePair(0x0000, 0x007F));
+ categoriesRangeMap.insert("IsLatin-1Supplement", qMakePair(0x0080, 0x00FF));
+ categoriesRangeMap.insert("IsLatinExtended-A", qMakePair(0x0100, 0x017F));
+ categoriesRangeMap.insert("IsLatinExtended-B", qMakePair(0x0180, 0x024F));
+ categoriesRangeMap.insert("IsIPAExtensions", qMakePair(0x0250, 0x02AF));
+ categoriesRangeMap.insert("IsSpacingModifierLetters", qMakePair(0x02B0, 0x02FF));
+ categoriesRangeMap.insert("IsCombiningDiacriticalMarks", qMakePair(0x0300, 0x036F));
+ categoriesRangeMap.insert("IsGreek", qMakePair(0x0370, 0x03FF));
+ categoriesRangeMap.insert("IsCyrillic", qMakePair(0x0400, 0x04FF));
+ categoriesRangeMap.insert("IsCyrillicSupplement", qMakePair(0x0500, 0x052F));
+ categoriesRangeMap.insert("IsArmenian", qMakePair(0x0530, 0x058F));
+ categoriesRangeMap.insert("IsHebrew", qMakePair(0x0590, 0x05FF));
+ categoriesRangeMap.insert("IsArabic", qMakePair(0x0600, 0x06FF));
+ categoriesRangeMap.insert("IsSyriac", qMakePair(0x0700, 0x074F));
+ categoriesRangeMap.insert("IsArabicSupplement", qMakePair(0x0750, 0x077F));
+ categoriesRangeMap.insert("IsThaana", qMakePair(0x0780, 0x07BF));
+ categoriesRangeMap.insert("IsDevanagari", qMakePair(0x0900, 0x097F));
+ categoriesRangeMap.insert("IsBengali", qMakePair(0x0980, 0x09FF));
+ categoriesRangeMap.insert("IsGurmukhi", qMakePair(0x0A00, 0x0A7F));
+ categoriesRangeMap.insert("IsGujarati", qMakePair(0x0A80, 0x0AFF));
+ categoriesRangeMap.insert("IsOriya", qMakePair(0x0B00, 0x0B7F));
+ categoriesRangeMap.insert("IsTamil", qMakePair(0x0B80, 0x0BFF));
+ categoriesRangeMap.insert("IsTelugu", qMakePair(0x0C00, 0x0C7F));
+ categoriesRangeMap.insert("IsKannada", qMakePair(0x0C80, 0x0CFF));
+ categoriesRangeMap.insert("IsMalayalam", qMakePair(0x0D00, 0x0D7F));
+ categoriesRangeMap.insert("IsSinhala", qMakePair(0x0D80, 0x0DFF));
+ categoriesRangeMap.insert("IsThai", qMakePair(0x0E00, 0x0E7F));
+ categoriesRangeMap.insert("IsLao", qMakePair(0x0E80, 0x0EFF));
+ categoriesRangeMap.insert("IsTibetan", qMakePair(0x0F00, 0x0FFF));
+ categoriesRangeMap.insert("IsMyanmar", qMakePair(0x1000, 0x109F));
+ categoriesRangeMap.insert("IsGeorgian", qMakePair(0x10A0, 0x10FF));
+ categoriesRangeMap.insert("IsHangulJamo", qMakePair(0x1100, 0x11FF));
+ categoriesRangeMap.insert("IsEthiopic", qMakePair(0x1200, 0x137F));
+ categoriesRangeMap.insert("IsEthiopicSupplement", qMakePair(0x1380, 0x139F));
+ categoriesRangeMap.insert("IsCherokee", qMakePair(0x13A0, 0x13FF));
+ categoriesRangeMap.insert("IsUnifiedCanadianAboriginalSyllabics", qMakePair(0x1400, 0x167F));
+ categoriesRangeMap.insert("IsOgham", qMakePair(0x1680, 0x169F));
+ categoriesRangeMap.insert("IsRunic", qMakePair(0x16A0, 0x16FF));
+ categoriesRangeMap.insert("IsTagalog", qMakePair(0x1700, 0x171F));
+ categoriesRangeMap.insert("IsHanunoo", qMakePair(0x1720, 0x173F));
+ categoriesRangeMap.insert("IsBuhid", qMakePair(0x1740, 0x175F));
+ categoriesRangeMap.insert("IsTagbanwa", qMakePair(0x1760, 0x177F));
+ categoriesRangeMap.insert("IsKhmer", qMakePair(0x1780, 0x17FF));
+ categoriesRangeMap.insert("IsMongolian", qMakePair(0x1800, 0x18AF));
+ categoriesRangeMap.insert("IsLimbu", qMakePair(0x1900, 0x194F));
+ categoriesRangeMap.insert("IsTaiLe", qMakePair(0x1950, 0x197F));
+ categoriesRangeMap.insert("IsNewTaiLue", qMakePair(0x1980, 0x19DF));
+ categoriesRangeMap.insert("IsKhmerSymbols", qMakePair(0x19E0, 0x19FF));
+ categoriesRangeMap.insert("IsBuginese", qMakePair(0x1A00, 0x1A1F));
+ categoriesRangeMap.insert("IsPhoneticExtensions", qMakePair(0x1D00, 0x1D7F));
+ categoriesRangeMap.insert("IsPhoneticExtensionsSupplement", qMakePair(0x1D80, 0x1DBF));
+ categoriesRangeMap.insert("IsCombiningDiacriticalMarksSupplement", qMakePair(0x1DC0, 0x1DFF));
+ categoriesRangeMap.insert("IsLatinExtendedAdditional", qMakePair(0x1E00, 0x1EFF));
+ categoriesRangeMap.insert("IsGreekExtended", qMakePair(0x1F00, 0x1FFF));
+ categoriesRangeMap.insert("IsGeneralPunctuation", qMakePair(0x2000, 0x206F));
+ categoriesRangeMap.insert("IsSuperscriptsandSubscripts", qMakePair(0x2070, 0x209F));
+ categoriesRangeMap.insert("IsCurrencySymbols", qMakePair(0x20A0, 0x20CF));
+ categoriesRangeMap.insert("IsCombiningMarksforSymbols", qMakePair(0x20D0, 0x20FF));
+ categoriesRangeMap.insert("IsLetterlikeSymbols", qMakePair(0x2100, 0x214F));
+ categoriesRangeMap.insert("IsNumberForms", qMakePair(0x2150, 0x218F));
+ categoriesRangeMap.insert("IsArrows", qMakePair(0x2190, 0x21FF));
+ categoriesRangeMap.insert("IsMathematicalOperators", qMakePair(0x2200, 0x22FF));
+ categoriesRangeMap.insert("IsMiscellaneousTechnical", qMakePair(0x2300, 0x23FF));
+ categoriesRangeMap.insert("IsControlPictures", qMakePair(0x2400, 0x243F));
+ categoriesRangeMap.insert("IsOpticalCharacterRecognition", qMakePair(0x2440, 0x245F));
+ categoriesRangeMap.insert("IsEnclosedAlphanumerics", qMakePair(0x2460, 0x24FF));
+ categoriesRangeMap.insert("IsBoxDrawing", qMakePair(0x2500, 0x257F));
+ categoriesRangeMap.insert("IsBlockElements", qMakePair(0x2580, 0x259F));
+ categoriesRangeMap.insert("IsGeometricShapes", qMakePair(0x25A0, 0x25FF));
+ categoriesRangeMap.insert("IsMiscellaneousSymbols", qMakePair(0x2600, 0x26FF));
+ categoriesRangeMap.insert("IsDingbats", qMakePair(0x2700, 0x27BF));
+ categoriesRangeMap.insert("IsMiscellaneousMathematicalSymbols-A", qMakePair(0x27C0, 0x27EF));
+ categoriesRangeMap.insert("IsSupplementalArrows-A", qMakePair(0x27F0, 0x27FF));
+ categoriesRangeMap.insert("IsBraillePatterns", qMakePair(0x2800, 0x28FF));
+ categoriesRangeMap.insert("IsSupplementalArrows-B", qMakePair(0x2900, 0x297F));
+ categoriesRangeMap.insert("IsMiscellaneousMathematicalSymbols-B", qMakePair(0x2980, 0x29FF));
+ categoriesRangeMap.insert("IsSupplementalMathematicalOperators", qMakePair(0x2A00, 0x2AFF));
+ categoriesRangeMap.insert("IsMiscellaneousSymbolsandArrows", qMakePair(0x2B00, 0x2BFF));
+ categoriesRangeMap.insert("IsGlagolitic", qMakePair(0x2C00, 0x2C5F));
+ categoriesRangeMap.insert("IsCoptic", qMakePair(0x2C80, 0x2CFF));
+ categoriesRangeMap.insert("IsGeorgianSupplement", qMakePair(0x2D00, 0x2D2F));
+ categoriesRangeMap.insert("IsTifinagh", qMakePair(0x2D30, 0x2D7F));
+ categoriesRangeMap.insert("IsEthiopicExtended", qMakePair(0x2D80, 0x2DDF));
+ categoriesRangeMap.insert("IsSupplementalPunctuation", qMakePair(0x2E00, 0x2E7F));
+ categoriesRangeMap.insert("IsCJKRadicalsSupplement", qMakePair(0x2E80, 0x2EFF));
+ categoriesRangeMap.insert("IsKangxiRadicals", qMakePair(0x2F00, 0x2FDF));
+ categoriesRangeMap.insert("IsIdeographicDescriptionCharacters", qMakePair(0x2FF0, 0x2FFF));
+ categoriesRangeMap.insert("IsCJKSymbolsandPunctuation", qMakePair(0x3000, 0x303F));
+ categoriesRangeMap.insert("IsHiragana", qMakePair(0x3040, 0x309F));
+ categoriesRangeMap.insert("IsKatakana", qMakePair(0x30A0, 0x30FF));
+ categoriesRangeMap.insert("IsBopomofo", qMakePair(0x3100, 0x312F));
+ categoriesRangeMap.insert("IsHangulCompatibilityJamo", qMakePair(0x3130, 0x318F));
+ categoriesRangeMap.insert("IsKanbun", qMakePair(0x3190, 0x319F));
+ categoriesRangeMap.insert("IsBopomofoExtended", qMakePair(0x31A0, 0x31BF));
+ categoriesRangeMap.insert("IsCJKStrokes", qMakePair(0x31C0, 0x31EF));
+ categoriesRangeMap.insert("IsKatakanaPhoneticExtensions", qMakePair(0x31F0, 0x31FF));
+ categoriesRangeMap.insert("IsEnclosedCJKLettersandMonths", qMakePair(0x3200, 0x32FF));
+ categoriesRangeMap.insert("IsCJKCompatibility", qMakePair(0x3300, 0x33FF));
+ categoriesRangeMap.insert("IsCJKUnifiedIdeographsExtensionA", qMakePair(0x3400, 0x4DB5));
+ categoriesRangeMap.insert("IsYijingHexagramSymbols", qMakePair(0x4DC0, 0x4DFF));
+ categoriesRangeMap.insert("IsCJKUnifiedIdeographs", qMakePair(0x4E00, 0x9FFF));
+ categoriesRangeMap.insert("IsYiSyllables", qMakePair(0xA000, 0xA48F));
+ categoriesRangeMap.insert("IsYiRadicals", qMakePair(0xA490, 0xA4CF));
+ categoriesRangeMap.insert("IsModifierToneLetters", qMakePair(0xA700, 0xA71F));
+ categoriesRangeMap.insert("IsSylotiNagri", qMakePair(0xA800, 0xA82F));
+ categoriesRangeMap.insert("IsHangulSyllables", qMakePair(0xAC00, 0xD7A3));
+ categoriesRangeMap.insert("IsPrivateUse", qMakePair(0xE000, 0xF8FF));
+ categoriesRangeMap.insert("IsCJKCompatibilityIdeographs", qMakePair(0xF900, 0xFAFF));
+ categoriesRangeMap.insert("IsAlphabeticPresentationForms", qMakePair(0xFB00, 0xFB4F));
+ categoriesRangeMap.insert("IsArabicPresentationForms-A", qMakePair(0xFB50, 0xFDFF));
+ categoriesRangeMap.insert("IsVariationSelectors", qMakePair(0xFE00, 0xFE0F));
+ categoriesRangeMap.insert("IsVerticalForms", qMakePair(0xFE10, 0xFE1F));
+ categoriesRangeMap.insert("IsCombiningHalfMarks", qMakePair(0xFE20, 0xFE2F));
+ categoriesRangeMap.insert("IsCJKCompatibilityForms", qMakePair(0xFE30, 0xFE4F));
+ categoriesRangeMap.insert("IsSmallFormVariants", qMakePair(0xFE50, 0xFE6F));
+ categoriesRangeMap.insert("IsArabicPresentationForms-B", qMakePair(0xFE70, 0xFEFF));
+ categoriesRangeMap.insert("IsHalfwidthandFullwidthForms", qMakePair(0xFF00, 0xFFEF));
+ categoriesRangeMap.insert("IsSpecials", qMakePair(0xFFF0, 0xFFFF));
+ categoriesRangeMap.insert("IsLinearBSyllabary", qMakePair(0x10000, 0x1007F));
+ categoriesRangeMap.insert("IsLinearBIdeograms", qMakePair(0x10080, 0x100FF));
+ categoriesRangeMap.insert("IsAegeanNumbers", qMakePair(0x10100, 0x1013F));
+ categoriesRangeMap.insert("IsAncientGreekNumbers", qMakePair(0x10140, 0x1018F));
+ categoriesRangeMap.insert("IsOldItalic", qMakePair(0x10300, 0x1032F));
+ categoriesRangeMap.insert("IsGothic", qMakePair(0x10330, 0x1034F));
+ categoriesRangeMap.insert("IsUgaritic", qMakePair(0x10380, 0x1039F));
+ categoriesRangeMap.insert("IsOldPersian", qMakePair(0x103A0, 0x103DF));
+ categoriesRangeMap.insert("IsDeseret", qMakePair(0x10400, 0x1044F));
+ categoriesRangeMap.insert("IsShavian", qMakePair(0x10450, 0x1047F));
+ categoriesRangeMap.insert("IsOsmanya", qMakePair(0x10480, 0x104AF));
+ categoriesRangeMap.insert("IsCypriotSyllabary", qMakePair(0x10800, 0x1083F));
+ categoriesRangeMap.insert("IsKharoshthi", qMakePair(0x10A00, 0x10A5F));
+ categoriesRangeMap.insert("IsByzantineMusicalSymbols", qMakePair(0x1D000, 0x1D0FF));
+ categoriesRangeMap.insert("IsMusicalSymbols", qMakePair(0x1D100, 0x1D1FF));
+ categoriesRangeMap.insert("IsAncientGreekMusicalNotation", qMakePair(0x1D200, 0x1D24F));
+ categoriesRangeMap.insert("IsTaiXuanJingSymbols", qMakePair(0x1D300, 0x1D35F));
+ categoriesRangeMap.insert("IsMathematicalAlphanumericSymbols", qMakePair(0x1D400, 0x1D7FF));
+ categoriesRangeMap.insert("IsCJKUnifiedIdeographsExtensionB", qMakePair(0x20000, 0x2A6DF));
+ categoriesRangeMap.insert("IsCJKCompatibilityIdeographsSupplement", qMakePair(0x2F800, 0x2FA1F));
+ categoriesRangeMap.insert("IsTags", qMakePair(0xE0000, 0xE007F));
+ categoriesRangeMap.insert("IsVariationSelectorsSupplement", qMakePair(0xE0100, 0xE01EF));
+ categoriesRangeMap.insert("IsSupplementaryPrivateUseArea-A", qMakePair(0xF0000, 0xFFFFF));
+ categoriesRangeMap.insert("IsSupplementaryPrivateUseArea-B", qMakePair(0x100000, 0x10FFFF));
+}
+
int QRegExpEngine::getChar()
{
return (yyPos == yyLen) ? EOS : yyIn[yyPos++].unicode();
@@ -2719,6 +2873,177 @@ int QRegExpEngine::getEscape()
yyCharClass->addCategories(0x000f807e);
yyCharClass->addSingleton(0x005f); // '_'
return Tok_CharClass;
+ case 'I':
+ if (xmlSchemaExtensions) {
+ yyCharClass->setNegative(!yyCharClass->negative());
+ // fall through
+ }
+ case 'i':
+ if (xmlSchemaExtensions) {
+ yyCharClass->addCategories(0x000f807e);
+ yyCharClass->addSingleton(0x003a); // ':'
+ yyCharClass->addSingleton(0x005f); // '_'
+ yyCharClass->addRange(0x0041, 0x005a); // [A-Z]
+ yyCharClass->addRange(0x0061, 0x007a); // [a-z]
+ yyCharClass->addRange(0xc0, 0xd6);
+ yyCharClass->addRange(0xd8, 0xf6);
+ yyCharClass->addRange(0xf8, 0x2ff);
+ yyCharClass->addRange(0x370, 0x37d);
+ yyCharClass->addRange(0x37f, 0x1fff);
+ yyCharClass->addRange(0x200c, 0x200d);
+ yyCharClass->addRange(0x2070, 0x218f);
+ yyCharClass->addRange(0x2c00, 0x2fef);
+ yyCharClass->addRange(0x3001, 0xd7ff);
+ yyCharClass->addRange(0xf900, 0xfdcf);
+ yyCharClass->addRange(0xfdf0, 0xfffd);
+ yyCharClass->addRange((ushort)0x10000, (ushort)0xeffff);
+ }
+ return Tok_CharClass;
+ case 'C':
+ if (xmlSchemaExtensions) {
+ yyCharClass->setNegative(!yyCharClass->negative());
+ // fall through
+ }
+ case 'c':
+ if (xmlSchemaExtensions) {
+ yyCharClass->addCategories(0x000f807e);
+ yyCharClass->addSingleton(0x002d); // '-'
+ yyCharClass->addSingleton(0x002e); // '.'
+ yyCharClass->addSingleton(0x003a); // ':'
+ yyCharClass->addSingleton(0x005f); // '_'
+ yyCharClass->addSingleton(0xb7);
+ yyCharClass->addRange(0x0030, 0x0039); // [0-9]
+ yyCharClass->addRange(0x0041, 0x005a); // [A-Z]
+ yyCharClass->addRange(0x0061, 0x007a); // [a-z]
+ yyCharClass->addRange(0xc0, 0xd6);
+ yyCharClass->addRange(0xd8, 0xf6);
+ yyCharClass->addRange(0xf8, 0x2ff);
+ yyCharClass->addRange(0x370, 0x37d);
+ yyCharClass->addRange(0x37f, 0x1fff);
+ yyCharClass->addRange(0x200c, 0x200d);
+ yyCharClass->addRange(0x2070, 0x218f);
+ yyCharClass->addRange(0x2c00, 0x2fef);
+ yyCharClass->addRange(0x3001, 0xd7ff);
+ yyCharClass->addRange(0xf900, 0xfdcf);
+ yyCharClass->addRange(0xfdf0, 0xfffd);
+ yyCharClass->addRange((ushort)0x10000, (ushort)0xeffff);
+ yyCharClass->addRange(0x0300, 0x036f);
+ yyCharClass->addRange(0x203f, 0x2040);
+ }
+ return Tok_CharClass;
+ case 'P':
+ if (xmlSchemaExtensions) {
+ yyCharClass->setNegative(!yyCharClass->negative());
+ // fall through
+ }
+ case 'p':
+ if (xmlSchemaExtensions) {
+ if (yyCh != '{') {
+ error(RXERR_CHARCLASS);
+ return Tok_CharClass;
+ }
+
+ QByteArray category;
+ yyCh = getChar();
+ while (yyCh != '}') {
+ if (yyCh == EOS) {
+ error(RXERR_END);
+ return Tok_CharClass;
+ }
+ category.append(yyCh);
+ yyCh = getChar();
+ }
+ yyCh = getChar(); // skip closing '}'
+
+ if (category == "M") {
+ yyCharClass->addCategories(0x0000000e);
+ } else if (category == "Mn") {
+ yyCharClass->addCategories(0x00000002);
+ } else if (category == "Mc") {
+ yyCharClass->addCategories(0x00000004);
+ } else if (category == "Me") {
+ yyCharClass->addCategories(0x00000008);
+ } else if (category == "N") {
+ yyCharClass->addCategories(0x00000070);
+ } else if (category == "Nd") {
+ yyCharClass->addCategories(0x00000010);
+ } else if (category == "Nl") {
+ yyCharClass->addCategories(0x00000020);
+ } else if (category == "No") {
+ yyCharClass->addCategories(0x00000040);
+ } else if (category == "Z") {
+ yyCharClass->addCategories(0x00000380);
+ } else if (category == "Zs") {
+ yyCharClass->addCategories(0x00000080);
+ } else if (category == "Zl") {
+ yyCharClass->addCategories(0x00000100);
+ } else if (category == "Zp") {
+ yyCharClass->addCategories(0x00000200);
+ } else if (category == "C") {
+ yyCharClass->addCategories(0x00006c00);
+ } else if (category == "Cc") {
+ yyCharClass->addCategories(0x00000400);
+ } else if (category == "Cf") {
+ yyCharClass->addCategories(0x00000800);
+ } else if (category == "Cs") {
+ yyCharClass->addCategories(0x00001000);
+ } else if (category == "Co") {
+ yyCharClass->addCategories(0x00002000);
+ } else if (category == "Cn") {
+ yyCharClass->addCategories(0x00004000);
+ } else if (category == "L") {
+ yyCharClass->addCategories(0x000f8000);
+ } else if (category == "Lu") {
+ yyCharClass->addCategories(0x00008000);
+ } else if (category == "Ll") {
+ yyCharClass->addCategories(0x00010000);
+ } else if (category == "Lt") {
+ yyCharClass->addCategories(0x00020000);
+ } else if (category == "Lm") {
+ yyCharClass->addCategories(0x00040000);
+ } else if (category == "Lo") {
+ yyCharClass->addCategories(0x00080000);
+ } else if (category == "P") {
+ yyCharClass->addCategories(0x4f580780);
+ } else if (category == "Pc") {
+ yyCharClass->addCategories(0x00100000);
+ } else if (category == "Pd") {
+ yyCharClass->addCategories(0x00200000);
+ } else if (category == "Ps") {
+ yyCharClass->addCategories(0x00400000);
+ } else if (category == "Pe") {
+ yyCharClass->addCategories(0x00800000);
+ } else if (category == "Pi") {
+ yyCharClass->addCategories(0x01000000);
+ } else if (category == "Pf") {
+ yyCharClass->addCategories(0x02000000);
+ } else if (category == "Po") {
+ yyCharClass->addCategories(0x04000000);
+ } else if (category == "S") {
+ yyCharClass->addCategories(0x78000000);
+ } else if (category == "Sm") {
+ yyCharClass->addCategories(0x08000000);
+ } else if (category == "Sc") {
+ yyCharClass->addCategories(0x10000000);
+ } else if (category == "Sk") {
+ yyCharClass->addCategories(0x20000000);
+ } else if (category == "So") {
+ yyCharClass->addCategories(0x40000000);
+ } else if (category.startsWith("Is")) {
+ if (categoriesRangeMap.isEmpty())
+ setupCategoriesRangeMap();
+
+ if (categoriesRangeMap.contains(category)) {
+ const QPair<int, int> range = categoriesRangeMap.value(category);
+ yyCharClass->addRange(range.first, range.second);
+ } else {
+ error(RXERR_CATEGORY);
+ }
+ } else {
+ error(RXERR_CATEGORY);
+ }
+ }
+ return Tok_CharClass;
#endif
#ifndef QT_NO_REGEXP_ESCAPE
case 'x':
@@ -2940,7 +3265,7 @@ int QRegExpEngine::getToken()
yyMaxRep = getRep(InftyRep);
}
if (yyMaxRep < yyMinRep)
- qSwap(yyMinRep, yyMaxRep);
+ error(RXERR_INTERVAL);
if (yyCh != '}')
error(RXERR_REPETITION);
yyCh = getChar();
@@ -3307,7 +3632,7 @@ static void prepareEngine_helper(QRegExpPrivate *priv)
{
bool initMatchState = !priv->eng;
#if !defined(QT_NO_REGEXP_OPTIM)
- if (!priv->eng) {
+ if (!priv->eng && globalEngineCache()) {
QMutexLocker locker(mutex());
priv->eng = globalEngineCache()->take(priv->engineKey);
if (priv->eng != 0)
@@ -3385,6 +3710,9 @@ static void invalidateEngine(QRegExpPrivate *priv)
equivalent to using the RegExp pattern on a string in
which all metacharacters are escaped using escape().
+ \value W3CXmlSchema11 The pattern is a regular expression as
+ defined by the W3C XML Schema 1.1 specification.
+
\sa setPatternSyntax()
*/
diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h
index 057eec2..16682a3 100644
--- a/src/corelib/tools/qregexp.h
+++ b/src/corelib/tools/qregexp.h
@@ -61,7 +61,7 @@ class QStringList;
class Q_CORE_EXPORT QRegExp
{
public:
- enum PatternSyntax { RegExp, Wildcard, FixedString, RegExp2 };
+ enum PatternSyntax { RegExp, Wildcard, FixedString, RegExp2, W3CXmlSchema11 };
enum CaretMode { CaretAtZero, CaretAtOffset, CaretWontMatch };
QRegExp();
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h
index d8ca658..7cfca0e 100644
--- a/src/corelib/tools/qringbuffer_p.h
+++ b/src/corelib/tools/qringbuffer_p.h
@@ -304,6 +304,54 @@ public:
return read(size());
}
+ // read an unspecified amount (will read the first buffer)
+ inline QByteArray read() {
+ if (bufferSize == 0)
+ return QByteArray();
+
+ // multiple buffers, just take the first one
+ if (head == 0 && tailBuffer != 0) {
+ QByteArray qba = buffers.takeFirst();
+ --tailBuffer;
+ bufferSize -= qba.length();
+ return qba;
+ }
+
+ // one buffer with good value for head. Just take it.
+ if (head == 0 && tailBuffer == 0) {
+ QByteArray qba = buffers.takeFirst();
+ qba.resize(tail);
+ buffers << QByteArray();
+ bufferSize = 0;
+ tail = 0;
+ return qba;
+ }
+
+ // Bad case: We have to memcpy.
+ // We can avoid by initializing the QRingBuffer with basicBlockSize of 0
+ // and only using this read() function.
+ QByteArray qba(readPointer(), nextDataBlockSize());
+ buffers.removeFirst();
+ head = 0;
+ if (tailBuffer == 0) {
+ buffers << QByteArray();
+ tail = 0;
+ } else {
+ --tailBuffer;
+ }
+ bufferSize -= qba.length();
+ return qba;
+ }
+
+ // append a new buffer to the end
+ inline void append(const QByteArray &qba) {
+ buffers[tailBuffer].resize(tail);
+ buffers << qba;
+ ++tailBuffer;
+ tail = qba.length();
+ bufferSize += qba.length();
+ }
+
inline QByteArray peek(int maxLength) const {
int bytesToRead = qMin(size(), maxLength);
if(maxLength <= 0)
@@ -358,7 +406,7 @@ public:
private:
QList<QByteArray> buffers;
int head, tail;
- int tailBuffer;
+ int tailBuffer; // always buffers.size() - 1
int basicBlockSize;
int bufferSize;
};
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index 083fea6..596a125 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -345,6 +345,24 @@
*/
/*!
+ \fn QSharedPointer<X> QSharedPointer::objectCast() const
+ \since 4.6
+
+ Performs a \l qobject_cast() from this pointer's type to \tt X and
+ returns a QSharedPointer that shares the reference. If this
+ function is used to up-cast, then QSharedPointer will perform a \tt
+ qobject_cast, which means that if the object being pointed by this
+ QSharedPointer is not of type \tt X, the returned object will be
+ null.
+
+ Note: the template type \c X must have the same const and volatile
+ qualifiers as the template of this object, or the cast will
+ fail. Use constCast() if you need to drop those qualifiers.
+
+ \sa qSharedPointerObjectCast()
+*/
+
+/*!
\fn QWeakPointer<T> QSharedPointer::toWeakRef() const
Returns a weak reference object that shares the pointer referenced
@@ -723,6 +741,47 @@
*/
/*!
+ \fn QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &other)
+ \relates QSharedPointer
+ \since 4.6
+
+ Returns a shared pointer to the pointer held by \a other, using a
+ \l qobject_cast() to type \tt X to obtain an internal pointer of the
+ appropriate type. If the \tt qobject_cast fails, the object
+ returned will be null.
+
+ Note that \tt X must have the same cv-qualifiers (\tt const and
+ \tt volatile) that \tt T has, or the code will fail to
+ compile. Use qSharedPointerConstCast to cast away the constness.
+
+ \sa QSharedPointer::objectCast(), qSharedPointerCast(), qSharedPointerConstCast()
+*/
+
+/*!
+ \fn QSharedPointer<X> qSharedPointerObjectCast(const QWeakPointer<T> &other)
+ \relates QSharedPointer
+ \relates QWeakPointer
+ \since 4.6
+
+ Returns a shared pointer to the pointer held by \a other, using a
+ \l qobject_cast() to type \tt X to obtain an internal pointer of the
+ appropriate type. If the \tt qobject_cast fails, the object
+ returned will be null.
+
+ The \a other object is converted first to a strong reference. If
+ that conversion fails (because the object it's pointing to has
+ already been deleted), this function also returns a null
+ QSharedPointer.
+
+ Note that \tt X must have the same cv-qualifiers (\tt const and
+ \tt volatile) that \tt T has, or the code will fail to
+ compile. Use qSharedPointerConstCast to cast away the constness.
+
+ \sa QWeakPointer::toStrongRef(), qSharedPointerCast(), qSharedPointerConstCast()
+*/
+
+
+/*!
\fn QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &other)
\relates QWeakPointer
diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h
index cd6bc62..abd83ad 100644
--- a/src/corelib/tools/qsharedpointer.h
+++ b/src/corelib/tools/qsharedpointer.h
@@ -93,6 +93,7 @@ public:
template <class X> QSharedPointer<X> staticCast() const;
template <class X> QSharedPointer<X> dynamicCast() const;
template <class X> QSharedPointer<X> constCast() const;
+ template <class X> QSharedPointer<X> objectCast() const;
};
template <class T>
@@ -136,6 +137,8 @@ template <class X, class T> QSharedPointer<X> qSharedPointerDynamicCast(const QS
template <class X, class T> QSharedPointer<X> qSharedPointerDynamicCast(const QWeakPointer<T> &src);
template <class X, class T> QSharedPointer<X> qSharedPointerConstCast(const QSharedPointer<T> &src);
template <class X, class T> QSharedPointer<X> qSharedPointerConstCast(const QWeakPointer<T> &src);
+template <class X, class T> QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &src);
+template <class X, class T> QSharedPointer<X> qSharedPointerObjectCast(const QWeakPointer<T> &src);
template <class X, class T> QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &src);
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index b928795..3043dc9 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -49,6 +49,7 @@
#endif
#include <QtCore/qatomic.h>
+#include <QtCore/qobject.h> // for qobject_cast
QT_BEGIN_HEADER
@@ -83,6 +84,11 @@ QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &ptr);
template <class X, class T>
QSharedPointer<X> qSharedPointerConstCast(const QSharedPointer<T> &ptr);
+#ifndef QT_NO_QOBJECT
+template <class X, class T>
+QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &ptr);
+#endif
+
namespace QtSharedPointer {
template <class T> class InternalRefCount;
template <class T> class ExternalRefCount;
@@ -128,7 +134,7 @@ namespace QtSharedPointer {
inline T *operator->() const { return data(); }
protected:
- inline Basic() : value(0 * sizeof(T)) { }
+ inline Basic() : value(0) { }
// ~Basic();
inline void verifyReconstruction(const T *ptr)
@@ -336,6 +342,14 @@ public:
return qSharedPointerConstCast<X, T>(*this);
}
+#ifndef QT_NO_QOBJECT
+ template <class X>
+ QSharedPointer<X> objectCast() const
+ {
+ return qSharedPointerObjectCast<X, T>(*this);
+ }
+#endif
+
inline void clear() { *this = QSharedPointer<T>(); }
QWeakPointer<T> toWeakRef() const;
@@ -557,6 +571,43 @@ QWeakPointer<X> qWeakPointerCast(const QSharedPointer<T> &src)
return qSharedPointerCast<X, T>(src).toWeakRef();
}
+#ifndef QT_NO_QOBJECT
+template <class X, class T>
+Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &src)
+{
+ register X *ptr = qobject_cast<X *>(src.data());
+ return QtSharedPointer::copyAndSetPointer(ptr, src);
+}
+template <class X, class T>
+Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast(const QWeakPointer<T> &src)
+{
+ return qSharedPointerObjectCast<X>(src.toStrongRef());
+}
+
+# ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION
+namespace QtSharedPointer {
+ template <class T> struct RemovePointer;
+ template <class T> struct RemovePointer<T *> { typedef T Type; };
+ template <class T> struct RemovePointer<QSharedPointer<T> > { typedef T Type; };
+ template <class T> struct RemovePointer<QWeakPointer<T> > { typedef T Type; };
+}
+
+template <class X, class T>
+inline QSharedPointer<typename QtSharedPointer::RemovePointer<X>::Type>
+qobject_cast(const QSharedPointer<T> &src)
+{
+ return qSharedPointerObjectCast<typename QtSharedPointer::RemovePointer<X>::Type, T>(src);
+}
+template <class X, class T>
+inline QSharedPointer<typename QtSharedPointer::RemovePointer<X>::Type>
+qobject_cast(const QWeakPointer<T> &src)
+{
+ return qSharedPointerObjectCast<typename QtSharedPointer::RemovePointer<X>::Type, T>(src);
+}
+# endif
+
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 38b6f58..f3c773b 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -45,6 +45,7 @@
#ifndef QT_NO_TEXTCODEC
#include <qtextcodec.h>
#endif
+#include <private/qutfcodec_p.h>
#include <qdatastream.h>
#include <qlist.h>
#include "qlocale.h"
@@ -964,7 +965,8 @@ int QString::toWCharArray(wchar_t *array) const
Constructs a string initialized with the first \a size characters
of the QChar array \a unicode.
- QString makes a deep copy of the string data.
+ QString makes a deep copy of the string data. The unicode data is copied as
+ is and the Byte Order Mark is preserved if present.
*/
QString::QString(const QChar *unicode, int size)
{
@@ -3482,7 +3484,7 @@ QByteArray QString::toAscii() const
return toLatin1();
}
-#ifndef Q_WS_MAC
+#if !defined(Q_WS_MAC) && defined(Q_OS_UNIX)
static QByteArray toLocal8Bit_helper(const QChar *data, int length)
{
#ifndef QT_NO_TEXTCODEC
@@ -3717,13 +3719,13 @@ QByteArray qt_winQString2MB(const QChar *ch, int uclen)
BOOL used_def;
QByteArray mb(4096, 0);
int len;
- while (!(len=WideCharToMultiByte(CP_ACP, 0, (const WCHAR*)ch, uclen,
+ while (!(len=WideCharToMultiByte(CP_ACP, 0, (const wchar_t*)ch, uclen,
mb.data(), mb.size()-1, 0, &used_def)))
{
int r = GetLastError();
if (r == ERROR_INSUFFICIENT_BUFFER) {
mb.resize(1+WideCharToMultiByte(CP_ACP, 0,
- (const WCHAR*)ch, uclen,
+ (const wchar_t*)ch, uclen,
0, 0, 0, &used_def));
// and try again...
} else {
@@ -3744,9 +3746,9 @@ QString qt_winMB2QString(const char *mb, int mblen)
if (!mb || !mblen)
return QString();
const int wclen_auto = 4096;
- WCHAR wc_auto[wclen_auto];
+ wchar_t wc_auto[wclen_auto];
int wclen = wclen_auto;
- WCHAR *wc = wc_auto;
+ wchar_t *wc = wc_auto;
int len;
while (!(len=MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
mb, mblen, wc, wclen)))
@@ -3759,7 +3761,7 @@ QString qt_winMB2QString(const char *mb, int mblen)
} else {
wclen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
mb, mblen, 0, 0);
- wc = new WCHAR[wclen];
+ wc = new wchar_t[wclen];
// and try again...
}
} else {
@@ -3802,11 +3804,6 @@ QString QString::fromLocal8Bit(const char *str, int size)
return QString();
if (size == 0 || (!*str && size < 0))
return QLatin1String("");
-#if defined(Q_OS_WIN32)
- if(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
- return qt_winMB2QString(str, size);
- }
-#endif
#if !defined(QT_NO_TEXTCODEC)
if (size < 0)
size = qstrlen(str);
@@ -3851,74 +3848,7 @@ QString QString::fromUtf8(const char *str, int size)
if (size < 0)
size = qstrlen(str);
- QString result(size, Qt::Uninitialized); // worst case
- ushort *qch = result.d->data;
- uint uc = 0;
- uint min_uc = 0;
- int need = 0;
- int error = -1;
- uchar ch;
- int i = 0;
-
- // skip utf8-encoded byte order mark
- if (size >= 3
- && (uchar)str[0] == 0xef && (uchar)str[1] == 0xbb && (uchar)str[2] == 0xbf)
- i += 3;
-
- for (; i < size; ++i) {
- ch = str[i];
- if (need) {
- if ((ch&0xc0) == 0x80) {
- uc = (uc << 6) | (ch & 0x3f);
- need--;
- if (!need) {
- if (uc > 0xffffU && uc < 0x110000U) {
- // surrogate pair
- *qch++ = QChar::highSurrogate(uc);
- uc = QChar::lowSurrogate(uc);
- } else if ((uc < min_uc) || (uc >= 0xd800 && uc <= 0xdfff) || (uc >= 0xfffe)) {
- // overlong seqence, UTF16 surrogate or BOM
- uc = QChar::ReplacementCharacter;
- }
- *qch++ = uc;
- }
- } else {
- i = error;
- need = 0;
- *qch++ = QChar::ReplacementCharacter;
- }
- } else {
- if (ch < 128) {
- *qch++ = ch;
- } else if ((ch & 0xe0) == 0xc0) {
- uc = ch & 0x1f;
- need = 1;
- error = i;
- min_uc = 0x80;
- } else if ((ch & 0xf0) == 0xe0) {
- uc = ch & 0x0f;
- need = 2;
- error = i;
- min_uc = 0x800;
- } else if ((ch&0xf8) == 0xf0) {
- uc = ch & 0x07;
- need = 3;
- error = i;
- min_uc = 0x10000;
- } else {
- // Error
- *qch++ = QChar::ReplacementCharacter;
- }
- }
- }
- if (need) {
- // we have some invalid characters remaining we need to add to the string
- for (int i = error; i < size; ++i)
- *qch++ = QChar::ReplacementCharacter;
- }
-
- result.truncate(qch - result.d->data);
- return result;
+ return QUtf8::convertToUnicode(str, size, 0);
}
/*!
@@ -3941,7 +3871,7 @@ QString QString::fromUtf16(const ushort *unicode, int size)
while (unicode[size] != 0)
++size;
}
- return QString((const QChar *)unicode, size);
+ return QUtf16::convertToUnicode((const char *)unicode, size*2, 0);
}
@@ -3965,20 +3895,7 @@ QString QString::fromUcs4(const uint *unicode, int size)
while (unicode[size] != 0)
++size;
}
-
- QString s(size * 2, Qt::Uninitialized); // worst case
- ushort *uc = s.d->data;
- for (int i = 0; i < size; ++i) {
- uint u = unicode[i];
- if (u > 0xffff) {
- // decompose into a surrogate pair
- *uc++ = QChar::highSurrogate(u);
- u = QChar::lowSurrogate(u);
- }
- *uc++ = u;
- }
- s.resize(uc - s.d->data);
- return s;
+ return QUtf32::convertToUnicode((const char *)unicode, size*4, 0);
}
/*!
@@ -4700,16 +4617,7 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
return ucstrcmp(data1, length1, data2, length2);
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
- int res;
- QT_WA({
- const TCHAR* s1 = (TCHAR*)data1;
- const TCHAR* s2 = (TCHAR*)data2;
- res = CompareStringW(GetUserDefaultLCID(), 0, s1, length1, s2, length2);
- } , {
- QByteArray s1 = toLocal8Bit_helper(data1, length1);
- QByteArray s2 = toLocal8Bit_helper(data2, length2);
- res = CompareStringA(GetUserDefaultLCID(), 0, s1.data(), s1.length(), s2.data(), s2.length());
- });
+ int res = CompareString(GetUserDefaultLCID(), 0, (wchar_t*)data1, length1, (wchar_t*)data2, length2);
switch (res) {
case CSTR_LESS_THAN:
@@ -6123,6 +6031,7 @@ QString QString::repeated(int times) const
return result;
}
+void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::UnicodeVersion version, int from);
/*!
\overload
\fn QString QString::normalized(NormalizationForm mode, QChar::UnicodeVersion version) const
@@ -6132,42 +6041,48 @@ QString QString::repeated(int times) const
*/
QString QString::normalized(QString::NormalizationForm mode, QChar::UnicodeVersion version) const
{
+ QString copy = *this;
+ qt_string_normalize(&copy, mode, version, 0);
+ return copy;
+}
+
+void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::UnicodeVersion version, int from)
+{
bool simple = true;
- for (int i = 0; i < d->size; ++i) {
- if (d->data[i] >= 0x80) {
+ const QChar *p = data->constData();
+ int len = data->length();
+ for (int i = from; i < len; ++i) {
+ if (p[i].unicode() >= 0x80) {
simple = false;
break;
}
}
if (simple)
- return *this;
+ return;
- QString s = *this;
+ QString &s = *data;
if (version != CURRENT_VERSION) {
for (int i = 0; i < NumNormalizationCorrections; ++i) {
const NormalizationCorrection &n = uc_normalization_corrections[i];
if (n.version > version) {
+ int pos = from;
if (n.ucs4 > 0xffff) {
ushort ucs4High = QChar::highSurrogate(n.ucs4);
ushort ucs4Low = QChar::lowSurrogate(n.ucs4);
ushort oldHigh = QChar::highSurrogate(n.old_mapping);
ushort oldLow = QChar::lowSurrogate(n.old_mapping);
- int pos = 0;
- while (pos < s.d->size - 1) {
- if (s.d->data[pos] == ucs4High && s.d->data[pos + 1] == ucs4Low) {
- s.detach();
- s.d->data[pos] = oldHigh;
- s.d->data[pos + 1] = oldLow;
+ while (pos < s.length() - 1) {
+ if (s.at(pos).unicode() == ucs4High && s.at(pos + 1).unicode() == ucs4Low) {
+ s[pos] = oldHigh;
+ s[pos + 1] = oldLow;
++pos;
}
++pos;
}
} else {
- int pos = 0;
- while (pos < s.d->size) {
- if (s.d->data[pos] == n.ucs4) {
- s.detach();
- s.d->data[pos] = n.old_mapping;
+ while (pos < s.length()) {
+ if (s.at(pos).unicode() == n.ucs4) {
+ s[pos] = n.old_mapping;
}
++pos;
}
@@ -6175,15 +6090,14 @@ QString QString::normalized(QString::NormalizationForm mode, QChar::UnicodeVersi
}
}
}
- s = decomposeHelper(s, mode < QString::NormalizationForm_KD, version);
+ decomposeHelper(data, mode < QString::NormalizationForm_KD, version, from);
- s = canonicalOrderHelper(s, version);
+ canonicalOrderHelper(data, version, from);
if (mode == QString::NormalizationForm_D || mode == QString::NormalizationForm_KD)
- return s;
-
- return composeHelper(s);
+ return;
+ composeHelper(data, from);
}
@@ -6568,7 +6482,7 @@ QString QString::arg(qlonglong a, int fieldWidth, int base, const QChar &fillCha
ArgEscapeData d = findArgEscapes(*this);
if (d.occurrences == 0) {
- qWarning("QString::arg: Argument missing: %s, %lld", toLocal8Bit().data(), a);
+ qWarning() << "QString::arg: Argument missing:" << *this << ',' << a;
return *this;
}
@@ -6611,7 +6525,7 @@ QString QString::arg(qulonglong a, int fieldWidth, int base, const QChar &fillCh
ArgEscapeData d = findArgEscapes(*this);
if (d.occurrences == 0) {
- qWarning("QString::arg: Argument missing: %s, %llu", toLocal8Bit().data(), a);
+ qWarning() << "QString::arg: Argument missing:" << *this << ',' << a;
return *this;
}
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 6bb0d8e..235c603 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1235,6 +1235,8 @@ inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QStringRef
QT_END_NAMESPACE
+QT_END_HEADER
+
#ifdef QT_USE_FAST_CONCATENATION
#include <QtCore/qstringbuilder.h>
#endif
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 852c072..3b43253 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -69,7 +69,7 @@ private:
};
-template <typename T> class QConcatenable {};
+template <typename T> struct QConcatenable {};
template <typename A, typename B>
class QStringBuilder
@@ -202,6 +202,18 @@ template <> struct QConcatenable<const char *>
*out++ = QLatin1Char(*a++);
}
};
+
+template <> struct QConcatenable<QByteArray>
+{
+ typedef QByteArray type;
+ static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); }
+ static inline void appendTo(const QByteArray &ba, QChar *&out)
+ {
+ const char *data = ba.constData();
+ while (*data)
+ *out++ = QLatin1Char(*data++);
+ }
+};
#endif
template <typename A, typename B>
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index 5a2b37a..5c550af 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -41,6 +41,7 @@
#include <qstringlist.h>
#include <qset.h>
+#include <qstringmatcher.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index 665c0d0..f36567a 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -47,7 +47,6 @@
#include <QtCore/qlist.h>
#include <QtCore/qregexp.h>
#include <QtCore/qstring.h>
-#include <QtCore/qstringmatcher.h>
#ifdef QT_INCLUDE_COMPAT
#include <Qt3Support/q3valuelist.h>
#endif
diff --git a/src/corelib/tools/qstringmatcher.h b/src/corelib/tools/qstringmatcher.h
index 2b8edc9..61b7a95 100644
--- a/src/corelib/tools/qstringmatcher.h
+++ b/src/corelib/tools/qstringmatcher.h
@@ -81,13 +81,14 @@ private:
// explicitely allow anonymous unions for RVCT to prevent compiler warnings
#pragma anon_unions
#endif
+ struct Data {
+ uchar q_skiptable[256];
+ const QChar *uc;
+ int len;
+ };
union {
uint q_data[256];
- struct {
- uchar q_skiptable[256];
- const QChar *uc;
- int len;
- } p;
+ Data p;
};
};
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp
index 04aed39..e32fc03 100644
--- a/src/corelib/tools/qtimeline.cpp
+++ b/src/corelib/tools/qtimeline.cpp
@@ -555,6 +555,8 @@ void QTimeLine::setCurveShape(CurveShape shape)
/*!
\property QTimeLine::easingCurve
+ \since 4.6
+
Specifies the easing curve that the timeline will use.
If both easing curve and curveShape are set, the last set property will
override the previous one. (If valueForTime() is reimplemented it will
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 9fc9c03..247f9f1 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -418,7 +418,9 @@ void QVector<T>::free(Data *x)
{
if (QTypeInfo<T>::isComplex) {
T* b = x->array;
- T* i = b + reinterpret_cast<QVectorData *>(x)->size;
+ union { QVectorData *d; Data *p; } u;
+ u.p = x;
+ T* i = b + u.d->size;
while (i-- != b)
i->~T();
}
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 1162238..85d9dbf 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -5,6 +5,7 @@ HEADERS += \
tools/qbitarray.h \
tools/qbytearray.h \
tools/qbytearraymatcher.h \
+ tools/qbytedata_p.h \
tools/qcache.h \
tools/qchar.h \
tools/qcontainerfwd.h \
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 79b9bf2..3c771fd 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -567,7 +567,7 @@ bool QXmlStreamReader::atEnd() const
returns true, hasError() returns true, and this function returns
QXmlStreamReader::Invalid.
- The exception is when error() return PrematureEndOfDocumentError.
+ The exception is when error() returns PrematureEndOfDocumentError.
This error is reported when the end of an otherwise well-formed
chunk of XML is reached, but the chunk doesn't represent a complete
XML document. In that case, parsing \e can be resumed by calling
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 85c3274..7c520df 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -44,6 +44,7 @@
#include "qdbusargument.h"
#include "qdbuspendingcall.h"
+#include "qdbusmessage_p.h"
#include "qdbusmetaobject_p.h"
#include "qdbusmetatype_p.h"
#include "qdbusutil_p.h"
@@ -52,99 +53,83 @@
QT_BEGIN_NAMESPACE
+static QDBusError checkIfValid(const QString &service, const QString &path,
+ const QString &interface, bool isDynamic)
+{
+ // We should be throwing exceptions here... oh well
+ QDBusError error;
+
+ // dynamic interfaces (QDBusInterface) can have empty interfaces, but not service and object paths
+ // non-dynamic is the opposite: service and object paths can be empty, but not the interface
+ if (!isDynamic) {
+ // use assertion here because this should never happen, at all
+ Q_ASSERT_X(!interface.isEmpty(), "QDBusAbstractInterface", "Interface name cannot be empty");
+ }
+ if (!QDBusUtil::checkBusName(service, isDynamic ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error))
+ return error;
+ if (!QDBusUtil::checkObjectPath(path, isDynamic ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error))
+ return error;
+ if (!QDBusUtil::checkInterfaceName(interface, QDBusUtil::EmptyAllowed, &error))
+ return error;
+
+ // no error
+ return QDBusError();
+}
+
QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(const QString &serv,
const QString &p,
const QString &iface,
const QDBusConnection& con,
bool isDynamic)
- : connection(con), service(serv), path(p), interface(iface), isValid(true)
+ : connection(con), service(serv), path(p), interface(iface),
+ lastError(checkIfValid(serv, p, iface, isDynamic)),
+ isValid(!lastError.isValid())
{
- if (isDynamic) {
- // QDBusInterface: service and object path can't be empty, but interface can
-#if 0
- Q_ASSERT_X(QDBusUtil::isValidBusName(service),
- "QDBusInterface::QDBusInterface", "Invalid service name");
- Q_ASSERT_X(QDBusUtil::isValidObjectPath(path),
- "QDBusInterface::QDBusInterface", "Invalid object path given");
- Q_ASSERT_X(interface.isEmpty() || QDBusUtil::isValidInterfaceName(interface),
- "QDBusInterface::QDBusInterface", "Invalid interface name");
-#else
- if (!QDBusUtil::isValidBusName(service)) {
- lastError = QDBusError(QDBusError::Disconnected,
- QLatin1String("Invalid service name"));
- isValid = false;
- } else if (!QDBusUtil::isValidObjectPath(path)) {
- lastError = QDBusError(QDBusError::Disconnected,
- QLatin1String("Invalid object name given"));
- isValid = false;
- } else if (!interface.isEmpty() && !QDBusUtil::isValidInterfaceName(interface)) {
- lastError = QDBusError(QDBusError::Disconnected,
- QLatin1String("Invalid interface name"));
- isValid = false;
- }
-#endif
- } else {
- // all others: service and path can be empty here, but interface can't
-#if 0
- Q_ASSERT_X(service.isEmpty() || QDBusUtil::isValidBusName(service),
- "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid service name");
- Q_ASSERT_X(path.isEmpty() || QDBusUtil::isValidObjectPath(path),
- "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid object path given");
- Q_ASSERT_X(QDBusUtil::isValidInterfaceName(interface),
- "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid interface class!");
-#else
- if (!service.isEmpty() && !QDBusUtil::isValidBusName(service)) {
- lastError = QDBusError(QDBusError::Disconnected,
- QLatin1String("Invalid service name"));
- isValid = false;
- } else if (!path.isEmpty() && !QDBusUtil::isValidObjectPath(path)) {
- lastError = QDBusError(QDBusError::Disconnected,
- QLatin1String("Invalid object path given"));
- isValid = false;
- } else if (!QDBusUtil::isValidInterfaceName(interface)) {
- lastError = QDBusError(QDBusError::Disconnected,
- QLatin1String("Invalid interface class"));
- isValid = false;
- }
-#endif
- }
-
if (!isValid)
return;
if (!connection.isConnected()) {
lastError = QDBusError(QDBusError::Disconnected,
QLatin1String("Not connected to D-Bus server"));
- isValid = false;
} else if (!service.isEmpty()) {
currentOwner = connectionPrivate()->getNameOwner(service); // verify the name owner
if (currentOwner.isEmpty()) {
- isValid = false;
lastError = connectionPrivate()->lastError;
}
}
}
-QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const
+bool QDBusAbstractInterfacePrivate::canMakeCalls() const
{
- if (!connection.isConnected()) // not connected
- return QVariant();
+ // recheck only if we have a wildcard (i.e. empty) service or path
+ // if any are empty, set the error message according to QDBusUtil
+ if (service.isEmpty())
+ return QDBusUtil::checkBusName(service, QDBusUtil::EmptyNotAllowed, &lastError);
+ if (path.isEmpty())
+ return QDBusUtil::checkObjectPath(path, QDBusUtil::EmptyNotAllowed, &lastError);
+ return true;
+}
+
+void QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, QVariant &where) const
+{
+ if (!isValid || !canMakeCalls()) { // can't make calls
+ where.clear();
+ return;
+ }
// is this metatype registered?
- int mid;
- const char *expectedSignature;
- if (mp.type() == QVariant::LastType) {
- // We're asking to read a QVariant
- mid = qMetaTypeId<QDBusVariant>();
- expectedSignature = "v";
- } else {
- mid = QMetaType::type(mp.typeName());
- expectedSignature = QDBusMetaType::typeToSignature(mid);
+ const char *expectedSignature = "";
+ if (mp.type() != 0xff) {
+ expectedSignature = QDBusMetaType::typeToSignature(where.userType());
if (expectedSignature == 0) {
qWarning("QDBusAbstractInterface: type %s must be registered with QtDBus before it can be "
"used to read property %s.%s",
mp.typeName(), qPrintable(interface), mp.name());
- return QVariant();
+ lastError = QDBusError(QDBusError::Failed,
+ QString::fromLatin1("Unregistered type %1 cannot be handled")
+ .arg(QLatin1String(mp.typeName())));
+ where.clear();
+ return;
}
}
@@ -152,26 +137,33 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const
QDBusMessage msg = QDBusMessage::createMethodCall(service, path,
QLatin1String(DBUS_INTERFACE_PROPERTIES),
QLatin1String("Get"));
+ QDBusMessagePrivate::setParametersValidated(msg, true);
msg << interface << QString::fromUtf8(mp.name());
QDBusMessage reply = connection.call(msg, QDBus::Block);
if (reply.type() != QDBusMessage::ReplyMessage) {
lastError = reply;
- return QVariant();
+ where.clear();
+ return;
}
if (reply.signature() != QLatin1String("v")) {
QString errmsg = QLatin1String("Invalid signature `%1' in return from call to "
DBUS_INTERFACE_PROPERTIES);
lastError = QDBusError(QDBusError::InvalidSignature, errmsg.arg(reply.signature()));
- return QVariant();
+ where.clear();
+ return;
}
QByteArray foundSignature;
const char *foundType = 0;
QVariant value = qvariant_cast<QDBusVariant>(reply.arguments().at(0)).variant();
- if (value.userType() == mid)
- return value; // simple match
+ if (value.userType() == where.userType() || mp.type() == 0xff
+ || (expectedSignature[0] == 'v' && expectedSignature[1] == '\0')) {
+ // simple match
+ where = value;
+ return;
+ }
if (value.userType() == qMetaTypeId<QDBusArgument>()) {
QDBusArgument arg = qvariant_cast<QDBusArgument>(value);
@@ -179,14 +171,9 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const
foundType = "user type";
foundSignature = arg.currentSignature().toLatin1();
if (foundSignature == expectedSignature) {
- void *null = 0;
- QVariant result(mid, null);
- QDBusMetaType::demarshall(arg, mid, result.data());
-
- if (mp.type() == QVariant::LastType)
- // special case: QVariant
- return qvariant_cast<QDBusVariant>(result).variant();
- return result;
+ // signatures match, we can demarshall
+ QDBusMetaType::demarshall(arg, where.userType(), where.data());
+ return;
}
} else {
foundType = value.typeName();
@@ -203,23 +190,28 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const
QString::fromUtf8(mp.name()),
QString::fromLatin1(mp.typeName()),
QString::fromLatin1(expectedSignature)));
- return QVariant();
+ where.clear();
+ return;
}
-void QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value)
+bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value)
{
- if (!connection.isConnected()) // not connected
- return;
+ if (!isValid || !canMakeCalls()) // can't make calls
+ return false;
// send the value
QDBusMessage msg = QDBusMessage::createMethodCall(service, path,
QLatin1String(DBUS_INTERFACE_PROPERTIES),
QLatin1String("Set"));
+ QDBusMessagePrivate::setParametersValidated(msg, true);
msg << interface << QString::fromUtf8(mp.name()) << qVariantFromValue(QDBusVariant(value));
QDBusMessage reply = connection.call(msg, QDBus::Block);
- if (reply.type() != QDBusMessage::ReplyMessage)
+ if (reply.type() != QDBusMessage::ReplyMessage) {
lastError = reply;
+ return false;
+ }
+ return true;
}
void QDBusAbstractInterfacePrivate::_q_serviceOwnerChanged(const QString &name,
@@ -230,10 +222,36 @@ void QDBusAbstractInterfacePrivate::_q_serviceOwnerChanged(const QString &name,
//qDebug() << "QDBusAbstractInterfacePrivate serviceOwnerChanged" << name << oldOwner << newOwner;
if (name == service) {
currentOwner = newOwner;
- isValid = !newOwner.isEmpty();
}
}
+QDBusAbstractInterfaceBase::QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &d, QObject *parent)
+ : QObject(d, parent)
+{
+}
+
+int QDBusAbstractInterfaceBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ int saved_id = _id;
+ _id = QObject::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+
+ if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty) {
+ QMetaProperty mp = metaObject()->property(saved_id);
+ int &status = *reinterpret_cast<int *>(_a[2]);
+ QVariant &variant = *reinterpret_cast<QVariant *>(_a[1]);
+
+ if (_c == QMetaObject::WriteProperty) {
+ status = d_func()->setProperty(mp, variant) ? 1 : 0;
+ } else {
+ d_func()->property(mp, variant);
+ status = variant.isValid() ? 1 : 0;
+ }
+ _id = -1;
+ }
+ return _id;
+}
/*!
\class QDBusAbstractInterface
@@ -258,10 +276,10 @@ void QDBusAbstractInterfacePrivate::_q_serviceOwnerChanged(const QString &name,
This is the constructor called from QDBusInterface::QDBusInterface.
*/
QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, QObject *parent)
- : QObject(d, parent)
+ : QDBusAbstractInterfaceBase(d, parent)
{
// keep track of the service owner
- if (d_func()->isValid)
+ if (!d_func()->currentOwner.isEmpty())
QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}
@@ -274,7 +292,7 @@ QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d,
QDBusAbstractInterface::QDBusAbstractInterface(const QString &service, const QString &path,
const char *interface, const QDBusConnection &con,
QObject *parent)
- : QObject(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface),
+ : QDBusAbstractInterfaceBase(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface),
con, false), parent)
{
// keep track of the service owner
@@ -300,7 +318,7 @@ QDBusAbstractInterface::~QDBusAbstractInterface()
*/
bool QDBusAbstractInterface::isValid() const
{
- return d_func()->isValid;
+ return !d_func()->currentOwner.isEmpty();
}
/*!
@@ -367,6 +385,9 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode,
{
Q_D(QDBusAbstractInterface);
+ if (!d->isValid || !d->canMakeCalls())
+ return QDBusMessage::createError(d->lastError);
+
QString m = method;
// split out the signature from the method
int pos = method.indexOf(QLatin1Char('.'));
@@ -397,6 +418,7 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode,
// qDebug() << "QDBusAbstractInterface" << "Service" << service() << "Path:" << path();
QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), m);
+ QDBusMessagePrivate::setParametersValidated(msg, true);
msg.setArguments(args);
QDBusMessage reply = d->connection.call(msg, mode);
@@ -425,7 +447,11 @@ QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString
{
Q_D(QDBusAbstractInterface);
+ if (!d->isValid || !d->canMakeCalls())
+ return QDBusPendingCall::fromError(d->lastError);
+
QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method);
+ QDBusMessagePrivate::setParametersValidated(msg, true);
msg.setArguments(args);
return d->connection.asyncCall(msg);
}
@@ -440,7 +466,8 @@ QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString
This function returns true if the queueing succeeds. It does
not indicate that the executed call succeeded. If it fails,
- the \a errorMethod is called.
+ the \a errorMethod is called. If the queueing failed, this
+ function returns false and no slot will be called.
The \a returnMethod must have as its parameters the types returned
by the function call. Optionally, it may have a QDBusMessage
@@ -453,22 +480,26 @@ QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString
bool QDBusAbstractInterface::callWithCallback(const QString &method,
const QList<QVariant> &args,
QObject *receiver,
- const char *returnMethod,
+ const char *returnMethod,
const char *errorMethod)
{
Q_D(QDBusAbstractInterface);
+ if (!d->isValid || !d->canMakeCalls())
+ return false;
+
QDBusMessage msg = QDBusMessage::createMethodCall(service(),
- path(),
- interface(),
- method);
+ path(),
+ interface(),
+ method);
+ QDBusMessagePrivate::setParametersValidated(msg, true);
msg.setArguments(args);
d->lastError = 0;
return d->connection.callWithCallback(msg,
- receiver,
- returnMethod,
- errorMethod);
+ receiver,
+ returnMethod,
+ errorMethod);
}
/*!
@@ -492,7 +523,7 @@ bool QDBusAbstractInterface::callWithCallback(const QString &method,
bool QDBusAbstractInterface::callWithCallback(const QString &method,
const QList<QVariant> &args,
QObject *receiver,
- const char *slot)
+ const char *slot)
{
return callWithCallback(method, args, receiver, slot, 0);
}
@@ -503,13 +534,15 @@ bool QDBusAbstractInterface::callWithCallback(const QString &method,
*/
void QDBusAbstractInterface::connectNotify(const char *signal)
{
+ // someone connecting to one of our signals
+ Q_D(QDBusAbstractInterface);
+ if (!d->isValid)
+ return;
+
// we end up recursing here, so optimise away
if (qstrcmp(signal + 1, "destroyed(QObject*)") == 0)
return;
- // someone connecting to one of our signals
- Q_D(QDBusAbstractInterface);
-
QDBusConnectionPrivate *conn = d->connectionPrivate();
if (conn)
conn->connectRelay(d->service, d->currentOwner, d->path, d->interface,
@@ -524,6 +557,8 @@ void QDBusAbstractInterface::disconnectNotify(const char *signal)
{
// someone disconnecting from one of our signals
Q_D(QDBusAbstractInterface);
+ if (!d->isValid)
+ return;
QDBusConnectionPrivate *conn = d->connectionPrivate();
if (conn)
@@ -540,11 +575,7 @@ QVariant QDBusAbstractInterface::internalPropGet(const char *propname) const
// assume this property exists and is readable
// we're only called from generated code anyways
- int idx = metaObject()->indexOfProperty(propname);
- if (idx != -1)
- return d_func()->property(metaObject()->property(idx));
- qWarning("QDBusAbstractInterface::internalPropGet called with unknown property '%s'", propname);
- return QVariant(); // error
+ return property(propname);
}
/*!
@@ -553,16 +584,7 @@ QVariant QDBusAbstractInterface::internalPropGet(const char *propname) const
*/
void QDBusAbstractInterface::internalPropSet(const char *propname, const QVariant &value)
{
- Q_D(QDBusAbstractInterface);
-
- // assume this property exists and is writeable
- // we're only called from generated code anyways
-
- int idx = metaObject()->indexOfProperty(propname);
- if (idx != -1)
- d->setProperty(metaObject()->property(idx), value);
- else
- qWarning("QDBusAbstractInterface::internalPropGet called with unknown property '%s'", propname);
+ setProperty(propname, value);
}
/*!
diff --git a/src/dbus/qdbusabstractinterface.h b/src/dbus/qdbusabstractinterface.h
index 6400b26..e525f77 100644
--- a/src/dbus/qdbusabstractinterface.h
+++ b/src/dbus/qdbusabstractinterface.h
@@ -61,7 +61,23 @@ class QDBusError;
class QDBusPendingCall;
class QDBusAbstractInterfacePrivate;
-class QDBUS_EXPORT QDBusAbstractInterface: public QObject
+
+class QDBUS_EXPORT QDBusAbstractInterfaceBase: public QObject
+{
+public:
+ int qt_metacall(QMetaObject::Call, int, void**);
+protected:
+ QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &dd, QObject *parent);
+private:
+ Q_DECLARE_PRIVATE(QDBusAbstractInterface)
+};
+
+class QDBUS_EXPORT QDBusAbstractInterface:
+#ifdef Q_QDOC
+ public QObject
+#else
+ public QDBusAbstractInterfaceBase
+#endif
{
Q_OBJECT
diff --git a/src/dbus/qdbusabstractinterface_p.h b/src/dbus/qdbusabstractinterface_p.h
index e2ea058..65df902 100644
--- a/src/dbus/qdbusabstractinterface_p.h
+++ b/src/dbus/qdbusabstractinterface_p.h
@@ -75,15 +75,19 @@ public:
QString path;
QString interface;
mutable QDBusError lastError;
+
+ // this is set during creation and never changed
+ // it can't be const because QDBusInterfacePrivate has one more check
bool isValid;
QDBusAbstractInterfacePrivate(const QString &serv, const QString &p,
const QString &iface, const QDBusConnection& con, bool dynamic);
virtual ~QDBusAbstractInterfacePrivate() { }
+ bool canMakeCalls() const;
// these functions do not check if the property is valid
- QVariant property(const QMetaProperty &mp) const;
- void setProperty(const QMetaProperty &mp, const QVariant &value);
+ void property(const QMetaProperty &mp, QVariant &where) const;
+ bool setProperty(const QMetaProperty &mp, const QVariant &value);
// return conn's d pointer
inline QDBusConnectionPrivate *connectionPrivate() const
diff --git a/src/dbus/qdbusargument_p.h b/src/dbus/qdbusargument_p.h
index b49a517..78bc683 100644
--- a/src/dbus/qdbusargument_p.h
+++ b/src/dbus/qdbusargument_p.h
@@ -130,7 +130,7 @@ public:
QDBusMarshaller *endCommon();
void open(QDBusMarshaller &sub, int code, const char *signature);
void close();
- void error();
+ void error(const QString &message);
bool appendVariantInternal(const QVariant &arg);
bool appendRegisteredType(const QVariant &arg);
@@ -140,6 +140,7 @@ public:
DBusMessageIter iterator;
QDBusMarshaller *parent;
QByteArray *ba;
+ QString errorString;
char closeCode;
bool ok;
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 5c37509..a156a71 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -300,6 +300,8 @@ public:
extern int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes);
extern int qDBusNameToTypeId(const char *name);
extern bool qDBusCheckAsyncTag(const char *tag);
+extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
+extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
// in qdbusinternalfilters.cpp
extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node);
@@ -310,9 +312,6 @@ extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNod
extern QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg);
-// in qdbusxmlgenerator.cpp
-extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
-
QT_END_NAMESPACE
#endif
diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp
index 4f50e4f..caa2437 100644
--- a/src/dbus/qdbuserror.cpp
+++ b/src/dbus/qdbuserror.cpp
@@ -91,6 +91,10 @@ org.freedesktop.DBus.Error.InvalidSignature
org.freedesktop.DBus.Error.UnknownInterface
com.trolltech.QtDBus.Error.InternalError
org.freedesktop.DBus.Error.UnknownObject
+com.trolltech.QtDBus.Error.InvalidService
+com.trolltech.QtDBus.Error.InvalidObjectPath
+com.trolltech.QtDBus.Error.InvalidInterface
+com.trolltech.QtDBus.Error.InvalidMember
*/
// in the same order as KnownErrors!
@@ -116,12 +120,17 @@ static const char errorMessages_string[] =
"org.freedesktop.DBus.Error.UnknownInterface\0"
"com.trolltech.QtDBus.Error.InternalError\0"
"org.freedesktop.DBus.Error.UnknownObject\0"
+ "com.trolltech.QtDBus.Error.InvalidService\0"
+ "com.trolltech.QtDBus.Error.InvalidObjectPath\0"
+ "com.trolltech.QtDBus.Error.InvalidInterface\0"
+ "com.trolltech.QtDBus.Error.InvalidMember\0"
"\0";
static const int errorMessages_indices[] = {
0, 6, 40, 76, 118, 153, 191, 231,
273, 313, 349, 384, 421, 461, 501, 540,
- 581, 617, 661, 705, 746, 0
+ 581, 617, 661, 705, 746, 787, 829, 874,
+ 918, 0
};
static const int errorMessages_count = sizeof errorMessages_indices /
@@ -216,8 +225,16 @@ static inline QDBusError::ErrorType get(const char *name)
\value UnknownInterface The interface is not known
\value InternalError An internal error occurred
(\c com.trolltech.QtDBus.Error.InternalError)
- \value UnknownObject The remote object could not be found.
+ \value InvalidObjectPath The object path provided is invalid.
+
+ \value InvalidService The service requested is invalid.
+
+ \value InvalidMember The member is invalid.
+
+ \value InvalidInterface The interface is invalid.
+
+ \value UnknownObject The remote object could not be found.
*/
/*!
diff --git a/src/dbus/qdbuserror.h b/src/dbus/qdbuserror.h
index 7b77fd5..4e348dd 100644
--- a/src/dbus/qdbuserror.h
+++ b/src/dbus/qdbuserror.h
@@ -81,10 +81,14 @@ public:
UnknownInterface,
InternalError,
UnknownObject,
+ InvalidService,
+ InvalidObjectPath,
+ InvalidInterface,
+ InvalidMember,
#ifndef Q_QDOC
// don't use this one!
- LastErrorType = UnknownObject
+ LastErrorType = InvalidMember
#endif
};
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 97a4545..e6c69b6 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1143,10 +1143,14 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
QDBusReadLocker locker(RelaySignalAction, this);
QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface,
QLatin1String(memberName));
+ QDBusMessagePrivate::setParametersValidated(message, true);
message.setArguments(args);
- DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
+ QDBusError error;
+ DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error);
if (!msg) {
- qWarning("QDBusConnection: Could not emit signal %s.%s", qPrintable(interface), memberName.constData());
+ qWarning("QDBusConnection: Could not emit signal %s.%s: %s", qPrintable(interface), memberName.constData(),
+ qPrintable(error.message()));
+ lastError = error;
return;
}
@@ -1359,12 +1363,8 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes
// try the object itself:
if (node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots)) {
bool interfaceFound = true;
- if (!msg.interface().isEmpty()) {
- // check if the interface name matches anything in the class hierarchy
- const QMetaObject *mo = node.obj->metaObject();
- for ( ; !interfaceFound && mo != &QObject::staticMetaObject; mo = mo->superClass())
- interfaceFound = msg.interface() == qDBusInterfaceFromMetaObject(mo);
- }
+ if (!msg.interface().isEmpty())
+ interfaceFound = qDBusInterfaceInObject(node.obj, msg.interface());
if (interfaceFound) {
if (!activateCall(node.obj, node.flags, msg))
@@ -1702,21 +1702,26 @@ int QDBusConnectionPrivate::send(const QDBusMessage& message)
return -1; // don't send; the reply will be retrieved by the caller
// through the d_ptr->localReply link
- DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
+ QDBusError error;
+ DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error);
if (!msg) {
if (message.type() == QDBusMessage::MethodCallMessage)
- qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"",
+ qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s",
qPrintable(message.service()), qPrintable(message.path()),
- qPrintable(message.interface()), qPrintable(message.member()));
+ qPrintable(message.interface()), qPrintable(message.member()),
+ qPrintable(error.message()));
else if (message.type() == QDBusMessage::SignalMessage)
- qWarning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\"",
+ qWarning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\": %s",
qPrintable(message.path()), qPrintable(message.interface()),
- qPrintable(message.member()));
+ qPrintable(message.member()),
+ qPrintable(error.message()));
else
- qWarning("QDBusConnection: error: could not send %s message to service \"%s\"",
+ qWarning("QDBusConnection: error: could not send %s message to service \"%s\": %s",
message.type() == QDBusMessage::ReplyMessage ? "reply" :
message.type() == QDBusMessage::ErrorMessage ? "error" :
- "invalid", qPrintable(message.service()));
+ "invalid", qPrintable(message.service()),
+ qPrintable(error.message()));
+ lastError = error;
return 0;
}
@@ -1743,12 +1748,15 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message,
return sendWithReplyLocal(message);
if (!QCoreApplication::instance() || sendMode == QDBus::Block) {
- DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
+ QDBusError err;
+ DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &err);
if (!msg) {
- qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"",
+ qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s",
qPrintable(message.service()), qPrintable(message.path()),
- qPrintable(message.interface()), qPrintable(message.member()));
- return QDBusMessage();
+ qPrintable(message.interface()), qPrintable(message.member()),
+ qPrintable(err.message()));
+ lastError = err;
+ return QDBusMessage::createError(err);
}
qDBusDebug() << QThread::currentThread() << "sending message (blocking):" << message;
@@ -1758,9 +1766,8 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message,
q_dbus_message_unref(msg);
if (!!error) {
- QDBusError qe = error;
- lastError = qe;
- return QDBusMessage::createError(qe);
+ lastError = err = error;
+ return QDBusMessage::createError(err);
}
QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(reply);
@@ -1770,16 +1777,17 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message,
return amsg;
} else { // use the event loop
QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout);
- if (!pcall)
- return QDBusMessage();
+ Q_ASSERT(pcall);
- pcall->watcherHelper = new QDBusPendingCallWatcherHelper;
- QEventLoop loop;
- loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit()));
- loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit()));
+ if (pcall->replyMessage.type() != QDBusMessage::InvalidMessage) {
+ pcall->watcherHelper = new QDBusPendingCallWatcherHelper;
+ QEventLoop loop;
+ loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit()));
+ loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit()));
- // enter the event loop and wait for a reply
- loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents);
+ // enter the event loop and wait for a reply
+ loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents);
+ }
QDBusMessage reply = pcall->replyMessage;
lastError = reply; // set or clear error
@@ -1835,20 +1843,25 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM
return pcall;
}
- DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
+ checkThread();
+ QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate;
+ pcall->sentMessage = message;
+ pcall->ref = 0;
+
+ QDBusError error;
+ DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error);
if (!msg) {
- qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"",
+ qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s",
qPrintable(message.service()), qPrintable(message.path()),
- qPrintable(message.interface()), qPrintable(message.member()));
- return 0;
+ qPrintable(message.interface()), qPrintable(message.member()),
+ qPrintable(error.message()));
+ pcall->replyMessage = QDBusMessage::createError(error);
+ lastError = error;
+ return pcall;
}
- checkThread();
qDBusDebug() << QThread::currentThread() << "sending message (async):" << message;
DBusPendingCall *pending = 0;
- QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate;
- pcall->sentMessage = message;
- pcall->ref = 0;
QDBusDispatchLocker locker(SendWithReplyAsyncAction, this);
if (q_dbus_connection_send_with_reply(connection, msg, &pending, timeout)) {
@@ -1862,14 +1875,14 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM
return pcall;
} else {
// we're probably disconnected at this point
- lastError = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server"));
+ lastError = error = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server"));
}
} else {
- lastError = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory"));
+ lastError = error = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory"));
}
q_dbus_message_unref(msg);
- pcall->replyMessage = QDBusMessage::createError(lastError);
+ pcall->replyMessage = QDBusMessage::createError(error);
return pcall;
}
@@ -1878,8 +1891,7 @@ int QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, QObj
int timeout)
{
QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout);
- if (!pcall)
- return 0;
+ Q_ASSERT(pcall);
// has it already finished (dispatched locally)?
if (pcall->replyMessage.type() == QDBusMessage::ReplyMessage) {
@@ -2081,6 +2093,7 @@ QString QDBusConnectionPrivate::getNameOwner(const QString& serviceName)
QDBusMessage msg = QDBusMessage::createMethodCall(QLatin1String(DBUS_SERVICE_DBUS),
QLatin1String(DBUS_PATH_DBUS), QLatin1String(DBUS_INTERFACE_DBUS),
QLatin1String("GetNameOwner"));
+ QDBusMessagePrivate::setParametersValidated(msg, true);
msg << serviceName;
QDBusMessage reply = sendWithReply(msg, QDBus::Block);
if (reply.type() == QDBusMessage::ReplyMessage)
@@ -2104,6 +2117,7 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa
QDBusMessage msg = QDBusMessage::createMethodCall(service, path,
QLatin1String(DBUS_INTERFACE_INTROSPECTABLE),
QLatin1String("Introspect"));
+ QDBusMessagePrivate::setParametersValidated(msg, true);
QDBusMessage reply = sendWithReply(msg, QDBus::Block);
diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp
index 211b717..5f6df0a 100644
--- a/src/dbus/qdbusinterface.cpp
+++ b/src/dbus/qdbusinterface.cpp
@@ -51,6 +51,102 @@
QT_BEGIN_NAMESPACE
+static void copyArgument(void *to, int id, const QVariant &arg)
+{
+ if (id == arg.userType()) {
+ switch (id) {
+ case QVariant::Bool:
+ *reinterpret_cast<bool *>(to) = arg.toBool();
+ return;
+
+ case QMetaType::UChar:
+ *reinterpret_cast<uchar *>(to) = arg.value<uchar>();
+ return;
+
+ case QMetaType::Short:
+ *reinterpret_cast<short *>(to) = arg.value<short>();
+ return;
+
+ case QMetaType::UShort:
+ *reinterpret_cast<ushort *>(to) = arg.value<ushort>();
+ return;
+
+ case QVariant::Int:
+ *reinterpret_cast<int *>(to) = arg.toInt();
+ return;
+
+ case QVariant::UInt:
+ *reinterpret_cast<uint *>(to) = arg.toUInt();
+ return;
+
+ case QVariant::LongLong:
+ *reinterpret_cast<qlonglong *>(to) = arg.toLongLong();
+ return;
+
+ case QVariant::ULongLong:
+ *reinterpret_cast<qulonglong *>(to) = arg.toULongLong();
+ return;
+
+ case QVariant::Double:
+ *reinterpret_cast<double *>(to) = arg.toDouble();
+ return;
+
+ case QVariant::String:
+ *reinterpret_cast<QString *>(to) = arg.toString();
+ return;
+
+ case QVariant::ByteArray:
+ *reinterpret_cast<QByteArray *>(to) = arg.toByteArray();
+ return;
+
+ case QVariant::StringList:
+ *reinterpret_cast<QStringList *>(to) = arg.toStringList();
+ return;
+ }
+
+ if (id == QDBusMetaTypeId::variant) {
+ *reinterpret_cast<QDBusVariant *>(to) = arg.value<QDBusVariant>();
+ return;
+ } else if (id == QDBusMetaTypeId::objectpath) {
+ *reinterpret_cast<QDBusObjectPath *>(to) = arg.value<QDBusObjectPath>();
+ return;
+ } else if (id == QDBusMetaTypeId::signature) {
+ *reinterpret_cast<QDBusSignature *>(to) = arg.value<QDBusSignature>();
+ return;
+ }
+
+ // those above are the only types possible
+ // the demarshaller code doesn't demarshall anything else
+ qFatal("Found a decoded basic type in a D-Bus reply that shouldn't be there");
+ }
+
+ // if we got here, it's either an un-dermarshalled type or a mismatch
+ if (arg.userType() != QDBusMetaTypeId::argument) {
+ // it's a mismatch
+ //qWarning?
+ return;
+ }
+
+ // is this type registered?
+ const char *userSignature = QDBusMetaType::typeToSignature(id);
+ if (!userSignature || !*userSignature) {
+ // type not registered
+ //qWarning?
+ return;
+ }
+
+ // is it the same signature?
+ QDBusArgument dbarg = arg.value<QDBusArgument>();
+ if (dbarg.currentSignature() != QLatin1String(userSignature)) {
+ // not the same signature, another mismatch
+ //qWarning?
+ return;
+ }
+
+ // we can demarshall
+ QDBusMetaType::demarshall(dbarg, id, to);
+}
+
QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString &p,
const QString &iface, const QDBusConnection &con)
: QDBusAbstractInterfacePrivate(serv, p, iface, con, true), metaObject(0)
@@ -186,45 +282,39 @@ int QDBusInterfacePrivate::metacall(QMetaObject::Call c, int id, void **argv)
// we will assume that the input arguments were passed correctly
QVariantList args;
- for (int i = 1; i <= inputTypesCount; ++i)
+ int i = 1;
+ for ( ; i <= inputTypesCount; ++i)
args << QVariant(inputTypes[i], argv[i]);
// make the call
- QPointer<QDBusInterface> qq = q;
QDBusMessage reply = q->callWithArgumentList(QDBus::Block, methodName, args);
- args.clear();
- // we ignore return values
+ if (reply.type() == QDBusMessage::ReplyMessage) {
+ // attempt to demarshall the return values
+ args = reply.arguments();
+ QVariantList::ConstIterator it = args.constBegin();
+ const int *outputTypes = metaObject->outputTypesForMethod(id);
+ int outputTypesCount = *outputTypes++;
+
+ if (*mm.typeName()) {
+ // this method has a return type
+ if (argv[0] && it != args.constEnd())
+ copyArgument(argv[0], *outputTypes++, *it);
- // access to "this" or to "q" below this point must check for "qq"
- // we may have been deleted!
+ // skip this argument even if we didn't copy it
+ --outputTypesCount;
+ ++it;
+ }
- if (!qq.isNull())
- lastError = reply;
+ for (int j = 0; j < outputTypesCount && it != args.constEnd(); ++i, ++j, ++it) {
+ copyArgument(argv[i], outputTypes[j], *it);
+ }
+ }
// done
+ lastError = reply;
return -1;
}
- } else if (c == QMetaObject::ReadProperty) {
- // Qt doesn't support non-readable properties
- // we have to re-check
- QMetaProperty mp = metaObject->property(id + metaObject->propertyOffset());
- if (!mp.isReadable())
- return -1; // don't read
-
- QVariant *value = reinterpret_cast<QVariant*>(argv[1]);
- argv[1] = 0;
- *value = property(mp);
-
- return -1; // handled, error or not
- } else if (c == QMetaObject::WriteProperty) {
- // QMetaProperty::write has already checked that we're writable
- // it has also checked that the type is right
- QVariant *value = reinterpret_cast<QVariant *>(argv[1]);
- QMetaProperty mp = metaObject->property(id + metaObject->propertyOffset());
-
- setProperty(mp, *value);
- return -1;
}
return id;
}
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index 416144d..45cbbb0 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -53,6 +53,7 @@
#include "qdbusextratypes.h"
#include "qdbusmessage.h"
#include "qdbusmetatype.h"
+#include "qdbusmetatype_p.h"
#include "qdbusmessage_p.h"
#include "qdbusutil_p.h"
@@ -177,14 +178,25 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node
// implement the D-Bus interface org.freedesktop.DBus.Properties
-static QDBusMessage qDBusPropertyError(const QDBusMessage &msg, const QString &interface_name)
+static inline QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const QString &interface_name)
{
- return msg.createErrorReply(QLatin1String(DBUS_ERROR_INVALID_ARGS),
+ return msg.createErrorReply(QDBusError::UnknownInterface,
QString::fromLatin1("Interface %1 was not found in object %2")
.arg(interface_name)
.arg(msg.path()));
}
+static inline QDBusMessage
+propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name)
+{
+ return msg.createErrorReply(QDBusError::InvalidArgs,
+ QString::fromLatin1("Property %1%2%3 was not found in object %4")
+ .arg(interface_name,
+ QString::fromLatin1(interface_name.isEmpty() ? "" : "."),
+ QString::fromLatin1(property_name),
+ msg.path()));
+}
+
QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg)
{
@@ -198,6 +210,7 @@ QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node
QDBusAdaptorConnector *connector;
QVariant value;
+ bool interfaceFound = false;
if (node.flags & QDBusConnection::ExportAdaptors &&
(connector = qDBusFindAdaptorConnector(node.obj))) {
@@ -217,31 +230,122 @@ QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node
QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
interface_name);
- if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface))
+ if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
+ interfaceFound = true;
value = it->adaptor->property(property_name);
+ }
}
}
- if (!value.isValid() && node.flags & (QDBusConnection::ExportAllProperties |
- QDBusConnection::ExportNonScriptableProperties)) {
+ if (!interfaceFound && !value.isValid()
+ && node.flags & (QDBusConnection::ExportAllProperties |
+ QDBusConnection::ExportNonScriptableProperties)) {
// try the object itself
- int pidx = node.obj->metaObject()->indexOfProperty(property_name);
- if (pidx != -1) {
- QMetaProperty mp = node.obj->metaObject()->property(pidx);
- if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) ||
- (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties)))
- value = mp.read(node.obj);
+ if (!interface_name.isEmpty())
+ interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);
+
+ if (interfaceFound) {
+ int pidx = node.obj->metaObject()->indexOfProperty(property_name);
+ if (pidx != -1) {
+ QMetaProperty mp = node.obj->metaObject()->property(pidx);
+ if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) ||
+ (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties)))
+ value = mp.read(node.obj);
+ }
}
}
if (!value.isValid()) {
// the property was not found
- return qDBusPropertyError(msg, interface_name);
+ if (!interfaceFound)
+ return interfaceNotFoundError(msg, interface_name);
+ return propertyNotFoundError(msg, interface_name, property_name);
}
return msg.createReply(qVariantFromValue(QDBusVariant(value)));
}
+enum PropertyWriteResult {
+ PropertyWriteSuccess = 0,
+ PropertyNotFound,
+ PropertyTypeMismatch,
+ PropertyWriteFailed
+};
+
+static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &interface_name,
+ const QByteArray &property_name, int status)
+{
+ switch (status) {
+ case PropertyNotFound:
+ return propertyNotFoundError(msg, interface_name, property_name);
+ case PropertyTypeMismatch:
+ return msg.createErrorReply(QDBusError::InvalidArgs,
+ QString::fromLatin1("Invalid arguments for writing to property %1%2%3")
+ .arg(interface_name,
+ QString::fromLatin1(interface_name.isEmpty() ? "" : "."),
+ QString::fromLatin1(property_name)));
+ case PropertyWriteFailed:
+ return msg.createErrorReply(QDBusError::InternalError,
+ QString::fromLatin1("Internal error"));
+
+ case PropertyWriteSuccess:
+ return msg.createReply();
+ }
+ Q_ASSERT_X(false, "", "Should not be reached");
+ return QDBusMessage();
+}
+
+static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant value,
+ int propFlags = QDBusConnection::ExportAllProperties)
+{
+ const QMetaObject *mo = obj->metaObject();
+ int pidx = mo->indexOfProperty(property_name);
+ if (pidx == -1) {
+ // this object has no property by that name
+ return PropertyNotFound;
+ }
+
+ QMetaProperty mp = mo->property(pidx);
+
+ // check if this property is exported
+ bool isScriptable = mp.isScriptable();
+ if (!(propFlags & QDBusConnection::ExportScriptableProperties) && isScriptable)
+ return PropertyNotFound;
+ if (!(propFlags & QDBusConnection::ExportNonScriptableProperties) && !isScriptable)
+ return PropertyNotFound;
+
+ // we found our property
+ // do we have the right type?
+ int id = mp.type();
+ if (id == QVariant::UserType) {
+ // dynamic type
+ id = qDBusNameToTypeId(mp.typeName());
+ if (id == -1) {
+ // type not registered?
+ qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
+ mp.typeName(), mo->className(), property_name.constData());
+ return PropertyWriteFailed;
+ }
+ }
+
+ if (id != 0xff && value.userType() == QDBusMetaTypeId::argument) {
+ // we have to demarshall before writing
+ void *null = 0;
+ QVariant other(id, null);
+ if (!QDBusMetaType::demarshall(qVariantValue<QDBusArgument>(value), id, other.data())) {
+ qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. "
+ "Use qDBusRegisterMetaType to register it",
+ mp.typeName(), id);
+ return PropertyWriteFailed;
+ }
+
+ value = other;
+ }
+
+ // the property type here should match
+ return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed;
+}
+
QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg)
{
@@ -263,38 +367,39 @@ QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node
if (interface_name.isEmpty()) {
for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(),
end = connector->adaptors.constEnd(); it != end; ++it) {
- const QMetaObject *mo = it->adaptor->metaObject();
- int pidx = mo->indexOfProperty(property_name);
- if (pidx != -1) {
- mo->property(pidx).write(it->adaptor, value);
- return msg.createReply();
- }
+ int status = writeProperty(it->adaptor, property_name, value);
+ if (status == PropertyNotFound)
+ continue;
+ return propertyWriteReply(msg, interface_name, property_name, status);
}
} else {
QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
interface_name);
- if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface))
- if (it->adaptor->setProperty(property_name, value))
- return msg.createReply();
+ if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) {
+ return propertyWriteReply(msg, interface_name, property_name,
+ writeProperty(it->adaptor, property_name, value));
+ }
}
}
if (node.flags & (QDBusConnection::ExportScriptableProperties |
QDBusConnection::ExportNonScriptableProperties)) {
// try the object itself
- int pidx = node.obj->metaObject()->indexOfProperty(property_name);
- if (pidx != -1) {
- QMetaProperty mp = node.obj->metaObject()->property(pidx);
- if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) ||
- (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties)))
- if (mp.write(node.obj, value))
- return msg.createReply();
+ bool interfaceFound = true;
+ if (!interface_name.isEmpty())
+ interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);
+
+ if (interfaceFound) {
+ return propertyWriteReply(msg, interface_name, property_name,
+ writeProperty(node.obj, property_name, value, node.flags));
}
}
- // the property was not found or not written to
- return qDBusPropertyError(msg, interface_name);
+ // the property was not found
+ if (!interface_name.isEmpty())
+ return interfaceNotFoundError(msg, interface_name);
+ return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound);
}
// unite two QVariantMaps, but don't generate duplicate keys
@@ -385,7 +490,7 @@ QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &n
if (!interfaceFound && !interface_name.isEmpty()) {
// the interface was not found
- return qDBusPropertyError(msg, interface_name);
+ return interfaceNotFoundError(msg, interface_name);
}
return msg.createReply(qVariantFromValue(result));
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp
index 7ada1ed..7207b4c 100644
--- a/src/dbus/qdbusmarshaller.cpp
+++ b/src/dbus/qdbusmarshaller.cpp
@@ -121,7 +121,7 @@ inline void QDBusMarshaller::append(const QDBusObjectPath &arg)
{
QByteArray data = arg.path().toUtf8();
if (!ba && data.isEmpty())
- error();
+ error(QLatin1String("Invalid object path passed in arguments"));
const char *cdata = data.constData();
qIterAppend(&iterator, ba, DBUS_TYPE_OBJECT_PATH, &cdata);
}
@@ -130,7 +130,7 @@ inline void QDBusMarshaller::append(const QDBusSignature &arg)
{
QByteArray data = arg.signature().toUtf8();
if (!ba && data.isEmpty())
- error();
+ error(QLatin1String("Invalid signature passed in arguments"));
const char *cdata = data.constData();
qIterAppend(&iterator, ba, DBUS_TYPE_SIGNATURE, &cdata);
}
@@ -161,7 +161,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg)
QVariant::Type id = QVariant::Type(value.userType());
if (id == QVariant::Invalid) {
qWarning("QDBusMarshaller: cannot add a null QDBusVariant");
- error();
+ error(QLatin1String("Variant containing QVariant::Invalid passed in arguments"));
return false;
}
@@ -180,7 +180,8 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg)
qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
"Use qDBusRegisterMetaType to register it",
QVariant::typeToName( id ), id);
- error();
+ error(QString::fromLatin1("Unregistered type %1 passed in arguments")
+ .arg(QLatin1String(QVariant::typeToName(id))));
return false;
}
@@ -220,7 +221,8 @@ inline QDBusMarshaller *QDBusMarshaller::beginArray(int id)
qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
"Use qDBusRegisterMetaType to register it",
QVariant::typeToName( QVariant::Type(id) ), id);
- error();
+ error(QString::fromLatin1("Unregistered type %1 passed in arguments")
+ .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id)))));
return this;
}
@@ -234,22 +236,26 @@ inline QDBusMarshaller *QDBusMarshaller::beginMap(int kid, int vid)
qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
"Use qDBusRegisterMetaType to register it",
QVariant::typeToName( QVariant::Type(kid) ), kid);
- error();
+ error(QString::fromLatin1("Unregistered type %1 passed in arguments")
+ .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid)))));
return this;
}
if (ksignature[1] != 0 || !q_dbus_type_is_basic(*ksignature)) {
qWarning("QDBusMarshaller: type '%s' (%d) cannot be used as the key type in a D-BUS map.",
QVariant::typeToName( QVariant::Type(kid) ), kid);
- error();
+ error(QString::fromLatin1("Type %1 passed in arguments cannot be used as a key in a map")
+ .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid)))));
return this;
}
const char *vsignature = QDBusMetaType::typeToSignature( QVariant::Type(vid) );
if (!vsignature) {
+ const char *typeName = QVariant::typeToName(QVariant::Type(vid));
qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
"Use qDBusRegisterMetaType to register it",
- QVariant::typeToName( QVariant::Type(vid) ), vid);
- error();
+ typeName, vid);
+ error(QString::fromLatin1("Unregistered type %1 passed in arguments")
+ .arg(QLatin1String(typeName)));
return this;
}
@@ -328,11 +334,13 @@ void QDBusMarshaller::close()
}
}
-void QDBusMarshaller::error()
+void QDBusMarshaller::error(const QString &msg)
{
ok = false;
if (parent)
- parent->error();
+ parent->error(msg);
+ else
+ errorString = msg;
}
bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
@@ -340,7 +348,7 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
int id = arg.userType();
if (id == QVariant::Invalid) {
qWarning("QDBusMarshaller: cannot add an invalid QVariant");
- error();
+ error(QLatin1String("Variant containing QVariant::Invalid passed in arguments"));
return false;
}
@@ -371,7 +379,8 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
"Use qDBusRegisterMetaType to register it",
QVariant::typeToName( QVariant::Type(id) ), id);
- error();
+ error(QString::fromLatin1("Unregistered type %1 passed in arguments")
+ .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id)))));
return false;
}
@@ -388,16 +397,6 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
case DBUS_TYPE_DOUBLE:
qIterAppend(&iterator, ba, *signature, arg.constData());
return true;
-
- case DBUS_TYPE_STRING:
- case DBUS_TYPE_OBJECT_PATH:
- case DBUS_TYPE_SIGNATURE: {
- const QByteArray data =
- reinterpret_cast<const QString *>(arg.constData())->toUtf8();
- const char *rawData = data.constData();
- qIterAppend(&iterator, ba, *signature, &rawData);
- return true;
- }
#else
case DBUS_TYPE_BYTE:
append( qvariant_cast<uchar>(arg) );
@@ -426,6 +425,8 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
case DBUS_TYPE_DOUBLE:
append( arg.toDouble() );
return true;
+#endif
+
case DBUS_TYPE_STRING:
append( arg.toString() );
return true;
@@ -435,7 +436,6 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
case DBUS_TYPE_SIGNATURE:
append( qvariant_cast<QDBusSignature>(arg) );
return true;
-#endif
// compound types:
case DBUS_TYPE_VARIANT:
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 9150295..78de6d9 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -62,7 +62,8 @@ static inline const char *data(const QByteArray &arr)
QDBusMessagePrivate::QDBusMessagePrivate()
: msg(0), reply(0), type(DBUS_MESSAGE_TYPE_INVALID),
- timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false)
+ timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false),
+ parametersValidated(false)
{
}
@@ -94,11 +95,17 @@ QString QDBusMessage::errorMessage() const
\internal
Constructs a DBusMessage object from this object. The returned value must be de-referenced
with q_dbus_message_unref.
+
+ The \a error object is set to indicate the error if anything went wrong with the
+ marshalling. Usually, this error message will be placed in the reply, as if the call failed.
+ The \a error pointer must not be null.
*/
-DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
+DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDBusError *error)
{
- if (!qdbus_loadLibDBus())
+ if (!qdbus_loadLibDBus()) {
+ *error = QDBusError(QDBusError::Failed, QLatin1String("Could not open lidbus-1 library"));
return 0;
+ }
DBusMessage *msg = 0;
const QDBusMessagePrivate *d_ptr = message.d_ptr;
@@ -108,10 +115,19 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
//qDebug() << "QDBusMessagePrivate::toDBusMessage" << "message is invalid";
break;
case DBUS_MESSAGE_TYPE_METHOD_CALL:
- // only interface can be empty
- if (d_ptr->service.isEmpty() || d_ptr->path.isEmpty() || d_ptr->name.isEmpty())
- break;
- msg = q_dbus_message_new_method_call(d_ptr->service.toUtf8(), d_ptr->path.toUtf8(),
+ // only service and interface can be empty -> path and name must not be empty
+ if (!d_ptr->parametersValidated) {
+ if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error))
+ return 0;
+ if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error))
+ return 0;
+ if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error))
+ return 0;
+ if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method"))
+ return 0;
+ }
+
+ msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(),
data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8());
break;
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
@@ -123,8 +139,10 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
break;
case DBUS_MESSAGE_TYPE_ERROR:
// error name can't be empty
- if (d_ptr->name.isEmpty())
- break;
+ if (!d_ptr->parametersValidated
+ && !QDBusUtil::checkErrorName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error))
+ return 0;
+
msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR);
q_dbus_message_set_error_name(msg, d_ptr->name.toUtf8());
if (!d_ptr->localMessage) {
@@ -134,8 +152,15 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
break;
case DBUS_MESSAGE_TYPE_SIGNAL:
// nothing can be empty here
- if (d_ptr->path.isEmpty() || d_ptr->interface.isEmpty() || d_ptr->name.isEmpty())
- break;
+ if (!d_ptr->parametersValidated) {
+ if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error))
+ return 0;
+ if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error))
+ return 0;
+ if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method"))
+ return 0;
+ }
+
msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(),
d_ptr->name.toUtf8());
break;
@@ -143,16 +168,11 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
Q_ASSERT(false);
break;
}
-#if 0
- DBusError err;
- q_dbus_error_init(&err);
- if (q_dbus_error_is_set(&err)) {
- QDBusError qe(&err);
- qDebug() << "QDBusMessagePrivate::toDBusMessage" << qe;
- }
-#endif
- if (!msg)
- return 0;
+
+ // if we got here, the parameters validated
+ // and since the message parameters cannot be changed once the message is created
+ // we can record this fact
+ d_ptr->parametersValidated = true;
QDBusMarshaller marshaller;
QVariantList::ConstIterator it = d_ptr->arguments.constBegin();
@@ -170,6 +190,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
// not ok;
q_dbus_message_unref(msg);
+ *error = QDBusError(QDBusError::Failed, QLatin1String("Marshalling failed: ") + marshaller.errorString);
return 0;
}
@@ -247,7 +268,13 @@ QDBusMessage QDBusMessagePrivate::makeLocal(const QDBusConnectionPrivate &conn,
// yes, we are
// we must marshall and demarshall again so as to create QDBusArgument
// entries for the complex types
- DBusMessage *message = toDBusMessage(asSent);
+ QDBusError error;
+ DBusMessage *message = toDBusMessage(asSent, &error);
+ if (!message) {
+ // failed to marshall, so it's a call error
+ return QDBusMessage::createError(error);
+ }
+
q_dbus_message_set_sender(message, conn.baseService.toUtf8());
QDBusMessage retval = fromDBusMessage(message);
@@ -466,6 +493,13 @@ QDBusMessage QDBusMessage::createErrorReply(const QString name, const QString &m
Constructs a new DBus reply message for the error type \a type using
the message \a msg. Returns the DBus message.
*/
+QDBusMessage QDBusMessage::createErrorReply(QDBusError::ErrorType atype, const QString &amsg) const
+{
+ QDBusMessage msg = createErrorReply(QDBusError::errorString(atype), amsg);
+ msg.d_ptr->parametersValidated = true;
+ return msg;
+}
+
/*!
Constructs an empty, invalid QDBusMessage object.
diff --git a/src/dbus/qdbusmessage.h b/src/dbus/qdbusmessage.h
index 55f388a..34b1635 100644
--- a/src/dbus/qdbusmessage.h
+++ b/src/dbus/qdbusmessage.h
@@ -87,8 +87,9 @@ public:
QDBusMessage createErrorReply(const QString name, const QString &msg) const;
inline QDBusMessage createErrorReply(const QDBusError &err) const
{ return createErrorReply(err.name(), err.message()); }
- inline QDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const;
+ QDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const;
+ // there are no setters; if this changes, see qdbusmessage_p.h
QString service() const;
QString path() const;
QString interface() const;
@@ -113,9 +114,6 @@ private:
QDBusMessagePrivate *d_ptr;
};
-inline QDBusMessage QDBusMessage::createErrorReply(QDBusError::ErrorType atype, const QString &amsg) const
-{ return createErrorReply(QDBusError::errorString(atype), amsg); }
-
#ifndef QT_NO_DEBUG_STREAM
QDBUS_EXPORT QDebug operator<<(QDebug, const QDBusMessage &);
#endif
diff --git a/src/dbus/qdbusmessage_p.h b/src/dbus/qdbusmessage_p.h
index 12a9500..b8f23dc 100644
--- a/src/dbus/qdbusmessage_p.h
+++ b/src/dbus/qdbusmessage_p.h
@@ -55,6 +55,7 @@
#include <qatomic.h>
#include <qstring.h>
+#include <qdbusmessage.h>
struct DBusMessage;
@@ -69,7 +70,11 @@ public:
~QDBusMessagePrivate();
QList<QVariant> arguments;
+
+ // the following parameters are "const": they are not changed after the constructors
+ // the parametersValidated member below controls whether they've been validated already
QString service, path, interface, name, message, signature;
+
DBusMessage *msg;
DBusMessage *reply;
int type;
@@ -79,8 +84,12 @@ public:
mutable uint delayedReply : 1;
uint localMessage : 1;
+ mutable uint parametersValidated : 1;
+
+ static void setParametersValidated(QDBusMessage &msg, bool enable)
+ { msg.d_ptr->parametersValidated = enable; }
- static DBusMessage *toDBusMessage(const QDBusMessage &message);
+ static DBusMessage *toDBusMessage(const QDBusMessage &message, QDBusError *error);
static QDBusMessage fromDBusMessage(DBusMessage *dmsg);
static bool isLocal(const QDBusMessage &msg);
diff --git a/src/dbus/qdbusmisc.cpp b/src/dbus/qdbusmisc.cpp
index e5c1da6..1b77a9b 100644
--- a/src/dbus/qdbusmisc.cpp
+++ b/src/dbus/qdbusmisc.cpp
@@ -41,12 +41,14 @@
#include <string.h>
+#include <QtCore/qcoreapplication.h>
#include <QtCore/qvariant.h>
#include <QtCore/qmetaobject.h>
#include "qdbusutil_p.h"
#include "qdbusconnection_p.h"
#include "qdbusmetatype_p.h"
+#include "qdbusabstractadaptor_p.h" // for QCLASSINFO_DBUS_*
QT_BEGIN_NAMESPACE
@@ -73,6 +75,51 @@ int qDBusNameToTypeId(const char *name)
return id;
}
+QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
+{
+ QString interface;
+
+ int idx = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE);
+ if (idx >= mo->classInfoOffset()) {
+ interface = QLatin1String(mo->classInfo(idx).value());
+ } else {
+ interface = QLatin1String(mo->className());
+ interface.replace(QLatin1String("::"), QLatin1String("."));
+
+ if (interface.startsWith(QLatin1String("QDBus"))) {
+ interface.prepend(QLatin1String("com.trolltech.QtDBus."));
+ } else if (interface.startsWith(QLatin1Char('Q')) &&
+ interface.length() >= 2 && interface.at(1).isUpper()) {
+ // assume it's Qt
+ interface.prepend(QLatin1String("com.trolltech.Qt."));
+ } else if (!QCoreApplication::instance()||
+ QCoreApplication::instance()->applicationName().isEmpty()) {
+ interface.prepend(QLatin1String("local."));
+ } else {
+ interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName());
+ QStringList domainName =
+ QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'),
+ QString::SkipEmptyParts);
+ if (domainName.isEmpty())
+ interface.prepend(QLatin1String("local."));
+ else
+ for (int i = 0; i < domainName.count(); ++i)
+ interface.prepend(QLatin1Char('.')).prepend(domainName.at(i));
+ }
+ }
+
+ return interface;
+}
+
+bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name)
+{
+ const QMetaObject *mo = obj->metaObject();
+ for ( ; mo != &QObject::staticMetaObject; mo = mo->superClass())
+ if (interface_name == qDBusInterfaceFromMetaObject(mo))
+ return true;
+ return false;
+}
+
// calculates the metatypes for the method
// the slot must have the parameters in the following form:
// - zero or more value or const-ref parameters of any kind
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index 1797ed0..0ec1a26 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -409,6 +409,44 @@ bool QDBusPendingCall::setReplyCallback(QObject *target, const char *member)
}
#endif
+/*!
+ \since 4.6
+ Creates a QDBusPendingCall object based on the error condition
+ \a error. The resulting pending call object will be in the
+ "finished" state and QDBusPendingReply::isError() will return true.
+
+ \sa fromCompletedCall()
+*/
+QDBusPendingCall QDBusPendingCall::fromError(const QDBusError &error)
+{
+ return fromCompletedCall(QDBusMessage::createError(error));
+}
+
+/*!
+ \since 4.6
+ Creates a QDBusPendingCall object based on the message \a msg.
+ The message must be of type QDBusMessage::ErrorMessage or
+ QDBusMessage::ReplyMessage (that is, a message that is typical
+ of a completed call).
+
+ This function is useful for code that requires simulating a pending
+ call, but that has already finished.
+
+ \sa fromError()
+*/
+QDBusPendingCall QDBusPendingCall::fromCompletedCall(const QDBusMessage &msg)
+{
+ QDBusPendingCallPrivate *d = 0;
+ if (msg.type() == QDBusMessage::ErrorMessage ||
+ msg.type() == QDBusMessage::ReplyMessage) {
+ d = new QDBusPendingCallPrivate;
+ d->replyMessage = msg;
+ d->connection = 0;
+ }
+
+ return QDBusPendingCall(d);
+}
+
class QDBusPendingCallWatcherPrivate: public QObjectPrivate
{
diff --git a/src/dbus/qdbuspendingcall.h b/src/dbus/qdbuspendingcall.h
index 8881920..8dbbb3c 100644
--- a/src/dbus/qdbuspendingcall.h
+++ b/src/dbus/qdbuspendingcall.h
@@ -78,6 +78,9 @@ public:
QDBusMessage reply() const;
#endif
+ static QDBusPendingCall fromError(const QDBusError &error);
+ static QDBusPendingCall fromCompletedCall(const QDBusMessage &message);
+
protected:
QExplicitlySharedDataPointer<QDBusPendingCallPrivate> d;
friend class QDBusPendingCallPrivate;
diff --git a/src/dbus/qdbuspendingcall_p.h b/src/dbus/qdbuspendingcall_p.h
index 7136f67..5577451 100644
--- a/src/dbus/qdbuspendingcall_p.h
+++ b/src/dbus/qdbuspendingcall_p.h
@@ -63,6 +63,7 @@
QT_BEGIN_NAMESPACE
+class QDBusPendingCall;
class QDBusPendingCallWatcher;
class QDBusPendingCallWatcherHelper;
class QDBusConnectionPrivate;
@@ -94,6 +95,8 @@ public:
void waitForFinished();
void setMetaTypes(int count, const int *types);
void checkReceivedSignature();
+
+ static QDBusPendingCall fromMessage(const QDBusMessage &msg);
};
class QDBusPendingCallWatcherHelper: public QObject
diff --git a/src/dbus/qdbusutil_p.h b/src/dbus/qdbusutil_p.h
index 13031fd..5c1e4cd 100644
--- a/src/dbus/qdbusutil_p.h
+++ b/src/dbus/qdbusutil_p.h
@@ -57,6 +57,7 @@
#include <QtCore/qvariant.h>
#include <QtDBus/qdbusmacros.h>
+#include <QtDBus/qdbuserror.h>
QT_BEGIN_HEADER
@@ -83,6 +84,73 @@ namespace QDBusUtil
QDBUS_EXPORT bool isValidSingleSignature(const QString &signature);
QDBUS_EXPORT QString argumentToString(const QVariant &variant);
+
+ enum AllowEmptyFlag {
+ EmptyAllowed,
+ EmptyNotAllowed
+ };
+
+ inline bool checkInterfaceName(const QString &name, AllowEmptyFlag empty, QDBusError *error)
+ {
+ if (name.isEmpty()) {
+ if (empty == EmptyAllowed) return true;
+ *error = QDBusError(QDBusError::InvalidInterface, QLatin1String("Interface name cannot be empty"));
+ return false;
+ }
+ if (isValidInterfaceName(name)) return true;
+ *error = QDBusError(QDBusError::InvalidInterface, QString::fromLatin1("Invalid interface class: %1").arg(name));
+ return false;
+ }
+
+ inline bool checkBusName(const QString &name, AllowEmptyFlag empty, QDBusError *error)
+ {
+ if (name.isEmpty()) {
+ if (empty == EmptyAllowed) return true;
+ *error = QDBusError(QDBusError::InvalidService, QLatin1String("Service name cannot be empty"));
+ return false;
+ }
+ if (isValidBusName(name)) return true;
+ *error = QDBusError(QDBusError::InvalidService, QString::fromLatin1("Invalid service name: %1").arg(name));
+ return false;
+ }
+
+ inline bool checkObjectPath(const QString &path, AllowEmptyFlag empty, QDBusError *error)
+ {
+ if (path.isEmpty()) {
+ if (empty == EmptyAllowed) return true;
+ *error = QDBusError(QDBusError::InvalidObjectPath, QLatin1String("Object path cannot be empty"));
+ return false;
+ }
+ if (isValidObjectPath(path)) return true;
+ *error = QDBusError(QDBusError::InvalidObjectPath, QString::fromLatin1("Invalid object path: %1").arg(path));
+ return false;
+ }
+
+ inline bool checkMemberName(const QString &name, AllowEmptyFlag empty, QDBusError *error, const char *nameType = 0)
+ {
+ if (!nameType) nameType = "member";
+ if (name.isEmpty()) {
+ if (empty == EmptyAllowed) return true;
+ *error = QDBusError(QDBusError::InvalidMember, QLatin1String(nameType) + QLatin1String(" name cannot be empty"));
+ return false;
+ }
+ if (isValidMemberName(name)) return true;
+ *error = QDBusError(QDBusError::InvalidMember, QString::fromLatin1("Invalid %1 name: %2")
+ .arg(QString::fromLatin1(nameType), name));
+ return false;
+ }
+
+ inline bool checkErrorName(const QString &name, AllowEmptyFlag empty, QDBusError *error)
+ {
+ if (name.isEmpty()) {
+ if (empty == EmptyAllowed) return true;
+ *error = QDBusError(QDBusError::InvalidInterface, QLatin1String("Error name cannot be empty"));
+ return false;
+ }
+ if (isValidErrorName(name)) return true;
+ *error = QDBusError(QDBusError::InvalidInterface, QString::fromLatin1("Invalid error name: %1").arg(name));
+ return false;
+ }
}
QT_END_NAMESPACE
diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp
index 82bd762..b426abd 100644
--- a/src/dbus/qdbusxmlgenerator.cpp
+++ b/src/dbus/qdbusxmlgenerator.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-#include <QtCore/qcoreapplication.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qstringlist.h>
@@ -232,42 +231,6 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
return retval;
}
-QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
-{
- QString interface;
-
- int idx = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE);
- if (idx >= mo->classInfoOffset()) {
- interface = QLatin1String(mo->classInfo(idx).value());
- } else {
- interface = QLatin1String(mo->className());
- interface.replace(QLatin1String("::"), QLatin1String("."));
-
- if (interface.startsWith(QLatin1String("QDBus"))) {
- interface.prepend(QLatin1String("com.trolltech.QtDBus."));
- } else if (interface.startsWith(QLatin1Char('Q')) &&
- interface.length() >= 2 && interface.at(1).isUpper()) {
- // assume it's Qt
- interface.prepend(QLatin1String("com.trolltech.Qt."));
- } else if (!QCoreApplication::instance()||
- QCoreApplication::instance()->applicationName().isEmpty()) {
- interface.prepend(QLatin1String("local."));
- } else {
- interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName());
- QStringList domainName =
- QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'),
- QString::SkipEmptyParts);
- if (domainName.isEmpty())
- interface.prepend(QLatin1String("local."));
- else
- for (int i = 0; i < domainName.count(); ++i)
- interface.prepend(QLatin1Char('.')).prepend(domainName.at(i));
- }
- }
-
- return interface;
- }
-
QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo,
const QMetaObject *base, int flags)
{
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 19080de..8dc8159 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -210,6 +210,7 @@ public:
PageTabList = 0x0000003C,
Clock = 0x0000003D,
Splitter = 0x0000003E,
+ // Additional Qt roles where enum value does not map directly to MSAA:
LayeredPane = 0x0000003F,
UserRole = 0x0000ffff
};
diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp
index ccb2673..85f1a8d 100644
--- a/src/gui/accessible/qaccessible_win.cpp
+++ b/src/gui/accessible/qaccessible_win.cpp
@@ -177,14 +177,14 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
return;
}
- QByteArray soundName;
+ QString soundName;
switch (reason) {
case PopupMenuStart:
- soundName = "MenuPopup";
+ soundName = QLatin1String("MenuPopup");
break;
case MenuCommand:
- soundName = "MenuCommand";
+ soundName = QLatin1String("MenuCommand");
break;
case Alert:
@@ -194,13 +194,13 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
if (mb) {
switch (mb->icon()) {
case QMessageBox::Warning:
- soundName = "SystemExclamation";
+ soundName = QLatin1String("SystemExclamation");
break;
case QMessageBox::Critical:
- soundName = "SystemHand";
+ soundName = QLatin1String("SystemHand");
break;
case QMessageBox::Information:
- soundName = "SystemAsterisk";
+ soundName = QLatin1String("SystemAsterisk");
break;
default:
break;
@@ -208,7 +208,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
} else
#endif // QT_NO_MESSAGEBOX
{
- soundName = "SystemAsterisk";
+ soundName = QLatin1String("SystemAsterisk");
}
}
@@ -219,20 +219,16 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
if (soundName.size()) {
#ifndef QT_NO_SETTINGS
- QSettings settings(QLatin1String("HKEY_CURRENT_USER\\AppEvents\\Schemes\\Apps\\.Default\\") +
- QString::fromLatin1(soundName.constData()), QSettings::NativeFormat);
+ QSettings settings(QLatin1String("HKEY_CURRENT_USER\\AppEvents\\Schemes\\Apps\\.Default\\") + soundName,
+ QSettings::NativeFormat);
QString file = settings.value(QLatin1String(".Current/.")).toString();
#else
- QString file;
+ QString file;
#endif
- if (!file.isEmpty()) {
- QT_WA({
- PlaySoundW(reinterpret_cast<const wchar_t *> (QString::fromLatin1(soundName).utf16()), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT );
- } , {
- PlaySoundA(soundName.constData(), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT );
- });
- }
- }
+ if (!file.isEmpty()) {
+ PlaySound(reinterpret_cast<const wchar_t *>(soundName.utf16()), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT);
+ }
+ }
if (!isActive())
return;
@@ -1055,6 +1051,8 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accRole(VARIANT varID, VARIANT
Role role = accessible->role(varID.lVal);
if (role != NoRole) {
+ if (role == LayeredPane)
+ role = QAccessible::Pane;
(*pvarRole).vt = VT_I4;
(*pvarRole).lVal = role;
} else {
diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp
index 42755dc..3cb35bf 100644
--- a/src/gui/dialogs/qdialog.cpp
+++ b/src/gui/dialogs/qdialog.cpp
@@ -787,8 +787,7 @@ void QDialog::setVisible(bool visible)
#ifdef Q_WS_WIN
if (d->mainDef && isActiveWindow()) {
BOOL snapToDefault = false;
- if ( QT_WA_INLINE( SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, &snapToDefault, 0) ,
- SystemParametersInfoA(SPI_GETSNAPTODEFBUTTON, 0, &snapToDefault, 0) )) {
+ if (SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, &snapToDefault, 0)) {
if (snapToDefault)
QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center()));
}
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index f1382fe..6198661 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -212,25 +212,30 @@ Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook
/*!
\enum QFileDialog::Option
- \value ShowDirsOnly Only show directories in the file dialog. By default both files and
- directories are shown. (Valid only in the \l Directory file mode.)
- \value DontResolveSymlinks Don't resolve symlinks in the file dialog. By default symlinks
- are resolved.
- \value DontConfirmOverwrite Don't ask for confirmation if an existing file is selected.
- By default confirmation is requested.
- \value DontUseNativeDialog Don't use the native file dialog. By default on Mac OS X,
- the native file dialog is used unless you use a subclass of QFileDialog that contains the
- Q_OBJECT macro.
+ \value ShowDirsOnly Only show directories in the file dialog. By
+ default both files and directories are shown. (Valid only in the
+ \l Directory file mode.)
+
+ \value DontResolveSymlinks Don't resolve symlinks in the file
+ dialog. By default symlinks are resolved.
+
+ \value DontConfirmOverwrite Don't ask for confirmation if an
+ existing file is selected. By default confirmation is requested.
+
+ \value DontUseNativeDialog Don't use the native file dialog. By
+ default, the native file dialog is used unless you use a subclass
+ of QFileDialog that contains the Q_OBJECT macro.
+
\value ReadOnly Indicates that the model is readonly.
- \value HideNameFilterDetails Indicates if the is hidden or not.
+ \value HideNameFilterDetails Indicates if the is hidden or not.
This value is obsolete and does nothing since Qt 4.5:
- \value DontUseSheet In previous versions of Qt, the static functions would
- create a sheet by default if the static function was given a parent. This
- is no longer supported in Qt 4.5, The static functions will always be an
- application modal dialog. If you want to use sheets, use
- QFileDialog::open() instead.
+ \value DontUseSheet In previous versions of Qt, the static
+ functions would create a sheet by default if the static function
+ was given a parent. This is no longer supported in Qt 4.5, The
+ static functions will always be an application modal dialog. If
+ you want to use sheets, use QFileDialog::open() instead.
*/
@@ -1633,12 +1638,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
args.parent = parent;
args.caption = caption;
args.directory = QFileDialogPrivate::workingDirectory(dir);
- //If workingDirectory returned a different path than the initial one,
- //it means that the initial path was invalid. There is no point to try select a file
- if (args.directory != QFileInfo(dir).path())
- args.selection = QString();
- else
- args.selection = QFileDialogPrivate::initialSelection(dir);
+ args.selection = QFileDialogPrivate::initialSelection(dir);
args.filter = filter;
args.mode = ExistingFile;
args.options = options;
@@ -1716,18 +1716,13 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
QString *selectedFilter,
Options options)
{
- if (qt_filedialog_open_filenames_hook)
+ if (qt_filedialog_open_filenames_hook && !(options & DontUseNativeDialog))
return qt_filedialog_open_filenames_hook(parent, caption, dir, filter, selectedFilter, options);
QFileDialogArgs args;
args.parent = parent;
args.caption = caption;
args.directory = QFileDialogPrivate::workingDirectory(dir);
- //If workingDirectory returned a different path than the initial one,
- //it means that the initial path was invalid. There is no point to try select a file
- if (args.directory != QFileInfo(dir).path())
- args.selection = QString();
- else
- args.selection = QFileDialogPrivate::initialSelection(dir);
+ args.selection = QFileDialogPrivate::initialSelection(dir);
args.filter = filter;
args.mode = ExistingFiles;
args.options = options;
@@ -1807,18 +1802,13 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
QString *selectedFilter,
Options options)
{
- if (qt_filedialog_save_filename_hook)
+ if (qt_filedialog_save_filename_hook && !(options & DontUseNativeDialog))
return qt_filedialog_save_filename_hook(parent, caption, dir, filter, selectedFilter, options);
QFileDialogArgs args;
args.parent = parent;
args.caption = caption;
args.directory = QFileDialogPrivate::workingDirectory(dir);
- //If workingDirectory returned a different path than the initial one,
- //it means that the initial path was invalid. There is no point to try select a file
- if (args.directory != QFileInfo(dir).path())
- args.selection = QString();
- else
- args.selection = QFileDialogPrivate::initialSelection(dir);
+ args.selection = QFileDialogPrivate::initialSelection(dir);
args.filter = filter;
args.mode = AnyFile;
args.options = options;
@@ -1887,7 +1877,7 @@ QString QFileDialog::getExistingDirectory(QWidget *parent,
const QString &dir,
Options options)
{
- if (qt_filedialog_existing_directory_hook)
+ if (qt_filedialog_existing_directory_hook && !(options & DontUseNativeDialog))
return qt_filedialog_existing_directory_hook(parent, caption, dir, options);
QFileDialogArgs args;
args.parent = parent;
diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h
index 21a52e5..2da2b92 100644
--- a/src/gui/dialogs/qfiledialog_p.h
+++ b/src/gui/dialogs/qfiledialog_p.h
@@ -73,7 +73,6 @@
#include <qabstractproxymodel.h>
#include <qcompleter.h>
#include <qpointer.h>
-#include <qtimeline.h>
#include <qdebug.h>
#include "qsidebar_p.h"
#include "qfscompleter_p.h"
@@ -145,8 +144,7 @@ public:
#ifndef Q_OS_WINCE
DWORD maxLength;
QString drive = path.left(3);
- if (QT_WA_INLINE(::GetVolumeInformationW(reinterpret_cast<const WCHAR *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0),
- ::GetVolumeInformationA(drive.toLocal8Bit().constData(), NULL, 0, NULL, &maxLength, NULL, NULL, 0)) == FALSE)
+ if (::GetVolumeInformation(reinterpret_cast<const wchar_t *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE)
return -1;
return maxLength;
#else
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index 4cb31f5..9bf82c3 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -60,6 +60,13 @@
#include <shlobj.h>
+#include <objbase.h>
+
+#if defined(__IFileDialog_INTERFACE_DEFINED__) \
+ && defined(__IFileOpenDialog_INTERFACE_DEFINED__)
+#define USE_COMMON_ITEM_DIALOG
+#endif
+
#ifdef Q_WS_WINCE
#include <commdlg.h>
# ifndef BFFM_SETSELECTION
@@ -70,8 +77,8 @@
typedef struct qt_priv_browseinfo {
HWND hwndOwner;
LPCITEMIDLIST pidlRoot;
- LPTSTR pszDisplayName;
- LPCTSTR lpszTitle;
+ LPWSTR pszDisplayName;
+ LPCWSTR lpszTitle;
UINT ulFlags;
BFFCALLBACK lpfn;
LPARAM lParam;
@@ -90,6 +97,9 @@ typedef LPITEMIDLIST (WINAPI *PtrSHBrowseForFolder)(BROWSEINFO*);
static PtrSHBrowseForFolder ptrSHBrowseForFolder = 0;
typedef BOOL (WINAPI *PtrSHGetPathFromIDList)(LPITEMIDLIST,LPWSTR);
static PtrSHGetPathFromIDList ptrSHGetPathFromIDList = 0;
+typedef HRESULT (WINAPI *PtrSHGetMalloc)(LPMALLOC *);
+static PtrSHGetMalloc ptrSHGetMalloc = 0;
+
QT_BEGIN_NAMESPACE
@@ -111,20 +121,20 @@ static void qt_win_resolve_libs()
#endif
triedResolve = true;
- if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) {
#if !defined(Q_WS_WINCE)
- QLibrary lib(QLatin1String("shell32"));
- ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW");
- ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW");
+ QLibrary lib(QLatin1String("shell32"));
+ ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW");
+ ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW");
+ ptrSHGetMalloc = (PtrSHGetMalloc) lib.resolve("SHGetMalloc");
#else
- // CE stores them in a different lib and does not use unicode version
- HINSTANCE handle = LoadLibraryW(L"Ceshell");
- ptrSHBrowseForFolder = (PtrSHBrowseForFolder)GetProcAddress(handle, L"SHBrowseForFolder");
- ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList)GetProcAddress(handle, L"SHGetPathFromIDList");
- if (ptrSHBrowseForFolder && ptrSHGetPathFromIDList)
- qt_priv_ptr_valid = true;
+ // CE stores them in a different lib and does not use unicode version
+ HINSTANCE handle = LoadLibraryW(L"Ceshell");
+ ptrSHBrowseForFolder = (PtrSHBrowseForFolder)GetProcAddress(handle, L"SHBrowseForFolder");
+ ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList)GetProcAddress(handle, L"SHGetPathFromIDList");
+ ptrSHGetMalloc = (PtrSHGetMalloc)GetProcAddress(handle, L"SHGetMalloc");
+ if (ptrSHBrowseForFolder && ptrSHGetPathFromIDList && ptrSHGetMalloc)
+ qt_priv_ptr_valid = true;
#endif
- }
}
}
@@ -186,95 +196,15 @@ static QString qt_win_selected_filter(const QString &filter, DWORD idx)
return qt_win_make_filters_list(filter).at((int)idx - 1);
}
-#ifndef Q_WS_WINCE
-// Static vars for OFNA funcs:
-static QByteArray aInitDir;
-static QByteArray aInitSel;
-static QByteArray aTitle;
-static QByteArray aFilter;
-// Use ANSI strings and API
-
-// If you change this, then make sure you change qt_win_make_OFN (below) too
-static OPENFILENAMEA *qt_win_make_OFNA(QWidget *parent,
- const QString &initialSelection,
- const QString &initialDirectory,
- const QString &title,
- const QString &filters,
- QFileDialog::FileMode mode,
- QFileDialog::Options options)
-{
- if (parent)
- parent = parent->window();
- else
- parent = QApplication::activeWindow();
-
- aTitle = title.toLocal8Bit();
- aInitDir = QDir::toNativeSeparators(initialDirectory).toLocal8Bit();
- if (initialSelection.isEmpty()) {
- aInitSel = "";
- } else {
- aInitSel = QDir::toNativeSeparators(initialSelection).toLocal8Bit();
- aInitSel.replace('<', "");
- aInitSel.replace('>', "");
- aInitSel.replace('\"', "");
- aInitSel.replace('|', "");
- }
- int maxLen = mode == QFileDialog::ExistingFiles ? maxMultiLen : maxNameLen;
- aInitSel.resize(maxLen + 1); // make room for return value
- aFilter = filters.toLocal8Bit();
-
- OPENFILENAMEA* ofn = new OPENFILENAMEA;
- memset(ofn, 0, sizeof(OPENFILENAMEA));
-
-#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500)
- // according to the MSDN, this should also be necessary for MSVC, but
- // OPENFILENAME_SIZE_VERSION_400A is in not Microsoft header, as it seems
- if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) {
- ofn->lStructSize = OPENFILENAME_SIZE_VERSION_400A;
- } else {
- ofn->lStructSize = sizeof(OPENFILENAMEA);
- }
-#else
- ofn->lStructSize = sizeof(OPENFILENAMEA);
-#endif
- Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
- ofn->hwndOwner = parent ? parent->winId() : 0;
- ofn->lpstrFilter = aFilter;
- ofn->lpstrFile = aInitSel.data();
- ofn->nMaxFile = maxLen;
- ofn->lpstrInitialDir = aInitDir.data();
- ofn->lpstrTitle = aTitle.data();
- ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER);
-
- if (mode == QFileDialog::ExistingFile ||
- mode == QFileDialog::ExistingFiles)
- ofn->Flags |= (OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST);
- if (mode == QFileDialog::ExistingFiles)
- ofn->Flags |= (OFN_ALLOWMULTISELECT);
- if (!(options & QFileDialog::DontConfirmOverwrite))
- ofn->Flags |= OFN_OVERWRITEPROMPT;
-
- return ofn;
-}
-
-static void qt_win_clean_up_OFNA(OPENFILENAMEA **ofn)
-{
- delete *ofn;
- *ofn = 0;
-}
-#endif
-
static QString tFilters, tTitle, tInitDir;
-#ifdef UNICODE
-// If you change this, then make sure you change qt_win_make_OFNA (above) too
static OPENFILENAME* qt_win_make_OFN(QWidget *parent,
const QString& initialSelection,
const QString& initialDirectory,
const QString& title,
const QString& filters,
QFileDialog::FileMode mode,
- QFileDialog::Options options)
+ QFileDialog::Options options)
{
if (parent)
parent = parent->window();
@@ -286,14 +216,14 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent,
tTitle = title;
QString initSel = QDir::toNativeSeparators(initialSelection);
if (!initSel.isEmpty()) {
- initSel.remove(QLatin1Char('<'));
- initSel.remove(QLatin1Char('>'));
- initSel.remove(QLatin1Char('\"'));
- initSel.remove(QLatin1Char('|'));
+ initSel.remove(QLatin1Char('<'));
+ initSel.remove(QLatin1Char('>'));
+ initSel.remove(QLatin1Char('\"'));
+ initSel.remove(QLatin1Char('|'));
}
int maxLen = mode == QFileDialog::ExistingFiles ? maxMultiLen : maxNameLen;
- TCHAR *tInitSel = new TCHAR[maxLen+1];
+ wchar_t *tInitSel = new wchar_t[maxLen + 1];
if (initSel.length() > 0 && initSel.length() <= maxLen)
memcpy(tInitSel, initSel.utf16(), (initSel.length()+1)*sizeof(QChar));
else
@@ -302,24 +232,14 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent,
OPENFILENAME* ofn = new OPENFILENAME;
memset(ofn, 0, sizeof(OPENFILENAME));
-#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500)
- // according to the MSDN, this should also be necessary for MSVC, but
- // OPENFILENAME_SIZE_VERSION_400 is in not Microsoft header, as it seems
- if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) {
- ofn->lStructSize= OPENFILENAME_SIZE_VERSION_400;
- } else {
- ofn->lStructSize = sizeof(OPENFILENAME);
- }
-#else
ofn->lStructSize = sizeof(OPENFILENAME);
-#endif
Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
ofn->hwndOwner = parent ? parent->winId() : 0;
- ofn->lpstrFilter = (TCHAR *)tFilters.utf16();
+ ofn->lpstrFilter = (wchar_t*)tFilters.utf16();
ofn->lpstrFile = tInitSel;
ofn->nMaxFile = maxLen;
- ofn->lpstrInitialDir = (TCHAR *)tInitDir.utf16();
- ofn->lpstrTitle = (TCHAR *)tTitle.utf16();
+ ofn->lpstrInitialDir = (wchar_t*)tInitDir.utf16();
+ ofn->lpstrTitle = (wchar_t*)tTitle.utf16();
ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER);
if (mode == QFileDialog::ExistingFile ||
mode == QFileDialog::ExistingFiles)
@@ -332,7 +252,6 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent,
return ofn;
}
-
static void qt_win_clean_up_OFN(OPENFILENAME **ofn)
{
delete [] (*ofn)->lpstrFile;
@@ -340,8 +259,6 @@ static void qt_win_clean_up_OFN(OPENFILENAME **ofn)
*ofn = 0;
}
-#endif // UNICODE
-
extern void qt_win_eatMouseMove();
QString qt_win_get_open_file_name(const QFileDialogArgs &args,
@@ -377,35 +294,20 @@ QString qt_win_get_open_file_name(const QFileDialogArgs &args,
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
modal_widget.setParent(args.parent, Qt::Window);
QApplicationPrivate::enterModal(&modal_widget);
- QT_WA({
- // Use Unicode strings and API
- OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection,
- args.directory, args.caption,
- qt_win_filter(args.filter),
- QFileDialog::ExistingFile,
- args.options);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileName(ofn)) {
- result = QString::fromUtf16((ushort*)ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- qt_win_clean_up_OFN(&ofn);
- } , {
- // Use ANSI strings and API
- OPENFILENAMEA* ofn = qt_win_make_OFNA(args.parent, args.selection,
- args.directory, args.caption,
- qt_win_filter(args.filter),
- QFileDialog::ExistingFile,
- args.options);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileNameA(ofn)) {
- result = QString::fromLocal8Bit(ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- qt_win_clean_up_OFNA(&ofn);
- });
+
+ OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection,
+ args.directory, args.caption,
+ qt_win_filter(args.filter),
+ QFileDialog::ExistingFile,
+ args.options);
+ if (idx)
+ ofn->nFilterIndex = idx + 1;
+ if (GetOpenFileName(ofn)) {
+ result = QString::fromWCharArray(ofn->lpstrFile);
+ selFilIdx = ofn->nFilterIndex;
+ }
+ qt_win_clean_up_OFN(&ofn);
+
QApplicationPrivate::leaveModal(&modal_widget);
qt_win_eatMouseMove();
@@ -422,7 +324,7 @@ QString qt_win_get_open_file_name(const QFileDialogArgs &args,
QString qt_win_get_save_file_name(const QFileDialogArgs &args,
QString *initialDirectory,
- QString *selectedFilter)
+ QString *selectedFilter)
{
QString result;
@@ -470,41 +372,22 @@ QString qt_win_get_save_file_name(const QFileDialogArgs &args,
}
}
- QT_WA({
- // Use Unicode strings and API
- OPENFILENAME *ofn = qt_win_make_OFN(args.parent, args.selection,
- args.directory, args.caption,
- qt_win_filter(args.filter),
- QFileDialog::AnyFile,
- args.options);
-
- ofn->lpstrDefExt = (TCHAR *)defaultSaveExt.utf16();
-
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetSaveFileName(ofn)) {
- result = QString::fromUtf16((ushort*)ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- qt_win_clean_up_OFN(&ofn);
- } , {
- // Use ANSI strings and API
- OPENFILENAMEA *ofn = qt_win_make_OFNA(args.parent, args.selection,
- args.directory, args.caption,
- qt_win_filter(args.filter),
- QFileDialog::AnyFile,
- args.options);
- QByteArray asciiExt = defaultSaveExt.toAscii();
- ofn->lpstrDefExt = asciiExt.data();
-
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetSaveFileNameA(ofn)) {
- result = QString::fromLocal8Bit(ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- qt_win_clean_up_OFNA(&ofn);
- });
+ OPENFILENAME *ofn = qt_win_make_OFN(args.parent, args.selection,
+ args.directory, args.caption,
+ qt_win_filter(args.filter),
+ QFileDialog::AnyFile,
+ args.options);
+
+ ofn->lpstrDefExt = (wchar_t*)defaultSaveExt.utf16();
+
+ if (idx)
+ ofn->nFilterIndex = idx + 1;
+ if (GetSaveFileName(ofn)) {
+ result = QString::fromWCharArray(ofn->lpstrFile);
+ selFilIdx = ofn->nFilterIndex;
+ }
+ qt_win_clean_up_OFN(&ofn);
+
#if defined(Q_WS_WINCE)
int semIndex = result.indexOf(QLatin1Char(';'));
if (semIndex >= 0)
@@ -525,14 +408,202 @@ QString qt_win_get_save_file_name(const QFileDialogArgs &args,
return fi.absoluteFilePath();
}
+
+#if defined(USE_COMMON_ITEM_DIALOG)
+
+typedef HRESULT (WINAPI *PtrSHCreateItemFromParsingName)(PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv);
+static PtrSHCreateItemFromParsingName pSHCreateItemFromParsingName = 0;
+
+static bool qt_win_set_IFileDialogOptions(IFileDialog *pfd,
+ const QString& initialSelection,
+ const QString& initialDirectory,
+ const QString& title,
+ const QStringList& filterLst,
+ QFileDialog::FileMode mode,
+ QFileDialog::Options options)
+{
+ if (!pSHCreateItemFromParsingName) {
+ // This function is available only in Vista & above.
+ QLibrary shellLib(QLatin1String("Shell32"));
+ pSHCreateItemFromParsingName = (PtrSHCreateItemFromParsingName)
+ shellLib.resolve("SHCreateItemFromParsingName");
+ if (!pSHCreateItemFromParsingName)
+ return false;
+ }
+ HRESULT hr;
+ QString winfilters;
+ int numFilters = 0;
+ quint32 currentOffset = 0;
+ QList<quint32> offsets;
+ QStringList::ConstIterator it = filterLst.begin();
+ // Create the native filter string and save offset to each entry.
+ for (; it != filterLst.end(); ++it) {
+ QString subfilter = *it;
+ if (!subfilter.isEmpty()) {
+ offsets<<currentOffset;
+ winfilters += subfilter; // The name of the filter.
+ winfilters += QChar();
+ currentOffset += subfilter.size()+1;
+ offsets<<currentOffset;
+ QString spec = qt_win_extract_filter(subfilter);
+ winfilters += spec; // The actual filter spec.
+ winfilters += QChar();
+ currentOffset += spec.size()+1;
+ numFilters++;
+ }
+ }
+ // Add the filters to the file dialog.
+ if (numFilters) {
+ wchar_t *szData = (wchar_t*)winfilters.utf16();
+ COMDLG_FILTERSPEC *filterSpec = new COMDLG_FILTERSPEC[numFilters];
+ for(int i = 0; i<numFilters; i++) {
+ filterSpec[i].pszName = szData+offsets[i*2];
+ filterSpec[i].pszSpec = szData+offsets[(i*2)+1];
+ }
+ hr = pfd->SetFileTypes(numFilters, filterSpec);
+ delete []filterSpec;
+ }
+ // Set the starting folder.
+ tInitDir = QDir::toNativeSeparators(initialDirectory);
+ if (!tInitDir.isEmpty()) {
+ IShellItem *psiDefaultFolder;
+ hr = pSHCreateItemFromParsingName((wchar_t*)tInitDir.utf16(),
+ NULL,
+ IID_PPV_ARGS(&psiDefaultFolder));
+
+ if (SUCCEEDED(hr)) {
+ hr = pfd->SetFolder(psiDefaultFolder);
+ psiDefaultFolder->Release();
+ }
+ }
+ // Set the currently selected file.
+ QString initSel = QDir::toNativeSeparators(initialSelection);
+ if (!initSel.isEmpty()) {
+ initSel.remove(QLatin1Char('<'));
+ initSel.remove(QLatin1Char('>'));
+ initSel.remove(QLatin1Char('\"'));
+ initSel.remove(QLatin1Char('|'));
+ }
+ if (!initSel.isEmpty()) {
+ hr = pfd->SetFileName((wchar_t*)initSel.utf16());
+ }
+ // Set the title for the file dialog.
+ if (!title.isEmpty()) {
+ hr = pfd->SetTitle((wchar_t*)title.utf16());
+ }
+ // Set other flags for the dialog.
+ DWORD newOptions;
+ hr = pfd->GetOptions(&newOptions);
+ if (SUCCEEDED(hr)) {
+ newOptions |= (FOS_NOCHANGEDIR | FOS_NOREADONLYRETURN);
+ if (mode == QFileDialog::ExistingFile ||
+ mode == QFileDialog::ExistingFiles)
+ newOptions |= (FOS_FILEMUSTEXIST | FOS_PATHMUSTEXIST);
+ if (mode == QFileDialog::ExistingFiles)
+ newOptions |= FOS_ALLOWMULTISELECT;
+ if (!(options & QFileDialog::DontConfirmOverwrite))
+ newOptions |= FOS_OVERWRITEPROMPT;
+ hr = pfd->SetOptions(newOptions);
+ }
+ return SUCCEEDED(hr);
+}
+
+QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args,
+ QString *initialDirectory,
+ const QStringList &filterList,
+ QString *selectedFilter,
+ int selectedFilterIndex)
+{
+ QStringList result;
+ QDialog modal_widget;
+ modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
+ modal_widget.setParent(args.parent, Qt::Window);
+ QApplicationPrivate::enterModal(&modal_widget);
+ // Multiple selection is allowed only in IFileOpenDialog.
+ IFileOpenDialog *pfd;
+ HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_PPV_ARGS(&pfd));
+
+ if (SUCCEEDED(hr)) {
+ qt_win_set_IFileDialogOptions(pfd, args.selection,
+ args.directory, args.caption,
+ filterList, QFileDialog::ExistingFiles,
+ args.options);
+ // Set the currently selected filter (one-based index).
+ hr = pfd->SetFileTypeIndex(selectedFilterIndex+1);
+ QWidget *parentWindow = args.parent;
+ if (parentWindow)
+ parentWindow = parentWindow->window();
+ else
+ parentWindow = QApplication::activeWindow();
+ // Show the file dialog.
+ hr = pfd->Show(parentWindow ? parentWindow->winId() : 0);
+ if (SUCCEEDED(hr)) {
+ // Retrieve the results.
+ IShellItemArray *psiaResults;
+ hr = pfd->GetResults(&psiaResults);
+ if (SUCCEEDED(hr)) {
+ DWORD numItems = 0;
+ psiaResults->GetCount(&numItems);
+ for (DWORD i = 0; i<numItems; i++) {
+ IShellItem *psi = 0;
+ hr = psiaResults->GetItemAt(i, &psi);
+ if (SUCCEEDED(hr)) {
+ // Retrieve the file name from shell item.
+ wchar_t *pszPath;
+ hr = psi->GetDisplayName(SIGDN_FILESYSPATH, &pszPath);
+ if (SUCCEEDED(hr)) {
+ QString fileName = QString::fromWCharArray(pszPath);
+ result.append(fileName);
+ CoTaskMemFree(pszPath);
+ }
+ psi->Release(); // Free the current item.
+ }
+ }
+ psiaResults->Release(); // Free the array of items.
+ }
+ }
+ }
+ QApplicationPrivate::leaveModal(&modal_widget);
+
+ qt_win_eatMouseMove();
+
+ if (!result.isEmpty()) {
+ // Retrieve the current folder name.
+ IShellItem *psi = 0;
+ hr = pfd->GetFolder(&psi);
+ if (SUCCEEDED(hr)) {
+ wchar_t *pszPath;
+ hr = psi->GetDisplayName(SIGDN_FILESYSPATH, &pszPath);
+ if (SUCCEEDED(hr)) {
+ *initialDirectory = QString::fromWCharArray(pszPath);
+ CoTaskMemFree(pszPath);
+ }
+ psi->Release();
+ }
+ // Retrieve the currently selected filter.
+ if (selectedFilter) {
+ quint32 filetype = 0;
+ hr = pfd->GetFileTypeIndex(&filetype);
+ if (SUCCEEDED(hr) && filetype && filetype <= (quint32)filterList.length()) {
+ // This is a one-based index, not zero-based.
+ *selectedFilter = filterList[filetype-1];
+ }
+ }
+ }
+ return result;
+}
+
+#endif
+
QStringList qt_win_get_open_file_names(const QFileDialogArgs &args,
QString *initialDirectory,
QString *selectedFilter)
{
- QStringList result;
QFileInfo fi;
QDir dir;
- QString isel;
if (initialDirectory && initialDirectory->left(5) == QLatin1String("file:"))
initialDirectory->remove(0, 5);
@@ -540,7 +611,6 @@ QStringList qt_win_get_open_file_names(const QFileDialogArgs &args,
if (initialDirectory && !fi.isDir()) {
*initialDirectory = fi.absolutePath();
- isel = fi.fileName();
}
if (!fi.exists())
@@ -548,83 +618,59 @@ QStringList qt_win_get_open_file_names(const QFileDialogArgs &args,
DWORD selFilIdx = 0;
+ QStringList filterLst = qt_win_make_filters_list(args.filter);
int idx = 0;
if (selectedFilter) {
- QStringList filterLst = qt_win_make_filters_list(args.filter);
idx = filterLst.indexOf(*selectedFilter);
}
+ // Windows Vista (& above) allows users to search from file dialogs. If user selects
+ // multiple files belonging to different folders from these search results, the
+ // GetOpenFileName() will return only one folder name for all the files. To retrieve
+ // the correct path for all selected files, we have to use Common Item Dialog interfaces.
+#if defined(USE_COMMON_ITEM_DIALOG)
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
+ return qt_win_CID_get_open_file_names(args, initialDirectory, filterLst, selectedFilter, idx);
+#endif
+ QStringList result;
QDialog modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
modal_widget.setParent(args.parent, Qt::Window);
QApplicationPrivate::enterModal(&modal_widget);
- QT_WA({
- OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection,
- args.directory, args.caption,
- qt_win_filter(args.filter),
- QFileDialog::ExistingFiles,
- args.options);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileName(ofn)) {
- QString fileOrDir = QString::fromUtf16((ushort*)ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- int offset = fileOrDir.length() + 1;
- if (ofn->lpstrFile[offset] == 0) {
- // Only one file selected; has full path
- fi.setFile(fileOrDir);
- QString res = fi.absoluteFilePath();
- if (!res.isEmpty())
- result.append(res);
- }
- else {
- // Several files selected; first string is path
- dir.setPath(fileOrDir);
- QString f;
- while(!(f = QString::fromUtf16((ushort*)ofn->lpstrFile+offset)).isEmpty()) {
- fi.setFile(dir, f);
- QString res = fi.absoluteFilePath();
- if (!res.isEmpty())
- result.append(res);
- offset += f.length() + 1;
- }
- }
+
+ OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection,
+ args.directory, args.caption,
+ qt_win_filter(args.filter),
+ QFileDialog::ExistingFiles,
+ args.options);
+ if (idx)
+ ofn->nFilterIndex = idx + 1;
+ if (GetOpenFileName(ofn)) {
+ QString fileOrDir = QString::fromWCharArray(ofn->lpstrFile);
+ selFilIdx = ofn->nFilterIndex;
+ int offset = fileOrDir.length() + 1;
+ if (ofn->lpstrFile[offset] == 0) {
+ // Only one file selected; has full path
+ fi.setFile(fileOrDir);
+ QString res = fi.absoluteFilePath();
+ if (!res.isEmpty())
+ result.append(res);
}
- qt_win_clean_up_OFN(&ofn);
- } , {
- OPENFILENAMEA* ofn = qt_win_make_OFNA(args.parent, args.selection,
- args.directory, args.caption,
- qt_win_filter(args.filter),
- QFileDialog::ExistingFiles,
- args.options);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileNameA(ofn)) {
- QByteArray fileOrDir(ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- int offset = fileOrDir.length() + 1;
- if (ofn->lpstrFile[offset] == '\0') {
- // Only one file selected; has full path
- fi.setFile(QString::fromLocal8Bit(fileOrDir));
+ else {
+ // Several files selected; first string is path
+ dir.setPath(fileOrDir);
+ QString f;
+ while(!(f = QString::fromWCharArray(ofn->lpstrFile + offset)).isEmpty()) {
+ fi.setFile(dir, f);
QString res = fi.absoluteFilePath();
if (!res.isEmpty())
result.append(res);
+ offset += f.length() + 1;
}
- else {
- // Several files selected; first string is path
- dir.setPath(QString::fromLocal8Bit(fileOrDir));
- QByteArray f;
- while (!(f = QByteArray(ofn->lpstrFile + offset)).isEmpty()) {
- fi.setFile(dir, QString::fromLocal8Bit(f));
- QString res = fi.absoluteFilePath();
- if (!res.isEmpty())
- result.append(res);
- offset += f.length() + 1;
- }
- }
- qt_win_clean_up_OFNA(&ofn);
}
- });
+ }
+ qt_win_clean_up_OFN(&ofn);
+
QApplicationPrivate::leaveModal(&modal_widget);
qt_win_eatMouseMove();
@@ -647,34 +693,20 @@ static int __stdcall winGetExistDirCallbackProc(HWND hwnd,
if (uMsg == BFFM_INITIALIZED && lpData != 0) {
QString *initDir = (QString *)(lpData);
if (!initDir->isEmpty()) {
- // ### Lars asks: is this correct for the A version????
- QT_WA({
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initDir->utf16()));
- } , {
- SendMessageA(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initDir->utf16()));
- });
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initDir->utf16()));
}
} else if (uMsg == BFFM_SELCHANGED) {
- QT_WA({
- qt_win_resolve_libs();
- TCHAR path[MAX_PATH];
+ qt_win_resolve_libs();
+ if (ptrSHGetPathFromIDList) {
+ wchar_t path[MAX_PATH];
ptrSHGetPathFromIDList(LPITEMIDLIST(lParam), path);
- QString tmpStr = QString::fromUtf16((ushort*)path);
+ QString tmpStr = QString::fromWCharArray(path);
if (!tmpStr.isEmpty())
SendMessage(hwnd, BFFM_ENABLEOK, 1, 1);
else
SendMessage(hwnd, BFFM_ENABLEOK, 0, 0);
SendMessage(hwnd, BFFM_SETSTATUSTEXT, 1, LPARAM(path));
- } , {
- char path[MAX_PATH];
- SHGetPathFromIDListA(LPITEMIDLIST(lParam), path);
- QString tmpStr = QString::fromLocal8Bit(path);
- if (!tmpStr.isEmpty())
- SendMessageA(hwnd, BFFM_ENABLEOK, 1, 1);
- else
- SendMessageA(hwnd, BFFM_ENABLEOK, 0, 0);
- SendMessageA(hwnd, BFFM_SETSTATUSTEXT, 1, LPARAM(path));
- });
+ }
}
return 0;
}
@@ -700,116 +732,49 @@ QString qt_win_get_existing_directory(const QFileDialogArgs &args)
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
modal_widget.setParent(parent, Qt::Window);
QApplicationPrivate::enterModal(&modal_widget);
-#if !defined(Q_WS_WINCE)
- QT_WA({
- qt_win_resolve_libs();
- QString initDir = QDir::toNativeSeparators(args.directory);
- TCHAR path[MAX_PATH];
- TCHAR initPath[MAX_PATH];
- initPath[0] = 0;
- path[0] = 0;
- tTitle = args.caption;
- BROWSEINFO bi;
- Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
- bi.hwndOwner = (parent ? parent->winId() : 0);
- bi.pidlRoot = NULL;
- //### This does not seem to be respected? - the dialog always displays "Browse for folder"
- bi.lpszTitle = (TCHAR*)tTitle.utf16();
- bi.pszDisplayName = initPath;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
- bi.lpfn = winGetExistDirCallbackProc;
- bi.lParam = LPARAM(&initDir);
- if (ptrSHBrowseForFolder) {
- LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder(&bi);
- if (pItemIDList && ptrSHGetPathFromIDList) {
- ptrSHGetPathFromIDList(pItemIDList, path);
- IMalloc *pMalloc;
- if (SHGetMalloc(&pMalloc) != NOERROR)
- result = QString();
- else {
- pMalloc->Free(pItemIDList);
- pMalloc->Release();
- result = QString::fromUtf16((ushort*)path);
- }
- } else
- result = QString();
- }
- tTitle = QString();
- } , {
- QString initDir = QDir::toNativeSeparators(args.directory);
- char path[MAX_PATH];
- char initPath[MAX_PATH];
- QByteArray ctitle = args.caption.toLocal8Bit();
- initPath[0]=0;
- path[0]=0;
- BROWSEINFOA bi;
- Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
- bi.hwndOwner = (parent ? parent->winId() : 0);
- bi.pidlRoot = NULL;
- bi.lpszTitle = ctitle;
- bi.pszDisplayName = initPath;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
- bi.lpfn = winGetExistDirCallbackProc;
- bi.lParam = LPARAM(&initDir);
- LPITEMIDLIST pItemIDList = SHBrowseForFolderA(&bi);
- if (pItemIDList) {
- SHGetPathFromIDListA(pItemIDList, path);
- IMalloc *pMalloc;
- if (SHGetMalloc(&pMalloc) != NOERROR)
- result = QString();
- else {
- pMalloc->Free(pItemIDList);
- pMalloc->Release();
- result = QString::fromLocal8Bit(path);
- }
- } else
- result = QString();
- });
-#else
- qt_win_resolve_libs();
+
QString initDir = QDir::toNativeSeparators(args.directory);
- TCHAR path[MAX_PATH];
- TCHAR initPath[MAX_PATH];
- memset(initPath, 0 , MAX_PATH*sizeof(TCHAR));
- memset(path, 0, MAX_PATH*sizeof(TCHAR));
+ wchar_t path[MAX_PATH];
+ wchar_t initPath[MAX_PATH];
+ initPath[0] = 0;
+ path[0] = 0;
tTitle = args.caption;
+
+#if !defined(Q_WS_WINCE)
+ BROWSEINFO bi;
+#else
qt_BROWSEINFO bi;
+#endif
+
Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
bi.hwndOwner = (parent ? parent->winId() : 0);
bi.pidlRoot = NULL;
- bi.lpszTitle = (TCHAR*)tTitle.utf16();
+ //### This does not seem to be respected? - the dialog always displays "Browse for folder"
+ bi.lpszTitle = (wchar_t*)tTitle.utf16();
bi.pszDisplayName = initPath;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
bi.lpfn = winGetExistDirCallbackProc;
bi.lParam = LPARAM(&initDir);
+
+ qt_win_resolve_libs();
if (ptrSHBrowseForFolder) {
LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder((BROWSEINFO*)&bi);
- if (pItemIDList && ptrSHGetPathFromIDList) {
+ if (pItemIDList) {
ptrSHGetPathFromIDList(pItemIDList, path);
IMalloc *pMalloc;
- if (SHGetMalloc(&pMalloc) != NOERROR)
- result = QString();
- else {
+ if (ptrSHGetMalloc(&pMalloc) == NOERROR) {
pMalloc->Free(pItemIDList);
pMalloc->Release();
- result = QString::fromUtf16((ushort*)path);
+ result = QString::fromWCharArray(path);
}
- } else
- result = QString();
+ }
}
tTitle = QString();
-#endif
QApplicationPrivate::leaveModal(&modal_widget);
qt_win_eatMouseMove();
- // Due to a bug on Windows Me, we need to reset the current
- // directory
- if ((QSysInfo::WindowsVersion == QSysInfo::WV_98 || QSysInfo::WindowsVersion == QSysInfo::WV_Me)
- && QDir::currentPath() != currentDir)
- QDir::setCurrent(currentDir);
-
if (!result.isEmpty())
result.replace(QLatin1Char('\\'), QLatin1Char('/'));
return result;
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp
index 1a7c6c7..283bda6 100644
--- a/src/gui/dialogs/qfilesystemmodel.cpp
+++ b/src/gui/dialogs/qfilesystemmodel.cpp
@@ -49,7 +49,7 @@
#include <qapplication.h>
#ifdef Q_OS_WIN
-#include <windows.h>
+#include <qt_windows.h>
#endif
QT_BEGIN_NAMESPACE
@@ -296,22 +296,14 @@ static QString qt_GetLongPathName(const QString &strShortPath)
#else
QString longSection = QDir::toNativeSeparators(section);
#endif
- QT_WA({
- WIN32_FIND_DATAW findData;
- h = ::FindFirstFileW((wchar_t *)longSection.utf16(), &findData);
- if (h != INVALID_HANDLE_VALUE)
- longPath.append(QString::fromUtf16((ushort*)findData.cFileName));
- } , {
- WIN32_FIND_DATAA findData;
- h = ::FindFirstFileA(section.toLocal8Bit(), &findData);
- if (h != INVALID_HANDLE_VALUE)
- longPath.append(QString::fromLocal8Bit(findData.cFileName));
- });
- if (h == INVALID_HANDLE_VALUE) {
+ WIN32_FIND_DATA findData;
+ h = ::FindFirstFile((wchar_t*)longSection.utf16(), &findData);
+ if (h != INVALID_HANDLE_VALUE) {
+ longPath.append(QString::fromWCharArray(findData.cFileName));
+ ::FindClose(h);
+ } else {
longPath.append(section);
break;
- } else {
- ::FindClose(h);
}
}
if (it != constEnd)
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index e56d7d4..8a79759 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -1362,8 +1362,10 @@ void QMessageBox::setVisible(bool visible)
/*!
\overload
- Opens the dialog and connects its accepted() signal to the slot specified
- by \a receiver and \a member.
+ Opens the dialog and connects its finished() or buttonClicked() signal to
+ the slot specified by \a receiver and \a member. If the slot in \a member
+ has a pointer for its first parameter the connection is to buttonClicked(),
+ otherwise the connection is to finished().
The signal will be disconnected from the slot when the dialog is closed.
*/
diff --git a/src/gui/dialogs/qpagesetupdialog_win.cpp b/src/gui/dialogs/qpagesetupdialog_win.cpp
index 93e38fd..5f49aee 100644
--- a/src/gui/dialogs/qpagesetupdialog_win.cpp
+++ b/src/gui/dialogs/qpagesetupdialog_win.cpp
@@ -78,11 +78,10 @@ int QPageSetupDialog::exec()
psd.lStructSize = sizeof(PAGESETUPDLG);
// we need a temp DEVMODE struct if we don't have a global DEVMODE
- HGLOBAL hDevMode;
- int devModeSize;
+ HGLOBAL hDevMode = 0;
+ int devModeSize = 0;
if (!ep->globalDevMode) {
- QT_WA( { devModeSize = sizeof(DEVMODEW) + ((DEVMODEW *) ep->devMode)->dmDriverExtra; },
- { devModeSize = sizeof(DEVMODEA) + ((DEVMODEA *) ep->devMode)->dmDriverExtra; });
+ devModeSize = sizeof(DEVMODE) + ep->devMode->dmDriverExtra;
hDevMode = GlobalAlloc(GHND, devModeSize);
if (hDevMode) {
void *dest = GlobalLock(hDevMode);
diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp
index e89ce90..115cd8d 100644
--- a/src/gui/dialogs/qprintdialog_win.cpp
+++ b/src/gui/dialogs/qprintdialog_win.cpp
@@ -77,27 +77,18 @@ public:
QWin32PrintEnginePrivate *ep;
};
-#ifndef Q_OS_WINCE
-// If you change this function, make sure you also change the unicode equivalent
-template <class PrintDialog, class DeviceMode>
-static PrintDialog *qt_win_make_PRINTDLG(QWidget *parent,
- QPrintDialog *pdlg,
- QPrintDialogPrivate *d, HGLOBAL *tempDevNames)
+static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent,
+ QPrintDialog *pdlg,
+ QPrintDialogPrivate *d, HGLOBAL *tempDevNames)
{
- PrintDialog *pd = new PrintDialog;
- memset(pd, 0, sizeof(PrintDialog));
- pd->lStructSize = sizeof(PrintDialog);
-
- void *devMode = sizeof(DeviceMode) == sizeof(DEVMODEA)
- ? (void *) d->ep->devModeA()
- : (void *) d->ep->devModeW();
+ DEVMODE *devMode = d->ep->devMode;
if (devMode) {
- int size = sizeof(DeviceMode) + ((DeviceMode *) devMode)->dmDriverExtra;
+ int size = sizeof(DEVMODE) + devMode->dmDriverExtra;
pd->hDevMode = GlobalAlloc(GHND, size);
{
void *dest = GlobalLock(pd->hDevMode);
- memcpy(dest, d->ep->devMode, size);
+ memcpy(dest, devMode, size);
GlobalUnlock(pd->hDevMode);
}
} else {
@@ -130,37 +121,31 @@ static PrintDialog *qt_win_make_PRINTDLG(QWidget *parent,
if (pd->nMinPage==0 && pd->nMaxPage==0)
pd->Flags |= PD_NOPAGENUMS;
+ // we don't have a 'current page' notion in the QPrinter API yet.
+ // Neither do we support more than one page range, so limit those
+ // options
+ pd->Flags |= PD_NOCURRENTPAGE;
+ pd->nStartPage = START_PAGE_GENERAL;
+ pd->nPageRanges = 1;
+ pd->nMaxPageRanges = 1;
+
if (d->ep->printToFile)
pd->Flags |= PD_PRINTTOFILE;
Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
pd->hwndOwner = parent ? parent->winId() : 0;
- pd->nFromPage = qMax(pdlg->fromPage(), pdlg->minPage());
- pd->nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1;
+ pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage());
+ pd->lpPageRanges[0].nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1;
pd->nCopies = d->ep->num_copies;
-
- return pd;
-}
-#endif // Q_OS_WINCE
-
-// If you change this function, make sure you also change the ansi equivalent
-template <typename T>
-static void qt_win_clean_up_PRINTDLG(T **pd)
-{
- delete *pd;
- *pd = 0;
}
-
-// If you change this function, make sure you also change the ansi equivalent
-template <typename T>
-static void qt_win_read_back_PRINTDLG(T *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d)
+static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d)
{
if (pd->Flags & PD_SELECTION) {
pdlg->setPrintRange(QPrintDialog::Selection);
pdlg->setFromTo(0, 0);
} else if (pd->Flags & PD_PAGENUMS) {
pdlg->setPrintRange(QPrintDialog::PageRange);
- pdlg->setFromTo(pd->nFromPage, pd->nToPage);
+ pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage);
} else {
pdlg->setPrintRange(QPrintDialog::AllPages);
pdlg->setFromTo(0, 0);
@@ -234,34 +219,36 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally()
HGLOBAL *tempDevNames = ep->createDevNames();
- bool result;
bool done;
- void *pd = QT_WA_INLINE(
- (void*)(qt_win_make_PRINTDLG<PRINTDLGW, DEVMODEW>(parent, q, this, tempDevNames)),
- (void*)(qt_win_make_PRINTDLG<PRINTDLGA, DEVMODEA>(parent, q, this, tempDevNames))
- );
+ bool result;
+ bool doPrinting;
+
+ PRINTPAGERANGE pageRange;
+ PRINTDLGEX pd;
+ memset(&pd, 0, sizeof(PRINTDLGEX));
+ pd.lStructSize = sizeof(PRINTDLGEX);
+ pd.lpPageRanges = &pageRange;
+ qt_win_setup_PRINTDLGEX(&pd, parent, q, this, tempDevNames);
do {
done = true;
- QT_WA({
- PRINTDLGW *pdw = reinterpret_cast<PRINTDLGW *>(pd);
- result = PrintDlgW(pdw);
- if ((pdw->Flags & PD_PAGENUMS) && (pdw->nFromPage > pdw->nToPage))
- done = false;
- if (result && pdw->hDC == 0)
- result = false;
- else if (!result)
- done = true;
- }, {
- PRINTDLGA *pda = reinterpret_cast<PRINTDLGA *>(pd);
- result = PrintDlgA(pda);
- if ((pda->Flags & PD_PAGENUMS) && (pda->nFromPage > pda->nToPage))
+ doPrinting = false;
+ result = (PrintDlgEx(&pd) == S_OK);
+ if (result && (pd.dwResultAction == PD_RESULT_PRINT
+ || pd.dwResultAction == PD_RESULT_APPLY))
+ {
+ doPrinting = (pd.dwResultAction == PD_RESULT_PRINT);
+ if ((pd.Flags & PD_PAGENUMS)
+ && (pd.lpPageRanges[0].nFromPage > pd.lpPageRanges[0].nToPage))
+ {
+ pd.lpPageRanges[0].nFromPage = 1;
+ pd.lpPageRanges[0].nToPage = 1;
done = false;
- if (result && pda->hDC == 0)
+ }
+ if (pd.hDC == 0)
result = false;
- else if (!result)
- done = true;
- });
+ }
+
if (!done) {
QMessageBox::warning(0, QPrintDialog::tr("Print"),
QPrintDialog::tr("The 'From' value cannot be greater than the 'To' value."),
@@ -274,16 +261,10 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally()
qt_win_eatMouseMove();
// write values back...
- if (result) {
- QT_WA({
- PRINTDLGW *pdw = reinterpret_cast<PRINTDLGW *>(pd);
- qt_win_read_back_PRINTDLG(pdw, q, this);
- qt_win_clean_up_PRINTDLG(&pdw);
- }, {
- PRINTDLGA *pda = reinterpret_cast<PRINTDLGA *>(pd);
- qt_win_read_back_PRINTDLG(pda, q, this);
- qt_win_clean_up_PRINTDLG(&pda);
- });
+ if (result && (pd.dwResultAction == PD_RESULT_PRINT
+ || pd.dwResultAction == PD_RESULT_APPLY))
+ {
+ qt_win_read_back_PRINTDLGEX(&pd, q, this);
// update printer validity
printer->d_func()->validPrinter = !ep->name.isEmpty();
}
@@ -291,9 +272,9 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally()
// Cleanup...
GlobalFree(tempDevNames);
- q->done(result);
+ q->done(result && doPrinting);
- return result;
+ return result && doPrinting;
}
void QPrintDialog::setVisible(bool visible)
diff --git a/src/gui/dialogs/qsidebar.cpp b/src/gui/dialogs/qsidebar.cpp
index 1915e21..e4821ad 100644
--- a/src/gui/dialogs/qsidebar.cpp
+++ b/src/gui/dialogs/qsidebar.cpp
@@ -247,11 +247,16 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move)
QUrl url = list.at(i);
if (!url.isValid() || url.scheme() != QLatin1String("file"))
continue;
+ //this makes sure the url is clean
+ const QString cleanUrl = QDir::cleanPath(url.toLocalFile());
+ url = QUrl::fromLocalFile(cleanUrl);
+
for (int j = 0; move && j < rowCount(); ++j) {
+ QString local = index(j, 0).data(UrlRole).toUrl().toLocalFile();
#if defined(Q_OS_WIN)
- if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()).toLower() == QDir::cleanPath(url.toLocalFile()).toLower()) {
+ if (index(j, 0).data(UrlRole).toUrl().toLocalFile().toLower() == cleanUrl.toLower()) {
#else
- if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()) == QDir::cleanPath(url.toLocalFile())) {
+ if (index(j, 0).data(UrlRole).toUrl().toLocalFile() == cleanUrl) {
#endif
removeRow(j);
if (j <= row)
@@ -260,12 +265,12 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move)
}
}
row = qMax(row, 0);
- QModelIndex idx = fileSystemModel->index(url.toLocalFile());
+ QModelIndex idx = fileSystemModel->index(cleanUrl);
if (!fileSystemModel->isDir(idx))
continue;
insertRows(row, 1);
setUrl(index(row, 0), url, idx);
- watching.append(QPair<QModelIndex, QString>(idx, url.toLocalFile()));
+ watching.append(qMakePair(idx, cleanUrl));
}
}
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index 5365889..345c0f7 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -343,8 +343,8 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
{
bool modern = ((info.wizStyle == QWizard::ModernStyle)
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
- || ((info.wizStyle == QWizard::AeroStyle)
- && (QVistaHelper::vistaState() == QVistaHelper::Classic) || vistaDisabled())
+ || ((info.wizStyle == QWizard::AeroStyle
+ && QVistaHelper::vistaState() == QVistaHelper::Classic) || vistaDisabled())
#endif
);
@@ -1251,13 +1251,7 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info)
extraHeight = vistaHelper->titleBarSize() + vistaHelper->topOffset();
#endif
QSize minimumSize = mainLayout->totalMinimumSize() + QSize(0, extraHeight);
- QSize maximumSize;
- bool skipMaxSize = false;
-#if defined(Q_WS_WIN)
- if (QSysInfo::WindowsVersion <= QSysInfo::WV_Me) // ### See Tasks 164078 and 161660
- skipMaxSize = true;
-#endif
- maximumSize = mainLayout->totalMaximumSize();
+ QSize maximumSize = mainLayout->totalMaximumSize();
if (info.header && headerWidget->maximumWidth() != QWIDGETSIZE_MAX) {
minimumSize.setWidth(headerWidget->maximumWidth());
maximumSize.setWidth(headerWidget->maximumWidth());
@@ -1276,13 +1270,11 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info)
}
if (q->maximumWidth() == maximumWidth) {
maximumWidth = maximumSize.width();
- if (!skipMaxSize)
- q->setMaximumWidth(maximumWidth);
+ q->setMaximumWidth(maximumWidth);
}
if (q->maximumHeight() == maximumHeight) {
maximumHeight = maximumSize.height();
- if (!skipMaxSize)
- q->setMaximumHeight(maximumHeight);
+ q->setMaximumHeight(maximumHeight);
}
}
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index 840149b..1def47f 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -616,7 +616,7 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
// Set up a memory DC and bitmap that we'll draw into
HDC dcMem;
HBITMAP bmp;
- BITMAPINFO dib = {0};
+ BITMAPINFO dib = {{0}};
dcMem = CreateCompatibleDC(hdc);
dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@@ -662,7 +662,7 @@ bool QVistaHelper::drawBlackRect(const QRect &rect, HDC hdc)
// Set up a memory DC and bitmap that we'll draw into
HDC dcMem;
HBITMAP bmp;
- BITMAPINFO dib = {0};
+ BITMAPINFO dib = {{0}};
dcMem = CreateCompatibleDC(hdc);
dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h
index d3410d0..18a7531 100644
--- a/src/gui/dialogs/qwizard_win_p.h
+++ b/src/gui/dialogs/qwizard_win_p.h
@@ -56,7 +56,7 @@
#ifndef QT_NO_WIZARD
#ifndef QT_NO_STYLE_WINDOWSVISTA
-#include <windows.h>
+#include <qt_windows.h>
#include <qobject.h>
#include <qwidget.h>
#include <qabstractbutton.h>
diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri
index 4a9aa3f..53a2512 100644
--- a/src/gui/embedded/embedded.pri
+++ b/src/gui/embedded/embedded.pri
@@ -141,15 +141,7 @@ embedded {
!contains( kbd-drivers, qvfb ) {
kbd-drivers += qvfb
}
- }
-
- contains( kbd-drivers, sl5000 ) {
- HEADERS +=embedded/qkbdsl5000_qws.h
- SOURCES +=embedded/qkbdsl5000_qws.cpp
- !contains( kbd-drivers, tty ) {
- kbd-drivers += tty
- }
- }
+ }
contains( kbd-drivers, tty ) {
HEADERS +=embedded/qkbdtty_qws.h
@@ -166,16 +158,6 @@ embedded {
SOURCES +=embedded/qkbdum_qws.cpp
}
- contains( kbd-drivers, yopy ) {
- HEADERS +=embedded/qkbdyopy_qws.h
- SOURCES +=embedded/qkbdyopy_qws.cpp
- }
-
- contains( kbd-drivers, vr41xx ) {
- HEADERS +=embedded/qkbdvr41xx_qws.h
- SOURCES +=embedded/qkbdvr41xx_qws.cpp
- }
-
#
# Mouse drivers
#
@@ -189,29 +171,19 @@ embedded {
SOURCES +=embedded/qmousepc_qws.cpp
}
- contains( mouse-drivers, bus ) {
- HEADERS +=embedded/qmousebus_qws.h
- SOURCES +=embedded/qmousebus_qws.cpp
- }
-
contains( mouse-drivers, linuxtp ) {
HEADERS +=embedded/qmouselinuxtp_qws.h
SOURCES +=embedded/qmouselinuxtp_qws.cpp
}
- contains( mouse-drivers, vr41xx ) {
- HEADERS +=embedded/qmousevr41xx_qws.h
- SOURCES +=embedded/qmousevr41xx_qws.cpp
- }
-
- contains( mouse-drivers, yopy ) {
- HEADERS +=embedded/qmouseyopy_qws.h
- SOURCES +=embedded/qmouseyopy_qws.cpp
- }
-
contains( mouse-drivers, tslib ) {
LIBS += -lts
HEADERS +=embedded/qmousetslib_qws.h
SOURCES +=embedded/qmousetslib_qws.cpp
}
+
+ contains( mouse-drivers, linuxinput ) {
+ HEADERS +=embedded/qmouselinuxinput_qws.h
+ SOURCES +=embedded/qmouselinuxinput_qws.cpp
+ }
}
diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp
index 7799339..756a398 100644
--- a/src/gui/embedded/qkbd_qws.cpp
+++ b/src/gui/embedded/qkbd_qws.cpp
@@ -453,8 +453,9 @@ void QWSKeyboardHandler::endAutoRepeat()
Maps \a keycode according to a keymap and sends that key event to the
\l{Qt for Embedded Linux} server application.
- Please see the QWS_KEYBOARD documentation for a description on how to
- create and use keymap files.
+ Please see the \l{Qt for Embedded Linux Character Input} and the \l
+ {kmap2qmap} documentations for a description on how to create and use
+ keymap files.
The key event is identified by its \a keycode value and the \a isPress
and \a autoRepeat parameters.
@@ -475,9 +476,6 @@ void QWSKeyboardHandler::endAutoRepeat()
implementation needs to take care of a special action, like console
switching or LED handling.
- Standard Linux console keymaps can be found at the
- \l {http://lct.sourceforege.net}{LCT project}
-
If standard Linux console keymaps are used, \a keycode must be one of the
standardized values defined in \c /usr/include/linux/input.h
diff --git a/src/gui/embedded/qkbddriverfactory_qws.cpp b/src/gui/embedded/qkbddriverfactory_qws.cpp
index c599396..b77eb72 100644
--- a/src/gui/embedded/qkbddriverfactory_qws.cpp
+++ b/src/gui/embedded/qkbddriverfactory_qws.cpp
@@ -47,10 +47,7 @@
#include "qkbdtty_qws.h"
#include "qkbdlinuxinput_qws.h"
#include "qkbdum_qws.h"
-#include "qkbdsl5000_qws.h"
#include "qkbdvfb_qws.h"
-#include "qkbdyopy_qws.h"
-#include "qkbdvr41xx_qws.h"
#include <stdlib.h>
#include "private/qfactoryloader_p.h"
#include "qkbddriverplugin_qws.h"
@@ -104,18 +101,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
QWSKeyboardHandler *QKbdDriverFactory::create(const QString& key, const QString& device)
{
QString driver = key.toLower();
-#ifndef QT_NO_QWS_KBD_SL5000
- if (driver == QLatin1String("sl5000") || driver.isEmpty())
- return new QWSSL5000KeyboardHandler(device);
-#endif
-#ifndef QT_NO_QWS_KBD_YOPY
- if (driver == QLatin1String("yopy") || driver.isEmpty())
- return new QWSYopyKeyboardHandler(device);
-#endif
-#ifndef QT_NO_QWS_KBD_VR41XX
- if (driver == QLatin1String("vr41xx") || driver.isEmpty())
- return new QWSVr41xxKeyboardHandler(device);
-#endif
#ifndef QT_NO_QWS_KEYBOARD
# ifndef QT_NO_QWS_KBD_TTY
if (driver == QLatin1String("tty") || driver.isEmpty())
@@ -158,15 +143,6 @@ QStringList QKbdDriverFactory::keys()
{
QStringList list;
-#ifndef QT_NO_QWS_KBD_SL5000
- list << QLatin1String("SL5000");
-#endif
-#ifndef QT_NO_QWS_KBD_YOPY
- list << QLatin1String("YOPY");
-#endif
-#ifndef QT_NO_QWS_KBD_VR41XX
- list << QLatin1String("VR41xx");
-#endif
#ifndef QT_NO_QWS_KBD_TTY
list << QLatin1String("TTY");
#endif
diff --git a/src/gui/embedded/qkbdlinuxinput_qws.cpp b/src/gui/embedded/qkbdlinuxinput_qws.cpp
index d5720f7..6aa6633 100644
--- a/src/gui/embedded/qkbdlinuxinput_qws.cpp
+++ b/src/gui/embedded/qkbdlinuxinput_qws.cpp
@@ -47,6 +47,7 @@
#include <QStringList>
#include <qplatformdefs.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <errno.h>
#include <termios.h>
@@ -75,6 +76,7 @@ private:
int m_fd;
int m_tty_fd;
struct termios m_tty_attr;
+ int m_orig_kbmode;
};
QWSLinuxInputKeyboardHandler::QWSLinuxInputKeyboardHandler(const QString &device)
@@ -94,8 +96,7 @@ bool QWSLinuxInputKeyboardHandler::filterInputEvent(quint16 &, qint32 &)
}
QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h, const QString &device)
- : m_handler(h), m_fd(-1), m_tty_fd(-1)
-
+ : m_handler(h), m_fd(-1), m_tty_fd(-1), m_orig_kbmode(K_XLATE)
{
setObjectName(QLatin1String("LinuxInputSubsystem Keyboard Handler"));
@@ -134,7 +135,10 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h,
struct ::termios termdata;
tcgetattr(m_tty_fd, &termdata);
- // setting this tranlation mode is also needed in INPUT mode to prevent
+ // record the original mode so we can restore it again in the destructor.
+ ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
+
+ // setting this tranlation mode is even needed in INPUT mode to prevent
// the shell from also interpreting codes, if the process has a tty
// attached: e.g. Ctrl+C wouldn't copy, but kill the application.
::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
@@ -151,7 +155,7 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h,
tcsetattr(m_tty_fd, TCSANOW, &termdata);
}
} else {
- qWarning("Cannot open input device '%s': %s", qPrintable(dev), strerror(errno));
+ qWarning("Cannot open keyboard input device '%s': %s", qPrintable(dev), strerror(errno));
return;
}
}
@@ -159,7 +163,7 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h,
QWSLinuxInputKbPrivate::~QWSLinuxInputKbPrivate()
{
if (m_tty_fd >= 0) {
- ::ioctl(m_tty_fd, KDSKBMODE, K_XLATE);
+ ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
}
if (m_fd >= 0)
diff --git a/src/gui/embedded/qkbdsl5000_qws.cpp b/src/gui/embedded/qkbdsl5000_qws.cpp
deleted file mode 100644
index 36cb903..0000000
--- a/src/gui/embedded/qkbdsl5000_qws.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdsl5000_qws.h"
-
-#ifndef QT_NO_QWS_KBD_SL5000
-
-#include "qwindowsystem_qws.h"
-#include "qwsutils_qws.h"
-#include "qscreen_qws.h"
-
-#include "qapplication.h"
-#include "qnamespace.h"
-#include "qtimer.h"
-
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-
-#include <asm/sharp_char.h>
-
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-static const QWSKeyMap sl5000KeyMap[] = {
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 00
- { Qt::Key_A, 'a' , 'A' , 'A'-64 }, // 01
- { Qt::Key_B, 'b' , 'B' , 'B'-64 }, // 02
- { Qt::Key_C, 'c' , 'C' , 'C'-64 }, // 03
- { Qt::Key_D, 'd' , 'D' , 'D'-64 }, // 04
- { Qt::Key_E, 'e' , 'E' , 'E'-64 }, // 05
- { Qt::Key_F, 'f' , 'F' , 'F'-64 }, // 06
- { Qt::Key_G, 'g' , 'G' , 'G'-64 }, // 07
- { Qt::Key_H, 'h' , 'H' , 'H'-64 }, // 08
- { Qt::Key_I, 'i' , 'I' , 'I'-64 }, // 09
- { Qt::Key_J, 'j' , 'J' , 'J'-64 }, // 0a 10
- { Qt::Key_K, 'k' , 'K' , 'K'-64 }, // 0b
- { Qt::Key_L, 'l' , 'L' , 'L'-64 }, // 0c
- { Qt::Key_M, 'm' , 'M' , 'M'-64 }, // 0d
- { Qt::Key_N, 'n' , 'N' , 'N'-64 }, // 0e
- { Qt::Key_O, 'o' , 'O' , 'O'-64 }, // 0f
- { Qt::Key_P, 'p' , 'P' , 'P'-64 }, // 10
- { Qt::Key_Q, 'q' , 'Q' , 'Q'-64 }, // 11
- { Qt::Key_R, 'r' , 'R' , 'R'-64 }, // 12
- { Qt::Key_S, 's' , 'S' , 'S'-64 }, // 13
- { Qt::Key_T, 't' , 'T' , 'T'-64 }, // 14 20
- { Qt::Key_U, 'u' , 'U' , 'U'-64 }, // 15
- { Qt::Key_V, 'v' , 'V' , 'V'-64 }, // 16
- { Qt::Key_W, 'w' , 'W' , 'W'-64 }, // 17
- { Qt::Key_X, 'x' , 'X' , 'X'-64 }, // 18
- { Qt::Key_Y, 'y' , 'Y' , 'Y'-64 }, // 19
- { Qt::Key_Z, 'z' , 'Z' , 'Z'-64 }, // 1a
- { Qt::Key_Shift, 0xffff , 0xffff , 0xffff }, // 1b
- { Qt::Key_Return, 13 , 13 , 0xffff }, // 1c
- { Qt::Key_F11, 0xffff , 0xffff , 0xffff }, // 1d todo
- { Qt::Key_F22, 0xffff , 0xffff , 0xffff }, // 1e 30
- { Qt::Key_Backspace, 8 , 8 , 0xffff }, // 1f
- { Qt::Key_F31, 0xffff , 0xffff , 0xffff }, // 20
- { Qt::Key_F35, 0xffff , 0xffff , 0xffff }, // 21 light
- { Qt::Key_Escape, 0xffff , 0xffff , 0xffff }, // 22
-
- // Direction key code are for *UNROTATED* display.
- { Qt::Key_Up, 0xffff , 0xffff , 0xffff }, // 23
- { Qt::Key_Right, 0xffff , 0xffff , 0xffff }, // 24
- { Qt::Key_Left, 0xffff , 0xffff , 0xffff }, // 25
- { Qt::Key_Down, 0xffff , 0xffff , 0xffff }, // 26
-
- { Qt::Key_F33, 0xffff , 0xffff , 0xffff }, // 27 OK
- { Qt::Key_F12, 0xffff , 0xffff , 0xffff }, // 28 40 home
- { Qt::Key_1, '1' , 'q' , 'Q'-64 }, // 29
- { Qt::Key_2, '2' , 'w' , 'W'-64 }, // 2a
- { Qt::Key_3, '3' , 'e' , 'E'-64 }, // 2b
- { Qt::Key_4, '4' , 'r' , 'R'-64 }, // 2c
- { Qt::Key_5, '5' , 't' , 'T'-64 }, // 2d
- { Qt::Key_6, '6' , 'y' , 'Y'-64 }, // 2e
- { Qt::Key_7, '7' , 'u' , 'U'-64 }, // 2f
- { Qt::Key_8, '8' , 'i' , 'I'-64 }, // 30
- { Qt::Key_9, '9' , 'o' , 'O'-64 }, // 31
- { Qt::Key_0, '0' , 'p' , 'P'-64 }, // 32 50
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 33
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 34
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 35
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 36
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 37
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 38
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 39
- { Qt::Key_Minus, '-' , 'b' , 'B'-64 }, // 3a
- { Qt::Key_Plus, '+' , 'n' , 'N'-64 }, // 3b
- { Qt::Key_CapsLock, 0xffff , 0xffff , 0xffff }, // 3c 60
- { Qt::Key_At, '@' , 's' , 'S'-64 }, // 3d
- { Qt::Key_Question, '?' , '?' , 0xffff }, // 3e
- { Qt::Key_Comma, ',' , ',' , 0xffff }, // 3f
- { Qt::Key_Period, '.' , '.' , 0xffff }, // 40
- { Qt::Key_Tab, 9 , '\\' , 0xffff }, // 41
- { Qt::Key_X, 0xffff , 'x' , 'X'-64 }, // 42
- { Qt::Key_C, 0xffff , 'c' , 'C'-64 }, // 43
- { Qt::Key_V, 0xffff , 'v' , 'V'-64 }, // 44
- { Qt::Key_Slash, '/' , '/' , 0xffff }, // 45
- { Qt::Key_Apostrophe, '\'' , '\'' , 0xffff }, // 46 70
- { Qt::Key_Semicolon, ';' , ';' , 0xffff }, // 47
- { Qt::Key_QuoteDbl, '\"' , '\"' , 0xffff }, // 48
- { Qt::Key_Colon, ':' , ':' , 0xffff }, // 49
- { Qt::Key_NumberSign, '#' , 'd' , 'D'-64 }, // 4a
- { Qt::Key_Dollar, '$' , 'f' , 'F'-64 }, // 4b
- { Qt::Key_Percent, '%' , 'g' , 'G'-64 }, // 4c
- { Qt::Key_Underscore, '_' , 'h' , 'H'-64 }, // 4d
- { Qt::Key_Ampersand, '&' , 'j' , 'J'-64 }, // 4e
- { Qt::Key_Asterisk, '*' , 'k' , 'K'-64 }, // 4f
- { Qt::Key_ParenLeft, '(' , 'l' , 'L'-64 }, // 50 80
- { Qt::Key_Delete, '[' , '[' , '[' }, // 51
- { Qt::Key_Z, 0xffff , 'z' , 'Z'-64 }, // 52
- { Qt::Key_Equal, '=' , 'm' , 'M'-64 }, // 53
- { Qt::Key_ParenRight, ')' , ']' , ']' }, // 54
- { Qt::Key_AsciiTilde, '~' , '^' , '^' }, // 55
- { Qt::Key_Less, '<' , '{' , '{' }, // 56
- { Qt::Key_Greater, '>' , '}' , '}' }, // 57
- { Qt::Key_F9, 0xffff , 0xffff , 0xffff }, // 58 datebook
- { Qt::Key_F10, 0xffff , 0xffff , 0xffff }, // 59 address
- { Qt::Key_F13, 0xffff , 0xffff , 0xffff }, // 5a 90 email
- { Qt::Key_F30, ' ' , ' ' , 0xffff }, // 5b select
- { Qt::Key_Space, ' ' , '|' , '`' }, // 5c
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 5d
- { Qt::Key_Exclam, '!' , 'a' , 'A'-64 }, // 5e
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 5f
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 60
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 61
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 62
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 63
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 64
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 65
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 66
- { Qt::Key_Meta, 0xffff , 0xffff , 0xffff }, // 67
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 68
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 69
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6a
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6b
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6c
- { Qt::Key_F34, 0xffff , 0xffff , 0xffff }, // 6d power
- { Qt::Key_F13, 0xffff , 0xffff , 0xffff }, // 6e mail long
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6f
- { Qt::Key_NumLock, 0xffff , 0xffff , 0xffff }, // 70
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 71
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 72
- { 0x20ac, 0xffff , 0x20ac , 0x20ac }, // 73 Euro sign
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 74
- { Qt::Key_F32, 0xffff , 0xffff , 0xffff }, // 75 Sync
- { 0, 0xffff , 0xffff , 0xffff }
-};
-
-static const int keyMSize = sizeof(sl5000KeyMap)/sizeof(QWSKeyMap)-1;
-
-QWSSL5000KeyboardHandler::QWSSL5000KeyboardHandler(const QString &device)
- : QWSTtyKeyboardHandler(device)
-{
- shift = false;
- alt = false;
- ctrl = false;
- extended = 0;
- prevuni = 0;
- prevkey = 0;
- caps = false;
- meta = false;
- fn = false;
- numLock = false;
-
- sharp_kbdctl_modifstat st;
- int dev = ::open(device.isEmpty()?"/dev/sharp_kbdctl":device.toLocal8Bit().constData(), O_RDWR);
- if (dev >= 0) {
- memset(&st, 0, sizeof(st));
- st.which = 3;
- int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st);
- if(!ret)
- numLock = (bool)st.stat;
- ::close(dev);
- }
-}
-
-QWSSL5000KeyboardHandler::~QWSSL5000KeyboardHandler()
-{
-}
-
-const QWSKeyMap *QWSSL5000KeyboardHandler::keyMap() const
-{
- return sl5000KeyMap;
-}
-
-bool QWSSL5000KeyboardHandler::filterKeycode(char &code)
-{
- int keyCode = Qt::Key_unknown;
- bool release = false;
-
- if (code & 0x80) {
- release = true;
- code &= 0x7f;
- }
-
- if (fn && !meta && (code >= 0x42 && code <= 0x52)) {
- ushort unicode=0;
- int scan=0;
- if (code == 0x42) { unicode='X'-'@'; scan=Qt::Key_X; } // Cut
- else if (code == 0x43) { unicode='C'-'@'; scan=Qt::Key_C; } // Copy
- else if (code == 0x44) { unicode='V'-'@'; scan=Qt::Key_V; } // Paste
- else if (code == 0x52) { unicode='Z'-'@'; scan=Qt::Key_Z; } // Undo
- if (scan) {
- processKeyEvent(unicode, scan, Qt::ControlModifier, !release, false);
- return true;
- }
- }
-
- if (code < keyMSize) {
- keyCode = keyMap()[int(code)].key_code;
- }
-
- bool repeatable = true;
-
- if (release && (keyCode == Qt::Key_F34 || keyCode == Qt::Key_F35))
- return true; // no release for power and light keys
- if ((keyCode >= Qt::Key_F1 && keyCode <= Qt::Key_F35)
- || keyCode == Qt::Key_Escape || keyCode == Qt::Key_Home
- || keyCode == Qt::Key_Shift || keyCode == Qt::Key_Meta)
- repeatable = false;
-
- if (qt_screen->isTransformed()
- && keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down)
- {
- keyCode = transformDirKey(keyCode);
- }
-
- // Ctrl-Alt-Delete exits qws
- if (ctrl && alt && keyCode == Qt::Key_Delete) {
- qApp->quit();
- }
-
- if (keyCode == Qt::Key_F22) { /* Fn key */
- fn = !release;
- } else if (keyCode == Qt::Key_NumLock) {
- if (release)
- numLock = !numLock;
- } else if (keyCode == Qt::AltModifier) {
- alt = !release;
- } else if (keyCode == Qt::ControlModifier) {
- ctrl = !release;
- } else if (keyCode == Qt::ShiftModifier) {
- shift = !release;
- } else if (keyCode == Qt::MetaModifier) {
- meta = !release;
- } else if (keyCode == Qt::Key_CapsLock && release) {
- caps = !caps;
- }
- if (keyCode != Qt::Key_unknown) {
- bool bAlt = alt;
- bool bCtrl = ctrl;
- bool bShift = shift;
- int unicode = 0;
- if (code < keyMSize) {
- bool bCaps = caps ^ shift;
- if (fn) {
- if (shift) {
- bCaps = bShift = false;
- bCtrl = true;
- }
- if (meta) {
- bCaps = bShift = true;
- bAlt = true;
- }
- } else if (meta) {
- bCaps = bShift = true;
- }
- if (code > 40 && caps) {
- // fn-keys should only react to shift, not caps
- bCaps = bShift = shift;
- }
- if (numLock) {
- if (keyCode != Qt::Key_Space && keyCode != Qt::Key_Tab)
- bCaps = bShift = false;
- }
- if (keyCode == Qt::Key_Delete && (bAlt || bCtrl)) {
- keyCode = Qt::Key_BraceLeft;
- unicode = '[';
- bCaps = bShift = bAlt = bCtrl = false;
- } else if (keyCode == Qt::Key_F31 && bCtrl) {
- keyCode = Qt::Key_QuoteLeft;
- unicode = '`';
- } else if (bCtrl)
- unicode = keyMap()[int(code)].ctrl_unicode ? keyMap()[int(code)].ctrl_unicode : 0xffff;
- else if (bCaps)
- unicode = keyMap()[int(code)].shift_unicode ? keyMap()[int(code)].shift_unicode : 0xffff;
- else
- unicode = keyMap()[int(code)].unicode ? keyMap()[int(code)].unicode : 0xffff;
- }
-
- modifiers = 0;
- if (bAlt) modifiers |= Qt::AltModifier;
- if (bCtrl) modifiers |= Qt::ControlModifier;
- if (bShift) modifiers |= Qt::ShiftModifier;
-
- // looks wrong -- WWA
- bool repeat = false;
- if (prevuni == unicode && prevkey == keyCode && !release)
- repeat = true;
-
- processKeyEvent(unicode, keyCode, modifiers, !release, repeat);
-
- if (!release) {
- prevuni = unicode;
- prevkey = keyCode;
- } else {
- prevkey = prevuni = 0;
- }
- }
-
- if (repeatable && !release)
- beginAutoRepeat(prevuni, prevkey, modifiers);
- else
- endAutoRepeat();
-
- return true;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_KBD_SL5000
diff --git a/src/gui/embedded/qkbdtty_qws.cpp b/src/gui/embedded/qkbdtty_qws.cpp
index 33777eb..f107567 100644
--- a/src/gui/embedded/qkbdtty_qws.cpp
+++ b/src/gui/embedded/qkbdtty_qws.cpp
@@ -47,6 +47,7 @@
#include <QStringList>
#include <qplatformdefs.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <errno.h>
#include <termios.h>
@@ -89,7 +90,7 @@ private:
struct termios m_tty_attr;
char m_last_keycode;
int m_vt_qws;
- int m_originalKbdMode;
+ int m_orig_kbmode;
};
@@ -110,7 +111,7 @@ bool QWSTtyKeyboardHandler::filterKeycode(char &)
}
QWSTtyKbPrivate::QWSTtyKbPrivate(QWSTtyKeyboardHandler *h, const QString &device)
- : m_handler(h), m_tty_fd(-1), m_last_keycode(0), m_vt_qws(0)
+ : m_handler(h), m_tty_fd(-1), m_last_keycode(0), m_vt_qws(0), m_orig_kbmode(K_XLATE)
{
setObjectName(QLatin1String("TTY Keyboard Handler"));
#ifndef QT_NO_QWS_SIGNALHANDLER
@@ -151,15 +152,15 @@ QWSTtyKbPrivate::QWSTtyKbPrivate(QWSTtyKeyboardHandler *h, const QString &device
tcgetattr(m_tty_fd, &termdata);
#if defined(Q_OS_LINUX)
- // record the original mode so we can restore it again in the constructor
- ::ioctl(m_tty_fd, KDGKBMODE, m_originalKbdMode);
+ // record the original mode so we can restore it again in the destructor.
+ ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
// PLEASE NOTE:
- // The tty keycode interface can only report keycodes 0x01 .. 0x7f
+ // the tty keycode interface can only report keycodes 0x01 .. 0x7f
// KEY_MAX is however defined to 0x1ff. In practice this is sufficient
// for a PC style keyboard though.
- // we don't support K_RAW anymore - if you need, you habe to add a
- // scan- to keycode converter.
+ // we don't support K_RAW anymore - if you need that, you have to add
+ // a scan- to keycode converter yourself.
::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
#endif
@@ -210,9 +211,10 @@ QWSTtyKbPrivate::~QWSTtyKbPrivate()
{
if (m_tty_fd >= 0) {
#if defined(Q_OS_LINUX)
- ::ioctl(m_tty_fd, KDSKBMODE, m_originalKbdMode);
+ ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
#endif
tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
+ QT_CLOSE(m_tty_fd);
}
}
diff --git a/src/gui/embedded/qkbdvfb_qws.cpp b/src/gui/embedded/qkbdvfb_qws.cpp
index 082aac1..a44183b 100644
--- a/src/gui/embedded/qkbdvfb_qws.cpp
+++ b/src/gui/embedded/qkbdvfb_qws.cpp
@@ -55,6 +55,7 @@
#include <qwindowsystem_qws.h>
#include <qsocketnotifier.h>
#include <qapplication.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
QT_BEGIN_NAMESPACE
@@ -69,13 +70,13 @@ QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device)
kbdBufferLen = sizeof(QVFbKeyData) * 5;
kbdBuffer = new unsigned char [kbdBufferLen];
- if ((kbdFD = open(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
+ if ((kbdFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
qWarning("Cannot open %s (%s)", terminalName.toLatin1().constData(),
strerror(errno));
} else {
// Clear pending input
char buf[2];
- while (read(kbdFD, buf, 1) > 0) { }
+ while (QT_READ(kbdFD, buf, 1) > 0) { }
notifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this);
connect(notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData()));
@@ -85,7 +86,7 @@ QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device)
QVFbKeyboardHandler::~QVFbKeyboardHandler()
{
if (kbdFD >= 0)
- close(kbdFD);
+ QT_CLOSE(kbdFD);
delete [] kbdBuffer;
}
@@ -94,7 +95,7 @@ void QVFbKeyboardHandler::readKeyboardData()
{
int n;
do {
- n = read(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
+ n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
if (n > 0)
kbdIdx += n;
} while (n > 0);
diff --git a/src/gui/embedded/qkbdvr41xx_qws.cpp b/src/gui/embedded/qkbdvr41xx_qws.cpp
deleted file mode 100644
index 03c2a67..0000000
--- a/src/gui/embedded/qkbdvr41xx_qws.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdvr41xx_qws.h"
-
-#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_VR41XX)
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <termios.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <qsocketnotifier.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSVr41xxKbPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSVr41xxKbPrivate(QWSVr41xxKeyboardHandler *h, const QString&);
- virtual ~QWSVr41xxKbPrivate();
-
- bool isOpen() { return buttonFD > 0; }
-
-private slots:
- void readKeyboardData();
-
-private:
- QString terminalName;
- int buttonFD;
- int kbdIdx;
- int kbdBufferLen;
- unsigned char *kbdBuffer;
- QSocketNotifier *notifier;
- QWSVr41xxKeyboardHandler *handler;
-};
-
-QWSVr41xxKeyboardHandler::QWSVr41xxKeyboardHandler(const QString &device)
-{
- d = new QWSVr41xxKbPrivate(this, device);
-}
-
-QWSVr41xxKeyboardHandler::~QWSVr41xxKeyboardHandler()
-{
- delete d;
-}
-
-QWSVr41xxKbPrivate::QWSVr41xxKbPrivate(QWSVr41xxKeyboardHandler *h, const QString &device) : handler(h)
-{
- terminalName = device;
- if (terminalName.isEmpty())
- terminalName = QLatin1String("/dev/buttons");
- buttonFD = -1;
- notifier = 0;
-
- buttonFD = open(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0);;
- if (buttonFD < 0) {
- qWarning("Cannot open %s\n", qPrintable(terminalName));
- return;
- }
-
- if (buttonFD >= 0) {
- notifier = new QSocketNotifier(buttonFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)),this,
- SLOT(readKeyboardData()));
- }
-
- kbdBufferLen = 80;
- kbdBuffer = new unsigned char [kbdBufferLen];
- kbdIdx = 0;
-}
-
-QWSVr41xxKbPrivate::~QWSVr41xxKbPrivate()
-{
- if (buttonFD > 0) {
- ::close(buttonFD);
- buttonFD = -1;
- }
- delete notifier;
- notifier = 0;
- delete [] kbdBuffer;
-}
-
-void QWSVr41xxKbPrivate::readKeyboardData()
-{
- int n = 0;
- do {
- n = read(buttonFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
- if (n > 0)
- kbdIdx += n;
- } while (n > 0);
-
- int idx = 0;
- while (kbdIdx - idx >= 2) {
- unsigned char *next = kbdBuffer + idx;
- unsigned short *code = (unsigned short *)next;
- int keycode = Qt::Key_unknown;
- switch ((*code) & 0x0fff) {
- case 0x7:
- keycode = Qt::Key_Up;
- break;
- case 0x9:
- keycode = Qt::Key_Right;
- break;
- case 0x8:
- keycode = Qt::Key_Down;
- break;
- case 0xa:
- keycode = Qt::Key_Left;
- break;
- case 0x3:
- keycode = Qt::Key_Up;
- break;
- case 0x4:
- keycode = Qt::Key_Down;
- break;
- case 0x1:
- keycode = Qt::Key_Return;
- break;
- case 0x2:
- keycode = Qt::Key_F4;
- break;
- default:
- qDebug("Unrecognised key sequence %d", *code);
- }
- if ((*code) & 0x8000)
- handler->processKeyEvent(0, keycode, 0, false, false);
- else
- handler->processKeyEvent(0, keycode, 0, true, false);
- idx += 2;
- }
-
- int surplus = kbdIdx - idx;
- for (int i = 0; i < surplus; i++)
- kbdBuffer[i] = kbdBuffer[idx+i];
- kbdIdx = surplus;
-}
-
-QT_END_NAMESPACE
-
-#include "qkbdvr41xx_qws.moc"
-
-#endif // QT_NO_QWS_KBD_VR41XX
diff --git a/src/gui/embedded/qkbdyopy_qws.cpp b/src/gui/embedded/qkbdyopy_qws.cpp
deleted file mode 100644
index 5c9d28d..0000000
--- a/src/gui/embedded/qkbdyopy_qws.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- * YOPY buttons driver
- * Contributed by Ron Victorelli (victorrj at icubed.com)
- */
-
-#include "qkbdyopy_qws.h"
-
-#ifndef QT_NO_QWS_KBD_YOPY
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <termios.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <linux/kd.h>
-#include <linux/fb.h>
-#include <linux/yopy_button.h>
-
-extern "C" {
- int getpgid(int);
-}
-
-#include <qwidget.h>
-#include <qsocketnotifier.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSYopyKbPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSYopyKbPrivate(QWSYopyKeyboardHandler *h, const QString&);
- virtual ~QWSYopyKbPrivate();
-
- bool isOpen() { return buttonFD > 0; }
-
-private slots:
- void readKeyboardData();
-
-private:
- QString terminalName;
- int buttonFD;
- struct termios newT, oldT;
- QSocketNotifier *notifier;
- QWSYopyKeyboardHandler *handler;
-};
-
-QWSYopyKeyboardHandler::QWSYopyKeyboardHandler(const QString &device)
-{
- d = new QWSYopyKbPrivate(this, device);
-}
-
-QWSYopyKeyboardHandler::~QWSYopyKeyboardHandler()
-{
- delete d;
-}
-
-QWSYopyKbPrivate::QWSYopyKbPrivate(QWSYopyKeyboardHandler *h, const QString &device) : handler(h)
-{
- terminalName = device.isEmpty()?"/dev/tty1":device.toLatin1().constData();
- buttonFD = -1;
- notifier = 0;
-
- buttonFD = ::open(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0);
- if (buttonFD < 0) {
- qWarning("Cannot open %s\n", qPrintable(terminalName));
- return;
- } else {
-
- tcsetpgrp(buttonFD, getpgid(0));
-
- /* put tty into "straight through" mode.
- */
- if (tcgetattr(buttonFD, &oldT) < 0) {
- qFatal("Linux-kbd: tcgetattr failed");
- }
-
- newT = oldT;
- newT.c_lflag &= ~(ICANON | ECHO | ISIG);
- newT.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON);
- newT.c_iflag |= IGNBRK;
- newT.c_cc[VMIN] = 0;
- newT.c_cc[VTIME] = 0;
-
-
- if (tcsetattr(buttonFD, TCSANOW, &newT) < 0) {
- qFatal("Linux-kbd: TCSANOW tcsetattr failed");
- }
-
- if (ioctl(buttonFD, KDSKBMODE, K_MEDIUMRAW) < 0) {
- qFatal("Linux-kbd: KDSKBMODE tcsetattr failed");
- }
-
- notifier = new QSocketNotifier(buttonFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)),this,
- SLOT(readKeyboardData()));
- }
-}
-
-QWSYopyKbPrivate::~QWSYopyKbPrivate()
-{
- if (buttonFD > 0) {
- ::close(buttonFD);
- buttonFD = -1;
- }
-}
-
-void QWSYopyKbPrivate::readKeyboardData()
-{
- uchar buf[1];
- char c='1';
- int fd;
-
- int n=read(buttonFD,buf,1);
- if (n<0) {
- qDebug("Keyboard read error %s",strerror(errno));
- } else {
- uint code = buf[0]&YPBUTTON_CODE_MASK;
- bool press = !(buf[0]&0x80);
- // printf("Key=%d/%d/%d\n",buf[1],code,press);
- int k=(-1);
- switch(code) {
- case 39: k=Qt::Key_Up; break;
- case 44: k=Qt::Key_Down; break;
- case 41: k=Qt::Key_Left; break;
- case 42: k=Qt::Key_Right; break;
- case 56: k=Qt::Key_F1; break; //windows
- case 29: k=Qt::Key_F2; break; //cycle
- case 24: k=Qt::Key_F3; break; //record
- case 23: k=Qt::Key_F4; break; //mp3
- case 4: k=Qt::Key_F5; break; // PIMS
- case 1: k=Qt::Key_Escape; break; // Escape
- case 40: k=Qt::Key_Up; break; // prev
- case 45: k=Qt::Key_Down; break; // next
- case 35: if(!press) {
- fd = open("/proc/sys/pm/sleep",O_RDWR,0);
- if(fd >= 0) {
- write(fd,&c,sizeof(c));
- close(fd);
- //
- // Updates all widgets.
- //
- QWidgetList list = QApplication::allWidgets();
- for (int i = 0; i < list.size(); ++i) {
- QWidget *w = list.at(i);
- w->update();
- }
- }
- }
- break;
-
- default: k=(-1); break;
- }
-
- if (k >= 0) {
- handler->processKeyEvent(0, k, 0, press, false);
- }
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qkbdyopy_qws.moc"
-
-#endif // QT_NO_QWS_KBD_YOPY
diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp
index c23608f..305832c 100644
--- a/src/gui/embedded/qlock.cpp
+++ b/src/gui/embedded/qlock.cpp
@@ -73,6 +73,8 @@ union semun {
#endif // QT_NO_QWS_MULTIPROCESS
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
+
#define MAX_LOCKS 200 // maximum simultaneous read locks
QT_BEGIN_NAMESPACE
@@ -134,7 +136,7 @@ QLock::QLock(const QString &filename, char id, bool create)
#ifdef Q_NO_SEMAPHORE
data->file = QString(filename+id).toLocal8Bit().constData();
for(int x = 0; x < 2; x++) {
- data->id = open(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU);
+ data->id = QT_OPEN(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU);
if(data->id != -1 || !create) {
data->owned = x;
break;
@@ -177,7 +179,7 @@ QLock::~QLock()
unlock();
#ifdef Q_NO_SEMAPHORE
if(isValid()) {
- close(data->id);
+ QT_CLOSE(data->id);
if(data->owned)
unlink(data->file);
}
diff --git a/src/gui/embedded/qmousebus_qws.cpp b/src/gui/embedded/qmousebus_qws.cpp
deleted file mode 100644
index a88ca5b..0000000
--- a/src/gui/embedded/qmousebus_qws.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousebus_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_BUS
-
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-
-#include "qapplication.h"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-/*
- * bus mouse driver (a.k.a. Logitech busmouse)
- */
-
-class QWSBusMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSBusMouseHandlerPrivate(QWSBusMouseHandler *h, const QString &driver, const QString &device);
- ~QWSBusMouseHandlerPrivate();
-
- void suspend();
- void resume();
-
-private slots:
- void readMouseData();
-
-protected:
- enum { mouseBufSize = 128 };
- QWSBusMouseHandler *handler;
- QSocketNotifier *mouseNotifier;
- int mouseFD;
- int mouseIdx;
- int obstate;
- uchar mouseBuf[mouseBufSize];
-};
-
-QWSBusMouseHandler::QWSBusMouseHandler(const QString &driver, const QString &device)
- : QWSMouseHandler(driver, device)
-{
- d = new QWSBusMouseHandlerPrivate(this, driver, device);
-}
-
-QWSBusMouseHandler::~QWSBusMouseHandler()
-{
- delete d;
-}
-
-void QWSBusMouseHandler::suspend()
-{
- d->suspend();
-}
-
-void QWSBusMouseHandler::resume()
-{
- d->resume();
-}
-
-
-QWSBusMouseHandlerPrivate::QWSBusMouseHandlerPrivate(QWSBusMouseHandler *h,
- const QString &, const QString &device)
- : handler(h)
-
-{
- QString mouseDev = device;
- if (mouseDev.isEmpty())
- mouseDev = QLatin1String("/dev/mouse");
- obstate = -1;
- mouseFD = -1;
- mouseFD = open(mouseDev.toLocal8Bit(), O_RDWR | O_NDELAY);
- if (mouseFD < 0)
- mouseFD = open(mouseDev.toLocal8Bit(), O_RDONLY | O_NDELAY);
- if (mouseFD < 0)
- qDebug("Cannot open %s (%s)", qPrintable(mouseDev), strerror(errno));
-
- // Clear pending input
- tcflush(mouseFD,TCIFLUSH);
- usleep(50000);
-
- char buf[100]; // busmouse driver will not read if bufsize < 3, YYD
- while (read(mouseFD, buf, 100) > 0) { } // eat unwanted replies
-
- mouseIdx = 0;
-
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-}
-
-QWSBusMouseHandlerPrivate::~QWSBusMouseHandlerPrivate()
-{
- if (mouseFD >= 0) {
- tcflush(mouseFD,TCIFLUSH); // yyd.
- close(mouseFD);
- }
-}
-
-
-void QWSBusMouseHandlerPrivate::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-
-void QWSBusMouseHandlerPrivate::resume()
-{
- mouseIdx = 0;
- obstate = -1;
- mouseNotifier->setEnabled(true);
-}
-
-void QWSBusMouseHandlerPrivate::readMouseData()
-{
- int n;
- // It'll only read 3 bytes a time and return all other buffer zeroed, thus cause protocol errors
- for (;;) {
- if (mouseBufSize - mouseIdx < 3)
- break;
- n = read(mouseFD, mouseBuf+mouseIdx, 3);
- if (n != 3)
- break;
- mouseIdx += 3;
- }
-
- static const int accel_limit = 5;
- static const int accel = 2;
-
- int idx = 0;
- int bstate = 0;
- int dx = 0, dy = 0;
- bool sendEvent = false;
- int tdx = 0, tdy = 0;
-
- while (mouseIdx-idx >= 3) {
-#if 0 // debug
- qDebug("Got mouse data");
-#endif
- uchar *mb = mouseBuf+idx;
- bstate = 0;
- dx = 0;
- dy = 0;
- sendEvent = false;
- if (((mb[0] & 0x04)))
- bstate |= Qt::LeftButton;
- if (((mb[0] & 0x01)))
- bstate |= Qt::RightButton;
-
- dx=(signed char)mb[1];
- dy=(signed char)mb[2];
- sendEvent=true;
-
- if (sendEvent) {
- if (qAbs(dx) > accel_limit || qAbs(dy) > accel_limit) {
- dx *= accel;
- dy *= accel;
- }
- tdx += dx;
- tdy += dy;
- if (bstate != obstate) {
- QPoint pos = handler->pos() + QPoint(tdx,-tdy);
- handler->limitToScreen(pos);
- handler->mouseChanged(pos,bstate);
- sendEvent = false;
- tdx = 0;
- tdy = 0;
- obstate = bstate;
- }
- }
- idx += 3;
- }
- if (sendEvent) {
- QPoint pos = handler->pos() + QPoint(tdx,-tdy);
- handler->limitToScreen(pos);
- handler->mouseChanged(pos,bstate);
- }
-
- int surplus = mouseIdx - idx;
- for (int i = 0; i < surplus; i++)
- mouseBuf[i] = mouseBuf[idx+i];
- mouseIdx = surplus;
-}
-
-QT_END_NAMESPACE
-
-#include "qmousebus_qws.moc"
-
-#endif // QT_NO_QWS_MOUSE_BUS
diff --git a/src/gui/embedded/qmousedriverfactory_qws.cpp b/src/gui/embedded/qmousedriverfactory_qws.cpp
index 7e51818..46898ae 100644
--- a/src/gui/embedded/qmousedriverfactory_qws.cpp
+++ b/src/gui/embedded/qmousedriverfactory_qws.cpp
@@ -43,10 +43,8 @@
#include "qapplication.h"
#include "qmousepc_qws.h"
-#include "qmousebus_qws.h"
-#include "qmousevr41xx_qws.h"
-#include "qmouseyopy_qws.h"
#include "qmouselinuxtp_qws.h"
+#include "qmouselinuxinput_qws.h"
#include "qmousevfb_qws.h"
#include "qmousetslib_qws.h"
#include <stdlib.h>
@@ -108,14 +106,6 @@ QWSMouseHandler *QMouseDriverFactory::create(const QString& key, const QString &
if (driver == QLatin1String("linuxtp") || driver.isEmpty())
return new QWSLinuxTPMouseHandler(key, device);
#endif
-#ifndef QT_NO_QWS_MOUSE_YOPY
- if (driver == QLatin1String("yopy") || driver.isEmpty())
- return new QWSYopyMouseHandler(key, device);
-#endif
-#ifndef QT_NO_QWS_MOUSE_VR41XX
- if (driver == QLatin1String("vr41xx") || driver.isEmpty())
- return new QWSVr41xxMouseHandler(key, device);
-#endif
#ifndef QT_NO_QWS_MOUSE_PC
if (driver == QLatin1String("auto")
|| driver == QLatin1String("intellimouse")
@@ -126,14 +116,16 @@ QWSMouseHandler *QMouseDriverFactory::create(const QString& key, const QString &
return new QWSPcMouseHandler(key, device);
}
#endif
-#ifndef QT_NO_QWS_MOUSE_BUS
- if (driver == QLatin1String("bus"))
- return new QWSBusMouseHandler(key, device);
-#endif
#ifndef QT_NO_QWS_MOUSE_TSLIB
if (driver == QLatin1String("tslib") || driver.isEmpty())
return new QWSTslibMouseHandler(key, device);
#endif
+# ifndef QT_NO_QWS_MOUSE_LINUXINPUT
+ if (driver == QLatin1String("linuxinput") || \
+ driver == QLatin1String("usb") || \
+ driver == QLatin1String("linuxis"))
+ return new QWSLinuxInputMouseHandler(device);
+# endif
#ifndef QT_NO_QWS_MOUSE_QVFB
if (driver == QLatin1String("qvfbmouse") || driver == QLatin1String("qvfb"))
return new QVFbMouseHandler(key, device);
@@ -160,12 +152,6 @@ QStringList QMouseDriverFactory::keys()
#ifndef QT_NO_QWS_MOUSE_LINUXTP
list << QLatin1String("LinuxTP");
#endif
-#ifndef QT_NO_QWS_MOUSE_YOPY
- list << QLatin1String("Yopy");
-#endif
-#ifndef QT_NO_QWS_MOUSE_VR41XX
- list << QLatin1String("VR41xx");
-#endif
#ifndef QT_NO_QWS_MOUSE_PC
list << QLatin1String("Auto")
<< QLatin1String("IntelliMouse")
@@ -173,12 +159,12 @@ QStringList QMouseDriverFactory::keys()
<< QLatin1String("MouseSystems")
<< QLatin1String("MouseMan");
#endif
-#ifndef QT_NO_QWS_MOUSE_BUS
- list << QLatin1String("Bus");
-#endif
#ifndef QT_NO_QWS_MOUSE_TSLIB
list << QLatin1String("Tslib");
#endif
+#ifndef QT_NO_QWS_MOUSE_LINUXINPUT
+ list << QLatin1String("LinuxInput");
+#endif
#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
#ifndef QT_NO_LIBRARY
diff --git a/src/gui/embedded/qmouselinuxinput_qws.cpp b/src/gui/embedded/qmouselinuxinput_qws.cpp
new file mode 100644
index 0000000..6ea8807
--- /dev/null
+++ b/src/gui/embedded/qmouselinuxinput_qws.cpp
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmouselinuxinput_qws.h"
+
+#include <QScreen>
+#include <QSocketNotifier>
+
+#include <qplatformdefs.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
+
+#include <errno.h>
+
+#include <linux/input.h>
+
+QT_BEGIN_NAMESPACE
+
+
+class QWSLinuxInputMousePrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *, const QString &);
+ ~QWSLinuxInputMousePrivate();
+
+ void enable(bool on);
+
+private Q_SLOTS:
+ void readMouseData();
+
+private:
+ QWSLinuxInputMouseHandler *m_handler;
+ QSocketNotifier * m_notify;
+ int m_fd;
+ int m_x, m_y;
+ int m_buttons;
+};
+
+QWSLinuxInputMouseHandler::QWSLinuxInputMouseHandler(const QString &device)
+ : QWSCalibratedMouseHandler(device)
+{
+ d = new QWSLinuxInputMousePrivate(this, device);
+}
+
+QWSLinuxInputMouseHandler::~QWSLinuxInputMouseHandler()
+{
+ delete d;
+}
+
+void QWSLinuxInputMouseHandler::suspend()
+{
+ d->enable(false);
+}
+
+void QWSLinuxInputMouseHandler::resume()
+{
+ d->enable(true);
+}
+
+QWSLinuxInputMousePrivate::QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *h, const QString &device)
+ : m_handler(h), m_notify(0), m_x(0), m_y(0), m_buttons(0)
+{
+ setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler"));
+
+ QString dev = QLatin1String("/dev/input/event0");
+ if (device.startsWith(QLatin1String("/dev/")))
+ dev = device;
+
+ m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
+ if (m_fd >= 0) {
+ m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
+ connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
+ } else {
+ qWarning("Cannot open mouse input device '%s': %s", qPrintable(dev), strerror(errno));
+ return;
+ }
+}
+
+QWSLinuxInputMousePrivate::~QWSLinuxInputMousePrivate()
+{
+ if (m_fd >= 0)
+ QT_CLOSE(m_fd);
+}
+
+void QWSLinuxInputMousePrivate::enable(bool on)
+{
+ if (m_notify)
+ m_notify->setEnabled(on);
+}
+
+void QWSLinuxInputMousePrivate::readMouseData()
+{
+ if (!qt_screen)
+ return;
+
+ struct ::input_event buffer[32];
+ int n = 0;
+
+ forever {
+ n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
+
+ if (n == 0) {
+ qWarning("Got EOF from the input device.");
+ return;
+ } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
+ qWarning("Could not read from input device: %s", strerror(errno));
+ return;
+ } else if (n % sizeof(buffer[0]) == 0) {
+ break;
+ }
+ }
+
+ n /= sizeof(buffer[0]);
+
+ for (int i = 0; i < n; ++i) {
+ struct ::input_event *data = &buffer[i];
+
+ bool unknown = false;
+ if (data->type == EV_ABS) {
+ if (data->code == ABS_X) {
+ m_x = data->value;
+ } else if (data->code == ABS_Y) {
+ m_y = data->value;
+ } else {
+ unknown = true;
+ }
+ } else if (data->type == EV_REL) {
+ if (data->code == REL_X) {
+ m_x += data->value;
+ } else if (data->code == REL_Y) {
+ m_y += data->value;
+ } else {
+ unknown = true;
+ }
+ } else if (data->type == EV_KEY && data->code == BTN_TOUCH) {
+ m_buttons = data->value ? Qt::LeftButton : 0;
+ } else if (data->type == EV_KEY) {
+ int button = 0;
+ switch (data->code) {
+ case BTN_LEFT: button = Qt::LeftButton; break;
+ case BTN_MIDDLE: button = Qt::MidButton; break;
+ case BTN_RIGHT: button = Qt::RightButton; break;
+ }
+ if (data->value)
+ m_buttons |= button;
+ else
+ m_buttons &= ~button;
+ } else if (data->type == EV_SYN && data->code == SYN_REPORT) {
+ QPoint pos(m_x, m_y);
+ pos = m_handler->transform(pos);
+ m_handler->limitToScreen(pos);
+ m_handler->mouseChanged(pos, m_buttons);
+ } else if (data->type == EV_MSC && data->code == MSC_SCAN) {
+ // kernel encountered an unmapped key - just ignore it
+ continue;
+ } else {
+ unknown = true;
+ }
+ if (unknown) {
+ qWarning("unknown mouse event type=%x, code=%x, value=%x", data->type, data->code, data->value);
+ }
+ }
+}
+
+QT_END_NAMESPACE
+
+#include "qmouselinuxinput_qws.moc"
diff --git a/src/gui/embedded/qmousebus_qws.h b/src/gui/embedded/qmouselinuxinput_qws.h
index 407da98..25e351f 100644
--- a/src/gui/embedded/qmousebus_qws.h
+++ b/src/gui/embedded/qmouselinuxinput_qws.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMOUSEBUS_QWS_H
-#define QMOUSEBUS_QWS_H
+#ifndef QMOUSELINUXINPUT_QWS_H
+#define QMOUSELINUXINPUT_QWS_H
-#include <QtGui/qmouse_qws.h>
+#include <QtGui/QWSCalibratedMouseHandler>
QT_BEGIN_HEADER
@@ -50,27 +50,29 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#ifndef QT_NO_QWS_MOUSE_BUS
+#ifndef QT_NO_QWS_MOUSE_LINUXINPUT
-class QWSBusMouseHandlerPrivate;
+class QWSLinuxInputMousePrivate;
-class QWSBusMouseHandler : public QWSMouseHandler
+class QWSLinuxInputMouseHandler : public QWSCalibratedMouseHandler
{
public:
- explicit QWSBusMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSBusMouseHandler();
+ QWSLinuxInputMouseHandler(const QString &);
+ ~QWSLinuxInputMouseHandler();
void suspend();
void resume();
-protected:
- QWSBusMouseHandlerPrivate *d;
+
+private:
+ QWSLinuxInputMousePrivate *d;
+
+ friend class QWSLinuxInputMousePrivate;
};
-#endif // QT_NO_QWS_MOUSE_BUS
+#endif // QT_NO_QWS_MOUSE_LINUXINPUT
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMOUSEBUS_QWS_H
+#endif // QMOUSELINUXINPUT_QWS_H
diff --git a/src/gui/embedded/qmouselinuxtp_qws.cpp b/src/gui/embedded/qmouselinuxtp_qws.cpp
index 1b4d96e..e64407e 100644
--- a/src/gui/embedded/qmouselinuxtp_qws.cpp
+++ b/src/gui/embedded/qmouselinuxtp_qws.cpp
@@ -47,6 +47,7 @@
#include "qtimer.h"
#include "qapplication.h"
#include "qscreen_qws.h"
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <unistd.h>
#include <stdlib.h>
@@ -190,7 +191,7 @@ QWSLinuxTPMouseHandlerPrivate::QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHand
} else {
mousedev = device;
}
- if ((mouseFD = open(mousedev.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
+ if ((mouseFD = QT_OPEN(mousedev.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
qWarning("Cannot open %s (%s)", qPrintable(mousedev), strerror(errno));
return;
}
@@ -205,7 +206,7 @@ QWSLinuxTPMouseHandlerPrivate::QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHand
QWSLinuxTPMouseHandlerPrivate::~QWSLinuxTPMouseHandlerPrivate()
{
if (mouseFD >= 0)
- close(mouseFD);
+ QT_CLOSE(mouseFD);
}
void QWSLinuxTPMouseHandlerPrivate::suspend()
@@ -233,7 +234,7 @@ void QWSLinuxTPMouseHandlerPrivate::readMouseData()
int n;
do {
- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
+ n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
if (n > 0)
mouseIdx += n;
} while (n > 0 && mouseIdx < mouseBufSize);
diff --git a/src/gui/embedded/qmousepc_qws.cpp b/src/gui/embedded/qmousepc_qws.cpp
index a9f2bc8..317bb8a 100644
--- a/src/gui/embedded/qmousepc_qws.cpp
+++ b/src/gui/embedded/qmousepc_qws.cpp
@@ -55,6 +55,7 @@
#include "qfile.h"
#include "qtextstream.h"
#include "qstringlist.h"
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <unistd.h>
#include <stdlib.h>
@@ -107,7 +108,7 @@ public:
{
if (fd != f) {
f = fd;
- close(fd);
+ QT_CLOSE(fd);
}
}
@@ -170,7 +171,7 @@ public:
}
static const uchar initseq[] = { 243, 200, 243, 100, 243, 80 };
static const uchar query[] = { 0xf2 };
- if (write(fd, initseq, sizeof(initseq))!=sizeof(initseq)) {
+ if (QT_WRITE(fd, initseq, sizeof(initseq))!=sizeof(initseq)) {
badness = 100;
return;
}
@@ -180,12 +181,12 @@ public:
perror("QWSPcMouseSubHandler_intellimouse: post-init tcflush");
#endif
}
- if (write(fd, query, sizeof(query))!=sizeof(query)) {
+ if (QT_WRITE(fd, query, sizeof(query))!=sizeof(query)) {
badness = 100;
return;
}
usleep(10000);
- n = read(fd, reply, 20);
+ n = QT_READ(fd, reply, 20);
if (n > 0) {
goodness = 10;
switch (reply[n-1]) {
@@ -256,13 +257,13 @@ public:
perror("QWSPcMouseSubHandler_mouseman: initial tcflush");
#endif
}
- write(fd,"",1);
+ QT_WRITE(fd,"",1);
usleep(50000);
- write(fd,"@EeI!",5);
+ QT_WRITE(fd,"@EeI!",5);
usleep(10000);
static const char ibuf[] = { 246, 244 };
- write(fd,ibuf,1);
- write(fd,ibuf+1,1);
+ QT_WRITE(fd,ibuf,1);
+ QT_WRITE(fd,ibuf+1,1);
if (tcflush(fd,TCIOFLUSH) == -1) {
#ifdef QWS_MOUSE_DEBUG
perror("QWSPcMouseSubHandler_mouseman: tcflush");
@@ -271,7 +272,7 @@ public:
usleep(10000);
char buf[100];
- while (read(fd, buf, 100) > 0) { } // eat unwanted replies
+ while (QT_READ(fd, buf, 100) > 0) { } // eat unwanted replies
}
int tryData()
@@ -350,7 +351,7 @@ private:
for (int n = 0; n < 4; n++) {
setflags(CSTOPB | speed[n]);
- write(fd, "*q", 2);
+ QT_WRITE(fd, "*q", 2);
usleep(10000);
}
}
@@ -369,7 +370,7 @@ public:
{
setflags(B1200|CS8|CSTOPB);
// 60Hz
- if (write(fd, "R", 1)!=1) {
+ if (QT_WRITE(fd, "R", 1)!=1) {
badness = 100;
return;
}
@@ -418,7 +419,7 @@ public:
{
setflags(B1200|CS7);
// 60Hz
- if (write(fd, "R", 1)!=1) {
+ if (QT_WRITE(fd, "R", 1)!=1) {
badness = 100;
return;
}
@@ -648,25 +649,25 @@ void QWSPcMouseHandlerPrivate::openDevices()
if (drv == QLatin1String("intellimouse")) {
if (dev.isEmpty())
dev = "/dev/psaux";
- fd = open(dev, O_RDWR | O_NDELAY);
+ fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
if (fd >= 0)
sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
} else if (drv == QLatin1String("microsoft")) {
if (dev.isEmpty())
dev = "/dev/ttyS0";
- fd = open(dev, O_RDWR | O_NDELAY);
+ fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
if (fd >= 0)
sub[nsub++] = new QWSPcMouseSubHandler_ms(fd);
} else if (drv == QLatin1String("mousesystems")) {
if (dev.isEmpty())
dev = "/dev/ttyS0";
- fd = open(dev, O_RDWR | O_NDELAY);
+ fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
if (fd >= 0)
sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd);
} else if (drv == QLatin1String("mouseman")) {
if (dev.isEmpty())
dev = "/dev/psaux";
- fd = open(dev, O_RDWR | O_NDELAY);
+ fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
if (fd >= 0)
sub[nsub++] = new QWSPcMouseSubHandler_mouseman(fd);
}
@@ -677,12 +678,12 @@ void QWSPcMouseHandlerPrivate::openDevices()
dev.constData(), strerror(errno));
} else {
// Try automatically
- fd = open("/dev/psaux", O_RDWR | O_NDELAY);
+ fd = QT_OPEN("/dev/psaux", O_RDWR | O_NDELAY);
if (fd >= 0) {
sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
notify(fd);
}
- fd = open("/dev/input/mice", O_RDWR | O_NDELAY);
+ fd = QT_OPEN("/dev/input/mice", O_RDWR | O_NDELAY);
if (fd >= 0) {
sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
notify(fd);
@@ -694,7 +695,7 @@ void QWSPcMouseHandlerPrivate::openDevices()
#if 0
const char fn[4][11] = { "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3" };
for (int ch = 0; ch < 4; ++ch) {
- fd = open(fn[ch], O_RDWR | O_NDELAY);
+ fd = QT_OPEN(fn[ch], O_RDWR | O_NDELAY);
if (fd >= 0) {
//sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd);
diff --git a/src/gui/embedded/qmousevfb_qws.cpp b/src/gui/embedded/qmousevfb_qws.cpp
index 17d051f..dd553bc 100644
--- a/src/gui/embedded/qmousevfb_qws.cpp
+++ b/src/gui/embedded/qmousevfb_qws.cpp
@@ -54,6 +54,7 @@
#include <qsocketnotifier.h>
#include <qapplication.h>
#include <qtimer.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
QT_BEGIN_NAMESPACE
@@ -64,7 +65,7 @@ QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device)
if (device.isEmpty())
mouseDev = QLatin1String("/dev/vmouse");
- mouseFD = open(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY);
+ mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY);
if (mouseFD == -1) {
perror("QVFbMouseHandler::QVFbMouseHandler");
qWarning("QVFbMouseHander: Unable to open device %s",
@@ -74,7 +75,7 @@ QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device)
// Clear pending input
char buf[2];
- while (read(mouseFD, buf, 1) > 0) { }
+ while (QT_READ(mouseFD, buf, 1) > 0) { }
mouseIdx = 0;
@@ -85,7 +86,7 @@ QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device)
QVFbMouseHandler::~QVFbMouseHandler()
{
if (mouseFD >= 0)
- close(mouseFD);
+ QT_CLOSE(mouseFD);
}
void QVFbMouseHandler::resume()
@@ -102,7 +103,7 @@ void QVFbMouseHandler::readMouseData()
{
int n;
do {
- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
+ n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
if (n > 0)
mouseIdx += n;
} while (n > 0);
diff --git a/src/gui/embedded/qmousevr41xx_qws.cpp b/src/gui/embedded/qmousevr41xx_qws.cpp
deleted file mode 100644
index 8748055..0000000
--- a/src/gui/embedded/qmousevr41xx_qws.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousevr41xx_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_VR41XX
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-#include "qtimer.h"
-#include "qapplication.h"
-#include "qscreen_qws.h"
-#include <qstringlist.h>
-#include <qvarlengtharray.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-static const int defaultFilterSize = 3;
-
-class QWSVr41xxMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSVr41xxMouseHandlerPrivate(QWSVr41xxMouseHandler *, const QString &, const QString &);
- ~QWSVr41xxMouseHandlerPrivate();
-
- void resume();
- void suspend();
-
-private slots:
- void sendRelease();
- void readMouseData();
-
-private:
- bool getSample();
- ushort currSample[6];
- uint currLength;
-
- int mouseFD;
- int mouseIdx;
- QTimer *rtimer;
- QSocketNotifier *mouseNotifier;
- QWSVr41xxMouseHandler *handler;
- QPoint lastPos;
- bool isPressed;
- int filterSize;
- int pressLimit;
-};
-
-QWSVr41xxMouseHandler::QWSVr41xxMouseHandler(const QString &drv, const QString &dev)
- : QWSCalibratedMouseHandler(drv, dev)
-{
- d = new QWSVr41xxMouseHandlerPrivate(this, drv, dev);
-}
-
-QWSVr41xxMouseHandler::~QWSVr41xxMouseHandler()
-{
- delete d;
-}
-
-void QWSVr41xxMouseHandler::resume()
-{
- d->resume();
-}
-
-void QWSVr41xxMouseHandler::suspend()
-{
- d->suspend();
-}
-
-QWSVr41xxMouseHandlerPrivate::QWSVr41xxMouseHandlerPrivate(QWSVr41xxMouseHandler *h, const QString &, const QString &device)
- : currLength(0), handler(h)
-{
- QStringList options = device.split(QLatin1String(":"));
- int index = -1;
-
- filterSize = defaultFilterSize;
- QRegExp filterRegExp(QLatin1String("filter=(\\d+)"));
- index = options.indexOf(filterRegExp);
- if (index != -1) {
- filterSize = qMax(1, filterRegExp.cap(1).toInt());
- options.removeAt(index);
- }
- handler->setFilterSize(filterSize);
-
- pressLimit = 750;
- QRegExp pressRegExp(QLatin1String("press=(\\d+)"));
- index = options.indexOf(pressRegExp);
- if (index != -1) {
- pressLimit = filterRegExp.cap(1).toInt();
- options.removeAt(index);
- }
-
- QString dev;
- if (options.isEmpty())
- dev = QLatin1String("/dev/vrtpanel");
- else
- dev = options.first();
-
- if ((mouseFD = open(dev.toLocal8Bit().constData(), O_RDONLY)) < 0) {
- qWarning("Cannot open %s (%s)", qPrintable(dev), strerror(errno));
- return;
- }
- sleep(1);
-
- if (fcntl(mouseFD, F_SETFL, O_NONBLOCK) < 0) {
- qWarning("Error initializing touch panel.");
- return;
- }
-
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-
- rtimer = new QTimer(this);
- rtimer->setSingleShot(true);
- connect(rtimer, SIGNAL(timeout()), this, SLOT(sendRelease()));
- mouseIdx = 0;
-}
-
-QWSVr41xxMouseHandlerPrivate::~QWSVr41xxMouseHandlerPrivate()
-{
- if (mouseFD >= 0)
- close(mouseFD);
-}
-
-void QWSVr41xxMouseHandlerPrivate::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-
-void QWSVr41xxMouseHandlerPrivate::resume()
-{
- mouseIdx = 0;
- mouseNotifier->setEnabled(true);
-}
-
-void QWSVr41xxMouseHandlerPrivate::sendRelease()
-{
- handler->sendFiltered(lastPos, Qt::NoButton);
- isPressed = false;
-}
-
-bool QWSVr41xxMouseHandlerPrivate::getSample()
-{
- const int n = read(mouseFD,
- reinterpret_cast<uchar*>(currSample) + currLength,
- sizeof(currSample) - currLength);
-
- if (n > 0)
- currLength += n;
-
- if (currLength < sizeof(currSample))
- return false;
-
- currLength = 0;
- return true;
-}
-
-void QWSVr41xxMouseHandlerPrivate::readMouseData()
-{
- const int sampleLength = sizeof(currSample) / sizeof(ushort);
- QVarLengthArray<ushort, sampleLength * defaultFilterSize> samples(sampleLength * filterSize);
-
- // Only return last 'filterSize' samples
- int head = 0;
- int tail = 0;
- int nSamples = 0;
- while (getSample()) {
- if (!(currSample[0] & 0x8000) || (currSample[5] < pressLimit))
- continue;
-
- ushort *data = samples.data() + head * sampleLength;
- memcpy(data, currSample, sizeof(currSample));
- ++nSamples;
- head = (head + 1) % filterSize;
- if (nSamples >= filterSize)
- tail = (tail + 1) % filterSize;
- }
-
- if (nSamples == 0)
- return;
-
- // send mouse events
- while (tail != head || filterSize == 1) {
- const ushort *data = samples.data() + tail * sampleLength;
- lastPos = QPoint(data[3] - data[4], data[2] - data[1]);
- handler->sendFiltered(lastPos, Qt::LeftButton);
- isPressed = true;
- tail = (tail + 1) % filterSize;
- if (filterSize == 1)
- break;
- }
-
- if (isPressed)
- rtimer->start(50); // release unreliable
-}
-
-QT_END_NAMESPACE
-
-#include "qmousevr41xx_qws.moc"
-
-#endif //QT_NO_QWS_MOUSE_VR41
diff --git a/src/gui/embedded/qmouseyopy_qws.cpp b/src/gui/embedded/qmouseyopy_qws.cpp
deleted file mode 100644
index 7b1141a..0000000
--- a/src/gui/embedded/qmouseyopy_qws.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmouseyopy_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_YOPY
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-#include "qapplication.h"
-#include "qscreen_qws.h"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSYopyMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSYopyMouseHandlerPrivate(QWSYopyMouseHandler *h);
- ~QWSYopyMouseHandlerPrivate();
-
- void suspend();
- void resume();
-
-private slots:
- void readMouseData();
-
-private:
- int mouseFD;
- int prevstate;
- QSocketNotifier *mouseNotifier;
- QWSYopyMouseHandler *handler;
-};
-
-QWSYopyMouseHandler::QWSYopyMouseHandler(const QString &driver, const QString &device)
- : QWSMouseHandler(driver, device)
-{
- d = new QWSYopyMouseHandlerPrivate(this);
-}
-
-QWSYopyMouseHandler::~QWSYopyMouseHandler()
-{
- delete d;
-}
-
-void QWSYopyMouseHandler::resume()
-{
- d->resume();
-}
-
-void QWSYopyMouseHandler::suspend()
-{
- d->suspend();
-}
-
-QWSYopyMouseHandlerPrivate::QWSYopyMouseHandlerPrivate(QWSYopyMouseHandler *h)
- : handler(h)
-{
- if ((mouseFD = open("/dev/ts", O_RDONLY)) < 0) {
- qWarning("Cannot open /dev/ts (%s)", strerror(errno));
- return;
- } else {
- sleep(1);
- }
- prevstate=0;
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read,
- this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-}
-
-QWSYopyMouseHandlerPrivate::~QWSYopyMouseHandlerPrivate()
-{
- if (mouseFD >= 0)
- close(mouseFD);
-}
-
-#define YOPY_XPOS(d) (d[1]&0x3FF)
-#define YOPY_YPOS(d) (d[2]&0x3FF)
-#define YOPY_PRES(d) (d[0]&0xFF)
-#define YOPY_STAT(d) (d[3]&0x01)
-
-struct YopyTPdata {
-
- unsigned char status;
- unsigned short xpos;
- unsigned short ypos;
-
-};
-
-void QWSYopyMouseHandlerPrivate::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-
-void QWSYopyMouseHandlerPrivate::resume()
-{
- prevstate = 0;
- mouseNotifier->setEnabled(true);
-}
-
-void QWSYopyMouseHandlerPrivate::readMouseData()
-{
- if(!qt_screen)
- return;
- YopyTPdata data;
-
- unsigned int yopDat[4];
-
- int ret;
-
- ret=read(mouseFD,&yopDat,sizeof(yopDat));
-
- if(ret) {
- data.status= (YOPY_PRES(yopDat)) ? 1 : 0;
- data.xpos=YOPY_XPOS(yopDat);
- data.ypos=YOPY_YPOS(yopDat);
- QPoint q;
- q.setX(data.xpos);
- q.setY(data.ypos);
- if (data.status && !prevstate) {
- handler->mouseChanged(q,Qt::LeftButton);
- } else if(!data.status && prevstate) {
- handler->mouseChanged(q,0);
- }
- prevstate = data.status;
- }
- if(ret<0) {
- qDebug("Error %s",strerror(errno));
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qmouseyopy_qws.moc"
-
-#endif //QT_NO_QWS_MOUSE_YOPY
diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp
index 42c4fcd..2845842 100644
--- a/src/gui/embedded/qscreenlinuxfb_qws.cpp
+++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp
@@ -46,6 +46,7 @@
#include "qwsdisplay_qws.h"
#include "qpixmap.h"
#include <private/qwssignalhandler_p.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <unistd.h>
#include <stdlib.h>
@@ -122,12 +123,12 @@ void QLinuxFbScreenPrivate::openTty()
if (ttyDevice.isEmpty()) {
for (const char * const *dev = devs; *dev; ++dev) {
- ttyfd = ::open(*dev, O_RDWR);
+ ttyfd = QT_OPEN(*dev, O_RDWR);
if (ttyfd != -1)
break;
}
} else {
- ttyfd = ::open(ttyDevice.toAscii().constData(), O_RDWR);
+ ttyfd = QT_OPEN(ttyDevice.toAscii().constData(), O_RDWR);
}
if (ttyfd == -1)
@@ -144,7 +145,7 @@ void QLinuxFbScreenPrivate::openTty()
// No blankin' screen, no blinkin' cursor!, no cursor!
const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c";
- ::write(ttyfd, termctl, sizeof(termctl));
+ QT_WRITE(ttyfd, termctl, sizeof(termctl));
}
void QLinuxFbScreenPrivate::closeTty()
@@ -157,9 +158,9 @@ void QLinuxFbScreenPrivate::closeTty()
// Blankin' screen, blinkin' cursor!
const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c";
- ::write(ttyfd, termctl, sizeof(termctl));
+ QT_WRITE(ttyfd, termctl, sizeof(termctl));
- ::close(ttyfd);
+ QT_CLOSE(ttyfd);
ttyfd = -1;
}
@@ -281,7 +282,7 @@ bool QLinuxFbScreen::connect(const QString &displaySpec)
dev = QLatin1String("/dev/fb0");
if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0)
- d_ptr->fd = open(dev.toLatin1().constData(), O_RDWR);
+ d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR);
if (d_ptr->fd == -1) {
if (QApplication::type() == QApplication::GuiServer) {
perror("QScreenLinuxFb::connect");
@@ -289,7 +290,7 @@ bool QLinuxFbScreen::connect(const QString &displaySpec)
return false;
}
if (access(dev.toLatin1().constData(), R_OK) == 0)
- d_ptr->fd = open(dev.toLatin1().constData(), O_RDONLY);
+ d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY);
}
fb_fix_screeninfo finfo;
@@ -681,7 +682,7 @@ bool QLinuxFbScreen::initDevice()
#ifdef __i386__
// Now init mtrr
if(!::getenv("QWS_NOMTRR")) {
- int mfd=open("/proc/mtrr",O_WRONLY,0);
+ int mfd=QT_OPEN("/proc/mtrr",O_WRONLY,0);
// MTRR entry goes away when file is closed - i.e.
// hopefully when QWS is killed
if(mfd != -1) {
@@ -702,6 +703,9 @@ bool QLinuxFbScreen::initDevice()
//sentry.base,sentry.size,strerror(errno));
}
}
+
+ // Should we close mfd here?
+ //QT_CLOSE(mfd);
}
#endif
if ((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (finfo.visual==FB_VISUAL_DIRECTCOLOR))
diff --git a/src/gui/embedded/qscreenproxy_qws.cpp b/src/gui/embedded/qscreenproxy_qws.cpp
index ade16ca..3d7451b 100644
--- a/src/gui/embedded/qscreenproxy_qws.cpp
+++ b/src/gui/embedded/qscreenproxy_qws.cpp
@@ -537,7 +537,7 @@ int QProxyScreen::transformOrientation() const
}
/*!
-\reimp
+\internal
*/
int QProxyScreen::memoryNeeded(const QString &str)
{
@@ -548,7 +548,7 @@ int QProxyScreen::memoryNeeded(const QString &str)
}
/*!
-\reimp
+\internal
*/
int QProxyScreen::sharedRamSize(void *ptr)
{
@@ -559,7 +559,7 @@ int QProxyScreen::sharedRamSize(void *ptr)
}
/*!
-\reimp
+\internal
*/
void QProxyScreen::haltUpdates()
{
@@ -568,7 +568,7 @@ void QProxyScreen::haltUpdates()
}
/*!
-\reimp
+\internal
*/
void QProxyScreen::resumeUpdates()
{
diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp
index 4355eff..e239e14 100644
--- a/src/gui/embedded/qsoundqss_qws.cpp
+++ b/src/gui/embedded/qsoundqss_qws.cpp
@@ -53,6 +53,7 @@
#include <qtimer.h>
#include <qpointer.h>
#include <qendian.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <unistd.h>
#include <stdlib.h>
@@ -1141,7 +1142,7 @@ void QWSSoundServerPrivate::sendCompletedSignals()
int QWSSoundServerPrivate::openFile(int wid, int sid, const QString& filename)
{
stopFile(wid, sid); // close and re-open.
- int f = ::open(QFile::encodeName(filename), O_RDONLY|O_NONBLOCK);
+ int f = QT_OPEN(QFile::encodeName(filename), O_RDONLY|O_NONBLOCK);
if (f == -1) {
// XXX check ferror, check reason.
qDebug("Failed opening \"%s\"",filename.toLatin1().data());
@@ -1161,7 +1162,7 @@ bool QWSSoundServerPrivate::openDevice()
{
if (fd < 0) {
if( silent ) {
- fd = ::open( "/dev/null", O_WRONLY );
+ fd = QT_OPEN( "/dev/null", O_WRONLY );
// Emulate write to audio device
int delay = 1000*(sound_buffer_size>>(sound_stereo+sound_16bit))/sound_speed/2;
timerId = startTimer(delay);
@@ -1172,7 +1173,7 @@ bool QWSSoundServerPrivate::openDevice()
// Don't block open right away.
//
bool openOkay = false;
- if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
+ if ((fd = QT_OPEN("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
int flags = fcntl(fd, F_GETFL);
flags &= ~O_NONBLOCK;
openOkay = (fcntl(fd, F_SETFL, flags) == 0);
@@ -1226,7 +1227,7 @@ bool QWSSoundServerPrivate::openDevice()
//
// Check system volume
//
- int mixerHandle = ::open( "/dev/mixer", O_RDWR|O_NONBLOCK );
+ int mixerHandle = QT_OPEN( "/dev/mixer", O_RDWR|O_NONBLOCK );
if ( mixerHandle >= 0 ) {
int volume;
ioctl( mixerHandle, MIXER_READ(0), &volume );
diff --git a/src/gui/embedded/qtransportauth_qws.cpp b/src/gui/embedded/qtransportauth_qws.cpp
index 05dce11..8523e27 100644
--- a/src/gui/embedded/qtransportauth_qws.cpp
+++ b/src/gui/embedded/qtransportauth_qws.cpp
@@ -56,6 +56,7 @@
#include "qlibraryinfo.h"
#include "qfile.h"
#include "qdebug.h"
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <syslog.h>
#include <unistd.h>
@@ -572,7 +573,7 @@ bool QTransportAuth::authorizeRequest( QTransportAuth::Data &d, const QString &r
//get cmdline from proc/pid/cmdline
snprintf( cmdlinePath, BUF_SIZE, "/proc/%d/cmdline", d.processId );
- int cmdlineFd = open( cmdlinePath, O_RDONLY );
+ int cmdlineFd = QT_OPEN( cmdlinePath, O_RDONLY );
if ( cmdlineFd == -1 )
{
qWarning( "SXE:- Error encountered in opening /proc/%u/cmdline: %s",
@@ -581,13 +582,13 @@ bool QTransportAuth::authorizeRequest( QTransportAuth::Data &d, const QString &r
}
else
{
- if ( -1 == ::read(cmdlineFd, cmdline, BUF_SIZE - 1 ) )
+ if ( -1 == QT_READ(cmdlineFd, cmdline, BUF_SIZE - 1 ) )
{
qWarning( "SXE:- Error encountered in reading /proc/%u/cmdline : %s",
d.processId, strerror(errno) );
snprintf( cmdline, BUF_SIZE, "%s", "Unknown" );
}
- close( cmdlineFd );
+ QT_CLOSE( cmdlineFd );
}
syslog( LOG_ERR | LOG_LOCAL6, "%s // PID:%u // ProgId:%u // Exe:%s // Request:%s // Cmdline:%s",
diff --git a/src/gui/embedded/qunixsocket.cpp b/src/gui/embedded/qunixsocket.cpp
index 070d3cf..57a4a11 100644
--- a/src/gui/embedded/qunixsocket.cpp
+++ b/src/gui/embedded/qunixsocket.cpp
@@ -46,6 +46,7 @@
#include <QtCore/qsocketnotifier.h>
#include <QtCore/qqueue.h>
#include <QtCore/qdatetime.h>
+#include "private/qcore_unix_p.h" // overrides QT_OPEN
#ifdef QUNIXSOCKET_DEBUG
#include <QtCore/qdebug.h>
@@ -131,7 +132,7 @@ struct QUnixSocketRightsPrivate : public QSharedData
#ifdef QUNIXSOCKET_DEBUG
int closerv =
#endif
- ::close(fd);
+ QT_CLOSE(fd);
#ifdef QUNIXSOCKET_DEBUG
if(0 != closerv) {
qDebug() << "QUnixSocketRightsPrivate: Unable to close managed"
@@ -162,7 +163,7 @@ QUnixSocketRights::QUnixSocketRights(int fd)
if(-1 == fd) {
d->fd = -1;
} else {
- d->fd = ::dup(fd);
+ d->fd = qt_safe_dup(fd);
#ifdef QUNIXSOCKET_DEBUG
if(-1 == d->fd) {
qDebug() << "QUnixSocketRights: Unable to duplicate fd "
@@ -232,7 +233,7 @@ int QUnixSocketRights::dupFd() const
{
if(-1 == d->fd) return -1;
- int rv = ::dup(d->fd);
+ int rv = qt_safe_dup(d->fd);
#ifdef QUNIXSOCKET_DEBUG
if(-1 == rv)
@@ -825,7 +826,7 @@ public:
int numFds = (h->cmsg_len - CMSG_LEN(0)) / sizeof(int);
for(int ii = 0; ii < numFds; ++ii)
- ::close(fds[ii]);
+ QT_CLOSE(fds[ii]);
}
h = (::cmsghdr *)CMSG_NXTHDR(&(message), h);
@@ -1017,7 +1018,7 @@ connect_error: // Cleanup failed connection
#ifdef QUNIXSOCKET_DEBUG
int closerv =
#endif
- ::close(d->fd);
+ QT_CLOSE(d->fd);
#ifdef QUNIXSOCKET_DEBUG
if(0 != closerv) {
qDebug() << "QUnixSocket: Unable to close file descriptor after "
@@ -1762,7 +1763,12 @@ void QUnixSocketPrivate::readActivated()
message.msg_controllen = ancillaryBufferCapacity();
message.msg_control = ancillaryBuffer;
- int recvrv = ::recvmsg(fd, &message, 0);
+ int flags = 0;
+#ifdef MSG_CMSG_CLOEXEC
+ flags = MSG_CMSG_CLOEXEC;
+#endif
+
+ int recvrv = ::recvmsg(fd, &message, flags);
#ifdef QUNIXSOCKET_DEBUG
qDebug() << "QUnixSocket: Received message (" << recvrv << ')';
#endif
diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri
index 4cee6d6..0c0747e 100644
--- a/src/gui/graphicsview/graphicsview.pri
+++ b/src/gui/graphicsview/graphicsview.pri
@@ -1,37 +1,42 @@
# Qt graphicsview module
-HEADERS += graphicsview/qgraphicsitem.h \
+HEADERS += graphicsview/qgraphicsgridlayout.h \
+ graphicsview/qgraphicsitem.h \
graphicsview/qgraphicsitem_p.h \
graphicsview/qgraphicsitemanimation.h \
- graphicsview/qgraphicsscene.h \
- graphicsview/qgraphicsscene_p.h \
- graphicsview/qgraphicsscene_bsp_p.h \
- graphicsview/qgraphicssceneevent.h \
- graphicsview/qgraphicsview_p.h \
- graphicsview/qgraphicsview.h
-SOURCES += graphicsview/qgraphicsitem.cpp \
- graphicsview/qgraphicsitemanimation.cpp \
- graphicsview/qgraphicsscene.cpp \
- graphicsview/qgraphicsscene_bsp.cpp \
- graphicsview/qgraphicssceneevent.cpp \
- graphicsview/qgraphicsview.cpp
-
-# Widgets on the canvas
-HEADERS += graphicsview/qgraphicslayout.h \
+ graphicsview/qgraphicslayout.h \
graphicsview/qgraphicslayout_p.h \
graphicsview/qgraphicslayoutitem.h \
graphicsview/qgraphicslayoutitem_p.h \
graphicsview/qgraphicslinearlayout.h \
+ graphicsview/qgraphicsproxywidget.h \
+ graphicsview/qgraphicsscene.h \
+ graphicsview/qgraphicsscene_bsp_p.h \
+ graphicsview/qgraphicsscene_p.h \
+ graphicsview/qgraphicsscenebsptreeindex_p.h \
+ graphicsview/qgraphicssceneevent.h \
+ graphicsview/qgraphicssceneindex_p.h \
+ graphicsview/qgraphicsscenelinearindex_p.h \
+ graphicsview/qgraphicsview.h \
+ graphicsview/qgraphicsview_p.h \
graphicsview/qgraphicswidget.h \
graphicsview/qgraphicswidget_p.h \
- graphicsview/qgridlayoutengine_p.h \
- graphicsview/qgraphicsproxywidget.h \
- graphicsview/qgraphicsgridlayout.h
-SOURCES += graphicsview/qgraphicslayout.cpp \
+ graphicsview/qgridlayoutengine_p.h
+
+SOURCES += graphicsview/qgraphicsgridlayout.cpp \
+ graphicsview/qgraphicsitem.cpp \
+ graphicsview/qgraphicsitemanimation.cpp \
+ graphicsview/qgraphicslayout.cpp \
graphicsview/qgraphicslayout_p.cpp \
graphicsview/qgraphicslayoutitem.cpp \
graphicsview/qgraphicslinearlayout.cpp \
+ graphicsview/qgraphicsproxywidget.cpp \
+ graphicsview/qgraphicsscene.cpp \
+ graphicsview/qgraphicsscene_bsp.cpp \
+ graphicsview/qgraphicsscenebsptreeindex.cpp \
+ graphicsview/qgraphicssceneevent.cpp \
+ graphicsview/qgraphicssceneindex.cpp \
+ graphicsview/qgraphicsscenelinearindex.cpp \
+ graphicsview/qgraphicsview.cpp \
graphicsview/qgraphicswidget.cpp \
graphicsview/qgraphicswidget_p.cpp \
- graphicsview/qgridlayoutengine.cpp \
- graphicsview/qgraphicsproxywidget.cpp \
- graphicsview/qgraphicsgridlayout.cpp
+ graphicsview/qgridlayoutengine.cpp
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 3c7593d..7e155e1 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -307,8 +307,6 @@
QStyleOptionGraphicsItem::exposedRect or QStyleOptionGraphicsItem::matrix.
By default, the exposedRect is initialized to the item's boundingRect and
the matrix is untransformed. Enable this flag for more fine-grained values.
- Note that QStyleOptionGraphicsItem::levelOfDetail is unaffected by this flag
- and is always initialized to 1.
Use QStyleOptionGraphicsItem::levelOfDetailFromTransform for a more
fine-grained value.
@@ -323,6 +321,10 @@
performance reasons, these notifications are disabled by default. You must
enable this flag to receive notifications for position and transform
changes. This flag was introduced in Qt 4.6.
+
+ \value ItemAcceptsInputMethod The item supports input methods typically
+ used for Asian languages.
+ This flag was introduced in Qt 4.6.
*/
/*!
@@ -554,6 +556,7 @@
#include "qgraphicsview.h"
#include "qgraphicswidget.h"
#include "qgraphicsproxywidget.h"
+#include "qgraphicsscenebsptreeindex_p.h"
#include <QtCore/qbitarray.h>
#include <QtCore/qdebug.h>
#include <QtCore/qpoint.h>
@@ -575,7 +578,6 @@
#include <private/qtextcontrol_p.h>
#include <private/qtextdocumentlayout_p.h>
#include <private/qtextengine_p.h>
-#include <private/qgesturemanager_p.h>
#ifdef Q_WS_X11
#include <private/qt_x11_p.h>
@@ -586,17 +588,6 @@
QT_BEGIN_NAMESPACE
-// QRectF::intersects() returns false always if either the source or target
-// rectangle's width or height are 0. This works around that problem.
-static inline void _q_adjustRect(QRectF *rect)
-{
- Q_ASSERT(rect);
- if (!rect->width())
- rect->adjust(-0.00001, 0, 0.00001, 0);
- if (!rect->height())
- rect->adjust(0, -0.00001, 0, 0.00001);
-}
-
static inline void _q_adjustRect(QRect *rect)
{
Q_ASSERT(rect);
@@ -616,8 +607,6 @@ public:
};
Q_GLOBAL_STATIC(QGraphicsItemCustomDataStore, qt_dataStore)
-QString qt_getStandardGestureTypeName(Qt::GestureType type);
-
/*!
\internal
@@ -660,6 +649,10 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch
// For root items only. This is the item that has either enabled or
// disabled \a childFlag, or has been reparented.
switch (int(childFlag)) {
+ case -2:
+ flag = AncestorFiltersChildEvents;
+ enabled = q->filtersChildEvents();
+ break;
case -1:
flag = AncestorHandlesChildEvents;
enabled = q->handlesChildEvents();
@@ -680,7 +673,8 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch
// Inherit the enabled-state from our parents.
if ((parent && ((parent->d_ptr->ancestorFlags & flag)
|| (int(parent->d_ptr->flags & childFlag) == childFlag)
- || (childFlag == -1 && parent->d_ptr->handlesChildEvents)))) {
+ || (childFlag == -1 && parent->d_ptr->handlesChildEvents)
+ || (childFlag == -2 && parent->d_ptr->filtersDescendantEvents)))) {
enabled = true;
ancestorFlags |= flag;
}
@@ -701,7 +695,9 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch
ancestorFlags &= ~flag;
// Don't process children if the item has the main flag set on itself.
- if ((childFlag != -1 && int(flags & childFlag) == childFlag) || (int(childFlag) == -1 && handlesChildEvents))
+ if ((childFlag != -1 && int(flags & childFlag) == childFlag)
+ || (int(childFlag) == -1 && handlesChildEvents)
+ || (int(childFlag) == -2 && filtersDescendantEvents))
return;
}
@@ -832,6 +828,42 @@ void QGraphicsItemPrivate::combineTransformFromParent(QTransform *x, const QTran
}
}
+void QGraphicsItemPrivate::updateSceneTransformFromParent()
+{
+ if (parent) {
+ Q_ASSERT(!parent->d_ptr->dirtySceneTransform);
+ if (parent->d_ptr->sceneTransformTranslateOnly) {
+ sceneTransform = QTransform::fromTranslate(parent->d_ptr->sceneTransform.dx() + pos.x(),
+ parent->d_ptr->sceneTransform.dy() + pos.y());
+ } else {
+ sceneTransform = parent->d_ptr->sceneTransform;
+ sceneTransform.translate(pos.x(), pos.y());
+ }
+ if (transformData) {
+ sceneTransform = transformData->computedFullTransform(&sceneTransform);
+ sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate);
+ } else {
+ sceneTransformTranslateOnly = parent->d_ptr->sceneTransformTranslateOnly;
+ }
+ } else if (!transformData) {
+ sceneTransform = QTransform::fromTranslate(pos.x(), pos.y());
+ sceneTransformTranslateOnly = 1;
+ } else if (transformData->onlyTransform) {
+ sceneTransform = transformData->transform;
+ if (!pos.isNull())
+ sceneTransform *= QTransform::fromTranslate(pos.x(), pos.y());
+ sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate);
+ } else if (pos.isNull()) {
+ sceneTransform = transformData->computedFullTransform();
+ sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate);
+ } else {
+ sceneTransform = QTransform::fromTranslate(pos.x(), pos.y());
+ sceneTransform = transformData->computedFullTransform(&sceneTransform);
+ sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate);
+ }
+ dirtySceneTransform = 0;
+}
+
/*!
\internal
@@ -871,6 +903,11 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
if (newParent == parent)
return;
+ if (scene) {
+ // Deliver the change to the index
+ scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParentVariant);
+ }
+
if (QGraphicsWidget *w = isWidget ? static_cast<QGraphicsWidget *>(q) : q->parentWidget()) {
// Update the child focus chain; when reparenting a widget that has a
// focus child, ensure that that focus child clears its focus child
@@ -922,6 +959,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
}
// Inherit ancestor flags from the new parent.
+ updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2));
updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-1));
updateAncestorFlag(QGraphicsItem::ItemClipsChildrenToShape);
updateAncestorFlag(QGraphicsItem::ItemIgnoresTransformations);
@@ -938,6 +976,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
} else {
// Inherit ancestor flags from the new parent.
+ updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2));
updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-1));
updateAncestorFlag(QGraphicsItem::ItemClipsChildrenToShape);
updateAncestorFlag(QGraphicsItem::ItemIgnoresTransformations);
@@ -958,12 +997,6 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
}
}
- if (scene) {
- // Invalidate any sort caching; arrival of a new item means we need to
- // resort.
- scene->d_func()->invalidateSortCache();
- }
-
// Resolve depth.
resolveDepth(parent ? parent->d_ptr->depth : -1);
dirtySceneTransform = 1;
@@ -1132,7 +1165,6 @@ QGraphicsItem::~QGraphicsItem()
{
d_ptr->inDestructor = 1;
d_ptr->removeExtraItemCache();
- d_ptr->removeExtraGestures();
clearFocus();
if (!d_ptr->children.isEmpty()) {
@@ -1203,7 +1235,7 @@ void QGraphicsItem::setGroup(QGraphicsItemGroup *group)
Returns a pointer to this item's parent item. If this item does not have a
parent, 0 is returned.
- \sa setParentItem(), children()
+ \sa setParentItem(), childItems()
*/
QGraphicsItem *QGraphicsItem::parentItem() const
{
@@ -1226,7 +1258,7 @@ QGraphicsItem *QGraphicsItem::topLevelItem() const
}
/*!
- \since 4.4
+ \since 4.6
Returns a pointer to the item's parent, cast to a QGraphicsObject. returns 0 if the parent item
is not a QGraphicsObject.
@@ -1319,7 +1351,7 @@ const QGraphicsObject *QGraphicsItem::toGraphicsObject() const
the parent. You should not \l{QGraphicsScene::addItem()}{add} the
item to the scene yourself.
- \sa parentItem(), children()
+ \sa parentItem(), childItems()
*/
void QGraphicsItem::setParentItem(QGraphicsItem *parent)
{
@@ -1442,6 +1474,8 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
flags = GraphicsItemFlags(itemChange(ItemFlagsChange, quint32(flags)).toUInt());
if (quint32(d_ptr->flags) == quint32(flags))
return;
+ if (d_ptr->scene)
+ d_ptr->scene->d_func()->index->itemChange(this, ItemFlagsChange, quint32(flags));
// Flags that alter the geometry of the item (or its children).
const quint32 geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations);
@@ -1490,6 +1524,12 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
d_ptr->scene->d_func()->needSortTopLevelItems = 1;
}
+ if ((flags & ItemAcceptsInputMethod) != (oldFlags & ItemAcceptsInputMethod)) {
+ // Update input method sensitivity in any views.
+ if (d_ptr->scene)
+ d_ptr->scene->d_func()->updateInputMethodSensitivityInViews();
+ }
+
if (d_ptr->scene) {
d_ptr->scene->d_func()->markDirty(this, QRectF(),
/*invalidateChildren=*/true,
@@ -1794,6 +1834,8 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
if (q_ptr->isSelected())
q_ptr->setSelected(false);
} else {
+ geometryChanged = 1;
+ paintedViewBoundingRectsNeedRepaint = 1;
if (isWidget && scene) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr);
if (widget->windowType() == Qt::Popup)
@@ -2254,10 +2296,10 @@ bool QGraphicsItem::acceptsHoverEvents() const
stays "hovered" until the cursor leaves its area, including its
children's areas.
- If a parent item handles child events (setHandlesChildEvents()), it will
- receive hover move, drag move, and drop events as the cursor passes
- through its children, but it does not receive hover enter and hover leave,
- nor drag enter and drag leave events on behalf of its children.
+ If a parent item handles child events, it will receive hover move,
+ drag move, and drop events as the cursor passes through its
+ children, but it does not receive hover enter and hover leave, nor
+ drag enter and drag leave events on behalf of its children.
A QGraphicsWidget with window decorations will accept hover events
regardless of the value of acceptHoverEvents().
@@ -2288,8 +2330,8 @@ void QGraphicsItem::setAcceptsHoverEvents(bool enabled)
/*! \since 4.6
- Returns true if an item accepts touch events (QTouchEvent); otherwise, returns false. By
- default, items do not accept touch events.
+ Returns true if an item accepts \l{QTouchEvent}{touch events};
+ otherwise, returns false. By default, items do not accept touch events.
\sa setAcceptTouchEvents()
*/
@@ -2301,7 +2343,7 @@ bool QGraphicsItem::acceptTouchEvents() const
/*!
\since 4.6
- If \a enabled is true, this item will accept touch events;
+ If \a enabled is true, this item will accept \l{QTouchEvent}{touch events};
otherwise, it will ignore them. By default, items do not accept
touch events.
*/
@@ -2317,6 +2359,44 @@ void QGraphicsItem::setAcceptTouchEvents(bool enabled)
}
/*!
+ \since 4.6
+
+ Returns true if this item filters child events (i.e., all events
+ intended for any of its children are instead sent to this item);
+ otherwise, false is returned.
+
+ The default value is false; child events are not filtered.
+
+ \sa setFiltersChildEvents()
+*/
+bool QGraphicsItem::filtersChildEvents() const
+{
+ return d_ptr->filtersDescendantEvents;
+}
+
+/*!
+ \since 4.6
+
+ If \a enabled is true, this item is set to filter all events for
+ all its children (i.e., all events intented for any of its
+ children are instead sent to this item); otherwise, if \a enabled
+ is false, this item will only handle its own events. The default
+ value is false.
+
+ \sa filtersChildEvents()
+*/
+void QGraphicsItem::setFiltersChildEvents(bool enabled)
+{
+ if (d_ptr->filtersDescendantEvents == enabled)
+ return;
+
+ d_ptr->filtersDescendantEvents = enabled;
+ d_ptr->updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2));
+}
+
+/*!
+ \obsolete
+
Returns true if this item handles child events (i.e., all events
intended for any of its children are instead sent to this item);
otherwise, false is returned.
@@ -2337,6 +2417,8 @@ bool QGraphicsItem::handlesChildEvents() const
}
/*!
+ \obsolete
+
If \a enabled is true, this item is set to handle all events for
all its children (i.e., all events intented for any of its
children are instead sent to this item); otherwise, if \a enabled
@@ -2371,6 +2453,8 @@ void QGraphicsItem::setHandlesChildEvents(bool enabled)
*/
bool QGraphicsItem::hasFocus() const
{
+ if (d_ptr->focusProxy)
+ return d_ptr->focusProxy->hasFocus();
return (d_ptr->scene && d_ptr->scene->focusItem() == this);
}
@@ -2396,12 +2480,16 @@ void QGraphicsItem::setFocus(Qt::FocusReason focusReason)
{
if (!d_ptr->scene || !isEnabled() || hasFocus() || !(d_ptr->flags & ItemIsFocusable))
return;
- if (isVisible()) {
+ QGraphicsItem *item = this;
+ QGraphicsItem *f;
+ while ((f = item->d_ptr->focusProxy))
+ item = f;
+ if (item->isVisible()) {
// Visible items immediately gain focus from scene.
- d_ptr->scene->setFocusItem(this, focusReason);
- } else if (d_ptr->isWidget) {
+ d_ptr->scene->d_func()->setFocusItemHelper(item, focusReason);
+ } else if (item->d_ptr->isWidget) {
// Just set up subfocus.
- static_cast<QGraphicsWidget *>(this)->d_func()->setFocusWidget();
+ static_cast<QGraphicsWidget *>(item)->d_func()->setFocusWidget();
}
}
@@ -2424,13 +2512,73 @@ void QGraphicsItem::clearFocus()
// Invisible widget items with focus must explicitly clear subfocus.
static_cast<QGraphicsWidget *>(this)->d_func()->clearFocusWidget();
}
- if (d_ptr->scene->focusItem() == this) {
+ if (hasFocus()) {
// If this item has the scene's input focus, clear it.
d_ptr->scene->setFocusItem(0);
}
}
/*!
+ \since 4.6
+
+ Returns this item's focus proxy, or 0 if the item
+ does not have any focus proxy.
+
+ \sa setFocusProxy()
+*/
+QGraphicsItem *QGraphicsItem::focusProxy() const
+{
+ return d_ptr->focusProxy;
+}
+
+/*!
+ \since 4.6
+
+ Sets the item's focus proxy to \a item.
+
+ If an item has a focus proxy, the focus proxy will receive
+ input focus when the item gains input focus. The item itself
+ will still have focus (i.e., hasFocus() will return true),
+ but only the focus proxy will receive the keyboard input.
+
+ A focus proxy can itself have a focus proxy, and so on. In
+ such case, keyboard input will be handled by the outermost
+ focus proxy.
+
+ \sa focusProxy()
+*/
+void QGraphicsItem::setFocusProxy(QGraphicsItem *item)
+{
+ if (item == d_ptr->focusProxy)
+ return;
+ if (item == this) {
+ qWarning("QGraphicsItem::setFocusProxy: cannot assign self as focus proxy");
+ return;
+ }
+ if (item) {
+ if (item->d_ptr->scene != d_ptr->scene) {
+ qWarning("QGraphicsItem::setFocusProxy: focus proxy must be in same scene");
+ return;
+ }
+ for (QGraphicsItem *f = item->focusProxy(); f != 0; f = f->focusProxy()) {
+ if (f == this) {
+ qWarning("QGraphicsItem::setFocusProxy: %p is already in the focus proxy chain", item);
+ return;
+ }
+ }
+ }
+
+ QGraphicsItem *lastFocusProxy = d_ptr->focusProxy;
+ d_ptr->focusProxy = item;
+ if (d_ptr->scene) {
+ if (lastFocusProxy)
+ d_ptr->scene->d_func()->focusProxyReverseMap.remove(lastFocusProxy, this);
+ if (item)
+ d_ptr->scene->d_func()->focusProxyReverseMap.insert(item, this);
+ }
+}
+
+/*!
\since 4.4
Grabs the mouse input.
@@ -2565,7 +2713,7 @@ void QGraphicsItem::ungrabKeyboard()
For convenience, you can also call scenePos() to determine the
item's position in scene coordinates, regardless of its parent.
- \sa x(), y(), setPos(), matrix(), {The Graphics View Coordinate System}
+ \sa x(), y(), setPos(), transform(), {The Graphics View Coordinate System}
*/
QPointF QGraphicsItem::pos() const
{
@@ -2581,10 +2729,12 @@ QPointF QGraphicsItem::pos() const
*/
/*!
- Set's the \a x coordinate of the item's position. Equivalent to
- calling setPos(x, y()).
+ \since 4.6
- \sa x(), setPos()
+ Set's the \a x coordinate of the item's position. Equivalent to
+ calling setPos(x, y()).
+
+ \sa x(), setPos()
*/
void QGraphicsItem::setX(qreal x)
{
@@ -2600,10 +2750,12 @@ void QGraphicsItem::setX(qreal x)
*/
/*!
- Set's the \a y coordinate of the item's position. Equivalent to
- calling setPos(x(), y).
+ \since 4.6
+
+ Set's the \a y coordinate of the item's position. Equivalent to
+ calling setPos(x(), y).
- \sa x(), setPos()
+ \sa x(), setPos()
*/
void QGraphicsItem::setY(qreal y)
{
@@ -3101,7 +3253,7 @@ void QGraphicsItem::setShear(qreal sh, qreal sv)
/*!
\since 4.6
- Returns the origin point used for transformation in item coordinate.
+ Returns the origin point for the transformation in item coordinates.
The default is QPointF(0,0).
@@ -3117,7 +3269,7 @@ QPointF QGraphicsItem::transformOrigin() const
/*!
\since 4.6
- Sets the \a origin for transformation in item coordinate
+ Sets the \a origin point for the transformation in item coordinates.
\sa transformOrigin(), {Transformations}
*/
@@ -3138,9 +3290,9 @@ void QGraphicsItem::setTransformOrigin(const QPointF &origin)
\since 4.6
\overload
- Sets the origin for the transformation to the point
- composed of \a x and \a y.
-
+ Sets the origin point for the transformation in item coordinates.
+ This is equivalent to calling setTransformOrigin(QPointF(\a x, \a y)).
+
\sa setTransformOrigin(), {Transformations}
*/
@@ -3154,7 +3306,8 @@ void QGraphicsItem::setTransformOrigin(const QPointF &origin)
*/
QMatrix QGraphicsItem::sceneMatrix() const
{
- return sceneTransform().toAffine();
+ d_ptr->ensureSceneTransform();
+ return d_ptr->sceneTransform.toAffine();
}
@@ -3177,16 +3330,7 @@ QMatrix QGraphicsItem::sceneMatrix() const
*/
QTransform QGraphicsItem::sceneTransform() const
{
- if (d_ptr->dirtySceneTransform) {
- // This item and all its descendants have dirty scene transforms.
- // We're about to validate this item's scene transform, so we have to
- // invalidate all the children; otherwise there's no way for the descendants
- // to detect that the ancestor has changed.
- d_ptr->invalidateChildrenSceneTransform();
- }
-
- QGraphicsItem *that = const_cast<QGraphicsItem *>(this);
- d_ptr->ensureSceneTransformRecursive(&that);
+ d_ptr->ensureSceneTransform();
return d_ptr->sceneTransform;
}
@@ -3216,8 +3360,10 @@ QTransform QGraphicsItem::sceneTransform() const
QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) const
{
// Ensure we return the standard transform if we're not untransformable.
- if (!d_ptr->itemIsUntransformable())
- return sceneTransform() * viewportTransform;
+ if (!d_ptr->itemIsUntransformable()) {
+ d_ptr->ensureSceneTransform();
+ return d_ptr->sceneTransform * viewportTransform;
+ }
// Find the topmost item that ignores view transformations.
const QGraphicsItem *untransformedAncestor = this;
@@ -3236,7 +3382,8 @@ QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) c
}
// First translate the base untransformable item.
- QPointF mappedPoint = (untransformedAncestor->sceneTransform() * viewportTransform).map(QPointF(0, 0));
+ untransformedAncestor->d_ptr->ensureSceneTransform();
+ QPointF mappedPoint = (untransformedAncestor->d_ptr->sceneTransform * viewportTransform).map(QPointF(0, 0));
// COMBINE
QTransform matrix = QTransform::fromTranslate(mappedPoint.x(), mappedPoint.y());
@@ -3329,8 +3476,11 @@ QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) co
// Find the closest common ancestor. If the two items don't share an
// ancestor, then the only way is to combine their scene transforms.
const QGraphicsItem *commonAncestor = commonAncestorItem(other);
- if (!commonAncestor)
- return sceneTransform() * other->sceneTransform().inverted(ok);
+ if (!commonAncestor) {
+ d_ptr->ensureSceneTransform();
+ other->d_ptr->ensureSceneTransform();
+ return d_ptr->sceneTransform * other->d_ptr->sceneTransform.inverted(ok);
+ }
// If the two items are cousins (in sibling branches), map both to the
// common ancestor, and combine the two transforms.
@@ -3621,18 +3771,20 @@ void QGraphicsItem::setZValue(qreal z)
qreal newZ = qreal(newZVariant.toDouble());
if (newZ == d_ptr->z)
return;
+
+ if (d_ptr->scene) {
+ // Z Value has changed, we have to notify the index.
+ d_ptr->scene->d_func()->index->itemChange(this, ItemZValueChange, newZVariant);
+ }
+
d_ptr->z = newZ;
if (d_ptr->parent)
d_ptr->parent->d_ptr->needSortChildren = 1;
else if (d_ptr->scene)
d_ptr->scene->d_func()->needSortTopLevelItems = 1;
- if (d_ptr->scene) {
+ if (d_ptr->scene)
d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true);
- // Invalidate any sort caching; arrival of a new item means we need to
- // resort.
- d_ptr->scene->d_func()->invalidateSortCache();
- }
itemChange(ItemZValueHasChanged, newZVariant);
@@ -3723,7 +3875,13 @@ QRectF QGraphicsItem::sceneBoundingRect() const
QRectF br = boundingRect();
br.translate(offset);
- return !parentItem ? br : parentItem->sceneTransform().mapRect(br);
+ if (!parentItem)
+ return br;
+ if (parentItem->d_ptr->hasTranslateOnlySceneTransform()) {
+ br.translate(parentItem->d_ptr->sceneTransform.dx(), parentItem->d_ptr->sceneTransform.dy());
+ return br;
+ }
+ return parentItem->d_ptr->sceneTransform.mapRect(br);
}
/*!
@@ -4098,7 +4256,7 @@ bool QGraphicsItem::isObscuredBy(const QGraphicsItem *item) const
{
if (!item)
return false;
- return QGraphicsScenePrivate::closestItemFirst_withoutCache(item, this)
+ return QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withoutCache(item, this)
&& qt_QGraphicsItem_isObscured(this, item, boundingRect());
}
@@ -4291,12 +4449,11 @@ bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, bool ignore
{
// No scene, or if the scene is updating everything, means we have nothing
// to do. The only exception is if the scene tracks the growing scene rect.
- return (!visible && !ignoreVisibleBit)
+ return !scene
+ || (!visible && !ignoreVisibleBit && !this->ignoreVisible)
|| (!ignoreDirtyBit && fullUpdatePending)
- || !scene
- || (scene->d_func()->updateAll && scene->d_func()->hasSceneRect)
|| (!ignoreClipping && (childrenClippedToShape() && isClippedAway()))
- || (!ignoreOpacity && childrenCombineOpacity() && isFullyTransparent());
+ || (!ignoreOpacity && !this->ignoreOpacity && childrenCombineOpacity() && isFullyTransparent());
}
/*!
@@ -4317,6 +4474,7 @@ void QGraphicsItemPrivate::resolveDepth(int parentDepth)
void QGraphicsItemPrivate::addChild(QGraphicsItem *child)
{
needSortChildren = 1;
+ child->d_ptr->siblingIndex = children.size();
children.append(child);
}
@@ -4326,6 +4484,10 @@ void QGraphicsItemPrivate::addChild(QGraphicsItem *child)
void QGraphicsItemPrivate::removeChild(QGraphicsItem *child)
{
children.removeOne(child);
+ // NB! Do not use children.removeAt(child->d_ptr->siblingIndex) because
+ // the child is not guaranteed to be at the index after the list is sorted.
+ // (see ensureSortedChildren()).
+ child->d_ptr->siblingIndex = -1;
}
/*!
@@ -4486,9 +4648,22 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost
}
// COMBINE my transform with the parent's scene transform.
- sceneTransform = parent ? parent->d_ptr->sceneTransform : QTransform();
- combineTransformFromParent(&sceneTransform);
- dirtySceneTransform = 0;
+ updateSceneTransformFromParent();
+ Q_ASSERT(!dirtySceneTransform);
+}
+
+void QGraphicsItemPrivate::ensureSceneTransform()
+{
+ if (dirtySceneTransform) {
+ // This item and all its descendants have dirty scene transforms.
+ // We're about to validate this item's scene transform, so we have to
+ // invalidate all the children; otherwise there's no way for the descendants
+ // to detect that the ancestor has changed.
+ invalidateChildrenSceneTransform();
+ }
+
+ QGraphicsItem *that = q_func();
+ ensureSceneTransformRecursive(&that);
}
/*!
@@ -4829,7 +5004,9 @@ QPointF QGraphicsItem::mapToParent(const QPointF &point) const
*/
QPointF QGraphicsItem::mapToScene(const QPointF &point) const
{
- return sceneTransform().map(point);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return QPointF(point.x() + d_ptr->sceneTransform.dx(), point.y() + d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.map(point);
}
/*!
@@ -4896,7 +5073,9 @@ QPolygonF QGraphicsItem::mapToParent(const QRectF &rect) const
*/
QPolygonF QGraphicsItem::mapToScene(const QRectF &rect) const
{
- return sceneTransform().map(rect);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return rect.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.map(rect);
}
/*!
@@ -4969,7 +5148,9 @@ QRectF QGraphicsItem::mapRectToParent(const QRectF &rect) const
*/
QRectF QGraphicsItem::mapRectToScene(const QRectF &rect) const
{
- return sceneTransform().mapRect(rect);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return rect.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.mapRect(rect);
}
/*!
@@ -5043,7 +5224,9 @@ QRectF QGraphicsItem::mapRectFromParent(const QRectF &rect) const
*/
QRectF QGraphicsItem::mapRectFromScene(const QRectF &rect) const
{
- return sceneTransform().inverted().mapRect(rect);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return rect.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.inverted().mapRect(rect);
}
/*!
@@ -5095,7 +5278,9 @@ QPolygonF QGraphicsItem::mapToParent(const QPolygonF &polygon) const
*/
QPolygonF QGraphicsItem::mapToScene(const QPolygonF &polygon) const
{
- return sceneTransform().map(polygon);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return polygon.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.map(polygon);
}
/*!
@@ -5140,7 +5325,9 @@ QPainterPath QGraphicsItem::mapToParent(const QPainterPath &path) const
*/
QPainterPath QGraphicsItem::mapToScene(const QPainterPath &path) const
{
- return sceneTransform().map(path);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return path.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.map(path);
}
/*!
@@ -5201,7 +5388,9 @@ QPointF QGraphicsItem::mapFromParent(const QPointF &point) const
*/
QPointF QGraphicsItem::mapFromScene(const QPointF &point) const
{
- return sceneTransform().inverted().map(point);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return QPointF(point.x() - d_ptr->sceneTransform.dx(), point.y() - d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.inverted().map(point);
}
/*!
@@ -5269,7 +5458,9 @@ QPolygonF QGraphicsItem::mapFromParent(const QRectF &rect) const
*/
QPolygonF QGraphicsItem::mapFromScene(const QRectF &rect) const
{
- return sceneTransform().inverted().map(rect);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return rect.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.inverted().map(rect);
}
/*!
@@ -5319,7 +5510,9 @@ QPolygonF QGraphicsItem::mapFromParent(const QPolygonF &polygon) const
*/
QPolygonF QGraphicsItem::mapFromScene(const QPolygonF &polygon) const
{
- return sceneTransform().inverted().map(polygon);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return polygon.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.inverted().map(polygon);
}
/*!
@@ -5362,7 +5555,9 @@ QPainterPath QGraphicsItem::mapFromParent(const QPainterPath &path) const
*/
QPainterPath QGraphicsItem::mapFromScene(const QPainterPath &path) const
{
- return sceneTransform().inverted().map(path);
+ if (d_ptr->hasTranslateOnlySceneTransform())
+ return path.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
+ return d_ptr->sceneTransform.inverted().map(path);
}
/*!
@@ -6251,102 +6446,6 @@ QVariant QGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const
}
/*!
- \since 4.6
-
- Subscribes the graphics item to the specified \a gesture type.
-
- Returns the id of the gesture.
-
- \sa releaseGesture(), setGestureEnabled()
-*/
-int QGraphicsItem::grabGesture(Qt::GestureType gesture)
-{
- /// TODO: if we are QGraphicsProxyWidget we should subscribe the widget to gesture as well.
- return grabGesture(qt_getStandardGestureTypeName(gesture));
-}
-
-/*!
- \since 4.6
-
- Subscribes the graphics item to the specified \a gesture type.
-
- Returns the id of the gesture.
-
- \sa releaseGesture(), setGestureEnabled()
-*/
-int QGraphicsItem::grabGesture(const QString &gesture)
-{
- int id = QGestureManager::instance()->makeGestureId(gesture);
- d_ptr->grabGesture(id);
- return id;
-}
-
-void QGraphicsItemPrivate::grabGesture(int id)
-{
- Q_Q(QGraphicsItem);
- extraGestures()->gestures << id;
- if (scene)
- scene->d_func()->grabGesture(q, id);
-}
-
-bool QGraphicsItemPrivate::releaseGesture(int id)
-{
- Q_Q(QGraphicsItem);
- QGestureExtraData *extra = maybeExtraGestures();
- if (extra && extra->gestures.contains(id)) {
- if (scene)
- scene->d_func()->releaseGesture(q, id);
- extra->gestures.remove(id);
- return true;
- }
- return false;
-}
-
-/*!
- \since 4.6
-
- Unsubscribes the graphics item from a gesture, which is specified
- by the \a gestureId.
-
- \sa grabGesture(), setGestureEnabled()
-*/
-void QGraphicsItem::releaseGesture(int gestureId)
-{
- /// TODO: if we are QGraphicsProxyWidget we should unsubscribe the widget from gesture as well.
- if (d_ptr->releaseGesture(gestureId))
- QGestureManager::instance()->releaseGestureId(gestureId);
-}
-
-/*!
- \since 4.6
-
- If \a enable is true, the gesture with the given \a gestureId is
- enabled; otherwise the gesture is disabled.
-
- The id of the gesture is returned by the grabGesture().
-
- \sa grabGesture(), releaseGesture()
-*/
-void QGraphicsItem::setGestureEnabled(int gestureId, bool enable)
-{
- //###
-}
-
-bool QGraphicsItemPrivate::hasGesture(const QString &name) const
-{
- if (QGestureExtraData *extra = maybeExtraGestures()) {
- QGestureManager *gm = QGestureManager::instance();
- QSet<int>::const_iterator it = extra->gestures.begin(),
- e = extra->gestures.end();
- for (; it != e; ++it) {
- if (gm->gestureNameFromId(*it) == name)
- return true;
- }
- }
- return false;
-}
-
-/*!
This virtual function is called by QGraphicsItem to notify custom items
that some part of the item's state changes. By reimplementing this
function, your can react to a change, and in some cases, (depending on \a
@@ -6370,23 +6469,6 @@ bool QGraphicsItemPrivate::hasGesture(const QString &name) const
QVariant QGraphicsItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
Q_UNUSED(change);
- if (change == QGraphicsItem::ItemSceneChange) {
- QGestureExtraData *extra = d_ptr->maybeExtraGestures();
- if (!qVariantValue<QGraphicsScene*>(value) && extra) {
- // the item has been removed from a scene, unsubscribe gestures.
- Q_ASSERT(d_ptr->scene);
- foreach(int id, extra->gestures)
- d_ptr->scene->d_func()->releaseGesture(this, id);
- }
- } else if (change == QGraphicsItem::ItemSceneHasChanged) {
- QGraphicsScene *scene = qVariantValue<QGraphicsScene*>(value);
- QGestureExtraData *extra = d_ptr->maybeExtraGestures();
- if (scene && extra) {
- // item has been added to the scene
- foreach(int id, extra->gestures)
- scene->d_func()->grabGesture(this, id);
- }
- }
return value;
}
@@ -6440,7 +6522,7 @@ void QGraphicsItem::addToIndex()
return;
}
if (d_ptr->scene)
- d_ptr->scene->d_func()->addToIndex(this);
+ d_ptr->scene->d_func()->index->addItem(this);
}
/*!
@@ -6457,7 +6539,7 @@ void QGraphicsItem::removeFromIndex()
return;
}
if (d_ptr->scene)
- d_ptr->scene->d_func()->removeFromIndex(this);
+ d_ptr->scene->d_func()->index->removeItem(this);
}
/*!
@@ -6476,10 +6558,12 @@ void QGraphicsItem::removeFromIndex()
void QGraphicsItem::prepareGeometryChange()
{
if (d_ptr->scene) {
+ d_ptr->scene->d_func()->dirtyGrowingItemsBoundingRect = true;
d_ptr->geometryChanged = 1;
d_ptr->paintedViewBoundingRectsNeedRepaint = 1;
QGraphicsScenePrivate *scenePrivate = d_ptr->scene->d_func();
+ scenePrivate->index->prepareBoundingRectChange(this);
scenePrivate->markDirty(this, QRectF(),
/*invalidateChildren=*/true,
/*maybeDirtyClipPath=*/!d_ptr->inSetPosHelper);
@@ -6490,10 +6574,13 @@ void QGraphicsItem::prepareGeometryChange()
// _q_processDirtyItems is called before _q_emitUpdated.
if ((scenePrivate->connectedSignals & scenePrivate->changedSignalMask)
|| scenePrivate->views.isEmpty()) {
- d_ptr->scene->update(sceneTransform().mapRect(boundingRect()));
+ if (d_ptr->hasTranslateOnlySceneTransform()) {
+ d_ptr->scene->update(boundingRect().translated(d_ptr->sceneTransform.dx(),
+ d_ptr->sceneTransform.dy()));
+ } else {
+ d_ptr->scene->update(d_ptr->sceneTransform.mapRect(boundingRect()));
+ }
}
-
- scenePrivate->removeFromIndex(this);
}
QGraphicsItem *parent = this;
@@ -9743,13 +9830,10 @@ QVariant QGraphicsSimpleTextItem::extension(const QVariant &variant) const
setParentItem().
The boundingRect() function of QGraphicsItemGroup returns the
- bounding rectangle of all items in the item group. In addition,
- item groups have handlesChildEvents() enabled by default, so all
- events sent to a member of the group go to the item group (i.e.,
- selecting one item in a group will select them all).
- QGraphicsItemGroup ignores the ItemIgnoresTransformations flag on its
- children (i.e., with respect to the geometry of the group item, the
- children are treated as if they were transformable).
+ bounding rectangle of all items in the item group.
+ QGraphicsItemGroup ignores the ItemIgnoresTransformations flag on
+ its children (i.e., with respect to the geometry of the group
+ item, the children are treated as if they were transformable).
There are two ways to construct an item group. The easiest and
most common approach is to pass a list of items (e.g., all
@@ -9939,17 +10023,11 @@ QDebug operator<<(QDebug debug, QGraphicsItem *item)
return debug;
}
- QStringList flags;
- if (item->isVisible()) flags << QLatin1String("isVisible");
- if (item->isEnabled()) flags << QLatin1String("isEnabled");
- if (item->isSelected()) flags << QLatin1String("isSelected");
- if (item->hasFocus()) flags << QLatin1String("HasFocus");
-
debug << "QGraphicsItem(this =" << ((void*)item)
<< ", parent =" << ((void*)item->parentItem())
<< ", pos =" << item->pos()
- << ", z =" << item->zValue() << ", flags = {"
- << flags.join(QLatin1String("|")) << " })";
+ << ", z =" << item->zValue() << ", flags = "
+ << item->flags() << ")";
return debug;
}
@@ -10083,6 +10161,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag)
case QGraphicsItem::ItemSendsGeometryChanges:
str = "ItemSendsGeometryChanges";
break;
+ case QGraphicsItem::ItemAcceptsInputMethod:
+ str = "ItemAcceptsInputMethod";
+ break;
}
debug << str;
return debug;
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index ac77dc2..fef09f0 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -99,7 +99,8 @@ public:
ItemStacksBehindParent = 0x100,
ItemUsesExtendedStyleOption = 0x200,
ItemHasNoContents = 0x400,
- ItemSendsGeometryChanges = 0x800
+ ItemSendsGeometryChanges = 0x800,
+ ItemAcceptsInputMethod = 0x1000
// NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag.
};
Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag)
@@ -142,7 +143,7 @@ public:
QGraphicsItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -209,13 +210,16 @@ public:
Qt::MouseButtons acceptedMouseButtons() const;
void setAcceptedMouseButtons(Qt::MouseButtons buttons);
- bool acceptsHoverEvents() const; // obsolete
- void setAcceptsHoverEvents(bool enabled); // obsolete
+ bool acceptsHoverEvents() const; // ### obsolete
+ void setAcceptsHoverEvents(bool enabled); // ### obsolete
bool acceptHoverEvents() const;
void setAcceptHoverEvents(bool enabled);
bool acceptTouchEvents() const;
void setAcceptTouchEvents(bool enabled);
+ bool filtersChildEvents() const;
+ void setFiltersChildEvents(bool enabled);
+
bool handlesChildEvents() const;
void setHandlesChildEvents(bool enabled);
@@ -223,6 +227,9 @@ public:
void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason);
void clearFocus();
+ QGraphicsItem *focusProxy() const;
+ void setFocusProxy(QGraphicsItem *item);
+
void grabMouse();
void ungrabMouse();
void grabKeyboard();
@@ -380,11 +387,6 @@ public:
QVariant data(int key) const;
void setData(int key, const QVariant &value);
- int grabGesture(Qt::GestureType gesture);
- int grabGesture(const QString &gesture);
- void releaseGesture(int gestureId);
- void setGestureEnabled(int gestureId, bool enable = true);
-
enum {
Type = 1,
UserType = 65536
@@ -442,11 +444,16 @@ private:
friend class QGraphicsScene;
friend class QGraphicsScenePrivate;
friend class QGraphicsSceneFindItemBspTreeVisitor;
+ friend class QGraphicsSceneBspTree;
friend class QGraphicsView;
friend class QGraphicsViewPrivate;
friend class QGraphicsWidget;
friend class QGraphicsWidgetPrivate;
friend class QGraphicsProxyWidgetPrivate;
+ friend class QGraphicsSceneIndex;
+ friend class QGraphicsSceneIndexPrivate;
+ friend class QGraphicsSceneBspTreeIndex;
+ friend class QGraphicsSceneBspTreeIndexPrivate;
friend class ::tst_QGraphicsItem;
friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *);
friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *);
@@ -538,7 +545,7 @@ class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem
public:
QAbstractGraphicsShapeItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -568,13 +575,13 @@ class Q_GUI_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem
public:
QGraphicsPathItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -611,19 +618,19 @@ class Q_GUI_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem
public:
QGraphicsRectItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -664,19 +671,19 @@ class Q_GUI_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem
public:
QGraphicsEllipseItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -723,14 +730,14 @@ class Q_GUI_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem
public:
QGraphicsPolygonItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsPolygonItem(const QPolygonF &polygon,
QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -770,19 +777,19 @@ class Q_GUI_EXPORT QGraphicsLineItem : public QGraphicsItem
public:
QGraphicsLineItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -830,13 +837,13 @@ public:
QGraphicsPixmapItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -892,13 +899,13 @@ class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject
public:
QGraphicsTextItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsTextItem(const QString &text, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -993,13 +1000,13 @@ class Q_GUI_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem
public:
QGraphicsSimpleTextItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
@@ -1039,7 +1046,7 @@ class Q_GUI_EXPORT QGraphicsItemGroup : public QGraphicsItem
public:
QGraphicsItemGroup(QGraphicsItem *parent = 0
#ifndef Q_QDOC
- // obsolete argument
+ // ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 15b9ab6..3d9f8a6 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -93,12 +93,6 @@ public:
void purge();
};
-class QGestureExtraData
-{
-public:
- QSet<int> gestures;
-};
-
class Q_AUTOTEST_EXPORT QGraphicsItemPrivate
{
Q_DECLARE_PUBLIC(QGraphicsItem)
@@ -108,15 +102,15 @@ public:
ExtraCursor,
ExtraCacheData,
ExtraMaxDeviceCoordCacheSize,
- ExtraBoundingRegionGranularity,
- ExtraGestures
+ ExtraBoundingRegionGranularity
};
enum AncestorFlag {
NoFlag = 0,
AncestorHandlesChildEvents = 0x1,
AncestorClipsChildren = 0x2,
- AncestorIgnoresTransformations = 0x4
+ AncestorIgnoresTransformations = 0x4,
+ AncestorFiltersChildEvents = 0x8
};
inline QGraphicsItemPrivate()
@@ -126,7 +120,9 @@ public:
parent(0),
transformData(0),
index(-1),
+ siblingIndex(-1),
depth(0),
+ focusProxy(0),
acceptedMouseButtons(0x1f),
visible(1),
explicitlyHidden(0),
@@ -156,13 +152,15 @@ public:
dirtyChildrenBoundingRect(1),
paintedViewBoundingRectsNeedRepaint(0),
dirtySceneTransform(1),
- geometryChanged(0),
+ geometryChanged(1),
inDestructor(0),
isObject(0),
ignoreVisible(0),
ignoreOpacity(0),
acceptTouchEvents(0),
acceptedTouchBeginEvent(0),
+ filtersDescendantEvents(0),
+ sceneTransformTranslateOnly(0),
globalStackingOrder(-1),
q_ptr(0)
{
@@ -171,6 +169,15 @@ public:
inline virtual ~QGraphicsItemPrivate()
{ }
+ static const QGraphicsItemPrivate *get(const QGraphicsItem *item)
+ {
+ return item->d_ptr;
+ }
+ static QGraphicsItemPrivate *get(QGraphicsItem *item)
+ {
+ return item->d_ptr;
+ }
+
void updateAncestorFlag(QGraphicsItem::GraphicsItemFlag childFlag,
AncestorFlag flag = NoFlag, bool enabled = false, bool root = true);
void setIsMemberOfGroup(bool enabled);
@@ -184,6 +191,7 @@ public:
void combineTransformToParent(QTransform *x, const QTransform *viewTransform = 0) const;
void combineTransformFromParent(QTransform *x, const QTransform *viewTransform = 0) const;
+ void updateSceneTransformFromParent();
// ### Qt 5: Remove. Workaround for reimplementation added after Qt 4.4.
virtual QVariant inputMethodQueryHelper(Qt::InputMethodQuery query) const;
@@ -293,6 +301,13 @@ public:
void invalidateCachedClipPathRecursively(bool childrenOnly = false, const QRectF &emptyIfOutsideThisRect = QRectF());
void updateCachedClipPathFromSetPosHelper(const QPointF &newPos);
void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem);
+ void ensureSceneTransform();
+
+ inline bool hasTranslateOnlySceneTransform()
+ {
+ ensureSceneTransform();
+ return sceneTransformTranslateOnly;
+ }
inline void invalidateChildrenSceneTransform()
{
@@ -377,6 +392,7 @@ public:
}
inline QTransform transformToParent() const;
+ inline void ensureSortedChildren();
QPainterPath cachedClipPath;
QRectF childrenBoundingRect;
@@ -392,31 +408,9 @@ public:
TransformData *transformData;
QTransform sceneTransform;
int index;
+ int siblingIndex;
int depth;
-
- inline QGestureExtraData* extraGestures() const
- {
- QGestureExtraData *c = (QGestureExtraData *)qVariantValue<void *>(extra(ExtraGestures));
- if (!c) {
- QGraphicsItemPrivate *that = const_cast<QGraphicsItemPrivate *>(this);
- c = new QGestureExtraData;
- that->setExtra(ExtraGestures, qVariantFromValue<void *>(c));
- }
- return c;
- }
- QGestureExtraData* maybeExtraGestures() const
- {
- return (QGestureExtraData *)qVariantValue<void *>(extra(ExtraGestures));
- }
- inline void removeExtraGestures()
- {
- QGestureExtraData *c = (QGestureExtraData *)qVariantValue<void *>(extra(ExtraGestures));
- delete c;
- unsetExtra(ExtraGestures);
- }
- bool hasGesture(const QString &gesture) const;
- void grabGesture(int id);
- bool releaseGesture(int id);
+ QGraphicsItem *focusProxy;
// Packed 32 bytes
quint32 acceptedMouseButtons : 5;
@@ -431,7 +425,7 @@ public:
quint32 handlesChildEvents : 1;
quint32 itemDiscovered : 1;
quint32 hasCursor : 1;
- quint32 ancestorFlags : 3;
+ quint32 ancestorFlags : 4;
quint32 cacheMode : 2;
quint32 hasBoundingRegionGranularity : 1;
quint32 isWidget : 1;
@@ -443,13 +437,13 @@ public:
quint32 inSetPosHelper : 1;
quint32 needSortChildren : 1;
quint32 allChildrenDirty : 1;
- quint32 fullUpdatePending : 1;
// New 32 bits
- quint32 flags : 12;
+ quint32 fullUpdatePending : 1;
+ quint32 flags : 13;
quint32 dirtyChildrenBoundingRect : 1;
quint32 paintedViewBoundingRectsNeedRepaint : 1;
- quint32 dirtySceneTransform : 1;
+ quint32 dirtySceneTransform : 1;
quint32 geometryChanged : 1;
quint32 inDestructor : 1;
quint32 isObject : 1;
@@ -457,7 +451,9 @@ public:
quint32 ignoreOpacity : 1;
quint32 acceptTouchEvents : 1;
quint32 acceptedTouchBeginEvent : 1;
- quint32 unused : 10; // feel free to use
+ quint32 filtersDescendantEvents : 1;
+ quint32 sceneTransformTranslateOnly : 1;
+ quint32 unused : 6; // feel free to use
// Optional stacking order
int globalStackingOrder;
@@ -488,6 +484,10 @@ struct QGraphicsItemPrivate::TransformData {
if (onlyTransform) {
if (!postmultiplyTransform)
return transform;
+ if (postmultiplyTransform->isIdentity())
+ return transform;
+ if (transform.isIdentity())
+ return *postmultiplyTransform;
QTransform x(transform);
x *= *postmultiplyTransform;
return x;
@@ -508,6 +508,29 @@ struct QGraphicsItemPrivate::TransformData {
}
};
+/*!
+ \internal
+*/
+inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
+{
+ // Return true if sibling item1 is on top of item2.
+ const QGraphicsItemPrivate *d1 = item1->d_ptr;
+ const QGraphicsItemPrivate *d2 = item2->d_ptr;
+ bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent;
+ bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent;
+ if (f1 != f2)
+ return f2;
+ if (d1->z != d2->z)
+ return d1->z > d2->z;
+ return d1->siblingIndex > d2->siblingIndex;
+}
+
+/*!
+ \internal
+*/
+static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
+{ return qt_closestLeaf(item2, item1); }
+
/*
return the full transform of the item to the parent. This include the position and all the transform data
*/
@@ -518,6 +541,14 @@ inline QTransform QGraphicsItemPrivate::transformToParent() const
return matrix;
}
+inline void QGraphicsItemPrivate::ensureSortedChildren()
+{
+ if (needSortChildren) {
+ qSort(children.begin(), children.end(), qt_notclosestLeaf);
+ needSortChildren = 0;
+ }
+}
+
QT_END_NAMESPACE
#endif // QT_NO_GRAPHICSVIEW
diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp
index 0fe648e..acf591a 100644
--- a/src/gui/graphicsview/qgraphicslayoutitem.cpp
+++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp
@@ -807,6 +807,8 @@ bool QGraphicsLayoutItem::isLayout() const
}
/*!
+ \since 4.6
+
Returns whether a layout should delete this item in its destructor.
If its true, then the layout will delete it. If its false, then it is
assumed that another object has the ownership of it, and the layout won't
@@ -833,6 +835,8 @@ bool QGraphicsLayoutItem::ownedByLayout() const
return d_func()->ownedByLayout;
}
/*!
+ \since 4.6
+
Sets whether a layout should delete this item in its destructor or not.
\a ownership must be true to in order for the layout to delete it.
\sa ownedByLayout()
diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp
index ab94679..5fac6cf 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp
@@ -48,7 +48,6 @@
#include "private/qgraphicsproxywidget_p.h"
#include "private/qwidget_p.h"
#include "private/qapplication_p.h"
-#include "private/qgesturemanager_p.h"
#include <QtCore/qdebug.h>
#include <QtGui/qevent.h>
@@ -452,6 +451,22 @@ void QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget()
/*!
\internal
+*/
+void QGraphicsProxyWidgetPrivate::updateProxyInputMethodAcceptanceFromWidget()
+{
+ Q_Q(QGraphicsProxyWidget);
+ if (!widget)
+ return;
+
+ QWidget *focusWidget = widget->focusWidget();
+ if (!focusWidget)
+ focusWidget = widget;
+ q->setFlag(QGraphicsItem::ItemAcceptsInputMethod,
+ focusWidget->testAttribute(Qt::WA_InputMethodEnabled));
+}
+
+/*!
+ \internal
Embeds \a subWin as a subwindow of this proxy widget. \a subWin must be a top-level
widget and a descendant of the widget managed by this proxy. A separate subproxy
@@ -649,9 +664,6 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto
q->setAttribute(Qt::WA_OpaquePaintEvent);
widget = newWidget;
- foreach(int gestureId, widget->d_func()->gestures) {
- grabGesture(gestureId);
- }
// Changes only go from the widget to the proxy.
enabledChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode;
@@ -694,6 +706,8 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto
updateProxyGeometryFromWidget();
+ updateProxyInputMethodAcceptanceFromWidget();
+
// Hook up the event filter to keep the state up to date.
newWidget->installEventFilter(q);
QObject::connect(newWidget, SIGNAL(destroyed()), q, SLOT(_q_removeWidgetSlot()));
@@ -875,16 +889,6 @@ bool QGraphicsProxyWidget::event(QEvent *event)
}
break;
}
- case QEvent::GraphicsSceneGesture: {
- qDebug() << "QGraphicsProxyWidget: graphicsscenegesture";
- if (d->widget && d->widget->isVisible()) {
- QGraphicsSceneGestureEvent *ge = static_cast<QGraphicsSceneGestureEvent*>(event);
- //### TODO: widget->childAt(): decompose gesture event and find widget under hotspots.
- //QGestureManager::instance()->sendGestureEvent(d->widget, ge->gestures().toSet(), ge->cancelledGestures());
- return true;
- }
- break;
- }
default:
break;
}
@@ -1317,8 +1321,8 @@ void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event)
if (d->widget && d->widget->focusWidget()) {
d->widget->focusWidget()->setFocus(event->reason());
return;
- }
- break;
+ }
+ break;
}
}
diff --git a/src/gui/graphicsview/qgraphicsproxywidget_p.h b/src/gui/graphicsview/qgraphicsproxywidget_p.h
index ec5400a..fbc9f6c 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget_p.h
+++ b/src/gui/graphicsview/qgraphicsproxywidget_p.h
@@ -102,6 +102,8 @@ public:
void updateWidgetGeometryFromProxy();
void updateProxyGeometryFromWidget();
+ void updateProxyInputMethodAcceptanceFromWidget();
+
QPointF mapToReceiver(const QPointF &pos, const QWidget *receiver) const;
enum ChangeMode {
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 13d3bd6..d721d0d 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
/*!
\class QGraphicsScene
\brief The QGraphicsScene class provides a surface for managing a large
@@ -218,6 +217,9 @@
#include "qgraphicsview_p.h"
#include "qgraphicswidget.h"
#include "qgraphicswidget_p.h"
+#include "qgraphicssceneindex_p.h"
+#include "qgraphicsscenebsptreeindex_p.h"
+#include "qgraphicsscenelinearindex_p.h"
#include <QtCore/qdebug.h>
#include <QtCore/qlist.h>
@@ -242,77 +244,15 @@
#include <QtGui/qtooltip.h>
#include <QtGui/qtransform.h>
#include <QtGui/qgesture.h>
+#include <QtGui/qinputcontext.h>
#include <private/qapplication_p.h>
#include <private/qobject_p.h>
#ifdef Q_WS_X11
#include <private/qt_x11_p.h>
#endif
-#include <private/qgesturemanager_p.h>
-#include <private/qgesture_p.h>
QT_BEGIN_NAMESPACE
-static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2);
-
-static inline bool QRectF_intersects(const QRectF &s, const QRectF &r)
-{
- qreal xp = s.left();
- qreal yp = s.top();
- qreal w = s.width();
- qreal h = s.height();
- qreal l1 = xp;
- qreal r1 = xp;
- if (w < 0)
- l1 += w;
- else
- r1 += w;
-
- qreal l2 = r.left();
- qreal r2 = r.left();
- if (w < 0)
- l2 += r.width();
- else
- r2 += r.width();
-
- if (l1 >= r2 || l2 >= r1)
- return false;
-
- qreal t1 = yp;
- qreal b1 = yp;
- if (h < 0)
- t1 += h;
- else
- b1 += h;
-
- qreal t2 = r.top();
- qreal b2 = r.top();
- if (r.height() < 0)
- t2 += r.height();
- else
- b2 += r.height();
-
- return !(t1 >= b2 || t2 >= b1);
-}
-
-// QRectF::intersects() returns false always if either the source or target
-// rectangle's width or height are 0. This works around that problem.
-static inline void _q_adjustRect(QRectF *rect)
-{
- Q_ASSERT(rect);
- if (!rect->width())
- rect->adjust(-0.00001, 0, 0.00001, 0);
- if (!rect->height())
- rect->adjust(0, -0.00001, 0, 0.00001);
-}
-
-static inline QRectF adjustedItemBoundingRect(const QGraphicsItem *item)
-{
- Q_ASSERT(item);
- QRectF boundingRect(item->boundingRect());
- _q_adjustRect(&boundingRect);
- return boundingRect;
-}
-
static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraphicsSceneMouseEvent *mouseEvent)
{
hover->setWidget(mouseEvent->widget());
@@ -332,18 +272,15 @@ static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraph
QGraphicsScenePrivate::QGraphicsScenePrivate()
: changedSignalMask(0),
indexMethod(QGraphicsScene::BspTreeIndex),
- bspTreeDepth(0),
+ index(0),
lastItemCount(0),
hasSceneRect(false),
+ dirtyGrowingItemsBoundingRect(true),
updateAll(false),
calledEmitUpdated(false),
processDirtyItemsEmitted(false),
selectionChanging(0),
needSortTopLevelItems(true),
- regenerateIndex(true),
- purgePending(false),
- indexTimerId(0),
- restartIndexTimer(false),
stickyFocus(false),
hasFocus(false),
focusItem(0),
@@ -360,7 +297,6 @@ QGraphicsScenePrivate::QGraphicsScenePrivate()
allItemsUseDefaultCursor(true),
painterStateProtection(true),
sortCacheEnabled(false),
- updatingSortCache(false),
style(0),
allItemsIgnoreTouchEvents(true)
{
@@ -373,6 +309,8 @@ void QGraphicsScenePrivate::init()
{
Q_Q(QGraphicsScene);
+ index = new QGraphicsSceneBspTreeIndex(q);
+
// Keep this index so we can check for connected slots later on.
changedSignalMask = (1 << q->metaObject()->indexOfSignal("changed(QList<QRectF>)"));
qApp->d_func()->scene_list.append(q);
@@ -382,224 +320,26 @@ void QGraphicsScenePrivate::init()
/*!
\internal
*/
-QList<QGraphicsItem *> QGraphicsScenePrivate::estimateItemsInRect(const QRectF &rect) const
-{
- const_cast<QGraphicsScenePrivate *>(this)->purgeRemovedItems();
- const_cast<QGraphicsScenePrivate *>(this)->_q_updateSortCache();
-
- if (indexMethod == QGraphicsScene::BspTreeIndex) {
- // ### Only do this once in a while.
- QGraphicsScenePrivate *that = const_cast<QGraphicsScenePrivate *>(this);
-
- // Get items from BSP tree
- QList<QGraphicsItem *> items = that->bspTree.items(rect);
-
- // Fill in with any unindexed items
- for (int i = 0; i < unindexedItems.size(); ++i) {
- if (QGraphicsItem *item = unindexedItems.at(i)) {
- if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) {
- QRectF boundingRect = item->sceneBoundingRect();
- if (QRectF_intersects(boundingRect, rect)) {
- item->d_ptr->itemDiscovered = 1;
- items << item;
- }
- }
- }
- }
-
- // Reset the discovered state of all discovered items
- for (int i = 0; i < items.size(); ++i)
- items.at(i)->d_func()->itemDiscovered = 0;
- return items;
- }
-
- QList<QGraphicsItem *> itemsInRect;
- for (int i = 0; i < unindexedItems.size(); ++i) {
- if (QGraphicsItem *item = unindexedItems.at(i)) {
- if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
- continue;
- if (item->d_ptr->visible && !item->d_ptr->isFullyTransparent())
- itemsInRect << item;
- }
- }
- for (int i = 0; i < indexedItems.size(); ++i) {
- if (QGraphicsItem *item = indexedItems.at(i)) {
- if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
- continue;
- if (item->d_ptr->visible && !item->d_ptr->isFullyTransparent())
- itemsInRect << item;
- }
- }
-
- return itemsInRect;
-}
-
-/*!
- \internal
-*/
-void QGraphicsScenePrivate::addToIndex(QGraphicsItem *item)
+QGraphicsScenePrivate *QGraphicsScenePrivate::get(QGraphicsScene *q)
{
- if (indexMethod == QGraphicsScene::BspTreeIndex) {
- if (item->d_func()->index != -1) {
- bspTree.insertItem(item, item->sceneBoundingRect());
- foreach (QGraphicsItem *child, item->children())
- child->addToIndex();
- } else {
- // The BSP tree is regenerated if the number of items grows to a
- // certain threshold, or if the bounding rect of the graph doubles in
- // size.
- startIndexTimer();
- }
- }
+ return q->d_func();
}
-/*!
- \internal
-*/
-void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item)
-{
- if (indexMethod == QGraphicsScene::BspTreeIndex) {
- int index = item->d_func()->index;
- if (index != -1) {
- bspTree.removeItem(item, item->sceneBoundingRect());
- freeItemIndexes << index;
- indexedItems[index] = 0;
- item->d_func()->index = -1;
- unindexedItems << item;
-
- foreach (QGraphicsItem *child, item->children())
- child->removeFromIndex();
- }
-
- startIndexTimer();
- }
-}
-
-/*!
- \internal
-*/
-void QGraphicsScenePrivate::resetIndex()
-{
- purgeRemovedItems();
- if (indexMethod == QGraphicsScene::BspTreeIndex) {
- for (int i = 0; i < indexedItems.size(); ++i) {
- if (QGraphicsItem *item = indexedItems.at(i)) {
- item->d_ptr->index = -1;
- unindexedItems << item;
- }
- }
- indexedItems.clear();
- freeItemIndexes.clear();
- regenerateIndex = true;
- startIndexTimer();
- }
-}
-
-static inline int intmaxlog(int n)
-{
- return (n > 0 ? qMax(qCeil(qLn(qreal(n)) / qLn(qreal(2))), 5) : 0);
-}
-
-/*!
- \internal
-*/
-void QGraphicsScenePrivate::_q_updateIndex()
+void QGraphicsScenePrivate::_q_emitUpdated()
{
- if (!indexTimerId)
- return;
-
Q_Q(QGraphicsScene);
- q->killTimer(indexTimerId);
- indexTimerId = 0;
-
- purgeRemovedItems();
-
- // Add unindexedItems to indexedItems
- QRectF unindexedItemsBoundingRect;
- for (int i = 0; i < unindexedItems.size(); ++i) {
- if (QGraphicsItem *item = unindexedItems.at(i)) {
- unindexedItemsBoundingRect |= item->sceneBoundingRect();
- if (!freeItemIndexes.isEmpty()) {
- int freeIndex = freeItemIndexes.takeFirst();
- item->d_func()->index = freeIndex;
- indexedItems[freeIndex] = item;
- } else {
- item->d_func()->index = indexedItems.size();
- indexedItems << item;
- }
- }
- }
-
- // Update growing scene rect.
- QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect;
- growingItemsBoundingRect |= unindexedItemsBoundingRect;
-
- // Determine whether we should regenerate the BSP tree.
- if (indexMethod == QGraphicsScene::BspTreeIndex) {
- int depth = bspTreeDepth;
- if (depth == 0) {
- int oldDepth = intmaxlog(lastItemCount);
- depth = intmaxlog(indexedItems.size());
- static const int slack = 100;
- if (bspTree.leafCount() == 0 || (oldDepth != depth && qAbs(lastItemCount - indexedItems.size()) > slack)) {
- // ### Crude algorithm.
- regenerateIndex = true;
- }
- }
+ calledEmitUpdated = false;
- // Regenerate the tree.
- if (regenerateIndex) {
- regenerateIndex = false;
- bspTree.initialize(q->sceneRect(), depth);
- unindexedItems = indexedItems;
- lastItemCount = indexedItems.size();
- q->update();
-
- // Take this opportunity to reset our largest-item counter for
- // untransformable items. When the items are inserted into the BSP
- // tree, we'll get an accurate calculation.
- largestUntransformableItem = QRectF();
+ if (dirtyGrowingItemsBoundingRect) {
+ if (!hasSceneRect) {
+ const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect;
+ growingItemsBoundingRect |= q->itemsBoundingRect();
+ if (oldGrowingItemsBoundingRect != growingItemsBoundingRect)
+ emit q->sceneRectChanged(growingItemsBoundingRect);
}
+ dirtyGrowingItemsBoundingRect = false;
}
- // Insert all unindexed items into the tree.
- for (int i = 0; i < unindexedItems.size(); ++i) {
- if (QGraphicsItem *item = unindexedItems.at(i)) {
- QRectF rect = item->sceneBoundingRect();
- if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
- continue;
- if (indexMethod == QGraphicsScene::BspTreeIndex)
- bspTree.insertItem(item, rect);
-
- // If the item ignores view transformations, update our
- // largest-item-counter to ensure that the view can accurately
- // discover untransformable items when drawing.
- if (item->d_ptr->itemIsUntransformable()) {
- QGraphicsItem *topmostUntransformable = item;
- while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags
- & QGraphicsItemPrivate::AncestorIgnoresTransformations)) {
- topmostUntransformable = topmostUntransformable->parentItem();
- }
- // ### Verify that this is the correct largest untransformable rectangle.
- largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect();
- }
- }
- }
- unindexedItems.clear();
-
- // Notify scene rect changes.
- if (!hasSceneRect && growingItemsBoundingRect != oldGrowingItemsBoundingRect)
- emit q->sceneRectChanged(growingItemsBoundingRect);
-}
-
-/*!
- \internal
-*/
-void QGraphicsScenePrivate::_q_emitUpdated()
-{
- Q_Q(QGraphicsScene);
- calledEmitUpdated = false;
-
// Ensure all views are connected if anything is connected. This disables
// the optimization that items send updates directly to the views, but it
// needs to happen in order to keep compatibility with the behavior from
@@ -617,6 +357,9 @@ void QGraphicsScenePrivate::_q_emitUpdated()
updateAll = false;
for (int i = 0; i < views.size(); ++i)
views.at(i)->d_func()->processPendingUpdates();
+ // It's important that we update all views before we dispatch, hence two for-loops.
+ for (int i = 0; i < views.size(); ++i)
+ views.at(i)->d_func()->dispatchPendingUpdateRequests();
return;
}
@@ -634,6 +377,7 @@ void QGraphicsScenePrivate::_q_emitUpdated()
void QGraphicsScenePrivate::registerTopLevelItem(QGraphicsItem *item)
{
needSortTopLevelItems = true;
+ item->d_ptr->siblingIndex = topLevelItems.size();
topLevelItems.append(item);
}
@@ -643,19 +387,10 @@ void QGraphicsScenePrivate::registerTopLevelItem(QGraphicsItem *item)
void QGraphicsScenePrivate::unregisterTopLevelItem(QGraphicsItem *item)
{
topLevelItems.removeOne(item);
-}
-
-/*!
- \internal
-
- Updates all items in the pending update list. At this point, the list is
- unlikely to contain partially constructed items.
-*/
-void QGraphicsScenePrivate::_q_updateLater()
-{
- foreach (QGraphicsItem *item, pendingUpdateItems)
- item->update();
- pendingUpdateItems.clear();
+ // NB! Do not use topLevelItems.removeAt(item->d_ptr->siblingIndex) because
+ // the item is not guaranteed to be at the index after the list is sorted
+ // (see ensureSortedTopLevelItems()).
+ item->d_ptr->siblingIndex = -1;
}
/*!
@@ -681,9 +416,23 @@ void QGraphicsScenePrivate::_q_processDirtyItems()
{
processDirtyItemsEmitted = false;
+ if (updateAll) {
+ Q_ASSERT(calledEmitUpdated);
+ // No need for further processing (except resetting the dirty states).
+ // The growingItemsBoundingRect is updated in _q_emitUpdated.
+ for (int i = 0; i < topLevelItems.size(); ++i)
+ resetDirtyItem(topLevelItems.at(i), /*recursive=*/true);
+ return;
+ }
+
const bool wasPendingSceneUpdate = calledEmitUpdated;
const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect;
- processDirtyItemsRecursive(0);
+
+ // Process items recursively.
+ for (int i = 0; i < topLevelItems.size(); ++i)
+ processDirtyItemsRecursive(topLevelItems.at(i));
+
+ dirtyGrowingItemsBoundingRect = false;
if (!hasSceneRect && oldGrowingItemsBoundingRect != growingItemsBoundingRect)
emit q_func()->sceneRectChanged(growingItemsBoundingRect);
@@ -701,13 +450,8 @@ void QGraphicsScenePrivate::_q_processDirtyItems()
}
// Immediately dispatch all pending update requests on the views.
- for (int i = 0; i < views.size(); ++i) {
- QWidget *viewport = views.at(i)->d_func()->viewport;
- if (qt_widget_private(viewport)->paintOnScreen())
- QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest);
- else
- QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest);
- }
+ for (int i = 0; i < views.size(); ++i)
+ views.at(i)->d_func()->dispatchPendingUpdateRequests();
}
/*!
@@ -728,22 +472,16 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
// Clear focus on the item to remove any reference in the focusWidget chain.
item->clearFocus();
+
markDirty(item, QRectF(), false, false, false, false, /*removingItemFromScene=*/true);
- if (!item->d_ptr->inDestructor) {
+ if (item->d_ptr->inDestructor) {
+ // The item is actually in its destructor, we call the special method in the index.
+ index->deleteItem(item);
+ } else {
// Can potentially call item->boundingRect() (virtual function), that's why
// we only can call this function if the item is not in its destructor.
- removeFromIndex(item);
- } else if (item->d_ptr->index != -1) {
- // Important: The index is useless until purgeRemovedItems() is called.
- indexedItems[item->d_ptr->index] = (QGraphicsItem *)0;
- if (!purgePending)
- purgePending = true;
- removedItems << item;
- } else {
- // Recently added items are purged immediately. unindexedItems() never
- // contains stale items.
- unindexedItems.removeAll(item);
+ index->removeItem(item);
}
if (!item->d_ptr->inDestructor && item == tabFocusFirst) {
@@ -753,6 +491,13 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
item->d_func()->scene = 0;
+ // Unregister focus proxy.
+ QMultiHash<QGraphicsItem *, QGraphicsItem *>::iterator it = focusProxyReverseMap.find(item);
+ while (it != focusProxyReverseMap.end() && it.key() == item) {
+ it.value()->d_ptr->focusProxy = 0;
+ it = focusProxyReverseMap.erase(it);
+ }
+
// Remove from parent, or unregister from toplevels.
if (QGraphicsItem *parentItem = item->parentItem()) {
if (parentItem->scene()) {
@@ -764,17 +509,6 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
unregisterTopLevelItem(item);
}
- if (!item->d_ptr->inDestructor) {
- // Remove from our item lists.
- int index = item->d_func()->index;
- if (index != -1) {
- freeItemIndexes << index;
- indexedItems[index] = 0;
- } else {
- unindexedItems.removeAll(item);
- }
- }
-
// Reset the mouse grabber and focus item data.
if (item == focusItem)
focusItem = 0;
@@ -794,7 +528,6 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
hoverItems.removeAll(item);
cachedItemsUnderMouse.removeAll(item);
unpolishedItems.removeAll(item);
- pendingUpdateItems.removeAll(item);
resetDirtyItem(item);
//We remove all references of item from the sceneEventFilter arrays
@@ -832,41 +565,54 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
/*!
\internal
-
- Removes stale pointers from all data structures.
*/
-void QGraphicsScenePrivate::purgeRemovedItems()
+void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
+ Qt::FocusReason focusReason)
{
- if (!purgePending && removedItems.isEmpty())
+ Q_Q(QGraphicsScene);
+ if (item == focusItem)
return;
+ if (item && (!(item->flags() & QGraphicsItem::ItemIsFocusable)
+ || !item->isVisible() || !item->isEnabled())) {
+ item = 0;
+ }
- // Remove stale items from the BSP tree.
- if (indexMethod != QGraphicsScene::NoIndex)
- bspTree.removeItems(removedItems);
+ if (item) {
+ q->setFocus(focusReason);
+ if (item == focusItem)
+ return;
+ }
- // Purge this list.
- removedItems.clear();
- freeItemIndexes.clear();
- for (int i = 0; i < indexedItems.size(); ++i) {
- if (!indexedItems.at(i))
- freeItemIndexes << i;
+ if (focusItem) {
+ QFocusEvent event(QEvent::FocusOut, focusReason);
+ lastFocusItem = focusItem;
+ focusItem = 0;
+ sendEvent(lastFocusItem, &event);
+
+ if (lastFocusItem
+ && (lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) {
+ // Reset any visible preedit text
+ QInputMethodEvent imEvent;
+ sendEvent(lastFocusItem, &imEvent);
+
+ // Close any external input method panel
+ for (int i = 0; i < views.size(); ++i)
+ views.at(i)->inputContext()->reset();
+ }
}
- purgePending = false;
-}
-/*!
- \internal
+ if (item) {
+ if (item->isWidget()) {
+ // Update focus child chain.
+ static_cast<QGraphicsWidget *>(item)->d_func()->setFocusWidget();
+ }
- Starts or restarts the timer used for reindexing unindexed items.
-*/
-void QGraphicsScenePrivate::startIndexTimer(int interval)
-{
- Q_Q(QGraphicsScene);
- if (indexTimerId) {
- restartIndexTimer = true;
- } else {
- indexTimerId = q->startTimer(interval);
+ focusItem = item;
+ QFocusEvent event(QEvent::FocusIn, focusReason);
+ sendEvent(item, &event);
}
+
+ updateInputMethodSensitivityInViews();
}
/*!
@@ -1105,41 +851,20 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre
{
Q_Q(const QGraphicsScene);
QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0;
- QList<QGraphicsItem *> items;
- if (view)
- items = view->items(view->viewport()->mapFromGlobal(screenPos));
- else
- items = q->items(scenePos);
- return items;
-}
+ if (!view)
+ return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder, QTransform());
-/*!
- \internal
+ const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1));
+ if (!view->isTransformed())
+ return q->items(pointRect, Qt::IntersectsItemShape, Qt::AscendingOrder);
- Checks if item collides with the path and mode, but also checks that if it
- doesn't collide, maybe its frame rect will.
-*/
-bool QGraphicsScenePrivate::itemCollidesWithPath(QGraphicsItem *item,
- const QPainterPath &path,
- Qt::ItemSelectionMode mode)
-{
- if (item->collidesWithPath(path, mode))
- return true;
- if (item->isWidget()) {
- // Check if this is a window, and if its frame rect collides.
- QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
- if (widget->isWindow()) {
- QRectF frameRect = widget->windowFrameRect();
- QPainterPath framePath;
- framePath.addRect(frameRect);
- bool intersects = path.intersects(frameRect);
- if (mode == Qt::IntersectsItemShape || mode == Qt::IntersectsItemBoundingRect)
- return intersects || path.contains(frameRect.topLeft())
- || framePath.contains(path.elementAt(0));
- return !intersects && path.contains(frameRect.topLeft());
- }
+ const QTransform viewTransform = view->viewportTransform();
+ if (viewTransform.type() <= QTransform::TxScale) {
+ return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape,
+ Qt::AscendingOrder, viewTransform);
}
- return false;
+ return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape,
+ Qt::AscendingOrder, viewTransform);
}
/*!
@@ -1151,7 +876,7 @@ void QGraphicsScenePrivate::storeMouseButtonsForMouseGrabber(QGraphicsSceneMouse
if (event->buttons() & i) {
mouseGrabberButtonDownPos.insert(Qt::MouseButton(i),
mouseGrabberItems.last()->d_ptr->genericMapFromScene(event->scenePos(),
- event->widget()));
+ event->widget()));
mouseGrabberButtonDownScenePos.insert(Qt::MouseButton(i), event->scenePos());
mouseGrabberButtonDownScreenPos.insert(Qt::MouseButton(i), event->screenPos());
}
@@ -1185,6 +910,24 @@ void QGraphicsScenePrivate::removeSceneEventFilter(QGraphicsItem *watched, QGrap
}
/*!
+ \internal
+*/
+bool QGraphicsScenePrivate::filterDescendantEvent(QGraphicsItem *item, QEvent *event)
+{
+ if (item && (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents)) {
+ QGraphicsItem *parent = item->parentItem();
+ while (parent) {
+ if (parent->d_ptr->filtersDescendantEvents && parent->sceneEventFilter(item, event))
+ return true;
+ if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents))
+ return false;
+ parent = parent->parentItem();
+ }
+ }
+ return false;
+}
+
+/*!
\internal
*/
bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event)
@@ -1216,7 +959,9 @@ bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event)
{
if (filterEvent(item, event))
return false;
- return (item && item->isEnabled()) ? item->sceneEvent(event) : false;
+ if (filterDescendantEvent(item, event))
+ return false;
+ return (item && item->isEnabled() ? item->sceneEvent(event) : false);
}
/*!
@@ -1429,779 +1174,6 @@ QGraphicsWidget *QGraphicsScenePrivate::windowForItem(const QGraphicsItem *item)
return 0;
}
-QList<QGraphicsItem *> QGraphicsScenePrivate::topLevelItemsInStackingOrder(const QTransform *const viewTransform,
- QRegion *exposedRegion)
-{
- if (indexMethod == QGraphicsScene::NoIndex || !exposedRegion) {
- if (needSortTopLevelItems) {
- needSortTopLevelItems = false;
- qStableSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf);
- }
- return topLevelItems;
- }
-
- const QRectF exposedRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1);
- QRectF sceneRect;
- QTransform invertedViewTransform(Qt::Uninitialized);
- if (!viewTransform) {
- sceneRect = exposedRect;
- } else {
- invertedViewTransform = viewTransform->inverted();
- sceneRect = invertedViewTransform.mapRect(exposedRect);
- }
- if (!largestUntransformableItem.isEmpty()) {
- // ### Nuke this when we move the indexing code into a separate
- // class. All the largestUntransformableItem code should then go
- // away, and the estimate function should return untransformable
- // items as well.
- QRectF untr = largestUntransformableItem;
- QRectF ltri = !viewTransform ? untr : invertedViewTransform.mapRect(untr);
- ltri.adjust(-untr.width(), -untr.height(), untr.width(), untr.height());
- sceneRect.adjust(-ltri.width(), -ltri.height(), ltri.width(), ltri.height());
- }
-
- QList<QGraphicsItem *> tmp = estimateItemsInRect(sceneRect);
- for (int i = 0; i < tmp.size(); ++i)
- tmp.at(i)->topLevelItem()->d_ptr->itemDiscovered = 1;
-
- // Sort if the toplevel list is unsorted.
- if (needSortTopLevelItems) {
- needSortTopLevelItems = false;
- qStableSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf);
- }
-
- QList<QGraphicsItem *> tli;
- for (int i = 0; i < topLevelItems.size(); ++i) {
- // ### Investigate smarter ways. Looping through all top level
- // items is not optimal. If the BSP tree is to have maximum
- // effect, it should be possible to sort the subset of items
- // quickly. We must use this approach for now, as it's the only
- // current way to keep the stable sorting order (insertion order).
- QGraphicsItem *item = topLevelItems.at(i);
- if (item->d_ptr->itemDiscovered) {
- item->d_ptr->itemDiscovered = 0;
- tli << item;
- }
- }
- return tli;
-}
-
-void QGraphicsScenePrivate::recursive_items_helper(QGraphicsItem *item, QRectF rect,
- QList<QGraphicsItem *> *items,
- const QTransform &parentTransform,
- const QTransform &viewTransform,
- Qt::ItemSelectionMode mode, Qt::SortOrder order,
- qreal parentOpacity) const
-{
- // Calculate opacity.
- qreal opacity;
- if (item) {
- if (!item->d_ptr->visible)
- return;
- QGraphicsItem *p = item->d_ptr->parent;
- bool itemIgnoresParentOpacity = item->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity;
- bool parentDoesntPropagateOpacity = (p && (p->d_ptr->flags & QGraphicsItem::ItemDoesntPropagateOpacityToChildren));
- if (!itemIgnoresParentOpacity && !parentDoesntPropagateOpacity) {
- opacity = parentOpacity * item->opacity();
- } else {
- opacity = item->d_ptr->opacity;
- }
- if (opacity == 0.0 && !(item->d_ptr->flags & QGraphicsItem::ItemDoesntPropagateOpacityToChildren))
- return;
- } else {
- opacity = parentOpacity;
- }
-
- // Calculate the full transform for this item.
- QTransform transform = parentTransform;
- bool keep = false;
- if (item) {
- item->d_ptr->combineTransformFromParent(&transform, &viewTransform);
-
- // ### This does not take the clip into account.
- QRectF brect = item->boundingRect();
- _q_adjustRect(&brect);
-
- keep = true;
- if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect)
- keep = rect.contains(transform.mapRect(brect)) && rect != brect;
- else
- keep = rect.intersects(transform.mapRect(brect));
-
- if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) {
- QPainterPath rectPath;
- rectPath.addRect(rect);
- keep = itemCollidesWithPath(item, transform.inverted().map(rectPath), mode);
- }
- }
-
- bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape));
- bool dontProcessItem = !item || !keep;
- bool dontProcessChildren = item && dontProcessItem && childClip;
-
- // Find and sort children.
- QList<QGraphicsItem *> &children = item ? item->d_ptr->children : const_cast<QGraphicsScenePrivate *>(this)->topLevelItems;
- if (!dontProcessChildren) {
- if (item && item->d_ptr->needSortChildren) {
- item->d_ptr->needSortChildren = 0;
- qStableSort(children.begin(), children.end(), qt_notclosestLeaf);
- } else if (!item && needSortTopLevelItems) {
- const_cast<QGraphicsScenePrivate *>(this)->needSortTopLevelItems = false;
- qStableSort(children.begin(), children.end(), qt_notclosestLeaf);
- }
- }
-
- childClip &= !dontProcessChildren & !children.isEmpty();
-
- // Clip.
- if (childClip)
- rect &= transform.map(item->shape()).controlPointRect();
-
- // Process children behind
- int i = 0;
- if (!dontProcessChildren) {
- for (i = 0; i < children.size(); ++i) {
- QGraphicsItem *child = children.at(i);
- if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent))
- break;
- recursive_items_helper(child, rect, items, transform, viewTransform,
- mode, order, opacity);
- }
- }
-
- // Process item
- if (!dontProcessItem)
- items->append(item);
-
- // Process children in front
- if (!dontProcessChildren) {
- for (; i < children.size(); ++i)
- recursive_items_helper(children.at(i), rect, items, transform, viewTransform,
- mode, order, opacity);
- }
-
- if (!item && order == Qt::AscendingOrder) {
- int n = items->size();
- for (int i = 0; i < n / 2; ++i) {
- QGraphicsItem *tmp = (*items)[n - i - 1];
- (*items)[n - i - 1] = (*items)[i];
- (*items)[i] = tmp;
- }
- }
-}
-
-QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QPointF &pos) const
-{
- QList<QGraphicsItem *> items;
-
- // The index returns a rough estimate of what items are inside the rect.
- // Refine it by iterating through all returned items.
- QRectF adjustedRect = QRectF(pos, QSize(1,1));
- foreach (QGraphicsItem *item, estimateItemsInRect(adjustedRect)) {
- // Find the item's scene transform in a clever way.
- QTransform x = item->sceneTransform();
- bool keep = false;
-
- // ### _q_adjustedRect is only needed because QRectF::intersects,
- // QRectF::contains and QTransform::map() and friends don't work with
- // flat rectangles.
- const QRectF br(adjustedItemBoundingRect(item));
- // Rect intersects/contains item's shape
- if (QRectF_intersects(adjustedRect, x.mapRect(br))) {
- bool ok;
- QTransform xinv = x.inverted(&ok);
- if (ok) {
- if (item->contains(xinv.map(pos))) {
- items << item;
- keep = true;
- }
- }
- }
-
- if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) {
- // Recurse into children that clip children.
- bool ok;
- QTransform xinv = x.inverted(&ok);
- if (ok)
- childItems_helper(&items, item, xinv.map(pos));
- }
- }
-
- sortItems(&items, Qt::AscendingOrder, sortCacheEnabled);
- return items;
-}
-
-QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QRectF &rect,
- Qt::ItemSelectionMode mode,
- Qt::SortOrder order) const
-{
- QList<QGraphicsItem *> items;
-
- QPainterPath path;
-
- // The index returns a rough estimate of what items are inside the rect.
- // Refine it by iterating through all returned items.
- QRectF adjustedRect(rect);
- _q_adjustRect(&adjustedRect);
- foreach (QGraphicsItem *item, estimateItemsInRect(adjustedRect)) {
- // Find the item's scene transform in a clever way.
- QTransform x = item->sceneTransform();
- bool keep = false;
-
- // ### _q_adjustedRect is only needed because QRectF::intersects,
- // QRectF::contains and QTransform::map() and friends don't work with
- // flat rectangles.
- const QRectF br(adjustedItemBoundingRect(item));
- if (mode >= Qt::ContainsItemBoundingRect) {
- // Rect intersects/contains item's bounding rect
- QRectF mbr = x.mapRect(br);
- if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr))
- || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(mbr))) {
- items << item;
- keep = true;
- }
- } else {
- // Rect intersects/contains item's shape
- if (QRectF_intersects(adjustedRect, x.mapRect(br))) {
- bool ok;
- QTransform xinv = x.inverted(&ok);
- if (ok) {
- if (path.isEmpty())
- path.addRect(rect);
- if (itemCollidesWithPath(item, xinv.map(path), mode)) {
- items << item;
- keep = true;
- }
- }
- }
- }
-
- if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) {
- // Recurse into children that clip children.
- bool ok;
- QTransform xinv = x.inverted(&ok);
- if (ok) {
- if (x.type() <= QTransform::TxScale) {
- // Rect
- childItems_helper(&items, item, xinv.mapRect(rect), mode);
- } else {
- // Polygon
- childItems_helper(&items, item, xinv.map(rect), mode);
- }
- }
- }
- }
-
- if (order != Qt::SortOrder(-1))
- sortItems(&items, order, sortCacheEnabled);
- return items;
-}
-
-QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QPolygonF &polygon,
- Qt::ItemSelectionMode mode,
- Qt::SortOrder order) const
-{
- QList<QGraphicsItem *> items;
-
- QRectF polyRect(polygon.boundingRect());
- _q_adjustRect(&polyRect);
- QPainterPath path;
-
- // The index returns a rough estimate of what items are inside the rect.
- // Refine it by iterating through all returned items.
- foreach (QGraphicsItem *item, estimateItemsInRect(polyRect)) {
- // Find the item's scene transform in a clever way.
- QTransform x = item->sceneTransform();
- bool keep = false;
-
- // ### _q_adjustedRect is only needed because QRectF::intersects,
- // QRectF::contains and QTransform::map() and friends don't work with
- // flat rectangles.
- const QRectF br(adjustedItemBoundingRect(item));
- if (mode >= Qt::ContainsItemBoundingRect) {
- // Polygon contains/intersects item's bounding rect
- if (path == QPainterPath())
- path.addPolygon(polygon);
- if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(x.mapRect(br)))
- || (mode == Qt::ContainsItemBoundingRect && path.contains(x.mapRect(br)))) {
- items << item;
- keep = true;
- }
- } else {
- // Polygon contains/intersects item's shape
- if (QRectF_intersects(polyRect, x.mapRect(br))) {
- bool ok;
- QTransform xinv = x.inverted(&ok);
- if (ok) {
- if (path == QPainterPath())
- path.addPolygon(polygon);
- if (itemCollidesWithPath(item, xinv.map(path), mode)) {
- items << item;
- keep = true;
- }
- }
- }
- }
-
- if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) {
- // Recurse into children that clip children.
- bool ok;
- QTransform xinv = x.inverted(&ok);
- if (ok)
- childItems_helper(&items, item, xinv.map(polygon), mode);
- }
- }
-
- if (order != Qt::SortOrder(-1))
- sortItems(&items, order, sortCacheEnabled);
- return items;
-}
-
-QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QPainterPath &path,
- Qt::ItemSelectionMode mode,
- Qt::SortOrder order) const
-{
- QList<QGraphicsItem *> items;
- QRectF pathRect(path.controlPointRect());
- _q_adjustRect(&pathRect);
-
- // The index returns a rough estimate of what items are inside the rect.
- // Refine it by iterating through all returned items.
- foreach (QGraphicsItem *item, estimateItemsInRect(pathRect)) {
- // Find the item's scene transform in a clever way.
- QTransform x = item->sceneTransform();
- bool keep = false;
-
- // ### _q_adjustedRect is only needed because QRectF::intersects,
- // QRectF::contains and QTransform::map() and friends don't work with
- // flat rectangles.
- const QRectF br(adjustedItemBoundingRect(item));
- if (mode >= Qt::ContainsItemBoundingRect) {
- // Path contains/intersects item's bounding rect
- if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(x.mapRect(br)))
- || (mode == Qt::ContainsItemBoundingRect && path.contains(x.mapRect(br)))) {
- items << item;
- keep = true;
- }
- } else {
- // Path contains/intersects item's shape
- if (QRectF_intersects(pathRect, x.mapRect(br))) {
- bool ok;
- QTransform xinv = x.inverted(&ok);
- if (ok) {
- if (itemCollidesWithPath(item, xinv.map(path), mode)) {
- items << item;
- keep = true;
- }
- }
- }
- }
-
- if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) {
- bool ok;
- QTransform xinv = x.inverted(&ok);
- if (ok)
- childItems_helper(&items, item, xinv.map(path), mode);
- }
- }
-
- if (order != Qt::SortOrder(-1))
- sortItems(&items, order, sortCacheEnabled);
- return items;
-}
-
-void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items,
- const QGraphicsItem *parent,
- const QPointF &pos) const
-{
- bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape);
- if (parentClip && parent->d_ptr->isClippedAway())
- return;
- // ### is this needed?
- if (parentClip && !parent->boundingRect().contains(pos))
- return;
-
- QList<QGraphicsItem *> &children = parent->d_ptr->children;
- for (int i = 0; i < children.size(); ++i) {
- QGraphicsItem *item = children.at(i);
- if (item->d_ptr->transformData && !item->d_ptr->transformData->computedFullTransform().isInvertible())
- continue;
-
- // Skip invisible items and all their children.
- if (item->d_ptr->isInvisible())
- continue;
-
- bool keep = false;
- if (!item->d_ptr->isClippedAway()) {
- if (item->contains(item->mapFromParent(pos))) {
- items->append(item);
- keep = true;
- }
- }
-
- if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty())
- // Recurse into children.
- childItems_helper(items, item, item->mapFromParent(pos));
- }
-}
-
-
-void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items,
- const QGraphicsItem *parent,
- const QRectF &rect,
- Qt::ItemSelectionMode mode) const
-{
- bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape);
- if (parentClip && parent->d_ptr->isClippedAway())
- return;
- QRectF adjustedRect(rect);
- _q_adjustRect(&adjustedRect);
- QRectF r = !parentClip ? adjustedRect : adjustedRect.intersected(adjustedItemBoundingRect(parent));
- if (r.isEmpty())
- return;
-
- QPainterPath path;
- QList<QGraphicsItem *> &children = parent->d_ptr->children;
- for (int i = 0; i < children.size(); ++i) {
- QGraphicsItem *item = children.at(i);
- if (item->d_ptr->transformData && !item->d_ptr->transformData->computedFullTransform().isInvertible())
- continue;
-
- // Skip invisible items and all their children.
- if (item->d_ptr->isInvisible())
- continue;
-
- bool keep = false;
- if (!item->d_ptr->isClippedAway()) {
- // ### _q_adjustedRect is only needed because QRectF::intersects,
- // QRectF::contains and QTransform::map() and friends don't work with
- // flat rectangles.
- const QRectF br(adjustedItemBoundingRect(item));
- QRectF mbr = item->mapRectToParent(br);
- if (mode >= Qt::ContainsItemBoundingRect) {
- // Rect intersects/contains item's bounding rect
- if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr))
- || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(br))) {
- items->append(item);
- keep = true;
- }
- } else {
- // Rect intersects/contains item's shape
- if (QRectF_intersects(rect, mbr)) {
- if (path == QPainterPath())
- path.addRect(rect);
- if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) {
- items->append(item);
- keep = true;
- }
- }
- }
- }
-
- if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) {
- // Recurse into children.
- if (!item->d_ptr->transformData || item->d_ptr->transformData->computedFullTransform().type() <= QTransform::TxScale) {
- // Rect
- childItems_helper(items, item, item->mapRectFromParent(rect), mode);
- } else {
- // Polygon
- childItems_helper(items, item, item->mapFromParent(rect), mode);
- }
- }
- }
-}
-
-
-void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items,
- const QGraphicsItem *parent,
- const QPolygonF &polygon,
- Qt::ItemSelectionMode mode) const
-{
- bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape);
- if (parentClip && parent->d_ptr->isClippedAway())
- return;
- QRectF polyRect(polygon.boundingRect());
- _q_adjustRect(&polyRect);
- QRectF r = !parentClip ? polyRect : polyRect.intersected(adjustedItemBoundingRect(parent));
- if (r.isEmpty())
- return;
-
- QPainterPath path;
- QList<QGraphicsItem *> &children = parent->d_ptr->children;
- for (int i = 0; i < children.size(); ++i) {
- QGraphicsItem *item = children.at(i);
- if (item->d_ptr->transformData && !item->d_ptr->transformData->computedFullTransform().isInvertible())
- continue;
-
- // Skip invisible items.
- if (item->d_ptr->isInvisible())
- continue;
-
- bool keep = false;
- if (!item->d_ptr->isClippedAway()) {
- // ### _q_adjustedRect is only needed because QRectF::intersects,
- // QRectF::contains and QTransform::map() and friends don't work with
- // flat rectangles.
- const QRectF br(adjustedItemBoundingRect(item));
- if (mode >= Qt::ContainsItemBoundingRect) {
- // Polygon contains/intersects item's bounding rect
- if (path == QPainterPath())
- path.addPolygon(polygon);
- if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br)))
- || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) {
- items->append(item);
- keep = true;
- }
- } else {
- // Polygon contains/intersects item's shape
- if (QRectF_intersects(polyRect, item->mapRectToParent(br))) {
- if (path == QPainterPath())
- path.addPolygon(polygon);
- if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) {
- items->append(item);
- keep = true;
- }
- }
- }
- }
-
- if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) {
- // Recurse into children that clip children.
- childItems_helper(items, item, item->mapFromParent(polygon), mode);
- }
- }
-}
-
-void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items,
- const QGraphicsItem *parent,
- const QPainterPath &path,
- Qt::ItemSelectionMode mode) const
-{
- bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape);
- if (parentClip && parent->d_ptr->isClippedAway())
- return;
- QRectF pathRect(path.boundingRect());
- _q_adjustRect(&pathRect);
- QRectF r = !parentClip ? pathRect : pathRect.intersected(adjustedItemBoundingRect(parent));
- if (r.isEmpty())
- return;
-
- QList<QGraphicsItem *> &children = parent->d_ptr->children;
- for (int i = 0; i < children.size(); ++i) {
- QGraphicsItem *item = children.at(i);
- if (item->d_ptr->transformData && !item->d_ptr->transformData->computedFullTransform().isInvertible())
- continue;
-
- // Skip invisible items.
- if (item->d_ptr->isInvisible())
- continue;
-
- bool keep = false;
- if (!item->d_ptr->isClippedAway()) {
- // ### _q_adjustedRect is only needed because QRectF::intersects,
- // QRectF::contains and QTransform::map() and friends don't work with
- // flat rectangles.
- const QRectF br(adjustedItemBoundingRect(item));
- if (mode >= Qt::ContainsItemBoundingRect) {
- // Polygon contains/intersects item's bounding rect
- if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br)))
- || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) {
- items->append(item);
- keep = true;
- }
- } else {
- // Path contains/intersects item's shape
- if (QRectF_intersects(pathRect, item->mapRectToParent(br))) {
- if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) {
- items->append(item);
- keep = true;
- }
- }
- }
- }
-
- if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) {
- // Recurse into children that clip children.
- childItems_helper(items, item, item->mapFromParent(path), mode);
- }
- }
-}
-
-void QGraphicsScenePrivate::invalidateSortCache()
-{
- Q_Q(QGraphicsScene);
- if (!sortCacheEnabled || updatingSortCache)
- return;
-
- updatingSortCache = true;
- QMetaObject::invokeMethod(q, "_q_updateSortCache", Qt::QueuedConnection);
-}
-
-/*!
- \internal
-
- Should not be exported, but we can't change that now.
- ### Qt 5: Remove symbol / make static
-*/
-inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
-{
- // Return true if sibling item1 is on top of item2.
- const QGraphicsItemPrivate *d1 = item1->d_ptr.data();
- const QGraphicsItemPrivate *d2 = item2->d_ptr.data();
- bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent;
- bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent;
- if (f1 != f2) return f2;
- qreal z1 = d1->z;
- qreal z2 = d2->z;
- return z1 > z2;
-}
-
-static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
-{
- return qt_closestLeaf(item2, item1);
-}
-
-/*!
- \internal
-
- Should not be exported, but we can't change that now.
-*/
-inline bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem *item2)
-{
- return QGraphicsScenePrivate::closestItemFirst_withoutCache(item1, item2);
-}
-
-/*!
- Returns true if \a item1 is on top of \a item2.
-
- \internal
-*/
-bool QGraphicsScenePrivate::closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
-{
- // Siblings? Just check their z-values.
- const QGraphicsItemPrivate *d1 = item1->d_ptr.data();
- const QGraphicsItemPrivate *d2 = item2->d_ptr.data();
- if (d1->parent == d2->parent)
- return qt_closestLeaf(item1, item2);
-
- // Find common ancestor, and each item's ancestor closest to the common
- // ancestor.
- int item1Depth = d1->depth;
- int item2Depth = d2->depth;
- const QGraphicsItem *p = item1;
- const QGraphicsItem *t1 = item1;
- while (item1Depth > item2Depth && (p = p->d_ptr->parent)) {
- if (p == item2) {
- // item2 is one of item1's ancestors; item1 is on top
- return !(t1->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent);
- }
- t1 = p;
- --item1Depth;
- }
- p = item2;
- const QGraphicsItem *t2 = item2;
- while (item2Depth > item1Depth && (p = p->d_ptr->parent)) {
- if (p == item1) {
- // item1 is one of item2's ancestors; item1 is not on top
- return (t2->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent);
- }
- t2 = p;
- --item2Depth;
- }
-
- // item1Ancestor is now at the same level as item2Ancestor, but not the same.
- const QGraphicsItem *a1 = t1;
- const QGraphicsItem *a2 = t2;
- while (a1) {
- const QGraphicsItem *p1 = a1;
- const QGraphicsItem *p2 = a2;
- a1 = a1->parentItem();
- a2 = a2->parentItem();
- if (a1 && a1 == a2)
- return qt_closestLeaf(p1, p2);
- }
-
- // No common ancestor? Then just compare the items' toplevels directly.
- return qt_closestLeaf(t1->topLevelItem(), t2->topLevelItem());
-}
-
-/*!
- Returns true if \a item2 is on top of \a item1.
-
- \internal
-*/
-bool QGraphicsScenePrivate::closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
-{
- return closestItemFirst_withoutCache(item2, item1);
-}
-
-void QGraphicsScenePrivate::climbTree(QGraphicsItem *item, int *stackingOrder)
-{
- if (!item->d_ptr->children.isEmpty()) {
- QList<QGraphicsItem *> childList = item->d_ptr->children;
- qSort(childList.begin(), childList.end(), qt_closestLeaf);
- for (int i = 0; i < childList.size(); ++i) {
- QGraphicsItem *item = childList.at(i);
- if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent))
- climbTree(childList.at(i), stackingOrder);
- }
- item->d_ptr->globalStackingOrder = (*stackingOrder)++;
- for (int i = 0; i < childList.size(); ++i) {
- QGraphicsItem *item = childList.at(i);
- if (item->flags() & QGraphicsItem::ItemStacksBehindParent)
- climbTree(childList.at(i), stackingOrder);
- }
- } else {
- item->d_ptr->globalStackingOrder = (*stackingOrder)++;
- }
-}
-
-void QGraphicsScenePrivate::_q_updateSortCache()
-{
- _q_updateIndex();
-
- if (!sortCacheEnabled || !updatingSortCache)
- return;
-
- updatingSortCache = false;
- int stackingOrder = 0;
-
- QList<QGraphicsItem *> topLevels;
-
- for (int i = 0; i < indexedItems.size(); ++i) {
- QGraphicsItem *item = indexedItems.at(i);
- if (item && item->parentItem() == 0)
- topLevels << item;
- }
- for (int i = 0; i < unindexedItems.size(); ++i) {
- QGraphicsItem *item = unindexedItems.at(i);
- if (item->parentItem() == 0)
- topLevels << item;
- }
-
- qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf);
- for (int i = 0; i < topLevels.size(); ++i)
- climbTree(topLevels.at(i), &stackingOrder);
-}
-
-void QGraphicsScenePrivate::sortItems(QList<QGraphicsItem *> *itemList, Qt::SortOrder order,
- bool sortCacheEnabled)
-{
- if (sortCacheEnabled) {
- if (order == Qt::AscendingOrder) {
- qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache);
- } else if (order == Qt::DescendingOrder) {
- qSort(itemList->begin(), itemList->end(), closestItemLast_withCache);
- }
- } else {
- if (order == Qt::AscendingOrder) {
- qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache);
- } else if (order == Qt::DescendingOrder) {
- qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache);
- }
- }
-}
-
/*!
\internal
@@ -2334,8 +1306,8 @@ QGraphicsScene::QGraphicsScene(QObject *parent)
QGraphicsScene::QGraphicsScene(const QRectF &sceneRect, QObject *parent)
: QObject(*new QGraphicsScenePrivate, parent)
{
- setSceneRect(sceneRect);
d_func()->init();
+ setSceneRect(sceneRect);
}
/*!
@@ -2349,8 +1321,8 @@ QGraphicsScene::QGraphicsScene(const QRectF &sceneRect, QObject *parent)
QGraphicsScene::QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent)
: QObject(*new QGraphicsScenePrivate, parent)
{
- setSceneRect(x, y, width, height);
d_func()->init();
+ setSceneRect(x, y, width, height);
}
/*!
@@ -2387,8 +1359,19 @@ QGraphicsScene::~QGraphicsScene()
QRectF QGraphicsScene::sceneRect() const
{
Q_D(const QGraphicsScene);
- const_cast<QGraphicsScenePrivate *>(d)->_q_updateIndex();
- return d->hasSceneRect ? d->sceneRect : d->growingItemsBoundingRect;
+ if (d->hasSceneRect)
+ return d->sceneRect;
+
+ if (d->dirtyGrowingItemsBoundingRect) {
+ // Lazily update the growing items bounding rect
+ QGraphicsScenePrivate *thatd = const_cast<QGraphicsScenePrivate *>(d);
+ QRectF oldGrowingBoundingRect = thatd->growingItemsBoundingRect;
+ thatd->growingItemsBoundingRect |= itemsBoundingRect();
+ thatd->dirtyGrowingItemsBoundingRect = false;
+ if (oldGrowingBoundingRect != thatd->growingItemsBoundingRect)
+ emit const_cast<QGraphicsScene *>(this)->sceneRectChanged(thatd->growingItemsBoundingRect);
+ }
+ return d->growingItemsBoundingRect;
}
void QGraphicsScene::setSceneRect(const QRectF &rect)
{
@@ -2396,8 +1379,7 @@ void QGraphicsScene::setSceneRect(const QRectF &rect)
if (rect != d->sceneRect) {
d->hasSceneRect = !rect.isNull();
d->sceneRect = rect;
- d->resetIndex();
- emit sceneRectChanged(rect);
+ emit sceneRectChanged(d->hasSceneRect ? rect : d->growingItemsBoundingRect);
}
}
@@ -2438,6 +1420,8 @@ void QGraphicsScene::setSceneRect(const QRectF &rect)
void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRectF &source,
Qt::AspectRatioMode aspectRatioMode)
{
+ // ### Switch to using the recursive rendering algorithm instead.
+
// Default source rect = scene rect
QRectF sourceRect = source;
if (sourceRect.isNull())
@@ -2532,8 +1516,19 @@ QGraphicsScene::ItemIndexMethod QGraphicsScene::itemIndexMethod() const
void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method)
{
Q_D(QGraphicsScene);
- d->resetIndex();
+ if (d->indexMethod == method)
+ return;
+
d->indexMethod = method;
+
+ QList<QGraphicsItem *> oldItems = d->index->items(Qt::AscendingOrder);
+ delete d->index;
+ if (method == BspTreeIndex)
+ d->index = new QGraphicsSceneBspTreeIndex(this);
+ else
+ d->index = new QGraphicsSceneLinearIndex(this);
+ for (int i = oldItems.size() - 1; i >= 0; --i)
+ d->index->addItem(oldItems.at(i));
}
/*!
@@ -2571,35 +1566,32 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method)
int QGraphicsScene::bspTreeDepth() const
{
Q_D(const QGraphicsScene);
- return d->bspTreeDepth;
+ QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index);
+ return bspTree ? bspTree->bspTreeDepth() : 0;
}
void QGraphicsScene::setBspTreeDepth(int depth)
{
Q_D(QGraphicsScene);
- if (d->bspTreeDepth == depth)
- return;
-
if (depth < 0) {
qWarning("QGraphicsScene::setBspTreeDepth: invalid depth %d ignored; must be >= 0", depth);
return;
}
- d->bspTreeDepth = depth;
- d->resetIndex();
+ QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index);
+ if (!bspTree) {
+ qWarning("QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP");
+ return;
+ }
+ bspTree->setBspTreeDepth(depth);
}
/*!
\property QGraphicsScene::sortCacheEnabled
\brief whether sort caching is enabled
\since 4.5
+ \obsolete
- When enabled, this property adds a cache that speeds up sorting and
- transformations for scenes with deep hierarchies (i.e., items with many
- levels of descendents), at the cost of using more memory (approx. 100 more
- bytes of memory per item).
-
- Items that are not part of a deep hierarchy suffer no penalty from this
- cache.
+ Since Qt 4.6, this property has no effect.
*/
bool QGraphicsScene::isSortCacheEnabled() const
{
@@ -2609,10 +1601,9 @@ bool QGraphicsScene::isSortCacheEnabled() const
void QGraphicsScene::setSortCacheEnabled(bool enabled)
{
Q_D(QGraphicsScene);
- if (enabled == d->sortCacheEnabled)
+ if (d->sortCacheEnabled == enabled)
return;
- if ((d->sortCacheEnabled = enabled))
- d->invalidateSortCache();
+ d->sortCacheEnabled = enabled;
}
/*!
@@ -2624,6 +1615,7 @@ void QGraphicsScene::setSortCacheEnabled(bool enabled)
*/
QRectF QGraphicsScene::itemsBoundingRect() const
{
+ // Does not take untransformable items into account.
QRectF boundingRect;
foreach (QGraphicsItem *item, items())
boundingRect |= item->sceneBoundingRect();
@@ -2638,43 +1630,43 @@ QRectF QGraphicsScene::itemsBoundingRect() const
QList<QGraphicsItem *> QGraphicsScene::items() const
{
Q_D(const QGraphicsScene);
- const_cast<QGraphicsScenePrivate *>(d)->purgeRemovedItems();
+ return d->index->items(Qt::AscendingOrder);
+}
- // If freeItemIndexes is empty, we know there are no holes in indexedItems and
- // unindexedItems.
- if (d->freeItemIndexes.isEmpty()) {
- if (d->unindexedItems.isEmpty())
- return d->indexedItems;
- return d->indexedItems + d->unindexedItems;
- }
+/*!
+ Returns an ordered list of all items on the scene. \a order decides the
+ sorting.
- // Rebuild the list of items to avoid holes. ### We could also just
- // compress the item lists at this point.
- QList<QGraphicsItem *> itemList;
- foreach (QGraphicsItem *item, d->indexedItems + d->unindexedItems) {
- if (item)
- itemList << item;
- }
- return itemList;
+ \sa addItem(), removeItem()
+*/
+QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const
+{
+ Q_D(const QGraphicsScene);
+ return d->index->items(order);
}
/*!
+ \obsolete
+
Returns all visible items at position \a pos in the scene. The items are
- listed in descending Z order (i.e., the first item in the list is the
+ listed in descending stacking order (i.e., the first item in the list is the
top-most item, and the last item is the bottom-most item).
+ This function is deprecated and returns incorrect results if the scene
+ contains items that ignore transformations. Use the overload that takes
+ a QTransform instead.
+
\sa itemAt()
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const
{
Q_D(const QGraphicsScene);
- return d->items_helper(pos);
+ return d->index->items(pos, Qt::IntersectsItemShape, Qt::AscendingOrder);
}
/*!
- \fn QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSelectionMode mode) const
-
\overload
+ \obsolete
Returns all visible items that, depending on \a mode, are either inside or
intersect with the specified \a rectangle.
@@ -2682,25 +1674,47 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a rectangle are returned.
+ This function is deprecated and returns incorrect results if the scene
+ contains items that ignore transformations. Use the overload that takes
+ a QTransform instead.
+
\sa itemAt()
*/
-QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode) const
+QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSelectionMode mode) const
{
Q_D(const QGraphicsScene);
- QList<QGraphicsItem *> itemList;
- d->recursive_items_helper(0, rect, &itemList, QTransform(), QTransform(), mode, Qt::AscendingOrder);
- return itemList;
+ return d->index->items(rectangle, mode, Qt::AscendingOrder);
}
/*!
\fn QList<QGraphicsItem *> QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode) const
+ \obsolete
\since 4.3
This convenience function is equivalent to calling items(QRectF(\a x, \a y, \a w, \a h), \a mode).
+
+ This function is deprecated and returns incorrect results if the scene
+ contains items that ignore transformations. Use the overload that takes
+ a QTransform instead.
*/
/*!
+ \fn QList<QGraphicsItem *> QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h,
+ Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
\overload
+ \since 4.6
+
+ Returns all visible items that, depending on \a mode, are either inside or
+ intersect with the rectangle defined by \a x, \a y, \a w and \a h, in a list
+ sorted using \a order.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+*/
+
+/*!
+ \overload
+ \obsolete
Returns all visible items that, depending on \a mode, are either inside or
intersect with the polygon \a polygon.
@@ -2708,16 +1722,21 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelecti
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a polygon are returned.
+ This function is deprecated and returns incorrect results if the scene
+ contains items that ignore transformations. Use the overload that takes
+ a QTransform instead.
+
\sa itemAt()
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode) const
{
Q_D(const QGraphicsScene);
- return d->items_helper(polygon, mode, Qt::AscendingOrder);
+ return d->index->items(polygon, mode, Qt::AscendingOrder);
}
/*!
\overload
+ \obsolete
Returns all visible items that, depending on \a path, are either inside or
intersect with the path \a path.
@@ -2725,12 +1744,103 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a path are returned.
+ This function is deprecated and returns incorrect results if the scene
+ contains items that ignore transformations. Use the overload that takes
+ a QTransform instead.
+
\sa itemAt()
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const
{
Q_D(const QGraphicsScene);
- return d->items_helper(path, mode, Qt::AscendingOrder);
+ return d->index->items(path, mode, Qt::AscendingOrder);
+}
+
+/*!
+ \since 4.6
+
+ Returns all visible items that, depending on \a mode, are at the specified \a pos
+ in a list sorted using \a order.
+
+ The default value for \a mode is Qt::IntersectsItemShape; all items whose
+ exact shape intersects with \a pos are returned.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
+ \sa itemAt()
+*/
+QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform) const
+{
+ Q_D(const QGraphicsScene);
+ return d->index->items(pos, mode, order, deviceTransform);
+}
+
+/*!
+ \overload
+ \since 4.6
+
+ Returns all visible items that, depending on \a mode, are either inside or
+ intersect with the specified \a rect and return a list sorted using \a order.
+
+ The default value for \a mode is Qt::IntersectsItemShape; all items whose
+ exact shape intersects with or is contained by \a rect are returned.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
+ \sa itemAt()
+*/
+QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform) const
+{
+ Q_D(const QGraphicsScene);
+ return d->index->items(rect, mode, order, deviceTransform);
+}
+
+/*!
+ \overload
+ \since 4.6
+
+ Returns all visible items that, depending on \a mode, are either inside or
+ intersect with the specified \a polygon and return a list sorted using \a order.
+
+ The default value for \a mode is Qt::IntersectsItemShape; all items whose
+ exact shape intersects with or is contained by \a polygon are returned.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
+ \sa itemAt()
+*/
+QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform) const
+{
+ Q_D(const QGraphicsScene);
+ return d->index->items(polygon, mode, order, deviceTransform);
+}
+
+/*!
+ \overload
+ \since 4.6
+
+ Returns all visible items that, depending on \a mode, are either inside or
+ intersect with the specified \a path and return a list sorted using \a order.
+
+ The default value for \a mode is Qt::IntersectsItemShape; all items whose
+ exact shape intersects with or is contained by \a path are returned.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
+ \sa itemAt()
+*/
+QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform) const
+{
+ Q_D(const QGraphicsScene);
+ return d->index->items(path, mode, order, deviceTransform);
}
/*!
@@ -2753,34 +1863,77 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item,
return QList<QGraphicsItem *>();
}
+ // Does not support ItemIgnoresTransformations.
QList<QGraphicsItem *> tmp;
- foreach (QGraphicsItem *itemInVicinity, d->estimateItemsInRect(item->sceneBoundingRect())) {
+ foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::AscendingOrder)) {
if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode))
tmp << itemInVicinity;
}
- d->sortItems(&tmp, Qt::AscendingOrder, d->sortCacheEnabled);
return tmp;
}
/*!
- \fn QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const
+ \overload
+ \obsolete
Returns the topmost visible item at the specified \a position, or 0 if
there are no items at this position.
\note The topmost item is the one with the highest Z-value.
+ This function is deprecated and returns incorrect results if the scene
+ contains items that ignore transformations. Use the overload that takes
+ a QTransform instead.
+
\sa items(), collidingItems(), QGraphicsItem::setZValue()
*/
-QGraphicsItem *QGraphicsScene::itemAt(const QPointF &pos) const
+QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const
{
- QList<QGraphicsItem *> itemsAtPoint = items(pos);
+ QList<QGraphicsItem *> itemsAtPoint = items(position);
return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
}
/*!
+ \since 4.6
+
+ Returns the topmost visible item at the specified \a position, or 0
+ if there are no items at this position.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
+ \note The topmost item is the one with the highest Z-value.
+
+ \sa items(), collidingItems(), QGraphicsItem::setZValue()
+ */
+QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const
+{
+ QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape,
+ Qt::AscendingOrder, deviceTransform);
+ return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
+}
+
+/*!
+ \fn QGraphicsScene::itemAt(qreal x, qreal y, const QTransform &deviceTransform) const
+ \overload
+ \since 4.6
+
+ Returns the topmost item at the position specified by (\a x, \a
+ y), or 0 if there are no items at this position.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
+ This convenience function is equivalent to calling \c
+ {itemAt(QPointF(x, y), deviceTransform)}.
+
+ \note The topmost item is the one with the highest Z-value.
+*/
+
+/*!
\fn QGraphicsScene::itemAt(qreal x, qreal y) const
\overload
+ \obsolete
Returns the topmost item at the position specified by (\a x, \a
y), or 0 if there are no items at this position.
@@ -2788,6 +1941,10 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &pos) const
This convenience function is equivalent to calling \c
{itemAt(QPointF(x, y))}.
+ This function is deprecated and returns incorrect results if the scene
+ contains items that ignore transformations. Use the overload that takes
+ a QTransform instead.
+
\note The topmost item is the one with the highest Z-value.
*/
@@ -2828,21 +1985,42 @@ QPainterPath QGraphicsScene::selectionArea() const
}
/*!
+ \since 4.6
+
Sets the selection area to \a path. All items within this area are
immediately selected, and all items outside are unselected. You can get
the list of all selected items by calling selectedItems().
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
For an item to be selected, it must be marked as \e selectable
(QGraphicsItem::ItemIsSelectable).
\sa clearSelection(), selectionArea()
*/
+void QGraphicsScene::setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform)
+{
+ setSelectionArea(path, Qt::IntersectsItemShape, deviceTransform);
+}
+
+/*!
+ \obsolete
+ \overload
+
+ Sets the selection area to \a path.
+
+ This function is deprecated and leads to incorrect results if the scene
+ contains items that ignore transformations. Use the overload that takes
+ a QTransform instead.
+*/
void QGraphicsScene::setSelectionArea(const QPainterPath &path)
{
- setSelectionArea(path, Qt::IntersectsItemShape);
+ setSelectionArea(path, Qt::IntersectsItemShape, QTransform());
}
/*!
+ \obsolete
\overload
\since 4.3
@@ -2853,6 +2031,24 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path)
*/
void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode)
{
+ setSelectionArea(path, mode, QTransform());
+}
+
+/*!
+ \overload
+ \since 4.6
+
+ Sets the selection area to \a path using \a mode to determine if items are
+ included in the selection area.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
+ \sa clearSelection(), selectionArea()
+*/
+void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode,
+ const QTransform &deviceTransform)
+{
Q_D(QGraphicsScene);
// Note: with boolean path operations, we can improve performance here
@@ -2868,7 +2064,7 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectio
bool changed = false;
// Set all items in path to selected.
- foreach (QGraphicsItem *item, items(path, mode)) {
+ foreach (QGraphicsItem *item, items(path, mode, Qt::AscendingOrder, deviceTransform)) {
if (item->flags() & QGraphicsItem::ItemIsSelectable) {
if (!item->isSelected())
changed = true;
@@ -2925,26 +2121,13 @@ void QGraphicsScene::clearSelection()
void QGraphicsScene::clear()
{
Q_D(QGraphicsScene);
- // Recursive descent delete
- for (int i = 0; i < d->indexedItems.size(); ++i) {
- if (QGraphicsItem *item = d->indexedItems.at(i)) {
- if (!item->parentItem())
- delete item;
- }
- }
- QList<QGraphicsItem *> unindexedParents;
- for (int i = 0; i < d->unindexedItems.size(); ++i) {
- QGraphicsItem *item = d->unindexedItems.at(i);
- if (!item->parentItem())
- unindexedParents << item;
- }
- d->unindexedItems.clear();
- qDeleteAll(unindexedParents);
- d->indexedItems.clear();
- d->freeItemIndexes.clear();
+ // NB! We have to clear the index before deleting items; otherwise the
+ // index might try to access dangling item pointers.
+ d->index->clear();
+ const QList<QGraphicsItem *> items = d->topLevelItems;
+ qDeleteAll(items);
+ Q_ASSERT(d->topLevelItems.isEmpty());
d->lastItemCount = 0;
- d->bspTree.clear();
- d->largestUntransformableItem = QRectF();
d->allItemsIgnoreHoverEvents = true;
d->allItemsUseDefaultCursor = true;
d->allItemsIgnoreTouchEvents = true;
@@ -3066,14 +2249,6 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
return;
}
- // Prevent reusing a recently deleted pointer: purge all removed items
- // from our lists.
- d->purgeRemovedItems();
-
- // Invalidate any sort caching; arrival of a new item means we need to
- // resort.
- d->invalidateSortCache();
-
// Detach this item from its parent if the parent's scene is different
// from this scene.
if (QGraphicsItem *itemParent = item->parentItem()) {
@@ -3084,29 +2259,18 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Add the item to this scene
item->d_func()->scene = targetScene;
- // Indexing requires sceneBoundingRect(), but because \a item might
- // not be completely constructed at this point, we need to store it in
- // a temporary list and schedule an indexing for later.
- d->unindexedItems << item;
- item->d_func()->index = -1;
- d->startIndexTimer(0);
+ // Add the item in the index
+ d->index->addItem(item);
// Add to list of toplevels if this item is a toplevel.
if (!item->d_ptr->parent)
d->registerTopLevelItem(item);
- // Update the scene's sort cache settings.
- item->d_ptr->globalStackingOrder = -1;
- d->invalidateSortCache();
-
// Add to list of items that require an update. We cannot assume that the
// item is fully constructed, so calling item->update() can lead to a pure
// virtual function call to boundingRect().
- if (!d->updateAll) {
- if (d->pendingUpdateItems.isEmpty())
- QMetaObject::invokeMethod(this, "_q_updateLater", Qt::QueuedConnection);
- d->pendingUpdateItems << item;
- }
+ d->markDirty(item);
+ d->dirtyGrowingItemsBoundingRect = true;
// Disable selectionChanged() for individual items
++d->selectionChanging;
@@ -3177,6 +2341,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Deliver post-change notification
item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant);
+
+ d->updateInputMethodSensitivityInViews();
}
/*!
@@ -3452,6 +2618,8 @@ void QGraphicsScene::removeItem(QGraphicsItem *item)
// Deliver post-change notification
item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant);
+
+ d->updateInputMethodSensitivityInViews();
}
/*!
@@ -3488,36 +2656,10 @@ QGraphicsItem *QGraphicsScene::focusItem() const
void QGraphicsScene::setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason)
{
Q_D(QGraphicsScene);
- if (item == d->focusItem)
- return;
- if (item && (!(item->flags() & QGraphicsItem::ItemIsFocusable)
- || !item->isVisible() || !item->isEnabled())) {
- item = 0;
- }
-
- if (item) {
- setFocus(focusReason);
- if (item == d->focusItem)
- return;
- }
-
- if (d->focusItem) {
- QFocusEvent event(QEvent::FocusOut, focusReason);
- d->lastFocusItem = d->focusItem;
- d->focusItem = 0;
- d->sendEvent(d->lastFocusItem, &event);
- }
-
- if (item) {
- if (item->isWidget()) {
- // Update focus child chain.
- static_cast<QGraphicsWidget *>(item)->d_func()->setFocusWidget();
- }
-
- d->focusItem = item;
- QFocusEvent event(QEvent::FocusIn, focusReason);
- d->sendEvent(item, &event);
- }
+ if (item)
+ item->setFocus(focusReason);
+ else
+ d->setFocusItemHelper(item, focusReason);
}
/*!
@@ -3572,13 +2714,17 @@ void QGraphicsScene::clearFocus()
/*!
\property QGraphicsScene::stickyFocus
- \brief whether or not clicking the scene will clear focus
+ \brief whether clicking into the scene background will clear focus
- If this property is false (the default), then clicking on the scene
- background or on an item that does not accept focus, will clear
- focus. Otherwise, focus will remain unchanged.
+ \since 4.6
- The focus change happens in response to a mouse press. You can reimplement
+ In a QGraphicsScene with stickyFocus set to true, focus will remain
+ unchanged when the user clicks into the scene background or on an item
+ that does not accept focus. Otherwise, focus will be cleared.
+
+ By default, this property is false.
+
+ Focus changes in response to a mouse press. You can reimplement
mousePressEvent() in a subclass of QGraphicsScene to toggle this property
based on where the user has clicked.
@@ -3701,7 +2847,7 @@ void QGraphicsScene::setForegroundBrush(const QBrush &brush)
QVariant QGraphicsScene::inputMethodQuery(Qt::InputMethodQuery query) const
{
Q_D(const QGraphicsScene);
- if (!d->focusItem)
+ if (!d->focusItem || !(d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod))
return QVariant();
const QTransform matrix = d->focusItem->sceneTransform();
QVariant value = d->focusItem->inputMethodQuery(query);
@@ -3737,7 +2883,7 @@ void QGraphicsScene::update(const QRectF &rect)
if (directUpdates) {
// Update all views.
for (int i = 0; i < d->views.size(); ++i)
- d->views.at(i)->d_func()->updateAll();
+ d->views.at(i)->d_func()->fullUpdatePending = true;
}
} else {
if (directUpdates) {
@@ -4018,132 +3164,17 @@ bool QGraphicsScene::event(QEvent *event)
// geometries that do not have an explicit style set.
update();
break;
- case QEvent::GraphicsSceneGesture: {
- QGraphicsSceneGestureEvent *ev = static_cast<QGraphicsSceneGestureEvent*>(event);
- QGraphicsView *view = qobject_cast<QGraphicsView*>(ev->widget());
- if (!view) {
- qWarning("QGraphicsScene::event: gesture event was received without a view");
- break;
- }
-
- // get a list of gestures that just started.
- QSet<QGesture*> startedGestures;
- QList<QGesture*> gestures = ev->gestures();
- for(QList<QGesture*>::const_iterator it = gestures.begin(), e = gestures.end();
- it != e; ++it) {
- QGesture *g = *it;
- QGesturePrivate *gd = g->d_func();
- if (g->state() == Qt::GestureStarted || gd->singleshot) {
- startedGestures.insert(g);
- }
- }
- if (!startedGestures.isEmpty()) {
- // find a target for each started gesture.
- for(QSet<QGesture*>::const_iterator it = startedGestures.begin(), e = startedGestures.end();
- it != e; ++it) {
- QGesture *g = *it;
- QGesturePrivate *gd = g->d_func();
- gd->graphicsItem = 0;
- QList<QGraphicsItem*> itemsInGestureArea = items(g->hotSpot());
- const QString gestureName = g->type();
- foreach(QGraphicsItem *item, itemsInGestureArea) {
- if (item->d_func()->hasGesture(gestureName)) {
- Q_ASSERT(gd->graphicsItem == 0);
- gd->graphicsItem = item;
- d->itemsWithGestures[item].insert(g);
- break;
- }
- }
- }
- }
- d->sendGestureEvent(ev->gestures().toSet(), ev->cancelledGestures());
- }
- break;
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
d->touchEventHandler(static_cast<QTouchEvent *>(event));
break;
- case QEvent::Timer:
- if (d->indexTimerId && static_cast<QTimerEvent *>(event)->timerId() == d->indexTimerId) {
- if (d->restartIndexTimer) {
- d->restartIndexTimer = false;
- } else {
- // this call will kill the timer
- d->_q_updateIndex();
- }
- }
- // Fallthrough intended - support timers in subclasses.
default:
return QObject::event(event);
}
return true;
}
-void QGraphicsScenePrivate::sendGestureEvent(const QSet<QGesture*> &gestures, const QSet<QString> &cancelled)
-{
- Q_Q(QGraphicsScene);
- typedef QMap<QGraphicsItem*, QSet<QGesture*> > ItemGesturesMap;
- ItemGesturesMap itemGestures;
- QSet<QGesture*> startedGestures;
- for(QSet<QGesture*>::const_iterator it = gestures.begin(), e = gestures.end();
- it != e; ++it) {
- QGesture *g = *it;
- Q_ASSERT(g != 0);
- QGesturePrivate *gd = g->d_func();
- if (gd->graphicsItem != 0) {
- itemGestures[gd->graphicsItem].insert(g);
- if (g->state() == Qt::GestureStarted || gd->singleshot)
- startedGestures.insert(g);
- }
- }
-
- QSet<QGesture*> ignoredGestures;
- for(ItemGesturesMap::const_iterator it = itemGestures.begin(), e = itemGestures.end();
- it != e; ++it) {
- QGraphicsItem *receiver = it.key();
- Q_ASSERT(receiver != 0);
- QGraphicsSceneGestureEvent event;
- event.setGestures(it.value());
- event.setCancelledGestures(cancelled);
- bool processed = sendEvent(receiver, &event);
- QSet<QGesture*> started = startedGestures.intersect(it.value());
- if (event.isAccepted())
- foreach(QGesture *g, started)
- g->accept();
- if (!started.isEmpty() && !(processed && event.isAccepted())) {
- // there are started gestures event that weren't
- // accepted, so propagating each gesture independently.
- QSet<QGesture*>::const_iterator it = started.begin(),
- e = started.end();
- for(; it != e; ++it) {
- QGesture *g = *it;
- if (processed && g->isAccepted()) {
- continue;
- }
- QGesturePrivate *gd = g->d_func();
- QGraphicsItem *item = gd->graphicsItem;
- gd->graphicsItem = 0;
-
- //### THIS IS BS, DONT FORGET TO REWRITE THIS CODE
- // need to make sure we try to deliver event just once to each widget
- const QString gestureType = g->type();
- QList<QGraphicsItem*> itemsUnderGesture = q->items(g->hotSpot());
- for (int i = 0; i < itemsUnderGesture.size(); ++i) {
- QGraphicsItem *item = itemsUnderGesture.at(i);
- if (item != receiver && item->d_func()->hasGesture(gestureType)) {
- ignoredGestures.insert(g);
- gd->graphicsItem = item;
- break;
- }
- }
- }
- }
- }
- if (!ignoredGestures.isEmpty())
- sendGestureEvent(ignoredGestures, cancelled);
-}
-
/*!
\reimp
@@ -4769,16 +3800,16 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
subclass to receive input method events for the scene.
The default implementation forwards the event to the focusItem().
- If no item currently has focus, this function does nothing.
+ If no item currently has focus or the current focus item does not
+ accept input methods, this function does nothing.
\sa QGraphicsItem::inputMethodEvent()
*/
void QGraphicsScene::inputMethodEvent(QInputMethodEvent *event)
{
Q_D(QGraphicsScene);
- if (!d->focusItem)
- return;
- d->sendEvent(d->focusItem, event);
+ if (d->focusItem && (d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod))
+ d->sendEvent(d->focusItem, event);
}
/*!
@@ -5226,6 +4257,20 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
}
}
+void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const viewTransform,
+ QRegion *exposedRegion, QWidget *widget)
+{
+ QRectF exposedSceneRect;
+ if (exposedRegion && indexMethod != QGraphicsScene::NoIndex) {
+ exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1);
+ if (viewTransform)
+ exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect);
+ }
+ const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::DescendingOrder);
+ for (int i = 0; i < tli.size(); ++i)
+ drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget);
+}
+
void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter,
const QTransform *const viewTransform,
QRegion *exposedRegion, QWidget *widget,
@@ -5248,6 +4293,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
QTransform transform(Qt::Uninitialized);
QTransform *transformPtr = 0;
+ bool translateOnlyTransform = false;
#define ENSURE_TRANSFORM_PTR \
if (!transformPtr) { \
Q_ASSERT(!itemIsUntransformable); \
@@ -5257,6 +4303,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
transformPtr = &transform; \
} else { \
transformPtr = &item->d_ptr->sceneTransform; \
+ translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; \
} \
}
@@ -5268,10 +4315,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
transform = item->deviceTransform(viewTransform ? *viewTransform : QTransform());
transformPtr = &transform;
} else if (item->d_ptr->dirtySceneTransform) {
- item->d_ptr->sceneTransform = item->d_ptr->parent ? item->d_ptr->parent->d_ptr->sceneTransform
- : QTransform();
- item->d_ptr->combineTransformFromParent(&item->d_ptr->sceneTransform);
- item->d_ptr->dirtySceneTransform = 0;
+ item->d_ptr->updateSceneTransformFromParent();
+ Q_ASSERT(!item->d_ptr->dirtySceneTransform);
wasDirtyParentSceneTransform = true;
}
@@ -5280,7 +4325,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (drawItem) {
const QRectF brect = adjustedItemBoundingRect(item);
ENSURE_TRANSFORM_PTR
- QRect viewBoundingRect = transformPtr->mapRect(brect).toRect();
+ QRect viewBoundingRect = translateOnlyTransform ? brect.translated(transformPtr->dx(), transformPtr->dy()).toRect()
+ : transformPtr->mapRect(brect).toRect();
item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect);
viewBoundingRect.adjust(-1, -1, 1, 1);
drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect) : !viewBoundingRect.isEmpty();
@@ -5297,10 +4343,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
int i = 0;
if (itemHasChildren) {
- if (item->d_ptr->needSortChildren) {
- item->d_ptr->needSortChildren = 0;
- qStableSort(item->d_ptr->children.begin(), item->d_ptr->children.end(), qt_notclosestLeaf);
- }
+ item->d_ptr->ensureSortedChildren();
if (itemClipsChildrenToShape) {
painter->save();
@@ -5326,7 +4369,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (drawItem) {
Q_ASSERT(!itemIsFullyTransparent);
Q_ASSERT(itemHasContents);
- item->d_ptr->initStyleOption(&styleOptionTmp, transform, exposedRegion
+ ENSURE_TRANSFORM_PTR
+ item->d_ptr->initStyleOption(&styleOptionTmp, *transformPtr, exposedRegion
? *exposedRegion : QRegion(), exposedRegion == 0);
const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape;
@@ -5334,10 +4378,9 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (savePainter)
painter->save();
- if (!itemHasChildren || !itemClipsChildrenToShape) {
- ENSURE_TRANSFORM_PTR
+ if (!itemHasChildren || !itemClipsChildrenToShape)
painter->setWorldTransform(*transformPtr);
- }
+
if (itemClipsToShape)
painter->setClipPath(item->shape(), Qt::IntersectClip);
painter->setOpacity(opacity);
@@ -5380,6 +4423,16 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b
/*ignoreVisibleBit=*/force,
/*ignoreDirtyBit=*/removingItemFromScene || invalidateChildren,
/*ignoreOpacity=*/ignoreOpacity)) {
+ if (item->d_ptr->dirty) {
+ // The item is already marked as dirty and will be processed later. However,
+ // we have to make sure ignoreVisible and ignoreOpacity are set properly;
+ // otherwise things like: item->update(); item->hide() (force is now true)
+ // won't work as expected.
+ if (force)
+ item->d_ptr->ignoreVisible = 1;
+ if (ignoreOpacity)
+ item->d_ptr->ignoreOpacity = 1;
+ }
return;
}
@@ -5439,65 +4492,121 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b
}
static inline bool updateHelper(QGraphicsViewPrivate *view, QGraphicsItemPrivate *item,
- const QRectF &rect, const QTransform &xform)
+ const QRectF &rect, bool itemIsUntransformable)
{
Q_ASSERT(view);
Q_ASSERT(item);
- if (item->hasBoundingRegionGranularity)
+
+ QGraphicsItem *itemq = static_cast<QGraphicsItem *>(item->q_ptr);
+ QGraphicsView *viewq = static_cast<QGraphicsView *>(view->q_ptr);
+
+ if (itemIsUntransformable) {
+ const QTransform xform = itemq->deviceTransform(viewq->viewportTransform());
+ if (!item->hasBoundingRegionGranularity)
+ return view->updateRect(xform.mapRect(rect).toRect());
return view->updateRegion(xform.map(QRegion(rect.toRect())));
- return view->updateRect(xform.mapRect(rect).toRect());
+ }
+
+ if (item->sceneTransformTranslateOnly && view->identityMatrix) {
+ const qreal dx = item->sceneTransform.dx();
+ const qreal dy = item->sceneTransform.dy();
+ if (!item->hasBoundingRegionGranularity) {
+ QRectF r(rect);
+ r.translate(dx - view->horizontalScroll(), dy - view->verticalScroll());
+ return view->updateRect(r.toRect());
+ }
+ QRegion r(rect.toRect());
+ r.translate(qRound(dx) - view->horizontalScroll(), qRound(dy) - view->verticalScroll());
+ return view->updateRegion(r);
+ }
+
+ if (!viewq->isTransformed()) {
+ if (!item->hasBoundingRegionGranularity)
+ return view->updateRect(item->sceneTransform.mapRect(rect).toRect());
+ return view->updateRegion(item->sceneTransform.map(QRegion(rect.toRect())));
+ }
+
+ QTransform xform = item->sceneTransform;
+ xform *= viewq->viewportTransform();
+ if (!item->hasBoundingRegionGranularity)
+ return view->updateRect(xform.mapRect(rect).toRect());
+ return view->updateRegion(xform.map(QRegion(rect.toRect())));
}
void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren,
qreal parentOpacity)
{
Q_Q(QGraphicsScene);
+ Q_ASSERT(item);
+ Q_ASSERT(!updateAll);
- bool wasDirtyParentViewBoundingRects = false;
- bool wasDirtyParentSceneTransform = false;
- qreal opacity = parentOpacity;
+ if (!item->d_ptr->dirty && !item->d_ptr->dirtyChildren) {
+ resetDirtyItem(item);
+ return;
+ }
- if (item) {
- wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint;
- opacity = item->d_ptr->combineOpacityFromParent(parentOpacity);
- const bool itemIsHidden = !item->d_ptr->ignoreVisible && !item->d_ptr->visible;
- const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity && opacity == 0.0;
-
- if (item->d_ptr->dirtySceneTransform && !itemIsHidden && !item->d_ptr->itemIsUntransformable()
- && !(itemIsFullyTransparent && item->d_ptr->childrenCombineOpacity())) {
- // Calculate the full scene transform for this item.
- item->d_ptr->sceneTransform = item->d_ptr->parent ? item->d_ptr->parent->d_ptr->sceneTransform
- : QTransform();
- item->d_ptr->combineTransformFromParent(&item->d_ptr->sceneTransform);
- item->d_ptr->dirtySceneTransform = 0;
- wasDirtyParentSceneTransform = true;
- }
+ const bool itemIsHidden = !item->d_ptr->ignoreVisible && !item->d_ptr->visible;
+ if (itemIsHidden) {
+ resetDirtyItem(item, /*recursive=*/true);
+ return;
+ }
+
+ const bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents);
+ const bool itemHasChildren = !item->d_ptr->children.isEmpty();
+ if (!itemHasContents && !itemHasChildren) {
+ resetDirtyItem(item);
+ return; // Item has neither contents nor children!(?)
+ }
+
+ const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity);
+ const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity && opacity < 0.0001;
+ if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) {
+ resetDirtyItem(item, /*recursive=*/itemHasChildren);
+ return;
+ }
- if (itemIsHidden || itemIsFullyTransparent || (item->d_ptr->flags & QGraphicsItem::ItemHasNoContents)) {
- // Make sure we don't process invisible items or items with no content.
- item->d_ptr->dirty = 0;
+ bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform;
+ const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable();
+ if (wasDirtyParentSceneTransform && !itemIsUntransformable) {
+ item->d_ptr->updateSceneTransformFromParent();
+ Q_ASSERT(!item->d_ptr->dirtySceneTransform);
+ }
+
+ const bool wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint;
+ if (itemIsFullyTransparent || !itemHasContents || dirtyAncestorContainsChildren) {
+ // Make sure we don't process invisible items or items with no content.
+ item->d_ptr->dirty = 0;
+ item->d_ptr->fullUpdatePending = 0;
+ // Might have a dirty view bounding rect otherwise.
+ if (itemIsFullyTransparent || !itemHasContents)
item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0;
+ }
+
+ if (!hasSceneRect && item->d_ptr->geometryChanged && item->d_ptr->visible) {
+ // Update growingItemsBoundingRect.
+ if (item->d_ptr->sceneTransformTranslateOnly) {
+ growingItemsBoundingRect |= item->boundingRect().translated(item->d_ptr->sceneTransform.dx(),
+ item->d_ptr->sceneTransform.dy());
+ } else {
+ growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect());
}
}
// Process item.
- if (item && (item->d_ptr->dirty || item->d_ptr->paintedViewBoundingRectsNeedRepaint)) {
+ if (item->d_ptr->dirty || item->d_ptr->paintedViewBoundingRectsNeedRepaint) {
const bool useCompatUpdate = views.isEmpty() || (connectedSignals & changedSignalMask);
- const bool untransformableItem = item->d_ptr->itemIsUntransformable();
const QRectF itemBoundingRect = adjustedItemBoundingRect(item);
- if (item->d_ptr->geometryChanged) {
- // Update growingItemsBoundingRect.
- if (!hasSceneRect)
- growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(itemBoundingRect);
- item->d_ptr->geometryChanged = 0;
- }
-
- if (useCompatUpdate && !untransformableItem && qFuzzyIsNull(item->boundingRegionGranularity())) {
+ if (useCompatUpdate && !itemIsUntransformable && qFuzzyIsNull(item->boundingRegionGranularity())) {
// This block of code is kept for compatibility. Since 4.5, by default
// QGraphicsView does not connect the signal and we use the below
// method of delivering updates.
- q->update(item->d_ptr->sceneTransform.mapRect(itemBoundingRect));
+ if (item->d_ptr->sceneTransformTranslateOnly) {
+ q->update(itemBoundingRect.translated(item->d_ptr->sceneTransform.dx(),
+ item->d_ptr->sceneTransform.dy()));
+ } else {
+ q->update(item->d_ptr->sceneTransform.mapRect(itemBoundingRect));
+ }
} else {
QRectF dirtyRect;
bool uninitializedDirtyRect = true;
@@ -5505,30 +4614,31 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
for (int j = 0; j < views.size(); ++j) {
QGraphicsView *view = views.at(j);
QGraphicsViewPrivate *viewPrivate = view->d_func();
- if (viewPrivate->fullUpdatePending)
- continue;
- switch (viewPrivate->viewportUpdateMode) {
- case QGraphicsView::NoViewportUpdate:
- continue;
- case QGraphicsView::FullViewportUpdate:
- view->viewport()->update();
- viewPrivate->fullUpdatePending = 1;
+ QRect &paintedViewBoundingRect = item->d_ptr->paintedViewBoundingRects[viewPrivate->viewport];
+ if (viewPrivate->fullUpdatePending
+ || viewPrivate->viewportUpdateMode == QGraphicsView::NoViewportUpdate) {
+ // Okay, if we have a full update pending or no viewport update, this item's
+ // paintedViewBoundingRect will be updated correctly in the next paintEvent if
+ // it is inside the viewport, but for now we can pretend that it is outside.
+ paintedViewBoundingRect = QRect(-1, -1, -1, -1);
continue;
- default:
- break;
}
- QRect &paintedViewBoundingRect = item->d_ptr->paintedViewBoundingRects[viewPrivate->viewport];
- if (item->d_ptr->paintedViewBoundingRectsNeedRepaint) {
- wasDirtyParentViewBoundingRects = true;
+ if (item->d_ptr->paintedViewBoundingRectsNeedRepaint && !paintedViewBoundingRect.isEmpty()) {
paintedViewBoundingRect.translate(viewPrivate->dirtyScrollOffset);
if (!viewPrivate->updateRect(paintedViewBoundingRect))
- paintedViewBoundingRect = QRect();
+ paintedViewBoundingRect = QRect(-1, -1, -1, -1); // Outside viewport.
}
if (!item->d_ptr->dirty)
continue;
+ if (!item->d_ptr->paintedViewBoundingRectsNeedRepaint
+ && paintedViewBoundingRect.x() == -1 && paintedViewBoundingRect.y() == -1
+ && paintedViewBoundingRect.width() == -1 && paintedViewBoundingRect.height() == -1) {
+ continue; // Outside viewport.
+ }
+
if (uninitializedDirtyRect) {
dirtyRect = itemBoundingRect;
if (!item->d_ptr->fullUpdatePending) {
@@ -5541,35 +4651,25 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
if (dirtyRect.isEmpty())
continue; // Discard updates outside the bounding rect.
- bool valid = false;
- if (untransformableItem) {
- valid = updateHelper(viewPrivate, item->d_ptr.data(), dirtyRect,
- item->deviceTransform(view->viewportTransform()));
- } else if (!view->isTransformed()) {
- valid = updateHelper(viewPrivate, item->d_ptr.data(), dirtyRect, item->d_ptr->sceneTransform);
- } else {
- QTransform deviceTransform = item->d_ptr->sceneTransform;
- deviceTransform *= view->viewportTransform();
- valid = updateHelper(viewPrivate, item->d_ptr.data(), dirtyRect, deviceTransform);
+ if (!updateHelper(viewPrivate, item->d_ptr, dirtyRect, itemIsUntransformable)
+ && item->d_ptr->paintedViewBoundingRectsNeedRepaint) {
+ paintedViewBoundingRect = QRect(-1, -1, -1, -1); // Outside viewport.
}
- if (!valid)
- paintedViewBoundingRect = QRect();
}
}
}
- // Process root items / children.
- if (!item || item->d_ptr->dirtyChildren) {
- QList<QGraphicsItem *> *children = item ? &item->d_ptr->children : &topLevelItems;
- const bool allChildrenDirty = item && item->d_ptr->allChildrenDirty;
+ // Process children.
+ if (itemHasChildren && item->d_ptr->dirtyChildren) {
if (!dirtyAncestorContainsChildren) {
- dirtyAncestorContainsChildren = item && item->d_ptr->fullUpdatePending
+ dirtyAncestorContainsChildren = item->d_ptr->fullUpdatePending
&& (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape);
}
- const bool parentIgnoresVisible = item && item->d_ptr->ignoreVisible;
- const bool parentIgnoresOpacity = item && item->d_ptr->ignoreOpacity;
- for (int i = 0; i < children->size(); ++i) {
- QGraphicsItem *child = children->at(i);
+ const bool allChildrenDirty = item->d_ptr->allChildrenDirty;
+ const bool parentIgnoresVisible = item->d_ptr->ignoreVisible;
+ const bool parentIgnoresOpacity = item->d_ptr->ignoreOpacity;
+ for (int i = 0; i < item->d_ptr->children.size(); ++i) {
+ QGraphicsItem *child = item->d_ptr->children.at(i);
if (wasDirtyParentSceneTransform)
child->d_ptr->dirtySceneTransform = 1;
if (wasDirtyParentViewBoundingRects)
@@ -5578,36 +4678,19 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
child->d_ptr->ignoreVisible = 1;
if (parentIgnoresOpacity)
child->d_ptr->ignoreOpacity = 1;
-
if (allChildrenDirty) {
child->d_ptr->dirty = 1;
child->d_ptr->fullUpdatePending = 1;
child->d_ptr->dirtyChildren = 1;
child->d_ptr->allChildrenDirty = 1;
- } else if (!child->d_ptr->dirty && !child->d_ptr->dirtyChildren) {
- resetDirtyItem(child);
- continue;
- }
-
- if (dirtyAncestorContainsChildren || updateAll) {
- // No need to process this child's dirty rect, hence reset the dirty state.
- // However, we have to continue the recursion because it might have a dirty
- // view bounding rect that needs repaint. We also have to reset the dirty
- // state of its descendants.
- child->d_ptr->dirty = 0;
- child->d_ptr->fullUpdatePending = 0;
- if (updateAll)
- child->d_ptr->paintedViewBoundingRectsNeedRepaint = 0;
}
-
processDirtyItemsRecursive(child, dirtyAncestorContainsChildren, opacity);
}
} else if (wasDirtyParentSceneTransform) {
item->d_ptr->invalidateChildrenSceneTransform();
}
- if (item)
- resetDirtyItem(item);
+ resetDirtyItem(item);
}
/*!
@@ -5988,34 +5071,42 @@ void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget)
}
}
-void QGraphicsScenePrivate::addView(QGraphicsView *view)
-{
- views << view;
- foreach(int gestureId, grabbedGestures)
- view->d_func()->grabGesture(gestureId);
-}
+/*!
+ \since 4.6
-void QGraphicsScenePrivate::removeView(QGraphicsView *view)
+ Sends event \a event to item \a item through possible event filters.
+
+ The event is sent only if the item is enabled.
+
+ Returns \c false if the event was filtered or if the item is disabled.
+ Otherwise returns the value that was returned from the event handler.
+
+ \sa QGraphicsItem::sceneEvent(), QGraphicsItem::sceneEventFilter()
+*/
+bool QGraphicsScene::sendEvent(QGraphicsItem *item, QEvent *event)
{
- views.removeAll(view);
- foreach(int gestureId, grabbedGestures)
- view->releaseGesture(gestureId);
+ Q_D(QGraphicsScene);
+ if (!item) {
+ qWarning("QGraphicsScene::sendEvent: cannot send event to a null item");
+ return false;
+ }
+ if (item->scene() != this) {
+ qWarning("QGraphicsScene::sendEvent: item %p's scene (%p)"
+ " is different from this scene (%p)",
+ item, item->scene(), this);
+ return false;
+ }
+ return d->sendEvent(item, event);
}
-void QGraphicsScenePrivate::grabGesture(QGraphicsItem *item, int gestureId)
+void QGraphicsScenePrivate::addView(QGraphicsView *view)
{
- if (!grabbedGestures.contains(gestureId)) {
- foreach(QGraphicsView *view, views)
- view->d_func()->grabGesture(gestureId);
- }
- (void)itemsWithGestures[item];
- grabbedGestures << gestureId;
+ views << view;
}
-void QGraphicsScenePrivate::releaseGesture(QGraphicsItem *item, int gestureId)
+void QGraphicsScenePrivate::removeView(QGraphicsView *view)
{
- itemsWithGestures.remove(item);
- //###
+ views.removeAll(view);
}
void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent)
@@ -6227,6 +5318,11 @@ void QGraphicsScenePrivate::enableTouchEventsOnViews()
view->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, true);
}
+void QGraphicsScenePrivate::updateInputMethodSensitivityInViews()
+{
+ for (int i = 0; i < views.size(); ++i)
+ views.at(i)->d_func()->updateInputMethodSensitivity();
+}
QT_END_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h
index 4d65b91..c0c6e75 100644
--- a/src/gui/graphicsview/qgraphicsscene.h
+++ b/src/gui/graphicsview/qgraphicsscene.h
@@ -79,11 +79,11 @@ class QGraphicsSceneHelpEvent;
class QGraphicsSceneHoverEvent;
class QGraphicsSceneMouseEvent;
class QGraphicsSceneWheelEvent;
-class QGraphicsSceneGestureEvent;
class QGraphicsSimpleTextItem;
class QGraphicsTextItem;
class QGraphicsView;
class QGraphicsWidget;
+class QGraphicsSceneIndex;
class QHelpEvent;
class QInputMethodEvent;
class QKeyEvent;
@@ -153,22 +153,39 @@ public:
QRectF itemsBoundingRect() const;
QList<QGraphicsItem *> items() const;
- QList<QGraphicsItem *> items(const QPointF &pos) const;
- QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
- QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
- QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
+ QList<QGraphicsItem *> items(Qt::SortOrder order) const; // ### Qt 5: unify
+
+ QList<QGraphicsItem *> items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
+ QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
+ QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
+ QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
+
+ QList<QGraphicsItem *> items(const QPointF &pos) const; // ### obsolete
+ QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete
+ QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete
+ QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete
+
QList<QGraphicsItem *> collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
- QGraphicsItem *itemAt(const QPointF &pos) const;
+
+ QGraphicsItem *itemAt(const QPointF &pos) const; // ### obsolete
+ QGraphicsItem *itemAt(const QPointF &pos, const QTransform &deviceTransform) const;
inline QList<QGraphicsItem *> items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const
- { return items(QRectF(x, y, w, h), mode); }
- inline QGraphicsItem *itemAt(qreal x, qreal y) const
+ { return items(QRectF(x, y, w, h), mode); } // ### obsolete
+ inline QList<QGraphicsItem *> items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order,
+ const QTransform &deviceTransform = QTransform()) const
+ { return items(QRectF(x, y, w, h), mode, order, deviceTransform); }
+ inline QGraphicsItem *itemAt(qreal x, qreal y) const // ### obsolete
{ return itemAt(QPointF(x, y)); }
+ inline QGraphicsItem *itemAt(qreal x, qreal y, const QTransform &deviceTransform) const
+ { return itemAt(QPointF(x, y), deviceTransform); }
QList<QGraphicsItem *> selectedItems() const;
QPainterPath selectionArea() const;
- void setSelectionArea(const QPainterPath &path);
- void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode);
+ void setSelectionArea(const QPainterPath &path); // ### obsolete
+ void setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform);
+ void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode); // ### obsolete
+ void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, const QTransform &deviceTransform);
QGraphicsItemGroup *createItemGroup(const QList<QGraphicsItem *> &items);
void destroyItemGroup(QGraphicsItemGroup *group);
@@ -229,6 +246,8 @@ public:
QGraphicsWidget *activeWindow() const;
void setActiveWindow(QGraphicsWidget *widget);
+ bool sendEvent(QGraphicsItem *item, QEvent *event);
+
public Q_SLOTS:
void update(const QRectF &rect = QRectF());
void invalidate(const QRectF &rect = QRectF(), SceneLayers layers = AllLayers);
@@ -274,11 +293,8 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QGraphicsScene)
Q_DISABLE_COPY(QGraphicsScene)
- Q_PRIVATE_SLOT(d_func(), void _q_updateIndex())
Q_PRIVATE_SLOT(d_func(), void _q_emitUpdated())
- Q_PRIVATE_SLOT(d_func(), void _q_updateLater())
Q_PRIVATE_SLOT(d_func(), void _q_polishItems())
- Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache())
Q_PRIVATE_SLOT(d_func(), void _q_processDirtyItems())
friend class QGraphicsItem;
friend class QGraphicsItemPrivate;
@@ -286,6 +302,10 @@ private:
friend class QGraphicsViewPrivate;
friend class QGraphicsWidget;
friend class QGraphicsWidgetPrivate;
+ friend class QGraphicsSceneIndex;
+ friend class QGraphicsSceneIndexPrivate;
+ friend class QGraphicsSceneBspTreeIndex;
+ friend class QGraphicsSceneBspTreeIndexPrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsScene::SceneLayers)
diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp
index 3f3e58b..fb4b9a4 100644
--- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp
+++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp
@@ -70,12 +70,15 @@ class QGraphicsSceneFindItemBspTreeVisitor : public QGraphicsSceneBspTreeVisitor
{
public:
QList<QGraphicsItem *> *foundItems;
+ bool onlyTopLevelItems;
void visit(QList<QGraphicsItem *> *items)
{
for (int i = 0; i < items->size(); ++i) {
QGraphicsItem *item = items->at(i);
- if (!item->d_func()->itemDiscovered && item->isVisible()) {
+ if (onlyTopLevelItems && item->d_ptr->parent)
+ item = item->topLevelItem();
+ if (!item->d_func()->itemDiscovered && item->d_ptr->visible) {
item->d_func()->itemDiscovered = 1;
foundItems->prepend(item);
}
@@ -143,19 +146,15 @@ void QGraphicsSceneBspTree::removeItems(const QSet<QGraphicsItem *> &items)
}
}
-QList<QGraphicsItem *> QGraphicsSceneBspTree::items(const QRectF &rect)
+QList<QGraphicsItem *> QGraphicsSceneBspTree::items(const QRectF &rect, bool onlyTopLevelItems) const
{
QList<QGraphicsItem *> tmp;
findVisitor->foundItems = &tmp;
+ findVisitor->onlyTopLevelItems = onlyTopLevelItems;
climbTree(findVisitor, rect);
- return tmp;
-}
-
-QList<QGraphicsItem *> QGraphicsSceneBspTree::items(const QPointF &pos)
-{
- QList<QGraphicsItem *> tmp;
- findVisitor->foundItems = &tmp;
- climbTree(findVisitor, pos);
+ // Reset discovery bits.
+ for (int i = 0; i < tmp.size(); ++i)
+ tmp.at(i)->d_ptr->itemDiscovered = 0;
return tmp;
}
@@ -235,47 +234,17 @@ void QGraphicsSceneBspTree::initialize(const QRectF &rect, int depth, int index)
}
}
-void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index)
-{
- if (nodes.isEmpty())
- return;
-
- const Node &node = nodes.at(index);
- int childIndex = firstChildIndex(index);
-
- switch (node.type) {
- case Node::Leaf: {
- visitor->visit(&leaves[node.leafIndex]);
- break;
- }
- case Node::Vertical:
- if (pos.x() < node.offset) {
- climbTree(visitor, pos, childIndex);
- } else {
- climbTree(visitor, pos, childIndex + 1);
- }
- break;
- case Node::Horizontal:
- if (pos.y() < node.offset) {
- climbTree(visitor, pos, childIndex);
- } else {
- climbTree(visitor, pos, childIndex + 1);
- }
- break;
- }
-}
-
-void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index)
+void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index) const
{
if (nodes.isEmpty())
return;
const Node &node = nodes.at(index);
- int childIndex = firstChildIndex(index);
+ const int childIndex = firstChildIndex(index);
switch (node.type) {
case Node::Leaf: {
- visitor->visit(&leaves[node.leafIndex]);
+ visitor->visit(const_cast<QList<QGraphicsItem*>*>(&leaves[node.leafIndex]));
break;
}
case Node::Vertical:
@@ -288,7 +257,6 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con
}
break;
case Node::Horizontal:
- int childIndex = firstChildIndex(index);
if (rect.top() < node.offset) {
climbTree(visitor, rect, childIndex);
if (rect.bottom() >= node.offset)
diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h
index 73a937f..4cac64a 100644
--- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h
@@ -92,8 +92,7 @@ public:
void removeItem(QGraphicsItem *item, const QRectF &rect);
void removeItems(const QSet<QGraphicsItem *> &items);
- QList<QGraphicsItem *> items(const QRectF &rect);
- QList<QGraphicsItem *> items(const QPointF &pos);
+ QList<QGraphicsItem *> items(const QRectF &rect, bool onlyTopLevelItems = false) const;
int leafCount() const;
inline int firstChildIndex(int index) const
@@ -106,11 +105,7 @@ public:
private:
void initialize(const QRectF &rect, int depth, int index);
- void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index = 0);
- void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index = 0);
-
- void findItems(QList<QGraphicsItem *> *foundItems, const QRectF &rect, int index);
- void findItems(QList<QGraphicsItem *> *foundItems, const QPointF &pos, int index);
+ void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index = 0) const;
QRectF rectForIndex(int index) const;
QVector<Node> nodes;
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 3c3a811..a4bbdd2 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -59,7 +59,6 @@
#include "qgraphicssceneevent.h"
#include "qgraphicsview.h"
-#include "qgraphicsscene_bsp_p.h"
#include "qgraphicsitem_p.h"
#include <private/qobject_p.h>
@@ -72,13 +71,11 @@
#include <QtGui/qstyle.h>
#include <QtGui/qstyleoption.h>
-static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000;
-
QT_BEGIN_NAMESPACE
+class QGraphicsSceneIndex;
class QGraphicsView;
class QGraphicsWidget;
-class QGesture;
class QGraphicsScenePrivate : public QObjectPrivate
{
@@ -87,24 +84,19 @@ public:
QGraphicsScenePrivate();
void init();
+ static QGraphicsScenePrivate *get(QGraphicsScene *q);
+
quint32 changedSignalMask;
QGraphicsScene::ItemIndexMethod indexMethod;
- int bspTreeDepth;
-
- QList<QGraphicsItem *> estimateItemsInRect(const QRectF &rect) const;
- void addToIndex(QGraphicsItem *item);
- void removeFromIndex(QGraphicsItem *item);
- void resetIndex();
+ QGraphicsSceneIndex *index;
- QGraphicsSceneBspTree bspTree;
- void _q_updateIndex();
int lastItemCount;
QRectF sceneRect;
bool hasSceneRect;
+ bool dirtyGrowingItemsBoundingRect;
QRectF growingItemsBoundingRect;
- QRectF largestUntransformableItem;
void _q_emitUpdated();
QList<QRectF> updatedRects;
@@ -115,9 +107,6 @@ public:
QPainterPath selectionArea;
int selectionChanging;
QSet<QGraphicsItem *> selectedItems;
- QList<QGraphicsItem *> unindexedItems;
- QList<QGraphicsItem *> indexedItems;
- QList<QGraphicsItem *> pendingUpdateItems;
QList<QGraphicsItem *> unpolishedItems;
QList<QGraphicsItem *> topLevelItems;
bool needSortTopLevelItems;
@@ -129,21 +118,11 @@ public:
void _q_processDirtyItems();
- QList<int> freeItemIndexes;
- bool regenerateIndex;
-
- bool purgePending;
void removeItemHelper(QGraphicsItem *item);
- QSet<QGraphicsItem *> removedItems;
- void purgeRemovedItems();
QBrush backgroundBrush;
QBrush foregroundBrush;
- int indexTimerId;
- bool restartIndexTimer;
- void startIndexTimer(int interval = QGRAPHICSSCENE_INDEXTIMER_TIMEOUT);
-
bool stickyFocus;
bool hasFocus;
QGraphicsItem *focusItem;
@@ -151,6 +130,8 @@ public:
QGraphicsWidget *tabFocusFirst;
QGraphicsWidget *activeWindow;
int activationRefCount;
+ void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason);
+ QMultiHash<QGraphicsItem *, QGraphicsItem *> focusProxyReverseMap;
QList<QGraphicsWidget *> popupWidgets;
void addPopup(QGraphicsWidget *widget);
@@ -182,7 +163,6 @@ public:
QList<QGraphicsItem *> itemsAtPosition(const QPoint &screenPos,
const QPointF &scenePos,
QWidget *widget) const;
- static bool itemCollidesWithPath(QGraphicsItem *item, const QPainterPath &path, Qt::ItemSelectionMode mode);
void storeMouseButtonsForMouseGrabber(QGraphicsSceneMouseEvent *event);
QList<QGraphicsView *> views;
@@ -194,6 +174,7 @@ public:
QMultiMap<QGraphicsItem *, QGraphicsItem *> sceneEventFilters;
void installSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter);
void removeSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter);
+ bool filterDescendantEvent(QGraphicsItem *item, QEvent *event);
bool filterEvent(QGraphicsItem *item, QEvent *event);
bool sendEvent(QGraphicsItem *item, QEvent *event);
@@ -211,69 +192,14 @@ public:
void mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent);
QGraphicsWidget *windowForItem(const QGraphicsItem *item) const;
- QList<QGraphicsItem *> topLevelItemsInStackingOrder(const QTransform *const, QRegion *);
- void recursive_items_helper(QGraphicsItem *item, QRectF rect, QList<QGraphicsItem *> *items,
- const QTransform &parentTransform, const QTransform &viewTransform,
- Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const;
-
- QList<QGraphicsItem *> items_helper(const QPointF &pos) const;
- QList<QGraphicsItem *> items_helper(const QRectF &rect,
- Qt::ItemSelectionMode mode,
- Qt::SortOrder order) const;
- QList<QGraphicsItem *> items_helper(const QPolygonF &rect,
- Qt::ItemSelectionMode mode,
- Qt::SortOrder order) const;
- QList<QGraphicsItem *> items_helper(const QPainterPath &rect,
- Qt::ItemSelectionMode mode,
- Qt::SortOrder order) const;
- void childItems_helper(QList<QGraphicsItem *> *items,
- const QGraphicsItem *parent,
- const QPointF &pos) const;
- void childItems_helper(QList<QGraphicsItem *> *items,
- const QGraphicsItem *parent,
- const QRectF &rect,
- Qt::ItemSelectionMode mode) const;
- void childItems_helper(QList<QGraphicsItem *> *items,
- const QGraphicsItem *parent,
- const QPolygonF &polygon,
- Qt::ItemSelectionMode mode) const;
- void childItems_helper(QList<QGraphicsItem *> *items,
- const QGraphicsItem *parent,
- const QPainterPath &path,
- Qt::ItemSelectionMode mode) const;
-
- bool sortCacheEnabled;
- bool updatingSortCache;
- void invalidateSortCache();
- static void climbTree(QGraphicsItem *item, int *stackingOrder);
- void _q_updateSortCache();
-
- static bool closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2);
- static bool closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2);
-
- static inline bool closestItemFirst_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
- {
- return item1->d_ptr->globalStackingOrder < item2->d_ptr->globalStackingOrder;
- }
- static inline bool closestItemLast_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
- {
- return item1->d_ptr->globalStackingOrder >= item2->d_ptr->globalStackingOrder;
- }
-
- static void sortItems(QList<QGraphicsItem *> *itemList, Qt::SortOrder order, bool cached);
+ bool sortCacheEnabled; // for compatibility
void drawItemHelper(QGraphicsItem *item, QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget,
bool painterStateProtection);
- inline void drawItems(QPainter *painter, const QTransform *const viewTransform,
- QRegion *exposedRegion, QWidget *widget)
- {
- const QList<QGraphicsItem *> tli = topLevelItemsInStackingOrder(viewTransform, exposedRegion);
- for (int i = 0; i < tli.size(); ++i)
- drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget);
- return;
- }
+ void drawItems(QPainter *painter, const QTransform *const viewTransform,
+ QRegion *exposedRegion, QWidget *widget);
void drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter, const QTransform *const,
QRegion *exposedRegion, QWidget *widget, qreal parentOpacity = qreal(1.0));
@@ -283,18 +209,32 @@ public:
void processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren = false,
qreal parentOpacity = qreal(1.0));
- inline void resetDirtyItem(QGraphicsItem *item)
+ inline void resetDirtyItem(QGraphicsItem *item, bool recursive = false)
{
Q_ASSERT(item);
item->d_ptr->dirty = 0;
item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0;
item->d_ptr->geometryChanged = 0;
+ if (!item->d_ptr->dirtyChildren)
+ recursive = false;
item->d_ptr->dirtyChildren = 0;
item->d_ptr->needsRepaint = QRectF();
item->d_ptr->allChildrenDirty = 0;
item->d_ptr->fullUpdatePending = 0;
item->d_ptr->ignoreVisible = 0;
item->d_ptr->ignoreOpacity = 0;
+ if (recursive) {
+ for (int i = 0; i < item->d_ptr->children.size(); ++i)
+ resetDirtyItem(item->d_ptr->children.at(i), recursive);
+ }
+ }
+
+ inline void ensureSortedTopLevelItems()
+ {
+ if (needSortTopLevelItems) {
+ qSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf);
+ needSortTopLevelItems = false;
+ }
}
QStyle *style;
@@ -309,13 +249,6 @@ public:
QStyleOptionGraphicsItem styleOptionTmp;
- // items with gestures -> list of started gestures.
- QMap<QGraphicsItem*, QSet<QGesture*> > itemsWithGestures;
- QSet<int> grabbedGestures;
- void grabGesture(QGraphicsItem *item, int gestureId);
- void releaseGesture(QGraphicsItem *item, int gestureId);
- void sendGestureEvent(const QSet<QGesture*> &gestures, const QSet<QString> &cancelled);
-
QMap<int, QTouchEvent::TouchPoint> sceneCurrentTouchPoints;
QMap<int, QGraphicsItem *> itemForTouchPointId;
static void updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent);
@@ -324,8 +257,29 @@ public:
bool sendTouchBeginEvent(QGraphicsItem *item, QTouchEvent *touchEvent);
bool allItemsIgnoreTouchEvents;
void enableTouchEventsOnViews();
+
+ void updateInputMethodSensitivityInViews();
};
+// QRectF::intersects() returns false always if either the source or target
+// rectangle's width or height are 0. This works around that problem.
+static inline void _q_adjustRect(QRectF *rect)
+{
+ Q_ASSERT(rect);
+ if (!rect->width())
+ rect->adjust(-0.00001, 0, 0.00001, 0);
+ if (!rect->height())
+ rect->adjust(0, -0.00001, 0, 0.00001);
+}
+
+static inline QRectF adjustedItemBoundingRect(const QGraphicsItem *item)
+{
+ Q_ASSERT(item);
+ QRectF boundingRect(item->boundingRect());
+ _q_adjustRect(&boundingRect);
+ return boundingRect;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_GRAPHICSVIEW
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
new file mode 100644
index 0000000..3cb33d1
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
@@ -0,0 +1,785 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QGraphicsSceneBspTreeIndex
+ \brief The QGraphicsSceneBspTreeIndex class provides an implementation of
+ a BSP indexing algorithm for discovering items in QGraphicsScene.
+ \since 4.6
+ \ingroup multimedia
+ \ingroup graphicsview-api
+ \mainclass
+ \internal
+
+ QGraphicsSceneBspTreeIndex index use a BSP(Binary Space Partitioning)
+ implementation to discover items quickly. This implementation is
+ very efficient for static scene. It has a depth that you can set.
+ The depth directly affects performance and memory usage; the latter
+ growing exponentially with the depth of the tree. With an optimal tree
+ depth, the index can instantly determine the locality of items, even
+ for scenes with thousands or millions of items. This also greatly improves
+ rendering performance.
+
+ By default, the value is 0, in which case Qt will guess a reasonable
+ default depth based on the size, location and number of items in the
+ scene. If these parameters change frequently, however, you may experience
+ slowdowns as the index retunes the depth internally. You can avoid
+ potential slowdowns by fixating the tree depth through setting this
+ property.
+
+ The depth of the tree and the size of the scene rectangle decide the
+ granularity of the scene's partitioning. The size of each scene segment is
+ determined by the following algorithm:
+
+ The BSP tree has an optimal size when each segment contains between 0 and
+ 10 items.
+
+ \sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex
+*/
+
+#include <QtCore/qglobal.h>
+
+#ifndef QT_NO_GRAPHICSVIEW
+
+#include <private/qgraphicsscene_p.h>
+#include <private/qgraphicsscenebsptreeindex_p.h>
+#include <private/qgraphicssceneindex_p.h>
+
+#include <QtCore/qmath.h>
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+static inline int intmaxlog(int n)
+{
+ return (n > 0 ? qMax(qCeil(qLn(qreal(n)) / qLn(qreal(2))), 5) : 0);
+}
+
+/*!
+ Constructs a private scene bsp index.
+*/
+QGraphicsSceneBspTreeIndexPrivate::QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene)
+ : QGraphicsSceneIndexPrivate(scene),
+ bspTreeDepth(0),
+ indexTimerId(0),
+ restartIndexTimer(false),
+ regenerateIndex(true),
+ lastItemCount(0),
+ purgePending(false),
+ sortCacheEnabled(false),
+ updatingSortCache(false)
+{
+}
+
+
+/*!
+ This method will update the BSP index by removing the items from the temporary
+ unindexed list and add them in the indexedItems list. This will also
+ update the growingItemsBoundingRect if needed. This will update the BSP
+ implementation as well.
+
+ \internal
+*/
+void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex()
+{
+ Q_Q(QGraphicsSceneBspTreeIndex);
+ if (!indexTimerId)
+ return;
+
+ q->killTimer(indexTimerId);
+ indexTimerId = 0;
+
+ purgeRemovedItems();
+
+ // Add unindexedItems to indexedItems
+ for (int i = 0; i < unindexedItems.size(); ++i) {
+ if (QGraphicsItem *item = unindexedItems.at(i)) {
+ Q_ASSERT(!item->d_ptr->itemDiscovered);
+ if (!freeItemIndexes.isEmpty()) {
+ int freeIndex = freeItemIndexes.takeFirst();
+ item->d_func()->index = freeIndex;
+ indexedItems[freeIndex] = item;
+ } else {
+ item->d_func()->index = indexedItems.size();
+ indexedItems << item;
+ }
+ }
+ }
+
+ // Determine whether we should regenerate the BSP tree.
+ if (bspTreeDepth == 0) {
+ int oldDepth = intmaxlog(lastItemCount);
+ bspTreeDepth = intmaxlog(indexedItems.size());
+ static const int slack = 100;
+ if (bsp.leafCount() == 0 || (oldDepth != bspTreeDepth && qAbs(lastItemCount - indexedItems.size()) > slack)) {
+ // ### Crude algorithm.
+ regenerateIndex = true;
+ }
+ }
+
+ // Regenerate the tree.
+ if (regenerateIndex) {
+ regenerateIndex = false;
+ bsp.initialize(sceneRect, bspTreeDepth);
+ unindexedItems = indexedItems;
+ lastItemCount = indexedItems.size();
+ }
+
+ // Insert all unindexed items into the tree.
+ for (int i = 0; i < unindexedItems.size(); ++i) {
+ if (QGraphicsItem *item = unindexedItems.at(i)) {
+ if (item->d_ptr->itemIsUntransformable()) {
+ untransformableItems << item;
+ continue;
+ }
+ if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
+ continue;
+
+ bsp.insertItem(item, item->sceneBoundingRect());
+ }
+ }
+ unindexedItems.clear();
+}
+
+
+/*!
+ \internal
+
+ Removes stale pointers from all data structures.
+*/
+void QGraphicsSceneBspTreeIndexPrivate::purgeRemovedItems()
+{
+ if (!purgePending && removedItems.isEmpty())
+ return;
+
+ // Remove stale items from the BSP tree.
+ bsp.removeItems(removedItems);
+ // Purge this list.
+ removedItems.clear();
+ freeItemIndexes.clear();
+ for (int i = 0; i < indexedItems.size(); ++i) {
+ if (!indexedItems.at(i))
+ freeItemIndexes << i;
+ }
+ purgePending = false;
+}
+
+/*!
+ \internal
+
+ Starts or restarts the timer used for reindexing unindexed items.
+*/
+void QGraphicsSceneBspTreeIndexPrivate::startIndexTimer(int interval)
+{
+ Q_Q(QGraphicsSceneBspTreeIndex);
+ if (indexTimerId) {
+ restartIndexTimer = true;
+ } else {
+ indexTimerId = q->startTimer(interval);
+ }
+}
+
+/*!
+ \internal
+*/
+void QGraphicsSceneBspTreeIndexPrivate::resetIndex()
+{
+ purgeRemovedItems();
+ for (int i = 0; i < indexedItems.size(); ++i) {
+ if (QGraphicsItem *item = indexedItems.at(i)) {
+ item->d_ptr->index = -1;
+ Q_ASSERT(!item->d_ptr->itemDiscovered);
+ unindexedItems << item;
+ }
+ }
+ indexedItems.clear();
+ freeItemIndexes.clear();
+ untransformableItems.clear();
+ regenerateIndex = true;
+ startIndexTimer();
+}
+
+/*!
+ \internal
+*/
+void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stackingOrder)
+{
+ if (!item->d_ptr->children.isEmpty()) {
+ QList<QGraphicsItem *> childList = item->d_ptr->children;
+ qSort(childList.begin(), childList.end(), qt_closestLeaf);
+ for (int i = 0; i < childList.size(); ++i) {
+ QGraphicsItem *item = childList.at(i);
+ if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent))
+ climbTree(childList.at(i), stackingOrder);
+ }
+ item->d_ptr->globalStackingOrder = (*stackingOrder)++;
+ for (int i = 0; i < childList.size(); ++i) {
+ QGraphicsItem *item = childList.at(i);
+ if (item->flags() & QGraphicsItem::ItemStacksBehindParent)
+ climbTree(childList.at(i), stackingOrder);
+ }
+ } else {
+ item->d_ptr->globalStackingOrder = (*stackingOrder)++;
+ }
+}
+
+/*!
+ \internal
+*/
+void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache()
+{
+ Q_Q(QGraphicsSceneBspTreeIndex);
+ _q_updateIndex();
+
+ if (!sortCacheEnabled || !updatingSortCache)
+ return;
+
+ updatingSortCache = false;
+ int stackingOrder = 0;
+
+ QList<QGraphicsItem *> topLevels;
+ const QList<QGraphicsItem *> items = q->items();
+ for (int i = 0; i < items.size(); ++i) {
+ QGraphicsItem *item = items.at(i);
+ if (item && !item->d_ptr->parent)
+ topLevels << item;
+ }
+
+ qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf);
+ for (int i = 0; i < topLevels.size(); ++i)
+ climbTree(topLevels.at(i), &stackingOrder);
+}
+
+/*!
+ \internal
+*/
+void QGraphicsSceneBspTreeIndexPrivate::invalidateSortCache()
+{
+ Q_Q(QGraphicsSceneBspTreeIndex);
+ if (!sortCacheEnabled || updatingSortCache)
+ return;
+
+ updatingSortCache = true;
+ QMetaObject::invokeMethod(q, "_q_updateSortCache", Qt::QueuedConnection);
+}
+
+void QGraphicsSceneBspTreeIndexPrivate::addItem(QGraphicsItem *item, bool recursive)
+{
+ if (!item)
+ return;
+
+ // Prevent reusing a recently deleted pointer: purge all removed item from our lists.
+ purgeRemovedItems();
+
+ // Invalidate any sort caching; arrival of a new item means we need to resort.
+ // Update the scene's sort cache settings.
+ item->d_ptr->globalStackingOrder = -1;
+ invalidateSortCache();
+
+ // Indexing requires sceneBoundingRect(), but because \a item might
+ // not be completely constructed at this point, we need to store it in
+ // a temporary list and schedule an indexing for later.
+ if (item->d_ptr->index == -1) {
+ Q_ASSERT(!unindexedItems.contains(item));
+ unindexedItems << item;
+ startIndexTimer(0);
+ } else {
+ Q_ASSERT(indexedItems.contains(item));
+ qWarning("QGraphicsSceneBspTreeIndex::addItem: item has already been added to this BSP");
+ }
+
+ if (recursive) {
+ for (int i = 0; i < item->d_ptr->children.size(); ++i)
+ addItem(item->d_ptr->children.at(i), recursive);
+ }
+}
+
+void QGraphicsSceneBspTreeIndexPrivate::removeItem(QGraphicsItem *item, bool recursive,
+ bool moveToUnindexedItems)
+{
+ if (!item)
+ return;
+
+ if (item->d_ptr->index != -1) {
+ Q_ASSERT(item->d_ptr->index < indexedItems.size());
+ Q_ASSERT(indexedItems.at(item->d_ptr->index) == item);
+ Q_ASSERT(!item->d_ptr->itemDiscovered);
+ freeItemIndexes << item->d_ptr->index;
+ indexedItems[item->d_ptr->index] = 0;
+ item->d_ptr->index = -1;
+
+ if (item->d_ptr->itemIsUntransformable()) {
+ untransformableItems.removeOne(item);
+ } else if (item->d_ptr->inDestructor) {
+ // Avoid virtual function calls from the destructor.
+ purgePending = true;
+ removedItems << item;
+ } else if (!(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) {
+ bsp.removeItem(item, item->sceneBoundingRect());
+ }
+ } else {
+ unindexedItems.removeOne(item);
+ }
+ invalidateSortCache(); // ### Only do this when removing from BSP?
+
+ Q_ASSERT(item->d_ptr->index == -1);
+ Q_ASSERT(!indexedItems.contains(item));
+ Q_ASSERT(!unindexedItems.contains(item));
+ Q_ASSERT(!untransformableItems.contains(item));
+
+ if (moveToUnindexedItems)
+ addItem(item);
+
+ if (recursive) {
+ for (int i = 0; i < item->d_ptr->children.size(); ++i)
+ removeItem(item->d_ptr->children.at(i), recursive, moveToUnindexedItems);
+ }
+}
+
+QList<QGraphicsItem *> QGraphicsSceneBspTreeIndexPrivate::estimateItems(const QRectF &rect, Qt::SortOrder order,
+ bool onlyTopLevelItems)
+{
+ Q_Q(QGraphicsSceneBspTreeIndex);
+ if (onlyTopLevelItems && rect.isNull())
+ return q->QGraphicsSceneIndex::estimateTopLevelItems(rect, order);
+
+ purgeRemovedItems();
+ _q_updateSortCache();
+ Q_ASSERT(unindexedItems.isEmpty());
+
+ QList<QGraphicsItem *> rectItems = bsp.items(rect, onlyTopLevelItems);
+ if (onlyTopLevelItems) {
+ for (int i = 0; i < untransformableItems.size(); ++i) {
+ QGraphicsItem *item = untransformableItems.at(i);
+ if (!item->d_ptr->parent) {
+ rectItems << item;
+ } else {
+ item = item->topLevelItem();
+ if (!rectItems.contains(item))
+ rectItems << item;
+ }
+ }
+ } else {
+ rectItems += untransformableItems;
+ }
+
+ sortItems(&rectItems, order, sortCacheEnabled, onlyTopLevelItems);
+ return rectItems;
+}
+
+/*!
+ Returns true if \a item1 is on top of \a item2.
+
+ \internal
+*/
+bool QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
+{
+ // Siblings? Just check their z-values.
+ const QGraphicsItemPrivate *d1 = item1->d_ptr;
+ const QGraphicsItemPrivate *d2 = item2->d_ptr;
+ if (d1->parent == d2->parent)
+ return qt_closestLeaf(item1, item2);
+
+ // Find common ancestor, and each item's ancestor closest to the common
+ // ancestor.
+ int item1Depth = d1->depth;
+ int item2Depth = d2->depth;
+ const QGraphicsItem *p = item1;
+ const QGraphicsItem *t1 = item1;
+ while (item1Depth > item2Depth && (p = p->d_ptr->parent)) {
+ if (p == item2) {
+ // item2 is one of item1's ancestors; item1 is on top
+ return !(t1->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent);
+ }
+ t1 = p;
+ --item1Depth;
+ }
+ p = item2;
+ const QGraphicsItem *t2 = item2;
+ while (item2Depth > item1Depth && (p = p->d_ptr->parent)) {
+ if (p == item1) {
+ // item1 is one of item2's ancestors; item1 is not on top
+ return (t2->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent);
+ }
+ t2 = p;
+ --item2Depth;
+ }
+
+ // item1Ancestor is now at the same level as item2Ancestor, but not the same.
+ const QGraphicsItem *a1 = t1;
+ const QGraphicsItem *a2 = t2;
+ while (a1) {
+ const QGraphicsItem *p1 = a1;
+ const QGraphicsItem *p2 = a2;
+ a1 = a1->parentItem();
+ a2 = a2->parentItem();
+ if (a1 && a1 == a2)
+ return qt_closestLeaf(p1, p2);
+ }
+
+ // No common ancestor? Then just compare the items' toplevels directly.
+ return qt_closestLeaf(t1->topLevelItem(), t2->topLevelItem());
+}
+
+/*!
+ Returns true if \a item2 is on top of \a item1.
+
+ \internal
+*/
+bool QGraphicsSceneBspTreeIndexPrivate::closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
+{
+ return closestItemFirst_withoutCache(item2, item1);
+}
+
+/*!
+ Sort a list of \a itemList in a specific \a order and use the cache if requested.
+
+ \internal
+*/
+void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList<QGraphicsItem *> *itemList, Qt::SortOrder order,
+ bool sortCacheEnabled, bool onlyTopLevelItems)
+{
+ if (order == Qt::SortOrder(-1))
+ return;
+
+ if (onlyTopLevelItems) {
+ if (order == Qt::AscendingOrder)
+ qSort(itemList->begin(), itemList->end(), qt_closestLeaf);
+ else if (order == Qt::DescendingOrder)
+ qSort(itemList->begin(), itemList->end(), qt_notclosestLeaf);
+ return;
+ }
+
+ if (sortCacheEnabled) {
+ if (order == Qt::AscendingOrder) {
+ qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache);
+ } else if (order == Qt::DescendingOrder) {
+ qSort(itemList->begin(), itemList->end(), closestItemLast_withCache);
+ }
+ } else {
+ if (order == Qt::AscendingOrder) {
+ qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache);
+ } else if (order == Qt::DescendingOrder) {
+ qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache);
+ }
+ }
+}
+
+/*!
+ Constructs a BSP scene index for the given \a scene.
+*/
+QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene)
+ : QGraphicsSceneIndex(*new QGraphicsSceneBspTreeIndexPrivate(scene), scene)
+{
+
+}
+
+QGraphicsSceneBspTreeIndex::~QGraphicsSceneBspTreeIndex()
+{
+ Q_D(QGraphicsSceneBspTreeIndex);
+ for (int i = 0; i < d->indexedItems.size(); ++i) {
+ // Ensure item bits are reset properly.
+ if (QGraphicsItem *item = d->indexedItems.at(i)) {
+ Q_ASSERT(!item->d_ptr->itemDiscovered);
+ item->d_ptr->index = -1;
+ }
+ }
+}
+
+/*!
+ \reimp
+ Clear the all the BSP index.
+*/
+void QGraphicsSceneBspTreeIndex::clear()
+{
+ Q_D(QGraphicsSceneBspTreeIndex);
+ d->bsp.clear();
+ d->lastItemCount = 0;
+ d->freeItemIndexes.clear();
+ for (int i = 0; i < d->indexedItems.size(); ++i) {
+ // Ensure item bits are reset properly.
+ if (QGraphicsItem *item = d->indexedItems.at(i)) {
+ Q_ASSERT(!item->d_ptr->itemDiscovered);
+ item->d_ptr->index = -1;
+ }
+ }
+ d->indexedItems.clear();
+ d->unindexedItems.clear();
+ d->untransformableItems.clear();
+ d->regenerateIndex = true;
+}
+
+/*!
+ Add the \a item into the BSP index.
+*/
+void QGraphicsSceneBspTreeIndex::addItem(QGraphicsItem *item)
+{
+ Q_D(QGraphicsSceneBspTreeIndex);
+ d->addItem(item);
+}
+
+/*!
+ Remove the \a item from the BSP index.
+*/
+void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item)
+{
+ Q_D(QGraphicsSceneBspTreeIndex);
+ d->removeItem(item);
+}
+
+/*!
+ \reimp
+ Update the BSP when the \a item 's bounding rect has changed.
+*/
+void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem *item)
+{
+ if (!item)
+ return;
+
+ if (item->d_ptr->index == -1 || item->d_ptr->itemIsUntransformable()
+ || (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) {
+ return; // Item is not in BSP tree; nothing to do.
+ }
+
+ Q_D(QGraphicsSceneBspTreeIndex);
+ QGraphicsItem *thatItem = const_cast<QGraphicsItem *>(item);
+ d->removeItem(thatItem, /*recursive=*/false, /*moveToUnindexedItems=*/true);
+ for (int i = 0; i < item->d_ptr->children.size(); ++i) // ### Do we really need this?
+ prepareBoundingRectChange(item->d_ptr->children.at(i));
+}
+
+/*!
+ Returns an estimation visible items that are either inside or
+ intersect with the specified \a rect and return a list sorted using \a order.
+
+ \a deviceTransform is the transformation apply to the view.
+
+*/
+QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order) const
+{
+ Q_D(const QGraphicsSceneBspTreeIndex);
+ return const_cast<QGraphicsSceneBspTreeIndexPrivate*>(d)->estimateItems(rect, order);
+}
+
+QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const
+{
+ Q_D(const QGraphicsSceneBspTreeIndex);
+ return const_cast<QGraphicsSceneBspTreeIndexPrivate*>(d)->estimateItems(rect, order, /*onlyTopLevels=*/true);
+}
+
+/*!
+ \fn QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const;
+
+ Return all items in the BSP index and sort them using \a order.
+*/
+QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) const
+{
+ Q_D(const QGraphicsSceneBspTreeIndex);
+ const_cast<QGraphicsSceneBspTreeIndexPrivate*>(d)->purgeRemovedItems();
+ QList<QGraphicsItem *> itemList;
+
+ // If freeItemIndexes is empty, we know there are no holes in indexedItems and
+ // unindexedItems.
+ if (d->freeItemIndexes.isEmpty()) {
+ if (d->unindexedItems.isEmpty()) {
+ itemList = d->indexedItems;
+ } else {
+ itemList = d->indexedItems + d->unindexedItems;
+ }
+ } else {
+ // Rebuild the list of items to avoid holes. ### We could also just
+ // compress the item lists at this point.
+ foreach (QGraphicsItem *item, d->indexedItems + d->unindexedItems) {
+ if (item)
+ itemList << item;
+ }
+ }
+ if (order != -1) {
+ //We sort descending order
+ d->sortItems(&itemList, order, d->sortCacheEnabled);
+ }
+ return itemList;
+}
+
+/*!
+ \property QGraphicsSceneBspTreeIndex::bspTreeDepth
+ \brief the depth of the BSP index tree
+ \since 4.6
+
+ This value determines the depth of BSP tree. The depth
+ directly affects performance and memory usage; the latter
+ growing exponentially with the depth of the tree. With an optimal tree
+ depth, the index can instantly determine the locality of items, even
+ for scenes with thousands or millions of items. This also greatly improves
+ rendering performance.
+
+ By default, the value is 0, in which case Qt will guess a reasonable
+ default depth based on the size, location and number of items in the
+ scene. If these parameters change frequently, however, you may experience
+ slowdowns as the index retunes the depth internally. You can avoid
+ potential slowdowns by fixating the tree depth through setting this
+ property.
+
+ The depth of the tree and the size of the scene rectangle decide the
+ granularity of the scene's partitioning. The size of each scene segment is
+ determined by the following algorithm:
+
+ The BSP tree has an optimal size when each segment contains between 0 and
+ 10 items.
+
+*/
+int QGraphicsSceneBspTreeIndex::bspTreeDepth()
+{
+ Q_D(const QGraphicsSceneBspTreeIndex);
+ return d->bspTreeDepth;
+}
+
+void QGraphicsSceneBspTreeIndex::setBspTreeDepth(int depth)
+{
+ Q_D(QGraphicsSceneBspTreeIndex);
+ if (d->bspTreeDepth == depth)
+ return;
+ d->bspTreeDepth = depth;
+ d->resetIndex();
+}
+
+/*!
+ \reimp
+
+ This method react to the \a rect change of the scene and
+ reset the BSP tree index.
+*/
+void QGraphicsSceneBspTreeIndex::updateSceneRect(const QRectF &rect)
+{
+ Q_D(QGraphicsSceneBspTreeIndex);
+ d->sceneRect = rect;
+ d->resetIndex();
+}
+
+/*!
+ \reimp
+
+ This method react to the \a change of the \a item and use the \a value to
+ update the BSP tree if necessary.
+
+*/
+void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value)
+{
+ Q_D(QGraphicsSceneBspTreeIndex);
+ switch (change) {
+ case QGraphicsItem::ItemFlagsChange: {
+ // Handle ItemIgnoresTransformations
+ bool ignoredTransform = item->d_ptr->flags & QGraphicsItem::ItemIgnoresTransformations;
+ bool willIgnoreTransform = value.toUInt() & QGraphicsItem::ItemIgnoresTransformations;
+ bool clipsChildren = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape;
+ bool willClipChildren = value.toUInt() & QGraphicsItem::ItemClipsChildrenToShape;
+ if ((ignoredTransform != willIgnoreTransform) || (clipsChildren != willClipChildren)) {
+ QGraphicsItem *thatItem = const_cast<QGraphicsItem *>(item);
+ // Remove item and its descendants from the index and append
+ // them to the list of unindexed items. Then, when the index
+ // is updated, they will be put into the bsp-tree or the list
+ // of untransformable items.
+ d->removeItem(thatItem, /*recursive=*/true, /*moveToUnidexedItems=*/true);
+ }
+ break;
+ }
+ case QGraphicsItem::ItemZValueChange:
+ d->invalidateSortCache();
+ break;
+ case QGraphicsItem::ItemParentChange: {
+ d->invalidateSortCache();
+ // Handle ItemIgnoresTransformations
+ QGraphicsItem *newParent = qVariantValue<QGraphicsItem *>(value);
+ bool ignoredTransform = item->d_ptr->itemIsUntransformable();
+ bool willIgnoreTransform = (item->d_ptr->flags & QGraphicsItem::ItemIgnoresTransformations)
+ || (newParent && newParent->d_ptr->itemIsUntransformable());
+ bool ancestorClippedChildren = item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren;
+ bool ancestorWillClipChildren = newParent
+ && ((newParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)
+ || (newParent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren));
+ if ((ignoredTransform != willIgnoreTransform) || (ancestorClippedChildren != ancestorWillClipChildren)) {
+ QGraphicsItem *thatItem = const_cast<QGraphicsItem *>(item);
+ // Remove item and its descendants from the index and append
+ // them to the list of unindexed items. Then, when the index
+ // is updated, they will be put into the bsp-tree or the list
+ // of untransformable items.
+ d->removeItem(thatItem, /*recursive=*/true, /*moveToUnidexedItems=*/true);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ return QGraphicsSceneIndex::itemChange(item, change, value);
+}
+/*!
+ \reimp
+
+ Used to catch the timer event.
+
+ \internal
+*/
+bool QGraphicsSceneBspTreeIndex::event(QEvent *event)
+{
+ Q_D(QGraphicsSceneBspTreeIndex);
+ switch (event->type()) {
+ case QEvent::Timer:
+ if (d->indexTimerId && static_cast<QTimerEvent *>(event)->timerId() == d->indexTimerId) {
+ if (d->restartIndexTimer) {
+ d->restartIndexTimer = false;
+ } else {
+ // this call will kill the timer
+ d->_q_updateIndex();
+ }
+ }
+ // Fallthrough intended - support timers in subclasses.
+ default:
+ return QObject::event(event);
+ }
+ return true;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qgraphicsscenebsptreeindex_p.cpp"
+
+#endif // QT_NO_GRAPHICSVIEW
+
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
new file mode 100644
index 0000000..2293a8e
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QGRAPHICSBSPTREEINDEX_H
+#define QGRAPHICSBSPTREEINDEX_H
+
+#include <QtCore/qglobal.h>
+
+#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+
+#include "qgraphicssceneindex_p.h"
+#include "qgraphicsitem_p.h"
+#include "qgraphicsscene_bsp_p.h"
+
+#include <QtCore/qrect.h>
+#include <QtCore/qlist.h>
+
+QT_BEGIN_NAMESPACE
+
+static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000;
+
+class QGraphicsScene;
+class QGraphicsSceneBspTreeIndexPrivate;
+
+class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex
+{
+ Q_OBJECT
+ Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth)
+public:
+ QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0);
+ ~QGraphicsSceneBspTreeIndex();
+
+ QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const;
+ QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const;
+ QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const;
+
+ int bspTreeDepth();
+ void setBspTreeDepth(int depth);
+
+protected Q_SLOTS:
+ void updateSceneRect(const QRectF &rect);
+
+protected:
+ bool event(QEvent *event);
+ void clear();
+
+ void addItem(QGraphicsItem *item);
+ void removeItem(QGraphicsItem *item);
+ void prepareBoundingRectChange(const QGraphicsItem *item);
+
+ void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value);
+
+private :
+ Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex)
+ Q_DISABLE_COPY(QGraphicsSceneBspTreeIndex)
+ Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache())
+ Q_PRIVATE_SLOT(d_func(), void _q_updateIndex())
+
+ friend class QGraphicsScene;
+ friend class QGraphicsScenePrivate;
+};
+
+class QGraphicsSceneBspTreeIndexPrivate : public QGraphicsSceneIndexPrivate
+{
+ Q_DECLARE_PUBLIC(QGraphicsSceneBspTreeIndex)
+public:
+ QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene);
+
+ QGraphicsSceneBspTree bsp;
+ QRectF sceneRect;
+ int bspTreeDepth;
+ int indexTimerId;
+ bool restartIndexTimer;
+ bool regenerateIndex;
+ int lastItemCount;
+
+ QList<QGraphicsItem *> indexedItems;
+ QList<QGraphicsItem *> unindexedItems;
+ QList<QGraphicsItem *> untransformableItems;
+ QList<int> freeItemIndexes;
+
+ bool purgePending;
+ QSet<QGraphicsItem *> removedItems;
+ void purgeRemovedItems();
+
+ void _q_updateIndex();
+ void startIndexTimer(int interval = QGRAPHICSSCENE_INDEXTIMER_TIMEOUT);
+ void resetIndex();
+
+ void _q_updateSortCache();
+ bool sortCacheEnabled;
+ bool updatingSortCache;
+ void invalidateSortCache();
+ void addItem(QGraphicsItem *item, bool recursive = false);
+ void removeItem(QGraphicsItem *item, bool recursive = false, bool moveToUnindexedItems = false);
+ QList<QGraphicsItem *> estimateItems(const QRectF &, Qt::SortOrder, bool b = false);
+
+ static void climbTree(QGraphicsItem *item, int *stackingOrder);
+ static bool closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2);
+ static bool closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2);
+
+ static inline bool closestItemFirst_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
+ {
+ return item1->d_ptr->globalStackingOrder < item2->d_ptr->globalStackingOrder;
+ }
+ static inline bool closestItemLast_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
+ {
+ return item1->d_ptr->globalStackingOrder >= item2->d_ptr->globalStackingOrder;
+ }
+
+ static void sortItems(QList<QGraphicsItem *> *itemList, Qt::SortOrder order,
+ bool cached, bool onlyTopLevelItems = false);
+};
+
+static inline bool QRectF_intersects(const QRectF &s, const QRectF &r)
+{
+ qreal xp = s.left();
+ qreal yp = s.top();
+ qreal w = s.width();
+ qreal h = s.height();
+ qreal l1 = xp;
+ qreal r1 = xp;
+ if (w < 0)
+ l1 += w;
+ else
+ r1 += w;
+
+ qreal l2 = r.left();
+ qreal r2 = r.left();
+ if (w < 0)
+ l2 += r.width();
+ else
+ r2 += r.width();
+
+ if (l1 >= r2 || l2 >= r1)
+ return false;
+
+ qreal t1 = yp;
+ qreal b1 = yp;
+ if (h < 0)
+ t1 += h;
+ else
+ b1 += h;
+
+ qreal t2 = r.top();
+ qreal b2 = r.top();
+ if (r.height() < 0)
+ t2 += r.height();
+ else
+ b2 += r.height();
+
+ return !(t1 >= b2 || t2 >= b1);
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_GRAPHICSVIEW
+
+#endif // QGRAPHICSBSPTREEINDEX_H
diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp
index 987ae9a..97e8e46 100644
--- a/src/gui/graphicsview/qgraphicssceneevent.cpp
+++ b/src/gui/graphicsview/qgraphicssceneevent.cpp
@@ -275,8 +275,6 @@
QT_BEGIN_NAMESPACE
-QString qt_getStandardGestureTypeName(Qt::GestureType type);
-
class QGraphicsSceneEventPrivate
{
public:
@@ -1678,249 +1676,6 @@ void QGraphicsSceneMoveEvent::setNewPos(const QPointF &pos)
d->newPos = pos;
}
-/*!
- \class QGraphicsSceneGestureEvent
- \brief The QGraphicsSceneGestureEvent class provides gesture events for
- the graphics view framework.
- \since 4.6
- \ingroup multimedia
- \ingroup graphicsview-api
-
- QGraphicsSceneGestureEvent extends information provided by
- QGestureEvent by adding some convenience functions like
- \l{QGraphicsSceneEvent::}{widget()} to get a widget that received
- original gesture event, and convenience functions mapToScene(),
- mapToItem() for converting positions of the gesture into
- QGraphicsScene and QGraphicsItem coordinate system respectively.
-
- The scene sends the event to the first QGraphicsItem under the
- mouse cursor that accepts gestures; a graphics item is set to accept
- gestures with \l{QGraphicsItem::}{grabGesture()}.
-
- \sa QGestureEvent
-*/
-
-/*!
- Constructs a QGraphicsSceneGestureEvent.
-*/
-QGraphicsSceneGestureEvent::QGraphicsSceneGestureEvent()
- : QGraphicsSceneEvent(QEvent::GraphicsSceneGesture)
-{
- setAccepted(false);
-}
-
-/*!
- Destroys a QGraphicsSceneGestureEvent.
-*/
-QGraphicsSceneGestureEvent::~QGraphicsSceneGestureEvent()
-{
-}
-
-/*!
- Returns true if the gesture event contains gesture of specific \a
- type; returns false otherwise.
-*/
-bool QGraphicsSceneGestureEvent::contains(const QString &type) const
-{
- return gesture(type) != 0;
-}
-
-/*!
- Returns true if the gesture event contains gesture of specific \a
- type; returns false otherwise.
-*/
-bool QGraphicsSceneGestureEvent::contains(Qt::GestureType type) const
-{
- return contains(qt_getStandardGestureTypeName(type));
-}
-
-/*!
- Returns a list of gesture names that this event contains.
-*/
-QList<QString> QGraphicsSceneGestureEvent::gestureTypes() const
-{
- return m_gestures.keys();
-}
-
-/*!
- Returns extended information about a gesture of specific \a type.
-*/
-const QGesture* QGraphicsSceneGestureEvent::gesture(const QString &type) const
-{
- return m_gestures.value(type, 0);
-}
-
-/*!
- Returns extended information about a gesture of specific \a type.
-*/
-const QGesture* QGraphicsSceneGestureEvent::gesture(Qt::GestureType type) const
-{
- return gesture(qt_getStandardGestureTypeName(type));
-}
-
-/*!
- Returns extended information about all gestures in the event.
-*/
-QList<QGesture*> QGraphicsSceneGestureEvent::gestures() const
-{
- return m_gestures.values();
-}
-
-/*!
- Returns a set of gesture names that used to be executed, but were
- cancelled (i.e. they were not finished properly).
-*/
-QSet<QString> QGraphicsSceneGestureEvent::cancelledGestures() const
-{
- return m_cancelledGestures;
-}
-
-/*!
- Sets a list of gesture names \a cancelledGestures that used to be
- executed, but were cancelled (i.e. they were not finished
- properly).
-*/
-void QGraphicsSceneGestureEvent::setCancelledGestures(const QSet<QString> &cancelledGestures)
-{
- m_cancelledGestures = cancelledGestures;
-}
-
-/*!
- Maps the point \a point, which is in a view coordinate system, to
- scene coordinate system, and returns the mapped coordinate.
-
- A \a point is in coordinate system of the widget that received
- gesture event.
-
- \sa mapToItem(), {The Graphics View Coordinate System}
-*/
-QPointF QGraphicsSceneGestureEvent::mapToScene(const QPoint &point) const
-{
- if (QGraphicsView *view = qobject_cast<QGraphicsView*>(widget()))
- return view->mapToScene(point);
- return QPointF();
-}
-
-/*!
- Maps the rectangular \a rect, which is in a view coordinate system, to
- scene coordinate system, and returns the mapped coordinate.
-
- A \a rect is in coordinate system of the widget that received
- gesture event.
-
- \sa mapToItem(), {The Graphics View Coordinate System}
-*/
-QPolygonF QGraphicsSceneGestureEvent::mapToScene(const QRect &rect) const
-{
- if (QGraphicsView *view = qobject_cast<QGraphicsView*>(widget()))
- return view->mapToScene(rect);
- return QPolygonF();
-}
-
-/*!
- Maps the point \a point, which is in a view coordinate system, to
- item's \a item coordinate system, and returns the mapped coordinate.
-
- If \a item is 0, this function returns the same as mapToScene().
-
- \sa mapToScene(), {The Graphics View Coordinate System}
-*/
-QPointF QGraphicsSceneGestureEvent::mapToItem(const QPoint &point, QGraphicsItem *item) const
-{
- if (item) {
- if (QGraphicsView *view = qobject_cast<QGraphicsView*>(widget()))
- return item->mapFromScene(view->mapToScene(point));
- } else {
- return mapToScene(point);
- }
- return QPointF();
-}
-
-/*!
- Maps the rectangualar \a rect, which is in a view coordinate system, to
- item's \a item coordinate system, and returns the mapped coordinate.
-
- If \a item is 0, this function returns the same as mapToScene().
-
- \sa mapToScene(), {The Graphics View Coordinate System}
-*/
-QPolygonF QGraphicsSceneGestureEvent::mapToItem(const QRect &rect, QGraphicsItem *item) const
-{
- if (item) {
- if (QGraphicsView *view = qobject_cast<QGraphicsView*>(widget()))
- return item->mapFromScene(view->mapToScene(rect));
- } else {
- return mapToScene(rect);
- }
- return QPolygonF();
-}
-
-/*!
- Set a list of gesture objects containing extended information about \a gestures.
-*/
-void QGraphicsSceneGestureEvent::setGestures(const QList<QGesture*> &gestures)
-{
- foreach(QGesture *g, gestures)
- m_gestures.insert(g->type(), g);
-}
-
-/*!
- Set a list of gesture objects containing extended information about \a gestures.
-*/
-void QGraphicsSceneGestureEvent::setGestures(const QSet<QGesture*> &gestures)
-{
- foreach(QGesture *g, gestures)
- m_gestures.insert(g->type(), g);
-}
-
-/*!
- Sets the accept flag of the all gestures inside the event object,
- the equivalent of calling \l{QEvent::accept()}{accept()} or
- \l{QEvent::setAccepted()}{setAccepted(true)}.
-
- Setting the accept parameter indicates that the event receiver
- wants the gesture. Unwanted gestures might be propagated to the parent
- widget.
-*/
-void QGraphicsSceneGestureEvent::acceptAll()
-{
- QHash<QString, QGesture*>::iterator it = m_gestures.begin(),
- e = m_gestures.end();
- for(; it != e; ++it)
- it.value()->accept();
- setAccepted(true);
-}
-
-/*!
- Sets the accept flag of the specified gesture inside the event
- object, the equivalent of calling
- \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()}
-
- Setting the accept parameter indicates that the event receiver
- wants the gesture. Unwanted gestures might be propagated to the parent
- widget.
-*/
-void QGraphicsSceneGestureEvent::accept(Qt::GestureType type)
-{
- if (QGesture *g = m_gestures.value(qt_getStandardGestureTypeName(type), 0))
- g->accept();
-}
-
-/*!
- Sets the accept flag of the specified gesture inside the event
- object, the equivalent of calling
- \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()}
-
- Setting the accept parameter indicates that the event receiver
- wants the gesture. Unwanted gestures might be propagated to the parent
- widget.
-*/
-void QGraphicsSceneGestureEvent::accept(const QString &type)
-{
- if (QGesture *g = m_gestures.value(type, 0))
- g->accept();
-}
-
QT_END_NAMESPACE
#endif // QT_NO_GRAPHICSVIEW
diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h
index c6a3eff..ea17f9d 100644
--- a/src/gui/graphicsview/qgraphicssceneevent.h
+++ b/src/gui/graphicsview/qgraphicssceneevent.h
@@ -307,49 +307,6 @@ public:
void setNewPos(const QPointF &pos);
};
-class QGesture;
-class QGraphicsItem;
-class QGraphicsSceneGestureEventPrivate;
-class Q_GUI_EXPORT QGraphicsSceneGestureEvent : public QGraphicsSceneEvent
-{
- Q_DECLARE_PRIVATE(QGraphicsSceneGestureEvent)
-public:
- QGraphicsSceneGestureEvent();
- ~QGraphicsSceneGestureEvent();
-
- bool contains(const QString &type) const;
- bool contains(Qt::GestureType type) const;
-
- QList<QString> gestureTypes() const;
-
- const QGesture* gesture(Qt::GestureType type) const;
- const QGesture* gesture(const QString &type) const;
- QList<QGesture*> gestures() const;
- void setGestures(const QList<QGesture*> &gestures);
- void setGestures(const QSet<QGesture*> &gestures);
-
- QSet<QString> cancelledGestures() const;
- void setCancelledGestures(const QSet<QString> &cancelledGestures);
-
- void acceptAll();
-#ifndef Q_NO_USING_KEYWORD
- using QEvent::accept;
-#else
- inline void accept() { QEvent::accept(); }
-#endif
- void accept(Qt::GestureType type);
- void accept(const QString &type);
-
- QPointF mapToScene(const QPoint &point) const;
- QPolygonF mapToScene(const QRect &rect) const;
- QPointF mapToItem(const QPoint &point, QGraphicsItem *item) const;
- QPolygonF mapToItem(const QRect &rect, QGraphicsItem *item) const;
-
-protected:
- QHash<QString, QGesture*> m_gestures;
- QSet<QString> m_cancelledGestures;
-};
-
#endif // QT_NO_GRAPHICSVIEW
QT_END_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp
new file mode 100644
index 0000000..ab5ca85
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicssceneindex.cpp
@@ -0,0 +1,648 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \class QGraphicsSceneIndex
+ \brief The QGraphicsSceneIndex class provides a base class to implement
+ a custom indexing algorithm for discovering items in QGraphicsScene.
+ \since 4.6
+ \ingroup multimedia
+ \ingroup graphicsview-api
+ \mainclass
+ \internal
+
+ The QGraphicsSceneIndex class provides a base class to implement
+ a custom indexing algorithm for discovering items in QGraphicsScene. You
+ need to subclass it and reimplement addItem, removeItem, estimateItems
+ and items in order to have an functional indexing.
+
+ \sa QGraphicsScene, QGraphicsView
+*/
+
+#include "qdebug.h"
+#include "qgraphicsscene.h"
+#include "qgraphicsitem_p.h"
+#include "qgraphicsscene_p.h"
+#include "qgraphicswidget.h"
+#include "qgraphicssceneindex_p.h"
+#include "qgraphicsscenebsptreeindex_p.h"
+
+#ifndef QT_NO_GRAPHICSVIEW
+
+QT_BEGIN_NAMESPACE
+
+class QGraphicsSceneIndexRectIntersector : public QGraphicsSceneIndexIntersector
+{
+public:
+ bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode,
+ const QTransform &deviceTransform) const
+ {
+ QRectF brect = item->boundingRect();
+ _q_adjustRect(&brect);
+
+ // ### Add test for this (without making things slower?)
+ Q_UNUSED(exposeRect);
+
+ bool keep = true;
+ const QGraphicsItemPrivate *itemd = QGraphicsItemPrivate::get(item);
+ if (itemd->itemIsUntransformable()) {
+ // Untransformable items; map the scene rect to item coordinates.
+ const QTransform transform = item->deviceTransform(deviceTransform);
+ QRectF itemRect = (deviceTransform * transform.inverted()).mapRect(sceneRect);
+ if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect)
+ keep = itemRect.contains(brect) && itemRect != brect;
+ else
+ keep = itemRect.intersects(brect);
+ if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) {
+ QPainterPath itemPath;
+ itemPath.addRect(itemRect);
+ keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode);
+ }
+ } else {
+ Q_ASSERT(!itemd->dirtySceneTransform);
+ const QRectF itemSceneBoundingRect = itemd->sceneTransformTranslateOnly
+ ? brect.translated(itemd->sceneTransform.dx(),
+ itemd->sceneTransform.dy())
+ : itemd->sceneTransform.mapRect(brect);
+ if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect)
+ keep = sceneRect != brect && sceneRect.contains(itemSceneBoundingRect);
+ else
+ keep = sceneRect.intersects(itemSceneBoundingRect);
+ if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) {
+ QPainterPath rectPath;
+ rectPath.addRect(sceneRect);
+ if (itemd->sceneTransformTranslateOnly)
+ rectPath.translate(-itemd->sceneTransform.dx(), -itemd->sceneTransform.dy());
+ else
+ rectPath = itemd->sceneTransform.inverted().map(rectPath);
+ keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, rectPath, mode);
+ }
+ }
+ return keep;
+ }
+
+ QRectF sceneRect;
+};
+
+class QGraphicsSceneIndexPointIntersector : public QGraphicsSceneIndexIntersector
+{
+public:
+ bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode,
+ const QTransform &deviceTransform) const
+ {
+ QRectF brect = item->boundingRect();
+ _q_adjustRect(&brect);
+
+ // ### Add test for this (without making things slower?)
+ Q_UNUSED(exposeRect);
+
+ bool keep = false;
+ const QGraphicsItemPrivate *itemd = QGraphicsItemPrivate::get(item);
+ if (itemd->itemIsUntransformable()) {
+ // Untransformable items; map the scene point to item coordinates.
+ const QTransform transform = item->deviceTransform(deviceTransform);
+ QPointF itemPoint = (deviceTransform * transform.inverted()).map(scenePoint);
+ keep = brect.contains(itemPoint);
+ if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) {
+ QPainterPath pointPath;
+ pointPath.addRect(QRectF(itemPoint, QSizeF(1, 1)));
+ keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, pointPath, mode);
+ }
+ } else {
+ Q_ASSERT(!itemd->dirtySceneTransform);
+ QRectF sceneBoundingRect = itemd->sceneTransformTranslateOnly
+ ? brect.translated(itemd->sceneTransform.dx(),
+ itemd->sceneTransform.dy())
+ : itemd->sceneTransform.mapRect(brect);
+ keep = sceneBoundingRect.intersects(QRectF(scenePoint, QSizeF(1, 1)));
+ if (keep) {
+ QPointF p = itemd->sceneTransformTranslateOnly
+ ? QPointF(scenePoint.x() - itemd->sceneTransform.dx(),
+ scenePoint.y() - itemd->sceneTransform.dy())
+ : itemd->sceneTransform.inverted().map(scenePoint);
+ keep = item->contains(p);
+ }
+ }
+
+ return keep;
+ }
+
+ QPointF scenePoint;
+};
+
+class QGraphicsSceneIndexPathIntersector : public QGraphicsSceneIndexIntersector
+{
+public:
+ bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode,
+ const QTransform &deviceTransform) const
+ {
+ QRectF brect = item->boundingRect();
+ _q_adjustRect(&brect);
+
+ // ### Add test for this (without making things slower?)
+ Q_UNUSED(exposeRect);
+
+ bool keep = true;
+ const QGraphicsItemPrivate *itemd = QGraphicsItemPrivate::get(item);
+ if (itemd->itemIsUntransformable()) {
+ // Untransformable items; map the scene rect to item coordinates.
+ const QTransform transform = item->deviceTransform(deviceTransform);
+ QPainterPath itemPath = (deviceTransform * transform.inverted()).map(scenePath);
+ if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect)
+ keep = itemPath.contains(brect);
+ else
+ keep = itemPath.intersects(brect);
+ if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape))
+ keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode);
+ } else {
+ Q_ASSERT(!itemd->dirtySceneTransform);
+ const QRectF itemSceneBoundingRect = itemd->sceneTransformTranslateOnly
+ ? brect.translated(itemd->sceneTransform.dx(),
+ itemd->sceneTransform.dy())
+ : itemd->sceneTransform.mapRect(brect);
+ if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect)
+ keep = scenePath.contains(itemSceneBoundingRect);
+ else
+ keep = scenePath.intersects(itemSceneBoundingRect);
+ if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) {
+ QPainterPath itemPath = itemd->sceneTransformTranslateOnly
+ ? scenePath.translated(-itemd->sceneTransform.dx(),
+ -itemd->sceneTransform.dy())
+ : itemd->sceneTransform.inverted().map(scenePath);
+ keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode);
+ }
+ }
+ return keep;
+ }
+
+ QPainterPath scenePath;
+};
+
+/*!
+ Constructs a private scene index.
+*/
+QGraphicsSceneIndexPrivate::QGraphicsSceneIndexPrivate(QGraphicsScene *scene) : scene(scene)
+{
+ pointIntersector = new QGraphicsSceneIndexPointIntersector;
+ rectIntersector = new QGraphicsSceneIndexRectIntersector;
+ pathIntersector = new QGraphicsSceneIndexPathIntersector;
+}
+
+/*!
+ Destructor of private scene index.
+*/
+QGraphicsSceneIndexPrivate::~QGraphicsSceneIndexPrivate()
+{
+ delete pointIntersector;
+ delete rectIntersector;
+ delete pathIntersector;
+}
+
+/*!
+ \internal
+
+ Checks if item collides with the path and mode, but also checks that if it
+ doesn't collide, maybe its frame rect will.
+*/
+bool QGraphicsSceneIndexPrivate::itemCollidesWithPath(const QGraphicsItem *item,
+ const QPainterPath &path,
+ Qt::ItemSelectionMode mode)
+{
+ if (item->collidesWithPath(path, mode))
+ return true;
+ if (item->isWidget()) {
+ // Check if this is a window, and if its frame rect collides.
+ const QGraphicsWidget *widget = static_cast<const QGraphicsWidget *>(item);
+ if (widget->isWindow()) {
+ QRectF frameRect = widget->windowFrameRect();
+ QPainterPath framePath;
+ framePath.addRect(frameRect);
+ bool intersects = path.intersects(frameRect);
+ if (mode == Qt::IntersectsItemShape || mode == Qt::IntersectsItemBoundingRect)
+ return intersects || path.contains(frameRect.topLeft())
+ || framePath.contains(path.elementAt(0));
+ return !intersects && path.contains(frameRect.topLeft());
+ }
+ }
+ return false;
+}
+
+/*!
+ \internal
+*/
+void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRectF exposeRect,
+ QGraphicsSceneIndexIntersector *intersector,
+ QList<QGraphicsItem *> *items,
+ const QTransform &viewTransform,
+ Qt::ItemSelectionMode mode, Qt::SortOrder order,
+ qreal parentOpacity) const
+{
+ Q_ASSERT(item);
+ if (!item->d_ptr->visible)
+ return;
+
+ const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity);
+ const bool itemIsFullyTransparent = (opacity < 0.0001);
+ const bool itemHasChildren = !item->d_ptr->children.isEmpty();
+ if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity()))
+ return;
+
+ // Update the item's scene transform if dirty.
+ const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable();
+ const bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform && !itemIsUntransformable;
+ if (wasDirtyParentSceneTransform) {
+ item->d_ptr->updateSceneTransformFromParent();
+ Q_ASSERT(!item->d_ptr->dirtySceneTransform);
+ }
+
+ const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape);
+ bool processItem = !itemIsFullyTransparent;
+ if (processItem) {
+ processItem = intersector->intersect(item, exposeRect, mode, viewTransform);
+ if (!processItem && (!itemHasChildren || itemClipsChildrenToShape)) {
+ if (wasDirtyParentSceneTransform)
+ item->d_ptr->invalidateChildrenSceneTransform();
+ return;
+ }
+ } // else we know for sure this item has children we must process.
+
+ int i = 0;
+ if (itemHasChildren) {
+ // Sort children.
+ item->d_ptr->ensureSortedChildren();
+
+ // Clip to shape.
+ if (itemClipsChildrenToShape && !itemIsUntransformable) {
+ QPainterPath mappedShape = item->d_ptr->sceneTransformTranslateOnly
+ ? item->shape().translated(item->d_ptr->sceneTransform.dx(),
+ item->d_ptr->sceneTransform.dy())
+ : item->d_ptr->sceneTransform.map(item->shape());
+ exposeRect &= mappedShape.controlPointRect();
+ }
+
+ // Process children behind
+ for (i = 0; i < item->d_ptr->children.size(); ++i) {
+ QGraphicsItem *child = item->d_ptr->children.at(i);
+ if (wasDirtyParentSceneTransform)
+ child->d_ptr->dirtySceneTransform = 1;
+ if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent))
+ break;
+ if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity))
+ continue;
+ recursive_items_helper(child, exposeRect, intersector, items, viewTransform,
+ mode, order, opacity);
+ }
+ }
+
+ // Process item
+ if (processItem)
+ items->append(item);
+
+ // Process children in front
+ if (itemHasChildren) {
+ for (; i < item->d_ptr->children.size(); ++i) {
+ QGraphicsItem *child = item->d_ptr->children.at(i);
+ if (wasDirtyParentSceneTransform)
+ child->d_ptr->dirtySceneTransform = 1;
+ if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity))
+ continue;
+ recursive_items_helper(child, exposeRect, intersector, items, viewTransform,
+ mode, order, opacity);
+ }
+ }
+}
+
+void QGraphicsSceneIndexPrivate::init()
+{
+ if (!scene)
+ return;
+
+ QObject::connect(scene, SIGNAL(sceneRectChanged(const QRectF&)),
+ q_func(), SLOT(updateSceneRect(const QRectF&)));
+}
+
+/*!
+ Constructs an abstract scene index for a given \a scene.
+*/
+QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene)
+: QObject(*new QGraphicsSceneIndexPrivate(scene), scene)
+{
+ d_func()->init();
+}
+
+/*!
+ \internal
+*/
+QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsSceneIndexPrivate &dd, QGraphicsScene *scene)
+ : QObject(dd, scene)
+{
+ d_func()->init();
+}
+
+/*!
+ Destroys the scene index.
+*/
+QGraphicsSceneIndex::~QGraphicsSceneIndex()
+{
+
+}
+
+/*!
+ Returns the scene of this index.
+*/
+QGraphicsScene* QGraphicsSceneIndex::scene() const
+{
+ Q_D(const QGraphicsSceneIndex);
+ return d->scene;
+}
+
+/*!
+ \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPointF &pos,
+ Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform
+ &deviceTransform) const
+
+ Returns all visible items that, depending on \a mode, are at the specified
+ \a pos and return a list sorted using \a order.
+
+ The default value for \a mode is Qt::IntersectsItemShape; all items whose
+ exact shape intersects with \a pos are returned.
+
+ \a deviceTransform is the transformation apply to the view.
+
+ This method use the estimation of the index (estimateItems) and refine the
+ list to get an exact result. If you want to implement your own refinement
+ algorithm you can reimplement this method.
+
+ \sa estimateItems()
+
+*/
+QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform) const
+{
+
+ Q_D(const QGraphicsSceneIndex);
+ QList<QGraphicsItem *> itemList;
+ d->pointIntersector->scenePoint = pos;
+ d->items_helper(QRectF(pos, QSizeF(1, 1)), d->pointIntersector, &itemList, deviceTransform, mode, order);
+ return itemList;
+}
+
+/*!
+ \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QRectF &rect,
+ Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform
+ &deviceTransform) const
+
+ \overload
+
+ Returns all visible items that, depending on \a mode, are either inside or
+ intersect with the specified \a rect and return a list sorted using \a order.
+
+ The default value for \a mode is Qt::IntersectsItemShape; all items whose
+ exact shape intersects with or is contained by \a rect are returned.
+
+ \a deviceTransform is the transformation apply to the view.
+
+ This method use the estimation of the index (estimateItems) and refine
+ the list to get an exact result. If you want to implement your own
+ refinement algorithm you can reimplement this method.
+
+ \sa estimateItems()
+
+*/
+QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform) const
+{
+ Q_D(const QGraphicsSceneIndex);
+ QRectF exposeRect = rect;
+ _q_adjustRect(&exposeRect);
+ QList<QGraphicsItem *> itemList;
+ d->rectIntersector->sceneRect = rect;
+ d->items_helper(exposeRect, d->rectIntersector, &itemList, deviceTransform, mode, order);
+ return itemList;
+}
+
+/*!
+ \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPolygonF
+ &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const
+ QTransform &deviceTransform) const
+
+ \overload
+
+ Returns all visible items that, depending on \a mode, are either inside or
+ intersect with the specified \a polygon and return a list sorted using \a order.
+
+ The default value for \a mode is Qt::IntersectsItemShape; all items whose
+ exact shape intersects with or is contained by \a polygon are returned.
+
+ \a deviceTransform is the transformation apply to the view.
+
+ This method use the estimation of the index (estimateItems) and refine
+ the list to get an exact result. If you want to implement your own
+ refinement algorithm you can reimplement this method.
+
+ \sa estimateItems()
+
+*/
+QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform) const
+{
+ Q_D(const QGraphicsSceneIndex);
+ QList<QGraphicsItem *> itemList;
+ QRectF exposeRect = polygon.boundingRect();
+ _q_adjustRect(&exposeRect);
+ QPainterPath path;
+ path.addPolygon(polygon);
+ d->pathIntersector->scenePath = path;
+ d->items_helper(exposeRect, d->pathIntersector, &itemList, deviceTransform, mode, order);
+ return itemList;
+}
+
+/*!
+ \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPainterPath
+ &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform
+ &deviceTransform) const
+
+ \overload
+
+ Returns all visible items that, depending on \a mode, are either inside or
+ intersect with the specified \a path and return a list sorted using \a order.
+
+ The default value for \a mode is Qt::IntersectsItemShape; all items whose
+ exact shape intersects with or is contained by \a path are returned.
+
+ \a deviceTransform is the transformation apply to the view.
+
+ This method use the estimation of the index (estimateItems) and refine
+ the list to get an exact result. If you want to implement your own
+ refinement algorithm you can reimplement this method.
+
+ \sa estimateItems()
+
+*/
+QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform) const
+{
+ Q_D(const QGraphicsSceneIndex);
+ QList<QGraphicsItem *> itemList;
+ QRectF exposeRect = path.controlPointRect();
+ _q_adjustRect(&exposeRect);
+ d->pathIntersector->scenePath = path;
+ d->items_helper(exposeRect, d->pathIntersector, &itemList, deviceTransform, mode, order);
+ return itemList;
+}
+
+/*!
+ This virtual function return an estimation of items at position \a point.
+ This method return a list sorted using \a order.
+*/
+QList<QGraphicsItem *> QGraphicsSceneIndex::estimateItems(const QPointF &point, Qt::SortOrder order) const
+{
+ return estimateItems(QRectF(point, QSize(1, 1)), order);
+}
+
+QList<QGraphicsItem *> QGraphicsSceneIndex::estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const
+{
+ Q_D(const QGraphicsSceneIndex);
+ Q_UNUSED(rect);
+ QGraphicsScenePrivate *scened = d->scene->d_func();
+ scened->ensureSortedTopLevelItems();
+ if (order == Qt::AscendingOrder) {
+ QList<QGraphicsItem *> sorted;
+ for (int i = scened->topLevelItems.size() - 1; i >= 0; --i)
+ sorted << scened->topLevelItems.at(i);
+ return sorted;
+ }
+ return scened->topLevelItems;
+}
+
+/*!
+ \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const
+
+ This pure virtual function all items in the index and sort them using
+ \a order.
+*/
+
+
+/*!
+ Notifies the index that the scene's scene rect has changed. \a rect
+ is thew new scene rect.
+
+ \sa QGraphicsScene::sceneRect()
+*/
+void QGraphicsSceneIndex::updateSceneRect(const QRectF &rect)
+{
+ Q_UNUSED(rect);
+}
+
+/*!
+ This virtual function removes all items in the scene index.
+*/
+void QGraphicsSceneIndex::clear()
+{
+ const QList<QGraphicsItem *> allItems = items();
+ for (int i = 0 ; i < allItems.size(); ++i)
+ removeItem(allItems.at(i));
+}
+
+/*!
+ \fn virtual void QGraphicsSceneIndex::addItem(QGraphicsItem *item) = 0
+
+ This pure virtual function inserts an \a item to the scene index.
+
+ \sa removeItem(), deleteItem()
+*/
+
+/*!
+ \fn virtual void QGraphicsSceneIndex::removeItem(QGraphicsItem *item) = 0
+
+ This pure virtual function removes an \a item to the scene index.
+
+ \sa addItem(), deleteItem()
+*/
+
+/*!
+ This method is called when an \a item has been deleted.
+ The default implementation call removeItem. Be carefull,
+ if your implementation of removeItem use pure virtual method
+ of QGraphicsItem like boundingRect(), then you should reimplement
+ this method.
+
+ \sa addItem(), removeItem()
+*/
+void QGraphicsSceneIndex::deleteItem(QGraphicsItem *item)
+{
+ removeItem(item);
+}
+
+/*!
+ This virtual function is called by QGraphicsItem to notify the index
+ that some part of the \a item 's state changes. By reimplementing this
+ function, your can react to a change, and in some cases, (depending on \a
+ change,) adjustments in the index can be made.
+
+ \a change is the parameter of the item that is changing. \a value is the
+ value that changed; the type of the value depends on \a change.
+
+ The default implementation does nothing.
+
+ \sa QGraphicsItem::GraphicsItemChange
+*/
+void QGraphicsSceneIndex::itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value)
+{
+ Q_UNUSED(item);
+ Q_UNUSED(change);
+ Q_UNUSED(value);
+}
+
+/*!
+ Notify the index for a geometry change of an \a item.
+
+ \sa QGraphicsItem::prepareGeometryChange()
+*/
+void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item)
+{
+ Q_UNUSED(item);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qgraphicssceneindex_p.cpp"
+
+#endif // QT_NO_GRAPHICSVIEW
diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h
new file mode 100644
index 0000000..37dffb8
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicssceneindex_p.h
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSSCENEINDEX_H
+#define QGRAPHICSSCENEINDEX_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qgraphicsscene_p.h"
+#include "qgraphicsscene.h"
+#include <private/qobject_p.h>
+
+#include <QtCore/qnamespace.h>
+#include <QtCore/qobject.h>
+#include <QtGui/qtransform.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+
+class QGraphicsSceneIndexIntersector;
+class QGraphicsSceneIndexPointIntersector;
+class QGraphicsSceneIndexRectIntersector;
+class QGraphicsSceneIndexPathIntersector;
+class QGraphicsSceneIndexPrivate;
+class QPointF;
+class QRectF;
+template<typename T> class QList;
+
+class Q_AUTOTEST_EXPORT QGraphicsSceneIndex : public QObject
+{
+ Q_OBJECT
+
+public:
+ QGraphicsSceneIndex(QGraphicsScene *scene = 0);
+ virtual ~QGraphicsSceneIndex();
+
+ QGraphicsScene *scene() const;
+
+ virtual QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const = 0;
+ virtual QList<QGraphicsItem *> items(const QPointF &pos, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
+ virtual QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
+ virtual QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
+ virtual QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode,
+ Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
+ virtual QList<QGraphicsItem *> estimateItems(const QPointF &point, Qt::SortOrder order) const;
+ virtual QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const = 0;
+ virtual QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &, Qt::SortOrder order) const;
+
+protected Q_SLOTS:
+ virtual void updateSceneRect(const QRectF &rect);
+
+protected:
+ virtual void clear();
+ virtual void addItem(QGraphicsItem *item) = 0;
+ virtual void removeItem(QGraphicsItem *item) = 0;
+ virtual void deleteItem(QGraphicsItem *item);
+
+ virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value);
+ virtual void prepareBoundingRectChange(const QGraphicsItem *item);
+
+ QGraphicsSceneIndex(QGraphicsSceneIndexPrivate &dd, QGraphicsScene *scene);
+
+ friend class QGraphicsScene;
+ friend class QGraphicsScenePrivate;
+ friend class QGraphicsItem;
+ friend class QGraphicsItemPrivate;
+ friend class QGraphicsSceneBspTreeIndex;
+private:
+ Q_DISABLE_COPY(QGraphicsSceneIndex)
+ Q_DECLARE_PRIVATE(QGraphicsSceneIndex)
+};
+
+class QGraphicsSceneIndexPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QGraphicsSceneIndex)
+public:
+ QGraphicsSceneIndexPrivate(QGraphicsScene *scene);
+ ~QGraphicsSceneIndexPrivate();
+
+ void init();
+ static bool itemCollidesWithPath(const QGraphicsItem *item, const QPainterPath &path, Qt::ItemSelectionMode mode);
+
+ void recursive_items_helper(QGraphicsItem *item, QRectF exposeRect,
+ QGraphicsSceneIndexIntersector *intersector, QList<QGraphicsItem *> *items,
+ const QTransform &viewTransform,
+ Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const;
+ inline void items_helper(const QRectF &rect, QGraphicsSceneIndexIntersector *intersector,
+ QList<QGraphicsItem *> *items, const QTransform &viewTransform,
+ Qt::ItemSelectionMode mode, Qt::SortOrder order) const;
+
+ QGraphicsScene *scene;
+ QGraphicsSceneIndexPointIntersector *pointIntersector;
+ QGraphicsSceneIndexRectIntersector *rectIntersector;
+ QGraphicsSceneIndexPathIntersector *pathIntersector;
+};
+
+inline void QGraphicsSceneIndexPrivate::items_helper(const QRectF &rect, QGraphicsSceneIndexIntersector *intersector,
+ QList<QGraphicsItem *> *items, const QTransform &viewTransform,
+ Qt::ItemSelectionMode mode, Qt::SortOrder order) const
+{
+ Q_Q(const QGraphicsSceneIndex);
+ const QList<QGraphicsItem *> tli = q->estimateTopLevelItems(rect, Qt::DescendingOrder);
+ for (int i = 0; i < tli.size(); ++i)
+ recursive_items_helper(tli.at(i), rect, intersector, items, viewTransform, mode, order);
+ if (order == Qt::AscendingOrder) {
+ const int n = items->size();
+ for (int i = 0; i < n / 2; ++i)
+ items->swap(i, n - i - 1);
+ }
+}
+
+class QGraphicsSceneIndexIntersector
+{
+public:
+ QGraphicsSceneIndexIntersector() { }
+ virtual ~QGraphicsSceneIndexIntersector() { }
+ virtual bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode,
+ const QTransform &deviceTransform) const = 0;
+};
+
+#endif // QT_NO_GRAPHICSVIEW
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QGRAPHICSSCENEINDEX_H
diff --git a/src/gui/embedded/qkbdsl5000_qws.h b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp
index 42afbe1..52bbc79 100644
--- a/src/gui/embedded/qkbdsl5000_qws.h
+++ b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp
@@ -39,54 +39,57 @@
**
****************************************************************************/
-#ifndef QKBDSL5000_QWS_H
-#define QKBDSL5000_QWS_H
+/*!
+ \class QGraphicsSceneLinearIndex
+ \brief The QGraphicsSceneLinearIndex class provides an implementation of
+ a linear indexing algorithm for discovering items in QGraphicsScene.
+ \since 4.6
+ \ingroup graphicsview-api
+ \internal
-#include <QtGui/qkbdtty_qws.h>
+ QGraphicsSceneLinearIndex index is default linear implementation to discover items.
+ It basically store all items in a list and return them to the scene.
-QT_BEGIN_HEADER
+ \sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex, QGraphicsSceneBspTreeIndex
+*/
-QT_BEGIN_NAMESPACE
+#include <private/qgraphicsscenelinearindex_p.h>
-QT_MODULE(Gui)
+/*!
+ \fn QGraphicsSceneLinearIndex::QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0):
-#ifndef QT_NO_QWS_KBD_SL5000
+ Construct a linear index for the given \a scene.
+*/
-struct QWSKeyMap {
- uint key_code;
- ushort unicode;
- ushort shift_unicode;
- ushort ctrl_unicode;
-};
+/*!
+ \fn QList<QGraphicsItem *> QGraphicsSceneLinearIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const;
+ Return all items in the index and sort them using \a order.
+*/
-class QWSSL5000KeyboardHandler : public QWSTtyKeyboardHandler
-{
-public:
- explicit QWSSL5000KeyboardHandler(const QString&);
- virtual ~QWSSL5000KeyboardHandler();
- bool filterKeycode(char &keycode);
- virtual const QWSKeyMap *keyMap() const;
+/*!
+ \fn virtual QList<QGraphicsItem *> QGraphicsSceneLinearIndex::estimateItems(const QRectF &rect, Qt::SortOrder order) const
-private:
- bool shift;
- bool alt;
- bool ctrl;
- bool caps;
- uint extended:2;
- Qt::KeyboardModifiers modifiers;
- int prevuni;
- int prevkey;
- bool meta;
- bool fn;
- bool numLock;
-};
+ Returns an estimation visible items that are either inside or
+ intersect with the specified \a rect and return a list sorted using \a order.
+*/
-#endif // QT_NO_QWS_KBD_SL5000
+/*!
+ \fn void QGraphicsSceneLinearIndex::clear()
+ \internal
+ Clear the all the BSP index.
+*/
-QT_END_NAMESPACE
+/*!
+ \fn virtual void QGraphicsSceneLinearIndex::addItem(QGraphicsItem *item)
-QT_END_HEADER
+ Add the \a item into the index.
+*/
+
+/*!
+ \fn virtual void QGraphicsSceneLinearIndex::removeItem(QGraphicsItem *item)
+
+ Add the \a item from the index.
+*/
-#endif // QKBDSL5000_QWS_H
diff --git a/examples/animation/stickman/editor/animationdialog.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h
index 293f0d4..1f3d58b 100644
--- a/examples/animation/stickman/editor/animationdialog.h
+++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h
@@ -39,46 +39,71 @@
**
****************************************************************************/
-#ifndef ANIMATIONDIALOG_H
-#define ANIMATIONDIALOG_H
+#ifndef QGRAPHICSSCENELINEARINDEX_H
+#define QGRAPHICSSCENELINEARINDEX_H
-#include <QDialog>
-#include <QMessageBox>
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+
+#include <QtCore/qrect.h>
+#include <QtCore/qlist.h>
+#include <QtGui/qgraphicsitem.h>
+#include <private/qgraphicssceneindex_p.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QSpinBox;
-class QLineEdit;
-QT_END_NAMESPACE
-class StickMan;
-class Animation;
-class AnimationDialog: public QDialog
+
+QT_MODULE(Gui)
+
+class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex
{
Q_OBJECT
+
public:
- AnimationDialog(StickMan *stickMan, QWidget *parent = 0);
- ~AnimationDialog();
+ QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0) : QGraphicsSceneIndex(scene)
+ { }
-public slots:
- void currentFrameChanged(int currentFrame);
- void totalFramesChanged(int totalFrames);
- void setCurrentAnimationName(const QString &name);
+ QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const
+ { Q_UNUSED(order); return m_items; }
- void newAnimation();
- void saveAnimation();
- void loadAnimation();
+ virtual QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const
+ {
+ Q_UNUSED(rect);
+ Q_UNUSED(order);
+ return m_items;
+ }
+
+protected :
+ virtual void clear()
+ { m_items.clear(); }
+
+ virtual void addItem(QGraphicsItem *item)
+ { m_items << item; }
+
+ virtual void removeItem(QGraphicsItem *item)
+ { m_items.removeOne(item); }
private:
- void saveCurrentFrame();
- void stickManFromCurrentFrame();
- void initFromAnimation();
- void initUi();
- QMessageBox::StandardButton maybeSave();
-
- QSpinBox *m_currentFrame;
- QSpinBox *m_totalFrames;
- QLineEdit *m_name;
- Animation *m_animation;
- StickMan *m_stickman;
+ QList<QGraphicsItem*> m_items;
};
-
-#endif
+
+#endif // QT_NO_GRAPHICSVIEW
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QGRAPHICSSCENELINEARINDEX_H
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 58bbdda..a3005ae 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -280,6 +280,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
#include <QtGui/qpainter.h>
#include <QtGui/qscrollbar.h>
#include <QtGui/qstyleoption.h>
+#include <QtGui/qinputcontext.h>
#ifdef Q_WS_X11
#include <private/qt_x11_p.h>
#endif
@@ -812,31 +813,17 @@ QRegion QGraphicsViewPrivate::mapToViewRegion(const QGraphicsItem *item, const Q
return item->boundingRegion(itv) & itv.mapRect(rect).toAlignedRect();
}
-// QRectF::intersects() returns false always if either the source or target
-// rectangle's width or height are 0. This works around that problem.
-static inline QRectF adjustedItemBoundingRect(const QGraphicsItem *item)
-{
- Q_ASSERT(item);
- QRectF boundingRect(item->boundingRect());
- if (!boundingRect.width())
- boundingRect.adjust(-0.00001, 0, 0.00001, 0);
- if (!boundingRect.height())
- boundingRect.adjust(0, -0.00001, 0, 0.00001);
- return boundingRect;
-}
-
+/*!
+ \internal
+*/
void QGraphicsViewPrivate::processPendingUpdates()
{
if (!scene)
return;
- if (fullUpdatePending) { // We have already called viewport->update()
- dirtyBoundingRect = QRect();
- dirtyRegion = QRegion();
- return;
- }
-
- if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) {
+ if (fullUpdatePending) {
+ viewport->update();
+ } else if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) {
if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing)
viewport->update(dirtyBoundingRect.adjusted(-1, -1, 1, 1));
else
@@ -849,13 +836,29 @@ void QGraphicsViewPrivate::processPendingUpdates()
dirtyRegion = QRegion();
}
+static inline bool intersectsViewport(const QRect &r, int width, int height)
+{ return !(r.left() > width) && !(r.right() < 0) && !(r.top() >= height) && !(r.bottom() < 0); }
+
+static inline bool containsViewport(const QRect &r, int width, int height)
+{ return r.left() <= 0 && r.top() <= 0 && r.right() >= width - 1 && r.bottom() >= height - 1; }
+
+static inline void QRect_unite(QRect *rect, const QRect &other)
+{
+ if (rect->isEmpty()) {
+ *rect = other;
+ } else {
+ rect->setCoords(qMin(rect->left(), other.left()), qMin(rect->top(), other.top()),
+ qMax(rect->right(), other.right()), qMax(rect->bottom(), other.bottom()));
+ }
+}
+
bool QGraphicsViewPrivate::updateRegion(const QRegion &r)
{
if (fullUpdatePending || viewportUpdateMode == QGraphicsView::NoViewportUpdate || r.isEmpty())
return false;
const QRect boundingRect = r.boundingRect();
- if (!boundingRect.intersects(viewport->rect()))
+ if (!intersectsViewport(boundingRect, viewport->width(), viewport->height()))
return false; // Update region outside viewport.
switch (viewportUpdateMode) {
@@ -864,8 +867,8 @@ bool QGraphicsViewPrivate::updateRegion(const QRegion &r)
viewport->update();
break;
case QGraphicsView::BoundingRectViewportUpdate:
- dirtyBoundingRect |= boundingRect;
- if (dirtyBoundingRect.contains(viewport->rect())) {
+ QRect_unite(&dirtyBoundingRect, boundingRect);
+ if (containsViewport(dirtyBoundingRect, viewport->width(), viewport->height())) {
fullUpdatePending = true;
viewport->update();
}
@@ -892,7 +895,7 @@ bool QGraphicsViewPrivate::updateRegion(const QRegion &r)
bool QGraphicsViewPrivate::updateRect(const QRect &r)
{
if (fullUpdatePending || viewportUpdateMode == QGraphicsView::NoViewportUpdate
- || !r.intersects(viewport->rect())) {
+ || !intersectsViewport(r, viewport->width(), viewport->height())) {
return false;
}
@@ -902,8 +905,8 @@ bool QGraphicsViewPrivate::updateRect(const QRect &r)
viewport->update();
break;
case QGraphicsView::BoundingRectViewportUpdate:
- dirtyBoundingRect |= r;
- if (dirtyBoundingRect.contains(viewport->rect())) {
+ QRect_unite(&dirtyBoundingRect, r);
+ if (containsViewport(dirtyBoundingRect, viewport->width(), viewport->height())) {
fullUpdatePending = true;
viewport->update();
}
@@ -954,47 +957,32 @@ extern QPainterPath qt_regionToPath(const QRegion &region);
is at risk of painting 1 pixel outside the bounding rect. Therefore we
must search for items with an adjustment of (-1, -1, 1, 1).
*/
-QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedRegion, bool *allItems) const
+QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedRegion, bool *allItems,
+ const QTransform &viewTransform) const
{
Q_Q(const QGraphicsView);
// Step 1) If all items are contained within the expose region, then
- // return a list of all visible items.
+ // return a list of all visible items. ### the scene's growing bounding
+ // rect does not take into account untransformable items.
const QRectF exposedRegionSceneBounds = q->mapToScene(exposedRegion.boundingRect().adjusted(-1, -1, 1, 1))
.boundingRect();
- if (exposedRegionSceneBounds.contains(scene->d_func()->growingItemsBoundingRect)) {
+ if (exposedRegionSceneBounds.contains(scene->sceneRect())) {
Q_ASSERT(allItems);
*allItems = true;
- // All items are guaranteed within the exposed region, don't bother using the index.
- QList<QGraphicsItem *> itemList(scene->items());
- int i = 0;
- while (i < itemList.size()) {
- const QGraphicsItem *item = itemList.at(i);
- // But we only want to include items that are visible
- // The following check is basically the same as item->d_ptr->isInvisible(), except
- // that we don't check whether the item clips children to shape or propagates its
- // opacity (we loop through all items, so those checks are wrong in this context).
- if (!item->isVisible() || item->d_ptr->isClippedAway() || item->d_ptr->isFullyTransparent())
- itemList.removeAt(i);
- else
- ++i;
- }
-
- // Sort the items.
- QGraphicsScenePrivate::sortItems(&itemList, Qt::DescendingOrder, scene->d_func()->sortCacheEnabled);
- return itemList;
+ // All items are guaranteed within the exposed region.
+ return scene->items(Qt::DescendingOrder);
}
// Step 2) If the expose region is a simple rect and the view is only
// translated or scaled, search for items using
// QGraphicsScene::items(QRectF).
- bool simpleRectLookup = (scene->d_func()->largestUntransformableItem.isNull()
- && exposedRegion.numRects() == 1 && matrix.type() <= QTransform::TxScale);
+ bool simpleRectLookup = exposedRegion.numRects() == 1 && matrix.type() <= QTransform::TxScale;
if (simpleRectLookup) {
- return scene->d_func()->items_helper(exposedRegionSceneBounds,
- Qt::IntersectsItemBoundingRect,
- Qt::DescendingOrder);
+ return scene->items(exposedRegionSceneBounds,
+ Qt::IntersectsItemBoundingRect,
+ Qt::DescendingOrder, viewTransform);
}
// If the region is complex or the view has a complex transform, adjust
@@ -1004,16 +992,25 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg
foreach (const QRect &r, exposedRegion.rects())
adjustedRegion += r.adjusted(-1, -1, 1, 1);
- const QPainterPath exposedPath(qt_regionToPath(adjustedRegion));
- if (scene->d_func()->largestUntransformableItem.isNull()) {
- const QPainterPath exposedScenePath(q->mapToScene(exposedPath));
- return scene->d_func()->items_helper(exposedScenePath,
- Qt::IntersectsItemBoundingRect,
- Qt::DescendingOrder);
- }
+ const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion)));
+ return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect,
+ Qt::DescendingOrder, viewTransform);
+}
- // NB! Path must be in viewport coordinates.
- return itemsInArea(exposedPath, Qt::IntersectsItemBoundingRect, Qt::DescendingOrder);
+/*!
+ \internal
+
+ Enables input methods for the view if and only if the current focus item of
+ the scene accepts input methods. Call function whenever that condition has
+ potentially changed.
+*/
+void QGraphicsViewPrivate::updateInputMethodSensitivity()
+{
+ Q_Q(QGraphicsView);
+ q->setAttribute(
+ Qt::WA_InputMethodEnabled,
+ scene && scene->focusItem()
+ && scene->focusItem()->flags() & QGraphicsItem::ItemAcceptsInputMethod);
}
/*!
@@ -1553,6 +1550,8 @@ void QGraphicsView::setScene(QGraphicsScene *scene)
} else {
d->recalculateContentSize();
}
+
+ d->updateInputMethodSensitivity();
}
/*!
@@ -1911,7 +1910,12 @@ void QGraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRati
void QGraphicsView::fitInView(const QGraphicsItem *item, Qt::AspectRatioMode aspectRatioMode)
{
QPainterPath path = item->isClipped() ? item->clipPath() : item->shape();
- fitInView(item->sceneTransform().map(path).boundingRect(), aspectRatioMode);
+ if (item->d_ptr->hasTranslateOnlySceneTransform()) {
+ path.translate(item->d_ptr->sceneTransform.dx(), item->d_ptr->sceneTransform.dy());
+ fitInView(path.boundingRect(), aspectRatioMode);
+ } else {
+ fitInView(item->d_ptr->sceneTransform.map(path).boundingRect(), aspectRatioMode);
+ }
}
/*!
@@ -1937,6 +1941,8 @@ void QGraphicsView::fitInView(const QGraphicsItem *item, Qt::AspectRatioMode asp
void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect &source,
Qt::AspectRatioMode aspectRatioMode)
{
+ // ### Switch to using the recursive rendering algorithm instead.
+
Q_D(QGraphicsView);
if (!d->scene || !(painter && painter->isActive()))
return;
@@ -2033,69 +2039,6 @@ QList<QGraphicsItem *> QGraphicsView::items() const
}
/*!
- Returns all items in the area \a path, which is in viewport coordinates,
- also taking untransformable items into consideration. This function is
- considerably slower than just checking the scene directly. There is
- certainly room for improvement.
-*/
-QList<QGraphicsItem *> QGraphicsViewPrivate::itemsInArea(const QPainterPath &path,
- Qt::ItemSelectionMode mode,
- Qt::SortOrder order) const
-{
- Q_Q(const QGraphicsView);
-
- // Determine the size of the largest untransformable subtree of children
- // mapped to scene coordinates.
- QRectF untr = scene->d_func()->largestUntransformableItem;
- QRectF ltri = matrix.inverted().mapRect(untr);
- ltri.adjust(-untr.width(), -untr.height(), untr.width(), untr.height());
-
- QRectF rect = path.controlPointRect();
-
- // Find all possible items in the relevant area.
- // ### Improve this algorithm; it might be searching a too large area.
- QRectF adjustedRect = q->mapToScene(rect.adjusted(-1, -1, 1, 1).toRect()).boundingRect();
- adjustedRect.adjust(-ltri.width(), -ltri.height(), ltri.width(), ltri.height());
-
- // First build a (potentially large) list of all items in the vicinity
- // that might be untransformable.
- QList<QGraphicsItem *> allCandidates = scene->d_func()->estimateItemsInRect(adjustedRect);
-
- // Then find the minimal list of items that are inside \a path, and
- // convert it to a set.
- QList<QGraphicsItem *> regularCandidates = scene->items(q->mapToScene(path), mode);
- QSet<QGraphicsItem *> candSet = QSet<QGraphicsItem *>::fromList(regularCandidates);
-
- QTransform viewMatrix = q->viewportTransform();
-
- QList<QGraphicsItem *> result;
-
- // Run through all candidates and keep all items that are in candSet, or
- // are untransformable and collide with \a path. ### We can improve this
- // algorithm.
- QList<QGraphicsItem *>::Iterator it = allCandidates.begin();
- while (it != allCandidates.end()) {
- QGraphicsItem *item = *it;
- if (item->d_ptr->itemIsUntransformable()) {
- // Check if this untransformable item collides with the
- // original selection rect.
- QTransform itemTransform = item->deviceTransform(viewMatrix);
- if (QGraphicsScenePrivate::itemCollidesWithPath(item, itemTransform.inverted().map(path), mode))
- result << item;
- } else {
- if (candSet.contains(item))
- result << item;
- }
- ++it;
- }
-
- // ### Insertion sort would be faster.
- if (order != Qt::SortOrder(-1))
- QGraphicsScenePrivate::sortItems(&result, order, scene->d_func()->sortCacheEnabled);
- return result;
-}
-
-/*!
Returns a list of all the items at the position \a pos in the view. The
items are listed in descending Z order (i.e., the first item in the list
is the top-most item, and the last item is the bottom-most item). \a pos
@@ -2114,17 +2057,22 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPoint &pos) const
Q_D(const QGraphicsView);
if (!d->scene)
return QList<QGraphicsItem *>();
- if (d->scene->d_func()->largestUntransformableItem.isNull()) {
- if ((d->identityMatrix || d->matrix.type() <= QTransform::TxScale)) {
- QTransform xinv = viewportTransform().inverted();
- return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)));
- }
- return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1));
+ // ### Unify these two, and use the items(QPointF) version in
+ // QGraphicsScene instead. The scene items function could use the viewport
+ // transform to map the point to a rect/polygon.
+ if ((d->identityMatrix || d->matrix.type() <= QTransform::TxScale)) {
+ // Use the rect version
+ QTransform xinv = viewportTransform().inverted();
+ return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)),
+ Qt::IntersectsItemShape,
+ Qt::AscendingOrder,
+ viewportTransform());
}
-
- QPainterPath path;
- path.addRect(QRectF(pos.x(), pos.y(), 1, 1));
- return d->itemsInArea(path);
+ // Use the polygon version
+ return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1),
+ Qt::IntersectsItemShape,
+ Qt::AscendingOrder,
+ viewportTransform());
}
/*!
@@ -2151,12 +2099,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QRect &rect, Qt::ItemSelection
Q_D(const QGraphicsView);
if (!d->scene)
return QList<QGraphicsItem *>();
- if (d->scene->d_func()->largestUntransformableItem.isNull())
- return d->scene->items(mapToScene(rect), mode);
-
- QPainterPath path;
- path.addRect(rect);
- return d->itemsInArea(path);
+ return d->scene->items(mapToScene(rect), mode, Qt::AscendingOrder, viewportTransform());
}
/*!
@@ -2184,13 +2127,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPolygon &polygon, Qt::ItemSel
Q_D(const QGraphicsView);
if (!d->scene)
return QList<QGraphicsItem *>();
- if (d->scene->d_func()->largestUntransformableItem.isNull())
- return d->scene->items(mapToScene(polygon), mode);
-
- QPainterPath path;
- path.addPolygon(polygon);
- path.closeSubpath();
- return d->itemsInArea(path);
+ return d->scene->items(mapToScene(polygon), mode, Qt::AscendingOrder, viewportTransform());
}
/*!
@@ -2210,9 +2147,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPainterPath &path, Qt::ItemSe
Q_D(const QGraphicsView);
if (!d->scene)
return QList<QGraphicsItem *>();
- if (d->scene->d_func()->largestUntransformableItem.isNull())
- return d->scene->items(mapToScene(path), mode);
- return d->itemsInArea(path);
+ return d->scene->items(mapToScene(path), mode, Qt::AscendingOrder, viewportTransform());
}
/*!
@@ -2673,9 +2608,6 @@ bool QGraphicsView::event(QEvent *event)
}
}
break;
- case QEvent::Gesture:
- viewportEvent(event);
- return true;
default:
break;
}
@@ -2757,17 +2689,6 @@ bool QGraphicsView::viewportEvent(QEvent *event)
d->scene->d_func()->updateAll = false;
}
break;
- case QEvent::Gesture: {
- QGraphicsSceneGestureEvent gestureEvent;
- gestureEvent.setWidget(this);
- QGestureEvent *ev = static_cast<QGestureEvent*>(event);
- gestureEvent.setGestures(ev->gestures());
- gestureEvent.setCancelledGestures(ev->cancelledGestures());
- QApplication::sendEvent(d->scene, &gestureEvent);
- event->setAccepted(gestureEvent.isAccepted());
- return true;
- }
- break;
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
@@ -2958,6 +2879,7 @@ void QGraphicsView::dragMoveEvent(QDragMoveEvent *event)
void QGraphicsView::focusInEvent(QFocusEvent *event)
{
Q_D(QGraphicsView);
+ d->updateInputMethodSensitivity();
QAbstractScrollArea::focusInEvent(event);
if (d->scene)
QApplication::sendEvent(d->scene, event);
@@ -3178,7 +3100,8 @@ void QGraphicsView::mouseMoveEvent(QMouseEvent *event)
selectionArea.addPolygon(mapToScene(d->rubberBandRect));
selectionArea.closeSubpath();
if (d->scene)
- d->scene->setSelectionArea(selectionArea, d->rubberBandSelectionMode);
+ d->scene->setSelectionArea(selectionArea, d->rubberBandSelectionMode,
+ viewportTransform());
return;
}
} else
@@ -3221,7 +3144,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
}
} else
#endif
- if (d->dragMode == QGraphicsView::ScrollHandDrag) {
+ if (d->dragMode == QGraphicsView::ScrollHandDrag && event->button() == Qt::LeftButton) {
#ifndef QT_NO_CURSOR
// Restore the open hand cursor. ### There might be items
// under the mouse that have a valid cursor at this time, so
@@ -3391,8 +3314,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
} else {
// Find all exposed items
bool allItems = false;
- QList<QGraphicsItem *> itemList = d->findItems(d->exposedRegion, &allItems);
-
+ QList<QGraphicsItem *> itemList = d->findItems(d->exposedRegion, &allItems, viewTransform);
if (!itemList.isEmpty()) {
// Generate the style options.
const int numItems = itemList.size();
@@ -3645,6 +3567,8 @@ QTransform QGraphicsView::viewportTransform() const
}
/*!
+ \since 4.6
+
Returns true if the view is transformed (i.e., a non-identity transform
has been assigned, or the scrollbars are adjusted).
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h
index 8c62f73..62a2b84 100644
--- a/src/gui/graphicsview/qgraphicsview_p.h
+++ b/src/gui/graphicsview/qgraphicsview_p.h
@@ -58,12 +58,14 @@
#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
#include <QtGui/qevent.h>
+#include <QtCore/qcoreapplication.h>
#include "qgraphicssceneevent.h"
+#include <QtGui/qstyleoption.h>
#include <private/qabstractscrollarea_p.h>
QT_BEGIN_NAMESPACE
-class QGraphicsViewPrivate : public QAbstractScrollAreaPrivate
+class Q_AUTOTEST_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate
{
Q_DECLARE_PUBLIC(QGraphicsView)
public:
@@ -84,10 +86,6 @@ public:
qint64 horizontalScroll() const;
qint64 verticalScroll() const;
- QList<QGraphicsItem *> itemsInArea(const QPainterPath &path,
- Qt::ItemSelectionMode mode = Qt::IntersectsItemShape,
- Qt::SortOrder = Qt::AscendingOrder) const;
-
QPointF mousePressItemPoint;
QPointF mousePressScenePoint;
QPoint mousePressViewPoint;
@@ -171,16 +169,27 @@ public:
dirtyBoundingRect = QRect();
dirtyRegion = QRegion();
}
+
+ inline void dispatchPendingUpdateRequests()
+ {
+ if (qt_widget_private(viewport)->paintOnScreen())
+ QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest);
+ else
+ QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest);
+ }
+
bool updateRect(const QRect &rect);
bool updateRegion(const QRegion &region);
bool updateSceneSlotReimplementedChecked;
QRegion exposedRegion;
- QList<QGraphicsItem *> findItems(const QRegion &exposedRegion, bool *allItems) const;
+ QList<QGraphicsItem *> findItems(const QRegion &exposedRegion, bool *allItems,
+ const QTransform &viewTransform) const;
QPointF mapToScene(const QPointF &point) const;
QRectF mapToScene(const QRectF &rect) const;
static void translateTouchEvent(QGraphicsViewPrivate *d, QTouchEvent *touchEvent);
+ void updateInputMethodSensitivity();
};
QT_END_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index b042be4..922db04 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -971,15 +971,18 @@ void QGraphicsWidget::updateGeometry()
deliver events related to state changes in the item. Because of this, it is
very important that subclasses call the base implementation.
- For example, QGraphicsWidget uses ItemVisibleChange to deliver \l Show and
- \l Hide events, ItemPositionHasChanged to deliver \l Move events, and
- ItemParentChange both to deliver \l ParentChange events, and for managing
- the focus chain.
+ \a change specifies the type of change, and \a value is the new value.
+
+ For example, QGraphicsWidget uses ItemVisibleChange to deliver
+ \l{QEvent::Show} {Show} and \l{QEvent::Hide}{Hide} events,
+ ItemPositionHasChanged to deliver \l{QEvent::Move}{Move} events,
+ and ItemParentChange both to deliver \l{QEvent::ParentChange}
+ {ParentChange} events, and for managing the focus chain.
QGraphicsWidget enables the ItemSendsGeometryChanges flag by default in
order to track position changes.
- \sa propertyChange()
+ \sa QGraphicsItem::itemChange()
*/
QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &value)
{
@@ -1211,7 +1214,8 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos)
/*!
\reimp
- QGraphicsWidget handles the following events:
+ Handles the \a event. QGraphicsWidget handles the following
+ events:
\table \o Event \o Usage
\row \o Polish
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index d9decb0..d3a4855 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -618,9 +618,6 @@ bool QImageData::checkForAlphaPixels() const
\table
\header \o Function \o Description
\row
- \o setAlphaChannel()
- \o Sets the alpha channel of the image.
- \row
\o setDotsPerMeterX()
\o Defines the aspect ratio by setting the number of pixels that fit
horizontally in a physical meter.
@@ -5280,7 +5277,7 @@ QPaintEngine *QImage::paintEngine() const
/*!
- \reimp
+ \internal
Returns the size for the specified \a metric on the device.
*/
@@ -5598,7 +5595,7 @@ bool QImage::isDetached() const
Note that the image will be converted to the Format_ARGB32_Premultiplied
format if the function succeeds.
- Use one of the composition mods in QPainter::CompositionMode instead.
+ Use one of the composition modes in QPainter::CompositionMode instead.
\warning This function is expensive.
@@ -5676,6 +5673,8 @@ void QImage::setAlphaChannel(const QImage &alphaChannel)
/*!
+ \obsolete
+
Returns the alpha channel of the image as a new grayscale QImage in which
each pixel's red, green, and blue values are given the alpha value of the
original image. The color depth of the returned image is 8-bit.
@@ -5755,7 +5754,7 @@ QImage QImage::alphaChannel() const
Returns true if the image has a format that respects the alpha
channel, otherwise returns false.
- \sa alphaChannel(), {QImage#Image Information}{Image Information}
+ \sa {QImage#Image Information}{Image Information}
*/
bool QImage::hasAlphaChannel() const
{
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index 2d0ee99..ddb51d3 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -949,6 +949,8 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
}
/*!
+ \internal
+
Internal implementation of the virtual QPaintDevice::metric()
function.
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index a3b2343..12287d3 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -384,6 +384,7 @@ QPixmap QPixmap::copy(const QRect &rect) const
/*!
\fn QPixmap::scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed)
+ \since 4.6
This convenience function is equivalent to calling QPixmap::scroll(\a dx,
\a dy, QRect(\a x, \a y, \a width, \a height), \a exposed).
@@ -392,6 +393,8 @@ QPixmap QPixmap::copy(const QRect &rect) const
*/
/*!
+ \since 4.6
+
Scrolls the area \a rect of this pixmap by (\a dx, \a dy). The exposed
region is left unchanged. You can optionally pass a pointer to an empty
QRegion to get the region that is \a exposed by the scroll operation.
@@ -1573,24 +1576,24 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
designed and optimized for showing images on screen. QBitmap is
only a convenience class that inherits QPixmap, ensuring a depth
of 1. The isQBitmap() function returns true if a QPixmap object is
- really a bitmap, otherwise returns false. Finally, the QPicture class is a
- paint device that records and replays QPainter commands.
+ really a bitmap, otherwise returns false. Finally, the QPicture class
+ is a paint device that records and replays QPainter commands.
A QPixmap can easily be displayed on the screen using QLabel or
one of QAbstractButton's subclasses (such as QPushButton and
QToolButton). QLabel has a pixmap property, whereas
- QAbstractButton has an icon property. And because QPixmap is a
- QPaintDevice subclass, QPainter can be used to draw directly onto
- pixmaps.
+ QAbstractButton has an icon property.
In addition to the ordinary constructors, a QPixmap can be
constructed using the static grabWidget() and grabWindow()
functions which creates a QPixmap and paints the given widget, or
- window, in it.
+ window, into it.
+
+ QPixmap objects can be passed around by value since the QPixmap
+ class uses implicit data sharing. For more information, see the \l
+ {Implicit Data Sharing} documentation. QPixmap objects can also be
+ streamed.
- Note that the pixel data in a pixmap is internal and is managed by
- the underlying window system. Pixels can only be accessed through
- QPainter functions or by converting the QPixmap to a QImage.
Depending on the system, QPixmap is stored using a RGB32 or a
premultiplied alpha format. If the image has an alpha channel, and
if the system allows, the preferred format is premultiplied alpha.
@@ -1601,6 +1604,13 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
QPixmap are stored on the client side and don't use any GDI
resources).
+ Note that the pixel data in a pixmap is internal and is managed by
+ the underlying window system. Because QPixmap is a QPaintDevice
+ subclass, QPainter can be used to draw directly onto pixmaps.
+ Pixels can only be accessed through QPainter functions or by
+ converting the QPixmap to a QImage. However, the fill() function
+ is available for initializing the entire pixmap with a given color.
+
There are functions to convert between QImage and
QPixmap. Typically, the QImage class is used to load an image
file, optionally manipulating the image data, before the QImage
@@ -1615,11 +1625,6 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
there are several functions that enables transformation of the
pixmap.
- QPixmap objects can be passed around by value since the QPixmap
- class uses implicit data sharing. For more information, see the \l
- {Implicit Data Sharing} documentation. QPixmap objects can also be
- streamed.
-
\tableofcontents
\section1 Reading and Writing Image Files
@@ -1676,12 +1681,15 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
The hasAlphaChannel() returns true if the pixmap has a format that
respects the alpha channel, otherwise returns false, while the
hasAlpha() function returns true if the pixmap has an alpha
- channel \e or a mask (otherwise false).
+ channel \e or a mask (otherwise false). The mask() function returns
+ the mask as a QBitmap object, which can be set using setMask().
- The alphaChannel() function returns the alpha channel as a new
- QPixmap object, while the mask() function returns the mask as a
- QBitmap object. The alpha channel and mask can be set using the
- setAlphaChannel() and setMask() functions, respectively.
+ The createHeuristicMask() function creates and returns a 1-bpp
+ heuristic mask (i.e. a QBitmap) for this pixmap. It works by
+ selecting a color from one of the corners and then chipping away
+ pixels of that color, starting at all the edges. The
+ createMaskFromColor() function creates and returns a mask (i.e. a
+ QBitmap) for the pixmap based on a given color.
\row
\o Low-level information
@@ -1719,14 +1727,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
\section1 Pixmap Transformations
QPixmap supports a number of functions for creating a new pixmap
- that is a transformed version of the original: The
- createHeuristicMask() function creates and returns a 1-bpp
- heuristic mask (i.e. a QBitmap) for this pixmap. It works by
- selecting a color from one of the corners and then chipping away
- pixels of that color, starting at all the edges. The
- createMaskFromColor() function creates and returns a mask (i.e. a
- QBitmap) for the pixmap based on a given color.
-
+ that is a transformed version of the original:
The scaled(), scaledToWidth() and scaledToHeight() functions
return scaled copies of the pixmap, while the copy() function
@@ -1741,11 +1742,6 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
function returns the actual matrix used for transforming the
pixmap.
- There are also functions for changing attributes of a pixmap.
- in-place: The fill() function fills the entire image with the
- given color, the setMask() function sets a mask bitmap, and the
- setAlphaChannel() function sets the pixmap's alpha channel.
-
\sa QBitmap, QImage, QImageReader, QImageWriter
*/
@@ -1764,7 +1760,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
Returns true if this pixmap has an alpha channel, \e or has a
mask, otherwise returns false.
- \sa hasAlphaChannel(), alphaChannel(), mask()
+ \sa hasAlphaChannel(), mask()
*/
bool QPixmap::hasAlpha() const
{
@@ -1775,7 +1771,7 @@ bool QPixmap::hasAlpha() const
Returns true if the pixmap has a format that respects the alpha
channel, otherwise returns false.
- \sa alphaChannel(), hasAlpha()
+ \sa hasAlpha()
*/
bool QPixmap::hasAlphaChannel() const
{
@@ -1783,7 +1779,7 @@ bool QPixmap::hasAlphaChannel() const
}
/*!
- \reimp
+ \internal
*/
int QPixmap::metric(PaintDeviceMetric metric) const
{
@@ -1792,6 +1788,7 @@ int QPixmap::metric(PaintDeviceMetric metric) const
/*!
\fn void QPixmap::setAlphaChannel(const QPixmap &alphaChannel)
+ \obsolete
Sets the alpha channel of this pixmap to the given \a alphaChannel
by converting the \a alphaChannel into 32 bit and using the
@@ -1829,6 +1826,8 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel)
}
/*!
+ \obsolete
+
Returns the alpha channel of the pixmap as a new grayscale QPixmap in which
each pixel's red, green, and blue values are given the alpha value of the
original pixmap. The color depth of the returned pixmap is the system depth
@@ -1847,7 +1846,9 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel)
\image alphachannelimage.png The pixmap and channelImage QPixmaps
\warning This is an expensive operation. The alpha channel of the
- pixmap is extracted dynamically from the pixeldata.
+ pixmap is extracted dynamically from the pixeldata. Most usecases of this
+ function are covered by QPainter and compositionModes which will normally
+ execute faster.
\sa setAlphaChannel(), {QPixmap#Pixmap Information}{Pixmap
Information}
@@ -1858,7 +1859,7 @@ QPixmap QPixmap::alphaChannel() const
}
/*!
- \reimp
+ \internal
*/
QPaintEngine *QPixmap::paintEngine() const
{
@@ -1868,7 +1869,7 @@ QPaintEngine *QPixmap::paintEngine() const
/*!
\fn QBitmap QPixmap::mask() const
- Extracts a bitmap mask from the pixmap's alphachannel.
+ Extracts a bitmap mask from the pixmap's alpha channel.
\warning This is potentially an expensive operation. The mask of
the pixmap is extracted dynamically from the pixeldata.
diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp
index c281fe9..25ef8ba 100644
--- a/src/gui/image/qpixmap_mac.cpp
+++ b/src/gui/image/qpixmap_mac.cpp
@@ -1169,25 +1169,6 @@ IconRef qt_mac_create_iconref(const QPixmap &px)
}
#endif
-QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
-{
- QPixmap ret(width, height);
- ret.fill(QColor(0, 0, 0, 0));
-
- CGRect rect = CGRectMake(0, 0, width, height);
-
- CGContextRef ctx = qt_mac_cg_context(&ret);
- CGAffineTransform old_xform = CGContextGetCTM(ctx);
- CGContextConcatCTM(ctx, CGAffineTransformInvert(old_xform));
- CGContextConcatCTM(ctx, CGAffineTransformIdentity);
-
- ::RGBColor b;
- b.blue = b.green = b.red = 255*255;
- PlotIconRefInContext(ctx, &rect, kAlignNone, kTransformNone, &b, kPlotIconRefNormalFlags, icon);
- CGContextRelease(ctx);
- return ret;
-}
-
/*! \internal */
QPaintEngine* QMacPixmapData::paintEngine() const
{
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index 2c84ce7..56b53bd 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -179,13 +179,7 @@ QPixmap QPixmap::fromWinHBITMAP(HBITMAP bitmap, HBitmapFormat format)
BITMAP bitmap_info;
memset(&bitmap_info, 0, sizeof(BITMAP));
- int res;
- QT_WA({
- res = GetObjectW(bitmap, sizeof(BITMAP), &bitmap_info);
- } , {
- res = GetObjectA(bitmap, sizeof(BITMAP), &bitmap_info);
- });
-
+ int res = GetObject(bitmap, sizeof(BITMAP), &bitmap_info);
if (!res) {
qErrnoWarning("QPixmap::fromWinHBITMAP(), failed to get bitmap info");
return QPixmap();
@@ -417,9 +411,9 @@ QPixmap convertHIconToPixmap( const HICON icon, bool large)
QPixmap loadIconFromShell32( int resourceId, int size )
{
#ifdef Q_OS_WINCE
- HMODULE hmod = LoadLibrary((const wchar_t *) QString::fromLatin1("ceshell.dll").utf16());
+ HMODULE hmod = LoadLibrary(L"ceshell.dll");
#else
- HMODULE hmod = LoadLibraryA("shell32.dll");
+ HMODULE hmod = LoadLibrary(L"shell32.dll");
#endif
if( hmod ) {
HICON iconHandle = (HICON)LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, size, size, 0);
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index baa2969..b4a3a49 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -64,25 +64,24 @@ QT_BEGIN_NAMESPACE
access the global pixmap cache. It creates an internal QCache
object for caching the pixmaps.
- The cache associates a pixmap with a string as a key or with a QPixmapCache::Key.
- The QPixmapCache::Key is faster than using strings as key. The string API is
- very convenient for complex keys but the QPixmapCache::Key API will be very efficient
- and convenient for a 1 object <-> 1 pixmap mapping (then you can store the key as
- a member).
- If two pixmaps are inserted into the cache using equal keys, then the
- last pixmap will hide the first pixmap. The QHash and QCache classes do
- exactly the same.
+ The cache associates a pixmap with a user-provided string as a key,
+ or with a QPixmapCache::Key that the cache generates.
+ Using QPixmapCache::Key for keys is faster than using strings. The string API is
+ very convenient for complex keys but the QPixmapCache::Key API will be very
+ efficient and convenient for a one-to-one object-to-pixmap mapping \mdash in
+ this case, you can store the keys as members of an object.
+
+ If two pixmaps are inserted into the cache using equal keys then the
+ last pixmap will replace the first pixmap in the cache. This follows the
+ behavior of the QHash and QCache classes.
The cache becomes full when the total size of all pixmaps in the
cache exceeds cacheLimit(). The initial cache limit is
- 2048 KB(2 MB) for Embedded, 10240 KB (10
- MB) for Desktops; it is changed with setCacheLimit().
- A pixmap takes roughly (\e{width} * \e{height} * \e{depth})/8 bytes of memory.
-
- The \e{Qt Quarterly} article
- \l{http://doc.trolltech.com/qq/qq12-qpixmapcache.html}{Optimizing
- with QPixmapCache} explains how to use QPixmapCache to speed up
- applications by caching the results of painting.
+ 2048 KB (2 MB) on embedded platforms, 10240 KB (10 MB) on desktop
+ platforms; you can change this by calling setCacheLimit() with the
+ required value.
+ A pixmap takes roughly (\e{width} * \e{height} * \e{depth})/8 bytes of
+ memory.
\sa QCache, QPixmap
*/
@@ -96,6 +95,17 @@ static int cache_limit = 10240; // 10 MB cache limit for desktop
#endif
/*!
+ \class QPixmapCache::Key
+ \brief The QPixmapCache::Key class can be used for efficient access
+ to the QPixmapCache.
+ \since 4.6
+
+ Use QPixmapCache::insert() to receive an instance of Key generated
+ by the pixmap cache. You can store the key in your own objects for
+ a very efficient one-to-one object-to-pixmap mapping.
+*/
+
+/*!
Constructs an empty Key object.
*/
QPixmapCache::Key::Key() : d(0)
@@ -114,7 +124,7 @@ QPixmapCache::Key::Key(const Key &other)
}
/*!
- Destructor; called immediately before the object is deleted.
+ Destroys the key.
*/
QPixmapCache::Key::~Key()
{
@@ -125,7 +135,8 @@ QPixmapCache::Key::~Key()
/*!
\internal
- Returns true if this key is the same as the given \a key.
+ Returns true if this key is the same as the given \a key; otherwise returns
+ false.
*/
bool QPixmapCache::Key::operator ==(const Key &key) const
{
@@ -409,7 +420,7 @@ QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
Q_GLOBAL_STATIC(QPMCache, pm_cache)
/*!
- \obsolete
+ \obsolete
\overload
Returns the pixmap associated with the \a key in the cache, or
@@ -442,7 +453,7 @@ bool QPixmapCache::find(const QString &key, QPixmap& pixmap)
}
/*!
- Looks for a cached pixmap associated with the \a key in the cache.
+ Looks for a cached pixmap associated with the given \a key in the cache.
If the pixmap is found, the function sets \a pixmap to that pixmap and
returns true; otherwise it leaves \a pixmap alone and returns false.
@@ -461,10 +472,10 @@ bool QPixmapCache::find(const QString &key, QPixmap* pixmap)
}
/*!
- Looks for a cached pixmap associated with the \a key in the cache.
+ Looks for a cached pixmap associated with the given \a key in the cache.
If the pixmap is found, the function sets \a pixmap to that pixmap and
returns true; otherwise it leaves \a pixmap alone and returns false. If
- the pixmap is not found, it means that the \a key is not valid anymore,
+ the pixmap is not found, it means that the \a key is no longer valid,
so it will be released for the next insertion.
\since 4.6
@@ -506,8 +517,8 @@ bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap)
}
/*!
- Inserts a copy of the pixmap \a pixmap into
- the cache and return you the key.
+ Inserts a copy of the given \a pixmap into the cache and returns a key
+ that can be used to retrieve it.
When a pixmap is inserted and the cache is about to exceed its
limit, it removes pixmaps until there is enough room for the
@@ -526,9 +537,9 @@ QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
}
/*!
- Replace the pixmap associated to the \a key into
- the cache. It return true if the pixmap \a pixmap has been correctly
- inserted into the cache false otherwise.
+ Replaces the pixmap associated with the given \a key with the \a pixmap
+ specified. Returns true if the \a pixmap has been correctly inserted into
+ the cache; otherwise returns false.
\sa setCacheLimit(), insert()
@@ -545,8 +556,8 @@ bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
/*!
Returns the cache limit (in kilobytes).
- The default cache limit is 2048 KB for Embedded, 10240 KB for
- Desktops.
+ The default cache limit is 2048 KB on embedded platforms, 10240 KB on
+ desktop platforms.
\sa setCacheLimit()
*/
@@ -559,8 +570,8 @@ int QPixmapCache::cacheLimit()
/*!
Sets the cache limit to \a n kilobytes.
- The default setting is 2048 KB for Embedded, 10240 KB for
- Desktops.
+ The default setting is 2048 KB on embedded platforms, 10240 KB on
+ desktop platforms.
\sa cacheLimit()
*/
@@ -580,7 +591,7 @@ void QPixmapCache::remove(const QString &key)
}
/*!
- Removes the pixmap associated with \a key from the cache and release
+ Removes the pixmap associated with \a key from the cache and releases
the key for a future insertion.
\since 4.6
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index c5f3663..184bd65 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -293,8 +293,6 @@ int QPixmapConvolutionFilter::columns() const
/*!
- \reimp
-
\internal
*/
QRectF QPixmapConvolutionFilter::boundingRectFor(const QRectF &rect) const
@@ -405,8 +403,6 @@ static void convolute(
}
/*!
- \reimp
-
\internal
*/
void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const QPixmap &src, const QRectF& srcRect) const
@@ -581,8 +577,6 @@ void QPixmapColorizeFilter::setColor(const QColor &color)
}
/*!
- \reimp
-
\internal
*/
void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const
@@ -805,8 +799,6 @@ void QPixmapDropShadowFilter::setOffset(const QPointF &offset)
*/
/*!
- \reimp
-
\internal
*/
QRectF QPixmapDropShadowFilter::boundingRectFor(const QRectF &rect) const
@@ -822,8 +814,6 @@ QRectF QPixmapDropShadowFilter::boundingRectFor(const QRectF &rect) const
}
/*!
- \reimp
-
\internal
*/
void QPixmapDropShadowFilter::draw(QPainter *p,
diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp
index a8c5092..da7e84f 100644
--- a/src/gui/inputmethod/qwininputcontext_win.cpp
+++ b/src/gui/inputmethod/qwininputcontext_win.cpp
@@ -45,16 +45,11 @@
#include "qfont.h"
#include "qwidget.h"
#include "qapplication.h"
-#include "qlibrary.h"
#include "qevent.h"
#include "qtextformat.h"
//#define Q_IME_DEBUG
-/* Active Input method support on Win95/98/NT */
-#include <objbase.h>
-#include <initguid.h>
-
#ifdef Q_IME_DEBUG
#include "qdebug.h"
#endif
@@ -218,25 +213,6 @@ static DWORD WM_MSIME_MOUSE = 0;
QWinInputContext::QWinInputContext(QObject *parent)
: QInputContext(parent), recursionGuard(false)
{
- if (QSysInfo::WindowsVersion < QSysInfo::WV_2000) {
- // try to get the Active IMM COM object on Win95/98/NT, where english versions don't
- // support the regular Windows input methods.
- if (CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_INPROC_SERVER,
- IID_IActiveIMMApp, (LPVOID *)&aimm) != S_OK) {
- aimm = 0;
- }
- if (aimm && (aimm->QueryInterface(IID_IActiveIMMMessagePumpOwner, (LPVOID *)&aimmpump) != S_OK ||
- aimm->Activate(true) != S_OK)) {
- aimm->Release();
- aimm = 0;
- if (aimmpump)
- aimmpump->Release();
- aimmpump = 0;
- }
- if (aimmpump)
- aimmpump->Start();
- }
-
#ifndef Q_WS_WINCE
QSysInfo::WinVersion ver = QSysInfo::windowsVersion();
if (ver & QSysInfo::WV_NT_based && ver >= QSysInfo::WV_VISTA) {
@@ -262,25 +238,21 @@ QWinInputContext::QWinInputContext(QObject *parent)
delete []lpList;
}
} else {
- // figure out whether a RTL language is installed
- typedef BOOL(WINAPI *PtrIsValidLanguageGroup)(DWORD,DWORD);
- PtrIsValidLanguageGroup isValidLanguageGroup = (PtrIsValidLanguageGroup)QLibrary::resolve(QLatin1String("kernel32"), "IsValidLanguageGroup");
- if (isValidLanguageGroup) {
- qt_use_rtl_extensions = isValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED)
- || isValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED);
- }
- qt_use_rtl_extensions |= IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
- || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
+ // figure out whether a RTL language is installed
+ qt_use_rtl_extensions = IsValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED)
+ || IsValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED)
+ || IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
+ || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
#ifdef LANG_SYRIAC
- || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
+ || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
#endif
- || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED);
+ || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED);
}
#else
qt_use_rtl_extensions = false;
#endif
- WM_MSIME_MOUSE = QT_WA_INLINE(RegisterWindowMessage(L"MSIMEMouseOperation"), RegisterWindowMessageA("MSIMEMouseOperation"));
+ WM_MSIME_MOUSE = RegisterWindowMessage(L"MSIMEMouseOperation");
}
QWinInputContext::~QWinInputContext()
@@ -337,26 +309,13 @@ static void notifyIME(HIMC imc, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
ImmNotifyIME(imc, dwAction, dwIndex, dwValue);
}
-static LONG getCompositionString(HIMC himc, DWORD dwIndex, LPVOID lpbuf, DWORD dBufLen, bool *unicode = 0)
+static LONG getCompositionString(HIMC himc, DWORD dwIndex, LPVOID lpbuf, DWORD dBufLen)
{
LONG len = 0;
- if (unicode)
- *unicode = true;
if (aimm)
aimm->GetCompositionStringW(himc, dwIndex, dBufLen, &len, lpbuf);
else
- {
- if(QSysInfo::WindowsVersion != QSysInfo::WV_95) {
- len = ImmGetCompositionStringW(himc, dwIndex, lpbuf, dBufLen);
- }
-#if !defined(Q_WS_WINCE)
- else {
- len = ImmGetCompositionStringA(himc, dwIndex, lpbuf, dBufLen);
- if (unicode)
- *unicode = false;
- }
-#endif
- }
+ len = ImmGetCompositionString(himc, dwIndex, lpbuf, dBufLen);
return len;
}
@@ -367,29 +326,28 @@ static int getCursorPosition(HIMC himc)
static QString getString(HIMC himc, DWORD dwindex, int *selStart = 0, int *selLength = 0)
{
- static char *buffer = 0;
+ static wchar_t *buffer = 0;
static int buflen = 0;
int len = getCompositionString(himc, dwindex, 0, 0) + 1;
if (!buffer || len > buflen) {
delete [] buffer;
buflen = qMin(len, 256);
- buffer = new char[buflen];
+ buffer = new wchar_t[buflen];
}
- bool unicode = true;
- len = getCompositionString(himc, dwindex, buffer, buflen, &unicode);
+ len = getCompositionString(himc, dwindex, buffer, buflen * sizeof(wchar_t));
if (selStart) {
- static char *attrbuffer = 0;
+ static wchar_t *attrbuffer = 0;
static int attrbuflen = 0;
int attrlen = getCompositionString(himc, dwindex, 0, 0) + 1;
if (!attrbuffer || attrlen> attrbuflen) {
delete [] attrbuffer;
attrbuflen = qMin(attrlen, 256);
- attrbuffer = new char[attrbuflen];
+ attrbuffer = new wchar_t[attrbuflen];
}
- attrlen = getCompositionString(himc, GCS_COMPATTR, attrbuffer, attrbuflen);
+ attrlen = getCompositionString(himc, GCS_COMPATTR, attrbuffer, attrbuflen * sizeof(wchar_t));
*selStart = attrlen+1;
*selLength = -1;
for (int i = 0; i < attrlen; i++) {
@@ -403,18 +361,8 @@ static QString getString(HIMC himc, DWORD dwindex, int *selStart = 0, int *selLe
if (len <= 0)
return QString();
- if (unicode) {
- return QString((QChar *)buffer, len/sizeof(QChar));
- }
- else {
- buffer[len] = 0;
- WCHAR *wc = new WCHAR[len+1];
- int l = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
- buffer, len, wc, len+1);
- QString res = QString((QChar *)wc, l);
- delete [] wc;
- return res;
- }
+
+ return QString((QChar*)buffer, len / sizeof(QChar));
}
void QWinInputContext::TranslateMessage(const MSG *msg)
@@ -428,11 +376,7 @@ LRESULT QWinInputContext::DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
LRESULT retval;
if (!aimm || aimm->OnDefWindowProc(hwnd, msg, wParam, lParam, &retval) != S_OK)
{
- QT_WA({
- retval = ::DefWindowProc(hwnd, msg, wParam, lParam);
- } , {
- retval = ::DefWindowProcA(hwnd,msg, wParam, lParam);
- });
+ retval = ::DefWindowProc(hwnd, msg, wParam, lParam);
}
return retval;
}
@@ -454,21 +398,13 @@ void QWinInputContext::update()
HFONT hf;
hf = f.handle();
- QT_WA({
- LOGFONT lf;
- if (GetObject(hf, sizeof(lf), &lf))
- if (aimm)
- aimm->SetCompositionFontW(imc, &lf);
- else
- ImmSetCompositionFont(imc, &lf);
- } , {
- LOGFONTA lf;
- if (GetObjectA(hf, sizeof(lf), &lf))
- if (aimm)
- aimm->SetCompositionFontA(imc, &lf);
- else
- ImmSetCompositionFontA(imc, &lf);
- });
+ LOGFONT lf;
+ if (GetObject(hf, sizeof(lf), &lf)) {
+ if (aimm)
+ aimm->SetCompositionFontW(imc, &lf);
+ else
+ ImmSetCompositionFont(imc, &lf);
+ }
QRect r = w->inputMethodQuery(Qt::ImMicroFocus).toRect();
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index a4f512b..759ee1a 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -128,6 +128,37 @@ void QAbstractItemViewPrivate::init()
q->setAttribute(Qt::WA_InputMethodEnabled);
}
+void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index)
+{
+ //we take a persistent model index because the model might change by emitting signals
+ Q_Q(QAbstractItemView);
+ if (viewportEnteredNeeded || enteredIndex != index) {
+ viewportEnteredNeeded = false;
+
+ if (index.isValid()) {
+ emit q->entered(index);
+#ifndef QT_NO_STATUSTIP
+ QString statustip = model->data(index, Qt::StatusTipRole).toString();
+ if (parent && !statustip.isEmpty()) {
+ QStatusTipEvent tip(statustip);
+ QApplication::sendEvent(parent, &tip);
+ }
+#endif
+ } else {
+#ifndef QT_NO_STATUSTIP
+ if (parent) {
+ QString emptyString;
+ QStatusTipEvent tip( emptyString );
+ QApplication::sendEvent(parent, &tip);
+ }
+#endif
+ emit q->viewportEntered();
+ }
+ enteredIndex = index;
+ }
+}
+
+
/*!
\class QAbstractItemView
@@ -1558,7 +1589,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
}
#endif // QT_NO_DRAGANDDROP
- QModelIndex index = indexAt(bottomRight);
+ QPersistentModelIndex index = indexAt(bottomRight);
QModelIndex buddy = d->model->buddy(d->pressedIndex);
if ((state() == EditingState && d->hasEditor(buddy))
|| edit(index, NoEditTriggers, event))
@@ -1569,36 +1600,10 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
else
topLeft = bottomRight;
- if (d->viewportEnteredNeeded || d->enteredIndex != index) {
- d->viewportEnteredNeeded = false;
-
- // signal handlers may change the model
- QPersistentModelIndex persistent = index;
- if (persistent.isValid()) {
- emit entered(persistent);
-#ifndef QT_NO_STATUSTIP
- QString statustip = d->model->data(persistent, Qt::StatusTipRole).toString();
- if (parent() && !statustip.isEmpty()) {
- QStatusTipEvent tip(statustip);
- QApplication::sendEvent(parent(), &tip);
- }
-#endif
- } else {
-#ifndef QT_NO_STATUSTIP
- if (parent()) {
- QString emptyString;
- QStatusTipEvent tip(emptyString);
- QApplication::sendEvent(parent(), &tip);
- }
-#endif
- emit viewportEntered();
- }
- d->enteredIndex = persistent;
- index = persistent;
- }
+ d->checkMouseMove(index);
#ifndef QT_NO_DRAGANDDROP
- if (index.isValid()
+ if (d->pressedIndex.isValid()
&& d->dragEnabled
&& (state() != DragSelectingState)
&& (event->buttons() != Qt::NoButton)
@@ -1614,14 +1619,13 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
// Do the normalize ourselves, since QRect::normalized() is flawed
QRect selectionRect = QRect(topLeft, bottomRight);
- QPersistentModelIndex persistent = index;
setSelection(selectionRect, command);
// set at the end because it might scroll the view
- if (persistent.isValid()
- && (persistent != d->selectionModel->currentIndex())
- && d->isIndexEnabled(persistent))
- d->selectionModel->setCurrentIndex(persistent, QItemSelectionModel::NoUpdate);
+ if (index.isValid()
+ && (index != d->selectionModel->currentIndex())
+ && d->isIndexEnabled(index))
+ d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
}
}
@@ -2200,6 +2204,8 @@ void QAbstractItemView::resizeEvent(QResizeEvent *event)
void QAbstractItemView::timerEvent(QTimerEvent *event)
{
Q_D(QAbstractItemView);
+ if (event->timerId() == d->fetchMoreTimer.timerId())
+ d->fetchMore();
if (event->timerId() == d->autoScrollTimer.timerId())
doAutoScroll();
else if (event->timerId() == d->updateTimer.timerId())
@@ -2415,7 +2421,7 @@ void QAbstractItemView::updateEditorGeometries()
void QAbstractItemView::updateGeometries()
{
updateEditorGeometries();
- QMetaObject::invokeMethod(this, "_q_fetchMore", Qt::QueuedConnection);
+ d_func()->fetchMoreTimer.start(0, this); //fetch more later
}
/*!
@@ -2426,6 +2432,7 @@ void QAbstractItemView::verticalScrollbarValueChanged(int value)
Q_D(QAbstractItemView);
if (verticalScrollBar()->maximum() == value && d->model->canFetchMore(d->root))
d->model->fetchMore(d->root);
+ d->checkMouseMove(viewport()->mapFromGlobal(QCursor::pos()));
}
/*!
@@ -2436,6 +2443,7 @@ void QAbstractItemView::horizontalScrollbarValueChanged(int value)
Q_D(QAbstractItemView);
if (horizontalScrollBar()->maximum() == value && d->model->canFetchMore(d->root))
d->model->fetchMore(d->root);
+ d->checkMouseMove(viewport()->mapFromGlobal(QCursor::pos()));
}
/*!
@@ -2958,7 +2966,7 @@ void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelInde
void QAbstractItemView::rowsInserted(const QModelIndex &, int, int)
{
if (!isVisible())
- QMetaObject::invokeMethod(this, "_q_fetchMore", Qt::QueuedConnection);
+ d_func()->fetchMoreTimer.start(0, this); //fetch more later
else
updateEditorGeometries();
}
@@ -3181,7 +3189,7 @@ void QAbstractItemView::currentChanged(const QModelIndex &current, const QModelI
update(current);
edit(current, CurrentChanged, 0);
if (current.row() == (d->model->rowCount(d->root) - 1))
- d->_q_fetchMore();
+ d->fetchMore();
} else {
d->shouldScrollToCurrentOnShow = d->autoScroll;
}
@@ -3602,8 +3610,9 @@ QAbstractItemViewPrivate::contiguousSelectionCommand(const QModelIndex &index,
}
}
-void QAbstractItemViewPrivate::_q_fetchMore()
+void QAbstractItemViewPrivate::fetchMore()
{
+ fetchMoreTimer.stop();
if (!model->canFetchMore(root))
return;
int last = model->rowCount(root) - 1;
@@ -3876,30 +3885,48 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even
return true;
}
-QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const
+/*
+ \internal
+
+ returns the pair QRect/QModelIndex that should be painted on the viewports's rect
+ */
+
+QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const
{
+ Q_ASSERT(r);
Q_Q(const QAbstractItemView);
- QRect rect = q->visualRect(indexes.at(0));
- QList<QRect> rects;
+ QRect &rect = *r;
+ const QRect viewportRect = viewport->rect();
+ QItemViewPaintPairs ret;
for (int i = 0; i < indexes.count(); ++i) {
- rects.append(q->visualRect(indexes.at(i)));
- rect |= rects.at(i);
+ const QModelIndex &index = indexes.at(i);
+ const QRect current = q->visualRect(index);
+ if (current.intersects(viewportRect)) {
+ ret += qMakePair(current, index);
+ rect |= current;
+ }
}
- rect = rect.intersected(viewport->rect());
- if (rect.width() <= 0 || rect.height() <= 0)
+ rect &= viewportRect;
+ return ret;
+}
+
+QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const
+{
+ Q_ASSERT(r);
+ QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r);
+ if (paintPairs.isEmpty())
return QPixmap();
- QImage image(rect.size(), QImage::Format_ARGB32_Premultiplied);
- image.fill(0);
- QPainter painter(&image);
+ QPixmap pixmap(r->size());
+ pixmap.fill(Qt::transparent);
+ QPainter painter(&pixmap);
QStyleOptionViewItemV4 option = viewOptionsV4();
option.state |= QStyle::State_Selected;
- for (int j = 0; j < indexes.count(); ++j) {
- option.rect = QRect(rects.at(j).topLeft() - rect.topLeft(), rects.at(j).size());
- delegateForIndex(indexes.at(j))->paint(&painter, option, indexes.at(j));
+ for (int j = 0; j < paintPairs.count(); ++j) {
+ option.rect = paintPairs.at(j).first.translated(-r->topLeft());
+ const QModelIndex &current = paintPairs.at(j).second;
+ delegateForIndex(current)->paint(&painter, option, current);
}
- painter.end();
- if (r) *r = rect;
- return QPixmap::fromImage(image);
+ return pixmap;
}
void QAbstractItemViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command)
diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h
index f98dd16..da6f0ea 100644
--- a/src/gui/itemviews/qabstractitemview.h
+++ b/src/gui/itemviews/qabstractitemview.h
@@ -353,7 +353,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())
- Q_PRIVATE_SLOT(d_func(), void _q_fetchMore())
friend class QTreeViewPrivate; // needed to compile with MSVC
friend class QAccessibleItemRow;
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index d661c2a..f90e0fe 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -61,11 +61,10 @@
#include "QtGui/qmime.h"
#include "QtGui/qpainter.h"
#include "QtCore/qpair.h"
-#include "QtCore/qtimer.h"
-#include "QtCore/qtimeline.h"
#include "QtGui/qregion.h"
#include "QtCore/qdebug.h"
#include "QtGui/qpainter.h"
+#include "QtCore/qbasictimer.h"
#ifndef QT_NO_ITEMVIEWS
@@ -87,6 +86,9 @@ struct QEditorInfo
};
+typedef QPair<QRect, QModelIndex> QItemViewPaintPair;
+typedef QList<QItemViewPaintPair> QItemViewPaintPairs;
+
class QEmptyModel : public QAbstractItemModel
{
public:
@@ -109,13 +111,14 @@ public:
void init();
- void _q_rowsRemoved(const QModelIndex &parent, int start, int end);
- void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
- void _q_columnsRemoved(const QModelIndex &parent, int start, int end);
- void _q_columnsInserted(const QModelIndex &parent, int start, int end);
- void _q_modelDestroyed();
- void _q_layoutChanged();
- void _q_fetchMore();
+ virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end);
+ virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+ virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end);
+ virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end);
+ virtual void _q_modelDestroyed();
+ virtual void _q_layoutChanged();
+
+ void fetchMore();
bool shouldEdit(QAbstractItemView::EditTrigger trigger, const QModelIndex &index) const;
bool shouldForwardEvent(QAbstractItemView::EditTrigger trigger, const QEvent *event) const;
@@ -139,6 +142,9 @@ public:
const QEvent *event) const;
virtual void selectAll(QItemSelectionModel::SelectionFlags command);
+ void checkMouseMove(const QPersistentModelIndex &index);
+ inline void checkMouseMove(const QPoint &pos) { checkMouseMove(q_func()->indexAt(pos)); }
+
inline QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const
{
switch (selectionBehavior) {
@@ -173,7 +179,9 @@ public:
q_func()->style()->drawPrimitive(QStyle::PE_IndicatorItemViewItemDrop, &opt, painter, q_func());
}
}
+
#endif
+ virtual QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
inline void releaseEditor(QWidget *editor) const {
if (editor) {
@@ -218,7 +226,7 @@ public:
void clearOrRemove();
void checkPersistentEditorFocus();
- QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r = 0) const;
+ QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r) const;
inline QPoint offset() const {
const Q_Q(QAbstractItemView);
@@ -372,7 +380,6 @@ public:
QBasicTimer updateTimer;
QBasicTimer delayedEditing;
QBasicTimer delayedAutoScroll; //used when an item is clicked
- QTimeLine timeline;
QAbstractItemView::ScrollMode verticalScrollMode;
QAbstractItemView::ScrollMode horizontalScrollMode;
@@ -384,6 +391,7 @@ public:
private:
mutable QBasicTimer delayedLayout;
+ mutable QBasicTimer fetchMoreTimer;
};
QT_BEGIN_INCLUDE_NAMESPACE
diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp
index 1662fa8..c544394 100644
--- a/src/gui/itemviews/qcolumnview.cpp
+++ b/src/gui/itemviews/qcolumnview.cpp
@@ -52,7 +52,6 @@
#include <qscrollbar.h>
#include <qpainter.h>
#include <qdebug.h>
-#include <qpainterpath.h>
QT_BEGIN_NAMESPACE
@@ -108,9 +107,13 @@ void QColumnViewPrivate::initialize()
{
Q_Q(QColumnView);
q->setTextElideMode(Qt::ElideMiddle);
- QObject::connect(&currentAnimation, SIGNAL(frameChanged(int)),
- hbar, SLOT(setValue(int)));
+#ifndef QT_NO_ANIMATION
QObject::connect(&currentAnimation, SIGNAL(finished()), q, SLOT(_q_changeCurrentColumn()));
+ currentAnimation.setDuration(ANIMATION_DURATION_MSEC);
+ currentAnimation.setTargetObject(hbar);
+ currentAnimation.setPropertyName("value");
+ currentAnimation.setEasingCurve(QEasingCurve::InOutQuad);
+#endif //QT_NO_ANIMATION
delete itemDelegate;
q->setItemDelegate(new QColumnViewDelegate(q));
}
@@ -260,10 +263,12 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
if (!index.isValid() || d->columns.isEmpty())
return;
- if (d->currentAnimation.state() == QTimeLine::Running)
+#ifndef QT_NO_ANIMATION
+ if (d->currentAnimation.state() == QPropertyAnimation::Running)
return;
d->currentAnimation.stop();
+#endif //QT_NO_ANIMATION
// Fill up what is needed to get to index
d->closeColumns(index, true);
@@ -326,22 +331,12 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
}
}
- //horizontalScrollBar()->setValue(newScrollbarValue);
- //d->_q_changeCurrentColumn();
- //return;
- // or do the following currentAnimation
-
- int oldValue = horizontalScrollBar()->value();
-
- if (oldValue < newScrollbarValue) {
- d->currentAnimation.setFrameRange(oldValue, newScrollbarValue);
- d->currentAnimation.setDirection(QTimeLine::Forward);
- d->currentAnimation.setCurrentTime(0);
- } else {
- d->currentAnimation.setFrameRange(newScrollbarValue, oldValue);
- d->currentAnimation.setDirection(QTimeLine::Backward);
- }
+#ifndef QT_NO_ANIMATION
+ d->currentAnimation.setEndValue(newScrollbarValue);
d->currentAnimation.start();
+#else
+ horizontalScrollBar()->setValue(newScrollbarValue);
+#endif //QT_NO_ANIMATION
}
/*!
@@ -410,8 +405,10 @@ void QColumnView::resizeEvent(QResizeEvent *event)
void QColumnViewPrivate::updateScrollbars()
{
Q_Q(QColumnView);
- if (currentAnimation.state() == QTimeLine::Running)
+#ifndef QT_NO_ANIMATION
+ if (currentAnimation.state() == QPropertyAnimation::Running)
return;
+#endif //QT_NO_ANIMATION
// find the total horizontal length of the laid out columns
int horizontalLength = 0;
@@ -896,6 +893,15 @@ QList<int> QColumnView::columnWidths() const
/*!
\reimp
*/
+void QColumnView::rowsInserted(const QModelIndex &parent, int start, int end)
+{
+ QAbstractItemView::rowsInserted(parent, start, end);
+ d_func()->checkColumnCreation(parent);
+}
+
+/*!
+ \reimp
+*/
void QColumnView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
Q_D(QColumnView);
@@ -1036,7 +1042,6 @@ QColumnViewPrivate::QColumnViewPrivate()
: QAbstractItemViewPrivate()
,showResizeGrips(true)
,offset(0)
-,currentAnimation(ANIMATION_DURATION_MSEC)
,previewWidget(0)
,previewColumn(0)
{
@@ -1048,6 +1053,41 @@ QColumnViewPrivate::~QColumnViewPrivate()
/*!
\internal
+
+ */
+void QColumnViewPrivate::_q_columnsInserted(const QModelIndex &parent, int start, int end)
+{
+ QAbstractItemViewPrivate::_q_columnsInserted(parent, start, end);
+ checkColumnCreation(parent);
+}
+
+/*!
+ \internal
+
+ Makes sure we create a corresponding column as a result of changing the model.
+
+ */
+void QColumnViewPrivate::checkColumnCreation(const QModelIndex &parent)
+{
+ if (parent == q_func()->currentIndex() && model->hasChildren(parent)) {
+ //the parent has children and is the current
+ //let's try to find out if there is already a mapping that is good
+ for (int i = 0; i < columns.count(); ++i) {
+ QAbstractItemView *view = columns.at(i);
+ if (view->rootIndex() == parent) {
+ if (view == previewColumn) {
+ //let's recreate the parent
+ closeColumns(parent, false);
+ createColumn(parent, true /*show*/);
+ }
+ break;
+ }
+ }
+ }
+}
+
+/*!
+ \internal
Place all of the columns where they belong inside of the viewport, resize as necessary.
*/
void QColumnViewPrivate::doLayout()
diff --git a/src/gui/itemviews/qcolumnview.h b/src/gui/itemviews/qcolumnview.h
index 880870a..f8697e9 100644
--- a/src/gui/itemviews/qcolumnview.h
+++ b/src/gui/itemviews/qcolumnview.h
@@ -97,16 +97,14 @@ protected:
QRegion visualRegionForSelection(const QItemSelection &selection) const;
int horizontalOffset() const;
int verticalOffset() const;
- void scrollContentsBy(int dx, int dy);
+ void rowsInserted(const QModelIndex &parent, int start, int end);
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous);
// QColumnView functions
+ void scrollContentsBy(int dx, int dy);
virtual QAbstractItemView* createColumn(const QModelIndex &rootIndex);
void initializeColumn(QAbstractItemView *column) const;
-protected Q_SLOTS:
- // QAbstractItemView overloads
- void currentChanged(const QModelIndex &current, const QModelIndex &previous);
-
private:
Q_DECLARE_PRIVATE(QColumnView)
Q_DISABLE_COPY(QColumnView)
diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h
index 904cd1d..7b4f774 100644
--- a/src/gui/itemviews/qcolumnview_p.h
+++ b/src/gui/itemviews/qcolumnview_p.h
@@ -60,7 +60,7 @@
#include <private/qabstractitemview_p.h>
#include <QtCore/qabstractitemmodel.h>
-#include <QtCore/qtimeline.h>
+#include <QtCore/qpropertyanimation.h>
#include <QtGui/qabstractitemdelegate.h>
#include <QtGui/qabstractitemview.h>
#include <QtGui/qitemdelegate.h>
@@ -148,16 +148,21 @@ public:
void closeColumns(const QModelIndex &parent = QModelIndex(), bool build = false);
void doLayout();
void setPreviewWidget(QWidget *widget);
+ void checkColumnCreation(const QModelIndex &parent);
+
void _q_gripMoved(int offset);
void _q_changeCurrentColumn();
void _q_clicked(const QModelIndex &index);
+ void _q_columnsInserted(const QModelIndex &parent, int start, int end);
QList<QAbstractItemView*> columns;
QVector<int> columnSizes; // used during init and corner moving
bool showResizeGrips;
int offset;
- QTimeLine currentAnimation;
+#ifndef QT_NO_ANIMATION
+ QPropertyAnimation currentAnimation;
+#endif
QWidget *previewWidget;
QAbstractItemView *previewColumn;
};
diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp
index 076e95d..5d7d1ff 100644
--- a/src/gui/itemviews/qdirmodel.cpp
+++ b/src/gui/itemviews/qdirmodel.cpp
@@ -228,7 +228,10 @@ void QDirModelPrivate::invalidate()
\note QDirModel requires an instance of a GUI application.
- \sa nameFilters(), setFilter(), filter(), QListView, QTreeView,
+ \note The usage of QDirModel is not recommended anymore. The
+ QFileSystemModel class is a more performant alternative.
+
+ \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel
{Dir View Example}, {Model Classes}
*/
diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp
index f9078b8..b9df4fc 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -45,18 +45,17 @@
#include <qstyle.h>
#include <qapplication.h>
#include <qdir.h>
+#include <qpixmapcache.h>
#if defined(Q_WS_WIN)
#define _WIN32_IE 0x0500
+#include <qt_windows.h>
+#include <commctrl.h>
#include <objbase.h>
#include <private/qpixmapdata_p.h>
-#include <qpixmapcache.h>
#elif defined(Q_WS_MAC)
-#include <private/qt_mac_p.h>
+#include <private/qt_cocoa_helpers_mac_p.h>
#endif
#include <private/qfunctions_p.h>
-#ifdef Q_OS_WINCE
-#include <Commctrl.h>
-#endif
#ifndef SHGFI_ADDOVERLAYS
#define SHGFI_ADDOVERLAYS 0x000000020
@@ -242,10 +241,10 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const
//Get the small icon
#ifndef Q_OS_WINCE
- val = SHGetFileInfo((const WCHAR *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
+ val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS);
#else
- val = SHGetFileInfo((const WCHAR *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
+ val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_SYSICONINDEX);
#endif
if (val) {
@@ -281,10 +280,10 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const
//Get the big icon
#ifndef Q_OS_WINCE
- val = SHGetFileInfo((const WCHAR *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
+ val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_LARGEICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS);
#else
- val = SHGetFileInfo((const WCHAR *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
+ val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
sizeof(SHFILEINFO), SHGFI_LARGEICON|SHGFI_SYSICONINDEX);
#endif
if (val) {
@@ -314,6 +313,31 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const
QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const
{
QIcon retIcon;
+ QString fileExtension = fi.suffix().toUpper();
+ fileExtension.prepend(QLatin1String("."));
+
+ const QString keyBase = QLatin1String("qt_") + fileExtension;
+
+ QPixmap pixmap;
+ if (fi.isFile() && !fi.isExecutable() && !fi.isSymLink()) {
+ QPixmapCache::find(keyBase + QLatin1String("16"), pixmap);
+ }
+
+ if (!pixmap.isNull()) {
+ retIcon.addPixmap(pixmap);
+ if (QPixmapCache::find(keyBase + QLatin1String("32"), pixmap)) {
+ retIcon.addPixmap(pixmap);
+ if (QPixmapCache::find(keyBase + QLatin1String("64"), pixmap)) {
+ retIcon.addPixmap(pixmap);
+ if (QPixmapCache::find(keyBase + QLatin1String("128"), pixmap)) {
+ retIcon.addPixmap(pixmap);
+ return retIcon;
+ }
+ }
+ }
+ }
+
+
FSRef macRef;
OSStatus status = FSPathMakeRef(reinterpret_cast<const UInt8*>(fi.canonicalFilePath().toUtf8().constData()),
&macRef, 0);
@@ -326,12 +350,23 @@ QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const
return retIcon;
IconRef iconRef;
SInt16 iconLabel;
- status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode, kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag, &iconRef, &iconLabel);
+ status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode,
+ kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag,
+ &iconRef, &iconLabel);
if (status != noErr)
return retIcon;
- extern void qt_mac_constructQIconFromIconRef(const IconRef, const IconRef, QIcon*, QStyle::StandardPixmap = QStyle::SP_CustomBase); // qmacstyle_mac.cpp
qt_mac_constructQIconFromIconRef(iconRef, 0, &retIcon);
ReleaseIconRef(iconRef);
+
+ pixmap = retIcon.pixmap(16);
+ QPixmapCache::insert(keyBase + QLatin1String("16"), pixmap);
+ pixmap = retIcon.pixmap(32);
+ QPixmapCache::insert(keyBase + QLatin1String("32"), pixmap);
+ pixmap = retIcon.pixmap(64);
+ QPixmapCache::insert(keyBase + QLatin1String("64"), pixmap);
+ pixmap = retIcon.pixmap(128);
+ QPixmapCache::insert(keyBase + QLatin1String("128"), pixmap);
+
return retIcon;
}
#endif
@@ -356,9 +391,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const
if (info.isRoot())
#if defined (Q_WS_WIN) && !defined(Q_WS_WINCE)
{
- uint type = DRIVE_UNKNOWN;
- QT_WA({ type = GetDriveTypeW((wchar_t *)info.absoluteFilePath().utf16()); },
- { type = GetDriveTypeA(info.absoluteFilePath().toLocal8Bit()); });
+ UINT type = GetDriveType((wchar_t *)info.absoluteFilePath().utf16());
switch (type) {
case DRIVE_REMOVABLE:
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 233150c..750e20b 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -522,31 +522,29 @@ int QHeaderView::length() const
QSize QHeaderView::sizeHint() const
{
Q_D(const QHeaderView);
- if (count() < 1)
- return QSize(0, 0);
if (d->cachedSizeHint.isValid())
return d->cachedSizeHint;
- int width = 0;
- int height = 0;
+ d->cachedSizeHint = QSize(0, 0); //reinitialize the cached size hint
+ const int sectionCount = count();
+
// get size hint for the first n sections
- int c = qMin(count(), 100);
- for (int i = 0; i < c; ++i) {
+ int i = 0;
+ for (int checked = 0; checked < 100 && i < sectionCount; ++i) {
if (isSectionHidden(i))
continue;
+ checked++;
QSize hint = sectionSizeFromContents(i);
- width = qMax(hint.width(), width);
- height = qMax(hint.height(), height);
+ d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint);
}
// get size hint for the last n sections
- c = qMax(count() - 100, c);
- for (int j = count() - 1; j >= c; --j) {
+ i = qMax(i, sectionCount - 100 );
+ for (int j = sectionCount - 1, checked = 0; j >= i && checked < 100; --j) {
if (isSectionHidden(j))
continue;
+ checked++;
QSize hint = sectionSizeFromContents(j);
- width = qMax(hint.width(), width);
- height = qMax(hint.height(), height);
+ d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint);
}
- d->cachedSizeHint = QSize(width, height);
return d->cachedSizeHint;
}
@@ -2540,7 +2538,7 @@ QSize QHeaderView::sectionSizeFromContents(int logicalIndex) const
if (opt.icon.isNull())
opt.icon = qvariant_cast<QPixmap>(variant);
QSize size = style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this);
- if (isSortIndicatorShown() && sortIndicatorSection() == logicalIndex) {
+ if (isSortIndicatorShown()) {
int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, &opt, this);
if (d->orientation == Qt::Horizontal)
size.rwidth() += size.height() + margin;
diff --git a/src/gui/itemviews/qheaderview.h b/src/gui/itemviews/qheaderview.h
index f752ae2..3a66c9a 100644
--- a/src/gui/itemviews/qheaderview.h
+++ b/src/gui/itemviews/qheaderview.h
@@ -221,14 +221,13 @@ protected:
bool isIndexHidden(const QModelIndex &index) const;
QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers);
- void setSelection(const QRect&, QItemSelectionModel::SelectionFlags);
+ void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags);
QRegion visualRegionForSelection(const QItemSelection &selection) const;
void initStyleOption(QStyleOptionHeader *option) const;
private:
Q_PRIVATE_SLOT(d_func(), void _q_sectionsRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast))
Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged())
- Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())
Q_DECLARE_PRIVATE(QHeaderView)
Q_DISABLE_COPY(QHeaderView)
};
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index 74f5da2..6bcc153 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -861,6 +861,8 @@ void QItemDelegate::drawBackground(QPainter *painter,
/*!
\internal
+
+ Code duplicated in QCommonStylePrivate::viewItemLayout
*/
void QItemDelegate::doLayout(const QStyleOptionViewItem &option,
@@ -882,8 +884,10 @@ void QItemDelegate::doLayout(const QStyleOptionViewItem &option,
int w, h;
textRect->adjust(-textMargin, 0, textMargin, 0); // add width padding
- if (textRect->height() == 0 && !hasPixmap)
+ if (textRect->height() == 0 && (!hasPixmap || !hint)) {
+ //if there is no text, we still want to have a decent height for the item sizeHint and the editor size
textRect->setHeight(option.fontMetrics.height());
+ }
QSize pm(0, 0);
if (hasPixmap) {
@@ -1219,15 +1223,12 @@ bool QItemDelegate::eventFilter(QObject *object, QEvent *event)
if (editor->parentWidget())
editor->parentWidget()->setFocus();
return true;
- } else if (event->type() == QEvent::FocusOut || event->type() == QEvent::Hide) {
+ } else if (event->type() == QEvent::FocusOut || (event->type() == QEvent::Hide && editor->isWindow())) {
//the Hide event will take care of he editors that are in fact complete dialogs
if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) {
- QWidget *w = QApplication::focusWidget();
- while (w) { // don't worry about focus changes internally in the editor
- if (w == editor)
- return false;
- w = w->parentWidget();
- }
+ if (editor->isAncestorOf(QApplication::focusWidget()))
+ return false; // don't worry about focus changes internally in the editor
+
#ifndef QT_NO_DRAGANDDROP
// The window may lose focus during an drag operation.
// i.e when dragging involves the taskbar on Windows.
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index e4cb0f0..87825d9 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -270,24 +270,35 @@ QItemSelectionRange QItemSelectionRange::intersect(const QItemSelectionRange &ot
*/
-/*!
- Returns the list of model index items stored in the selection.
-*/
+/*
+ \internal
-QModelIndexList QItemSelectionRange::indexes() const
+ utility function for getting the indexes from a range
+ it avoid concatenating list and works on one
+ */
+
+static void indexesFromRange(const QItemSelectionRange &range, QModelIndexList &result)
{
- QModelIndex index;
- QModelIndexList result;
- if (isValid() && model()) {
- for (int column = left(); column <= right(); ++column) {
- for (int row = top(); row <= bottom(); ++row) {
- index = model()->index(row, column, parent());
- Qt::ItemFlags flags = model()->flags(index);
+ if (range.isValid() && range.model()) {
+ for (int column = range.left(); column <= range.right(); ++column) {
+ for (int row = range.top(); row <= range.bottom(); ++row) {
+ QModelIndex index = range.model()->index(row, column, range.parent());
+ Qt::ItemFlags flags = range.model()->flags(index);
if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))
result.append(index);
}
}
}
+}
+
+/*!
+ Returns the list of model index items stored in the selection.
+*/
+
+QModelIndexList QItemSelectionRange::indexes() const
+{
+ QModelIndexList result;
+ indexesFromRange(*this, result);
return result;
}
@@ -404,7 +415,7 @@ QModelIndexList QItemSelection::indexes() const
QModelIndexList result;
QList<QItemSelectionRange>::const_iterator it = begin();
for (; it != end(); ++it)
- result += (*it).indexes();
+ indexesFromRange(*it, result);
return result;
}
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 4652b91..148d204 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -709,6 +709,31 @@ void QListViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command)
selectionModel->select(selection, command);
}
+/*!
+ \reimp
+
+ We have a QListView way of knowing what elements are on the viewport
+ through the intersectingSet function
+*/
+QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const
+{
+ Q_ASSERT(r);
+ Q_Q(const QListView);
+ QRect &rect = *r;
+ const QRect viewportRect = viewport->rect();
+ QItemViewPaintPairs ret;
+ const QSet<QModelIndex> visibleIndexes = intersectingSet(viewportRect).toList().toSet();
+ for (int i = 0; i < indexes.count(); ++i) {
+ const QModelIndex &index = indexes.at(i);
+ if (visibleIndexes.contains(index)) {
+ const QRect current = q->visualRect(index);
+ ret += qMakePair(current, index);
+ rect |= current;
+ }
+ }
+ rect &= viewportRect;
+ return ret;
+}
/*!
\internal
@@ -925,9 +950,9 @@ void QListView::dragMoveEvent(QDragMoveEvent *e)
QModelIndex index;
if (d->movement == Snap) {
QRect rect(d->dynamicListView->snapToGrid(e->pos() + d->offset()), d->gridSize());
- d->intersectingSet(rect);
- index = d->intersectVector.count() > 0
- ? d->intersectVector.last() : QModelIndex();
+ const QVector<QModelIndex> intersectVector = d->intersectingSet(rect);
+ index = intersectVector.count() > 0
+ ? intersectVector.last() : QModelIndex();
} else {
index = indexAt(e->pos());
}
@@ -1100,10 +1125,8 @@ void QListView::paintEvent(QPaintEvent *e)
return;
QStyleOptionViewItemV4 option = d->viewOptionsV4();
QPainter painter(d->viewport);
- QRect area = e->rect();
- d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false);
- const QVector<QModelIndex> toBeRendered = d->intersectVector;
+ const QVector<QModelIndex> toBeRendered = d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false);
const QModelIndex current = currentIndex();
const QModelIndex hover = d->hover;
@@ -1225,9 +1248,9 @@ QModelIndex QListView::indexAt(const QPoint &p) const
{
Q_D(const QListView);
QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1);
- d->intersectingSet(rect);
- QModelIndex index = d->intersectVector.count() > 0
- ? d->intersectVector.last() : QModelIndex();
+ const QVector<QModelIndex> intersectVector = d->intersectingSet(rect);
+ QModelIndex index = intersectVector.count() > 0
+ ? intersectVector.last() : QModelIndex();
if (index.isValid() && visualRect(index).contains(p))
return index;
return QModelIndex();
@@ -1325,38 +1348,38 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
if (d->gridSize().isValid()) rect.setSize(d->gridSize());
QSize contents = d->contentsSize();
- d->intersectVector.clear();
+ QVector<QModelIndex> intersectVector;
switch (cursorAction) {
case MoveLeft:
- while (d->intersectVector.isEmpty()) {
+ while (intersectVector.isEmpty()) {
rect.translate(-rect.width(), 0);
if (rect.right() <= 0)
return current;
if (rect.left() < 0)
rect.setLeft(0);
- d->intersectingSet(rect);
- d->removeCurrentAndDisabled(&d->intersectVector, current);
+ intersectVector = d->intersectingSet(rect);
+ d->removeCurrentAndDisabled(&intersectVector, current);
}
- return d->closestIndex(initialRect, d->intersectVector);
+ return d->closestIndex(initialRect, intersectVector);
case MoveRight:
- while (d->intersectVector.isEmpty()) {
+ while (intersectVector.isEmpty()) {
rect.translate(rect.width(), 0);
if (rect.left() >= contents.width())
return current;
if (rect.right() > contents.width())
rect.setRight(contents.width());
- d->intersectingSet(rect);
- d->removeCurrentAndDisabled(&d->intersectVector, current);
+ intersectVector = d->intersectingSet(rect);
+ d->removeCurrentAndDisabled(&intersectVector, current);
}
- return d->closestIndex(initialRect, d->intersectVector);
+ return d->closestIndex(initialRect, intersectVector);
case MovePageUp:
rect.moveTop(rect.top() - d->viewport->height());
if (rect.top() < rect.height())
rect.moveTop(rect.height());
case MovePrevious:
case MoveUp:
- while (d->intersectVector.isEmpty()) {
+ while (intersectVector.isEmpty()) {
rect.translate(0, -rect.height());
if (rect.bottom() <= 0) {
#ifdef QT_KEYPAD_NAVIGATION
@@ -1372,17 +1395,17 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
}
if (rect.top() < 0)
rect.setTop(0);
- d->intersectingSet(rect);
- d->removeCurrentAndDisabled(&d->intersectVector, current);
+ intersectVector = d->intersectingSet(rect);
+ d->removeCurrentAndDisabled(&intersectVector, current);
}
- return d->closestIndex(initialRect, d->intersectVector);
+ return d->closestIndex(initialRect, intersectVector);
case MovePageDown:
rect.moveTop(rect.top() + d->viewport->height());
if (rect.bottom() > contents.height() - rect.height())
rect.moveBottom(contents.height() - rect.height());
case MoveNext:
case MoveDown:
- while (d->intersectVector.isEmpty()) {
+ while (intersectVector.isEmpty()) {
rect.translate(0, rect.height());
if (rect.top() >= contents.height()) {
#ifdef QT_KEYPAD_NAVIGATION
@@ -1399,10 +1422,10 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
}
if (rect.bottom() > contents.height())
rect.setBottom(contents.height());
- d->intersectingSet(rect);
- d->removeCurrentAndDisabled(&d->intersectVector, current);
+ intersectVector = d->intersectingSet(rect);
+ d->removeCurrentAndDisabled(&intersectVector, current);
}
- return d->closestIndex(initialRect, d->intersectVector);
+ return d->closestIndex(initialRect, intersectVector);
case MoveHome:
return d->model->index(0, d->column, d->root);
case MoveEnd:
@@ -1477,10 +1500,10 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
QItemSelection selection;
if (rect.width() == 1 && rect.height() == 1) {
- d->intersectingSet(rect.translated(horizontalOffset(), verticalOffset()));
+ const QVector<QModelIndex> intersectVector = d->intersectingSet(rect.translated(horizontalOffset(), verticalOffset()));
QModelIndex tl;
- if (!d->intersectVector.isEmpty())
- tl = d->intersectVector.last(); // special case for mouse press; only select the top item
+ if (!intersectVector.isEmpty())
+ tl = intersectVector.last(); // special case for mouse press; only select the top item
if (tl.isValid() && d->isIndexEnabled(tl))
selection.select(tl, tl);
} else {
@@ -1490,14 +1513,14 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
QModelIndex tl, br;
// get the first item
const QRect topLeft(rect.left() + horizontalOffset(), rect.top() + verticalOffset(), 1, 1);
- d->intersectingSet(topLeft);
- if (!d->intersectVector.isEmpty())
- tl = d->intersectVector.last();
+ QVector<QModelIndex> intersectVector = d->intersectingSet(topLeft);
+ if (!intersectVector.isEmpty())
+ tl = intersectVector.last();
// get the last item
const QRect bottomRight(rect.right() + horizontalOffset(), rect.bottom() + verticalOffset(), 1, 1);
- d->intersectingSet(bottomRight);
- if (!d->intersectVector.isEmpty())
- br = d->intersectVector.last();
+ intersectVector = d->intersectingSet(bottomRight);
+ if (!intersectVector.isEmpty())
+ br = intersectVector.last();
// get the ranges
if (tl.isValid() && br.isValid()
@@ -1540,7 +1563,10 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
}
// middle rectangle
if (top.bottom() < bottom.top()) {
- middle.setTop(top.bottom() + 1);
+ if (gridSize().isValid() && !gridSize().isNull())
+ middle.setTop(top.top() + gridSize().height());
+ else
+ middle.setTop(top.bottom() + 1);
middle.setLeft(qMin(top.left(), bottom.left()));
middle.setBottom(bottom.top() - 1);
middle.setRight(qMax(top.right(), bottom.right()));
@@ -1567,7 +1593,10 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
// only set middle if the
middle.setTop(0);
middle.setBottom(ch);
- middle.setLeft(left.right() + 1);
+ if (gridSize().isValid() && !gridSize().isNull())
+ middle.setLeft(left.left() + gridSize().width());
+ else
+ middle.setLeft(left.right() + 1);
middle.setRight(right.left() - 1);
} else if (left.bottom() < right.top()) {
left.setBottom(right.top() - 1);
@@ -1633,14 +1662,16 @@ QRegion QListView::visualRegionForSelection(const QItemSelection &selection) con
QModelIndexList QListView::selectedIndexes() const
{
Q_D(const QListView);
- QModelIndexList viewSelected;
- QModelIndexList modelSelected;
- if (d->selectionModel)
- modelSelected = d->selectionModel->selectedIndexes();
- for (int i = 0; i < modelSelected.count(); ++i) {
- QModelIndex index = modelSelected.at(i);
+ if (!d->selectionModel)
+ return QModelIndexList();
+
+ QModelIndexList viewSelected = d->selectionModel->selectedIndexes();
+ for (int i = 0; i < viewSelected.count(); ++i) {
+ const QModelIndex &index = viewSelected.at(i);
if (!isIndexHidden(index) && index.parent() == d->root && index.column() == d->column)
- viewSelected.append(index);
+ ++i;
+ else
+ viewSelected.removeAt(i);
}
return viewSelected;
}
@@ -2116,8 +2147,8 @@ QItemSelection QListViewPrivate::selection(const QRect &rect) const
{
QItemSelection selection;
QModelIndex tl, br;
- intersectingSet(rect);
- QVector<QModelIndex>::iterator it = intersectVector.begin();
+ const QVector<QModelIndex> intersectVector = intersectingSet(rect);
+ QVector<QModelIndex>::const_iterator it = intersectVector.begin();
for (; it != intersectVector.end(); ++it) {
if (!tl.isValid() && !br.isValid()) {
tl = br = *it;
@@ -2408,9 +2439,9 @@ void QStaticListViewBase::doStaticLayout(const QListViewLayoutInfo &info)
Finds the set of items intersecting with \a area.
In this function, itemsize is counted from topleft to the start of the next item.
*/
-void QStaticListViewBase::intersectingStaticSet(const QRect &area) const
+QVector<QModelIndex> QStaticListViewBase::intersectingStaticSet(const QRect &area) const
{
- clearIntersections();
+ QVector<QModelIndex> ret;
int segStartPosition;
int segEndPosition;
int flowStartPosition;
@@ -2427,7 +2458,7 @@ void QStaticListViewBase::intersectingStaticSet(const QRect &area) const
flowEndPosition = area.bottom();
}
if (segmentPositions.count() < 2 || flowPositions.isEmpty())
- return;
+ return ret;
// the last segment position is actually the edge of the last segment
const int segLast = segmentPositions.count() - 2;
int seg = qBinarySearch<int>(segmentPositions, segStartPosition, 0, segLast + 1);
@@ -2442,13 +2473,14 @@ void QStaticListViewBase::intersectingStaticSet(const QRect &area) const
continue;
QModelIndex index = modelIndex(row);
if (index.isValid())
- appendToIntersections(index);
+ ret += index;
#if 0 // for debugging
else
qWarning("intersectingStaticSet: row %d was invalid", row);
#endif
}
}
+ return ret;
}
int QStaticListViewBase::itemIndex(const QListViewItem &item) const
@@ -2769,12 +2801,15 @@ void QDynamicListViewBase::doDynamicLayout(const QListViewLayoutInfo &info)
viewport()->update();
}
-void QDynamicListViewBase::intersectingDynamicSet(const QRect &area) const
+QVector<QModelIndex> QDynamicListViewBase::intersectingDynamicSet(const QRect &area) const
{
- clearIntersections();
- QListViewPrivate *that = const_cast<QListViewPrivate*>(dd);
+ QDynamicListViewBase *that = const_cast<QDynamicListViewBase*>(this);
QBspTree::Data data(static_cast<void*>(that));
- that->dynamicListView->tree.climbTree(area, &QDynamicListViewBase::addLeaf, data);
+ QVector<QModelIndex> res;
+ that->interSectingVector = &res;
+ that->tree.climbTree(area, &QDynamicListViewBase::addLeaf, data);
+ that->interSectingVector = 0;
+ return res;
}
void QDynamicListViewBase::createItems(int to)
@@ -2851,20 +2886,20 @@ int QDynamicListViewBase::itemIndex(const QListViewItem &item) const
}
void QDynamicListViewBase::addLeaf(QVector<int> &leaf, const QRect &area,
- uint visited, QBspTree::Data data)
+ uint visited, QBspTree::Data data)
{
QListViewItem *vi;
- QListViewPrivate *_this = static_cast<QListViewPrivate *>(data.ptr);
+ QDynamicListViewBase *_this = static_cast<QDynamicListViewBase *>(data.ptr);
for (int i = 0; i < leaf.count(); ++i) {
int idx = leaf.at(i);
- if (idx < 0 || idx >= _this->dynamicListView->items.count())
+ if (idx < 0 || idx >= _this->items.count())
continue;
- vi = &_this->dynamicListView->items[idx];
+ vi = &_this->items[idx];
Q_ASSERT(vi);
if (vi->isValid() && vi->rect().intersects(area) && vi->visited != visited) {
- QModelIndex index = _this->listViewItemToIndex(*vi);
+ QModelIndex index = _this->dd->listViewItemToIndex(*vi);
Q_ASSERT(index.isValid());
- _this->intersectVector.append(index);
+ _this->interSectingVector->append(index);
vi->visited = visited;
}
}
diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h
index a7a7000..1727ba4 100644
--- a/src/gui/itemviews/qlistview_p.h
+++ b/src/gui/itemviews/qlistview_p.h
@@ -153,9 +153,6 @@ public:
inline bool isHidden(int row) const;
inline int hiddenCount() const;
- inline void clearIntersections() const;
- inline void appendToIntersections(const QModelIndex &idx) const;
-
inline bool isRightToLeft() const;
QListViewPrivate *dd;
@@ -186,7 +183,7 @@ public:
QPoint initStaticLayout(const QListViewLayoutInfo &info);
void doStaticLayout(const QListViewLayoutInfo &info);
- void intersectingStaticSet(const QRect &area) const;
+ QVector<QModelIndex> intersectingStaticSet(const QRect &area) const;
int itemIndex(const QListViewItem &item) const;
@@ -216,7 +213,7 @@ class QDynamicListViewBase : public QCommonListViewBase
friend class QListViewPrivate;
public:
QDynamicListViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d),
- batchStartRow(0), batchSavedDeltaSeg(0) {}
+ batchStartRow(0), batchSavedDeltaSeg(0), interSectingVector(0) {}
QBspTree tree;
QVector<QListViewItem> items;
@@ -230,6 +227,7 @@ public:
// used when laying out in batches
int batchStartRow;
int batchSavedDeltaSeg;
+ QVector<QModelIndex> *interSectingVector; //used from within intersectingDynamicSet
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max);
@@ -237,7 +235,7 @@ public:
void initBspTree(const QSize &contents);
QPoint initDynamicLayout(const QListViewLayoutInfo &info);
void doDynamicLayout(const QListViewLayoutInfo &info);
- void intersectingDynamicSet(const QRect &area) const;
+ QVector<QModelIndex> intersectingDynamicSet(const QRect &area) const;
static void addLeaf(QVector<int> &leaf, const QRect &area,
uint visited, QBspTree::Data data);
@@ -277,11 +275,11 @@ public:
bool doItemsLayout(int num);
- inline void intersectingSet(const QRect &area, bool doLayout = true) const {
+ inline QVector<QModelIndex> intersectingSet(const QRect &area, bool doLayout = true) const {
if (doLayout) executePostedLayout();
QRect a = (q_func()->isRightToLeft() ? flipX(area.normalized()) : area.normalized());
- if (viewMode == QListView::ListMode) staticListView->intersectingStaticSet(a);
- else dynamicListView->intersectingDynamicSet(a);
+ return (viewMode == QListView::ListMode) ? staticListView->intersectingStaticSet(a)
+ : dynamicListView->intersectingDynamicSet(a);
}
// ### FIXME:
@@ -351,6 +349,8 @@ public:
void scrollElasticBandBy(int dx, int dy);
+ QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
+
// ### FIXME: we only need one at a time
QDynamicListViewBase *dynamicListView;
QStaticListViewBase *staticListView;
@@ -383,9 +383,6 @@ public:
QRect layoutBounds;
- // used for intersecting set
- mutable QVector<QModelIndex> intersectVector;
-
// timers
QBasicTimer batchLayoutTimer;
@@ -438,9 +435,6 @@ inline QAbstractItemDelegate *QCommonListViewBase::delegate(const QModelIndex &i
inline bool QCommonListViewBase::isHidden(int row) const { return dd->isHidden(row); }
inline int QCommonListViewBase::hiddenCount() const { return dd->hiddenRows.count(); }
-inline void QCommonListViewBase::clearIntersections() const { dd->intersectVector.clear(); }
-inline void QCommonListViewBase::appendToIntersections(const QModelIndex &idx) const { dd->intersectVector.append(idx); }
-
inline bool QCommonListViewBase::isRightToLeft() const { return qq->isRightToLeft(); }
QT_END_NAMESPACE
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index 30a8c96..fdc09ca 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -146,6 +146,7 @@ public:
const QModelIndex &source_parent) const;
QModelIndex proxy_to_source(const QModelIndex &proxyIndex) const;
QModelIndex source_to_proxy(const QModelIndex &sourceIndex) const;
+ bool can_create_mapping(const QModelIndex &source_parent) const;
void remove_from_mapping(const QModelIndex &source_parent);
@@ -354,6 +355,25 @@ QModelIndex QSortFilterProxyModelPrivate::source_to_proxy(const QModelIndex &sou
return create_index(proxy_row, proxy_column, it);
}
+bool QSortFilterProxyModelPrivate::can_create_mapping(const QModelIndex &source_parent) const
+{
+ if (source_parent.isValid()) {
+ QModelIndex source_grand_parent = source_parent.parent();
+ IndexMap::const_iterator it = source_index_mapping.constFind(source_grand_parent);
+ if (it == source_index_mapping.constEnd()) {
+ // Don't care, since we don't have mapping for the grand parent
+ return false;
+ }
+ Mapping *gm = it.value();
+ if (gm->proxy_rows.at(source_parent.row()) == -1 ||
+ gm->proxy_columns.at(source_parent.column()) == -1) {
+ // Don't care, since parent is filtered
+ return false;
+ }
+ }
+ return true;
+}
+
/*!
\internal
@@ -659,20 +679,8 @@ void QSortFilterProxyModelPrivate::source_items_inserted(
return;
IndexMap::const_iterator it = source_index_mapping.constFind(source_parent);
if (it == source_index_mapping.constEnd()) {
- if (source_parent.isValid()) {
- QModelIndex source_grand_parent = source_parent.parent();
- it = source_index_mapping.constFind(source_grand_parent);
- if (it == source_index_mapping.constEnd()) {
- // Don't care, since we don't have mapping for the grand parent
- return;
- }
- Mapping *gm = it.value();
- if (gm->proxy_rows.at(source_parent.row()) == -1 ||
- gm->proxy_columns.at(source_parent.column()) == -1) {
- // Don't care, since parent is filtered
- return;
- }
- }
+ if (!can_create_mapping(source_parent))
+ return;
it = create_mapping(source_parent);
Mapping *m = it.value();
QModelIndex proxy_parent = q->mapFromSource(source_parent);
@@ -1186,7 +1194,8 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted(
Q_UNUSED(end);
//Force the creation of a mapping now, even if its empty.
//We need it because the proxy can be acessed at the moment it emits rowsAboutToBeInserted in insert_source_items
- create_mapping(source_parent);
+ if (can_create_mapping(source_parent))
+ create_mapping(source_parent);
}
void QSortFilterProxyModelPrivate::_q_sourceRowsInserted(
@@ -1217,7 +1226,8 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeInserted(
Q_UNUSED(end);
//Force the creation of a mapping now, even if its empty.
//We need it because the proxy can be acessed at the moment it emits columnsAboutToBeInserted in insert_source_items
- create_mapping(source_parent);
+ if (can_create_mapping(source_parent))
+ create_mapping(source_parent);
}
void QSortFilterProxyModelPrivate::_q_sourceColumnsInserted(
diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp
index e79dafe..df519ee 100644
--- a/src/gui/itemviews/qstyleditemdelegate.cpp
+++ b/src/gui/itemviews/qstyleditemdelegate.cpp
@@ -671,15 +671,12 @@ bool QStyledItemDelegate::eventFilter(QObject *object, QEvent *event)
if (editor->parentWidget())
editor->parentWidget()->setFocus();
return true;
- } else if (event->type() == QEvent::FocusOut || event->type() == QEvent::Hide) {
+ } else if (event->type() == QEvent::FocusOut || (event->type() == QEvent::Hide && editor->isWindow())) {
//the Hide event will take care of he editors that are in fact complete dialogs
if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) {
- QWidget *w = QApplication::focusWidget();
- while (w) { // don't worry about focus changes internally in the editor
- if (w == editor)
- return false;
- w = w->parentWidget();
- }
+ if (editor->isAncestorOf(QApplication::focusWidget()))
+ return false; // don't worry about focus changes internally in the editor
+
#ifndef QT_NO_DRAGANDDROP
// The window may lose focus during an drag operation.
// i.e when dragging involves the taskbar on Windows.
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index c676237..2009499 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -1528,6 +1528,8 @@ void QTableView::updateGeometries()
++columnsInViewport;
}
}
+ columnsInViewport = qMax(columnsInViewport, 1); //there must be always at least 1 column
+
if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) {
const int visibleColumns = columnCount - d->horizontalHeader->hiddenSectionCount();
horizontalScrollBar()->setRange(0, visibleColumns - columnsInViewport);
@@ -1554,6 +1556,8 @@ void QTableView::updateGeometries()
++rowsInViewport;
}
}
+ rowsInViewport = qMax(rowsInViewport, 1); //there must be always at least 1 row
+
if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
const int visibleRows = rowCount - d->verticalHeader->hiddenSectionCount();
verticalScrollBar()->setRange(0, visibleRows - rowsInViewport);
@@ -2036,7 +2040,7 @@ void QTableView::scrollTo(const QModelIndex &index, ScrollHint hint)
if (positionAtRight || hint == PositionAtCenter || positionAtLeft) {
int hiddenSections = 0;
if (d->horizontalHeader->sectionsHidden()) {
- for (int s = horizontalIndex; s >= 0; --s) {
+ for (int s = horizontalIndex - 1; s >= 0; --s) {
int column = d->horizontalHeader->logicalIndex(s);
if (d->horizontalHeader->isSectionHidden(column))
++hiddenSections;
@@ -2091,7 +2095,7 @@ void QTableView::scrollTo(const QModelIndex &index, ScrollHint hint)
if (hint == PositionAtBottom || hint == PositionAtCenter || hint == PositionAtTop) {
int hiddenSections = 0;
if (d->verticalHeader->sectionsHidden()) {
- for (int s = verticalIndex; s >= 0; --s) {
+ for (int s = verticalIndex - 1; s >= 0; --s) {
int row = d->verticalHeader->logicalIndex(s);
if (d->verticalHeader->isSectionHidden(row))
++hiddenSections;
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 7c319dc..7536d72 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -262,10 +262,6 @@ void QTreeView::setSelectionModel(QItemSelectionModel *selectionModel)
Q_D(QTreeView);
Q_ASSERT(selectionModel);
if (d->selectionModel) {
- if (d->allColumnsShowFocus) {
- QObject::disconnect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
- this, SLOT(_q_currentChanged(QModelIndex,QModelIndex)));
- }
// support row editing
disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
d->model, SLOT(submit()));
@@ -275,10 +271,6 @@ void QTreeView::setSelectionModel(QItemSelectionModel *selectionModel)
QAbstractItemView::setSelectionModel(selectionModel);
if (d->selectionModel) {
- if (d->allColumnsShowFocus) {
- QObject::connect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
- this, SLOT(_q_currentChanged(QModelIndex,QModelIndex)));
- }
// support row editing
connect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
d->model, SLOT(submit()));
@@ -901,15 +893,6 @@ void QTreeView::setAllColumnsShowFocus(bool enable)
Q_D(QTreeView);
if (d->allColumnsShowFocus == enable)
return;
- if (d->selectionModel) {
- if (enable) {
- QObject::connect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
- this, SLOT(_q_currentChanged(QModelIndex,QModelIndex)));
- } else {
- QObject::disconnect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
- this, SLOT(_q_currentChanged(QModelIndex,QModelIndex)));
- }
- }
d->allColumnsShowFocus = enable;
d->viewport->update();
}
@@ -1112,18 +1095,22 @@ void QTreeView::scrollTo(const QModelIndex &index, ScrollHint hint)
} else if (hint == PositionAtTop || (hint == EnsureVisible && item < top)) {
verticalScrollBar()->setValue(item);
} else { // PositionAtBottom or PositionAtCenter
- int itemLocation = item;
+ const int currentItemHeight = d->itemHeight(item);
int y = (hint == PositionAtCenter
- ? area.height() / 2
+ //we center on the current item with a preference to the top item (ie. -1)
+ ? area.height() / 2 + currentItemHeight - 1
+ //otherwise we simply take the whole space
: area.height());
- while (y > 0 && item > 0)
- y -= d->itemHeight(item--);
- // end up half over the top of the area
- if (y < 0 && item < itemLocation)
- ++item;
- // end up half over the bottom of the area
- if (item >= 0 && item < itemLocation)
- ++item;
+ if (y > currentItemHeight) {
+ while (item >= 0) {
+ y -= d->itemHeight(item);
+ if (y < 0) { //there is no more space left
+ item++;
+ break;
+ }
+ item--;
+ }
+ }
verticalScrollBar()->setValue(item);
}
} else { // ScrollPerPixel
@@ -1267,10 +1254,13 @@ void QTreeView::paintEvent(QPaintEvent *event)
Q_D(QTreeView);
d->executePostedLayout();
QPainter painter(viewport());
+#ifndef QT_NO_ANIMATION
if (d->isAnimating()) {
- drawTree(&painter, event->region() - d->animationRect());
+ drawTree(&painter, event->region() - d->animatedOperation.rect());
d->drawAnimatedOperation(&painter);
- } else {
+ } else
+#endif //QT_NO_ANIMATION
+ {
drawTree(&painter, event->region());
#ifndef QT_NO_DRAGANDDROP
d->paintDropIndicator(&painter);
@@ -1306,13 +1296,13 @@ bool QTreeViewPrivate::expandOrCollapseItemAtPos(const QPoint &pos)
{
Q_Q(QTreeView);
// we want to handle mousePress in EditingState (persistent editors)
- if ((q->state() != QAbstractItemView::NoState
- && q->state() != QAbstractItemView::EditingState)
+ if ((state != QAbstractItemView::NoState
+ && state != QAbstractItemView::EditingState)
|| !viewport->rect().contains(pos))
return true;
int i = itemDecorationAt(pos);
- if ((i != -1) && q->itemsExpandable() && hasVisibleChildren(viewItems.at(i).index)) {
+ if ((i != -1) && itemsExpandable && hasVisibleChildren(viewItems.at(i).index)) {
if (viewItems.at(i).expanded)
collapse(i, true);
else
@@ -1335,6 +1325,50 @@ void QTreeViewPrivate::_q_modelDestroyed()
}
/*!
+ \reimp
+
+ We have a QTreeView way of knowing what elements are on the viewport
+*/
+QItemViewPaintPairs QTreeViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const
+{
+ Q_ASSERT(r);
+ return QAbstractItemViewPrivate::draggablePaintPairs(indexes, r);
+ Q_Q(const QTreeView);
+ QRect &rect = *r;
+ const QRect viewportRect = viewport->rect();
+ int itemOffset = 0;
+ int row = firstVisibleItem(&itemOffset);
+ QPair<int, int> startEnd = startAndEndColumns(viewportRect);
+ QVector<int> columns;
+ for (int i = startEnd.first; i <= startEnd.second; ++i) {
+ int logical = header->logicalIndex(i);
+ if (!header->isSectionHidden(logical))
+ columns += logical;
+ }
+ QSet<QModelIndex> visibleIndexes;
+ for (; itemOffset < viewportRect.bottom() && row < viewItems.count(); ++row) {
+ const QModelIndex &index = viewItems.at(row).index;
+ for (int colIndex = 0; colIndex < columns.count(); ++colIndex)
+ visibleIndexes += index.sibling(index.row(), columns.at(colIndex));
+ itemOffset += itemHeight(row);
+ }
+
+ //now that we have the visible indexes, we can try to find those which are selected
+ QItemViewPaintPairs ret;
+ for (int i = 0; i < indexes.count(); ++i) {
+ const QModelIndex &index = indexes.at(i);
+ if (visibleIndexes.contains(index)) {
+ const QRect current = q->visualRect(index);
+ ret += qMakePair(current, index);
+ rect |= current;
+ }
+ }
+ rect &= viewportRect;
+ return ret;
+}
+
+
+/*!
\since 4.2
Draws the part of the tree intersecting the given \a region using the specified
\a painter.
@@ -2819,7 +2853,7 @@ int QTreeView::rowHeight(const QModelIndex &index) const
}
/*!
- \reimp
+ \internal
*/
void QTreeView::horizontalScrollbarAction(int action)
{
@@ -2851,10 +2885,9 @@ void QTreeViewPrivate::initialize()
header->setStretchLastSection(true);
header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter);
q->setHeader(header);
-
- // animation
- QObject::connect(&timeline, SIGNAL(frameChanged(int)), q, SLOT(_q_animate()));
- QObject::connect(&timeline, SIGNAL(finished()), q, SLOT(_q_endAnimatedOperation()), Qt::QueuedConnection);
+#ifndef QT_NO_ANIMATION
+ QObject::connect(&animatedOperation, SIGNAL(finished()), q, SLOT(_q_endAnimatedOperation()));
+#endif //QT_NO_ANIMATION
}
void QTreeViewPrivate::expand(int item, bool emitSignal)
@@ -2864,10 +2897,11 @@ void QTreeViewPrivate::expand(int item, bool emitSignal)
if (item == -1 || viewItems.at(item).expanded)
return;
+#ifndef QT_NO_ANIMATION
if (emitSignal && animationsEnabled)
- prepareAnimatedOperation(item, AnimatedOperation::Expand);
-
- QAbstractItemView::State oldState = q->state();
+ prepareAnimatedOperation(item, QVariantAnimation::Forward);
+#endif //QT_NO_ANIMATION
+ QAbstractItemView::State oldState = state;
q->setState(QAbstractItemView::ExpandingState);
const QModelIndex index = viewItems.at(item).index;
storeExpanded(index);
@@ -2877,8 +2911,10 @@ void QTreeViewPrivate::expand(int item, bool emitSignal)
if (emitSignal) {
emit q->expanded(index);
+#ifndef QT_NO_ANIMATION
if (animationsEnabled)
beginAnimatedOperation();
+#endif //QT_NO_ANIMATION
}
if (model->canFetchMore(index))
model->fetchMore(index);
@@ -2902,10 +2938,12 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal)
if (it == expandedIndexes.end() || viewItems.at(item).expanded == false)
return; // nothing to do
+#ifndef QT_NO_ANIMATION
if (emitSignal && animationsEnabled)
- prepareAnimatedOperation(item, AnimatedOperation::Collapse);
+ prepareAnimatedOperation(item, QVariantAnimation::Backward);
+#endif //QT_NO_ANIMATION
- QAbstractItemView::State oldState = q->state();
+ QAbstractItemView::State oldState = state;
q->setState(QAbstractItemView::CollapsingState);
expandedIndexes.erase(it);
viewItems[item].expanded = false;
@@ -2922,29 +2960,33 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal)
if (emitSignal) {
emit q->collapsed(modelIndex);
+#ifndef QT_NO_ANIMATION
if (animationsEnabled)
beginAnimatedOperation();
+#endif //QT_NO_ANIMATION
}
}
-void QTreeViewPrivate::prepareAnimatedOperation(int item, AnimatedOperation::Type type)
+#ifndef QT_NO_ANIMATION
+void QTreeViewPrivate::prepareAnimatedOperation(int item, QVariantAnimation::Direction direction)
{
animatedOperation.item = item;
- animatedOperation.type = type;
+ animatedOperation.viewport = viewport;
+ animatedOperation.setDirection(direction);
int top = coordinateForItem(item) + itemHeight(item);
QRect rect = viewport->rect();
rect.setTop(top);
- if (type == AnimatedOperation::Collapse) {
+ if (direction == QVariantAnimation::Backward) {
const int limit = rect.height() * 2;
int h = 0;
int c = item + viewItems.at(item).total + 1;
for (int i = item + 1; i < c && h < limit; ++i)
h += itemHeight(i);
rect.setHeight(h);
- animatedOperation.duration = h;
+ animatedOperation.setEndValue(top + h);
}
- animatedOperation.top = top;
+ animatedOperation.setStartValue(top);
animatedOperation.before = renderTreeToPixmapForAnimation(rect);
}
@@ -2953,50 +2995,29 @@ void QTreeViewPrivate::beginAnimatedOperation()
Q_Q(QTreeView);
QRect rect = viewport->rect();
- rect.setTop(animatedOperation.top);
- if (animatedOperation.type == AnimatedOperation::Expand) {
+ rect.setTop(animatedOperation.top());
+ if (animatedOperation.direction() == QVariantAnimation::Forward) {
const int limit = rect.height() * 2;
int h = 0;
int c = animatedOperation.item + viewItems.at(animatedOperation.item).total + 1;
for (int i = animatedOperation.item + 1; i < c && h < limit; ++i)
h += itemHeight(i);
rect.setHeight(h);
- animatedOperation.duration = h;
+ animatedOperation.setEndValue(animatedOperation.top() + h);
}
animatedOperation.after = renderTreeToPixmapForAnimation(rect);
q->setState(QAbstractItemView::AnimatingState);
-
- timeline.stop();
- timeline.setDuration(250);
- timeline.setFrameRange(animatedOperation.top, animatedOperation.top + animatedOperation.duration);
- timeline.start();
-}
-
-void QTreeViewPrivate::_q_endAnimatedOperation()
-{
- Q_Q(QTreeView);
- animatedOperation.before = QPixmap();
- animatedOperation.after = QPixmap();
- q->setState(QAbstractItemView::NoState);
- q->updateGeometries();
- viewport->update();
-}
-
-void QTreeViewPrivate::_q_animate()
-{
- QRect rect = viewport->rect();
- rect.moveTop(animatedOperation.top);
- viewport->repaint(rect);
+ animatedOperation.start(); //let's start the animation
}
void QTreeViewPrivate::drawAnimatedOperation(QPainter *painter) const
{
- int start = timeline.startFrame();
- int end = timeline.endFrame();
- bool collapsing = animatedOperation.type == AnimatedOperation::Collapse;
- int current = collapsing ? end - timeline.currentFrame() + start : timeline.currentFrame();
+ const int start = animatedOperation.startValue().toInt(),
+ end = animatedOperation.endValue().toInt(),
+ current = animatedOperation.currentValue().toInt();
+ bool collapsing = animatedOperation.direction() == QVariantAnimation::Backward;
const QPixmap top = collapsing ? animatedOperation.before : animatedOperation.after;
painter->drawPixmap(0, start, top, 0, end - current - 1, top.width(), top.height());
const QPixmap bottom = collapsing ? animatedOperation.after : animatedOperation.before;
@@ -3039,26 +3060,14 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons
return pixmap;
}
-void QTreeViewPrivate::_q_currentChanged(const QModelIndex &current, const QModelIndex &previous)
+void QTreeViewPrivate::_q_endAnimatedOperation()
{
Q_Q(QTreeView);
- if (previous.isValid()) {
- QRect previousRect = q->visualRect(previous);
- if (allColumnsShowFocus) {
- previousRect.setX(0);
- previousRect.setWidth(viewport->width());
- }
- viewport->update(previousRect);
- }
- if (current.isValid()) {
- QRect currentRect = q->visualRect(current);
- if (allColumnsShowFocus) {
- currentRect.setX(0);
- currentRect.setWidth(viewport->width());
- }
- viewport->update(currentRect);
- }
+ q->setState(QAbstractItemView::NoState);
+ q->updateGeometries();
+ viewport->update();
}
+#endif //QT_NO_ANIMATION
void QTreeViewPrivate::_q_modelAboutToBeReset()
{
@@ -3787,6 +3796,21 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
}
#endif
QAbstractItemView::currentChanged(current, previous);
+
+ if (allColumnsShowFocus()) {
+ if (previous.isValid()) {
+ QRect previousRect = visualRect(previous);
+ previousRect.setX(0);
+ previousRect.setWidth(viewport()->width());
+ viewport()->update(previousRect);
+ }
+ if (current.isValid()) {
+ QRect currentRect = visualRect(current);
+ currentRect.setX(0);
+ currentRect.setWidth(viewport()->width());
+ viewport()->update(currentRect);
+ }
+ }
}
/*!
diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h
index 35a205c..4411781 100644
--- a/src/gui/itemviews/qtreeview.h
+++ b/src/gui/itemviews/qtreeview.h
@@ -144,19 +144,20 @@ public:
void sortByColumn(int column, Qt::SortOrder order);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void selectAll();
+
Q_SIGNALS:
void expanded(const QModelIndex &index);
void collapsed(const QModelIndex &index);
public Q_SLOTS:
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void hideColumn(int column);
void showColumn(int column);
void expand(const QModelIndex &index);
void collapse(const QModelIndex &index);
void resizeColumnToContents(int column);
void sortByColumn(int column);
- void selectAll();
void expandAll();
void collapseAll();
void expandToDepth(int depth);
@@ -222,14 +223,11 @@ private:
Q_DECLARE_PRIVATE(QTreeView)
Q_DISABLE_COPY(QTreeView)
+#ifndef QT_NO_ANIMATION
Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation())
- Q_PRIVATE_SLOT(d_func(), void _q_animate())
- Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QModelIndex&, const QModelIndex &))
- Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int))
- Q_PRIVATE_SLOT(d_func(), void _q_columnsRemoved(const QModelIndex &, int, int))
+#endif //QT_NO_ANIMATION
Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset())
Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order))
- Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
};
#endif // QT_NO_TREEVIEW
diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h
index 6a1dfe5..546dc75 100644
--- a/src/gui/itemviews/qtreeview_p.h
+++ b/src/gui/itemviews/qtreeview_p.h
@@ -54,6 +54,7 @@
//
#include "private/qabstractitemview_p.h"
+#include <QtCore/qvariantanimation.h>
#ifndef QT_NO_TREEVIEW
@@ -81,42 +82,41 @@ public:
uniformRowHeights(false), rootDecoration(true),
itemsExpandable(true), sortingEnabled(false),
expandsOnDoubleClick(true),
- allColumnsShowFocus(false),
+ allColumnsShowFocus(false), current(0),
animationsEnabled(false), columnResizeTimerID(0),
autoExpandDelay(-1), hoverBranch(-1), geometryRecursionBlock(false) {}
~QTreeViewPrivate() {}
void initialize();
- struct AnimatedOperation
+ QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
+
+#ifndef QT_NO_ANIMATION
+ struct AnimatedOperation : public QVariantAnimation
{
- enum Type { Expand, Collapse };
int item;
- int top;
- int duration;
- Type type;
QPixmap before;
QPixmap after;
- };
-
- void expand(int item, bool emitSignal);
- void collapse(int item, bool emitSignal);
-
- void prepareAnimatedOperation(int item, AnimatedOperation::Type type);
+ QWidget *viewport;
+ AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); }
+ int top() const { return startValue().toInt(); }
+ QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; }
+ void updateCurrentValue(const QVariant &) { viewport->update(rect()); }
+ void updateState(State, State state) { if (state == Stopped) before = after = QPixmap(); }
+ } animatedOperation;
+ void prepareAnimatedOperation(int item, QVariantAnimation::Direction d);
void beginAnimatedOperation();
- void _q_endAnimatedOperation();
void drawAnimatedOperation(QPainter *painter) const;
QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const;
+ void _q_endAnimatedOperation();
+#endif //QT_NO_ANIMATION
- inline QRect animationRect() const
- { return QRect(0, animatedOperation.top, viewport->width(),
- viewport->height() - animatedOperation.top); }
+ void expand(int item, bool emitSignal);
+ void collapse(int item, bool emitSignal);
- void _q_currentChanged(const QModelIndex&, const QModelIndex&);
void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int);
void _q_columnsRemoved(const QModelIndex &, int, int);
void _q_modelAboutToBeReset();
- void _q_animate();
void _q_sortIndicatorChanged(int column, Qt::SortOrder order);
void _q_modelDestroyed();
@@ -177,8 +177,6 @@ public:
// used when expanding and collapsing items
QSet<QPersistentModelIndex> expandedIndexes;
- QStack<bool> expandParent;
- AnimatedOperation animatedOperation;
bool animationsEnabled;
inline bool storeExpanded(const QPersistentModelIndex &idx) {
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index a8d09b0..530b146 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -44,12 +44,8 @@ HEADERS += \
kernel/qkeymapper_p.h \
kernel/qgesture.h \
kernel/qgesture_p.h \
- kernel/qgesturemanager_p.h \
- kernel/qgesturerecognizer_p.h \
- kernel/qgesturerecognizer.h \
- kernel/qgesturestandardrecognizers_p.h \
- kernel/qdirectionrecognizer_p.h \
- kernel/qdirectionsimplificator_p.h
+ kernel/qstandardgestures.h \
+ kernel/qstandardgestures_p.h
SOURCES += \
kernel/qaction.cpp \
@@ -80,10 +76,7 @@ SOURCES += \
kernel/qwidgetaction.cpp \
kernel/qkeymapper.cpp \
kernel/qgesture.cpp \
- kernel/qgesturemanager.cpp \
- kernel/qgesturerecognizer.cpp \
- kernel/qgesturestandardrecognizers.cpp \
- kernel/qdirectionrecognizer.cpp
+ kernel/qstandardgestures.cpp
win32 {
DEFINES += QT_NO_DIRECTDRAW
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index fe40ea8..afe6269 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -82,7 +82,7 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::OptionsSoftKey),
- iconVisibleInMenu(-1)
+ priority(QAction::NormalPriority), iconVisibleInMenu(-1)
{
#ifdef QT3_SUPPORT
static int qt_static_action_id = -1;
@@ -910,6 +910,52 @@ QString QAction::whatsThis() const
return d->whatsthis;
}
+/*!
+ \enum QAction::Priority
+ \since 4.6
+
+ This enum defines priorities for actions in user interface.
+
+ \value LowPriority The action should not be prioritized in
+ the user interface.
+
+ \value NormalPriority
+
+ \value HighPriority The action should be prioritized in
+ the user interface.
+
+ \sa priority
+*/
+
+
+/*!
+ \property QAction::priority
+ \since 4.6
+
+ \brief the actions's priority in the user interface.
+
+ This property can be set to indicate how the action should be prioritized
+ in the user interface.
+
+ For instance, when toolbars have the Qt::ToolButtonTextBesideIcon
+ mode set, then actions with LowPriority will not show the text
+ labels.
+*/
+void QAction::setPriority(Priority priority)
+{
+ Q_D(QAction);
+ if (d->priority == priority)
+ return;
+
+ d->priority = priority;
+ d->sendDataChanged();
+}
+
+QAction::Priority QAction::priority() const
+{
+ Q_D(const QAction);
+ return d->priority;
+}
/*!
\property QAction::checkable
diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h
index b9bdcf1..3fd80b9 100644
--- a/src/gui/kernel/qaction.h
+++ b/src/gui/kernel/qaction.h
@@ -68,6 +68,7 @@ class Q_GUI_EXPORT QAction : public QObject
Q_ENUMS(MenuRole)
Q_ENUMS(SoftKeyRole)
+ Q_ENUMS(Priority)
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
@@ -87,6 +88,7 @@ class Q_GUI_EXPORT QAction : public QObject
Q_PROPERTY(MenuRole menuRole READ menuRole WRITE setMenuRole)
Q_PROPERTY(SoftKeyRole softKeyRole READ softKeyRole WRITE setSoftKeyRole)
Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu)
+ Q_PROPERTY(Priority priority READ priority WRITE setPriority)
public:
enum MenuRole { NoRole, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
@@ -95,6 +97,9 @@ public:
OkSoftKey, CancelSoftKey, EditSoftKey, ViewSoftKey, BackSpaceSoftKey,
EndEditSoftKey, RevertEditSoftKey, DeselectSoftKey, FinishSoftKey,
MenuSoftKey, ContextMenuSoftKey, ExitSoftKey };
+ enum Priority { LowPriority = 0,
+ NormalPriority = 128,
+ HighPriority = 256};
explicit QAction(QObject* parent);
QAction(const QString &text, QObject* parent);
QAction(const QIcon &icon, const QString &text, QObject* parent);
@@ -129,6 +134,9 @@ public:
void setWhatsThis(const QString &what);
QString whatsThis() const;
+ void setPriority(Priority priority);
+ Priority priority() const;
+
#ifndef QT_NO_MENU
QMenu *menu() const;
void setMenu(QMenu *menu);
diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h
index 516b89c..4e3651e 100644
--- a/src/gui/kernel/qaction_p.h
+++ b/src/gui/kernel/qaction_p.h
@@ -103,6 +103,7 @@ public:
uint fontSet : 1;
QAction::MenuRole menuRole;
QAction::SoftKeyRole softKeyRole;
+ QAction::Priority priority;
int iconVisibleInMenu : 3; // Only has values -1, 0, and 1
QList<QWidget *> widgets;
#ifndef QT_NO_GRAPHICSVIEW
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 2f1ab0e..700af43 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -93,8 +93,6 @@
#include "qapplication.h"
-#include <private/qgesturemanager_p.h>
-
#ifdef Q_WS_WINCE
#include "qdatetime.h"
#include "qguifunctions_wince.h"
@@ -131,7 +129,7 @@ int QApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly
QApplication::Type qt_appType=QApplication::Tty;
QApplicationPrivate *QApplicationPrivate::self = 0;
-QInputContext *QApplicationPrivate::inputContext;
+QInputContext *QApplicationPrivate::inputContext = 0;
bool QApplicationPrivate::quitOnLastWindowClosed = true;
@@ -142,14 +140,6 @@ bool QApplicationPrivate::autoSipEnabled = false;
bool QApplicationPrivate::autoSipEnabled = true;
#endif
-QGestureManager* QGestureManager::instance()
-{
- QApplicationPrivate *d = qApp->d_func();
- if (!d->gestureManager)
- d->gestureManager = new QGestureManager(qApp);
- return d->gestureManager;
-}
-
QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type)
: QCoreApplicationPrivate(argc, argv)
{
@@ -173,8 +163,6 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T
directPainters = 0;
#endif
- gestureManager = 0;
-
if (!self)
self = this;
}
@@ -846,6 +834,12 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv,
#endif // Q_WS_X11
extern void qInitDrawhelperAsm();
+extern int qRegisterGuiVariant();
+extern int qUnregisterGuiVariant();
+#ifndef QT_NO_STATEMACHINE
+extern int qRegisterGuiStateMachine();
+extern int qUnregisterGuiStateMachine();
+#endif
/*!
\fn void QApplicationPrivate::initialize()
@@ -859,11 +853,9 @@ void QApplicationPrivate::initialize()
if (qt_appType != QApplication::Tty)
(void) QApplication::style(); // trigger creation of application style
// trigger registering of QVariant's GUI types
- extern int qRegisterGuiVariant();
qRegisterGuiVariant();
#ifndef QT_NO_STATEMACHINE
// trigger registering of QStateMachine's GUI types
- extern int qRegisterGuiStateMachine();
qRegisterGuiStateMachine();
#endif
@@ -878,12 +870,6 @@ void QApplicationPrivate::initialize()
if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0)
q->setAttribute(Qt::AA_NativeWindows);
-#if defined(Q_WS_WIN)
- // Alien is not currently working on Windows 98
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)
- q->setAttribute(Qt::AA_NativeWindows);
-#endif
-
#ifdef Q_WS_WINCE
#ifdef QT_AUTO_MAXIMIZE_THRESHOLD
autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD;
@@ -1095,11 +1081,9 @@ QApplication::~QApplication()
#ifndef QT_NO_STATEMACHINE
// trigger unregistering of QStateMachine's GUI types
- extern int qUnregisterGuiStateMachine();
qUnregisterGuiStateMachine();
#endif
// trigger unregistering of QVariant's GUI types
- extern int qUnregisterGuiVariant();
qUnregisterGuiVariant();
}
@@ -3669,14 +3653,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
#endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT
}
- if (!d->grabbedGestures.isEmpty() && e->spontaneous() && receiver->isWidgetType()) {
- const QEvent::Type t = e->type();
- if (t != QEvent::Gesture && t != QEvent::GraphicsSceneGesture) {
- if (QGestureManager::instance()->filterEvent(static_cast<QWidget*>(receiver), e))
- return true;
- }
- }
-
// User input and window activation makes tooltips sleep
switch (e->type()) {
case QEvent::Wheel:
@@ -4164,6 +4140,19 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
res = d->notify_helper(receiver, e);
break;
+ case QEvent::WinGesture:
+ {
+ // only propagate the first gesture event (after the GID_BEGIN)
+ QWidget *w = static_cast<QWidget *>(receiver);
+ while (w) {
+ e->ignore();
+ res = d->notify_helper(w, e);
+ if ((res && e->isAccepted()) || w->isWindow())
+ break;
+ w = w->parentWidget();
+ }
+ break;
+ }
default:
res = d->notify_helper(receiver, e);
break;
@@ -4511,13 +4500,13 @@ HRESULT qt_CoCreateGuid(GUID* guid)
{
// We will use the following information to create the GUID
// 1. absolute path to application
- wchar_t tempFilename[512];
- if (!GetModuleFileNameW(0, tempFilename, 512))
+ wchar_t tempFilename[MAX_PATH];
+ if (!GetModuleFileName(0, tempFilename, MAX_PATH))
return S_FALSE;
- unsigned int hash = qHash(QString::fromUtf16((const unsigned short *) tempFilename));
+ unsigned int hash = qHash(QString::fromWCharArray(tempFilename));
guid->Data1 = hash;
// 2. creation time of file
- QFileInfo info(QString::fromUtf16((const unsigned short *) tempFilename));
+ QFileInfo info(QString::fromWCharArray(tempFilename));
guid->Data2 = qHash(info.created().toTime_t());
// 3. current system time
guid->Data3 = qHash(QDateTime::currentDateTime().toTime_t());
@@ -4551,10 +4540,10 @@ QSessionManager::QSessionManager(QApplication * app, QString &id, QString &key)
GUID guid;
CoCreateGuid(&guid);
StringFromGUID2(guid, guidstr, 40);
- id = QString::fromUtf16((ushort*)guidstr);
+ id = QString::fromWCharArray(guidstr);
CoCreateGuid(&guid);
StringFromGUID2(guid, guidstr, 40);
- key = QString::fromUtf16((ushort*)guidstr);
+ key = QString::fromWCharArray(guidstr);
#endif
d->sessionId = id;
d->sessionKey = key;
@@ -5166,57 +5155,6 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy)
return true;
}
-/*!
- \since 4.6
-
- Adds custom gesture \a recognizer object.
-
- Qt takes ownership of the provided \a recognizer.
-
- \sa Qt::AA_EnableGestures, QGestureEvent
-*/
-void QApplication::addGestureRecognizer(QGestureRecognizer *recognizer)
-{
- QGestureManager::instance()->addRecognizer(recognizer);
-}
-
-/*!
- \since 4.6
-
- Removes custom gesture \a recognizer object.
-
- \sa Qt::AA_EnableGestures, QGestureEvent
-*/
-void QApplication::removeGestureRecognizer(QGestureRecognizer *recognizer)
-{
- Q_D(QApplication);
- if (!d->gestureManager)
- return;
- d->gestureManager->removeRecognizer(recognizer);
-}
-
-/*!
- \property QApplication::eventDeliveryDelayForGestures
- \since 4.6
-
- Specifies the \a delay before input events are delivered to the
- gesture enabled widgets.
-
- The delay allows to postpone widget's input event handling until
- gestures framework can successfully recognize a gesture.
-
- \sa QWidget::grabGesture
-*/
-void QApplication::setEventDeliveryDelayForGestures(int delay)
-{
- QGestureManager::instance()->setEventDeliveryDelay(delay);
-}
-
-int QApplication::eventDeliveryDelayForGestures()
-{
- return QGestureManager::instance()->eventDeliveryDelay();
-}
-
/*! \fn QDecoration &QApplication::qwsDecoration()
Return the QWSDecoration used for decorating windows.
@@ -5400,8 +5338,6 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
const QList<QTouchEvent::TouchPoint> &touchPoints)
{
QApplicationPrivate *d = self;
- QApplication *q = self->q_func();
-
typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints;
QHash<QWidget *, StatesAndTouchPoints> widgetsNeedingEvents;
@@ -5423,7 +5359,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
if (!widget) {
// determine which widget this event will go to
if (!window)
- window = q->topLevelAt(touchPoint.screenPos().toPoint());
+ window = QApplication::topLevelAt(touchPoint.screenPos().toPoint());
if (!window)
continue;
widget = window->childAt(window->mapFromGlobal(touchPoint.screenPos().toPoint()));
@@ -5523,7 +5459,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
QTouchEvent touchEvent(eventType,
deviceType,
- q->keyboardModifiers(),
+ QApplication::keyboardModifiers(),
it.value().first,
it.value().second);
updateTouchPointsForWidget(widget, &touchEvent);
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 4b447b5..fcb3a7c 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -75,7 +75,6 @@ class QStyle;
class QEventLoop;
class QIcon;
class QInputContext;
-class QGestureRecognizer;
template <typename T> class QList;
class QLocale;
#if defined(Q_WS_QWS)
@@ -114,7 +113,6 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication
Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold)
#endif
Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled)
- Q_PROPERTY(int eventDeliveryDelayForGestures READ eventDeliveryDelayForGestures WRITE setEventDeliveryDelayForGestures)
public:
enum Type { Tty, GuiClient, GuiServer };
@@ -280,12 +278,6 @@ public:
static bool keypadNavigationEnabled();
#endif
- void addGestureRecognizer(QGestureRecognizer *recognizer);
- void removeGestureRecognizer(QGestureRecognizer *recognizer);
-
- void setEventDeliveryDelayForGestures(int delay);
- int eventDeliveryDelayForGestures();
-
Q_SIGNALS:
void lastWindowClosed();
void focusChanged(QWidget *old, QWidget *now);
@@ -396,7 +388,6 @@ private:
friend class QDirectPainter;
friend class QDirectPainterPrivate;
#endif
- friend class QGestureManager;
#if defined(Q_WS_WIN)
friend QApplicationPrivate* getQApplicationPrivateInternal();
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index b1aa75f..beccfb0 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1069,7 +1069,7 @@ void qt_init(QApplicationPrivate *priv, int)
if (GetCurrentProcess(&psn) == noErr) {
// Jambi needs to transform itself since most people aren't "used"
// to putting things in bundles, but other people may actually not
- // want to tranform the process (running as a helper or somethng)
+ // want to tranform the process (running as a helper or something)
// so don't do that for them. This means checking both LSUIElement
// and LSBackgroundOnly. If you set them both... well, you
// shouldn't do that.
@@ -1377,29 +1377,6 @@ QWidget *QApplication::topLevelAt(const QPoint &p)
#endif
}
-static QWidget *qt_mac_recursive_widgetAt(QWidget *widget, int x, int y)
-{
- if (!widget)
- return 0;
- const QObjectList kids = widget->children();
- for(int i = kids.size()-1; i >= 0; --i) {
- if ( QWidget *kid = qobject_cast<QWidget*>(kids.at(i)) ) {
- if (kid->isVisible() && !kid->isTopLevel() &&
- !kid->testAttribute(Qt::WA_TransparentForMouseEvents)) {
- const int wx=kid->x(), wy=kid->y(),
- wx2=wx+kid->width(), wy2=wy+kid->height();
- if (x >= wx && y >= wy && x < wx2 && y < wy2) {
- const QRegion mask = kid->mask();
- if (!mask.isEmpty() && !mask.contains(QPoint(x-wx, y-wy)))
- continue;
- return qt_mac_recursive_widgetAt(kid, x-wx, y-wy);
- }
- }
- }
- }
- return widget;
-}
-
/*****************************************************************************
Main event loop
*****************************************************************************/
@@ -1770,7 +1747,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
if(window) {
HIViewRef hiview;
if(HIViewGetViewForMouseEvent(HIViewGetRoot(window), event, &hiview) == noErr) {
- widget = QWidget::find((WId)hiview);;
+ widget = QWidget::find((WId)hiview);
if (widget) {
// Make sure we didn't pass over a widget with a "fake hole" in it.
QWidget *otherWidget = QApplication::widgetAt(where.h, where.v);
@@ -1887,9 +1864,10 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
tablet_button_state = new_tablet_button_state;
QMacTabletHash *tabletHash = qt_mac_tablet_hash();
- if (!tabletHash->contains(tabletPointRec.deviceID)) {
- qWarning("QCocoaView handleTabletEvent: This tablet device is unknown"
- " (received no proximity event for it). Discarding event.");
+ if (!tabletHash->contains(tabletPointRec.deviceID) && t != QEvent::TabletRelease) {
+ // Never discard TabletRelease events as they may be delivered *after* TabletLeaveProximity events
+ qWarning("handleTabletEvent: This tablet device is unknown"
+ " (received no proximity event for it). Discarding event.");
return false;
}
QTabletDeviceData &deviceData = tabletHash->operator[](tabletPointRec.deviceID);
@@ -1931,8 +1909,13 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
tp, rotation, z, modifiers, deviceData.tabletUniqueID);
QApplication::sendSpontaneousEvent(widget, &e);
if (e.isAccepted()) {
+ if (t == QEvent::TabletPress) {
+ qt_button_down = widget;
+ } else if (t == QEvent::TabletRelease) {
+ qt_button_down = 0;
+ }
#if defined(DEBUG_MOUSE_MAPS)
- qDebug("Bail out early due to table acceptance");
+ qDebug("Bail out early due to tablet acceptance");
#endif
break;
}
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index e9e8d45..0cd93b9 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -159,17 +159,19 @@ inline QPointF QTabletDeviceData::scaleCoord(int coordX, int coordY,
int outOriginY, int outExtentY) const
{
QPointF ret;
+
if (sign(outExtentX) == sign(maxX))
- ret.setX(((coordX - minX) * qAbs(outExtentX) / qAbs(qreal(maxX))) + outOriginX);
+ ret.setX(((coordX - minX) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) + outOriginX);
else
- ret.setX(((qAbs(maxX) - (coordX - minX)) * qAbs(outExtentX) / qAbs(qreal(maxX)))
+ ret.setX(((qAbs(maxX) - (coordX - minX)) * qAbs(outExtentX) / qAbs(qreal(maxX - minX)))
+ outOriginX);
if (sign(outExtentY) == sign(maxY))
- ret.setY(((coordY - minY) * qAbs(outExtentY) / qAbs(qreal(maxY))) + outOriginY);
+ ret.setY(((coordY - minY) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) + outOriginY);
else
- ret.setY(((qAbs(maxY) - (coordY - minY)) * qAbs(outExtentY) / qAbs(qreal(maxY)))
+ ret.setY(((qAbs(maxY) - (coordY - minY)) * qAbs(outExtentY) / qAbs(qreal(maxY - minY)))
+ outOriginY);
+
return ret;
}
#endif
@@ -191,10 +193,68 @@ extern "C" {
#endif
#if defined(Q_WS_WIN)
-typedef BOOL (WINAPI *qt_RegisterTouchWindowPtr)(HWND, ULONG);
-typedef BOOL (WINAPI *qt_GetTouchInputInfoPtr)(HANDLE, UINT, PVOID, int);
-typedef BOOL (WINAPI *qt_CloseTouchInputHandlePtr)(HANDLE);
-#endif
+typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG);
+typedef BOOL (WINAPI *PtrGetTouchInputInfo)(HANDLE, UINT, PVOID, int);
+typedef BOOL (WINAPI *PtrCloseTouchInputHandle)(HANDLE);
+
+typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE, PVOID);
+typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE, UINT, PBYTE);
+typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE);
+typedef BOOL (WINAPI *PtrSetGestureConfig)(HWND, DWORD, UINT, PVOID, UINT);
+typedef BOOL (WINAPI *PtrGetGestureConfig)(HWND, DWORD, DWORD, PUINT, PVOID, UINT);
+
+typedef BOOL (WINAPI *PtrBeginPanningFeedback)(HWND);
+typedef BOOL (WINAPI *PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL);
+typedef BOOL (WINAPI *PtrEndPanningFeedback)(HWND, BOOL);
+
+#ifndef WM_GESTURE
+# define WM_GESTURE 0x0119
+
+# define GID_BEGIN 1
+# define GID_END 2
+# define GID_ZOOM 3
+# define GID_PAN 4
+# define GID_ROTATE 5
+# define GID_TWOFINGERTAP 6
+# define GID_ROLLOVER 7
+
+typedef struct tagGESTUREINFO
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ DWORD dwID;
+ HWND hwndTarget;
+ POINTS ptsLocation;
+ DWORD dwInstanceID;
+ DWORD dwSequenceID;
+ ULONGLONG ullArguments;
+ UINT cbExtraArgs;
+} GESTUREINFO;
+
+# define GC_PAN 0x00000001
+# define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002
+# define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004
+
+typedef struct tagGESTURECONFIG
+{
+ DWORD dwID;
+ DWORD dwWant;
+ DWORD dwBlock;
+} GESTURECONFIG;
+
+#endif // WM_GESTURE
+
+#endif // Q_WS_WIN
+
+class QPanGesture;
+class QPinchGesture;
+struct StandardGestures
+{
+ QPanGesture *pan;
+ QPinchGesture *pinch;
+ StandardGestures() : pan(0), pinch(0) { }
+};
+
class QScopedLoopLevelCounter
{
@@ -445,10 +505,6 @@ public:
void sendSyntheticEnterLeave(QWidget *widget);
#endif
- QGestureManager *gestureManager;
- // map<gesture name -> number of widget subscribed to it>
- QMap<QString, int> grabbedGestures;
-
QMap<int, QWidget *> widgetForTouchPointId;
QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent);
@@ -464,13 +520,26 @@ public:
const QList<QTouchEvent::TouchPoint> &touchPoints);
#if defined(Q_WS_WIN)
- static qt_RegisterTouchWindowPtr RegisterTouchWindow;
- static qt_GetTouchInputInfoPtr GetTouchInputInfo;
- static qt_CloseTouchInputHandlePtr CloseTouchInputHandle;
+ static PtrRegisterTouchWindow RegisterTouchWindow;
+ static PtrGetTouchInputInfo GetTouchInputInfo;
+ static PtrCloseTouchInputHandle CloseTouchInputHandle;
QHash<DWORD, int> touchInputIDToTouchPointID;
QList<QTouchEvent::TouchPoint> appAllTouchPoints;
bool translateTouchEvent(const MSG &msg);
+
+ typedef QMap<QWidget*, StandardGestures> WidgetStandardGesturesMap;
+ WidgetStandardGesturesMap widgetGestures;
+ ulong lastGestureId;
+
+ PtrGetGestureInfo GetGestureInfo;
+ PtrGetGestureExtraArgs GetGestureExtraArgs;
+ PtrCloseGestureInfoHandle CloseGestureInfoHandle;
+ PtrSetGestureConfig SetGestureConfig;
+ PtrGetGestureConfig GetGestureConfig;
+ PtrBeginPanningFeedback BeginPanningFeedback;
+ PtrUpdatePanningFeedback UpdatePanningFeedback;
+ PtrEndPanningFeedback EndPanningFeedback;
#endif
#ifdef QT_RX71_MULTITOUCH
diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp
index 92fe5f5..83b2861 100644
--- a/src/gui/kernel/qapplication_qws.cpp
+++ b/src/gui/kernel/qapplication_qws.cpp
@@ -668,10 +668,14 @@ void QWSDisplay::Data::sendSynchronousCommand(QWSCommand & cmd)
int QWSDisplay::Data::takeId()
{
- if (unused_identifiers.count() == 10)
+ int unusedIdCount = unused_identifiers.count();
+ if (unusedIdCount == 10)
create(15);
- if (unused_identifiers.count() == 0)
+ if (unusedIdCount == 0) {
+ create(1); // Make sure we have an incoming id to wait for, just in case we're recursive
waitForCreation();
+ }
+
return unused_identifiers.takeFirst();
}
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index bb7d931..d5c820c 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -89,6 +89,8 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#include <private/qkeymapper_p.h>
#include <private/qlocale_p.h>
#include "qevent_p.h"
+#include "qstandardgestures.h"
+#include "qstandardgestures_p.h"
//#define ALIEN_DEBUG
@@ -105,7 +107,6 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#endif
#endif // QT_NO_ACCESSIBILITY
-#include <winuser.h>
#if !defined(WINABLEAPI)
# if defined(Q_WS_WINCE)
# include <bldver.h>
@@ -145,24 +146,6 @@ typedef struct tagTOUCHINPUT
#endif
-#ifndef FLASHW_STOP
-typedef struct {
- UINT cbSize;
- HWND hwnd;
- DWORD dwFlags;
- UINT uCount;
- DWORD dwTimeout;
-} FLASHWINFO, *PFLASHWINFO;
-#define FLASHW_STOP 0
-#define FLASHW_CAPTION 0x00000001
-#define FLASHW_TRAY 0x00000002
-#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY)
-#define FLASHW_TIMER 0x00000004
-#define FLASHW_TIMERNOFG 0x0000000C
-#endif /* FLASHW_STOP */
-typedef BOOL (WINAPI *PtrFlashWindowEx)(PFLASHWINFO pfwi);
-static PtrFlashWindowEx pFlashWindowEx = 0;
-
#include <windowsx.h>
#include <limits.h>
#include <string.h>
@@ -272,10 +255,6 @@ QTabletDeviceData currentTabletPointer;
// from qregion_win.cpp
extern HRGN qt_tryCreateRegion(QRegion::RegionType type, int left, int top, int right, int bottom);
-Q_CORE_EXPORT bool winPeekMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin,
- UINT wMsgFilterMax, UINT wRemoveMsg);
-Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
// support for on-the-fly changes of the XP theme engine
#ifndef WM_THEMECHANGED
#define WM_THEMECHANGED 0x031A
@@ -290,22 +269,24 @@ Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
#define WM_XBUTTONDOWN 0x020B
#define WM_XBUTTONUP 0x020C
#define WM_XBUTTONDBLCLK 0x020D
+#endif
+#ifndef GET_KEYSTATE_WPARAM
#define GET_KEYSTATE_WPARAM(wParam) (LOWORD(wParam))
#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam))
#define XBUTTON1 0x0001
#define XBUTTON2 0x0002
+#endif
+#ifndef MK_XBUTTON1
#define MK_XBUTTON1 0x0020
#define MK_XBUTTON2 0x0040
#endif
-#ifdef Q_WS_WINCE
-#define GET_KEYSTATE_WPARAM(wParam) (LOWORD(wParam))
-#endif
-
-// support for multi-media-keys on ME/2000/XP
+// support for multi-media-keys
#ifndef WM_APPCOMMAND
#define WM_APPCOMMAND 0x0319
+#endif
+#ifndef FAPPCOMMAND_MOUSE
#define FAPPCOMMAND_MOUSE 0x8000
#define FAPPCOMMAND_KEY 0
#define FAPPCOMMAND_OEM 0x1000
@@ -373,9 +354,7 @@ Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
#define APPCOMMAND_MEDIA_CHANNEL_DOWN 52
#endif // APPCOMMAND_MICROPHONE_VOLUME_MUTE
-#endif // WM_APPCOMMAND
-
-static UINT WM95_MOUSEWHEEL = 0;
+#endif // FAPPCOMMAND_MOUSE
#if (_WIN32_WINNT < 0x0400)
// This struct is defined in winuser.h if the _WIN32_WINNT >= 0x0400 -- in the
@@ -475,6 +454,7 @@ public:
bool translateConfigEvent(const MSG &msg);
bool translateCloseEvent(const MSG &msg);
bool translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, int numPackets);
+ bool translateGestureEvent(const MSG &msg);
void repolishStyle(QStyle &style);
inline void showChildren(bool spontaneous) { d_func()->showChildren(spontaneous); }
inline void hideChildren(bool spontaneous) { d_func()->hideChildren(spontaneous); }
@@ -543,14 +523,13 @@ static void qt_set_windows_color_resources()
pal.setColor(QPalette::Inactive, QPalette::Light, pal.light().color());
pal.setColor(QPalette::Inactive, QPalette::Dark, pal.dark().color());
- if (QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95) {
- if (pal.midlight() == pal.button())
- pal.setColor(QPalette::Midlight, pal.button().color().lighter(110));
- if (pal.background() != pal.base()) {
- pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.color(QPalette::Inactive, QPalette::Window));
- pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Inactive, QPalette::Text));
- }
+ if (pal.midlight() == pal.button())
+ pal.setColor(QPalette::Midlight, pal.button().color().lighter(110));
+ if (pal.background() != pal.base()) {
+ pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.color(QPalette::Inactive, QPalette::Window));
+ pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Inactive, QPalette::Text));
}
+
const QColor bg = pal.background().color();
const QColor fg = pal.foreground().color(), btn = pal.button().color();
QColor disabled((fg.red()+btn.red())/2,(fg.green()+btn.green())/2,
@@ -601,35 +580,18 @@ static void qt_set_windows_color_resources()
static void qt_set_windows_font_resources()
{
#ifndef Q_WS_WINCE
- QFont menuFont;
- QFont messageFont;
- QFont statusFont;
- QFont titleFont;
- QFont iconTitleFont;
- QT_WA({
- NONCLIENTMETRICS ncm;
- ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONTW);
- SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0);
- menuFont = qt_LOGFONTtoQFont(ncm.lfMenuFont,true);
- messageFont = qt_LOGFONTtoQFont(ncm.lfMessageFont,true);
- statusFont = qt_LOGFONTtoQFont(ncm.lfStatusFont,true);
- titleFont = qt_LOGFONTtoQFont(ncm.lfCaptionFont,true);
- LOGFONTW lfIconTitleFont;
- SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0);
- iconTitleFont = qt_LOGFONTtoQFont(lfIconTitleFont,true);
- } , {
- // A version
- NONCLIENTMETRICSA ncm;
- ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, lfMessageFont) + sizeof(LOGFONTA);
- SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
- menuFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfMenuFont,true);
- messageFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfMessageFont,true);
- statusFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfStatusFont,true);
- titleFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfCaptionFont,true);
- LOGFONTA lfIconTitleFont;
- SystemParametersInfoA(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0);
- iconTitleFont = qt_LOGFONTtoQFont((LOGFONT&)lfIconTitleFont,true);
- });
+ NONCLIENTMETRICS ncm;
+ ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);
+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0);
+
+ QFont menuFont = qt_LOGFONTtoQFont(ncm.lfMenuFont, true);
+ QFont messageFont = qt_LOGFONTtoQFont(ncm.lfMessageFont, true);
+ QFont statusFont = qt_LOGFONTtoQFont(ncm.lfStatusFont, true);
+ QFont titleFont = qt_LOGFONTtoQFont(ncm.lfCaptionFont, true);
+
+ LOGFONT lfIconTitleFont;
+ SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0);
+ QFont iconTitleFont = qt_LOGFONTtoQFont(lfIconTitleFont, true);
QApplication::setFont(menuFont, "QMenu");
QApplication::setFont(menuFont, "QMenuBar");
@@ -657,26 +619,13 @@ static void qt_set_windows_font_resources()
static void qt_win_read_cleartype_settings()
{
+ UINT result = 0;
#ifdef Q_OS_WINCE
- UINT result;
- BOOL ok;
- ok = SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &result, 0);
- if (ok)
- qt_cleartype_enabled = result;
+ if (SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &result, 0))
+ qt_cleartype_enabled = result;
#else
- QT_WA({
- UINT result;
- BOOL ok;
- ok = SystemParametersInfoW(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0);
- if (ok)
- qt_cleartype_enabled = (result == FE_FONTSMOOTHINGCLEARTYPE);
- }, {
- UINT result;
- BOOL ok;
- ok = SystemParametersInfoA(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0);
- if (ok)
- qt_cleartype_enabled = (result == FE_FONTSMOOTHINGCLEARTYPE);
- });
+ if (SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0))
+ qt_cleartype_enabled = (result == FE_FONTSMOOTHINGCLEARTYPE);
#endif
}
@@ -694,10 +643,10 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
QPalette pal = *QApplicationPrivate::sys_pal;
QColor menuCol(qt_colorref2qrgb(GetSysColor(COLOR_MENU)));
QColor menuText(qt_colorref2qrgb(GetSysColor(COLOR_MENUTEXT)));
- BOOL isFlat = 0;
+ BOOL isFlat = false;
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
- SystemParametersInfo(0x1022 /*SPI_GETFLATMENU*/, 0, &isFlat, 0);
+ SystemParametersInfo(SPI_GETFLATMENU, 0, &isFlat, 0);
QPalette menu(pal);
// we might need a special color group for the menu.
menu.setColor(QPalette::Active, QPalette::Button, menuCol);
@@ -712,8 +661,7 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
QColor(qt_colorref2qrgb(GetSysColor(
(QSysInfo::WindowsVersion >= QSysInfo::WV_XP
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
- && isFlat ? COLOR_MENUHILIGHT
- : COLOR_HIGHLIGHT))));
+ && isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT))));
menu.setColor(QPalette::Disabled, QPalette::HighlightedText, disabled);
menu.setColor(QPalette::Disabled, QPalette::Button,
menu.color(QPalette::Active, QPalette::Button));
@@ -729,10 +677,8 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
menu.color(QPalette::Active, QPalette::Highlight));
menu.setColor(QPalette::Inactive, QPalette::HighlightedText,
menu.color(QPalette::Active, QPalette::HighlightedText));
-
- if (QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95)
- menu.setColor(QPalette::Inactive, QPalette::ButtonText,
- pal.color(QPalette::Inactive, QPalette::Dark));
+ menu.setColor(QPalette::Inactive, QPalette::ButtonText,
+ pal.color(QPalette::Inactive, QPalette::Dark));
QApplication::setPalette(menu, "QMenu");
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
@@ -749,15 +695,10 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
qt_init() - initializes Qt for Windows
*****************************************************************************/
-typedef BOOL (WINAPI *PtrUpdateLayeredWindow)(HWND hwnd, HDC hdcDst, const POINT *pptDst,
- const SIZE *psize, HDC hdcSrc, const POINT *pptSrc, COLORREF crKey,
- const Q_BLENDFUNCTION *pblend, DWORD dwflags);
-
typedef BOOL (WINAPI *PtrSetProcessDPIAware) (VOID);
-
-static PtrUpdateLayeredWindow ptrUpdateLayeredWindow = 0;
static PtrSetProcessDPIAware ptrSetProcessDPIAware = 0;
-
+PtrUpdateLayeredWindow ptrUpdateLayeredWindow = 0;
+PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect = 0;
static BOOL WINAPI qt_updateLayeredWindowIndirect(HWND hwnd, const Q_UPDATELAYEREDWINDOWINFO *info)
{
return (*ptrUpdateLayeredWindow)(hwnd, info->hdcDst, info->pptDst, info->psize, info->hdcSrc,
@@ -822,46 +763,30 @@ void qt_init(QApplicationPrivate *priv, int)
#endif
qApp->setObjectName(priv->appName());
-#if !defined(Q_WS_WINCE)
// default font
- HFONT hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
- QFont f(QLatin1String("MS Sans Serif"),8);
- int result = 0;
- QT_WA({
- LOGFONT lf;
- if (result = GetObject(hfont, sizeof(lf), &lf))
- f = qt_LOGFONTtoQFont((LOGFONT&)lf,true);
- } , {
- LOGFONTA lf;
- if (result = GetObjectA(hfont, sizeof(lf), &lf))
- f = qt_LOGFONTtoQFont((LOGFONT&)lf,true);
- });
- if (result
- && QSysInfo::WindowsVersion >= QSysInfo::WV_2000
- && QSysInfo::WindowsVersion <= QSysInfo::WV_NT_based
- && f.family() == QLatin1String("MS Shell Dlg"))
- f.setFamily(QLatin1String("MS Shell Dlg 2"));
- QApplicationPrivate::setSystemFont(f);
-#else //Q_WS_WINCE
- LOGFONT lf;
- HGDIOBJ stockFont = GetStockObject(SYSTEM_FONT);
- int result = 0;
- result = GetObject(stockFont, sizeof(lf), &lf);
- QFont font = qt_LOGFONTtoQFont(lf, true);
- if (result)
- QApplicationPrivate::setSystemFont(font);
-#endif //Q_WS_WINCE
+#ifndef Q_WS_WINCE
+ HGDIOBJ stockFont = GetStockObject(DEFAULT_GUI_FONT);
+#else
+ HGDIOBJ stockFont = GetStockObject(SYSTEM_FONT);
+#endif
+
+ LOGFONT lf;
+ GetObject(stockFont, sizeof(lf), &lf);
+ QFont systemFont = qt_LOGFONTtoQFont(lf, true);
+
+#ifndef Q_WS_WINCE
+ if (systemFont.family() == QLatin1String("MS Shell Dlg")) {
+ systemFont.setFamily(QLatin1String("MS Shell Dlg 2"));
+ }
+#endif
+
+ QApplicationPrivate::setSystemFont(systemFont);
// QFont::locale_init(); ### Uncomment when it does something on Windows
if (QApplication::desktopSettingsAware())
qt_set_windows_resources();
- QT_WA({
- WM95_MOUSEWHEEL = RegisterWindowMessage(L"MSWHEEL_ROLLMSG");
- } , {
- WM95_MOUSEWHEEL = RegisterWindowMessageA("MSWHEEL_ROLLMSG");
- });
initWinTabFunctions();
QApplicationPrivate::inputContext = new QWinInputContext(0);
@@ -884,10 +809,38 @@ void qt_init(QApplicationPrivate *priv, int)
ptrUpdateLayeredWindowIndirect = qt_updateLayeredWindowIndirect;
// Notify Vista and Windows 7 that we support highter DPI settings
- if (ptrSetProcessDPIAware = (PtrSetProcessDPIAware)
- QLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware"))
- ptrSetProcessDPIAware();
-#endif
+ ptrSetProcessDPIAware = (PtrSetProcessDPIAware)
+ QLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware");
+ if (ptrSetProcessDPIAware)
+ ptrSetProcessDPIAware();
+#endif
+
+ priv->lastGestureId = 0;
+
+ priv->GetGestureInfo =
+ (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"),
+ "GetGestureInfo");
+ priv->GetGestureExtraArgs =
+ (PtrGetGestureExtraArgs)QLibrary::resolve(QLatin1String("user32"),
+ "GetGestureExtraArgs");
+ priv->CloseGestureInfoHandle =
+ (PtrCloseGestureInfoHandle)QLibrary::resolve(QLatin1String("user32"),
+ "CloseGestureInfoHandle");
+ priv->SetGestureConfig =
+ (PtrSetGestureConfig)QLibrary::resolve(QLatin1String("user32"),
+ "SetGestureConfig");
+ priv->GetGestureConfig =
+ (PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"),
+ "GetGestureConfig");
+ priv->BeginPanningFeedback =
+ (PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
+ "BeginPanningFeedback");
+ priv->UpdatePanningFeedback =
+ (PtrUpdatePanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
+ "UpdatePanningFeedback");
+ priv->EndPanningFeedback =
+ (PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
+ "EndPanningFeedback");
}
/*****************************************************************************
@@ -963,7 +916,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class
if (w->inherits("QTipLabel") || w->inherits("QAlphaWidget")) {
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
- style |= 0x00020000; // CS_DROPSHADOW
+ style |= CS_DROPSHADOW;
}
cname = QLatin1String("QToolTip");
} else {
@@ -981,7 +934,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class
#endif
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
- style |= 0x00020000; // CS_DROPSHADOW
+ style |= CS_DROPSHADOW;
icon = false;
} else {
cname = QLatin1String("QWidget");
@@ -1001,10 +954,10 @@ const QString qt_reg_winclass(QWidget *w) // register window class
// unique ID on WinCE to make sure we can
// move the windows to the front when starting
// a second instance.
- wchar_t uniqueAppID[256];
- GetModuleFileNameW(0, uniqueAppID, 255);
- cname = QString::number(RegisterWindowMessageW(
- (const wchar_t *) QString::fromUtf16((const ushort *)uniqueAppID).toLower().replace(QLatin1Char('\\'),
+ wchar_t uniqueAppID[MAX_PATH];
+ GetModuleFileName(0, uniqueAppID, MAX_PATH);
+ cname = QString::number(RegisterWindowMessage(
+ (const wchar_t *) QString::fromWCharArray(uniqueAppID).toLower().replace(QLatin1Char('\\'),
QLatin1Char('_')).utf16()));
#endif
@@ -1016,15 +969,9 @@ const QString qt_reg_winclass(QWidget *w) // register window class
static int classExists = -1;
if (classExists == -1) {
- QT_WA({
- WNDCLASS wcinfo;
- classExists = GetClassInfo(qWinAppInst(), (TCHAR*)cname.utf16(), &wcinfo);
- classExists = classExists && wcinfo.lpfnWndProc != QtWndProc;
- }, {
- WNDCLASSA wcinfo;
- classExists = GetClassInfoA(qWinAppInst(), cname.toLatin1(), &wcinfo);
- classExists = classExists && wcinfo.lpfnWndProc != QtWndProc;
- });
+ WNDCLASS wcinfo;
+ classExists = GetClassInfo((HINSTANCE)qWinAppInst(), (wchar_t*)cname.utf16(), &wcinfo);
+ classExists = classExists && wcinfo.lpfnWndProc != QtWndProc;
}
if (classExists)
@@ -1033,73 +980,37 @@ const QString qt_reg_winclass(QWidget *w) // register window class
if (winclassNames()->contains(cname)) // already registered in our list
return cname;
- ATOM atom;
+ WNDCLASS wc;
+ wc.style = style;
+ wc.lpfnWndProc = (WNDPROC)QtWndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = qWinAppInst();
+ if (icon) {
+ wc.hIcon = (HICON)LoadImage(qWinAppInst(), L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
#ifndef Q_WS_WINCE
- HBRUSH bgBrush = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
- QT_WA({
- WNDCLASS wc;
- wc.style = style;
- wc.lpfnWndProc = (WNDPROC)QtWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = qWinAppInst();
- if (icon) {
- wc.hIcon = LoadIcon(qWinAppInst(), L"IDI_ICON1");
- if (!wc.hIcon)
- wc.hIcon = LoadIcon(0, IDI_APPLICATION);
- } else {
- wc.hIcon = 0;
- }
- wc.hCursor = 0;
- wc.hbrBackground= bgBrush;
- wc.lpszMenuName = 0;
- wc.lpszClassName= (TCHAR*)cname.utf16();
- atom = RegisterClass(&wc);
- } , {
- WNDCLASSA wc;
- wc.style = style;
- wc.lpfnWndProc = (WNDPROC)QtWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = qWinAppInst();
- if (icon) {
- wc.hIcon = LoadIconA(qWinAppInst(), (char*)"IDI_ICON1");
- if (!wc.hIcon)
- wc.hIcon = LoadIconA(0, (char*)IDI_APPLICATION);
- } else {
- wc.hIcon = 0;
- }
- wc.hCursor = 0;
- wc.hbrBackground= bgBrush;
- wc.lpszMenuName = 0;
- QByteArray tempArray = cname.toLatin1();
- wc.lpszClassName= tempArray;
- atom = RegisterClassA(&wc);
- });
+ if (!wc.hIcon)
+ wc.hIcon = (HICON)LoadImage(0, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
+#endif
+ } else {
+ wc.hIcon = 0;
+ }
+ wc.hCursor = 0;
+#ifndef Q_WS_WINCE
+ wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
#else
- WNDCLASS wc;
- wc.style = style;
- wc.lpfnWndProc = (WNDPROC)QtWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = qWinAppInst();
- if (icon) {
- wc.hIcon = LoadIcon(qWinAppInst(), L"IDI_ICON1");
-// if (!wc.hIcon)
-// wc.hIcon = LoadIcon(0, IDI_APPLICATION);
- } else {
- wc.hIcon = 0;
- }
- wc.hCursor = 0;
- wc.hbrBackground= 0;
- wc.lpszMenuName = 0;
- wc.lpszClassName= (TCHAR*)cname.utf16();
- atom = RegisterClass(&wc);
+ wc.hbrBackground = 0;
#endif
+ wc.lpszMenuName = 0;
+ wc.lpszClassName = (wchar_t*)cname.utf16();
+
+ ATOM atom = RegisterClass(&wc);
#ifndef QT_NO_DEBUG
if (!atom)
qErrnoWarning("QApplication::regClass: Registering window class failed.");
+#else
+ Q_UNUSED(atom);
#endif
winclassNames()->insert(cname, 1);
@@ -1117,11 +1028,7 @@ static void unregWinClasses()
WinClassNameHash *hash = winclassNames();
QHash<QString, int>::ConstIterator it = hash->constBegin();
while (it != hash->constEnd()) {
- QT_WA({
- UnregisterClass((TCHAR*)it.key().utf16(), qWinAppInst());
- } , {
- UnregisterClassA(it.key().toLatin1(), qWinAppInst());
- });
+ UnregisterClass((wchar_t*)it.key().utf16(), qWinAppInst());
++it;
}
hash->clear();
@@ -1338,16 +1245,10 @@ void QApplication::beep()
static void alert_widget(QWidget *widget, int duration)
{
- bool stopFlash = duration < 0;
-
- if (!pFlashWindowEx) {
#ifndef Q_OS_WINCE
- QLibrary themeLib(QLatin1String("user32"));
- pFlashWindowEx = (PtrFlashWindowEx)themeLib.resolve("FlashWindowEx");
-#endif
- }
+ bool stopFlash = duration < 0;
- if (pFlashWindowEx && widget && (!widget->isActiveWindow() || stopFlash)) {
+ if (widget && (!widget->isActiveWindow() || stopFlash)) {
DWORD timeOut = GetCaretBlinkTime();
if (timeOut <= 0)
timeOut = 250;
@@ -1365,8 +1266,9 @@ static void alert_widget(QWidget *widget, int duration)
info.dwTimeout = stopFlash ? 0 : timeOut;
info.uCount = stopFlash ? 0 : flashCount;
- pFlashWindowEx(&info);
+ FlashWindowEx(&info);
}
+#endif
}
void QApplication::alert(QWidget *widget, int duration)
@@ -1454,13 +1356,13 @@ static int inputcharset = CP_ACP;
static bool qt_is_translatable_mouse_event(UINT message)
{
- return (message >= WM_MOUSEFIRST && message <= WM_MOUSELAST ||
- message >= WM_XBUTTONDOWN && message <= WM_XBUTTONDBLCLK)
+ return (((message >= WM_MOUSEFIRST && message <= WM_MOUSELAST) ||
+ (message >= WM_XBUTTONDOWN && message <= WM_XBUTTONDBLCLK))
&& message != WM_MOUSEWHEEL
- && message != WM_MOUSEHWHEEL
+ && message != WM_MOUSEHWHEEL)
#ifndef Q_WS_WINCE
- || message >= WM_NCMOUSEMOVE && message <= WM_NCMBUTTONDBLCLK
+ || (message >= WM_NCMOUSEMOVE && message <= WM_NCMBUTTONDBLCLK)
#endif
;
}
@@ -1727,7 +1629,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
// Sometimes we only get a WM_MOUSEMOVE message
// and sometimes we get both a WM_MOUSEMOVE and
// a WM_LBUTTONDOWN/UP, this creates a spurious mouse
- // press/release event, using the winPeekMessage
+ // press/release event, using the PeekMessage
// will help us fix this. This leaves us with a
// question:
// This effectively kills using the mouse AND the
@@ -1737,16 +1639,14 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
bool is_mouse_move = (message == WM_MOUSEMOVE);
if (is_mouse_move) {
MSG msg1;
- if (winPeekMessage(&msg1, msg.hwnd, WM_MOUSEFIRST,
- WM_MOUSELAST, PM_NOREMOVE))
+ if (PeekMessage(&msg1, msg.hwnd, WM_MOUSEFIRST,
+ WM_MOUSELAST, PM_NOREMOVE))
next_is_button = (msg1.message == WM_LBUTTONUP
|| msg1.message == WM_LBUTTONDOWN);
}
if (!is_mouse_move || (is_mouse_move && !next_is_button))
qt_tabletChokeMouse = false;
}
- } else if (message == WM95_MOUSEWHEEL) {
- result = widget->translateWheelEvent(msg);
} else {
switch (message) {
case WM_TOUCH:
@@ -1777,7 +1677,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
case WM_IME_KEYDOWN:
case WM_CHAR: {
MSG msg1;
- bool anyMsg = winPeekMessage(&msg1, msg.hwnd, 0, 0, PM_NOREMOVE);
+ bool anyMsg = PeekMessage(&msg1, msg.hwnd, 0, 0, PM_NOREMOVE);
if (anyMsg && msg1.message == WM_DEADCHAR) {
result = true; // consume event since there is a dead char next
break;
@@ -1977,11 +1877,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
#ifndef QT_NO_WHATSTHIS
QWhatsThis::enterWhatsThisMode();
#endif
- QT_WA({
- DefWindowProc(hwnd, WM_NCPAINT, 1, 0);
- } , {
- DefWindowProcA(hwnd, WM_NCPAINT, 1, 0);
- });
+ DefWindowProc(hwnd, WM_NCPAINT, 1, 0);
break;
#if defined(QT_NON_COMMERCIAL)
QT_NC_SYSCOMMAND
@@ -2043,8 +1939,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
break;
if (!msg.wParam) {
- QString area = QT_WA_INLINE(QString::fromUtf16((unsigned short *)msg.lParam),
- QString::fromLocal8Bit((char*)msg.lParam));
+ QString area = QString::fromWCharArray((wchar_t*)msg.lParam);
if (area == QLatin1String("intl")) {
QLocalePrivate::updateSystemPrivate();
if (!widget->testAttribute(Qt::WA_SetLocale))
@@ -2422,11 +2317,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
text = widget->objectName();
ret = qMin<int>(wParam - 1, text.size());
text.resize(ret);
- QT_WA({
- memcpy((void *)lParam, text.utf16(), (text.size() + 1) * 2);
- }, {
- memcpy((void *)lParam, text.toLocal8Bit().data(), text.size() + 1);
- });
+ memcpy((void *)lParam, text.utf16(), (text.size() + 1) * sizeof(ushort));
delete acc;
}
if (!ret) {
@@ -2514,11 +2405,11 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
#ifndef Q_WS_WINCE
case WM_INPUTLANGCHANGE: {
- char info[7];
- if (!GetLocaleInfoA(MAKELCID(lParam, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, info, 6)) {
+ wchar_t info[7];
+ if (!GetLocaleInfo(MAKELCID(lParam, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, info, 6)) {
inputcharset = CP_ACP;
} else {
- inputcharset = QString::fromLatin1(info).toInt();
+ inputcharset = QString::fromWCharArray(info).toInt();
}
QKeyMapper::changeKeyboard();
break;
@@ -2612,6 +2503,10 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
result = false;
break;
+ case WM_GESTURE:
+ widget->translateGestureEvent(msg);
+ result = true;
+ break;
default:
result = false; // event was not processed
break;
@@ -2711,11 +2606,10 @@ bool qt_try_modal(QWidget *widget, MSG *msg, int& ret)
bool block_event = false;
#ifndef Q_WS_WINCE
- if (type != WM_NCHITTEST)
+ if (type != WM_NCHITTEST) {
#endif
if ((type >= WM_MOUSEFIRST && type <= WM_MOUSELAST) ||
- type == WM_MOUSEWHEEL || type == (int)WM95_MOUSEWHEEL ||
- type == WM_MOUSEHWHEEL ||
+ type == WM_MOUSEWHEEL || type == WM_MOUSEHWHEEL ||
type == WM_MOUSELEAVE ||
(type >= WM_KEYFIRST && type <= WM_KEYLAST)
#ifndef Q_WS_WINCE
@@ -2742,17 +2636,18 @@ bool qt_try_modal(QWidget *widget, MSG *msg, int& ret)
block_event = true;
}
#ifndef Q_WS_WINCE
- else if (type == WM_MOUSEACTIVATE || type == WM_NCLBUTTONDOWN){
- if (!top->isActiveWindow()) {
- top->activateWindow();
- } else {
- QApplication::beep();
- }
- block_event = true;
- ret = MA_NOACTIVATEANDEAT;
- } else if (type == WM_SYSCOMMAND) {
- if (!(msg->wParam == SC_RESTORE && widget->isMinimized()))
+ else if (type == WM_MOUSEACTIVATE || type == WM_NCLBUTTONDOWN){
+ if (!top->isActiveWindow()) {
+ top->activateWindow();
+ } else {
+ QApplication::beep();
+ }
block_event = true;
+ ret = MA_NOACTIVATEANDEAT;
+ } else if (type == WM_SYSCOMMAND) {
+ if (!(msg->wParam == SC_RESTORE && widget->isMinimized()))
+ block_event = true;
+ }
}
#endif
@@ -2954,20 +2849,11 @@ void qt_win_eatMouseMove()
// remove all those messages (usually 1) and post the last one with a
// reset button state
- MSG msg = {0, 0, 0, 0, 0, 0, 0};
- QT_WA( {
- while (PeekMessage(&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
- ;
- if (msg.message == WM_MOUSEMOVE)
- PostMessage(msg.hwnd, msg.message, 0, msg.lParam);
- }, {
- MSG msg;
- msg.message = 0;
- while (PeekMessageA(&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
- ;
- if (msg.message == WM_MOUSEMOVE)
- PostMessageA(msg.hwnd, msg.message, 0, msg.lParam);
- } );
+ MSG msg = {0, 0, 0, 0, 0, {0, 0} };
+ while (PeekMessage(&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
+ ;
+ if (msg.message == WM_MOUSEMOVE)
+ PostMessage(msg.hwnd, msg.message, 0, msg.lParam);
}
// In DnD, the mouse release event never appears, so the
@@ -3002,8 +2888,8 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
// Compress mouse move events
if (msg.message == WM_MOUSEMOVE) {
MSG mouseMsg;
- while (winPeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEFIRST,
- WM_MOUSELAST, PM_NOREMOVE)) {
+ while (PeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEFIRST,
+ WM_MOUSELAST, PM_NOREMOVE)) {
if (mouseMsg.message == WM_MOUSEMOVE) {
#define PEEKMESSAGE_IS_BROKEN 1
#ifdef PEEKMESSAGE_IS_BROKEN
@@ -3014,12 +2900,12 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
// key release events (kls 2003-05-13):
MSG keyMsg;
bool done = false;
- while (winPeekMessage(&keyMsg, 0, WM_KEYFIRST, WM_KEYLAST,
- PM_NOREMOVE)) {
+ while (PeekMessage(&keyMsg, 0, WM_KEYFIRST, WM_KEYLAST,
+ PM_NOREMOVE)) {
if (keyMsg.time < mouseMsg.time) {
if ((keyMsg.lParam & 0xC0000000) == 0x40000000) {
- winPeekMessage(&keyMsg, 0, keyMsg.message,
- keyMsg.message, PM_REMOVE);
+ PeekMessage(&keyMsg, 0, keyMsg.message,
+ keyMsg.message, PM_REMOVE);
} else {
done = true;
break;
@@ -3045,8 +2931,8 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
msgPtr->wParam = mouseMsg.wParam;
msgPtr->pt = mouseMsg.pt;
// Remove the mouse move message
- winPeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEMOVE,
- WM_MOUSEMOVE, PM_REMOVE);
+ PeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEMOVE,
+ WM_MOUSEMOVE, PM_REMOVE);
} else {
break; // there was no more WM_MOUSEMOVE event
}
@@ -3075,7 +2961,9 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
if (alienWidget && alienWidget->internalWinId())
alienWidget = 0;
- if (type == QEvent::MouseMove || type == QEvent::NonClientAreaMouseMove) {
+ if (type == QEvent::MouseMove || type == QEvent::NonClientAreaMouseMove
+ || type == QEvent::TabletMove) {
+
if (!(state & Qt::MouseButtonMask))
qt_button_down = 0;
#ifndef QT_NO_CURSOR
@@ -3206,6 +3094,8 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
popupButtonFocus = popupChild;
break;
case QEvent::MouseButtonRelease:
+ case QEvent::TabletRelease:
+
releaseAfter = true;
break;
default:
@@ -3260,7 +3150,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
POINT widgetpt = gpos;
ScreenToClient(hwndTarget, &widgetpt);
LPARAM lParam = MAKELPARAM(widgetpt.x, widgetpt.y);
- winPostMessage(hwndTarget, msg.message, msg.wParam, lParam);
+ PostMessage(hwndTarget, msg.message, msg.wParam, lParam);
}
} else if (type == QEvent::MouseButtonRelease && button == Qt::RightButton
&& QApplication::activePopupWidget() == activePopupWidget) {
@@ -3443,17 +3333,19 @@ static void tabletInit(UINT wActiveCsr, HCTX hTab)
tdd.minTanPressure = int(np.axMin);
tdd.maxTanPressure = int(np.axMax);
- ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_X, &np);
- tdd.minX = int(np.axMin);
- tdd.maxX = int(np.axMax);
+ LOGCONTEXT lcMine;
+
+ /* get default region */
+ ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine);
+
+ tdd.minX = 0;
+ tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX);
- ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_Y, &np);
- tdd.minY = int(np.axMin);
- tdd.maxY = int(np.axMax);
+ tdd.minY = 0;
+ tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY);
- ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_Z, &np);
- tdd.minZ = int(np.axMin);
- tdd.maxZ = int(np.axMax);
+ tdd.minZ = 0;
+ tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ);
int csr_type,
csr_physid;
@@ -3563,13 +3455,34 @@ bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf,
}
QPoint globalPos(qRound(hiResGlobal.x()), qRound(hiResGlobal.y()));
+ if (t == QEvent::TabletPress)
+ {
+ qt_button_down = QApplication::widgetAt(globalPos);
+ }
+
// make sure the tablet event get's sent to the proper widget...
- QWidget *w = QApplication::widgetAt(globalPos);
+ QWidget *w = 0;
+
if (qt_button_down)
w = qt_button_down; // Pass it to the thing that's grabbed it.
+ else
+ w = QApplication::widgetAt(globalPos);
if (!w)
w = this;
+
+ if (t == QEvent::TabletRelease)
+ {
+ if (qt_win_ignoreNextMouseReleaseEvent) {
+ qt_win_ignoreNextMouseReleaseEvent = false;
+ if (qt_button_down && qt_button_down->internalWinId() == autoCaptureWnd) {
+ releaseAutoCapture();
+ qt_button_down = 0;
+ }
+ }
+
+ }
+
QPoint localPos = w->mapFromGlobal(globalPos);
#ifndef QT_NO_TABLETEVENT
if (currentTabletPointer.currentDevice == QTabletEvent::Airbrush) {
@@ -3627,14 +3540,8 @@ static void initWinTabFunctions()
QLibrary library(QLatin1String("wintab32"));
if (library.load()) {
- QT_WA({
- ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW");
- ptrWTGet = (PtrWTGet)library.resolve("WTGetW");
- } , {
- ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoA");
- ptrWTGet = (PtrWTGet)library.resolve("WTGetA");
- });
-
+ ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW");
+ ptrWTGet = (PtrWTGet)library.resolve("WTGetW");
ptrWTEnable = (PtrWTEnable)library.resolve("WTEnable");
ptrWTOverlap = (PtrWTEnable)library.resolve("WTOverlap");
ptrWTPacketsGet = (PtrWTPacketsGet)library.resolve("WTPacketsGet");
@@ -3808,6 +3715,60 @@ bool QETWidget::translateCloseEvent(const MSG &)
return d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
}
+bool QETWidget::translateGestureEvent(const MSG &msg)
+{
+ GESTUREINFO gi;
+ gi.cbSize = sizeof(GESTUREINFO);
+ gi.dwFlags = 0;
+ gi.ptsLocation.x = 0;
+ gi.ptsLocation.y = 0;
+ gi.dwID = 0;
+ gi.dwInstanceID = 0;
+ gi.dwSequenceID = 0;
+
+ QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
+ BOOL bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi);
+
+ const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
+ QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
+ if (alienWidget && alienWidget->internalWinId())
+ alienWidget = 0;
+ QWidget *widget = alienWidget ? alienWidget : this;
+
+ QWinGestureEvent event;
+ event.sequenceId = gi.dwSequenceID;
+ event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
+ if (bResult) {
+ switch (gi.dwID) {
+ case GID_BEGIN:
+ // we are not interested in this type of event.
+ break;
+ case GID_END:
+ event.gestureType = QWinGestureEvent::GestureEnd;
+ break;
+ case GID_ZOOM:
+ event.gestureType = QWinGestureEvent::Pinch;
+ break;
+ case GID_PAN:
+ event.gestureType = QWinGestureEvent::Pan;
+ break;
+ case GID_ROTATE:
+ case GID_TWOFINGERTAP:
+ case GID_ROLLOVER:
+ default:
+ break;
+ }
+ if (event.gestureType != QWinGestureEvent::None)
+ qt_sendSpontaneousEvent(widget, &event);
+ } else {
+ DWORD dwErr = GetLastError();
+ if (dwErr > 0)
+ qWarning() << "translateGestureEvent: error = " << dwErr;
+ }
+ qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam);
+ return true;
+}
+
void QApplication::setCursorFlashTime(int msecs)
{
@@ -3861,11 +3822,7 @@ void QApplication::setWheelScrollLines(int n)
#ifdef SPI_SETWHEELSCROLLLINES
if (n < 0)
n = 0;
- QT_WA({
- SystemParametersInfo(SPI_SETWHEELSCROLLLINES, (uint)n, 0, 0);
- } , {
- SystemParametersInfoA(SPI_SETWHEELSCROLLLINES, (uint)n, 0, 0);
- });
+ SystemParametersInfo(SPI_SETWHEELSCROLLLINES, (uint)n, 0, 0);
#else
QApplicationPrivate::wheel_scroll_lines = n;
#endif
@@ -3875,11 +3832,7 @@ int QApplication::wheelScrollLines()
{
#ifdef SPI_GETWHEELSCROLLLINES
uint i = 3;
- QT_WA({
- SystemParametersInfo(SPI_GETWHEELSCROLLLINES, sizeof(uint), &i, 0);
- } , {
- SystemParametersInfoA(SPI_GETWHEELSCROLLLINES, sizeof(uint), &i, 0);
- });
+ SystemParametersInfo(SPI_GETWHEELSCROLLLINES, sizeof(uint), &i, 0);
if (i > INT_MAX)
i = INT_MAX;
return i;
@@ -3924,8 +3877,7 @@ bool QApplication::isEffectEnabled(Qt::UIEffect effect)
if (QColormap::instance().depth() < 16)
return false;
- if (!effect_override && desktopSettingsAware()
- && !(QSysInfo::WindowsVersion == QSysInfo::WV_95 || QSysInfo::WindowsVersion == QSysInfo::WV_NT)) {
+ if (!effect_override && desktopSettingsAware()) {
// we know that they can be used when we are here
BOOL enabled = false;
UINT api;
@@ -3934,33 +3886,22 @@ bool QApplication::isEffectEnabled(Qt::UIEffect effect)
api = SPI_GETMENUANIMATION;
break;
case Qt::UI_FadeMenu:
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)
- return false;
api = SPI_GETMENUFADE;
break;
case Qt::UI_AnimateCombo:
api = SPI_GETCOMBOBOXANIMATION;
break;
case Qt::UI_AnimateTooltip:
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)
- api = SPI_GETMENUANIMATION;
- else
- api = SPI_GETTOOLTIPANIMATION;
+ api = SPI_GETTOOLTIPANIMATION;
break;
case Qt::UI_FadeTooltip:
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)
- return false;
api = SPI_GETTOOLTIPFADE;
break;
default:
api = SPI_GETUIEFFECTS;
break;
}
- QT_WA({
- SystemParametersInfo(api, 0, &enabled, 0);
- } , {
- SystemParametersInfoA(api, 0, &enabled, 0);
- });
+ SystemParametersInfo(api, 0, &enabled, 0);
return enabled;
}
@@ -4009,16 +3950,18 @@ void QSessionManager::cancel()
#endif //QT_NO_SESSIONMANAGER
-qt_RegisterTouchWindowPtr QApplicationPrivate::RegisterTouchWindow = 0;
-qt_GetTouchInputInfoPtr QApplicationPrivate::GetTouchInputInfo = 0;
-qt_CloseTouchInputHandlePtr QApplicationPrivate::CloseTouchInputHandle = 0;
+
+PtrRegisterTouchWindow QApplicationPrivate::RegisterTouchWindow = 0;
+PtrGetTouchInputInfo QApplicationPrivate::GetTouchInputInfo = 0;
+PtrCloseTouchInputHandle QApplicationPrivate::CloseTouchInputHandle = 0;
void QApplicationPrivate::initializeMultitouch_sys()
{
QLibrary library(QLatin1String("user32"));
- RegisterTouchWindow = static_cast<qt_RegisterTouchWindowPtr>(library.resolve("RegisterTouchWindow"));
- GetTouchInputInfo = static_cast<qt_GetTouchInputInfoPtr>(library.resolve("GetTouchInputInfo"));
- CloseTouchInputHandle = static_cast<qt_CloseTouchInputHandlePtr>(library.resolve("CloseTouchInputHandle"));
+ // MinGW (g++ 3.4.5) accepts only C casts.
+ RegisterTouchWindow = (PtrRegisterTouchWindow)(library.resolve("RegisterTouchWindow"));
+ GetTouchInputInfo = (PtrGetTouchInputInfo)(library.resolve("GetTouchInputInfo"));
+ CloseTouchInputHandle = (PtrCloseTouchInputHandle)(library.resolve("CloseTouchInputHandle"));
touchInputIDToTouchPointID.clear();
}
@@ -4030,13 +3973,11 @@ void QApplicationPrivate::cleanupMultitouch_sys()
bool QApplicationPrivate::translateTouchEvent(const MSG &msg)
{
- Q_Q(QApplication);
-
QWidget *widgetForHwnd = QWidget::find(msg.hwnd);
if (!widgetForHwnd)
return false;
- QRect screenGeometry = q->desktop()->screenGeometry(widgetForHwnd);
+ QRect screenGeometry = QApplication::desktop()->screenGeometry(widgetForHwnd);
QList<QTouchEvent::TouchPoint> touchPoints;
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 5ef6b2e..4016563 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -117,7 +117,9 @@ extern "C" {
#define XK_MISCELLANY
#include <X11/keysymdef.h>
+#if !defined(QT_NO_XINPUT)
#include <X11/extensions/XI.h>
+#endif
#include <stdlib.h>
#include <string.h>
@@ -655,11 +657,13 @@ static int qt_x_errhandler(Display *dpy, XErrorEvent *err)
break;
default:
+#if !defined(QT_NO_XINPUT)
if (err->request_code == X11->xinput_major
&& err->error_code == (X11->xinput_errorbase + XI_BadDevice)
&& err->minor_code == 3 /* X_OpenDevice */) {
return 0;
}
+#endif
break;
}
@@ -1392,6 +1396,18 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0,
color = kdeColor(QLatin1String("Colors:Button/ForegroundNormal"), theKdeSettings);
if (color.isValid())
pal.setColor(QPalette::ButtonText, color);
+
+ color = kdeColor(QLatin1String("linkColor"), theKdeSettings);
+ if (!color.isValid())
+ color = kdeColor(QLatin1String("Colors:View/ForegroundLink"), theKdeSettings);
+ if (color.isValid())
+ pal.setColor(QPalette::Link, color);
+
+ color = kdeColor(QLatin1String("visitedLinkColor"), theKdeSettings);
+ if (!color.isValid())
+ color = kdeColor(QLatin1String("Colors:View/ForegroundVisited"), theKdeSettings);
+ if (color.isValid())
+ pal.setColor(QPalette::LinkVisited, color);
}
if (highlight.isValid() && highlightText.isValid()) {
@@ -3230,48 +3246,43 @@ int QApplication::x11ProcessEvent(XEvent* event)
#ifdef ALIEN_DEBUG
//qDebug() << "QApplication::x11ProcessEvent:" << event->type;
#endif
- Time time = 0, userTime = 0;
switch (event->type) {
case ButtonPress:
pressed_window = event->xbutton.window;
- userTime = event->xbutton.time;
+ X11->userTime = event->xbutton.time;
// fallthrough intended
case ButtonRelease:
- time = event->xbutton.time;
+ X11->time = event->xbutton.time;
break;
case MotionNotify:
- time = event->xmotion.time;
+ X11->time = event->xmotion.time;
break;
case XKeyPress:
- userTime = event->xkey.time;
+ X11->userTime = event->xkey.time;
// fallthrough intended
case XKeyRelease:
- time = event->xkey.time;
+ X11->time = event->xkey.time;
break;
case PropertyNotify:
- time = event->xproperty.time;
+ X11->time = event->xproperty.time;
break;
case EnterNotify:
case LeaveNotify:
- time = event->xcrossing.time;
+ X11->time = event->xcrossing.time;
break;
case SelectionClear:
- time = event->xselectionclear.time;
+ X11->time = event->xselectionclear.time;
break;
default:
-#ifndef QT_NO_XFIXES
- if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) {
- XFixesSelectionNotifyEvent *req =
- reinterpret_cast<XFixesSelectionNotifyEvent *>(event);
- time = req->selection_timestamp;
- }
-#endif
break;
}
- if (time > X11->time)
- X11->time = time;
- if (userTime > X11->userTime)
- X11->userTime = userTime;
+#ifndef QT_NO_XFIXES
+ if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) {
+ XFixesSelectionNotifyEvent *req =
+ reinterpret_cast<XFixesSelectionNotifyEvent *>(event);
+ X11->time = req->selection_timestamp;
+ }
+#endif
QETWidget *widget = (QETWidget*)QWidget::find((WId)event->xany.window);
@@ -3437,19 +3448,10 @@ int QApplication::x11ProcessEvent(XEvent* event)
QSize oldSize(w->size());
w->data->crect.setWidth(DisplayWidth(X11->display, scr));
w->data->crect.setHeight(DisplayHeight(X11->display, scr));
- QVarLengthArray<QRect> oldSizes(desktop->numScreens());
- for (int i = 0; i < desktop->numScreens(); ++i)
- oldSizes[i] = desktop->screenGeometry(i);
QResizeEvent e(w->size(), oldSize);
QApplication::sendEvent(w, &e);
- for (int i = 0; i < qMin(oldSizes.count(), desktop->numScreens()); ++i) {
- if (oldSizes[i] != desktop->screenGeometry(i))
- emit desktop->resized(i);
- }
- for (int i = oldSizes.count(); i < desktop->numScreens(); ++i)
- emit desktop->resized(i); // added
- for (int i = desktop->numScreens(); i < oldSizes.count(); ++i)
- emit desktop->resized(i); // removed
+ if (w != desktop)
+ QApplication::sendEvent(desktop, &e);
}
#endif // QT_NO_XRANDR
diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/gui/kernel/qclipboard_mac.cpp
index b7b57b8..45050b2 100644
--- a/src/gui/kernel/qclipboard_mac.cpp
+++ b/src/gui/kernel/qclipboard_mac.cpp
@@ -50,6 +50,7 @@
#include "qurl.h"
#include <stdlib.h>
#include <string.h>
+#include "qt_cocoa_helpers_mac_p.h"
QT_BEGIN_NAMESPACE
@@ -525,8 +526,17 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
QString c_flavor = c->flavorFor(format);
if(!c_flavor.isEmpty()) {
// Handle text/plain a little differently. Try handling Unicode first.
- if((c_flavor == QLatin1String("com.apple.traditional-mac-plain-text") || c_flavor == QLatin1String("public.utf8-plain-text")) &&
- hasFlavor(QLatin1String("public.utf16-plain-text")))
+ bool checkForUtf16 = (c_flavor == QLatin1String("com.apple.traditional-mac-plain-text")
+ || c_flavor == QLatin1String("public.utf8-plain-text"));
+ if (checkForUtf16 || c_flavor == QLatin1String("public.utf16-plain-text")) {
+ // Try to get the NSStringPboardType from NSPasteboard, newlines are mapped
+ // correctly (as '\n') in this data. The 'public.utf16-plain-text' type
+ // usually maps newlines to '\r' instead.
+ QString str = qt_mac_get_pasteboardString();
+ if (!str.isEmpty())
+ return str;
+ }
+ if (checkForUtf16 && hasFlavor(QLatin1String("public.utf16-plain-text")))
c_flavor = QLatin1String("public.utf16-plain-text");
QVariant ret;
diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp
index 09b5448..f5aa088 100644
--- a/src/gui/kernel/qclipboard_win.cpp
+++ b/src/gui/kernel/qclipboard_win.cpp
@@ -200,7 +200,7 @@ HRESULT QtCeGetClipboard(IDataObject** obj)
if (clipData == 0) {
clipData = GetClipboardData(CF_UNICODETEXT);
if (clipData != 0)
- clipText = QString::fromUtf16((unsigned short *)clipData);
+ clipText = QString::fromWCharArray((wchar_t *)clipData);
} else {
clipText = QString::fromLatin1((const char*)clipData);
}
@@ -325,13 +325,7 @@ bool QClipboard::event(QEvent *e)
}
if (propagate && d->nextClipboardViewer) {
- QT_WA({
- SendMessage(d->nextClipboardViewer, m->message,
- m->wParam, m->lParam);
- } , {
- SendMessageA(d->nextClipboardViewer, m->message,
- m->wParam, m->lParam);
- });
+ SendMessage(d->nextClipboardViewer, m->message, m->wParam, m->lParam);
}
return true;
diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/gui/kernel/qcocoapanel_mac.mm
index bdc7ecb..1e0bbdf 100644
--- a/src/gui/kernel/qcocoapanel_mac.mm
+++ b/src/gui/kernel/qcocoapanel_mac.mm
@@ -85,6 +85,12 @@ QT_USE_NAMESPACE
last resort (i.e., this is code that can potentially be removed).
*/
+- (void)toggleToolbarShown:(id)sender
+{
+ macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]);
+ [super toggleToolbarShown:sender];
+}
+
- (void)keyDown:(NSEvent *)theEvent
{
bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 52685ca..3bc348c 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -550,15 +550,7 @@ extern "C" {
qwidget->objectName().local8Bit().data());
#endif
QPainter p(qwidget);
- QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(qwidget->parent());
- QPoint scrollAreaOffset;
- if (scrollArea && scrollArea->viewport() == qwidget) {
- QAbstractScrollAreaPrivate *priv
- = static_cast<QAbstractScrollAreaPrivate *>(qt_widget_private(scrollArea));
- scrollAreaOffset = priv->contentsOffset();
- p.translate(-scrollAreaOffset);
- }
- qwidgetprivate->paintBackground(&p, qrgn, scrollAreaOffset,
+ qwidgetprivate->paintBackground(&p, qrgn,
qwidget->isWindow() ? QWidgetPrivate::DrawAsRoot : 0);
p.end();
}
@@ -1047,7 +1039,7 @@ extern "C" {
- (void) insertText:(id)aString
{
- if ([aString length]) {
+ if ([aString length] && composing) {
// Send the commit string to the widget.
QString commitText;
if ([aString isKindOfClass:[NSAttributedString class]]) {
@@ -1060,7 +1052,14 @@ extern "C" {
QInputMethodEvent e;
e.setCommitString(commitText);
qt_sendSpontaneousEvent(qwidget, &e);
+ } else {
+ // The key sequence "`q" on a French Keyboard will generate two calls to insertText before
+ // it returns from interpretKeyEvents. The first call will turn off 'composing' and accept
+ // the "`" key. The last keyDown event needs to be processed by the widget to get the
+ // character "q". The string parameter is ignored for the second call.
+ sendKeyEvents = true;
}
+
composingText->clear();
}
diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm
index 7084416..eb08982 100644
--- a/src/gui/kernel/qcocoawindow_mac.mm
+++ b/src/gui/kernel/qcocoawindow_mac.mm
@@ -104,6 +104,12 @@ QT_USE_NAMESPACE
last resort (i.e., this is code that can potentially be removed).
*/
+- (void)toggleToolbarShown:(id)sender
+{
+ macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]);
+ [super toggleToolbarShown:sender];
+}
+
- (void)keyDown:(NSEvent *)theEvent
{
bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
diff --git a/src/gui/kernel/qcursor_win.cpp b/src/gui/kernel/qcursor_win.cpp
index f0dc108..26e395c 100644
--- a/src/gui/kernel/qcursor_win.cpp
+++ b/src/gui/kernel/qcursor_win.cpp
@@ -317,54 +317,50 @@ void QCursorData::update()
phand_bits, phandm_bits
};
- unsigned short *sh;
+ wchar_t *sh = 0;
switch (cshape) { // map to windows cursor
case Qt::ArrowCursor:
- sh = (unsigned short*)IDC_ARROW;
+ sh = IDC_ARROW;
break;
case Qt::UpArrowCursor:
- sh = (unsigned short*)IDC_UPARROW;
+ sh = IDC_UPARROW;
break;
case Qt::CrossCursor:
- sh = (unsigned short*)IDC_CROSS;
+ sh = IDC_CROSS;
break;
case Qt::WaitCursor:
- sh = (unsigned short*)IDC_WAIT;
+ sh = IDC_WAIT;
break;
case Qt::IBeamCursor:
- sh = (unsigned short*)IDC_IBEAM;
+ sh = IDC_IBEAM;
break;
case Qt::SizeVerCursor:
- sh = (unsigned short*)IDC_SIZENS;
+ sh = IDC_SIZENS;
break;
case Qt::SizeHorCursor:
- sh = (unsigned short*)IDC_SIZEWE;
+ sh = IDC_SIZEWE;
break;
case Qt::SizeBDiagCursor:
- sh = (unsigned short*)IDC_SIZENESW;
+ sh = IDC_SIZENESW;
break;
case Qt::SizeFDiagCursor:
- sh = (unsigned short*)IDC_SIZENWSE;
+ sh = IDC_SIZENWSE;
break;
case Qt::SizeAllCursor:
- sh = (unsigned short*)IDC_SIZEALL;
+ sh = IDC_SIZEALL;
break;
case Qt::ForbiddenCursor:
- sh = (unsigned short*)IDC_NO;
+ sh = IDC_NO;
break;
case Qt::WhatsThisCursor:
- sh = (unsigned short*)IDC_HELP;
+ sh = IDC_HELP;
break;
case Qt::BusyCursor:
- sh = (unsigned short*)IDC_APPSTARTING;
+ sh = IDC_APPSTARTING;
break;
case Qt::PointingHandCursor:
- if ((QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) > QSysInfo::WV_95 ||
- (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) > QSysInfo::WV_NT) {
- sh = (unsigned short*)IDC_HAND;
- break;
- }
- // fall through
+ sh = IDC_HAND;
+ break;
case Qt::BlankCursor:
case Qt::SplitVCursor:
case Qt::SplitHCursor:
@@ -480,13 +476,11 @@ void QCursorData::update()
qWarning("QCursor::update: Invalid cursor shape %d", cshape);
return;
}
- // ### From MSDN:
- // ### LoadCursor has been superseded by the LoadImage function.
- QT_WA({
- hcurs = LoadCursorW(0, reinterpret_cast<const TCHAR *>(sh));
- } , {
- hcurs = LoadCursorA(0, reinterpret_cast<const char*>(sh));
- });
+#ifdef Q_WS_WINCE
+ hcurs = LoadCursor(0, sh);
+#else
+ hcurs = (HCURSOR)LoadImage(0, sh, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
+#endif
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdesktopwidget.h b/src/gui/kernel/qdesktopwidget.h
index 470f10a..a21ae9d 100644
--- a/src/gui/kernel/qdesktopwidget.h
+++ b/src/gui/kernel/qdesktopwidget.h
@@ -56,6 +56,9 @@ class QDesktopWidgetPrivate;
class Q_GUI_EXPORT QDesktopWidget : public QWidget
{
Q_OBJECT
+ Q_PROPERTY(bool virtualDesktop READ isVirtualDesktop)
+ Q_PROPERTY(int screenCount READ screenCount NOTIFY screenCountChanged)
+ Q_PROPERTY(int primaryScreen READ primaryScreen)
public:
QDesktopWidget();
~QDesktopWidget();
@@ -63,6 +66,7 @@ public:
bool isVirtualDesktop() const;
int numScreens() const;
+ int screenCount() const;
int primaryScreen() const;
int screenNumber(const QWidget *widget = 0) const;
@@ -85,6 +89,7 @@ public:
Q_SIGNALS:
void resized(int);
void workAreaResized(int);
+ void screenCountChanged(int);
protected:
void resizeEvent(QResizeEvent *e);
@@ -97,6 +102,9 @@ private:
friend class QApplicationPrivate;
};
+inline int QDesktopWidget::screenCount() const
+{ return numScreens(); }
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/kernel/qdesktopwidget_mac.mm b/src/gui/kernel/qdesktopwidget_mac.mm
index 2489fe4..705387d 100644
--- a/src/gui/kernel/qdesktopwidget_mac.mm
+++ b/src/gui/kernel/qdesktopwidget_mac.mm
@@ -97,15 +97,13 @@ QT_USE_NAMESPACE
Q_GLOBAL_STATIC(QDesktopWidgetImplementation, qdesktopWidgetImplementation)
QDesktopWidgetImplementation::QDesktopWidgetImplementation()
- : appScreen(0), displays(0)
+ : appScreen(0)
{
onResize();
}
QDesktopWidgetImplementation::~QDesktopWidgetImplementation()
{
- if (displays)
- [displays release];
}
QDesktopWidgetImplementation *QDesktopWidgetImplementation::instance()
@@ -118,13 +116,7 @@ QRect QDesktopWidgetImplementation::availableRect(int screenIndex) const
if (screenIndex < 0 || screenIndex >= screenCount)
screenIndex = appScreen;
- NSRect r = [[displays objectAtIndex:screenIndex] visibleFrame];
- NSRect primaryRect = [[displays objectAtIndex:0] frame];
-
- const int flippedY = - r.origin.y + // account for position offset and
- primaryRect.size.height - r.size.height; // height difference.
- return QRectF(r.origin.x, flippedY,
- r.size.width, r.size.height).toRect();
+ return availableRects[screenIndex].toRect();
}
QRect QDesktopWidgetImplementation::screenRect(int screenIndex) const
@@ -132,22 +124,28 @@ QRect QDesktopWidgetImplementation::screenRect(int screenIndex) const
if (screenIndex < 0 || screenIndex >= screenCount)
screenIndex = appScreen;
- NSRect r = [[displays objectAtIndex:screenIndex] frame];
- NSRect primaryRect = [[displays objectAtIndex:0] frame];
-
- const int flippedY = - r.origin.y + // account for position offset and
- primaryRect.size.height - r.size.height; // height difference.
- return QRectF(r.origin.x, flippedY,
- r.size.width, r.size.height).toRect();
+ return screenRects[screenIndex].toRect();
}
void QDesktopWidgetImplementation::onResize()
{
- if (displays)
- [displays release];
-
- displays = [[NSScreen screens] retain];
- screenCount = [displays count];
+ QMacCocoaAutoReleasePool pool;
+ NSArray *displays = [NSScreen screens];
+ screenCount = [displays count];
+
+ screenRects.clear();
+ availableRects.clear();
+ NSRect primaryRect = [[displays objectAtIndex:0] frame];
+ for (int i = 0; i<screenCount; i++) {
+ NSRect r = [[displays objectAtIndex:i] frame];
+ const int flippedY = - r.origin.y + // account for position offset and
+ primaryRect.size.height - r.size.height; // height difference.
+ screenRects.append(QRectF(r.origin.x, flippedY,
+ r.size.width, r.size.height));
+ r = [[displays objectAtIndex:i] visibleFrame];
+ availableRects.append(QRectF(r.origin.x, flippedY,
+ r.size.width, r.size.height));
+ }
}
@@ -195,7 +193,7 @@ const QRect QDesktopWidget::screenGeometry(int screen) const
int QDesktopWidget::screenNumber(const QWidget *widget) const
{
- QDesktopWidgetImplementation *d = qdesktopWidgetImplementation();
+ QDesktopWidgetImplementation *d = qdesktopWidgetImplementation();
if (!widget)
return d->appScreen;
QRect frame = widget->frameGeometry();
@@ -216,7 +214,7 @@ int QDesktopWidget::screenNumber(const QWidget *widget) const
int QDesktopWidget::screenNumber(const QPoint &point) const
{
- QDesktopWidgetImplementation *d = qdesktopWidgetImplementation();
+ QDesktopWidgetImplementation *d = qdesktopWidgetImplementation();
int closestScreen = -1;
int shortestDistance = INT_MAX;
for (int i = 0; i < d->screenCount; ++i) {
@@ -232,13 +230,25 @@ int QDesktopWidget::screenNumber(const QPoint &point) const
void QDesktopWidget::resizeEvent(QResizeEvent *)
{
- QDesktopWidgetImplementation *d = qdesktopWidgetImplementation();
+ QDesktopWidgetImplementation *d = qdesktopWidgetImplementation();
+
+ const int oldScreenCount = d->screenCount;
+ const QVector<QRectF> oldRects(d->screenRects);
+ const QVector<QRectF> oldWorks(d->availableRects);
d->onResize();
- for (int i = 0; i < d->screenCount; ++i) {
- emit resized(i);
+ for (int i = 0; i < qMin(oldScreenCount, d->screenCount); ++i) {
+ if (oldRects.at(i) != d->screenRects.at(i))
+ emit resized(i);
+ }
+ for (int i = 0; i < qMin(oldScreenCount, d->screenCount); ++i) {
+ if (oldWorks.at(i) != d->availableRects.at(i))
+ emit workAreaResized(i);
}
+
+ if (oldScreenCount != d->screenCount)
+ emit screenCountChanged(d->screenCount);
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdesktopwidget_mac_p.h b/src/gui/kernel/qdesktopwidget_mac_p.h
index 0fdc455..e9d5d9f 100644
--- a/src/gui/kernel/qdesktopwidget_mac_p.h
+++ b/src/gui/kernel/qdesktopwidget_mac_p.h
@@ -64,7 +64,8 @@ public:
int appScreen;
int screenCount;
- NSArray *displays;
+ QVector<QRectF> availableRects;
+ QVector<QRectF> screenRects;
QRect availableRect(int screenIndex) const;
QRect screenRect(int screenIndex) const;
diff --git a/src/gui/kernel/qdesktopwidget_win.cpp b/src/gui/kernel/qdesktopwidget_win.cpp
index aa290c4..a89e08f 100644
--- a/src/gui/kernel/qdesktopwidget_win.cpp
+++ b/src/gui/kernel/qdesktopwidget_win.cpp
@@ -152,41 +152,27 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that)
rects = new QVector<QRect>();
workrects = new QVector<QRect>();
+ screenCount = 0;
#ifndef Q_OS_WINCE
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- screenCount = 0;
- // Trying to get the function pointers to Win98/2000 only functions
- QLibrary user32Lib(QLatin1String("user32"));
- if (!user32Lib.load())
- return;
+ QLibrary user32Lib(QLatin1String("user32"));
+ if (user32Lib.load()) {
enumDisplayMonitors = (EnumFunc)user32Lib.resolve("EnumDisplayMonitors");
- QT_WA({
- getMonitorInfo = (InfoFunc)user32Lib.resolve("GetMonitorInfoW");
- } , {
- getMonitorInfo = (InfoFunc)user32Lib.resolve("GetMonitorInfoA");
- });
-
- if (!enumDisplayMonitors || !getMonitorInfo) {
- screenCount = GetSystemMetrics(80); // SM_CMONITORS
- rects->resize(screenCount);
- for (int i = 0; i < screenCount; ++i)
- rects->replace(i, that->rect());
- return;
- }
- // Calls enumCallback
- enumDisplayMonitors(0, 0, enumCallback, 0);
- enumDisplayMonitors = 0;
- getMonitorInfo = 0;
- } else {
- rects->resize(1);
- rects->replace(0, that->rect());
- workrects->resize(1);
- workrects->replace(0, that->rect());
+ getMonitorInfo = (InfoFunc)user32Lib.resolve("GetMonitorInfoW");
}
-#else
- screenCount = 0;
+ if (!enumDisplayMonitors || !getMonitorInfo) {
+ screenCount = GetSystemMetrics(80); // SM_CMONITORS
+ rects->resize(screenCount);
+ for (int i = 0; i < screenCount; ++i)
+ rects->replace(i, that->rect());
+ return;
+ }
+ // Calls enumCallback
+ enumDisplayMonitors(0, 0, enumCallback, 0);
+ enumDisplayMonitors = 0;
+ getMonitorInfo = 0;
+#else
QLibrary coreLib(QLatin1String("coredll"));
if (coreLib.load()) {
// CE >= 4.0 case
@@ -307,80 +293,69 @@ const QRect QDesktopWidget::availableGeometry(int screen) const
for(int i=0; i < d->workrects->size(); ++i)
qt_get_sip_info((*d->workrects)[i]);
#endif
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- if (screen < 0 || screen >= d->screenCount)
- screen = d->primaryScreen;
+ if (screen < 0 || screen >= d->screenCount)
+ screen = d->primaryScreen;
- return d->workrects->at(screen);
- } else {
- return d->workrects->at(d->primaryScreen);
- }
+ return d->workrects->at(screen);
}
const QRect QDesktopWidget::screenGeometry(int screen) const
{
const QDesktopWidgetPrivate *d = d_func();
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- if (screen < 0 || screen >= d->screenCount)
- screen = d->primaryScreen;
+ if (screen < 0 || screen >= d->screenCount)
+ screen = d->primaryScreen;
- return d->rects->at(screen);
- } else {
- return d->rects->at(d->primaryScreen);
- }
+ return d->rects->at(screen);
}
int QDesktopWidget::screenNumber(const QWidget *widget) const
{
Q_D(const QDesktopWidget);
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- if (!widget)
- return d->primaryScreen;
- QRect frame = widget->frameGeometry();
- if (!widget->isWindow())
- frame.moveTopLeft(widget->mapToGlobal(QPoint(0,0)));
-
- int maxSize = -1;
- int maxScreen = -1;
-
- for (int i = 0; i < d->screenCount; ++i) {
- QRect sect = d->rects->at(i).intersected(frame);
- int size = sect.width() * sect.height();
- if (size > maxSize && sect.width() > 0 && sect.height() > 0) {
- maxSize = size;
- maxScreen = i;
- }
- }
- return maxScreen;
- } else {
+ if (!widget)
return d->primaryScreen;
+
+ QRect frame = widget->frameGeometry();
+ if (!widget->isWindow())
+ frame.moveTopLeft(widget->mapToGlobal(QPoint(0,0)));
+
+ int maxSize = -1;
+ int maxScreen = -1;
+
+ for (int i = 0; i < d->screenCount; ++i) {
+ QRect sect = d->rects->at(i).intersected(frame);
+ int size = sect.width() * sect.height();
+ if (size > maxSize && sect.width() > 0 && sect.height() > 0) {
+ maxSize = size;
+ maxScreen = i;
+ }
}
+
+ return maxScreen;
}
int QDesktopWidget::screenNumber(const QPoint &point) const
{
Q_D(const QDesktopWidget);
+
int closestScreen = -1;
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- int shortestDistance = INT_MAX;
- for (int i = 0; i < d->screenCount; ++i) {
- int thisDistance = d->pointToRect(point, d->rects->at(i));
- if (thisDistance < shortestDistance) {
- shortestDistance = thisDistance;
- closestScreen = i;
- }
+ int shortestDistance = INT_MAX;
+
+ for (int i = 0; i < d->screenCount; ++i) {
+ int thisDistance = d->pointToRect(point, d->rects->at(i));
+ if (thisDistance < shortestDistance) {
+ shortestDistance = thisDistance;
+ closestScreen = i;
}
}
+
return closestScreen;
}
void QDesktopWidget::resizeEvent(QResizeEvent *)
{
Q_D(QDesktopWidget);
- QVector<QRect> oldrects;
- oldrects = *d->rects;
- QVector<QRect> oldworkrects;
- oldworkrects = *d->workrects;
+ const QVector<QRect> oldrects(*d->rects);
+ const QVector<QRect> oldworkrects(*d->workrects);
int oldscreencount = d->screenCount;
QDesktopWidgetPrivate::cleanup();
@@ -391,18 +366,22 @@ void QDesktopWidget::resizeEvent(QResizeEvent *)
#endif
for (int i = 0; i < qMin(oldscreencount, d->screenCount); ++i) {
- QRect oldrect = oldrects[i];
- QRect newrect = d->rects->at(i);
+ const QRect oldrect = oldrects[i];
+ const QRect newrect = d->rects->at(i);
if (oldrect != newrect)
emit resized(i);
}
for (int j = 0; j < qMin(oldscreencount, d->screenCount); ++j) {
- QRect oldrect = oldworkrects[j];
- QRect newrect = d->workrects->at(j);
+ const QRect oldrect = oldworkrects[j];
+ const QRect newrect = d->workrects->at(j);
if (oldrect != newrect)
emit workAreaResized(j);
}
+
+ if (oldscreencount != d->screenCount) {
+ emit screenCountChanged(d->screenCount);
+ }
}
#ifdef Q_CC_MSVC
diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp
index 59d3239..1555fc0 100644
--- a/src/gui/kernel/qdesktopwidget_x11.cpp
+++ b/src/gui/kernel/qdesktopwidget_x11.cpp
@@ -372,7 +372,32 @@ int QDesktopWidget::screenNumber(const QPoint &point) const
void QDesktopWidget::resizeEvent(QResizeEvent *event)
{
Q_D(QDesktopWidget);
+ int oldScreenCount = d->screenCount;
+ QVector<QRect> oldRects(oldScreenCount);
+ QVector<QRect> oldWorks(oldScreenCount);
+ for (int i = 0; i < oldScreenCount; ++i) {
+ oldRects[i] = d->rects[i];
+ oldWorks[i] = d->workareas[i];
+ }
+
d->init();
+
+ for (int i = 0; i < qMin(oldScreenCount, d->screenCount); ++i) {
+ if (oldRects.at(i) != d->rects[i])
+ emit resized(i);
+ }
+
+ // ### workareas are just reset by init, not filled with new values
+ // ### so this will not work correctly
+ for (int j = 0; j < qMin(oldScreenCount, d->screenCount); ++j) {
+ if (oldWorks.at(j) != d->workareas[j])
+ emit workAreaResized(j);
+ }
+
+ if (oldScreenCount != d->screenCount) {
+ emit screenCountChanged(d->screenCount);
+ }
+
qt_desktopwidget_workarea_dirty = true;
QWidget::resizeEvent(event);
}
diff --git a/src/gui/kernel/qdirectionrecognizer.cpp b/src/gui/kernel/qdirectionrecognizer.cpp
deleted file mode 100644
index a1bc5b1..0000000
--- a/src/gui/kernel/qdirectionrecognizer.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectionrecognizer_p.h"
-
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI 3.141592653589793238462643
-#endif
-
-QT_BEGIN_NAMESPACE
-
-enum {
- DistanceDelta = 20
-};
-
-QDirectionSimpleRecognizer::QDirectionSimpleRecognizer()
-{
-}
-
-Direction QDirectionSimpleRecognizer::addPosition(const QPoint &pos)
-{
- if (!directions.isEmpty()) {
- const QPoint tmp = pos - directions.back().point;
- if (tmp.manhattanLength() < 5)
- return Direction();
- }
- if (lastPoint.isNull()) {
- lastPoint = pos;
- return Direction();
- }
- int dx = pos.x() - lastPoint.x();
- int dy = pos.y() - lastPoint.y();
- Qt::DirectionType direction = Qt::NoDirection;
- if (dx < 0) {
- if (-1*dx >= DistanceDelta/2)
- direction = Qt::LeftDirection;
- } else {
- if (dx >= DistanceDelta/2)
- direction = Qt::RightDirection;
- }
- if (dy < 0) {
- if (-1*dy >= DistanceDelta/2)
- direction = Qt::UpDirection;
- } else {
- if (dy >= DistanceDelta/2)
- direction = Qt::DownDirection;
- }
- if (direction == Qt::NoDirection)
- return Direction();
-
- lastPoint = pos;
- directions.push_back(Direction(direction, pos));
- return Direction(direction, pos);
-}
-
-
-DirectionList QDirectionSimpleRecognizer::getDirections() const
-{
- return directions;
-}
-
-void QDirectionSimpleRecognizer::reset()
-{
- directions.clear();
- lastPoint = QPoint();
-}
-
-
-/// QDirectionDiagonalRecognizer
-
-QDirectionDiagonalRecognizer::QDirectionDiagonalRecognizer()
-{
-}
-
-Direction QDirectionDiagonalRecognizer::addPosition(const QPoint &pos)
-{
- if (!directions.isEmpty()) {
- const QPoint tmp = pos - directions.back().point;
- if (tmp.manhattanLength() < 5)
- return Direction();
- }
- if (lastPoint.isNull()) {
- lastPoint = pos;
- return Direction();
- }
- int dx = pos.x() - lastPoint.x();
- int dy = pos.y() - lastPoint.y();
- int distance = sqrt(static_cast<double>(dx*dx + dy*dy));
- if (distance < DistanceDelta/2)
- return Direction();
-
- Qt::DirectionType direction = Qt::NoDirection;
- double angle = atan(1.0*qAbs(lastPoint.y() - pos.y())/qAbs(pos.x() - lastPoint.x())) * 180. / M_PI;
- if (dx < 0 && dy <= 0) {
- angle = 180 - angle;
- } else if (dx <= 0 && dy > 0) {
- angle += 180;
- } else if (dx > 0 && dy > 0) {
- angle = 360-angle;
- }
- if (angle < 0)
- angle += 360;
- if (angle <= 20)
- direction = Qt::RightDirection;
- else if (angle <= 65)
- direction = Qt::RightUpDirection;
- else if (angle <= 110)
- direction = Qt::UpDirection;
- else if (angle <= 155)
- direction = Qt::LeftUpDirection;
- else if (angle <= 200)
- direction = Qt::LeftDirection;
- else if (angle <= 245)
- direction = Qt::LeftDownDirection;
- else if (angle <= 290)
- direction = Qt::DownDirection;
- else if (angle <= 335)
- direction = Qt::RightDownDirection;
- else
- direction = Qt::RightDirection;
-
- if (direction == Qt::NoDirection)
- return Direction();
-
- lastPoint = pos;
- directions.push_back(Direction(direction, pos));
- return Direction(direction, pos);
-}
-
-
-DirectionList QDirectionDiagonalRecognizer::getDirections() const
-{
- return directions;
-}
-
-void QDirectionDiagonalRecognizer::reset()
-{
- directions.clear();
- lastPoint = QPoint();
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdirectionsimplificator_p.h b/src/gui/kernel/qdirectionsimplificator_p.h
deleted file mode 100644
index d7491dc..0000000
--- a/src/gui/kernel/qdirectionsimplificator_p.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDIRECTIONSIMPLIFICATOR_P_H
-#define QDIRECTIONSIMPLIFICATOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qdirectionrecognizer_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QDirectionSimplificator
-{
-public:
- QDirectionSimplificator(const DirectionList &dir);
-
- bool simplify(DirectionList *result);
-
-private:
- DirectionList directions;
- DirectionList lastResult;
- enum State {
- None,
- Trim, // remove first and last element
- AccidentalMoves, // 66866 => 6666
- ComplexAccidentalMoves, // 778788 => 777888 (swapping elements without changing direction)
- ShortMoves, // (moves of length 1)
- } state;
-
- struct SimplifyTrim
- {
- SimplifyTrim() : state(0) { }
- bool operator()(DirectionList &directions)
- {
- if (state == 0) {
- directions.removeFirst();
- state = 1;
- } else if (state == 1) {
- directions.removeLast();
- state = 2;
- } else if (state == 2 && directions.size() >= 2) {
- directions.removeFirst();
- directions.removeLast();
- state = 3;
- } else {
- return false;
- }
- return true;
- }
- int state;
- };
- struct SimplifyAccidentalMoves
- {
- SimplifyAccidentalMoves() : state(0) { }
- bool operator()(DirectionList &directions)
- {
- return false;
- }
- int state;
- };
- struct SimplifyComplexAccidentalMoves
- {
- SimplifyComplexAccidentalMoves() : state(0) { }
- bool operator()(DirectionList &directions)
- {
- return false;
- }
- int state;
- };
-
- SimplifyTrim trim;
- SimplifyAccidentalMoves accidentalMoves;
- SimplifyComplexAccidentalMoves complexAccidentalMoves;
- //SimplifyShortMoves shortMoves;
-};
-
-QDirectionSimplificator::QDirectionSimplificator(const DirectionList &dir)
- : directions(dir), state(None)
-{
-}
-
-bool QDirectionSimplificator::simplify(DirectionList *result)
-{
- if (directions.isEmpty() || !result)
- return false;
- *result = directions;
- switch(state) {
- case None:
- state = Trim;
- trim = SimplifyTrim();
- case Trim:
- if (trim(*result))
- break;
- *result = lastResult;
- state = AccidentalMoves;
- accidentalMoves = SimplifyAccidentalMoves();
- case AccidentalMoves:
- if (accidentalMoves(*result))
- break;
- *result = lastResult;
- state = ComplexAccidentalMoves;
- complexAccidentalMoves = SimplifyComplexAccidentalMoves();
- case ComplexAccidentalMoves:
- if (complexAccidentalMoves(*result))
- break;
- *result = lastResult;
- // state = ShortMoves;
- // shortMoves = SimplifyShortMoves();
- // case ShortMoves:
- // if (shortMoves(*result))
- // break;
- // state = None;
- default:
- return false;
- }
- lastResult = *result;
- if (lastResult.isEmpty())
- return false;
- return true;
-}
-
-QT_END_NAMESPACE
-
-#endif // QDIRECTIONSIMPLIFICATOR_P_H
diff --git a/src/gui/kernel/qdnd_mac.mm b/src/gui/kernel/qdnd_mac.mm
index b244d84..99399da 100644
--- a/src/gui/kernel/qdnd_mac.mm
+++ b/src/gui/kernel/qdnd_mac.mm
@@ -405,12 +405,12 @@ bool QWidgetPrivate::qt_mac_dnd_event(uint kind, DragRef dragRef)
SetDragDropAction(dragRef, qt_mac_dnd_map_qt_actions(qDEEvent.dropAction()));
if (!qDEEvent.isAccepted())
- // The widget is simply not interrested in this
+ // The widget is simply not interested in this
// drag. So tell carbon this by returning 'false'. We will then
// not receive any further move, drop or leave events for this widget.
return false;
else {
- // Documentation states that a drag move event is sendt immidiatly after
+ // Documentation states that a drag move event is sent immediately after
// a drag enter event. So we do that. This will honor widgets overriding
// 'dragMoveEvent' only, and not 'dragEnterEvent'
QDragMoveEvent qDMEvent(q->mapFromGlobal(QPoint(mouse.h, mouse.v)), qtAllowed, dropdata,
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index deb52a7..852c86c 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -65,7 +65,7 @@
#endif
#if defined(Q_WS_WIN)
-# include <windows.h>
+# include <qt_windows.h>
# include <objidl.h>
#endif
diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp
index 99c960c..70f89d2 100644
--- a/src/gui/kernel/qdnd_win.cpp
+++ b/src/gui/kernel/qdnd_win.cpp
@@ -154,9 +154,9 @@ QOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
#ifdef QDND_DEBUG
qDebug("QOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)");
#ifndef Q_OS_WINCE
- char buf[256] = {0};
- GetClipboardFormatNameA(pformatetc->cfFormat, buf, 255);
- qDebug("CF = %d : %s", pformatetc->cfFormat, buf);
+ wchar_t buf[256] = {0};
+ GetClipboardFormatName(pformatetc->cfFormat, buf, 255);
+ qDebug("CF = %d : %s", pformatetc->cfFormat, QString::fromWCharArray(buf));
#endif
#endif
@@ -398,52 +398,47 @@ void QOleDropSource::createCursors()
int h = cpm.height();
if (!pm.isNull()) {
- int x1 = qMin(-hotSpot.x(),0);
- int x2 = qMax(pm.width()-hotSpot.x(),cpm.width());
- int y1 = qMin(-hotSpot.y(),0);
- int y2 = qMax(pm.height()-hotSpot.y(),cpm.height());
+ int x1 = qMin(-hotSpot.x(), 0);
+ int x2 = qMax(pm.width() - hotSpot.x(), cpm.width());
+ int y1 = qMin(-hotSpot.y(), 0);
+ int y2 = qMax(pm.height() - hotSpot.y(), cpm.height());
- w = x2-x1+1;
- h = y2-y1+1;
+ w = x2 - x1 + 1;
+ h = y2 - y1 + 1;
}
QRect srcRect = pm.rect();
QPoint pmDest = QPoint(qMax(0, -hotSpot.x()), qMax(0, -hotSpot.y()));
QPoint newHotSpot = hotSpot;
-#if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS)
- bool limitedCursorSize = (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)
- || (QSysInfo::WindowsVersion == QSysInfo::WV_NT)
- || (QSysInfo::WindowsVersion == QSysInfo::WV_CE);
-
- if (limitedCursorSize) {
- // Limited cursor size
- int reqw = GetSystemMetrics(SM_CXCURSOR);
- int reqh = GetSystemMetrics(SM_CYCURSOR);
-
- QPoint hotspotInPM = newHotSpot - pmDest;
- if (reqw < w) {
- // Not wide enough - move objectpm right
- qreal r = qreal(newHotSpot.x()) / w;
- newHotSpot = QPoint(int(r * reqw), newHotSpot.y());
- if (newHotSpot.x() + cpm.width() > reqw)
- newHotSpot.setX(reqw - cpm.width());
-
- srcRect = QRect(QPoint(hotspotInPM.x() - newHotSpot.x(), srcRect.top()), QSize(reqw, srcRect.height()));
- }
- if (reqh < h) {
- qreal r = qreal(newHotSpot.y()) / h;
- newHotSpot = QPoint(newHotSpot.x(), int(r * reqh));
- if (newHotSpot.y() + cpm.height() > reqh)
- newHotSpot.setY(reqh - cpm.height());
-
- srcRect = QRect(QPoint(srcRect.left(), hotspotInPM.y() - newHotSpot.y()), QSize(srcRect.width(), reqh));
- }
- // Always use system cursor size
- w = reqw;
- h = reqh;
+#if defined(Q_OS_WINCE)
+ // Limited cursor size
+ int reqw = GetSystemMetrics(SM_CXCURSOR);
+ int reqh = GetSystemMetrics(SM_CYCURSOR);
+
+ QPoint hotspotInPM = newHotSpot - pmDest;
+ if (reqw < w) {
+ // Not wide enough - move objectpm right
+ qreal r = qreal(newHotSpot.x()) / w;
+ newHotSpot = QPoint(int(r * reqw), newHotSpot.y());
+ if (newHotSpot.x() + cpm.width() > reqw)
+ newHotSpot.setX(reqw - cpm.width());
+
+ srcRect = QRect(QPoint(hotspotInPM.x() - newHotSpot.x(), srcRect.top()), QSize(reqw, srcRect.height()));
}
+ if (reqh < h) {
+ qreal r = qreal(newHotSpot.y()) / h;
+ newHotSpot = QPoint(newHotSpot.x(), int(r * reqh));
+ if (newHotSpot.y() + cpm.height() > reqh)
+ newHotSpot.setY(reqh - cpm.height());
+
+ srcRect = QRect(QPoint(srcRect.left(), hotspotInPM.y() - newHotSpot.y()), QSize(srcRect.width(), reqh));
+ }
+ // Always use system cursor size
+ w = reqw;
+ h = reqh;
#endif
+
QPixmap newCursor(w, h);
if (!pm.isNull()) {
newCursor.fill(QColor(0, 0, 0, 0));
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 8e92243..a6a87b7 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -53,8 +53,6 @@
QT_BEGIN_NAMESPACE
-QString qt_getStandardGestureTypeName(Qt::GestureType type);
-
/*!
\class QInputEvent
\ingroup events
@@ -116,8 +114,12 @@ QInputEvent::~QInputEvent()
propagated up the parent widget chain until a widget accepts it
with accept(), or an event filter consumes it.
+ \note If a mouse event is propagated to a \l{QWidget}{widget} for
+ which Qt::WA_NoMousePropagation has been set, that mouse event
+ will not be propagated further up the parent widget chain.
+
The state of the keyboard modifier keys can be found by calling the
- \l{QInputEvent::modifiers()}{modifiers()} function, inhertied from
+ \l{QInputEvent::modifiers()}{modifiers()} function, inherited from
QInputEvent.
The functions pos(), x(), and y() give the cursor position
@@ -3343,9 +3345,6 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast<const QChildEvent*>(e))->child();
return dbg.space();
- case QEvent::Gesture:
- n = "Gesture";
- break;
default:
dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')';
return dbg.space();
@@ -3542,167 +3541,24 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar)
#endif
-/*!
- \class QGestureEvent
- \since 4.6
- \ingroup events
-
- \brief The QGestureEvent class provides the parameters used for
- gesture recognition.
-
- The QGestureEvent class contains a list of gestures that are being
- executed right now (\l{QGestureEvent::}{gestureTypes()}) and a
- list of gestures that are cancelled (the gesture might be
- cancelled because the window lost focus, or because of timeout,
- etc).
-
- \sa QGesture
-*/
-
-/*!
- Creates new QGestureEvent containing a list of \a gestures that
- are being executed and a list of gesture that were cancelled (\a
- cancelledGestures).
-*/
-QGestureEvent::QGestureEvent(const QSet<QGesture*> &gestures,
- const QSet<QString> &cancelledGestures)
- : QEvent(QEvent::Gesture), m_cancelledGestures(cancelledGestures)
-{
- setAccepted(false);
- foreach(QGesture *r, gestures)
- m_gestures.insert(r->type(), r);
-}
-
-/*!
- Destroys the QGestureEvent object.
-*/
-QGestureEvent::~QGestureEvent()
-{
-}
-
-/*!
- Returns true if the gesture event contains gesture of specific \a
- type; returns false otherwise.
-*/
-bool QGestureEvent::contains(Qt::GestureType type) const
-{
- return contains(qt_getStandardGestureTypeName(type));
-}
-
-/*!
- Returns true if the gesture event contains gesture of specific \a
- type; returns false otherwise.
-*/
-bool QGestureEvent::contains(const QString &type) const
-{
- return gesture(type) != 0;
-}
-
-/*!
- Returns a list of gesture names that this event contains.
-*/
-QList<QString> QGestureEvent::gestureTypes() const
-{
- return m_gestures.keys();
-}
-
-/*!
- Returns extended information about a gesture of specific \a type.
-*/
-const QGesture* QGestureEvent::gesture(Qt::GestureType type) const
-{
- return gesture(qt_getStandardGestureTypeName(type));
-}
-
-/*!
- Returns extended information about a gesture of specific \a type.
-*/
-const QGesture* QGestureEvent::gesture(const QString &type) const
-{
- return m_gestures.value(type, 0);
-}
-
-/*!
- Returns extended information about all gestures in the event.
-*/
-QList<QGesture*> QGestureEvent::gestures() const
-{
- return m_gestures.values();
-}
-
-/*!
- Returns a set of gesture names that used to be executed, but were
- cancelled (i.e. they were not finished properly).
-*/
-QSet<QString> QGestureEvent::cancelledGestures() const
-{
- return m_cancelledGestures;
-}
-
-/*!
- Sets the accept flag of the all gestures inside the event object,
- the equivalent of calling \l{QEvent::accept()}{accept()} or
- \l{QEvent::setAccepted()}{setAccepted(true)}.
-
- Setting the accept parameter indicates that the event receiver
- wants the gesture. Unwanted gestures might be propagated to the parent
- widget.
-*/
-void QGestureEvent::acceptAll()
-{
- QHash<QString, QGesture*>::iterator it = m_gestures.begin(),
- e = m_gestures.end();
- for(; it != e; ++it)
- it.value()->accept();
- setAccepted(true);
-}
-
-/*!
- Sets the accept flag of the specified gesture inside the event
- object, the equivalent of calling
- \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()}
-
- Setting the accept parameter indicates that the event receiver
- wants the gesture. Unwanted gestures might be propagated to the parent
- widget.
-*/
-void QGestureEvent::accept(Qt::GestureType type)
-{
- if (QGesture *g = m_gestures.value(qt_getStandardGestureTypeName(type), 0))
- g->accept();
-}
-
-/*!
- Sets the accept flag of the specified gesture inside the event
- object, the equivalent of calling
- \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()}
-
- Setting the accept parameter indicates that the event receiver
- wants the gesture. Unwanted gestures might be propagated to the parent
- widget.
-*/
-void QGestureEvent::accept(const QString &type)
-{
- if (QGesture *g = m_gestures.value(type, 0))
- g->accept();
-}
-
/*! \class QTouchEvent
- \brief The QTouchEvent class contains parameters that describe a touch event
-.
+ \brief The QTouchEvent class contains parameters that describe a touch event.
\since 4.6
\ingroup events
Touch events occur when pressing, releasing, or moving one or more
touch points on a touch device (such as a touch-screen or
- track-pad), and if the widget has the Qt::WA_AcceptTouchEvents
- attribute.
+ track-pad). To receive touch events, widgets have to have the
+ Qt::WA_AcceptTouchEvents attribute set and graphics items need to have
+ the \l{QGraphicsItem::setAcceptTouchEvents()}{acceptTouchEvents}
+ attribute set to true.
All touch events are of type QEvent::TouchBegin,
QEvent::TouchUpdate, or QEvent::TouchEnd. The touchPoints()
function returns a list of all touch points contained in the event.
- Information about each touch point can be retreived using the
- QTouchEvent::TouchPoint class.
+ Information about each touch point can be retrieved using the
+ QTouchEvent::TouchPoint class. The Qt::TouchPointState enum
+ describes the different states that a touch point may have.
Similar to QMouseEvent, Qt automatically grabs each touch point on
the first press inside a widget; the widget will receive all
@@ -3720,10 +3576,11 @@ void QGestureEvent::accept(const QString &type)
then mouse events are simulated from the state of the first touch
point.
- The Qt::TouchPointState enum describes the different states that a
- touch point may have.
+ Reimplement QWidget::event() for widgets and QGraphicsItem::sceneEvent()
+ for items in a graphics view to receive touch events.
- QTouchEvent::TouchPoint Qt::TouchPointState Qt::WA_AcceptTouchEvents
+ \sa QTouchEvent::TouchPoint, Qt::TouchPointState, Qt::WA_AcceptTouchEvents,
+ QGraphicsItem::acceptTouchEvents()
*/
/*! \enum Qt::TouchPointState
@@ -3741,13 +3598,7 @@ void QGestureEvent::accept(const QString &type)
\omitvalue TouchPointPrimary
*/
-/*! \class QTouchEvent::TouchPoint
- \brief The QTouchEvent::TouchPoint class provide information about a touch point in a QTouchEvent.
- \since 4.6
-*/
-
/*! \enum QTouchEvent::DeviceType
- \since 4.6
This enum represents the type of device that generated a QTouchEvent.
@@ -3826,6 +3677,11 @@ QTouchEvent::~QTouchEvent()
Sets the list of touch points for this event.
*/
+/*! \class QTouchEvent::TouchPoint
+ \brief The QTouchEvent::TouchPoint class provides information about a touch point in a QTouchEvent.
+ \since 4.6
+*/
+
/*! \internal
Constructs a QTouchEvent::TouchPoint for use in a QTouchEvent.
@@ -3885,7 +3741,9 @@ bool QTouchEvent::TouchPoint::isPrimary() const
/*!
Returns the position of this touch point, relative to the widget
- or item that received the event.
+ or QGraphicsItem that received the event.
+
+ \sa startPos(), lastPos(), screenPos(), scenePos(), normalizedPos()
*/
QPointF QTouchEvent::TouchPoint::pos() const
{
@@ -3894,6 +3752,13 @@ QPointF QTouchEvent::TouchPoint::pos() const
/*!
Returns the scene position of this touch point.
+
+ The scene position is the position in QGraphicsScene coordinates
+ if the QTouchEvent is handled by a QGraphicsItem::touchEvent()
+ reimplementation, and identical to the screen position for
+ widgets.
+
+ \sa startScenePos(), lastScenePos(), pos()
*/
QPointF QTouchEvent::TouchPoint::scenePos() const
{
@@ -3902,6 +3767,8 @@ QPointF QTouchEvent::TouchPoint::scenePos() const
/*!
Returns the screen position of this touch point.
+
+ \sa startScreenPos(), lastScreenPos(), pos()
*/
QPointF QTouchEvent::TouchPoint::screenPos() const
{
@@ -3909,8 +3776,12 @@ QPointF QTouchEvent::TouchPoint::screenPos() const
}
/*!
- Returns the position of this touch point. The coordinates are normalized to size of the touch
- device, i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
+ Returns the normalized position of this touch point.
+
+ The coordinates are normalized to the size of the touch device,
+ i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
+
+ \sa startNormalizedPos(), lastNormalizedPos(), pos()
*/
QPointF QTouchEvent::TouchPoint::normalizedPos() const
{
@@ -3919,7 +3790,9 @@ QPointF QTouchEvent::TouchPoint::normalizedPos() const
/*!
Returns the starting position of this touch point, relative to the
- widget that received the event.
+ widget or QGraphicsItem that received the event.
+
+ \sa pos(), lastPos()
*/
QPointF QTouchEvent::TouchPoint::startPos() const
{
@@ -3928,6 +3801,13 @@ QPointF QTouchEvent::TouchPoint::startPos() const
/*!
Returns the starting scene position of this touch point.
+
+ The scene position is the position in QGraphicsScene coordinates
+ if the QTouchEvent is handled by a QGraphicsItem::touchEvent()
+ reimplementation, and identical to the screen position for
+ widgets.
+
+ \sa scenePos(), lastScenePos()
*/
QPointF QTouchEvent::TouchPoint::startScenePos() const
{
@@ -3936,6 +3816,8 @@ QPointF QTouchEvent::TouchPoint::startScenePos() const
/*!
Returns the starting screen position of this touch point.
+
+ \sa screenPos(), lastScreenPos()
*/
QPointF QTouchEvent::TouchPoint::startScreenPos() const
{
@@ -3943,8 +3825,12 @@ QPointF QTouchEvent::TouchPoint::startScreenPos() const
}
/*!
- Returns the starting position of this touch point. The coordinates are normalized to size of
- the touch device, i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
+ Returns the normalized starting position of this touch point.
+
+ The coordinates are normalized to the size of the touch device,
+ i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
+
+ \sa normalizedPos(), lastNormalizedPos()
*/
QPointF QTouchEvent::TouchPoint::startNormalizedPos() const
{
@@ -3953,7 +3839,9 @@ QPointF QTouchEvent::TouchPoint::startNormalizedPos() const
/*!
Returns the position of this touch point from the previous touch
- event, relative to the widget that received the event.
+ event, relative to the widget or QGraphicsItem that received the event.
+
+ \sa pos(), startPos()
*/
QPointF QTouchEvent::TouchPoint::lastPos() const
{
@@ -3963,6 +3851,13 @@ QPointF QTouchEvent::TouchPoint::lastPos() const
/*!
Returns the scene position of this touch point from the previous
touch event.
+
+ The scene position is the position in QGraphicsScene coordinates
+ if the QTouchEvent is handled by a QGraphicsItem::touchEvent()
+ reimplementation, and identical to the screen position for
+ widgets.
+
+ \sa scenePos(), startScenePos()
*/
QPointF QTouchEvent::TouchPoint::lastScenePos() const
{
@@ -3972,6 +3867,8 @@ QPointF QTouchEvent::TouchPoint::lastScenePos() const
/*!
Returns the screen position of this touch point from the previous
touch event.
+
+ \sa screenPos(), startScreenPos()
*/
QPointF QTouchEvent::TouchPoint::lastScreenPos() const
{
@@ -3979,9 +3876,13 @@ QPointF QTouchEvent::TouchPoint::lastScreenPos() const
}
/*!
- Returns the position of this touch point from the previous touch event. The coordinates are
- normalized to size of the touch device, i.e. (0,0) is the top-left corner and (1,1) is the
- bottom-right corner.
+ Returns the normalized position of this touch point from the
+ previous touch event.
+
+ The coordinates are normalized to the size of the touch device,
+ i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
+
+ \sa normalizedPos(), startNormalizedPos()
*/
QPointF QTouchEvent::TouchPoint::lastNormalizedPos() const
{
@@ -3989,8 +3890,11 @@ QPointF QTouchEvent::TouchPoint::lastNormalizedPos() const
}
/*!
- Returns the rect for this touch point. The rect is centered around the point returned by pos().
- Note this function returns an empty rect if the device does not report touch point sizes.
+ Returns the rect for this touch point, relative to the widget
+ or QGraphicsItem that received the event. The rect is centered
+ around the point returned by pos().
+
+ \note This function returns an empty rect if the device does not report touch point sizes.
*/
QRectF QTouchEvent::TouchPoint::rect() const
{
@@ -3999,6 +3903,10 @@ QRectF QTouchEvent::TouchPoint::rect() const
/*!
Returns the rect for this touch point in scene coordinates.
+
+ \note This function returns an empty rect if the device does not report touch point sizes.
+
+ \sa scenePos(), rect()
*/
QRectF QTouchEvent::TouchPoint::sceneRect() const
{
@@ -4007,6 +3915,10 @@ QRectF QTouchEvent::TouchPoint::sceneRect() const
/*!
Returns the rect for this touch point in screen coordinates.
+
+ \note This function returns an empty rect if the device does not report touch point sizes.
+
+ \sa screenPos(), rect()
*/
QRectF QTouchEvent::TouchPoint::screenRect() const
{
@@ -4176,4 +4088,15 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T
return *this;
}
+/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const
+ Returns the touch device Type, which is of type
+ \l {QTouchEvent::DeviceType} {DeviceType}.
+ */
+
+/*! \fn void QTouchEvent::setDeviceType(DeviceType deviceType)
+ Sets the device type to \a deviceType, which is of type
+ \l {QTouchEvent::DeviceType} {DeviceType}.
+ */
+
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 3c5fc90..a1cfbe5 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -715,41 +715,6 @@ private:
};
#endif
-class Q_GUI_EXPORT QGestureEvent : public QEvent
-{
-public:
- QGestureEvent(const QSet<QGesture*> &gestures,
- const QSet<QString> &cancelledGestures = QSet<QString>());
- ~QGestureEvent();
-
- bool contains(Qt::GestureType type) const;
- bool contains(const QString &type) const;
-
- QList<QString> gestureTypes() const;
-
- const QGesture* gesture(Qt::GestureType type) const;
- const QGesture* gesture(const QString &type) const;
- QList<QGesture*> gestures() const;
-
- QSet<QString> cancelledGestures() const;
-
- void acceptAll();
-#ifndef Q_NO_USING_KEYWORD
- using QEvent::accept;
-#else
- inline void accept() { QEvent::accept(); }
-#endif
- void accept(Qt::GestureType type);
- void accept(const QString &type);
-
-protected:
- QHash<QString, QGesture*> m_gestures;
- QSet<QString> m_cancelledGestures;
-
- friend class QApplication;
- friend class QGestureManager;
-};
-
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
#endif
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 8a2bb05..67441ea 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -119,6 +119,22 @@ public:
qreal pressure;
};
+class QWinGestureEvent : public QEvent
+{
+public:
+ enum Type {
+ None,
+ GestureEnd,
+ Pan,
+ Pinch
+ };
+
+ QWinGestureEvent() : QEvent(QEvent::WinGesture), gestureType(None), sequenceId(0) { }
+ Type gestureType;
+ QPoint position;
+ ulong sequenceId;
+};
+
QT_END_NAMESPACE
#endif // QEVENT_P_H
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 99a1fc1..cde0c47 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -264,12 +264,16 @@ void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CF
int nativeSocket = CFSocketGetNative(s);
MacSocketInfo *socketInfo = eventDispatcher->macSockets.value(nativeSocket);
QEvent notifierEvent(QEvent::SockAct);
+
+ // There is a race condition that happen where we disable the notifier and
+ // the kernel still has a notification to pass on. We then get this
+ // notification after we've successfully disabled the CFSocket, but our Qt
+ // notifier is now gone. The upshot is we have to check the notifier
+ // everytime.
if (callbackType == kCFSocketReadCallBack) {
- Q_ASSERT(socketInfo->readNotifier);
- QApplication::sendEvent(socketInfo->readNotifier, &notifierEvent);
+ if (socketInfo->readNotifier)
+ QApplication::sendEvent(socketInfo->readNotifier, &notifierEvent);
} else if (callbackType == kCFSocketWriteCallBack) {
- // ### Bug in Apple socket notifiers seems to send write even
- // ### after the notifier has been disabled, need to investigate further.
if (socketInfo->writeNotifier)
QApplication::sendEvent(socketInfo->writeNotifier, &notifierEvent);
}
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index d7b2d1b..d53b419 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -41,190 +41,173 @@
#include "qgesture.h"
#include <private/qgesture_p.h>
+#include "qgraphicsitem.h"
QT_BEGIN_NAMESPACE
-QString qt_getStandardGestureTypeName(Qt::GestureType type);
+
+class QEventFilterProxyGraphicsItem : public QGraphicsItem
+{
+public:
+ QEventFilterProxyGraphicsItem(QGesture *g)
+ : gesture(g)
+ {
+ }
+ bool sceneEventFilter(QGraphicsItem *, QEvent *event)
+ {
+ return gesture ? gesture->filterEvent(event) : false;
+ }
+ QRectF boundingRect() const { return QRectF(); }
+ void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) { }
+
+private:
+ QGesture *gesture;
+};
/*!
\class QGesture
\since 4.6
- \brief The QGesture class represents a gesture, containing all
- properties that describe a gesture.
-
- The widget receives a QGestureEvent with a list of QGesture
- objects that represent gestures that are occuring on it. The class
- has a list of properties that can be queried by the user to get
- some gesture-specific arguments (i.e. position of the tap in the
- DoubleTap gesture).
-
- When creating custom gesture recognizers, they might add new
- properties to the gesture object, or custom gesture developers
- might subclass the QGesture objects to provide some extended
- information. However, if the gesture developer wants to add a new
- property to the gesture object that describe coordinate (like a
- QPoint or QRect), it is required to subclass the QGesture and
- re-implement the \l{QGesture::}{translate()} function to make sure
- the coordinates are translated properly when the gesture event is
- propagated to parent widgets.
-
- \sa QGestureEvent, QGestureRecognizer
-*/
+ \brief The QGesture class is the base class for implementing custom
+ gestures.
-/*!
- Creates a new gesture object of type \a type in a \a state and
- marks it as a child of \a parent.
+ This class represents both an object that recognizes a gesture out of a set
+ of input events (a gesture recognizer), and a gesture object itself that
+ can be used to get extended information about the triggered gesture.
- Usually QGesture objects should only be contructed by the
- QGestureRecognizer classes.
-*/
-QGesture::QGesture(QObject *parent, const QString &type, Qt::GestureState state)
- : QObject(*new QGesturePrivate, parent), m_accept(0)
-{
- Q_D(QGesture);
- d->type = type;
- d->state = state;
-}
+ The class has a list of properties that can be queried by the user to get
+ some gesture-specific parameters (for example, an offset of a Pan gesture).
-/*!
- Creates a new gesture object of type \a type in a \a state and
- marks it as a child of \a parent.
-
- This constructor also fills some basic information about the
- gesture like a \a startPos which describes the start point of the
- gesture, \a lastPos - last point where the gesture happened, \a
- pos - a current point, \a rect - a bounding rect of the gesture,
- \a hotSpot - a center point of the gesture, \a startTime - a time
- when the gesture has started, \a duration - how long the gesture
- is going on.
-
- Usually QGesture objects should only be contructed by the
- QGestureRecognizer classes.
-*/
-QGesture::QGesture(QObject *parent, const QString &type, const QPoint &startPos,
- const QPoint &lastPos, const QPoint &pos, const QRect &rect,
- const QPoint &hotSpot, const QDateTime &startTime,
- uint duration, Qt::GestureState state)
- : QObject(*new QGesturePrivate, parent)
-{
- Q_D(QGesture);
- d->type = type;
- d->state = state;
- d->init(startPos, lastPos, pos, rect, hotSpot, startTime, duration);
-}
+ Usually gesture recognizer implements a state machine, storing its state
+ internally in the recognizer object. The recognizer receives input events
+ through the \l{QGesture::}{filterEvent()} virtual function and decides
+ whether the event should change the state of the recognizer by emitting an
+ appropriate signal.
-/*! \internal
+ Input events should be either fed to the recognizer one by one with a
+ filterEvent() function, or the gesture recognizer should be attached to an
+ object it filters events for by specifying it as a parent object. The
+ QGesture object installs itself as an event filter to the parent object
+ automatically, the unsetObject() function should be used to remove an event
+ filter from the parent object. To make a
+ gesture that operates on a QGraphicsItem, both the appropriate QGraphicsView
+ should be passed as a parent object and setGraphicsItem() functions should
+ be used to attach a gesture to a graphics item.
+
+ This is a base class, to create a custom gesture type, you should subclass
+ it and implement its pure virtual functions.
+
+ \sa QPanGesture, QTapAndHoldGesture
*/
-QGesture::QGesture(QGesturePrivate &dd, QObject *parent, const QString &type,
- Qt::GestureState state)
- : QObject(dd, parent)
-{
- Q_D(QGesture);
- d->type = type;
- d->state = state;
-}
-/*!
- Destroys the gesture object.
+/*! \fn bool QGesture::filterEvent(QEvent *event)
+
+ Parses input \a event and emits a signal when detects a gesture.
+
+ In your reimplementation of this function, if you want to filter the \a
+ event out, i.e. stop it being handled further, return true; otherwise
+ return false;
+
+ This is a pure virtual function that needs to be implemented in subclasses.
*/
-QGesture::~QGesture()
-{
-}
-/*!
- \property QGesture::type
+/*! \fn void QGesture::started()
+
+ The signal is emitted when the gesture is started. Extended information
+ about the gesture is contained in the signal sender object.
- \brief The type of the gesture.
+ In addition to started(), a triggered() signal should also be emitted.
*/
-QString QGesture::type() const
-{
- return d_func()->type;
-}
+/*! \fn void QGesture::triggered()
-/*!
- \property QGesture::state
+ The signal is emitted when the gesture is detected. Extended information
+ about the gesture is contained in the signal sender object.
+*/
- \brief The current state of the gesture.
+/*! \fn void QGesture::finished()
+
+ The signal is emitted when the gesture is finished. Extended information
+ about the gesture is contained in the signal sender object.
*/
-Qt::GestureState QGesture::state() const
-{
- return d_func()->state;
-}
-/*!
- Translates the internal gesture properties that represent
- coordinates by \a offset.
+/*! \fn void QGesture::cancelled()
- Custom gesture recognizer developer have to re-implement this
- function if they want to store custom properties that represent
- coordinates.
+ The signal is emitted when the gesture is cancelled, for example the reset()
+ function is called while the gesture was in the process of emitting a
+ triggered() signal. Extended information about the gesture is contained in
+ the sender object.
*/
-void QGesture::translate(const QPoint &offset)
-{
- Q_D(QGesture);
- d->rect.translate(offset);
- d->hotSpot += offset;
- d->startPos += offset;
- d->lastPos += offset;
- d->pos += offset;
-}
+
/*!
- \property QGesture::rect
+ Creates a new gesture handler object and marks it as a child of \a parent.
+
+ The \a parent object is also the default event source for the gesture,
+ meaning that the gesture installs itself as an event filter for the \a
+ parent.
- \brief The bounding rect of a gesture.
+ \sa setGraphicsItem()
*/
-QRect QGesture::rect() const
+QGesture::QGesture(QObject *parent)
+ : QObject(*new QGesturePrivate, parent)
{
- return d_func()->rect;
+ if (parent)
+ installEventFilter(parent);
}
-void QGesture::setRect(const QRect &rect)
+/*! \internal
+ */
+QGesture::QGesture(QGesturePrivate &dd, QObject *parent)
+ : QObject(dd, parent)
{
- d_func()->rect = rect;
+ if (parent)
+ installEventFilter(parent);
}
/*!
- \property QGesture::hotSpot
-
- \brief The center point of a gesture.
+ Destroys the gesture object.
*/
-QPoint QGesture::hotSpot() const
+QGesture::~QGesture()
{
- return d_func()->hotSpot;
}
-void QGesture::setHotSpot(const QPoint &point)
+/*! \internal
+ */
+bool QGesture::eventFilter(QObject *receiver, QEvent *event)
{
- d_func()->hotSpot = point;
+ Q_D(QGesture);
+ if (d->graphicsItem && receiver == parent())
+ return false;
+ return filterEvent(event);
}
/*!
- \property QGesture::startTime
+ \property QGesture::state
- \brief The time when the gesture has started.
+ \brief The current state of the gesture.
*/
-QDateTime QGesture::startTime() const
+
+/*!
+ Returns the gesture recognition state.
+ */
+Qt::GestureState QGesture::state() const
{
- return d_func()->startTime;
+ return d_func()->state;
}
/*!
- \property QGesture::duration
-
- \brief The duration time of a gesture.
-*/
-uint QGesture::duration() const
+ Sets this gesture's recognition state to \a state.
+ */
+void QGesture::setState(Qt::GestureState state)
{
- return d_func()->duration;
+ d_func()->state = state;
}
/*!
\property QGesture::startPos
- \brief The start position of the pointer.
+ \brief The start position of the gesture (if relevant).
*/
QPoint QGesture::startPos() const
{
@@ -239,7 +222,7 @@ void QGesture::setStartPos(const QPoint &point)
/*!
\property QGesture::lastPos
- \brief The last recorded position of the pointer.
+ \brief The last recorded position of the gesture (if relevant).
*/
QPoint QGesture::lastPos() const
{
@@ -254,7 +237,7 @@ void QGesture::setLastPos(const QPoint &point)
/*!
\property QGesture::pos
- \brief The current position of the pointer.
+ \brief The current position of the gesture (if relevant).
*/
QPoint QGesture::pos() const
{
@@ -267,49 +250,47 @@ void QGesture::setPos(const QPoint &point)
}
/*!
- \class QPanningGesture
- \since 4.6
-
- \brief The QPanningGesture class represents a Pan gesture,
- providing additional information related to panning.
+ Sets the \a graphicsItem the gesture is filtering events for.
- This class is provided for convenience, panning direction
- information is also contained in the QGesture object in it's
- properties.
-*/
+ The gesture will install an event filter to the \a graphicsItem and
+ redirect them to the filterEvent() function.
-/*! \internal
+ \sa graphicsItem()
*/
-QPanningGesture::QPanningGesture(QObject *parent)
- : QGesture(*new QPanningGesturePrivate, parent,
- qt_getStandardGestureTypeName(Qt::PanGesture))
-{
-}
-
-/*! \internal
-*/
-QPanningGesture::~QPanningGesture()
+void QGesture::setGraphicsItem(QGraphicsItem *graphicsItem)
{
+ Q_D(QGesture);
+ if (d->graphicsItem && d->eventFilterProxyGraphicsItem)
+ d->graphicsItem->removeSceneEventFilter(d->eventFilterProxyGraphicsItem);
+ d->graphicsItem = graphicsItem;
+ if (!d->eventFilterProxyGraphicsItem)
+ d->eventFilterProxyGraphicsItem = new QEventFilterProxyGraphicsItem(this);
+ if (graphicsItem)
+ graphicsItem->installSceneEventFilter(d->eventFilterProxyGraphicsItem);
}
/*!
- \property QPanningGesture::lastDirection
+ Returns the graphics item the gesture is filtering events for.
- \brief The last recorded direction of panning.
+ \sa setGraphicsItem()
*/
-Qt::DirectionType QPanningGesture::lastDirection() const
+QGraphicsItem* QGesture::graphicsItem() const
{
- return d_func()->lastDirection;
+ return d_func()->graphicsItem;
}
-/*!
- \property QPanningGesture::direction
+/*! \fn void QGesture::reset()
- \brief The current direction of panning.
+ Resets the internal state of the gesture. This function might be called by
+ the filterEvent() implementation in a derived class, or by the user to
+ cancel a gesture. The base class implementation emits the cancelled()
+ signal if the state() of the gesture wasn't empty.
*/
-Qt::DirectionType QPanningGesture::direction() const
+void QGesture::reset()
{
- return d_func()->direction;
+ if (state() != Qt::NoGesture)
+ emit cancelled();
+ setState(Qt::NoGesture);
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index f3c95cc..1cd9cae 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -42,12 +42,12 @@
#ifndef QGESTURE_H
#define QGESTURE_H
-#include "qobject.h"
-#include "qlist.h"
-#include "qdatetime.h"
-#include "qpoint.h"
-#include "qrect.h"
-#include "qmetatype.h"
+#include <QtCore/qobject.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qpoint.h>
+#include <QtCore/qrect.h>
+#include <QtCore/qmetatype.h>
QT_BEGIN_HEADER
@@ -55,50 +55,32 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
+class QGraphicsItem;
class QGesturePrivate;
class Q_GUI_EXPORT QGesture : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QGesture)
- Q_PROPERTY(QString type READ type)
Q_PROPERTY(Qt::GestureState state READ state)
- Q_PROPERTY(QDateTime startTime READ startTime)
- Q_PROPERTY(uint duration READ duration)
-
- Q_PROPERTY(QRect rect READ rect WRITE setRect)
- Q_PROPERTY(QPoint hotSpot READ hotSpot WRITE setHotSpot)
Q_PROPERTY(QPoint startPos READ startPos WRITE setStartPos)
Q_PROPERTY(QPoint lastPos READ lastPos WRITE setLastPos)
Q_PROPERTY(QPoint pos READ pos WRITE setPos)
public:
- QGesture(QObject *parent, const QString &type,
- Qt::GestureState state = Qt::GestureStarted);
- QGesture(QObject *parent,
- const QString &type, const QPoint &startPos,
- const QPoint &lastPos, const QPoint &pos, const QRect &rect,
- const QPoint &hotSpot, const QDateTime &startTime,
- uint duration, Qt::GestureState state);
- virtual ~QGesture();
-
- inline void setAccepted(bool accepted) { m_accept = accepted; }
- inline bool isAccepted() const { return m_accept; }
-
- inline void accept() { m_accept = true; }
- inline void ignore() { m_accept = false; }
-
- QString type() const;
- Qt::GestureState state() const;
+ explicit QGesture(QObject *parent = 0);
+ ~QGesture();
+
+ virtual bool filterEvent(QEvent *event) = 0;
+
+ void setGraphicsItem(QGraphicsItem *);
+ QGraphicsItem *graphicsItem() const;
- QDateTime startTime() const;
- uint duration() const;
+ virtual void reset();
- QRect rect() const;
- void setRect(const QRect &rect);
- QPoint hotSpot() const;
- void setHotSpot(const QPoint &point);
+ Qt::GestureState state() const;
+ void setState(Qt::GestureState state);
QPoint startPos() const;
void setStartPos(const QPoint &point);
@@ -108,45 +90,19 @@ public:
void setPos(const QPoint &point);
protected:
- QGesture(QGesturePrivate &dd, QObject *parent, const QString &type,
- Qt::GestureState state = Qt::GestureStarted);
- virtual void translate(const QPoint &offset);
+ QGesture(QGesturePrivate &dd, QObject *parent);
+ bool eventFilter(QObject*, QEvent*);
-private:
- ushort m_accept : 1;
-
- friend class QGestureManager;
- friend class QApplication;
- friend class QGraphicsScene;
- friend class QGraphicsScenePrivate;
- friend class QGestureRecognizerPan;
- friend class QDoubleTapGestureRecognizer;
- friend class QTapAndHoldGestureRecognizer;
-};
-
-class QPanningGesturePrivate;
-class Q_GUI_EXPORT QPanningGesture : public QGesture
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QPanningGesture)
-
- Q_PROPERTY(Qt::DirectionType lastDirection READ lastDirection)
- Q_PROPERTY(Qt::DirectionType direction READ direction)
-
-public:
- Qt::DirectionType lastDirection() const;
- Qt::DirectionType direction() const;
+Q_SIGNALS:
+ void started();
+ void triggered();
+ void finished();
+ void cancelled();
private:
- QPanningGesture(QObject *parent = 0);
- ~QPanningGesture();
-
- friend class QGestureRecognizerPan;
+ friend class QWidget;
};
-Q_DECLARE_METATYPE(Qt::DirectionType)
-Q_DECLARE_METATYPE(Qt::GestureState)
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index caf851e..99f572f 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -56,10 +56,12 @@
#include "qrect.h"
#include "qpoint.h"
#include "qdatetime.h"
+#include "qgesture.h"
#include "private/qobject_p.h"
QT_BEGIN_NAMESPACE
+class QObject;
class QGraphicsItem;
class QGesturePrivate : public QObjectPrivate
{
@@ -67,47 +69,28 @@ class QGesturePrivate : public QObjectPrivate
public:
QGesturePrivate()
- : state(Qt::NoGesture), graphicsItem(0), singleshot(0), duration(0) { }
+ : graphicsItem(0), eventFilterProxyGraphicsItem(0), state(Qt::NoGesture)
+ {
+ }
void init(const QPoint &startPos, const QPoint &lastPos,
- const QPoint &pos, const QRect &rect,
- const QPoint &hotSpot, const QDateTime &startTime,
- uint duration)
+ const QPoint &pos)
{
- this->rect = rect;
- this->hotSpot = hotSpot;
- this->startTime = startTime;
- this->duration = duration;
this->startPos = startPos;
this->lastPos = lastPos;
this->pos = pos;
}
- QString type;
- Qt::GestureState state;
-
- QPointer<QWidget> widget;
QGraphicsItem *graphicsItem;
- uint singleshot:1;
+ QGraphicsItem *eventFilterProxyGraphicsItem;
+
+ Qt::GestureState state;
- QRect rect;
- QPoint hotSpot;
- QDateTime startTime;
- uint duration;
QPoint startPos;
QPoint lastPos;
QPoint pos;
};
-class QPanningGesturePrivate : public QGesturePrivate
-{
- Q_DECLARE_PUBLIC(QPanningGesture)
-
-public:
- Qt::DirectionType lastDirection;
- Qt::DirectionType direction;
-};
-
QT_END_NAMESPACE
#endif // QGESTURE_P_H
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
deleted file mode 100644
index 20abda9..0000000
--- a/src/gui/kernel/qgesturemanager.cpp
+++ /dev/null
@@ -1,644 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgesturemanager_p.h"
-#include "qgesture.h"
-#include "qgesture_p.h"
-#include "qevent.h"
-
-#include "qapplication.h"
-#include "qapplication_p.h"
-#include "qwidget.h"
-#include "qwidget_p.h"
-
-#include "qgesturestandardrecognizers_p.h"
-
-#include "qdebug.h"
-
-// #define GESTURE_DEBUG
-#ifndef GESTURE_DEBUG
-# define DEBUG if (0) qDebug
-#else
-# define DEBUG qDebug
-#endif
-
-QT_BEGIN_NAMESPACE
-
-bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event);
-
-static const unsigned int MaximumGestureRecognitionTimeout = 2000;
-
-QGestureManager::QGestureManager(QObject *parent)
- : QObject(parent), eventDeliveryDelayTimeout(300),
- delayedPressTimer(0), lastMousePressReceiver(0), lastMousePressEvent(QEvent::None, QPoint(), Qt::NoButton, 0, 0),
- lastGestureId(0), state(NotGesture)
-{
- qRegisterMetaType<Qt::DirectionType>();
- qRegisterMetaType<Qt::GestureState>();
-
- recognizers << new QDoubleTapGestureRecognizer(this);
- recognizers << new QTapAndHoldGestureRecognizer(this);
- recognizers << new QGestureRecognizerPan(this);
-
- foreach(QGestureRecognizer *r, recognizers)
- connect(r, SIGNAL(stateChanged(QGestureRecognizer::Result)),
- this, SLOT(recognizerStateChanged(QGestureRecognizer::Result)));
-}
-
-void QGestureManager::addRecognizer(QGestureRecognizer *recognizer)
-{
- recognizer->setParent(this);
- recognizers << recognizer;
-}
-
-void QGestureManager::removeRecognizer(QGestureRecognizer *recognizer)
-{
- recognizers.remove(recognizer);
-}
-
-bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
-{
- QPoint currentPos;
- switch (event->type()) {
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonRelease:
- case QEvent::MouseButtonDblClick:
- case QEvent::MouseMove:
- currentPos = static_cast<QMouseEvent*>(event)->pos(); break;
- default: break;
- }
-
- const QMap<QString, int> &grabbedGestures = qApp->d_func()->grabbedGestures;
-
- bool ret = false;
- QSet<QGestureRecognizer*> startedGestures;
- QSet<QGestureRecognizer*> finishedGestures;
- QSet<QGestureRecognizer*> newMaybeGestures;
- QSet<QGestureRecognizer*> cancelledGestures;
- QSet<QGestureRecognizer*> notGestures;
- if (state == NotGesture || state == MaybeGesture) {
- DEBUG() << "QGestureManager: current event processing state: "
- << (state == NotGesture ? "NotGesture" : "MaybeGesture");
-
- QSet<QGestureRecognizer*> stillMaybeGestures;
- // try other recognizers.
- foreach(QGestureRecognizer *r, recognizers) {
- if (grabbedGestures.value(r->gestureType(), 0) <= 0)
- continue;
- QGestureRecognizer::Result result = r->filterEvent(event);
- if (result == QGestureRecognizer::GestureStarted) {
- DEBUG() << "QGestureManager: gesture started: " << r;
- startedGestures << r;
- } else if (result == QGestureRecognizer::GestureFinished) {
- DEBUG() << "QGestureManager: gesture finished: " << r;
- finishedGestures << r;
- } else if (result == QGestureRecognizer::MaybeGesture) {
- DEBUG() << "QGestureManager: maybe gesture: " << r;
- newMaybeGestures << r;
- } else if (result == QGestureRecognizer::NotGesture) {
- // if it was maybe gesture, but isn't a gesture anymore.
- DEBUG() << "QGestureManager: not gesture: " << r;
- notGestures << r;
- }
- }
- Q_ASSERT(activeGestures.isEmpty());
- activeGestures += startedGestures;
- for(QMap<QGestureRecognizer*, int>::iterator it = maybeGestures.begin();
- it != maybeGestures.end();) {
- QGestureRecognizer *r = it.key();
- if (startedGestures.contains(r) || finishedGestures.contains(r) ||
- notGestures.contains(r)) {
- killTimer(it.value());
- it = maybeGestures.erase(it);
- } else {
- ++it;
- }
- }
- foreach(QGestureRecognizer *r, newMaybeGestures) {
- if (!maybeGestures.contains(r)) {
- int timerId = startTimer(MaximumGestureRecognitionTimeout);
- if (!timerId)
- qWarning("QGestureManager: couldn't start timer!");
- maybeGestures.insert(r, timerId);
- }
- }
- if (!finishedGestures.isEmpty() || !startedGestures.isEmpty()) {
- // gesture found!
- ret = true;
- QSet<QGesture*> started;
- foreach(QGestureRecognizer *r, finishedGestures) {
- if (QGesture *gesture = r->getGesture()) {
- started << gesture;
- gesture->d_func()->singleshot = true;
- }
- }
- foreach(QGestureRecognizer *r, startedGestures) {
- if (QGesture *gesture = r->getGesture()) {
- started << gesture;
- gesture->d_func()->singleshot = false;
- }
- }
-
- if (!activeGestures.isEmpty()) {
- DEBUG() << "QGestureManager: new state = Gesture";
- state = Gesture;
- } else if (!maybeGestures.isEmpty()) {
- DEBUG() << "QGestureManager: new state = Maybe";
- state = MaybeGesture;
- } else {
- DEBUG() << "QGestureManager: new state = NotGesture";
- state = NotGesture;
- }
-
- Q_ASSERT(!started.isEmpty());
- ret = sendGestureEvent(receiver, started, QSet<QGesture*>());
- } else if (!maybeGestures.isEmpty()) {
- if (state != MaybeGesture) {
- // We got a new set of events that look like a start
- // of some gesture, so we switch to state MaybeGesture
- // and wait for more events.
- DEBUG() << "QGestureManager: new state = Maybe. Waiting for events";
- state = MaybeGesture;
- // start gesture timer
- } else {
- // we still not sure if it is a gesture or not.
- }
- } else if (state == MaybeGesture) {
- // last time we thought it looks like gesture, but now we
- // know for sure that it isn't.
- DEBUG() << "QGestureManager: new state = NotGesture";
- state = NotGesture;
- }
- foreach(QGestureRecognizer *r, finishedGestures)
- r->reset();
- foreach(QGestureRecognizer *r, cancelledGestures)
- r->reset();
- foreach(QGestureRecognizer *r, notGestures)
- r->reset();
- } else if (state == Gesture) {
- DEBUG() << "QGestureManager: current event processing state: Gesture";
- Q_ASSERT(!activeGestures.isEmpty());
-
- foreach(QGestureRecognizer *r, recognizers) {
- if (grabbedGestures.value(r->gestureType(), 0) <= 0)
- continue;
- QGestureRecognizer::Result result = r->filterEvent(event);
- if (result == QGestureRecognizer::GestureStarted) {
- DEBUG() << "QGestureManager: gesture started: " << r;
- startedGestures << r;
- } else if (result == QGestureRecognizer::GestureFinished) {
- DEBUG() << "QGestureManager: gesture finished: " << r;
- finishedGestures << r;
- } else if (result == QGestureRecognizer::MaybeGesture) {
- DEBUG() << "QGestureManager: maybe gesture: " << r;
- newMaybeGestures << r;
- } else if (result == QGestureRecognizer::NotGesture) {
- // if it was an active gesture, but isn't a gesture anymore.
- if (activeGestures.contains(r)) {
- DEBUG() << "QGestureManager: cancelled gesture: " << r;
- cancelledGestures << r;
- } else {
- DEBUG() << "QGestureManager: not gesture: " << r;
- notGestures << r;
- }
- }
- }
-
- for(QMap<QGestureRecognizer*, int>::iterator it = maybeGestures.begin();
- it != maybeGestures.end();) {
- QGestureRecognizer *r = it.key();
- if (startedGestures.contains(r) || finishedGestures.contains(r) ||
- notGestures.contains(r)) {
- killTimer(it.value());
- it = maybeGestures.erase(it);
- } else {
- ++it;
- }
- }
- foreach(QGestureRecognizer *r, newMaybeGestures) {
- if (!maybeGestures.contains(r)) {
- int timerId = startTimer(MaximumGestureRecognitionTimeout);
- if (!timerId)
- qWarning("QGestureManager: couldn't start timer!");
- maybeGestures.insert(r, timerId);
- }
- }
- QSet<QGesture*> started, updated;
- if (!finishedGestures.isEmpty() || !startedGestures.isEmpty()) {
- // another gesture found!
- ret = true;
- foreach(QGestureRecognizer *r, finishedGestures) {
- if (QGesture *gesture = r->getGesture()) {
- gesture->d_func()->singleshot = !activeGestures.contains(r);
- if (gesture->d_func()->singleshot)
- started << gesture;
- else
- updated << gesture;
- }
- }
- foreach(QGestureRecognizer *r, startedGestures) {
- if (QGesture *gesture = r->getGesture()) {
- gesture->d_func()->singleshot = !activeGestures.contains(r);
- if (gesture->d_func()->singleshot)
- started << gesture;
- else
- updated << gesture;
- }
- }
- }
- activeGestures -= newMaybeGestures;
- activeGestures -= cancelledGestures;
- activeGestures += startedGestures;
- activeGestures -= finishedGestures;
- QSet<QString> cancelledGestureNames;
- foreach(QGestureRecognizer *r, cancelledGestures)
- cancelledGestureNames << r->gestureType();
- ret = sendGestureEvent(receiver, started, updated, cancelledGestureNames);
-
- foreach(QGestureRecognizer *r, finishedGestures)
- r->reset();
- foreach(QGestureRecognizer *r, cancelledGestures)
- r->reset();
- foreach(QGestureRecognizer *r, notGestures)
- r->reset();
- if (!activeGestures.isEmpty()) {
- // nothing changed, we are still handling a gesture
- } else if (!maybeGestures.isEmpty()) {
- DEBUG() << "QGestureManager: new state = Maybe. Waiting for events: " << maybeGestures;
- state = MaybeGesture;
- } else {
- DEBUG() << "QGestureManager: new state = NotGesture";
- state = NotGesture;
- }
- }
-
- if (delayedPressTimer && state == Gesture) {
- DEBUG() << "QGestureManager: gesture started. Forgetting about postponed mouse press event";
- killTimer(delayedPressTimer);
- delayedPressTimer = 0;
- lastMousePressReceiver = 0;
- } else if (delayedPressTimer && (state == NotGesture ||
- event->type() == QEvent::MouseButtonRelease)) {
- // not a gesture or released button too fast, so replay press
- // event back.
- DEBUG() << "QGestureManager: replaying mouse press event";
- QMap<QGestureRecognizer*, int>::const_iterator it = maybeGestures.begin(),
- e = maybeGestures.end();;
- for (; it != e; ++it) {
- it.key()->reset();
- killTimer(it.value());
- }
- maybeGestures.clear();
- state = NotGesture;
-
- if (lastMousePressReceiver) {
- QApplication::sendEvent(lastMousePressReceiver, &lastMousePressEvent);
- if (event->type() == QEvent::MouseButtonRelease) {
- QMouseEvent *me = static_cast<QMouseEvent*>(event);
- QMouseEvent move(QEvent::MouseMove, me->pos(), me->globalPos(), me->button(),
- me->buttons(), me->modifiers());
- QApplication::sendEvent(lastMousePressReceiver, &move);
- ret = false;
- }
- lastMousePressReceiver = 0;
- }
- lastMousePressReceiver = 0;
- killTimer(delayedPressTimer);
- delayedPressTimer = 0;
- } else if (state == MaybeGesture && event->type() == QEvent::MouseButtonPress
- && eventDeliveryDelayTimeout) {
- // postpone the press event delivery until we know for
- // sure whether it is a gesture.
- DEBUG() << "QGestureManager: postponing mouse press event";
- QMouseEvent *me = static_cast<QMouseEvent*>(event);
- lastMousePressReceiver = receiver;
- lastMousePressEvent = QMouseEvent(QEvent::MouseButtonPress, me->pos(),
- me->globalPos(), me->button(),
- me->buttons(), me->modifiers());
- Q_ASSERT(delayedPressTimer == 0);
- delayedPressTimer = startTimer(eventDeliveryDelayTimeout);
- if (!delayedPressTimer)
- qWarning("QGestureManager: couldn't start delayed press timer!");
- ret = true;
- }
- if (delayedPressTimer && event->type() == QEvent::MouseMove) {
- // if we have postponed a mouse press event, postpone all
- // subsequent mouse move events as well.
- ret = true;
- }
-
- lastPos = currentPos;
- return ret;
-}
-
-void QGestureManager::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() == delayedPressTimer) {
- DEBUG() << "QGestureManager: replaying mouse press event due to timeout";
- // sanity checks
- Q_ASSERT(state != Gesture);
-
- QMap<QGestureRecognizer*, int>::const_iterator it = maybeGestures.begin(),
- e = maybeGestures.end();;
- for (; it != e; ++it) {
- it.key()->reset();
- killTimer(it.value());
- }
- maybeGestures.clear();
- state = NotGesture;
-
- if (lastMousePressReceiver) {
- // we neither received a mouse release event nor gesture
- // started, so we replay stored mouse press event.
- QApplication::sendEvent(lastMousePressReceiver, &lastMousePressEvent);
- lastMousePressReceiver = 0;
- }
-
- lastMousePressReceiver = 0;
- killTimer(delayedPressTimer);
- delayedPressTimer = 0;
- } else {
- // sanity checks, remove later
- Q_ASSERT((state == Gesture && !activeGestures.isEmpty()) || (state != Gesture && activeGestures.isEmpty()));
-
- typedef QMap<QGestureRecognizer*, int> MaybeGestureMap;
- for (MaybeGestureMap::iterator it = maybeGestures.begin(), e = maybeGestures.end();
- it != e; ++it) {
- if (it.value() == event->timerId()) {
- DEBUG() << "QGestureManager: gesture timeout.";
- QGestureRecognizer *r = it.key();
- r->reset();
- maybeGestures.erase(it);
- killTimer(event->timerId());
- break;
- }
- }
-
- if (state == MaybeGesture && maybeGestures.isEmpty()) {
- DEBUG() << "QGestureManager: new state = NotGesture because of timeout";
- state = NotGesture;
- }
- }
-}
-
-bool QGestureManager::inGestureMode()
-{
- return state == Gesture;
-}
-
-void QGestureManager::recognizerStateChanged(QGestureRecognizer::Result result)
-{
- QGestureRecognizer *recognizer = qobject_cast<QGestureRecognizer*>(sender());
- if (!recognizer)
- return;
- if (qApp->d_func()->grabbedGestures.value(recognizer->gestureType(), 0) <= 0) {
- recognizer->reset();
- return;
- }
-
- switch (result) {
- case QGestureRecognizer::GestureStarted:
- case QGestureRecognizer::GestureFinished: {
- if (result == QGestureRecognizer::GestureStarted) {
- DEBUG() << "QGestureManager: gesture started: " << recognizer;
- activeGestures << recognizer;
- DEBUG() << "QGestureManager: new state = Gesture";
- state = Gesture;
- } else {
- DEBUG() << "QGestureManager: gesture finished: " << recognizer;
- }
- if (maybeGestures.contains(recognizer)) {
- killTimer(maybeGestures.value(recognizer));
- maybeGestures.remove(recognizer);
- }
- QSet<QGesture*> gestures;
- if (QGesture *gesture = recognizer->getGesture())
- gestures << gesture;
- if(!gestures.isEmpty()) {
- //FIXME: sendGestureEvent(targetWidget, gestures);
- }
- if (result == QGestureRecognizer::GestureFinished)
- recognizer->reset();
- }
- break;
- case QGestureRecognizer::MaybeGesture: {
- DEBUG() << "QGestureManager: maybe gesture: " << recognizer;
- if (activeGestures.contains(recognizer)) {
- //FIXME: sendGestureEvent(targetWidget, QSet<QGesture*>(), QSet<QString>() << recognizer->gestureType());
- }
- if (!maybeGestures.contains(recognizer)) {
- int timerId = startTimer(MaximumGestureRecognitionTimeout);
- if (!timerId)
- qWarning("QGestureManager: couldn't start timer!");
- maybeGestures.insert(recognizer, timerId);
- }
- }
- break;
- case QGestureRecognizer::NotGesture:
- DEBUG() << "QGestureManager: not gesture: " << recognizer;
- if (maybeGestures.contains(recognizer)) {
- killTimer(maybeGestures.value(recognizer));
- maybeGestures.remove(recognizer);
- }
- recognizer->reset();
- break;
- default:
- Q_ASSERT(false);
- }
-
- if (delayedPressTimer && state == Gesture) {
- killTimer(delayedPressTimer);
- delayedPressTimer = 0;
- }
-}
-
-bool QGestureManager::sendGestureEvent(QWidget *receiver,
- const QSet<QGesture*> &startedGestures,
- const QSet<QGesture*> &updatedGestures,
- const QSet<QString> &cancelled)
-{
- DEBUG() << "QGestureManager::sendGestureEvent: sending to" << receiver
- << "gestures:" << startedGestures << "," << updatedGestures
- << "cancelled:" << cancelled;
- // grouping gesture objects by receiver widgets.
- typedef QMap<QWidget*, QSet<QGesture*> > WidgetGesturesMap;
- WidgetGesturesMap widgetGestures;
- for(QSet<QGesture*>::const_iterator it = startedGestures.begin(), e = startedGestures.end();
- it != e; ++it) {
- QGesture *g = *it;
- QGesturePrivate *gd = g->d_func();
- if (receiver) {
- // find the target widget
- gd->widget = 0;
- gd->graphicsItem = 0;
- QWidget *w = receiver;
- QPoint offset;
- const QString gestureType = g->type();
- while (w) {
- if (w->d_func()->hasGesture(gestureType))
- break;
- if (w->isWindow()) {
- w = 0;
- break;
- }
- offset += w->pos();
- w = w->parentWidget();
- }
- if (w && w != gd->widget) {
- DEBUG() << "QGestureManager::sendGestureEvent:" << g << "propagating to widget" << w << "offset" << offset;
- g->translate(offset);
- }
- gd->widget = w;
- }
- if (!gd->widget) {
- DEBUG() << "QGestureManager: didn't find a widget to send gesture event ("
- << g->type() << ") for tree:" << receiver;
- // TODO: maybe we should reset gesture recognizers when nobody interested in its gestures.
- continue;
- }
- widgetGestures[gd->widget].insert(g);
- }
-
- QSet<QGesture*> ignoredGestures;
- bool ret = false;
- for(WidgetGesturesMap::const_iterator it = widgetGestures.begin(), e = widgetGestures.end();
- it != e; ++it) {
- QWidget *receiver = it.key();
- Q_ASSERT(receiver != 0 /*should be taken care above*/);
- QSet<QGesture*> gestures = it.value();
- // mark all gestures as ignored by default
- for(QSet<QGesture*>::iterator it = gestures.begin(), e = gestures.end(); it != e; ++it)
- (*it)->ignore();
- // TODO: send cancelled gesture event to the widget that received the original gesture!
- QGestureEvent event(gestures, cancelled);
- DEBUG() << "QGestureManager::sendGestureEvent: sending now to" << receiver
- << "gestures" << gestures;
- bool processed = qt_sendSpontaneousEvent(receiver, &event);
- QSet<QGesture*> started = startedGestures & gestures;
- DEBUG() << "QGestureManager::sendGestureEvent:" <<
- (event.isAccepted() ? "" : "not") << "all gestures were accepted";
- if (!started.isEmpty() && !(processed && event.isAccepted())) {
- // there are started gestures events that weren't
- // accepted, so propagating each gesture independently.
- if (event.isAccepted()) {
- foreach(QGesture *g, started)
- g->accept();
- }
- QSet<QGesture*>::const_iterator it = started.begin(),
- e = started.end();
- for(; it != e; ++it) {
- QGesture *g = *it;
- if (processed && g->isAccepted()) {
- ret = true;
- continue;
- }
- // if it wasn't accepted, find the first parent widget
- // that is subscribed to the gesture.
- QGesturePrivate *gd = g->d_func();
- QWidget *w = gd->widget;
- gd->widget = 0;
-
- if (w && !w->isWindow()) {
- g->translate(w->pos());
- w = w->parentWidget();
- QPoint offset;
- const QString gestureType = g->type();
- while (w) {
- if (w->d_func()->hasGesture(gestureType)) {
- DEBUG() << "QGestureManager::sendGestureEvent:" << receiver
- << "didn't accept gesture" << g << "propagating to" << w;
- ignoredGestures.insert(g);
- gd->widget = w;
- break;
- }
- if (w->isWindow()) {
- w = 0;
- break;
- }
- offset += w->pos();
- w = w->parentWidget();
- }
- if (w) {
- g->translate(offset);
- } else {
- DEBUG() << "QGestureManager::sendGestureEvent:" << receiver
- << "didn't accept gesture" << g << "and nobody wants it";
- }
- }
- }
- }
- }
- if (ignoredGestures.isEmpty())
- return ret;
- // try to send all gestures that were ignored to the next parent
- return sendGestureEvent(0, ignoredGestures, QSet<QGesture*>(), cancelled) || ret;
-}
-
-int QGestureManager::eventDeliveryDelay() const
-{
- return eventDeliveryDelayTimeout;
-}
-
-void QGestureManager::setEventDeliveryDelay(int ms)
-{
- eventDeliveryDelayTimeout = ms;
-}
-
-int QGestureManager::makeGestureId(const QString &name)
-{
- gestureIdMap[++lastGestureId] = name;
- return lastGestureId;
-}
-
-void QGestureManager::releaseGestureId(int gestureId)
-{
- gestureIdMap.remove(gestureId);
-}
-
-QString QGestureManager::gestureNameFromId(int gestureId) const
-{
- return gestureIdMap.value(gestureId);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qgesturemanager_p.cpp"
-
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
deleted file mode 100644
index 8656590..0000000
--- a/src/gui/kernel/qgesturemanager_p.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGESTUREMANAGER_P_H
-#define QGESTUREMANAGER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qlist.h"
-#include "qset.h"
-#include "qevent.h"
-#include "qbasictimer.h"
-#include "qpointer.h"
-
-#include "qgesturerecognizer.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWidget;
-class Q_AUTOTEST_EXPORT QGestureManager : public QObject
-{
- Q_OBJECT
-public:
- QGestureManager(QObject *parent);
-
- int eventDeliveryDelay() const;
- void setEventDeliveryDelay(int ms);
-
- void addRecognizer(QGestureRecognizer *recognizer);
- void removeRecognizer(QGestureRecognizer *recognizer);
-
- bool filterEvent(QWidget *receiver, QEvent *event);
- bool inGestureMode();
-
- int makeGestureId(const QString &name);
- void releaseGestureId(int gestureId);
- QString gestureNameFromId(int gestureId) const;
-
- // declared in qapplication.cpp
- static QGestureManager* instance();
-
- bool sendGestureEvent(QWidget *receiver,
- const QSet<QGesture*> &startedGestures,
- const QSet<QGesture*> &updatedGestures,
- const QSet<QString> &cancelled = QSet<QString>());
-
-protected:
- void timerEvent(QTimerEvent *event);
-
-private slots:
- void recognizerStateChanged(QGestureRecognizer::Result);
-
-private:
- QSet<QGestureRecognizer*> activeGestures;
- QMap<QGestureRecognizer*, int> maybeGestures;
- QSet<QGestureRecognizer*> recognizers;
-
- QPoint lastPos;
-
- int eventDeliveryDelayTimeout;
- int delayedPressTimer;
- QPointer<QWidget> lastMousePressReceiver;
- QMouseEvent lastMousePressEvent;
-
- QMap<int, QString> gestureIdMap;
- int lastGestureId;
-
- enum State {
- Gesture,
- NotGesture,
- MaybeGesture // that mean timers are up and waiting for some
- // more events, and input events are handled by
- // gesture recognizer explicitely
- } state;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGESTUREMANAGER_P_H
diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp
deleted file mode 100644
index c330663..0000000
--- a/src/gui/kernel/qgesturerecognizer.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgesturerecognizer.h"
-#include "qgesture.h"
-
-#include <private/qobject_p.h>
-#include <private/qgesturerecognizer_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QString qt_getStandardGestureTypeName(Qt::GestureType gestureType);
-
-/*!
- \class QGestureRecognizer
- \since 4.6
-
- \brief The QGestureRecognizer class is the base class for
- implementing custom gestures.
-
- This is a base class, to create a custom gesture type, you should
- subclass it and implement its pure virtual functions.
-
- Usually gesture recognizer implements state machine, storing its
- state internally in the recognizer object. The recognizer receives
- input events through the \l{QGestureRecognizer::}{filterEvent()}
- virtual function and decides whether the parsed event should
- change the state of the recognizer - i.e. if the event starts or
- ends a gesture or if it isn't related to gesture at all.
-*/
-
-/*!
- \enum QGestureRecognizer::Result
- \since 4.6
-
- This enum type defines the state of the gesture recognizer.
-
- \value Ignore Gesture recognizer ignores the event.
-
- \value NotGesture Not a gesture.
-
- \value GestureStarted The continuous gesture has started. When the
- recognizer is in this state, a \l{QGestureEvent}{gesture event}
- containing QGesture objects returned by the
- \l{QGestureRecognizer::}{getGesture()} will be sent to a widget.
-
- \value GestureFinished The gesture has ended. A
- \l{QGestureEvent}{gesture event} will be sent to a widget.
-
- \value MaybeGesture Gesture recognizer hasn't decided yet if a
- gesture has started, but it might start soon after the following
- events are received by the recognizer. This means that gesture
- manager shouldn't reset() the internal state of the gesture
- recognizer.
-*/
-
-/*! \fn QGestureRecognizer::Result QGestureRecognizer::filterEvent(const QEvent *event)
-
- This is a pure virtual function that needs to be implemented in
- subclasses.
-
- Parses input \a event and returns the result, which specifies if
- the event sequence is a gesture or not.
-*/
-
-/*! \fn QGesture* QGestureRecognizer::getGesture()
-
- Returns a gesture object that will be send to the widget. This
- function is called when the gesture recognizer changed its state
- to QGestureRecognizer::GestureStarted or
- QGestureRecognizer::GestureFinished.
-
- The returned QGesture object must point to the same object in a
- single gesture sequence.
-
- The gesture object is owned by the recognizer itself.
-*/
-
-/*! \fn void QGestureRecognizer::reset()
-
- Resets the internal state of the gesture recognizer.
-*/
-
-/*! \fn void QGestureRecognizer::stateChanged(QGestureRecognizer::Result result)
-
- The gesture recognizer might emit the stateChanged() signal when
- the gesture state changes asynchronously, i.e. without any event
- being filtered through filterEvent().
-*/
-
-QGestureRecognizerPrivate::QGestureRecognizerPrivate()
- : gestureType(Qt::UnknownGesture)
-{
-}
-
-/*!
- Creates a new gesture recognizer object that handles gestures of
- the specific \a gestureType as a child of \a parent.
-
- \sa QApplication::addGestureRecognizer(),
- QApplication::removeGestureRecognizer(),
-*/
-QGestureRecognizer::QGestureRecognizer(const QString &gestureType, QObject *parent)
- : QObject(*new QGestureRecognizerPrivate, parent)
-{
- Q_D(QGestureRecognizer);
- d->customGestureType = gestureType;
-}
-
-/*!
- Returns the name of the gesture that is handled by the recognizer.
-*/
-QString QGestureRecognizer::gestureType() const
-{
- Q_D(const QGestureRecognizer);
- if (d->gestureType == Qt::UnknownGesture)
- return d->customGestureType;
- return qt_getStandardGestureTypeName(d->gestureType);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h
deleted file mode 100644
index 2c1c61b..0000000
--- a/src/gui/kernel/qgesturerecognizer.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGESTURERECOGNIZER_H
-#define QGESTURERECOGNIZER_H
-
-#include "qevent.h"
-#include "qlist.h"
-#include "qset.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGesture;
-class QGestureRecognizerPrivate;
-class Q_GUI_EXPORT QGestureRecognizer : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QGestureRecognizer)
-
-public:
- enum Result
- {
- Ignore,
- NotGesture,
- GestureStarted, //TODO: rename to just Gesture?
- GestureFinished,
- MaybeGesture
- };
-
- explicit QGestureRecognizer(const QString &gestureType, QObject *parent = 0);
-
- QString gestureType() const;
-
- virtual QGestureRecognizer::Result filterEvent(const QEvent* event) = 0;
- virtual QGesture* getGesture() = 0;
- virtual void reset() = 0;
-
-signals:
- void stateChanged(QGestureRecognizer::Result result);
-
-private:
- friend class QDoubleTapGestureRecognizer;
- friend class QTapAndHoldGestureRecognizer;
- friend class QGestureRecognizerPan;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGESTURERECOGNIZER_P_H
diff --git a/src/gui/kernel/qgesturestandardrecognizers.cpp b/src/gui/kernel/qgesturestandardrecognizers.cpp
deleted file mode 100644
index b108994..0000000
--- a/src/gui/kernel/qgesturestandardrecognizers.cpp
+++ /dev/null
@@ -1,306 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgesturestandardrecognizers_p.h"
-#include "qgesture_p.h"
-#include "qgesturerecognizer_p.h"
-
-// #define GESTURE_RECOGNIZER_DEBUG
-#ifndef GESTURE_RECOGNIZER_DEBUG
-# define DEBUG if (0) qDebug
-#else
-# define DEBUG qDebug
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QString qt_getStandardGestureTypeName(Qt::GestureType gestureType)
-{
- switch (gestureType) {
- case Qt::TapGesture:
- return QLatin1String("__QTapGesture");
- case Qt::DoubleTapGesture:
- return QLatin1String("__QDoubleTapGesture");
- case Qt::TrippleTapGesture:
- return QLatin1String("__QTrippleTapGesture");
- case Qt::TapAndHoldGesture:
- return QLatin1String("__QTapAndHoldGesture");
- case Qt::PanGesture:
- return QLatin1String("__QPanGesture");
- case Qt::PinchGesture:
- return QLatin1String("__QPinchGesture");
- case Qt::UnknownGesture:
- break;
- }
- qFatal("QGestureRecognizer::gestureType: got an unhandled gesture type.");
- return QLatin1String("__unknown_gesture");
-}
-
-//
-// QGestureRecognizerPan
-//
-
-QGestureRecognizerPan::QGestureRecognizerPan(QObject *parent)
- : QGestureRecognizer(QString(), parent),
- mousePressed(false), gestureState(Qt::NoGesture),
- lastDirection(Qt::NoDirection), currentDirection(Qt::NoDirection)
-{
- Q_D(QGestureRecognizer);
- d->gestureType = Qt::PanGesture;
-}
-
-QGestureRecognizer::Result QGestureRecognizerPan::filterEvent(const QEvent *event)
-{
- if (event->type() == QEvent::MouseButtonPress) {
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- if (currentDirection != Qt::NoDirection) {
- DEBUG() << "Pan: MouseButtonPress: fail. another press during pan";
- reset();
- return QGestureRecognizer::NotGesture;
- }
- if (ev->button() != Qt::LeftButton) {
- return QGestureRecognizer::NotGesture;
- }
- DEBUG() << "Pan: MouseButtonPress: maybe gesture started";
- mousePressed = true;
- pressedPos = lastPos = currentPos = ev->pos();
- return QGestureRecognizer::MaybeGesture;
- } else if (event->type() == QEvent::MouseButtonRelease) {
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- if (mousePressed && currentDirection != Qt::NoDirection
- && ev->button() == Qt::LeftButton) {
- DEBUG() << "Pan: MouseButtonRelease: pan detected";
- gestureState = Qt::GestureFinished;
- currentPos = ev->pos();
- internalReset();
- return QGestureRecognizer::GestureFinished;
- }
- DEBUG() << "Pan: MouseButtonRelease: some weird release detected, ignoring";
- reset();
- return QGestureRecognizer::NotGesture;
- } else if (event->type() == QEvent::MouseMove) {
- if (!mousePressed)
- return QGestureRecognizer::NotGesture;
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- lastPos = currentPos;
- currentPos = ev->pos();
- Qt::DirectionType newDirection =
- simpleRecognizer.addPosition(ev->pos()).direction;
- DEBUG() << "Pan: MouseMove: simplerecognizer result = " << newDirection;
- QGestureRecognizer::Result result = QGestureRecognizer::NotGesture;
- if (currentDirection == Qt::NoDirection) {
- if (newDirection == Qt::NoDirection) {
- result = QGestureRecognizer::MaybeGesture;
- } else {
- result = QGestureRecognizer::GestureStarted;
- gestureState = Qt::GestureStarted;
- }
- } else {
- result = QGestureRecognizer::GestureStarted;
- gestureState = Qt::GestureUpdated;
- }
- if (newDirection != Qt::NoDirection) {
- if (currentDirection != newDirection)
- lastDirection = currentDirection;
- currentDirection = newDirection;
- }
- return result;
- }
- return QGestureRecognizer::Ignore;
-}
-
-QGesture* QGestureRecognizerPan::getGesture()
-{
- if (currentDirection == Qt::NoDirection)
- return 0;
- QPanningGesturePrivate *d = gesture.d_func();
- d->startPos = pressedPos;
- d->lastPos = lastPos;
- d->pos = currentPos;
- d->hotSpot = pressedPos;
- d->state = gestureState;
- d->lastDirection = lastDirection;
- d->direction = currentDirection;
-
- return &gesture;
-}
-
-void QGestureRecognizerPan::reset()
-{
- mousePressed = false;
- lastDirection = Qt::NoDirection;
- currentDirection = Qt::NoDirection;
- gestureState = Qt::NoGesture;
- diagonalRecognizer.reset();
- simpleRecognizer.reset();
-}
-
-void QGestureRecognizerPan::internalReset()
-{
- mousePressed = false;
- diagonalRecognizer.reset();
- simpleRecognizer.reset();
-}
-
-
-//
-// QDoubleTapGestureRecognizer
-//
-QDoubleTapGestureRecognizer::QDoubleTapGestureRecognizer(QObject *parent)
- : QGestureRecognizer(QString(), parent),
- gesture(0, qt_getStandardGestureTypeName(Qt::DoubleTapGesture))
-{
- Q_D(QGestureRecognizer);
- d->gestureType = Qt::DoubleTapGesture;
-}
-
-QGestureRecognizer::Result QDoubleTapGestureRecognizer::filterEvent(const QEvent *event)
-{
- if (event->type() == QEvent::MouseButtonPress) {
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- if (pressedPosition.isNull()) {
- pressedPosition = ev->pos();
- return QGestureRecognizer::MaybeGesture;
- } else if ((pressedPosition - ev->pos()).manhattanLength() < 10) {
- return QGestureRecognizer::GestureFinished;
- }
- return QGestureRecognizer::NotGesture;
- } else if (event->type() == QEvent::MouseButtonRelease) {
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- if (!pressedPosition.isNull() && (pressedPosition - ev->pos()).manhattanLength() < 10)
- return QGestureRecognizer::MaybeGesture;
- return QGestureRecognizer::NotGesture;
- } else if (event->type() == QEvent::MouseButtonDblClick) {
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- pressedPosition = ev->pos();
- return QGestureRecognizer::GestureFinished;
- }
- return QGestureRecognizer::NotGesture;
-}
-
-QGesture* QDoubleTapGestureRecognizer::getGesture()
-{
- QGesturePrivate *d = gesture.d_func();
- d->startPos = pressedPosition;
- d->lastPos = pressedPosition;
- d->pos = pressedPosition;
- d->hotSpot = pressedPosition;
- d->state = Qt::GestureFinished;
- return &gesture;
-}
-
-void QDoubleTapGestureRecognizer::reset()
-{
- pressedPosition = QPoint();
-}
-
-//
-// QTapAndHoldGestureRecognizer
-//
-const int QTapAndHoldGestureRecognizer::iterationCount = 40;
-const int QTapAndHoldGestureRecognizer::iterationTimeout = 50;
-
-QTapAndHoldGestureRecognizer::QTapAndHoldGestureRecognizer(QObject *parent)
- : QGestureRecognizer(QString(), parent),
- gesture(0, qt_getStandardGestureTypeName(Qt::TapAndHoldGesture)),
- iteration(0)
-{
- Q_D(QGestureRecognizer);
- d->gestureType = Qt::TapAndHoldGesture;
-}
-
-QGestureRecognizer::Result QTapAndHoldGestureRecognizer::filterEvent(const QEvent *event)
-{
- if (event->type() == QEvent::MouseButtonPress) {
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- if (timer.isActive())
- timer.stop();
- timer.start(QTapAndHoldGestureRecognizer::iterationTimeout, this);
- pressedPosition = ev->pos();
- return QGestureRecognizer::MaybeGesture;
- } else if (event->type() == QEvent::MouseMove) {
- const QMouseEvent *ev = static_cast<const QMouseEvent*>(event);
- if ((pressedPosition - ev->pos()).manhattanLength() < 15)
- return QGestureRecognizer::GestureStarted;
- else
- return QGestureRecognizer::NotGesture;
- } else if (event->type() == QEvent::MouseButtonRelease) {
- timer.stop();
- return QGestureRecognizer::NotGesture;
- }
- return QGestureRecognizer::Ignore;
-}
-
-void QTapAndHoldGestureRecognizer::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() != timer.timerId())
- return;
- if (iteration == QTapAndHoldGestureRecognizer::iterationCount) {
- timer.stop();
- emit stateChanged(QGestureRecognizer::GestureFinished);
- } else {
- emit stateChanged(QGestureRecognizer::GestureStarted);
- }
- ++iteration;
-}
-
-QGesture* QTapAndHoldGestureRecognizer::getGesture()
-{
- QGesturePrivate *d = gesture.d_func();
- d->startPos = pressedPosition;
- d->lastPos = pressedPosition;
- d->pos = pressedPosition;
- d->hotSpot = pressedPosition;
- if (iteration >= QTapAndHoldGestureRecognizer::iterationCount)
- d->state = Qt::GestureFinished;
- else
- d->state = iteration == 0 ? Qt::GestureStarted : Qt::GestureUpdated;
- return &gesture;
-}
-
-void QTapAndHoldGestureRecognizer::reset()
-{
- pressedPosition = QPoint();
- timer.stop();
- iteration = 0;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp
index c986117..011c726 100644
--- a/src/gui/kernel/qguifunctions_wince.cpp
+++ b/src/gui/kernel/qguifunctions_wince.cpp
@@ -215,13 +215,7 @@ int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID l
return ret;
}
-bool qt_wince_TextOutW(HDC hdc, int x, int y, LPWSTR lpString, UINT c)
-{
- return ExtTextOutW(hdc, x, y, 0, NULL, lpString, c, NULL);
-}
-
-
-HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCTSTR, LPCTSTR file, LPCTSTR params, LPCTSTR dir, int showCmd)
+HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd)
{
SHELLEXECUTEINFO info;
info.hwnd = hwnd;
@@ -253,17 +247,11 @@ COLORREF qt_wince_PALETTEINDEX( WORD /*wPaletteIndex*/)
return 0;
}
-BOOL qt_wince_TextOut( HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cbString )
-{
- return ExtTextOut( hdc, nXStart, nYStart - 16, 0, NULL, lpString, cbString, NULL );
-}
-
// Internal Qt -----------------------------------------------------
bool qt_wince_is_platform(const QString &platformString) {
- TCHAR tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE,
- sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0))
- if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
+ wchar_t tszPlatform[64];
+ if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform) / sizeof(wchar_t), tszPlatform, 0))
+ if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
return true;
return false;
}
@@ -316,8 +304,8 @@ void qt_wince_maximize(QWidget *widget)
void qt_wince_minimize(HWND hwnd) {
- uint exstyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
- uint style = GetWindowLongW(hwnd, GWL_STYLE);
+ uint exstyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ uint style = GetWindowLong(hwnd, GWL_STYLE);
RECT rect;
RECT crect = {0,0,0,0};
GetWindowRect(hwnd, &rect);
diff --git a/src/gui/kernel/qguifunctions_wince.h b/src/gui/kernel/qguifunctions_wince.h
index bcf2004..234c8c6 100644
--- a/src/gui/kernel/qguifunctions_wince.h
+++ b/src/gui/kernel/qguifunctions_wince.h
@@ -73,10 +73,6 @@ int qt_wince_GetDIBits(HDC, HBITMAP, uint, uint, void*, LPBITMAPINFO, uint);
// QWidget
#define SW_SHOWMINIMIZED SW_MINIMIZE
-// QPaintEngine
-bool qt_wince_TextOutW(HDC, int, int, LPWSTR, UINT);
-#define TextOutW(a,b,c,d,e) qt_wince_TextOutW(a,b,c,d,e)
-
// QRegion
#define ALTERNATE 0
#define WINDING 1
@@ -128,7 +124,7 @@ typedef struct tagTTPOLYCURVE
#define TT_PRIM_CSPLINE 3
#define ANSI_VAR_FONT 12
-HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCTSTR operation, LPCTSTR file, LPCTSTR params, LPCTSTR dir, int showCmd);
+HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR operation, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd);
#define ShellExecute(a,b,c,d,e,f) qt_wince_ShellExecute(a,b,c,d,e,f)
@@ -150,8 +146,6 @@ HWND qt_wince_SetClipboardViewer(
// Graphics ---------------------------------------------------------
COLORREF qt_wince_PALETTEINDEX( WORD wPaletteIndex );
#define PALETTEINDEX(a) qt_wince_PALETTEINDEX(a)
-BOOL qt_wince_TextOut( HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cbString );
-#define TextOut(a,b,c,d,e) qt_wince_TextOut(a,b,c,d,e)
#endif // Q_OS_WINCE
#endif // QGUIFUNCTIONS_WCE_H
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 01df47d..ab69cdf 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -60,6 +60,11 @@
#include "qregion.h"
#include "qsizepolicy.h"
#include "qtextformat.h"
+#include "qmatrix4x4.h"
+#include "qvector2d.h"
+#include "qvector3d.h"
+#include "qvector4d.h"
+#include "qquaternion.h"
#include "private/qvariant_p.h"
@@ -148,6 +153,31 @@ static void construct(QVariant::Private *x, const void *copy)
v_construct<QColor>(x, &color);
break;
}
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+ v_construct<QMatrix4x4>(x, copy);
+ break;
+#endif
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ v_construct<QVector2D>(x, copy);
+ break;
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ v_construct<QVector3D>(x, copy);
+ break;
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ v_construct<QVector4D>(x, copy);
+ break;
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ v_construct<QQuaternion>(x, copy);
+ break;
+#endif
default:
qcoreVariantHandler()->construct(x, copy);
return;
@@ -221,6 +251,31 @@ static void clear(QVariant::Private *d)
case QVariant::Pen:
v_clear<QPen>(d);
break;
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+ v_clear<QMatrix4x4>(d);
+ break;
+#endif
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ v_clear<QVector2D>(d);
+ break;
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ v_clear<QVector3D>(d);
+ break;
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ v_clear<QVector4D>(d);
+ break;
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ v_clear<QVector4D>(d);
+ break;
+#endif
default:
qcoreVariantHandler()->clear(d);
return;
@@ -266,7 +321,26 @@ static bool isNull(const QVariant::Private *d)
case QVariant::KeySequence:
#endif
case QVariant::Pen:
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+#endif
break;
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ return v_cast<QVector2D>(d)->isNull();
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ return v_cast<QVector3D>(d)->isNull();
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ return v_cast<QVector4D>(d)->isNull();
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ return v_cast<QQuaternion>(d)->isNull();
+#endif
default:
return qcoreVariantHandler()->isNull(d);
}
@@ -326,6 +400,26 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
#endif
case QVariant::Pen:
return *v_cast<QPen>(a) == *v_cast<QPen>(b);
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+ return *v_cast<QMatrix4x4>(a) == *v_cast<QMatrix4x4>(b);
+#endif
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ return *v_cast<QVector2D>(a) == *v_cast<QVector2D>(b);
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ return *v_cast<QVector3D>(a) == *v_cast<QVector3D>(b);
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ return *v_cast<QVector4D>(a) == *v_cast<QVector4D>(b);
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ return *v_cast<QQuaternion>(a) == *v_cast<QQuaternion>(b);
+#endif
default:
break;
}
@@ -513,6 +607,31 @@ static void streamDebug(QDebug dbg, const QVariant &v)
case QVariant::Pen:
dbg.nospace() << qvariant_cast<QPen>(v);
break;
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+ dbg.nospace() << qvariant_cast<QMatrix4x4>(v);
+ break;
+#endif
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ dbg.nospace() << qvariant_cast<QVector2D>(v);
+ break;
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ dbg.nospace() << qvariant_cast<QVector3D>(v);
+ break;
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ dbg.nospace() << qvariant_cast<QVector4D>(v);
+ break;
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ dbg.nospace() << qvariant_cast<QQuaternion>(v);
+ break;
+#endif
default:
qcoreVariantHandler()->debugStream(dbg, v);
break;
@@ -596,6 +715,21 @@ Q_DECL_METATYPE_HELPER(QTextLength)
Q_DECL_METATYPE_HELPER(QTextFormat)
Q_DECL_METATYPE_HELPER(QMatrix)
Q_DECL_METATYPE_HELPER(QTransform)
+#ifndef QT_NO_MATRIX4X4
+Q_DECL_METATYPE_HELPER(QMatrix4x4)
+#endif
+#ifndef QT_NO_VECTOR2D
+Q_DECL_METATYPE_HELPER(QVector2D)
+#endif
+#ifndef QT_NO_VECTOR3D
+Q_DECL_METATYPE_HELPER(QVector3D)
+#endif
+#ifndef QT_NO_VECTOR4D
+Q_DECL_METATYPE_HELPER(QVector4D)
+#endif
+#ifndef QT_NO_QUATERNION
+Q_DECL_METATYPE_HELPER(QQuaternion)
+#endif
#ifdef QT_NO_DATASTREAM
# define Q_IMPL_METATYPE_HELPER(TYPE) \
@@ -645,7 +779,32 @@ static const QMetaTypeGuiHelper qVariantGuiHelper[] = {
Q_IMPL_METATYPE_HELPER(QTextLength),
Q_IMPL_METATYPE_HELPER(QTextFormat),
Q_IMPL_METATYPE_HELPER(QMatrix),
- Q_IMPL_METATYPE_HELPER(QTransform)
+ Q_IMPL_METATYPE_HELPER(QTransform),
+#ifndef QT_NO_MATRIX4X4
+ Q_IMPL_METATYPE_HELPER(QMatrix4x4),
+#else
+ {0, 0, 0, 0},
+#endif
+#ifndef QT_NO_VECTOR2D
+ Q_IMPL_METATYPE_HELPER(QVector2D),
+#else
+ {0, 0, 0, 0},
+#endif
+#ifndef QT_NO_VECTOR3D
+ Q_IMPL_METATYPE_HELPER(QVector3D),
+#else
+ {0, 0, 0, 0},
+#endif
+#ifndef QT_NO_VECTOR4D
+ Q_IMPL_METATYPE_HELPER(QVector4D),
+#else
+ {0, 0, 0, 0},
+#endif
+#ifndef QT_NO_QUATERNION
+ Q_IMPL_METATYPE_HELPER(QQuaternion)
+#else
+ {0, 0, 0, 0}
+#endif
};
static const QVariant::Handler *qt_guivariant_last_handler = 0;
diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp
index 017c13c..8eee665 100644
--- a/src/gui/kernel/qkeymapper_mac.cpp
+++ b/src/gui/kernel/qkeymapper_mac.cpp
@@ -729,8 +729,10 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e
QString text(ourChar);
/* This is actually wrong - but unfortunatly it is the best that can be
done for now because of the Control/Meta mapping problems */
- if (modifiers & (Qt::ControlModifier | Qt::MetaModifier))
+ if (modifiers & (Qt::ControlModifier | Qt::MetaModifier)
+ && !qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
text = QString();
+ }
if (widget) {
diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp
index e40dfa0..0998631 100644
--- a/src/gui/kernel/qkeymapper_win.cpp
+++ b/src/gui/kernel/qkeymapper_win.cpp
@@ -41,7 +41,7 @@
#include "qkeymapper_p.h"
-#include <windows.h>
+#include <qt_windows.h>
#include <qdebug.h>
#include <private/qevent_p.h>
#include <private/qlocale_p.h>
@@ -57,9 +57,7 @@ QT_BEGIN_NAMESPACE
// Implemented elsewhere
extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM);
-Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-Q_CORE_EXPORT bool winPeekMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax,
- UINT wRemoveMsg);
+
extern Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id);
#ifndef LANG_PASHTO
#define LANG_PASHTO 0x63
@@ -467,12 +465,7 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer,
Q_ASSERT(vk > 0 && vk < 256);
int code = 0;
QChar unicodeBuffer[5];
- int res = 0;
- if (QSysInfo::WindowsVersion < QSysInfo::WV_NT)
- res = ToAscii(vk, scancode, kbdBuffer, reinterpret_cast<LPWORD>(unicodeBuffer), 0);
- else
- res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast<LPWSTR>(unicodeBuffer), 5, 0);
-
+ int res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast<LPWSTR>(unicodeBuffer), 5, 0);
if (res)
code = unicodeBuffer[0].toUpper().unicode();
@@ -504,38 +497,6 @@ static inline int asciiToKeycode(char a, int state)
return a & 0xff;
}
-static int inputcharset = CP_ACP;
-static inline QChar wmchar_to_unicode(DWORD c)
-{
- // qt_winMB2QString is the generalization of this function.
- QT_WA({
- return QChar((ushort)c);
- } , {
- char mb[2];
- mb[0] = c & 0xff;
- mb[1] = 0;
- WCHAR wc[1];
- MultiByteToWideChar(inputcharset, MB_PRECOMPOSED, mb, -1, wc, 1);
- return QChar(wc[0]);
- });
-}
-
-static inline QChar imechar_to_unicode(DWORD c)
-{
- // qt_winMB2QString is the generalization of this function.
- QT_WA({
- return QChar((ushort)c);
- } , {
- char mb[3];
- mb[0] = (c >> 8) & 0xff;
- mb[1] = c & 0xff;
- mb[2] = 0;
- WCHAR wc[1];
- MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mb, -1, wc, 1);
- return QChar(wc[0]);
- });
-}
-
static inline bool isModifierKey(int code)
{
return (code >= Qt::Key_Shift) && (code <= Qt::Key_ScrollLock);
@@ -635,43 +596,15 @@ void QKeyMapperPrivate::clearMappings()
/* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout()
* returns a DWORD. */
-// LCID newLCID = MAKELCID(DWORD(GetKeyboardLayout(0)), SORT_DEFAULT);
+
+ LCID newLCID = MAKELCID((DWORD)GetKeyboardLayout(0), SORT_DEFAULT);
// keyboardInputLocale = qt_localeFromLCID(newLCID);
- LCID newLCID = MAKELCID(
- reinterpret_cast<long>(GetKeyboardLayout(0)),
- SORT_DEFAULT
- );
- keyboardInputLocale = qt_localeFromLCID(newLCID);
+
bool bidi = false;
-#ifdef UNICODE
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000) {
- WCHAR wchLCIDFontSig[16];
- if (GetLocaleInfoW(newLCID,
- LOCALE_FONTSIGNATURE,
- &wchLCIDFontSig[0],
- (sizeof(wchLCIDFontSig)/sizeof(WCHAR)))
- && (wchLCIDFontSig[7] & (WCHAR)0x0800))
+ wchar_t LCIDFontSig[16];
+ if (GetLocaleInfo(newLCID, LOCALE_FONTSIGNATURE, LCIDFontSig, sizeof(LCIDFontSig) / sizeof(wchar_t))
+ && (LCIDFontSig[7] & (wchar_t)0x0800))
bidi = true;
- } else
-#endif //UNICODE
- {
- if (newLCID == 0x0859 || //Sindhi (Arabic script)
- newLCID == 0x0460) //Kashmiri (Arabic script)
- bidi = true;;
-
- switch (PRIMARYLANGID(newLCID))
- {
- case LANG_ARABIC:
- case LANG_HEBREW:
- case LANG_URDU:
- case LANG_FARSI:
- case LANG_PASHTO:
- //case LANG_UIGHUR:
- case LANG_SYRIAC:
- case LANG_DIVEHI:
- bidi = true;
- }
- }
keyboardInputDirection = bidi ? Qt::RightToLeft : Qt::LeftToRight;
}
@@ -760,7 +693,7 @@ void QKeyMapperPrivate::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
keyLayout[vk_key]->qtKey[8] = fallbackKey;
// If this vk_key a Dead Key
- if (MapVirtualKey(vk_key, 2) & 0x80008000) { // (High-order dead key on Win 95 is 0x8000)
+ if (MapVirtualKey(vk_key, 2) & 0x80000000) {
// Push a Space, then the original key through the low-level ToAscii functions.
// We do this because these functions (ToAscii / ToUnicode) will alter the internal state of
// the keyboard driver By doing the following, we set the keyboard driver state back to what
@@ -837,13 +770,13 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
bool isNumpad = (msg.wParam >= VK_NUMPAD0 && msg.wParam <= VK_NUMPAD9);
quint32 nModifiers = 0;
- if (QSysInfo::WindowsVersion < QSysInfo::WV_NT || QSysInfo::WindowsVersion & QSysInfo::WV_CE_based) {
+#if defined(QT_OS_WINCE)
nModifiers |= (GetKeyState(VK_SHIFT ) < 0 ? ShiftAny : 0);
nModifiers |= (GetKeyState(VK_CONTROL) < 0 ? ControlAny : 0);
nModifiers |= (GetKeyState(VK_MENU ) < 0 ? AltAny : 0);
nModifiers |= (GetKeyState(VK_LWIN ) < 0 ? MetaLeft : 0);
nModifiers |= (GetKeyState(VK_RWIN ) < 0 ? MetaRight : 0);
- } else {
+#else
// Map native modifiers to some bit representation
nModifiers |= (GetKeyState(VK_LSHIFT ) & 0x80 ? ShiftLeft : 0);
nModifiers |= (GetKeyState(VK_RSHIFT ) & 0x80 ? ShiftRight : 0);
@@ -857,7 +790,8 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
nModifiers |= (GetKeyState(VK_CAPITAL ) & 0x01 ? CapsLock : 0);
nModifiers |= (GetKeyState(VK_NUMLOCK ) & 0x01 ? NumLock : 0);
nModifiers |= (GetKeyState(VK_SCROLL ) & 0x01 ? ScrollLock : 0);
- }
+#endif // QT_OS_WINCE
+
if (msg.lParam & ExtendedKey)
nModifiers |= msg.lParam & ExtendedKey;
@@ -870,12 +804,12 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
// Now we know enough to either have MapVirtualKey or our own keymap tell us if it's a deadkey
bool isDeadKey = isADeadKey(msg.wParam, state)
- || MapVirtualKey(msg.wParam, 2) & 0x80008000; // High-order on 95 is 0x8000
+ || MapVirtualKey(msg.wParam, 2) & 0x80000000;
// A multi-character key not found by our look-ahead
if (msgType == WM_CHAR) {
QString s;
- QChar ch = wmchar_to_unicode(msg.wParam);
+ QChar ch = QChar((ushort)msg.wParam);
if (!ch.isNull())
s += ch;
@@ -886,7 +820,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
// Input method characters not found by our look-ahead
else if (msgType == WM_IME_CHAR) {
QString s;
- QChar ch = imechar_to_unicode(msg.wParam);
+ QChar ch = QChar((ushort)msg.wParam);
if (!ch.isNull())
s += ch;
@@ -917,8 +851,8 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
}
} else if (msgType == WM_KEYUP) {
if (dirStatus == VK_LSHIFT
- && (msg.wParam == VK_SHIFT && GetKeyState(VK_LCONTROL)
- || msg.wParam == VK_CONTROL && GetKeyState(VK_LSHIFT))) {
+ && ((msg.wParam == VK_SHIFT && GetKeyState(VK_LCONTROL))
+ || (msg.wParam == VK_CONTROL && GetKeyState(VK_LSHIFT)))) {
k0 = q->sendKeyEvent(widget, grab, QEvent::KeyPress, Qt::Key_Direction_L, 0,
QString(), false, 0,
scancode, msg.wParam, nModifiers);
@@ -927,8 +861,8 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
scancode, msg.wParam, nModifiers);
dirStatus = 0;
} else if (dirStatus == VK_RSHIFT
- && (msg.wParam == VK_SHIFT && GetKeyState(VK_RCONTROL)
- || msg.wParam == VK_CONTROL && GetKeyState(VK_RSHIFT))) {
+ && ( (msg.wParam == VK_SHIFT && GetKeyState(VK_RCONTROL))
+ || (msg.wParam == VK_CONTROL && GetKeyState(VK_RSHIFT)))) {
k0 = q->sendKeyEvent(widget, grab, QEvent::KeyPress, Qt::Key_Direction_R,
0, QString(), false, 0,
scancode, msg.wParam, nModifiers);
@@ -1050,11 +984,9 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
: msgType == WM_IME_KEYDOWN ? WM_IME_CHAR : WM_SYSCHAR);
QChar uch;
- if (winPeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) {
+ if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) {
// Found a ?_CHAR
- uch = charType == WM_IME_CHAR
- ? imechar_to_unicode(wm_char.wParam)
- : wmchar_to_unicode(wm_char.wParam);
+ uch = QChar((ushort)wm_char.wParam);
if (msgType == WM_SYSKEYDOWN && uch.isLetter() && (msg.lParam & KF_ALTDOWN))
uch = uch.toLower(); // (See doc of WM_SYSCHAR) Alt-letter
if (!code && !uch.row())
@@ -1067,7 +999,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
// to find the correct key using the current message parameters & keyboard state.
if (uch.isNull() && msgType == WM_IME_KEYDOWN) {
BYTE keyState[256];
- WCHAR newKey[3] = {0};
+ wchar_t newKey[3] = {0};
GetKeyboardState(keyState);
int val = ToUnicode(vk_key, scancode, keyState, newKey, 2, 0);
if (val == 1) {
@@ -1085,18 +1017,10 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
uch = QChar(QLatin1Char(0x7f)); // Windows doesn't know this one.
} else {
if (msgType != WM_SYSKEYDOWN || !code) {
- UINT map;
- QT_WA({
- map = MapVirtualKey(msg.wParam, 2);
- } , {
- map = MapVirtualKeyA(msg.wParam, 2);
- // High-order bit is 0x8000 on '95
- if (map & 0x8000)
- map = (map^0x8000)|0x80000000;
- });
+ UINT map = MapVirtualKey(msg.wParam, 2);
// If the high bit of the return value is set, it's a deadkey
if (!(map & 0x80000000))
- uch = wmchar_to_unicode((DWORD)map);
+ uch = QChar((ushort)map);
}
}
if (!code && !uch.row())
@@ -1237,6 +1161,8 @@ bool QKeyMapper::sendKeyEvent(QWidget *widget, bool grab,
if (QApplicationPrivate::instance()->qt_tryAccelEvent(widget, &a))
return true;
}
+#else
+ Q_UNUSED(grab);
#endif
if (!widget->isEnabled())
return false;
diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp
index 9430f1b..921afce 100644
--- a/src/gui/kernel/qlayout.cpp
+++ b/src/gui/kernel/qlayout.cpp
@@ -61,7 +61,10 @@ static int menuBarHeightForWidth(QWidget *menubar, int w)
int result = menubar->heightForWidth(qMax(w, menubar->minimumWidth()));
if (result != -1)
return result;
- result = menubar->sizeHint().height();
+ result = menubar->sizeHint()
+ .expandedTo(menubar->minimumSize())
+ .expandedTo(menubar->minimumSizeHint())
+ .boundedTo(menubar->maximumSize()).height();
if (result != -1)
return result;
}
diff --git a/src/gui/kernel/qmime_win.cpp b/src/gui/kernel/qmime_win.cpp
index bc15638..acd7cfc 100644
--- a/src/gui/kernel/qmime_win.cpp
+++ b/src/gui/kernel/qmime_win.cpp
@@ -170,7 +170,7 @@ static QByteArray getData(int cf, IDataObject *pDataObj)
if (pDataObj->GetData(&formatetc, &s) == S_OK) {
char szBuffer[4096];
ULONG actualRead = 0;
- LARGE_INTEGER pos = {0, 0};
+ LARGE_INTEGER pos = {{0, 0}};
//Move to front (can fail depending on the data model implemented)
HRESULT hr = s.pstm->Seek(pos, STREAM_SEEK_SET, NULL);
while(SUCCEEDED(hr)){
@@ -281,11 +281,7 @@ QWindowsMime::~QWindowsMime()
*/
int QWindowsMime::registerMimeType(const QString &mime)
{
-#ifdef Q_OS_WINCE
int f = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (mime.utf16()));
-#else
- int f = RegisterClipboardFormatA(mime.toLocal8Bit());
-#endif
if (!f)
qErrnoWarning("QWindowsMime::registerMimeType: Failed to register clipboard format");
@@ -401,9 +397,9 @@ QStringList QWindowsMime::allMimesForFormats(IDataObject *pDataObj)
while (S_OK == fmtenum->Next(1, &fmtetc, 0)) {
#if defined(QMIME_DEBUG) && !defined(Q_OS_WINCE)
qDebug("QWindowsMime::allMimesForFormats()");
- char buf[256] = {0};
- GetClipboardFormatNameA(fmtetc.cfFormat, buf, 255);
- qDebug("CF = %d : %s", fmtetc.cfFormat, buf);
+ wchar_t buf[256] = {0};
+ GetClipboardFormatName(fmtetc.cfFormat, buf, 255);
+ qDebug("CF = %d : %s", fmtetc.cfFormat, QString::fromWCharArray(buf));
#endif
for (int i=mimes.size()-1; i>=0; --i) {
QString format = mimes.at(i)->mimeForFormat(fmtetc);
@@ -504,7 +500,7 @@ bool QWindowsMimeText::convertFromMime(const FORMATETC &formatetc, const QMimeDa
++u;
}
res.truncate(ri);
- const int byteLength = res.length()*2;
+ const int byteLength = res.length() * sizeof(ushort);
QByteArray r(byteLength + 2, '\0');
memcpy(r.data(), res.unicode(), byteLength);
r[byteLength] = 0;
@@ -549,7 +545,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
QString str;
QByteArray data = getData(CF_UNICODETEXT, pDataObj);
if (!data.isEmpty()) {
- str = QString::fromUtf16((const unsigned short *)data.data());
+ str = QString::fromWCharArray((const wchar_t *)data.data());
str.replace(QLatin1String("\r\n"), QLatin1String("\n"));
} else {
data = getData(CF_TEXT, pDataObj);
@@ -620,11 +616,7 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat
for (int i=0; i<urls.size(); i++) {
QString fn = QDir::toNativeSeparators(urls.at(i).toLocalFile());
if (!fn.isEmpty()) {
- QT_WA({
- size += sizeof(TCHAR)*(fn.length()+1);
- } , {
- size += fn.toLocal8Bit().length()+1;
- });
+ size += sizeof(ushort) * (fn.length() + 1);
fileNames.append(fn);
}
}
@@ -636,36 +628,22 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat
d->fNC = true;
char* files = ((char*)d) + d->pFiles;
- QT_WA({
- d->fWide = true;
- TCHAR* f = (TCHAR*)files;
- for (int i=0; i<fileNames.size(); i++) {
- int l = fileNames.at(i).length();
- memcpy(f, fileNames.at(i).utf16(), l*sizeof(TCHAR));
- f += l;
- *f++ = 0;
- }
- *f = 0;
- } , {
- d->fWide = false;
- char* f = files;
- for (int i=0; i<fileNames.size(); i++) {
- QByteArray c = fileNames.at(i).toLocal8Bit();
- if (!c.isEmpty()) {
- int l = c.length();
- memcpy(f, c.constData(), l);
- f += l;
- *f++ = 0;
- }
- }
- *f = 0;
- });
+ d->fWide = true;
+ wchar_t* f = (wchar_t*)files;
+ for (int i=0; i<fileNames.size(); i++) {
+ int l = fileNames.at(i).length();
+ memcpy(f, fileNames.at(i).utf16(), l * sizeof(ushort));
+ f += l;
+ *f++ = 0;
+ }
+ *f = 0;
+
return setData(result, pmedium);
} else if (getCf(formatetc) == CF_INETURL_W) {
QList<QUrl> urls = mimeData->urls();
QByteArray result;
QString url = urls.at(0).toString();
- result = QByteArray((const char *)url.utf16(), url.length() * 2);
+ result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort));
result.append('\0');
result.append('\0');
return setData(result, pmedium);
@@ -720,15 +698,15 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
LPDROPFILES hdrop = (LPDROPFILES)data.data();
if (hdrop->fWide) {
- const ushort* filesw = (const ushort*)(data.data() + hdrop->pFiles);
- int i=0;
+ const wchar_t* filesw = (const wchar_t *)(data.data() + hdrop->pFiles);
+ int i = 0;
while (filesw[i]) {
- QString fileurl = QString::fromUtf16(filesw+i);
+ QString fileurl = QString::fromWCharArray(filesw + i);
urls += QUrl::fromLocalFile(fileurl);
i += fileurl.length()+1;
}
} else {
- const char* files = (const char*)data.data() + hdrop->pFiles;
+ const char* files = (const char *)data.data() + hdrop->pFiles;
int i=0;
while (files[i]) {
urls += QUrl::fromLocalFile(QString::fromLocal8Bit(files+i));
@@ -744,7 +722,7 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
QByteArray data = getData(CF_INETURL_W, pDataObj);
if (data.isEmpty())
return QVariant();
- return QUrl(QString::fromUtf16((const unsigned short *)data.constData()));
+ return QUrl(QString::fromWCharArray((const wchar_t *)data.constData()));
} else if (canGetData(CF_INETURL, pDataObj)) {
QByteArray data = getData(CF_INETURL, pDataObj);
if (data.isEmpty())
@@ -913,11 +891,7 @@ private:
QWindowsMimeImage::QWindowsMimeImage()
{
-#ifdef Q_OS_WINCE
- CF_PNG = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (QString::fromLatin1("PNG").utf16()));
-#else
- CF_PNG = RegisterClipboardFormatA("PNG");
-#endif
+ CF_PNG = RegisterClipboardFormat(L"PNG");
}
QVector<FORMATETC> QWindowsMimeImage::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
@@ -1114,7 +1088,7 @@ bool QBuiltInMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData
++u;
}
res.truncate(ri);
- const int byteLength = res.length()*2;
+ const int byteLength = res.length() * sizeof(ushort);
QByteArray r(byteLength + 2, '\0');
memcpy(r.data(), res.unicode(), byteLength);
r[byteLength] = 0;
@@ -1154,8 +1128,8 @@ QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDat
qDebug("QBuiltInMimes::convertToMime()");
#endif
if (mimeType == QLatin1String("text/html") && preferredType == QVariant::String) {
- // text/html is in wide chars on windows (compatible with mozillia)
- val = QString::fromUtf16((const unsigned short *)data.data());
+ // text/html is in wide chars on windows (compatible with Mozilla)
+ val = QString::fromWCharArray((const wchar_t *)data.data());
} else {
val = data; // it should be enough to return the data and let QMimeData do the rest.
}
@@ -1280,11 +1254,7 @@ bool QLastResortMimes::canConvertToMime(const QString &mimeType, IDataObject *pD
{
if (isCustomMimeType(mimeType)) {
QString clipFormat = customMimeType(mimeType);
-#ifdef Q_OS_WINCE
int cf = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (clipFormat.utf16()));
-#else
- int cf = RegisterClipboardFormatA(clipFormat.toLocal8Bit());
-#endif
return canGetData(cf, pDataObj);
} else if (formats.keys(mimeType).isEmpty()) {
// if it is not in there then register it an see if we can get it
@@ -1304,11 +1274,7 @@ QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *p
QByteArray data;
if (isCustomMimeType(mimeType)) {
QString clipFormat = customMimeType(mimeType);
-#ifdef Q_OS_WINCE
int cf = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (clipFormat.utf16()));
-#else
- int cf = RegisterClipboardFormatA(clipFormat.toLocal8Bit());
-#endif
data = getData(cf, pDataObj);
} else if (formats.keys(mimeType).isEmpty()) {
int cf = QWindowsMime::registerMimeType(mimeType);
@@ -1325,46 +1291,38 @@ QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *p
QString QLastResortMimes::mimeForFormat(const FORMATETC &formatetc) const
{
QString format = formats.value(getCf(formatetc));
- if (format.isEmpty()) {
- QByteArray ba;
- QString clipFormat;
- int len;
- QT_WA({
- ba.resize(256*2);
- len = GetClipboardFormatNameW(getCf(formatetc), (TCHAR*)ba.data(), 255);
- if (len)
- clipFormat = QString::fromUtf16((ushort *)ba.data(), len);
- } , {
- ba.resize(256);
- len = GetClipboardFormatNameA(getCf(formatetc), ba.data(), 255);
- if (len)
- clipFormat = QString::fromLocal8Bit(ba.data(), len);
- });
- if (len) {
+ if (!format.isEmpty())
+ return format;
+
+ wchar_t buffer[256];
+ int len = GetClipboardFormatName(getCf(formatetc), buffer, 256);
+
+ if (len) {
+ QString clipFormat = QString::fromWCharArray(buffer, len);
#ifndef QT_NO_DRAGANDDROP
- if (QInternalMimeData::canReadData(clipFormat))
- format = clipFormat;
- else if((formatetc.cfFormat >= 0xC000)){
- //create the mime as custom. not registered.
- if (!excludeList.contains(clipFormat, Qt::CaseInsensitive)) {
- //check if this is a mime type
- bool ianaType = false;
- int sz = ianaTypes.size();
- for (int i = 0; i < sz; i++) {
- if (clipFormat.startsWith(ianaTypes[i], Qt::CaseInsensitive)) {
- ianaType = true;
- break;
- }
+ if (QInternalMimeData::canReadData(clipFormat))
+ format = clipFormat;
+ else if((formatetc.cfFormat >= 0xC000)){
+ //create the mime as custom. not registered.
+ if (!excludeList.contains(clipFormat, Qt::CaseInsensitive)) {
+ //check if this is a mime type
+ bool ianaType = false;
+ int sz = ianaTypes.size();
+ for (int i = 0; i < sz; i++) {
+ if (clipFormat.startsWith(ianaTypes[i], Qt::CaseInsensitive)) {
+ ianaType = true;
+ break;
}
- if (!ianaType)
- format = QLatin1String(x_qt_windows_mime) + clipFormat + QLatin1Char('\"');
- else
- format = clipFormat;
}
+ if (!ianaType)
+ format = QLatin1String(x_qt_windows_mime) + clipFormat + QLatin1Char('\"');
+ else
+ format = clipFormat;
}
-#endif //QT_NO_DRAGANDDROP
}
+#endif //QT_NO_DRAGANDDROP
}
+
return format;
}
diff --git a/src/gui/kernel/qmultitouch_mac.mm b/src/gui/kernel/qmultitouch_mac.mm
index 3fe85a9..3d2eae6 100644
--- a/src/gui/kernel/qmultitouch_mac.mm
+++ b/src/gui/kernel/qmultitouch_mac.mm
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
#ifdef QT_MAC_USE_COCOA
-QHash<int, QCocoaTouch*> QCocoaTouch::_currentTouches;
+QHash<qint64, QCocoaTouch*> QCocoaTouch::_currentTouches;
QPointF QCocoaTouch::_screenReferencePos;
QPointF QCocoaTouch::_trackpadReferencePos;
int QCocoaTouch::_idAssignmentCount = 0;
@@ -62,7 +62,7 @@ QCocoaTouch::QCocoaTouch(NSTouch *nstouch)
_touchPoint.setId(_idAssignmentCount++);
_touchPoint.setPressure(1.0);
- _identity = int([nstouch identity]);
+ _identity = qint64([nstouch identity]);
_currentTouches.insert(_identity, this);
updateTouchData(nstouch, NSTouchPhaseBegan);
}
@@ -100,7 +100,7 @@ void QCocoaTouch::updateTouchData(NSTouch *nstouch, NSTouchPhase phase)
QCocoaTouch *QCocoaTouch::findQCocoaTouch(NSTouch *nstouch)
{
- int identity = int([nstouch identity]);
+ qint64 identity = qint64([nstouch identity]);
if (_currentTouches.contains(identity))
return _currentTouches.value(identity);
return 0;
diff --git a/src/gui/kernel/qmultitouch_mac_p.h b/src/gui/kernel/qmultitouch_mac_p.h
index 3fa8f6c..618e9ca 100644
--- a/src/gui/kernel/qmultitouch_mac_p.h
+++ b/src/gui/kernel/qmultitouch_mac_p.h
@@ -74,7 +74,7 @@ class QCocoaTouch
static void setMouseInDraggingState(bool inDraggingState);
private:
- static QHash<int, QCocoaTouch*> _currentTouches;
+ static QHash<qint64, QCocoaTouch*> _currentTouches;
static QPointF _screenReferencePos;
static QPointF _trackpadReferencePos;
static int _idAssignmentCount;
@@ -82,7 +82,7 @@ class QCocoaTouch
static bool _updateInternalStateOnly;
QTouchEvent::TouchPoint _touchPoint;
- int _identity;
+ qint64 _identity;
QCocoaTouch(NSTouch *nstouch);
~QCocoaTouch();
diff --git a/src/gui/kernel/qsound_win.cpp b/src/gui/kernel/qsound_win.cpp
index 7330d4b..82854ae 100644
--- a/src/gui/kernel/qsound_win.cpp
+++ b/src/gui/kernel/qsound_win.cpp
@@ -77,13 +77,8 @@ public:
QAuServerWindows::QAuServerWindows(QObject* parent) :
QAuServer(parent), current(0)
{
- QT_WA({
- mutex = CreateMutexW(0, 0, 0);
- event = CreateEventW(0, FALSE, FALSE, 0);
- } , {
- mutex = CreateMutexA(0, 0, 0);
- event = CreateEventA(0, FALSE, FALSE, 0);
- });
+ mutex = CreateMutex(0, 0, 0);
+ event = CreateEvent(0, FALSE, FALSE, 0);
}
QAuServerWindows::~QAuServerWindows()
@@ -133,13 +128,9 @@ DWORD WINAPI SoundPlayProc(LPVOID param)
if (loops == -1)
flags |= SND_LOOP;
- QT_WA({
- PlaySoundW((TCHAR*)filename.utf16(), 0, flags);
- } , {
- PlaySoundA(QFile::encodeName(filename).data(), 0, flags);
- });
- if (sound && loops == 1)
- server->decLoop(sound);
+ PlaySound((wchar_t*)filename.utf16(), 0, flags);
+ if (sound && loops == 1)
+ server->decLoop(sound);
// GUI thread continues, but we are done as well.
SetEvent(event);
@@ -148,18 +139,13 @@ DWORD WINAPI SoundPlayProc(LPVOID param)
QPointer<QSound> guarded_sound = sound;
SetEvent(event);
- for (int l = 0; l < loops && server->current; ++l) {
- QT_WA( {
- PlaySoundW( (TCHAR*)filename.utf16(), 0, SND_FILENAME|SND_SYNC );
- } , {
- PlaySoundA( QFile::encodeName(filename).data(), 0,
- SND_FILENAME|SND_SYNC );
- } );
-
- if (guarded_sound)
- server->decLoop(guarded_sound);
- }
- server->current = 0;
+ for (int l = 0; l < loops && server->current; ++l) {
+ PlaySound((wchar_t*)filename.utf16(), 0, SND_FILENAME | SND_SYNC);
+
+ if (guarded_sound)
+ server->decLoop(guarded_sound);
+ }
+ server->current = 0;
}
ReleaseMutex(mutex);
@@ -169,7 +155,7 @@ DWORD WINAPI SoundPlayProc(LPVOID param)
void QAuServerWindows::playHelper(const QString &filename, int loop, QSound *snd)
{
if (loop == 0)
- return;
+ return;
// busy?
if (WaitForSingleObject(mutex, 0) == WAIT_TIMEOUT)
return;
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
new file mode 100644
index 0000000..c8b11c5
--- /dev/null
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -0,0 +1,254 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstandardgestures.h"
+#include "qstandardgestures_p.h"
+
+#include <qabstractscrollarea.h>
+#include <qscrollbar.h>
+#include <private/qapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QPanGesture
+ \since 4.6
+
+ \brief The QPanGesture class represents a Pan gesture,
+ providing additional information related to panning.
+*/
+
+/*!
+ Creates a new Pan gesture handler object and marks it as a child of \a
+ parent.
+
+ On some platform like Windows it's necessary to provide a non-null widget
+ as \a parent to get native gesture support.
+*/
+QPanGesture::QPanGesture(QWidget *parent)
+ : QGesture(*new QPanGesturePrivate, parent)
+{
+#ifdef Q_WS_WIN
+ if (parent) {
+ QApplicationPrivate* getQApplicationPrivateInternal();
+ QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
+ qAppPriv->widgetGestures[parent].pan = this;
+ }
+#endif
+}
+
+/*! \internal */
+bool QPanGesture::event(QEvent *event)
+{
+#ifdef Q_WS_WIN
+ QApplicationPrivate* getQApplicationPrivateInternal();
+ switch (event->type()) {
+ case QEvent::ParentAboutToChange:
+ if (QWidget *w = qobject_cast<QWidget*>(parent()))
+ getQApplicationPrivateInternal()->widgetGestures[w].pan = 0;
+ break;
+ case QEvent::ParentChange:
+ if (QWidget *w = qobject_cast<QWidget*>(parent()))
+ getQApplicationPrivateInternal()->widgetGestures[w].pan = this;
+ break;
+ default:
+ break;
+ }
+#endif
+ return QObject::event(event);
+}
+
+/*! \internal */
+bool QPanGesture::filterEvent(QEvent *event)
+{
+ Q_D(QPanGesture);
+ if (!event->spontaneous())
+ return false;
+ const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
+ if (event->type() == QEvent::TouchBegin) {
+ d->touchPoints = ev->touchPoints();
+ const QPoint p = ev->touchPoints().at(0).pos().toPoint();
+ setStartPos(p);
+ setLastPos(p);
+ setPos(p);
+ return false;
+ } else if (event->type() == QEvent::TouchEnd) {
+ if (state() != Qt::NoGesture) {
+ setState(Qt::GestureFinished);
+ setLastPos(pos());
+ setPos(ev->touchPoints().at(0).pos().toPoint());
+ emit triggered();
+ emit finished();
+ }
+ setState(Qt::NoGesture);
+ reset();
+ } else if (event->type() == QEvent::TouchUpdate) {
+ d->touchPoints = ev->touchPoints();
+ QPointF pt = d->touchPoints.at(0).pos() - d->touchPoints.at(0).startPos();
+ setLastPos(pos());
+ setPos(ev->touchPoints().at(0).pos().toPoint());
+ if (pt.x() > 10 || pt.y() > 10 || pt.x() < -10 || pt.y() < -10) {
+ if (state() == Qt::NoGesture)
+ setState(Qt::GestureStarted);
+ else
+ setState(Qt::GestureUpdated);
+ emit triggered();
+ }
+ }
+ return false;
+}
+
+/*! \internal */
+void QPanGesture::reset()
+{
+ Q_D(QPanGesture);
+ d->touchPoints.clear();
+}
+
+/*!
+ \property QPanGesture::totalOffset
+
+ Specifies a total pan offset since the start of the gesture.
+*/
+QSize QPanGesture::totalOffset() const
+{
+ QPoint pt = pos() - startPos();
+ return QSize(pt.x(), pt.y());
+}
+
+/*!
+ \property QPanGesture::lastOffset
+
+ Specifies a pan offset since the last time the gesture was
+ triggered.
+*/
+QSize QPanGesture::lastOffset() const
+{
+ QPoint pt = pos() - lastPos();
+ return QSize(pt.x(), pt.y());
+}
+
+/*!
+ \class QTapAndHoldGesture
+ \since 4.6
+
+ \brief The QTapAndHoldGesture class represents a Tap-and-Hold gesture,
+ providing additional information.
+*/
+
+const int QTapAndHoldGesturePrivate::iterationCount = 40;
+const int QTapAndHoldGesturePrivate::iterationTimeout = 50;
+
+/*!
+ Creates a new Tap and Hold gesture handler object and marks it as a child
+ of \a parent.
+
+ On some platforms like Windows there is a system-wide tap and hold gesture
+ that cannot be overriden, hence the gesture might never trigger and default
+ context menu will be shown instead.
+*/
+QTapAndHoldGesture::QTapAndHoldGesture(QWidget *parent)
+ : QGesture(*new QTapAndHoldGesturePrivate, parent)
+{
+}
+
+/*! \internal */
+bool QTapAndHoldGesture::filterEvent(QEvent *event)
+{
+ Q_D(QTapAndHoldGesture);
+ if (!event->spontaneous())
+ return false;
+ const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
+ switch (event->type()) {
+ case QEvent::TouchBegin: {
+ if (d->timer.isActive())
+ d->timer.stop();
+ d->timer.start(QTapAndHoldGesturePrivate::iterationTimeout, this);
+ const QPoint p = ev->touchPoints().at(0).pos().toPoint();
+ setStartPos(p);
+ setLastPos(p);
+ setPos(p);
+ break;
+ }
+ case QEvent::TouchUpdate:
+ if (ev->touchPoints().size() != 1)
+ reset();
+ else if ((startPos() - ev->touchPoints().at(0).pos().toPoint()).manhattanLength() > 15)
+ reset();
+ break;
+ case QEvent::TouchEnd:
+ reset();
+ break;
+ default:
+ break;
+ }
+ return false;
+}
+
+/*! \internal */
+void QTapAndHoldGesture::timerEvent(QTimerEvent *event)
+{
+ Q_D(QTapAndHoldGesture);
+ if (event->timerId() != d->timer.timerId())
+ return;
+ if (d->iteration == QTapAndHoldGesturePrivate::iterationCount) {
+ d->timer.stop();
+ setState(Qt::GestureFinished);
+ emit triggered();
+ } else {
+ setState(Qt::GestureStarted);
+ emit triggered();
+ }
+ ++d->iteration;
+}
+
+/*! \internal */
+void QTapAndHoldGesture::reset()
+{
+ Q_D(QTapAndHoldGesture);
+ if (state() != Qt::NoGesture)
+ emit cancelled();
+ setState(Qt::NoGesture);
+ d->timer.stop();
+ d->iteration = 0;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/embedded/qmousevr41xx_qws.h b/src/gui/kernel/qstandardgestures.h
index 46d07e0..2234702 100644
--- a/src/gui/embedded/qmousevr41xx_qws.h
+++ b/src/gui/kernel/qstandardgestures.h
@@ -39,10 +39,13 @@
**
****************************************************************************/
-#ifndef QMOUSEVR41XX_QWS_H
-#define QMOUSEVR41XX_QWS_H
+#ifndef QSTANDARDGESTURES_H
+#define QSTANDARDGESTURES_H
-#include <QtGui/qmouse_qws.h>
+#include <QtGui/qevent.h>
+#include <QtCore/qbasictimer.h>
+
+#include <QtGui/qgesture.h>
QT_BEGIN_HEADER
@@ -50,31 +53,49 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#ifndef QT_NO_QWS_MOUSE_VR41XX
+class QPanGesturePrivate;
+class Q_GUI_EXPORT QPanGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QPanGesture)
-class QWSVr41xxMouseHandlerPrivate;
+ Q_PROPERTY(QSize totalOffset READ totalOffset)
+ Q_PROPERTY(QSize lastOffset READ lastOffset)
-class QWSVr41xxMouseHandler : public QWSCalibratedMouseHandler
-{
public:
- explicit QWSVr41xxMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSVr41xxMouseHandler();
+ QPanGesture(QWidget *parent);
- void resume();
- void suspend();
+ bool filterEvent(QEvent *event);
+ void reset();
+
+ QSize totalOffset() const;
+ QSize lastOffset() const;
protected:
- QWSVr41xxMouseHandlerPrivate *d;
+ bool event(QEvent *event);
private:
- friend class QWSVr41xxMouseHandlerPrivate;
+ friend class QWidget;
};
-#endif // QT_NO_QWS_MOUSE_VR41XX
+class QTapAndHoldGesturePrivate;
+class Q_GUI_EXPORT QTapAndHoldGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QTapAndHoldGesture)
+
+public:
+ QTapAndHoldGesture(QWidget *parent);
+
+ bool filterEvent(QEvent *event);
+ void reset();
+
+protected:
+ void timerEvent(QTimerEvent *event);
+};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMOUSEVR41XX_QWS_H
+#endif // QSTANDARDGESTURES_H
diff --git a/src/gui/kernel/qgesturerecognizer_p.h b/src/gui/kernel/qstandardgestures_p.h
index e250201..bb11c9f 100644
--- a/src/gui/kernel/qgesturerecognizer_p.h
+++ b/src/gui/kernel/qstandardgestures_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QGESTURERECOGNIZER_P_H
-#define QGESTURERECOGNIZER_P_H
+#ifndef QSTANDARDGESTURES_P_H
+#define QSTANDARDGESTURES_P_H
//
// W A R N I N G
@@ -53,20 +53,39 @@
// We mean it.
//
-#include <private/qobject_p.h>
+#include "qevent.h"
+#include "qbasictimer.h"
+#include "qdebug.h"
+
+#include "qgesture.h"
+#include "qgesture_p.h"
QT_BEGIN_NAMESPACE
-class QGestureRecognizerPrivate : public QObjectPrivate
+class QPanGesturePrivate : public QGesturePrivate
{
+ Q_DECLARE_PUBLIC(QPanGesture)
+
public:
- QGestureRecognizerPrivate();
+ QPanGesturePrivate() { }
+
+ QList<QTouchEvent::TouchPoint> touchPoints;
+};
+
+class QTapAndHoldGesturePrivate : public QGesturePrivate
+{
+ Q_DECLARE_PUBLIC(QTapAndHoldGesture)
public:
- Qt::GestureType gestureType;
- QString customGestureType;
+ QTapAndHoldGesturePrivate()
+ : iteration(0) { }
+
+ QBasicTimer timer;
+ int iteration;
+ static const int iterationCount;
+ static const int iterationTimeout;
};
QT_END_NAMESPACE
-#endif // QGESTURERECOGNIZER_P_H
+#endif // QSTANDARDGESTURES_P_H
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 073a00e..223e36b 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -77,6 +77,7 @@
#include <qwidget.h>
#include <qdesktopwidget.h>
#include <qevent.h>
+#include <qpixmapcache.h>
#include <private/qevent_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qt_mac_p.h>
@@ -177,11 +178,10 @@ void macWindowToolbarShow(const QWidget *widget, bool show )
{
OSWindowRef wnd = qt_mac_window_for(widget);
#if QT_MAC_USE_COCOA
- NSToolbar *toolbar = [wnd toolbar];
- if (toolbar) {
+ if (NSToolbar *toolbar = [wnd toolbar]) {
QMacCocoaAutoReleasePool pool;
if (show != [toolbar isVisible]) {
- [wnd toggleToolbarShown:wnd];
+ [toolbar setVisible:show];
} else {
// The toolbar may be in sync, but we are not, update our framestrut.
qt_widget_private(const_cast<QWidget *>(widget))->updateFrameStrut();
@@ -197,22 +197,21 @@ void macWindowToolbarSet( void * /*OSWindowRef*/ window, void *toolbarRef )
{
OSWindowRef wnd = static_cast<OSWindowRef>(window);
#if QT_MAC_USE_COCOA
- [wnd setToolbar:static_cast<NSToolbar *>(toolbarRef)];
+ [wnd setToolbar:static_cast<NSToolbar *>(toolbarRef)];
#else
SetWindowToolbar(wnd, static_cast<HIToolbarRef>(toolbarRef));
#endif
}
-bool macWindowToolbarVisible( void * /*OSWindowRef*/ window )
+bool macWindowToolbarIsVisible( void * /*OSWindowRef*/ window )
{
OSWindowRef wnd = static_cast<OSWindowRef>(window);
#if QT_MAC_USE_COCOA
- NSToolbar *toolbar = [wnd toolbar];
- if (toolbar)
+ if (NSToolbar *toolbar = [wnd toolbar])
return [toolbar isVisible];
return false;
#else
- return IsWindowToolbarVisible(wnd);
+ return IsWindowToolbarVisible(wnd);
#endif
}
@@ -220,12 +219,12 @@ void macWindowSetHasShadow( void * /*OSWindowRef*/ window, bool hasShadow )
{
OSWindowRef wnd = static_cast<OSWindowRef>(window);
#if QT_MAC_USE_COCOA
- [wnd setHasShadow:BOOL(hasShadow)];
+ [wnd setHasShadow:BOOL(hasShadow)];
#else
- if (hasShadow)
- ChangeWindowAttributes(wnd, 0, kWindowNoShadowAttribute);
- else
- ChangeWindowAttributes(wnd, kWindowNoShadowAttribute, 0);
+ if (hasShadow)
+ ChangeWindowAttributes(wnd, 0, kWindowNoShadowAttribute);
+ else
+ ChangeWindowAttributes(wnd, kWindowNoShadowAttribute, 0);
#endif
}
@@ -233,9 +232,9 @@ void macWindowFlush(void * /*OSWindowRef*/ window)
{
OSWindowRef wnd = static_cast<OSWindowRef>(window);
#if QT_MAC_USE_COCOA
- [wnd flushWindowIfNeeded];
+ [wnd flushWindowIfNeeded];
#else
- HIWindowFlush(wnd);
+ HIWindowFlush(wnd);
#endif
}
@@ -352,6 +351,12 @@ Qt::MouseButton qt_mac_get_button(EventMouseButton button)
return Qt::NoButton;
}
+void macSendToolbarChangeEvent(QWidget *widget)
+{
+ QToolBarChangeEvent ev(!(GetCurrentKeyModifiers() & cmdKey));
+ qt_sendSpontaneousEvent(widget, &ev);
+}
+
Q_GLOBAL_STATIC(QMacTabletHash, tablet_hash)
QMacTabletHash *qt_mac_tablet_hash()
{
@@ -1131,4 +1136,61 @@ CGFloat qt_mac_get_scalefactor()
#endif
}
+QString qt_mac_get_pasteboardString()
+{
+ QMacCocoaAutoReleasePool pool;
+ NSPasteboard *pb = [NSPasteboard generalPasteboard];
+ NSString *text = [pb stringForType:NSStringPboardType];
+ if (text) {
+ return qt_mac_NSStringToQString(text);
+ } else {
+ return QString();
+ }
+}
+
+QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
+{
+ QPixmap ret(width, height);
+ ret.fill(QColor(0, 0, 0, 0));
+
+ CGRect rect = CGRectMake(0, 0, width, height);
+
+ CGContextRef ctx = qt_mac_cg_context(&ret);
+ CGAffineTransform old_xform = CGContextGetCTM(ctx);
+ CGContextConcatCTM(ctx, CGAffineTransformInvert(old_xform));
+ CGContextConcatCTM(ctx, CGAffineTransformIdentity);
+
+ ::RGBColor b;
+ b.blue = b.green = b.red = 255*255;
+ PlotIconRefInContext(ctx, &rect, kAlignNone, kTransformNone, &b, kPlotIconRefNormalFlags, icon);
+ CGContextRelease(ctx);
+ return ret;
+}
+
+void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon, QStyle::StandardPixmap standardIcon)
+{
+ int size = 16;
+ while (size <= 128) {
+
+ const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size);
+ QPixmap mainIcon;
+ if (standardIcon >= QStyle::SP_CustomBase) {
+ mainIcon = qt_mac_convert_iconref(icon, size, size);
+ } else if (QPixmapCache::find(cacheKey, mainIcon) == false) {
+ mainIcon = qt_mac_convert_iconref(icon, size, size);
+ QPixmapCache::insert(cacheKey, mainIcon);
+ }
+
+ if (overlayIcon) {
+ int littleSize = size / 2;
+ QPixmap overlayPix = qt_mac_convert_iconref(overlayIcon, littleSize, littleSize);
+ QPainter painter(&mainIcon);
+ painter.drawPixmap(size - littleSize, size - littleSize, overlayPix);
+ }
+
+ retIcon->addPixmap(mainIcon);
+ size += size; // 16 -> 32 -> 64 -> 128
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index 7b975f5..af3b4cb 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -105,6 +105,8 @@
#include <qpoint.h>
#include "private/qt_mac_p.h"
+struct HIContentBorderMetrics;
+
#ifdef Q_WS_MAC32
typedef struct _NSPoint NSPoint; // Just redefine here so I don't have to pull in all of Cocoa.
#else
@@ -118,10 +120,10 @@ void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds = 0);
bool macWindowIsTextured(void * /*OSWindowRef*/ window);
void macWindowToolbarShow(const QWidget *widget, bool show );
void macWindowToolbarSet( void * /*OSWindowRef*/ window, void* toolbarRef );
-bool macWindowToolbarVisible( void * /*OSWindowRef*/ window );
+bool macWindowToolbarIsVisible( void * /*OSWindowRef*/ window );
void macWindowSetHasShadow( void * /*OSWindowRef*/ window, bool hasShadow );
void macWindowFlush(void * /*OSWindowRef*/ window);
-struct HIContentBorderMetrics;
+void macSendToolbarChangeEvent(QWidget *widget);
void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::HIContentBorderMetrics &metrics);
void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm);
void qt_mac_update_mouseTracking(QWidget *widget);
@@ -142,6 +144,9 @@ struct ::TabletProximityRec;
void qt_dispatchTabletProximityEvent(const ::TabletProximityRec &proxRec);
Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags);
Qt::KeyboardModifiers qt_cocoaDragOperation2QtModifiers(uint dragOperations);
+QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height);
+void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon,
+ QStyle::StandardPixmap standardIcon = QStyle::SP_CustomBase);
inline int flipYCoordinate(int y)
{
return QApplication::desktop()->screenGeometry(0).height() - y;
@@ -162,6 +167,7 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
void qt_syncCocoaTitleBarButtons(OSWindowRef window, QWidget *widgetForWindow);
CGFloat qt_mac_get_scalefactor();
+QString qt_mac_get_pasteboardString();
#ifdef __OBJC__
inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)
diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp
index 067c783..62b5863 100644
--- a/src/gui/kernel/qwhatsthis.cpp
+++ b/src/gui/kernel/qwhatsthis.cpp
@@ -226,7 +226,9 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor
text);
}
#if defined(Q_WS_WIN)
- if ((QSysInfo::WindowsVersion&QSysInfo::WV_NT_based) > QSysInfo::WV_2000) {
+ if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
+ && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ {
BOOL shadow;
SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0);
shadowWidth = shadow ? 0 : 6;
@@ -302,7 +304,9 @@ void QWhatsThat::paintEvent(QPaintEvent*)
{
bool drawShadow = true;
#if defined(Q_WS_WIN)
- if ((QSysInfo::WindowsVersion&QSysInfo::WV_NT_based) > QSysInfo::WV_2000) {
+ if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
+ && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ {
BOOL shadow;
SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0);
drawShadow = !shadow;
@@ -347,6 +351,7 @@ void QWhatsThat::paintEvent(QPaintEvent*)
rect.translate(-r.x(), -r.y());
p.setClipRect(rect);
QAbstractTextDocumentLayout::PaintContext context;
+ context.palette.setBrush(QPalette::Text, context.palette.toolTipText());
doc->documentLayout()->draw(&p, context);
}
else
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 4c2fe9d..334706d 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -82,6 +82,8 @@
#include "private/qstyle_p.h"
#include "private/qinputcontext_p.h"
#include "qfileinfo.h"
+#include "qstandardgestures.h"
+#include "qstandardgestures_p.h"
#if defined (Q_WS_WIN)
# include <private/qwininputcontext_p.h>
@@ -111,9 +113,9 @@
#include "private/qgraphicsproxywidget_p.h"
#include "QtGui/qabstractscrollarea.h"
#include "private/qabstractscrollarea_p.h"
+#include "private/qevent_p.h"
#include "private/qgraphicssystem_p.h"
-#include "private/qgesturemanager_p.h"
// widget/widget data creation count
//#define QWIDGET_EXTRA_DEBUG
@@ -132,8 +134,6 @@ Q_GUI_EXPORT void qt_x11_set_global_double_buffer(bool enable)
}
#endif
-QString qt_getStandardGestureTypeName(Qt::GestureType);
-
static inline bool qRectIntersects(const QRect &r1, const QRect &r2)
{
return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) &&
@@ -869,8 +869,8 @@ void QWidget::setAutoFillBackground(bool enabled)
\list
\o X11: This feature relies on the use of an X server that supports ARGB visuals
and a compositing window manager.
- \o Windows: This feature requires Windows 2000 or later. The widget needs to have
- the Qt::FramelessWindowHint window flag set for the translucency to work.
+ \o Windows: The widget needs to have the Qt::FramelessWindowHint window flag set
+ for the translucency to work.
\endlist
@@ -2035,10 +2035,9 @@ void QPixmap::fill( const QWidget *widget, const QPoint &off )
QPainter p(this);
p.translate(-off);
widget->d_func()->paintBackground(&p, QRect(off, size()));
-
}
-static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush)
+static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush)
{
Q_ASSERT(painter);
@@ -2047,8 +2046,8 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QPoin
// Optimize pattern filling on mac by using HITheme directly
// when filling with the standard widget background.
// Defined in qmacstyle_mac.cpp
- extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush);
- qt_mac_fill_background(painter, rgn, offset, brush);
+ extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush);
+ qt_mac_fill_background(painter, rgn, brush);
#else
#if !defined(QT_NO_STYLE_S60)
// Defined in qs60style.cpp
@@ -2057,24 +2056,37 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QPoin
if (!qt_s60_fill_background(painter, rgn, offset, brush))
#endif // !defined(QT_NO_STYLE_S60)
{
- const QRegion translated = rgn.translated(offset);
- const QRect rect(translated.boundingRect());
- painter->setClipRegion(translated);
+ const QRect rect(rgn.boundingRect());
+ painter->setClipRegion(rgn);
painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
}
#endif // Q_WS_MAC
} else {
const QVector<QRect> &rects = rgn.rects();
for (int i = 0; i < rects.size(); ++i)
- painter->fillRect(rects.at(i).translated(offset), brush);
+ painter->fillRect(rects.at(i), brush);
}
}
-
-void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, const QPoint &offset, int flags) const
+void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int flags) const
{
Q_Q(const QWidget);
+#ifndef QT_NO_SCROLLAREA
+ bool resetBrushOrigin = false;
+ QPointF oldBrushOrigin;
+ //If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture
+ QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);
+ if (scrollArea && scrollArea->viewport() == q) {
+ QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr;
+ QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
+ oldBrushOrigin = painter->brushOrigin();
+ resetBrushOrigin = true;
+ painter->setBrushOrigin(-priv->contentsOffset());
+
+ }
+#endif // QT_NO_SCROLLAREA
+
const QBrush autoFillBrush = q->palette().brush(q->backgroundRole());
if ((flags & DrawAsRoot) && !(q->autoFillBackground() && autoFillBrush.isOpaque())) {
@@ -2083,19 +2095,24 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, cons
if (!(flags & DontSetCompositionMode) && painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff))
painter->setCompositionMode(QPainter::CompositionMode_Source); //copy alpha straight in
#endif
- fillRegion(painter, rgn, offset, bg);
-
+ fillRegion(painter, rgn, bg);
}
if (q->autoFillBackground())
- fillRegion(painter, rgn, offset, autoFillBrush);
+ fillRegion(painter, rgn, autoFillBrush);
+
if (q->testAttribute(Qt::WA_StyledBackground)) {
- painter->setClipRegion(rgn.translated(offset));
+ painter->setClipRegion(rgn);
QStyleOption opt;
opt.initFrom(q);
q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);
}
+
+#ifndef QT_NO_SCROLLAREA
+ if (resetBrushOrigin)
+ painter->setBrushOrigin(oldBrushOrigin);
+#endif // QT_NO_SCROLLAREA
}
/*
@@ -4619,6 +4636,11 @@ void QWidget::unsetLayoutDirection()
By default, this property contains a cursor with the Qt::ArrowCursor
shape.
+ Some underlying window implementations will reset the cursor if it
+ leaves a widget even if the mouse is grabbed. If you want to have
+ a cursor set for all widgets, even when outside the window, consider
+ QApplication::setOverrideCursor().
+
\sa QApplication::setOverrideCursor()
*/
@@ -5078,19 +5100,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
&& !q->testAttribute(Qt::WA_OpaquePaintEvent) && !q->testAttribute(Qt::WA_NoSystemBackground)) {
QPainter p(q);
- QPoint scrollAreaOffset;
-
-#ifndef QT_NO_SCROLLAREA
- QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);
- if (scrollArea && scrollArea->viewport() == q) {
- QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr.data();
- QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
- scrollAreaOffset = priv->contentsOffset();
- p.translate(-scrollAreaOffset);
- }
-#endif // QT_NO_SCROLLAREA
-
- paintBackground(&p, toBePainted, scrollAreaOffset, (asRoot || onScreen) ? flags | DrawAsRoot : 0);
+ paintBackground(&p, toBePainted, (asRoot || onScreen) ? flags | DrawAsRoot : 0);
}
if (!sharedPainter)
@@ -5523,8 +5533,6 @@ QString QWidget::windowIconText() const
\list
\o The file name of the specified path, obtained using QFileInfo::fileName().
- \o An optional \c{*} character, if the \l windowModified property is set,
- as per the Apple Human Interface Guidelines.
\endlist
On Windows and X11:
@@ -5573,7 +5581,7 @@ void QWidgetPrivate::setWindowFilePath_helper(const QString &filePath)
{
if (extra->topextra && extra->topextra->caption.isEmpty()) {
#ifdef Q_WS_MAC
- setWindowTitle_helper(filePath);
+ setWindowTitle_helper(QFileInfo(filePath).fileName());
#else
Q_Q(QWidget);
Q_UNUSED(filePath);
@@ -7571,7 +7579,6 @@ bool QWidget::event(QEvent *event)
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
#endif
- case QEvent::Gesture:
return false;
default:
break;
@@ -7972,9 +7979,6 @@ bool QWidget::event(QEvent *event)
d->needWindowChange = false;
break;
#endif
- case QEvent::Gesture:
- event->ignore();
- break;
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
@@ -8018,6 +8022,59 @@ bool QWidget::event(QEvent *event)
#endif
break;
}
+#ifdef Q_WS_WIN
+ case QEvent::WinGesture: {
+ QWinGestureEvent *ev = static_cast<QWinGestureEvent*>(event);
+ QApplicationPrivate *qAppPriv = qApp->d_func();
+ QApplicationPrivate::WidgetStandardGesturesMap::iterator it;
+ it = qAppPriv->widgetGestures.find(this);
+ if (it != qAppPriv->widgetGestures.end()) {
+ Qt::GestureState state = Qt::GestureUpdated;
+ if (qAppPriv->lastGestureId == 0)
+ state = Qt::GestureStarted;
+ QWinGestureEvent::Type type = ev->gestureType;
+ if (ev->gestureType == QWinGestureEvent::GestureEnd) {
+ type = (QWinGestureEvent::Type)qAppPriv->lastGestureId;
+ state = Qt::GestureFinished;
+ }
+
+ QGesture *gesture = 0;
+ switch (type) {
+ case QWinGestureEvent::Pan: {
+ QPanGesture *pan = it.value().pan;
+ gesture = pan;
+ if (state == Qt::GestureStarted) {
+ gesture->setStartPos(ev->position);
+ gesture->setLastPos(ev->position);
+ } else {
+ gesture->setLastPos(gesture->pos());
+ }
+ gesture->setPos(ev->position);
+ break;
+ }
+ case QWinGestureEvent::Pinch:
+ break;
+ default:
+ break;
+ }
+ if (gesture) {
+ gesture->setState(state);
+ if (state == Qt::GestureStarted)
+ emit gesture->started();
+ emit gesture->triggered();
+ if (state == Qt::GestureFinished)
+ emit gesture->finished();
+ event->accept();
+ }
+ if (ev->gestureType == QWinGestureEvent::GestureEnd) {
+ qAppPriv->lastGestureId = 0;
+ } else {
+ qAppPriv->lastGestureId = type;
+ }
+ }
+ break;
+ }
+#endif
#ifndef QT_NO_PROPERTIES
case QEvent::DynamicPropertyChange: {
const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
@@ -9986,11 +10043,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_InputMethodEnabled: {
QInputContext *ic = d->ic;
- if (!ic) {
- // implicitly create input context only if we have a focus
- if (hasFocus())
- ic = d->inputContext();
- }
+ if (!ic && (!on || hasFocus()))
+ ic = d->inputContext();
if (ic) {
if (on && hasFocus() && ic->focusWidget() != this && isEnabled()) {
ic->setFocusWidget(this);
@@ -10105,8 +10159,8 @@ bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const
By default the value of this property is 1.0.
- This feature is available on Embedded Linux, Mac OS X, X11 platforms that
- support the Composite extension, and Windows 2000 and later.
+ This feature is available on Embedded Linux, Mac OS X, Windows,
+ and X11 platforms that support the Composite extension.
This feature is not available on Windows CE.
@@ -11157,103 +11211,6 @@ QWindowSurface *QWidget::windowSurface() const
return bs ? bs->windowSurface : 0;
}
-/*!
- \since 4.6
-
- Subscribes the widget to the specified \a gesture type.
-
- Returns the id of the gesture.
-
- \sa releaseGesture(), setGestureEnabled()
-*/
-int QWidget::grabGesture(const QString &gesture)
-{
- Q_D(QWidget);
- int id = d->grabGesture(QGestureManager::instance()->makeGestureId(gesture));
- if (d->extra && d->extra->proxyWidget)
- d->extra->proxyWidget->QGraphicsItem::d_ptr->grabGesture(id);
- return id;
-}
-
-int QWidgetPrivate::grabGesture(int gestureId)
-{
- gestures << gestureId;
- ++qApp->d_func()->grabbedGestures[QGestureManager::instance()->gestureNameFromId(gestureId)];
- return gestureId;
-}
-
-bool QWidgetPrivate::releaseGesture(int gestureId)
-{
- QApplicationPrivate *qAppPriv = qApp->d_func();
- if (gestures.contains(gestureId)) {
- QString name = QGestureManager::instance()->gestureNameFromId(gestureId);
- Q_ASSERT(qAppPriv->grabbedGestures[name] > 0);
- --qAppPriv->grabbedGestures[name];
- gestures.remove(gestureId);
- return true;
- }
- return false;
-}
-
-bool QWidgetPrivate::hasGesture(const QString &name) const
-{
- QGestureManager *gm = QGestureManager::instance();
- QSet<int>::const_iterator it = gestures.begin(),
- e = gestures.end();
- for (; it != e; ++it) {
- if (gm->gestureNameFromId(*it) == name)
- return true;
- }
- return false;
-}
-
-/*!
- \since 4.6
-
- Subscribes the widget to the specified \a gesture type.
-
- Returns the id of the gesture.
-
- \sa releaseGesture(), setGestureEnabled()
-*/
-int QWidget::grabGesture(Qt::GestureType gesture)
-{
- return grabGesture(qt_getStandardGestureTypeName(gesture));
-}
-
-/*!
- \since 4.6
-
- Unsubscribes the widget from a gesture, which is specified by the
- \a gestureId.
-
- \sa grabGesture(), setGestureEnabled()
-*/
-void QWidget::releaseGesture(int gestureId)
-{
- Q_D(QWidget);
- if (d->releaseGesture(gestureId)) {
- if (d->extra && d->extra->proxyWidget)
- d->extra->proxyWidget->QGraphicsItem::d_ptr->releaseGesture(gestureId);
- QGestureManager::instance()->releaseGestureId(gestureId);
- }
-}
-
-/*!
- \since 4.6
-
- If \a enable is true, the gesture with the given \a gestureId is
- enabled; otherwise the gesture is disabled.
-
- The id of the gesture is returned by the grabGesture().
-
- \sa grabGesture(), releaseGesture()
-*/
-void QWidget::setGestureEnabled(int gestureId, bool enable)
-{
- //###
-}
-
void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const
{
if (left)
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 2008723..c73f633 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -90,7 +90,6 @@ class QDragLeaveEvent;
class QDropEvent;
class QShowEvent;
class QHideEvent;
-class QGestureEvent;
class QInputContext;
class QIcon;
class QWindowSurface;
@@ -616,11 +615,6 @@ public:
void setWindowSurface(QWindowSurface *surface);
QWindowSurface *windowSurface() const;
- int grabGesture(const QString &gesture);
- int grabGesture(Qt::GestureType gesture);
- void releaseGesture(int gestureId);
- void setGestureEnabled(int gestureId, bool enable = true);
-
Q_SIGNALS:
void customContextMenuRequested(const QPoint &pos);
@@ -765,7 +759,6 @@ private:
friend class QSymbianControl;
friend class QS60WindowSurface;
#endif
- friend class QGestureManager;
#ifdef Q_WS_X11
friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp);
friend void qt_net_remove_user_time(QWidget *tlw);
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 045bcb3..1717fbd 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -83,6 +83,7 @@
#include "qcursor.h"
#include "qdesktopwidget.h"
#include "qevent.h"
+#include "qfileinfo.h"
#include "qimage.h"
#include "qlayout.h"
#include "qmenubar.h"
@@ -843,8 +844,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
qt_button_down = 0;
} else if(ekind == kEventWindowToolbarSwitchMode) {
- QToolBarChangeEvent ev(!(GetCurrentKeyModifiers() & cmdKey));
- QApplication::sendSpontaneousEvent(widget, &ev);
+ macSendToolbarChangeEvent(widget);
HIToolbarRef toolbar;
if (GetWindowToolbar(wid, &toolbar) == noErr) {
if (toolbar) {
@@ -1198,22 +1198,13 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
p.setClipping(false);
if(was_unclipped)
widget->setAttribute(Qt::WA_PaintUnclipped);
-
- QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(widget->parent());
- QPoint scrollAreaOffset;
- if (scrollArea && scrollArea->viewport() == widget) {
- QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(static_cast<QWidget *>(scrollArea)->d_ptr.data());
- scrollAreaOffset = priv->contentsOffset();
- p.translate(-scrollAreaOffset);
- }
-
- widget->d_func()->paintBackground(&p, qrgn, scrollAreaOffset, widget->isWindow() ? DrawAsRoot : 0);
+ widget->d_func()->paintBackground(&p, qrgn, widget->isWindow() ? DrawAsRoot : 0);
if (widget->testAttribute(Qt::WA_TintedBackground)) {
QColor tint = widget->palette().window().color();
tint.setAlphaF(.6);
const QVector<QRect> &rects = qrgn.rects();
for (int i = 0; i < rects.size(); ++i)
- p.fillRect(rects.at(i).translated(scrollAreaOffset), tint);
+ p.fillRect(rects.at(i), tint);
}
p.end();
if (!redirectionOffset.isNull())
@@ -1369,6 +1360,14 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
// Set dropWidget to zero, so qt_mac_dnd_event
// doesn't get called a second time below:
dropWidget = 0;
+ } else if (ekind == kEventControlDragLeave) {
+ dropWidget = QDragManager::self()->currentTarget();
+ if (dropWidget) {
+ dropWidget->d_func()->qt_mac_dnd_event(kEventControlDragLeave, drag);
+ }
+ // Set dropWidget to zero, so qt_mac_dnd_event
+ // doesn't get called a second time below:
+ dropWidget = 0;
}
}
}
@@ -2857,8 +2856,7 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
SetWindowTitleWithCFString(qt_mac_window_for(q), QCFString(caption));
#else
QMacCocoaAutoReleasePool pool;
- [qt_mac_window_for(q)
- setTitle:reinterpret_cast<const NSString *>(static_cast<CFStringRef>(QCFString(caption)))];
+ [qt_mac_window_for(q) setTitle:qt_mac_QStringToNSString(caption)];
#endif
}
}
@@ -2880,7 +2878,8 @@ void QWidgetPrivate::setWindowFilePath_sys(const QString &filePath)
Q_Q(QWidget);
#ifdef QT_MAC_USE_COCOA
QMacCocoaAutoReleasePool pool;
- [qt_mac_window_for(q) setRepresentedFilename:reinterpret_cast<const NSString *>(static_cast<CFStringRef>(QCFString(filePath)))];
+ QFileInfo fi(filePath);
+ [qt_mac_window_for(q) setRepresentedFilename:fi.exists() ? qt_mac_QStringToNSString(filePath) : @""];
#else
bool validRef = false;
FSRef ref;
@@ -2970,8 +2969,7 @@ void QWidgetPrivate::setWindowIconText_sys(const QString &iconText)
SetWindowAlternateTitle(qt_mac_window_for(q), QCFString(iconText));
#else
QMacCocoaAutoReleasePool pool;
- [qt_mac_window_for(q)
- setMiniwindowTitle:reinterpret_cast<const NSString *>(static_cast<CFStringRef>(QCFString(iconText)))];
+ [qt_mac_window_for(q) setMiniwindowTitle:qt_mac_QStringToNSString(iconText)];
#endif
}
}
@@ -3818,8 +3816,6 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
Qt coordinate system for parent
X coordinate system for parent (relative to parent's wrect).
*/
- QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX);
- QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
QRect wrect;
//xrect is the X geometry of my X widget. (starts out in parent's Qt coord sys, and ends up in parent's X coord sys)
QRect xrect = data.crect;
@@ -3841,6 +3837,7 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
parentWRect = QRect(tmpRect.origin.x, tmpRect.origin.y,
tmpRect.size.width, tmpRect.size.height);
} else {
+ const QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
parentWRect = wrectRange;
}
} else {
@@ -3896,15 +3893,24 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
}
}
+ const QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX);
if (!validRange.contains(xrect)) {
// we are too big, and must clip
- xrect &=wrectRange;
+ QPoint screenOffset(0, 0); // offset of the part being on screen
+ const QWidget *parentWidget = q->parentWidget();
+ while (parentWidget && !parentWidget->isWindow()) {
+ screenOffset -= parentWidget->data->crect.topLeft();
+ parentWidget = parentWidget->parentWidget();
+ }
+ QRect cropRect(screenOffset.x() - WRECT_MAX,
+ screenOffset.y() - WRECT_MAX,
+ 2*WRECT_MAX,
+ 2*WRECT_MAX);
+
+ xrect &=cropRect;
wrect = xrect;
- wrect.translate(-data.crect.topLeft());
- //parent's X coord system is equal to parent's Qt coord
- //sys, so we don't need to map xrect.
+ wrect.translate(-data.crect.topLeft()); // translate wrect in my Qt coordinates
}
-
}
// unmap if we are outside the valid window system coord system
@@ -3944,10 +3950,9 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
qt_mac_update_widget_posisiton(q, oldRect, xrect);
- if (jump) {
- updateSystemBackground();
+ if (jump)
q->update();
- }
+
if (mapWindow && !dontShow) {
q->setAttribute(Qt::WA_Mapped);
#ifndef QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 84a15ed..1d9689e 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -311,7 +311,7 @@ public:
void setUpdatesEnabled_helper(bool );
- void paintBackground(QPainter *, const QRegion &, const QPoint & = QPoint(), int flags = DrawAsRoot) const;
+ void paintBackground(QPainter *, const QRegion &, int flags = DrawAsRoot) const;
bool isAboutToShow() const;
QRegion prepareToRender(const QRegion &region, QWidget::RenderFlags renderFlags);
void render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion,
@@ -541,11 +541,6 @@ public:
QList<QAction*> actions;
#endif
- QSet<int> gestures;
- int grabGesture(int gestureId);
- bool releaseGesture(int gestureId);
- bool hasGesture(const QString &type) const;
-
// Bit fields.
uint high_attributes[3]; // the low ones are in QWidget::widget_attributes
QPalette::ColorRole fg_role : 8;
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index e39ca77..46fa3be 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -140,14 +140,8 @@ static void init_wintab_functions()
if (!qt_is_gui_used)
return;
QLibrary library(QLatin1String("wintab32"));
- QT_WA({
- ptrWTOpen = (PtrWTOpen)library.resolve("WTOpenW");
- ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW");
- } , {
- ptrWTOpen = (PtrWTOpen)library.resolve("WTOpenA");
- ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoA");
- });
-
+ ptrWTOpen = (PtrWTOpen)library.resolve("WTOpenW");
+ ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW");
ptrWTClose = (PtrWTClose)library.resolve("WTClose");
ptrWTQueueSizeGet = (PtrWTQueueSizeGet)library.resolve("WTQueueSizeGet");
ptrWTQueueSizeSet = (PtrWTQueueSizeSet)library.resolve("WTQueueSizeSet");
@@ -270,7 +264,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
HINSTANCE appinst = qWinAppInst();
HWND parentw, destroyw = 0;
- WId id;
+ WId id = 0;
QString windowClassName = qt_reg_winclass(q);
@@ -287,25 +281,18 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (desktop && !q->testAttribute(Qt::WA_DontShowOnScreen)) { // desktop widget
popup = false; // force this flags off
- if (QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95)
- data.crect.setRect(GetSystemMetrics(76 /* SM_XVIRTUALSCREEN */), GetSystemMetrics(77 /* SM_YVIRTUALSCREEN */),
+ data.crect.setRect(GetSystemMetrics(76 /* SM_XVIRTUALSCREEN */), GetSystemMetrics(77 /* SM_YVIRTUALSCREEN */),
GetSystemMetrics(78 /* SM_CXVIRTUALSCREEN */), GetSystemMetrics(79 /* SM_CYVIRTUALSCREEN */));
- else
- data.crect.setRect(0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
}
parentw = q->parentWidget() ? q->parentWidget()->effectiveWinId() : 0;
-#ifdef UNICODE
QString title;
- const TCHAR *ttitle = 0;
-#endif
- QByteArray title95;
int style = WS_CHILD;
int exsty = 0;
if (window) {
- style = GetWindowLongA(window, GWL_STYLE);
+ style = GetWindowLong(window, GWL_STYLE);
if (!style)
qErrnoWarning("QWidget::create: GetWindowLong failed");
topLevel = false; // #### needed for some IE plugins??
@@ -361,12 +348,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
}
if (flags & Qt::WindowTitleHint) {
- QT_WA({
- title = q->isWindow() ? qAppName() : q->objectName();
- ttitle = (TCHAR*)title.utf16();
- } , {
- title95 = q->isWindow() ? qAppName().toLocal8Bit() : q->objectName().toLatin1();
- });
+ title = q->isWindow() ? qAppName() : q->objectName();
}
// The Qt::WA_WState_Created flag is checked by translateConfigEvent() in
@@ -379,13 +361,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
destroyw = data.winid;
id = window;
setWinId(window);
- LONG res = SetWindowLongA(window, GWL_STYLE, style);
+ LONG res = SetWindowLong(window, GWL_STYLE, style);
if (!res)
qErrnoWarning("QWidget::create: Failed to set window style");
#ifdef _WIN64
- res = SetWindowLongPtrA( window, GWLP_WNDPROC, (LONG_PTR)QtWndProc );
+ res = SetWindowLongPtr( window, GWLP_WNDPROC, (LONG_PTR)QtWndProc );
#else
- res = SetWindowLongA( window, GWL_WNDPROC, (LONG)QtWndProc );
+ res = SetWindowLong( window, GWL_WNDPROC, (LONG)QtWndProc );
#endif
if (!res)
qErrnoWarning("QWidget::create: Failed to set window procedure");
@@ -436,16 +418,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
}
}
- QT_WA({
- const TCHAR *cname = (TCHAR*)windowClassName.utf16();
- id = CreateWindowEx(exsty, cname, ttitle, style,
- x, y, w, h,
- parentw, 0, appinst, 0);
- } , {
- id = CreateWindowExA(exsty, windowClassName.toLatin1(), title95, style,
- x, y, w, h,
- parentw, 0, appinst, 0);
- });
+ id = CreateWindowEx(exsty, reinterpret_cast<const wchar_t *>(windowClassName.utf16()),
+ reinterpret_cast<const wchar_t *>(title.utf16()), style,
+ x, y, w, h,
+ parentw, NULL, appinst, NULL);
if (!id)
qErrnoWarning("QWidget::create: Failed to create window");
setWinId(id);
@@ -457,16 +433,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
SetWindowPos(id, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
winUpdateIsOpaque();
} else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create child widget
- QT_WA({
- const TCHAR *cname = (TCHAR*)windowClassName.utf16();
- id = CreateWindowEx(exsty, cname, ttitle, style,
- data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(),
- parentw, NULL, appinst, NULL);
- } , {
- id = CreateWindowExA(exsty, windowClassName.toLatin1(), title95, style,
- data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(),
+ id = CreateWindowEx(exsty, reinterpret_cast<const wchar_t *>(windowClassName.utf16()),
+ reinterpret_cast<const wchar_t *>(title.utf16()), style,
+ data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(),
parentw, NULL, appinst, NULL);
- });
if (!id)
qErrnoWarning("QWidget::create: Failed to create window");
SetWindowPos(id, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -682,7 +652,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
// Show borderless toplevel windows in tasklist & NavBar
if (!parent) {
QString txt = q->windowTitle().isEmpty()?qAppName():q->windowTitle();
- SetWindowText(q->internalWinId(), (TCHAR*)txt.utf16());
+ SetWindowText(q->internalWinId(), (wchar_t*)txt.utf16());
}
#endif
invalidateBuffer(q->rect());
@@ -767,11 +737,7 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
return;
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- QT_WA({
- SetWindowText(q->internalWinId(), (TCHAR*)caption.utf16());
- } , {
- SetWindowTextA(q->internalWinId(), caption.toLocal8Bit());
- });
+ SetWindowText(q->internalWinId(), (wchar_t*)caption.utf16());
}
/*
@@ -853,11 +819,11 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON),
&(x->iconPixmap));
if (x->winIconBig) {
- SendMessageA(q->internalWinId(), WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)x->winIconSmall);
- SendMessageA(q->internalWinId(), WM_SETICON, 1 /* ICON_BIG */, (LPARAM)x->winIconBig);
+ SendMessage(q->internalWinId(), WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)x->winIconSmall);
+ SendMessage(q->internalWinId(), WM_SETICON, 1 /* ICON_BIG */, (LPARAM)x->winIconBig);
} else {
- SendMessageA(q->internalWinId(), WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)x->winIconSmall);
- SendMessageA(q->internalWinId(), WM_SETICON, 1 /* ICON_BIG */, (LPARAM)x->winIconSmall);
+ SendMessage(q->internalWinId(), WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)x->winIconSmall);
+ SendMessage(q->internalWinId(), WM_SETICON, 1 /* ICON_BIG */, (LPARAM)x->winIconSmall);
}
}
@@ -884,7 +850,7 @@ LRESULT CALLBACK qJournalRecordProc(int nCode, WPARAM wParam, LPARAM lParam)
/* Works only as long as pointer is inside the application's window,
which is good enough for QDockWidget.
- Doesn't call SetWindowsHookExA() - this function causes a system-wide
+ Doesn't call SetWindowsHookEx() - this function causes a system-wide
freeze if any other app on the system installs a hook and fails to
process events. */
void QWidgetPrivate::grabMouseWhileInWindow()
@@ -908,7 +874,7 @@ void QWidget::grabMouse()
if (!qt_nograb()) {
if (mouseGrb)
mouseGrb->releaseMouse();
- journalRec = SetWindowsHookExA(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandleA(0), 0);
+ journalRec = SetWindowsHookEx(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandle(0), 0);
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
SetCapture(effectiveWinId());
mouseGrb = this;
@@ -921,7 +887,7 @@ void QWidget::grabMouse(const QCursor &cursor)
if (!qt_nograb()) {
if (mouseGrb)
mouseGrb->releaseMouse();
- journalRec = SetWindowsHookExA(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandleA(0), 0);
+ journalRec = SetWindowsHookEx(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandle(0), 0);
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
SetCapture(effectiveWinId());
mouseGrbCur = new QCursor(cursor);
@@ -1028,7 +994,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
if (newstate & Qt::WindowFullScreen) {
if (d->topData()->normalGeometry.width() < 0 && !(oldstate & Qt::WindowMaximized))
d->topData()->normalGeometry = geometry();
- d->topData()->savedFlags = Qt::WindowFlags(GetWindowLongA(internalWinId(), GWL_STYLE));
+ d->topData()->savedFlags = Qt::WindowFlags(GetWindowLong(internalWinId(), GWL_STYLE));
#ifndef Q_FLATTEN_EXPOSE
UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
#else
@@ -1038,7 +1004,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
style |= WS_SYSMENU;
if (isVisible())
style |= WS_VISIBLE;
- SetWindowLongA(internalWinId(), GWL_STYLE, style);
+ SetWindowLong(internalWinId(), GWL_STYLE, style);
QRect r = QApplication::desktop()->screenGeometry(this);
UINT swpf = SWP_FRAMECHANGED;
if (newstate & Qt::WindowActive)
@@ -1050,7 +1016,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
UINT style = d->topData()->savedFlags;
if (isVisible())
style |= WS_VISIBLE;
- SetWindowLongA(internalWinId(), GWL_STYLE, style);
+ SetWindowLong(internalWinId(), GWL_STYLE, style);
UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE;
if (newstate & Qt::WindowActive)
@@ -1395,7 +1361,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
UINT style = top->savedFlags;
if (q->isVisible())
style |= WS_VISIBLE;
- SetWindowLongA(q->internalWinId(), GWL_STYLE, style);
+ SetWindowLong(q->internalWinId(), GWL_STYLE, style);
UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE;
if (data.window_state & Qt::WindowActive)
@@ -1410,7 +1376,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
const bool inTopLevelResize = tlwExtra ? tlwExtra->inTopLevelResize : false;
const bool isTranslucentWindow = !isOpaque && ptrUpdateLayeredWindowIndirect && (data.window_flags & Qt::FramelessWindowHint)
- && GetWindowLongA(q->internalWinId(), GWL_EXSTYLE) & Q_WS_EX_LAYERED;
+ && GetWindowLong(q->internalWinId(), GWL_EXSTYLE) & Q_WS_EX_LAYERED;
if (q->testAttribute(Qt::WA_WState_ConfigPending)) { // processing config event
if (q->internalWinId())
@@ -1578,11 +1544,11 @@ void QWidgetPrivate::winUpdateIsOpaque()
return;
if (!isOpaque && ptrUpdateLayeredWindowIndirect) {
- SetWindowLongA(q->internalWinId(), GWL_EXSTYLE,
- GetWindowLongA(q->internalWinId(), GWL_EXSTYLE) | Q_WS_EX_LAYERED);
+ SetWindowLong(q->internalWinId(), GWL_EXSTYLE,
+ GetWindowLong(q->internalWinId(), GWL_EXSTYLE) | Q_WS_EX_LAYERED);
} else {
- SetWindowLongA(q->internalWinId(), GWL_EXSTYLE,
- GetWindowLongA(q->internalWinId(), GWL_EXSTYLE) & ~Q_WS_EX_LAYERED);
+ SetWindowLong(q->internalWinId(), GWL_EXSTYLE,
+ GetWindowLong(q->internalWinId(), GWL_EXSTYLE) & ~Q_WS_EX_LAYERED);
}
#endif
}
@@ -1592,12 +1558,12 @@ void QWidgetPrivate::setConstraints_sys()
#ifndef Q_WS_WINCE_WM
Q_Q(QWidget);
if (q->isWindow() && q->testAttribute(Qt::WA_WState_Created)) {
- int style = GetWindowLongA(q->internalWinId(), GWL_STYLE);
+ int style = GetWindowLong(q->internalWinId(), GWL_STYLE);
if (shouldShowMaximizeButton())
style |= WS_MAXIMIZEBOX;
else
style &= ~WS_MAXIMIZEBOX;
- SetWindowLongA(q->internalWinId(), GWL_STYLE, style);
+ SetWindowLong(q->internalWinId(), GWL_STYLE, style);
}
#endif
}
@@ -1867,10 +1833,8 @@ void QWidgetPrivate::updateFrameStrut()
RECT rect = {0,0,0,0};
QTLWExtra *top = topData();
- uint exstyle = QT_WA_INLINE(GetWindowLongW(q->internalWinId(), GWL_EXSTYLE),
- GetWindowLongA(q->internalWinId(), GWL_EXSTYLE));
- uint style = QT_WA_INLINE(GetWindowLongW(q->internalWinId(), GWL_STYLE),
- GetWindowLongA(q->internalWinId(), GWL_STYLE));
+ uint exstyle = GetWindowLong(q->internalWinId(), GWL_EXSTYLE);
+ uint style = GetWindowLong(q->internalWinId(), GWL_STYLE);
#ifndef Q_WS_WINCE
if (AdjustWindowRectEx(&rect, style & ~(WS_OVERLAPPED), FALSE, exstyle)) {
#else
@@ -1886,11 +1850,10 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level)
{
Q_Q(QWidget);
- if (!isOpaque && ptrUpdateLayeredWindowIndirect && (data.window_flags & Qt::FramelessWindowHint)) {
- if (GetWindowLongA(q->internalWinId(), GWL_EXSTYLE) & Q_WS_EX_LAYERED) {
- Q_BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * level), Q_AC_SRC_ALPHA};
- Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, NULL, NULL, NULL, NULL, 0, &blend, Q_ULW_ALPHA, NULL};
- (*ptrUpdateLayeredWindowIndirect)(q->internalWinId(), &info);
+ if (!isOpaque && ptrUpdateLayeredWindow && (data.window_flags & Qt::FramelessWindowHint)) {
+ if (GetWindowLong(q->internalWinId(), GWL_EXSTYLE) & Q_WS_EX_LAYERED) {
+ BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * level), AC_SRC_ALPHA};
+ ptrUpdateLayeredWindow(q->internalWinId(), NULL, NULL, NULL, NULL, NULL, 0, &blend, Q_ULW_ALPHA);
}
return;
}
@@ -1906,15 +1869,15 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level)
if (!ptrSetLayeredWindowAttributes)
return;
- int wl = GetWindowLongA(q->internalWinId(), GWL_EXSTYLE);
+ int wl = GetWindowLong(q->internalWinId(), GWL_EXSTYLE);
if (level != 1.0) {
if ((wl&Q_WS_EX_LAYERED) == 0)
- SetWindowLongA(q->internalWinId(), GWL_EXSTYLE, wl|Q_WS_EX_LAYERED);
+ SetWindowLong(q->internalWinId(), GWL_EXSTYLE, wl | Q_WS_EX_LAYERED);
} else if (wl&Q_WS_EX_LAYERED) {
- SetWindowLongA(q->internalWinId(), GWL_EXSTYLE, wl & ~Q_WS_EX_LAYERED);
+ SetWindowLong(q->internalWinId(), GWL_EXSTYLE, wl & ~Q_WS_EX_LAYERED);
}
- (*ptrSetLayeredWindowAttributes)(q->internalWinId(), 0, (int)(level * 255), Q_LWA_ALPHA);
+ ptrSetLayeredWindowAttributes(q->internalWinId(), 0, (int)(level * 255), Q_LWA_ALPHA);
}
#endif //Q_WS_WINCE
diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp
index 24d8156..b0eaa12 100644
--- a/src/gui/kernel/qwidget_wince.cpp
+++ b/src/gui/kernel/qwidget_wince.cpp
@@ -188,11 +188,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
parentw = q->parentWidget() ? q->parentWidget()->effectiveWinId() : 0;
-#ifdef UNICODE
QString title;
- const TCHAR *ttitle = 0;
-#endif
- QByteArray title95;
int style = WS_CHILD;
int exsty = WS_EX_NOPARENTNOTIFY;
@@ -236,12 +232,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
}
if (flags & Qt::WindowTitleHint) {
- QT_WA({
- title = q->isWindow() ? qAppName() : q->objectName();
- ttitle = (TCHAR*)title.utf16();
- } , {
- title95 = q->isWindow() ? qAppName().toLocal8Bit() : q->objectName().toLatin1();
- });
+ title = q->isWindow() ? qAppName() : q->objectName();
}
// The Qt::WA_WState_Created flag is checked by translateConfigEvent() in
@@ -254,11 +245,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
destroyw = data.winid;
id = window;
setWinId(window);
- LONG res = SetWindowLongA(window, GWL_STYLE, style);
+ LONG res = SetWindowLong(window, GWL_STYLE, style);
if (!res)
qErrnoWarning("QWidget::create: Failed to set window style");
- res = SetWindowLongA( window, GWL_WNDPROC, (LONG)QtWndProc );
+ res = SetWindowLong( window, GWL_WNDPROC, (LONG)QtWndProc );
if (!res)
qErrnoWarning("QWidget::create: Failed to set window procedure");
@@ -267,10 +258,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (!id) { //Create a dummy desktop
RECT r;
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
- const TCHAR *cname = reinterpret_cast<const TCHAR *> (windowClassName.utf16());
- id = CreateWindow(cname, ttitle, style,
- r.left, r.top, r.right - r.left, r.bottom - r.top,
- 0, 0, appinst, 0);
+ id = CreateWindow(reinterpret_cast<const wchar_t *>(windowClassName.utf16()),
+ reinterpret_cast<const wchar_t *>(title.utf16()), style,
+ r.left, r.top, r.right - r.left, r.bottom - r.top,
+ 0, 0, appinst, 0);
}
setWinId(id);
} else if (topLevel) { // create top-level widget
@@ -303,8 +294,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
}
}
- const TCHAR *cname = reinterpret_cast<const TCHAR *> (windowClassName.utf16());
- id = CreateWindowEx(exsty, cname, ttitle, style,
+ id = CreateWindowEx(exsty, reinterpret_cast<const wchar_t *>(windowClassName.utf16()),
+ reinterpret_cast<const wchar_t *>(title.utf16()), style,
x, y, w, h,
0, 0, appinst, 0);
@@ -314,16 +305,9 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if ((flags & Qt::WindowStaysOnTopHint) || (type == Qt::ToolTip))
SetWindowPos(id, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
} else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create child widget
- QT_WA({
- const TCHAR *cname = (TCHAR*)windowClassName.utf16();
- id = CreateWindowEx(exsty, cname, ttitle, style,
- data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(),
- parentw, NULL, appinst, NULL);
- } , {
- id = CreateWindowExA(exsty, windowClassName.toLatin1(), title95, style,
- data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(),
+ id = CreateWindowEx(exsty, (wchar_t*)windowClassName.utf16(), (wchar_t*)title.utf16(), style,
+ data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(),
parentw, NULL, appinst, NULL);
- });
if (!id)
qErrnoWarning("QWidget::create: Failed to create window");
SetWindowPos(id, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -510,7 +494,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
}
if ((oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized)) {
if (!(newstate & Qt::WindowMaximized)) {
- int style = GetWindowLongW(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION;
+ int style = GetWindowLong(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION;
SetWindowLong(internalWinId(), GWL_STYLE, style);
SetWindowLong(internalWinId(), GWL_EXSTYLE, GetWindowLong (internalWinId(), GWL_EXSTYLE) & ~ WS_EX_NODRAG);
}
@@ -535,11 +519,11 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
if (newstate & Qt::WindowFullScreen) {
if (d->topData()->normalGeometry.width() < 0 && !(oldstate & Qt::WindowMaximized))
d->topData()->normalGeometry = geometry();
- d->topData()->savedFlags = (Qt::WindowFlags) GetWindowLongA(internalWinId(), GWL_STYLE);
+ d->topData()->savedFlags = (Qt::WindowFlags)GetWindowLong(internalWinId(), GWL_STYLE);
UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
if (isVisible())
style |= WS_VISIBLE;
- SetWindowLongA(internalWinId(), GWL_STYLE, style);
+ SetWindowLong(internalWinId(), GWL_STYLE, style);
QRect r = qApp->desktop()->screenGeometry(this);
UINT swpf = SWP_FRAMECHANGED;
if (newstate & Qt::WindowActive)
@@ -550,7 +534,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
UINT style = d->topData()->savedFlags;
if (isVisible())
style |= WS_VISIBLE;
- SetWindowLongA(internalWinId(), GWL_STYLE, style);
+ SetWindowLong(internalWinId(), GWL_STYLE, style);
UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE;
if (newstate & Qt::WindowActive)
swpf |= SWP_NOACTIVATE;
diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp
index 3ddde1b..659331f 100644
--- a/src/gui/kernel/qx11embed_x11.cpp
+++ b/src/gui/kernel/qx11embed_x11.cpp
@@ -826,7 +826,7 @@ bool QX11EmbedWidget::x11Event(XEvent *event)
&actual_format_return, &nitems_return,
&bytes_after_return, &prop_return) == Success) {
if (nitems_return > 1) {
- if (((int * )prop_return)[1] & XEMBED_MAPPED) {
+ if (((long * )prop_return)[1] & XEMBED_MAPPED) {
XMapWindow(x11Info().display(), internalWinId());
} else {
XUnmapWindow(x11Info().display(), internalWinId());
@@ -1670,9 +1670,9 @@ void QX11EmbedContainerPrivate::acceptClient(WId window)
// Clients with the _XEMBED_INFO property are XEMBED clients.
clientIsXEmbed = true;
- unsigned int *p = (unsigned int *)prop_return;
+ long *p = (long *)prop_return;
if (nitems_return >= 2)
- clientversion = p[0];
+ clientversion = (unsigned int)p[0];
}
XFree(prop_return);
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index 1131f9b..7bdf70a 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -119,7 +119,9 @@ Q_INLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT>::QGenericMatrix()
template <int N, int M, typename T, typename InnerT>
Q_INLINE_TEMPLATE QGenericMatrix<N, M, T, InnerT>::QGenericMatrix(const QGenericMatrix<N, M, T, InnerT>& other)
{
- qMemCopy(m, other.m, sizeof(m));
+ for (int col = 0; col < N; ++col)
+ for (int row = 0; row < M; ++row)
+ m[col][row] = other.m[col][row];
}
template <int N, int M, typename T, typename InnerT>
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index 9fe487b..b4c54a0 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -53,10 +53,6 @@ QT_BEGIN_NAMESPACE
\brief The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
\since 4.6
- The matrix elements are stored internally using the most efficient
- numeric representation for the underlying hardware: floating-point
- or fixed-point.
-
\sa QVector3D, QGenericMatrix
*/
@@ -308,8 +304,7 @@ QMatrix4x4::QMatrix4x4(const QTransform& transform)
// The 4x4 matrix inverse algorithm is based on that described at:
// http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q24
// Some optimization has been done to avoid making copies of 3x3
-// sub-matrices, to do calculations in fixed-point where required,
-// and to unroll the loops.
+// sub-matrices and to unroll the loops.
// Calculate the determinant of a 3x3 sub-matrix.
// | A B C |
@@ -1004,10 +999,6 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, const QVector3D& vector)
#endif
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
/*!
\overload
@@ -1803,6 +1794,51 @@ QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QMatrix4x4 &matrix)
+ \relates QMatrix4x4
+
+ Writes the given \a matrix to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QMatrix4x4 &matrix)
+{
+ for (int row = 0; row < 4; ++row)
+ for (int col = 0; col < 4; ++col)
+ stream << double(matrix(row, col));
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QMatrix4x4 &matrix)
+ \relates QMatrix4x4
+
+ Reads a 4x4 matrix from the given \a stream into the given \a matrix
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QMatrix4x4 &matrix)
+{
+ double x;
+ for (int row = 0; row < 4; ++row) {
+ for (int col = 0; col < 4; ++col) {
+ stream >> x;
+ matrix(row, col) = float(x);
+ }
+ }
+ matrix.inferSpecialType();
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_MATRIX4X4
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index d63de70..f7246bb 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -960,6 +960,11 @@ inline float *QMatrix4x4::data()
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QMatrix4x4 &m);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix4x4 &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix4x4 &);
+#endif
+
template <int N, int M>
QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, qreal, float>& matrix)
{
@@ -989,10 +994,6 @@ QGenericMatrix<N, M, qreal, float> qGenericMatrixFromMatrix4x4(const QMatrix4x4&
QT_END_NAMESPACE
-#ifndef QT_NO_MATRIX4X4
-Q_DECLARE_METATYPE(QMatrix4x4)
-#endif
-
QT_END_HEADER
#endif
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index 17c4373..841a4c0 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -55,10 +55,6 @@ QT_BEGIN_NAMESPACE
Quaternions are used to represent rotations in 3D space, and
consist of a 3D rotation axis specified by the x, y, and z
coordinates, and a scalar representing the rotation angle.
-
- The components of a quaternion are stored internally using the most
- efficient representation for the GL rendering engine, which will be
- either floating-point or fixed-point.
*/
/*!
@@ -339,10 +335,6 @@ QVector3D QQuaternion::rotateVector(const QVector3D& vector) const
\sa operator*=()
*/
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
#ifndef QT_NO_VECTOR3D
/*!
@@ -579,6 +571,51 @@ QDebug operator<<(QDebug dbg, const QQuaternion &q)
#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion)
+ \relates QQuaternion
+
+ Writes the given \a quaternion to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion)
+{
+ stream << double(quaternion.scalar()) << double(quaternion.x())
+ << double(quaternion.y()) << double(quaternion.z());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QQuaternion &quaternion)
+ \relates QQuaternion
+
+ Reads a quaternion from the given \a stream into the given \a quaternion
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QQuaternion &quaternion)
+{
+ double scalar, x, y, z;
+ stream >> scalar;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ quaternion.setScalar(qreal(scalar));
+ quaternion.setX(qreal(x));
+ quaternion.setY(qreal(y));
+ quaternion.setZ(qreal(z));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
#endif
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 6b24a04..55c871d 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -324,14 +324,15 @@ inline QVector4D QQuaternion::toVector4D() const
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QQuaternion &q);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QQuaternion &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QQuaternion &);
#endif
-QT_END_NAMESPACE
-
-#ifndef QT_NO_QUATERNION
-Q_DECLARE_METATYPE(QQuaternion)
#endif
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index 9b5d123..28f6b7a 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -57,9 +57,7 @@ QT_BEGIN_NAMESPACE
The QVector2D class can also be used to represent vertices in 2D space.
We therefore do not need to provide a separate vertex class.
- The coordinates are stored internally using the most efficient
- representation for the GL rendering engine, which will be either
- floating-point or fixed-point.
+ \sa QVector3D, QVector4D, QQuaternion
*/
/*!
@@ -412,6 +410,46 @@ QDebug operator<<(QDebug dbg, const QVector2D &vector)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QVector2D &vector)
+ \relates QVector2D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QVector2D &vector)
+{
+ stream << double(vector.x()) << double(vector.y());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
+ \relates QVector2D
+
+ Reads a 2D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
+{
+ double x, y;
+ stream >> x;
+ stream >> y;
+ vector.setX(qreal(x));
+ vector.setY(qreal(y));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR2D
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index bb62afe..d473c2f 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -243,14 +243,15 @@ inline QPointF QVector2D::toPointF() const
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector2D &vector);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector2D &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector2D &);
#endif
-QT_END_NAMESPACE
-
-#ifndef QT_NO_VECTOR2D
-Q_DECLARE_METATYPE(QVector2D)
#endif
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index 977152a..881f47c 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -61,9 +61,7 @@ QT_BEGIN_NAMESPACE
The QVector3D class can also be used to represent vertices in 3D space.
We therefore do not need to provide a separate vertex class.
- The coordinates are stored internally using the most efficient
- representation for the GL rendering engine, which will be either
- floating-point or fixed-point.
+ \sa QVector2D, QVector4D, QQuaternion
*/
/*!
@@ -560,6 +558,49 @@ QDebug operator<<(QDebug dbg, const QVector3D &vector)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
+ \relates QVector3D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
+{
+ stream << double(vector.x()) << double(vector.y())
+ << double(vector.z());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
+ \relates QVector3D
+
+ Reads a 3D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
+{
+ double x, y, z;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ vector.setX(qreal(x));
+ vector.setY(qreal(y));
+ vector.setZ(qreal(z));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR3D
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index 873b388..7494dcf 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -271,14 +271,15 @@ inline QPointF QVector3D::toPointF() const
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector3D &vector);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector3D &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector3D &);
#endif
-QT_END_NAMESPACE
-
-#ifndef QT_NO_VECTOR3D
-Q_DECLARE_METATYPE(QVector3D)
#endif
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index a28d2a1..1a84db6 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -57,10 +57,6 @@ QT_BEGIN_NAMESPACE
The QVector4D class can also be used to represent vertices in 4D space.
We therefore do not need to provide a separate vertex class.
- The coordinates are stored internally using the most efficient
- representation for the GL rendering engine, which will be either
- floating-point or fixed-point.
-
\sa QQuaternion, QVector2D, QVector3D
*/
@@ -513,6 +509,51 @@ QDebug operator<<(QDebug dbg, const QVector4D &vector)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QVector4D &vector)
+ \relates QVector4D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QVector4D &vector)
+{
+ stream << double(vector.x()) << double(vector.y())
+ << double(vector.z()) << double(vector.w());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector4D &vector)
+ \relates QVector4D
+
+ Reads a 4D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector4D &vector)
+{
+ double x, y, z, w;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ stream >> w;
+ vector.setX(qreal(x));
+ vector.setY(qreal(y));
+ vector.setZ(qreal(z));
+ vector.setW(qreal(w));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR4D
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index dcfd87a..cd61496 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -276,14 +276,15 @@ inline QPointF QVector4D::toPointF() const
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector4D &vector);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector4D &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector4D &);
#endif
-QT_END_NAMESPACE
-
-#ifndef QT_NO_VECTOR4D
-Q_DECLARE_METATYPE(QVector4D)
#endif
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index a3ae102..602b991 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1008,8 +1008,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs,
;
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
} else { // color pixmap, no mask
- QString k;
- k.sprintf("$qt-drawitem-%llx", pm.cacheKey());
+ QString k = QString::fromLatin1("$qt-drawitem-%1").arg(pm.cacheKey());
if (!QPixmapCache::find(k, pm)) {
pm = pm.createHeuristicMask();
pm.setMask((QBitmap&)pm);
diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h
index 8f6797c..ce07c1f 100644
--- a/src/gui/painting/qdrawutil.h
+++ b/src/gui/painting/qdrawutil.h
@@ -133,7 +133,7 @@ Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GU
const QPalette &pal, bool enabled);
#endif
-struct Q_GUI_EXPORT QMargins
+struct QMargins
{
inline QMargins(int margin = 0)
: top(margin),
@@ -151,7 +151,7 @@ struct Q_GUI_EXPORT QMargins
int right;
};
-struct Q_GUI_EXPORT QTileRules
+struct QTileRules
{
inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule = Qt::Stretch)
: horizontal(horizontalRule), vertical(verticalRule) {}
@@ -168,8 +168,7 @@ Q_GUI_EXPORT void qDrawBorderPixmap(QPainter *painter,
const QRect &sourceRect,
const QMargins &sourceMargins,
const QTileRules &rules = QTileRules());
-
-Q_GUI_EXPORT inline void qDrawBorderPixmap(QPainter *painter,
+inline void qDrawBorderPixmap(QPainter *painter,
const QRect &target,
const QMargins &margins,
const QPixmap &pixmap)
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index c5e342c..2febdfa 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -112,10 +112,6 @@ extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); //
#define qt_swap_int(x, y) { int tmp = (x); (x) = (y); (y) = tmp; }
#define qt_swap_qreal(x, y) { qreal tmp = (x); (x) = (y); (y) = tmp; }
-#ifdef Q_WS_WIN
-static bool qt_enable_16bit_colors = false;
-#endif
-
// #define QT_DEBUG_DRAW
#ifdef QT_DEBUG_DRAW
void dumpClip(int width, int height, QClipData *clip);
@@ -4685,104 +4681,6 @@ static int qt_intersect_spans(QT_FT_Span *spans, int numSpans,
return n;
}
-/*
- \internal
- Clip spans to \a{clip}-region.
- Returns number of unclipped spans
-*/
-static int qt_intersect_spans(QT_FT_Span *spans, int numSpans,
- int *currSpan,
- QT_FT_Span *outSpans, int maxOut,
- const QRegion &clip)
-{
- const QVector<QRect> rects = clip.rects();
- const int numRects = rects.size();
-
- int r = 0;
- short miny, minx, maxx, maxy;
- {
- const QRect &rect = rects[0];
- miny = rect.top();
- minx = rect.left();
- maxx = rect.right();
- maxy = rect.bottom();
- }
-
- // TODO: better mapping of currY and startRect
-
- int n = 0;
- int i = *currSpan;
- int currY = spans[i].y;
- while (i < numSpans) {
-
- if (spans[i].y != currY && r != 0) {
- currY = spans[i].y;
- r = 0;
- const QRect &rect = rects[r];
- miny = rect.top();
- minx = rect.left();
- maxx = rect.right();
- maxy = rect.bottom();
- }
-
- if (spans[i].y < miny) {
- ++i;
- continue;
- }
-
- if (spans[i].y > maxy || spans[i].x > maxx) {
- if (++r >= numRects) {
- ++i;
- continue;
- }
-
- const QRect &rect = rects[r];
- miny = rect.top();
- minx = rect.left();
- maxx = rect.right();
- maxy = rect.bottom();
- continue;
- }
-
- if (spans[i].x + spans[i].len <= minx) {
- ++i;
- continue;
- }
-
- outSpans[n].y = spans[i].y;
- outSpans[n].coverage = spans[i].coverage;
-
- if (spans[i].x < minx) {
- const ushort cutaway = minx - spans[i].x;
- outSpans[n].len = qMin(spans[i].len - cutaway, maxx - minx + 1);
- outSpans[n].x = minx;
- if (outSpans[n].len == spans[i].len - cutaway) {
- ++i;
- } else {
- // span wider than current rect
- spans[i].len -= outSpans[n].len + cutaway;
- spans[i].x = maxx + 1;
- }
- } else { // span starts inside current rect
- outSpans[n].x = spans[i].x;
- outSpans[n].len = qMin(spans[i].len,
- ushort(maxx - spans[i].x + 1));
- if (outSpans[n].len == spans[i].len) {
- ++i;
- } else {
- // span wider than current rect
- spans[i].len -= outSpans[n].len;
- spans[i].x = maxx + 1;
- }
- }
-
- if (++n >= maxOut)
- break;
- }
-
- *currSpan = i;
- return n;
-}
static void qt_span_fill_clipRect(int count, const QSpan *spans,
void *userData)
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 664751a..6735ee6 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -48,6 +48,10 @@
#include "qprinterinfo.h"
#include <qnumeric.h>
+#ifdef Q_OS_UNIX
+#include "private/qcore_unix_p.h" // overrides QT_OPEN
+#endif
+
QT_BEGIN_NAMESPACE
extern int qt_defaultDpi();
@@ -964,8 +968,7 @@ QPdfBaseEngine::QPdfBaseEngine(QPdfBaseEnginePrivate &dd, PaintEngineFeatures f)
void QPdfBaseEngine::drawPoints (const QPointF *points, int pointCount)
{
- Q_D(QPdfBaseEngine);
- if (!points || !d->hasPen)
+ if (!points)
return;
QPainterPath p;
@@ -995,6 +998,12 @@ void QPdfBaseEngine::drawRects (const QRectF *rects, int rectCount)
return;
Q_D(QPdfBaseEngine);
+ if (d->useAlphaEngine) {
+ QAlphaPaintEngine::drawRects(rects, rectCount);
+ if (!continueCall())
+ return;
+ }
+
if (d->clipEnabled && d->allClipped)
return;
if (!d->hasPen && !d->hasBrush)
@@ -1647,7 +1656,7 @@ static void closeAllOpenFds()
#endif
// leave stdin/out/err untouched
while(--i > 2)
- ::close(i);
+ QT_CLOSE(i);
}
#endif
@@ -1681,7 +1690,7 @@ bool QPdfBaseEnginePrivate::openPrintDevice()
if (!printerName.isEmpty())
pr = printerName;
int fds[2];
- if (pipe(fds) != 0) {
+ if (qt_safe_pipe(fds) != 0) {
qWarning("QPdfPrinter: Could not open pipe to print");
return false;
}
@@ -1700,9 +1709,9 @@ bool QPdfBaseEnginePrivate::openPrintDevice()
(void)execlp("true", "true", (char *)0);
(void)execl("/bin/true", "true", (char *)0);
(void)execl("/usr/bin/true", "true", (char *)0);
- ::exit(0);
+ ::_exit(0);
}
- dup2(fds[0], 0);
+ qt_safe_dup2(fds[0], 0, 0);
closeAllOpenFds();
@@ -1769,14 +1778,14 @@ bool QPdfBaseEnginePrivate::openPrintDevice()
// wait for a second so the parent process (the
// child of the GUI process) has exited. then
// exit.
- ::close(0);
+ QT_CLOSE(0);
(void)::sleep(1);
- ::exit(0);
+ ::_exit(0);
}
// parent process
- ::close(fds[0]);
+ QT_CLOSE(fds[0]);
fd = fds[1];
- (void)::waitpid(pid, 0, 0);
+ (void)qt_safe_waitpid(pid, 0, 0);
if (fd < 0)
return false;
@@ -1923,7 +1932,7 @@ void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &t
#ifdef Q_WS_WIN
if (ti.fontEngine->type() == QFontEngine::Win) {
QFontEngineWin *fe = static_cast<QFontEngineWin *>(ti.fontEngine);
- size = fe->tm.w.tmHeight;
+ size = fe->tm.tmHeight;
}
#endif
diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp
index c1edcb3..b267860 100644
--- a/src/gui/painting/qprintengine_pdf.cpp
+++ b/src/gui/painting/qprintengine_pdf.cpp
@@ -655,7 +655,7 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
#ifdef Q_WS_WIN
if (ti.fontEngine->type() == QFontEngine::Win) {
QFontEngineWin *fe = static_cast<QFontEngineWin *>(ti.fontEngine);
- size = fe->tm.w.tmHeight;
+ size = fe->tm.tmHeight;
}
#endif
int synthesized = ti.fontEngine->synthesized();
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index f36028f..7b99e2f 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -199,33 +199,18 @@ bool QWin32PrintEngine::begin(QPaintDevice *pdev)
if (d->printToFile && d->fileName.isEmpty())
d->fileName = d->port;
- QT_WA({
- d->devModeW()->dmCopies = d->num_copies;
- DOCINFO di;
- memset(&di, 0, sizeof(DOCINFO));
- di.cbSize = sizeof(DOCINFO);
- di.lpszDocName = reinterpret_cast<const wchar_t *>(d->docName.utf16());
- if (d->printToFile && !d->fileName.isEmpty())
- di.lpszOutput = reinterpret_cast<const wchar_t *>(d->fileName.utf16());
- if (ok && StartDoc(d->hdc, &di) == SP_ERROR) {
- qErrnoWarning("QWin32PrintEngine::begin: StartDoc failed");
- ok = false;
- }
- } , {
- d->devModeA()->dmCopies = d->num_copies;
- DOCINFOA di;
- memset(&di, 0, sizeof(DOCINFOA));
- di.cbSize = sizeof(DOCINFOA);
- QByteArray docNameA = d->docName.toLocal8Bit();
- di.lpszDocName = docNameA.data();
- QByteArray outfileA = d->fileName.toLocal8Bit();
- if (d->printToFile && !d->fileName.isEmpty())
- di.lpszOutput = outfileA;
- if (ok && StartDocA(d->hdc, &di) == SP_ERROR) {
- qErrnoWarning("QWin32PrintEngine::begin: StartDoc failed");
- ok = false;
- }
- });
+ d->devMode->dmCopies = d->num_copies;
+
+ DOCINFO di;
+ memset(&di, 0, sizeof(DOCINFO));
+ di.cbSize = sizeof(DOCINFO);
+ di.lpszDocName = reinterpret_cast<const wchar_t *>(d->docName.utf16());
+ if (d->printToFile && !d->fileName.isEmpty())
+ di.lpszOutput = reinterpret_cast<const wchar_t *>(d->fileName.utf16());
+ if (ok && StartDoc(d->hdc, &di) == SP_ERROR) {
+ qErrnoWarning("QWin32PrintEngine::begin: StartDoc failed");
+ ok = false;
+ }
if (StartPage(d->hdc) <= 0) {
qErrnoWarning("QWin32PrintEngine::begin: StartPage failed");
@@ -317,11 +302,6 @@ bool QWin32PrintEngine::newPage()
bool success = false;
if (d->hdc && d->state == QPrinter::Active) {
-// bool restorePainter = false;
-// if ((qWinVersion()& Qt::WV_DOS_based) && painter && painter->isActive()) {
-// painter->save(); // EndPage/StartPage ruins the DC
-// restorePainter = true;
-// }
if (EndPage(d->hdc) != SP_ERROR) {
// reinitialize the DC before StartPage if needed,
// because resetdc is disabled between calls to the StartPage and EndPage functions
@@ -337,16 +317,10 @@ bool QWin32PrintEngine::newPage()
}
success = (StartPage(d->hdc) != SP_ERROR);
}
- if (!success)
+ if (!success) {
d->state = QPrinter::Aborted;
-
-// if (qWinVersion() & Qt::WV_DOS_based)
-// if (restorePainter) {
-// painter->restore();
-// }
-
- if (!success)
return false;
+ }
}
return true;
}
@@ -369,7 +343,7 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem
QRgb brushColor = state->pen().brush().color().rgb();
bool fallBack = state->pen().brush().style() != Qt::SolidPattern
|| qAlpha(brushColor) != 0xff
- || QT_WA_INLINE(d->txop >= QTransform::TxProject, d->txop >= QTransform::TxScale)
+ || d->txop >= QTransform::TxProject
|| ti.fontEngine->type() != QFontEngine::Win;
@@ -380,17 +354,10 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem
SelectObject(d->hdc, fe->hfont);
if (GetDeviceCaps(d->hdc, TECHNOLOGY) != DT_CHARSTREAM) {
- QT_WA({
- TCHAR n[64];
- GetTextFaceW(d->hdc, 64, n);
- fallBack = QString::fromUtf16((ushort *)n)
- != QString::fromUtf16((ushort *)fe->logfont.lfFaceName);
- } , {
- char an[64];
- GetTextFaceA(d->hdc, 64, an);
- fallBack = QString::fromLocal8Bit(an)
- != QString::fromLocal8Bit(((LOGFONTA*)(&fe->logfont))->lfFaceName);
- });
+ wchar_t n[64];
+ GetTextFace(d->hdc, 64, n);
+ fallBack = QString::fromWCharArray(n)
+ != QString::fromWCharArray(fe->logfont.lfFaceName);
}
}
@@ -983,22 +950,14 @@ void QWin32PrintEnginePrivate::queryDefault()
* Strings "windows" and "device" are specified in the MSDN under EnumPrinters()
*/
QString noPrinters(QLatin1String("qt_no_printers"));
- QString output;
- QT_WA({
- ushort buffer[256];
- GetProfileStringW(L"windows", L"device",
- reinterpret_cast<const wchar_t *>(noPrinters.utf16()),
- reinterpret_cast<wchar_t *>(buffer), 256);
- output = QString::fromUtf16(buffer);
- if (output.isEmpty() || output == noPrinters) // no printers
- return;
- }, {
- char buffer[256];
- GetProfileStringA("windows", "device", noPrinters.toLatin1(), buffer, 256);
- output = QString::fromLocal8Bit(buffer);
- if (output.isEmpty() || output == noPrinters) // no printers
- return;
- });
+ wchar_t buffer[256];
+ GetProfileString(L"windows", L"device",
+ reinterpret_cast<const wchar_t *>(noPrinters.utf16()),
+ buffer, 256);
+ QString output = QString::fromWCharArray(buffer);
+ if (output.isEmpty() || output == noPrinters) // no printers
+ return;
+
QStringList info = output.split(QLatin1Char(','));
if (info.size() > 0) {
if (name.isEmpty())
@@ -1030,13 +989,7 @@ void QWin32PrintEnginePrivate::initialize()
txop = QTransform::TxNone;
- bool ok;
- QT_WA( {
- ok = OpenPrinterW((LPWSTR)name.utf16(), (LPHANDLE)&hPrinter, 0);
- }, {
- ok = OpenPrinterA((LPSTR)name.toLatin1().data(), (LPHANDLE)&hPrinter, 0);
- } );
-
+ bool ok = OpenPrinter((LPWSTR)name.utf16(), (LPHANDLE)&hPrinter, 0);
if (!ok) {
qErrnoWarning("QWin32PrintEngine::initialize: OpenPrinter failed");
return;
@@ -1045,22 +998,10 @@ void QWin32PrintEnginePrivate::initialize()
// Fetch the PRINTER_INFO_2 with DEVMODE data containing the
// printer settings.
DWORD infoSize, numBytes;
- ok = true;
- QT_WA( {
- GetPrinterW(hPrinter, 2, NULL, 0, &infoSize);
- hMem = GlobalAlloc(GHND, infoSize);
- pInfo = GlobalLock(hMem);
- if (!GetPrinterW(hPrinter, 2, (LPBYTE)pInfo, infoSize, &numBytes)) {
- ok = false;
- }
- }, {
- GetPrinterA(hPrinter, 2, NULL, 0, &infoSize);
- hMem = GlobalAlloc(GHND, infoSize);
- pInfo = GlobalLock(hMem);
- if (!GetPrinterA(hPrinter, 2, (LPBYTE)pInfo, infoSize, &numBytes)) {
- ok = false;
- }
- });
+ GetPrinter(hPrinter, 2, NULL, 0, &infoSize);
+ hMem = GlobalAlloc(GHND, infoSize);
+ pInfo = (PRINTER_INFO_2*) GlobalLock(hMem);
+ ok = GetPrinter(hPrinter, 2, (LPBYTE)pInfo, infoSize, &numBytes);
if (!ok) {
qErrnoWarning("QWin32PrintEngine::initialize: GetPrinter failed");
@@ -1073,28 +1014,15 @@ void QWin32PrintEnginePrivate::initialize()
return;
}
- QT_WA( {
- devMode = pInfoW()->pDevMode;
- }, {
- devMode = pInfoA()->pDevMode;
- } );
-
- QT_WA( {
- hdc = CreateDC(reinterpret_cast<const wchar_t *>(program.utf16()),
- reinterpret_cast<const wchar_t *>(name.utf16()), 0, devModeW());
- }, {
- hdc = CreateDCA(program.toLatin1(), name.toLatin1(), 0, devModeA());
- } );
+ devMode = pInfo->pDevMode;
+ hdc = CreateDC(reinterpret_cast<const wchar_t *>(program.utf16()),
+ reinterpret_cast<const wchar_t *>(name.utf16()), 0, devMode);
Q_ASSERT(hPrinter);
Q_ASSERT(pInfo);
if (devMode) {
- QT_WA( {
- num_copies = devModeW()->dmCopies;
- }, {
- num_copies = devModeA()->dmCopies;
- } );
+ num_copies = devMode->dmCopies;
}
initHDC();
@@ -1212,28 +1140,18 @@ void QWin32PrintEnginePrivate::release()
QList<QVariant> QWin32PrintEnginePrivate::queryResolutions() const
{
// Read the supported resolutions of the printer.
- DWORD numRes;
- LONG *enumRes;
- DWORD errRes;
QList<QVariant> list;
- QT_WA({
- numRes = DeviceCapabilities(reinterpret_cast<const wchar_t *>(name.utf16()),
- reinterpret_cast<const wchar_t *>(port.utf16()),
- DC_ENUMRESOLUTIONS, 0, 0);
- if (numRes == (DWORD)-1)
- return list;
- enumRes = (LONG*)malloc(numRes * 2 * sizeof(LONG));
- errRes = DeviceCapabilities(reinterpret_cast<const wchar_t *>(name.utf16()),
- reinterpret_cast<const wchar_t *>(port.utf16()),
- DC_ENUMRESOLUTIONS, (LPWSTR)enumRes, 0);
- }, {
- numRes = DeviceCapabilitiesA(name.toLocal8Bit(), port.toLocal8Bit(), DC_ENUMRESOLUTIONS, 0, 0);
- if (numRes == (DWORD)-1)
- return list;
- enumRes = (LONG*)malloc(numRes * 2 * sizeof(LONG));
- errRes = DeviceCapabilitiesA(name.toLocal8Bit(), port.toLocal8Bit(), DC_ENUMRESOLUTIONS, (LPSTR)enumRes, 0);
- });
+ DWORD numRes = DeviceCapabilities(reinterpret_cast<const wchar_t *>(name.utf16()),
+ reinterpret_cast<const wchar_t *>(port.utf16()),
+ DC_ENUMRESOLUTIONS, 0, 0);
+ if (numRes == (DWORD)-1)
+ return list;
+
+ LONG *enumRes = (LONG*)malloc(numRes * 2 * sizeof(LONG));
+ DWORD errRes = DeviceCapabilities(reinterpret_cast<const wchar_t *>(name.utf16()),
+ reinterpret_cast<const wchar_t *>(port.utf16()),
+ DC_ENUMRESOLUTIONS, (LPWSTR)enumRes, 0);
if (errRes == (DWORD)-1) {
qErrnoWarning("QWin32PrintEngine::queryResolutions: DeviceCapabilities failed");
@@ -1241,7 +1159,8 @@ QList<QVariant> QWin32PrintEnginePrivate::queryResolutions() const
}
for (uint i=0; i<numRes; ++i)
- list.append(int(enumRes[i*2]));
+ list.append(int(enumRes[i * 2]));
+
return list;
}
@@ -1285,9 +1204,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
{
if (!d->devMode)
break;
- short collate = value.toBool() ? DMCOLLATE_TRUE : DMCOLLATE_FALSE;
- QT_WA( { d->devModeW()->dmCollate = collate; },
- { d->devModeA()->dmCollate = collate; } );
+ d->devMode->dmCollate = value.toBool() ? DMCOLLATE_TRUE : DMCOLLATE_FALSE;
d->doReinit();
}
break;
@@ -1296,8 +1213,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
{
if (!d->devMode)
break;
- int cm = value.toInt() == QPrinter::Color ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME;
- QT_WA( { d->devModeW()->dmColor = cm; }, { d->devModeA()->dmColor = cm; } );
+ d->devMode->dmColor = (value.toInt() == QPrinter::Color) ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME;
d->doReinit();
}
break;
@@ -1323,8 +1239,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
if (!d->devMode)
break;
d->num_copies = value.toInt();
- QT_WA( { d->devModeW()->dmCopies = d->num_copies; },
- { d->devModeA()->dmCopies = d->num_copies; });
+ d->devMode->dmCopies = d->num_copies;
d->doReinit();
break;
@@ -1333,14 +1248,8 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
if (!d->devMode)
break;
int orientation = value.toInt() == QPrinter::Landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT;
- int old_orientation;
- QT_WA( {
- old_orientation = d->devModeW()->dmOrientation;
- d->devModeW()->dmOrientation = orientation;
- }, {
- old_orientation = d->devModeA()->dmOrientation;
- d->devModeA()->dmOrientation = orientation;
- } );
+ int old_orientation = d->devMode->dmOrientation;
+ d->devMode->dmOrientation = orientation;
if (d->has_custom_paper_size && old_orientation != orientation)
d->paper_size = QSizeF(d->paper_size.height(), d->paper_size.width());
d->doReinit();
@@ -1359,11 +1268,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
case PPK_PaperSize:
if (!d->devMode)
break;
- QT_WA( {
- d->devModeW()->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt()));
- }, {
- d->devModeA()->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt()));
- } );
+ d->devMode->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt()));
d->has_custom_paper_size = (QPrinter::PaperSize(value.toInt()) == QPrinter::Custom);
d->doReinit();
break;
@@ -1378,11 +1283,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
if (v.contains(value))
dmMapped = mapPaperSourceDevmode(QPrinter::PaperSource(value.toInt()));
- QT_WA( {
- d->devModeW()->dmDefaultSource = dmMapped;
- }, {
- d->devModeA()->dmDefaultSource = dmMapped;
- } );
+ d->devMode->dmDefaultSource = dmMapped;
d->doReinit();
}
break;
@@ -1416,11 +1317,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
if (!d->devMode)
break;
d->has_custom_paper_size = false;
- QT_WA( {
- d->devModeW()->dmPaperSize = value.toInt();
- }, {
- d->devModeA()->dmPaperSize = value.toInt();
- } );
+ d->devMode->dmPaperSize = value.toInt();
d->doReinit();
break;
@@ -1430,33 +1327,28 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->paper_size = value.toSizeF();
if (!d->devMode)
break;
- int orientation;
- QT_WA( {
- orientation = d->devModeW()->dmOrientation;
- DWORD needed = 0;
- DWORD returned = 0;
- if (!EnumForms(d->hPrinter, 1, 0, 0, &needed, &returned)) {
- BYTE *forms = (BYTE *) malloc(needed);
- if (EnumForms(d->hPrinter, 1, forms, needed, &needed, &returned)) {
- for (DWORD i=0; i< returned; ++i) {
- FORM_INFO_1 *formArray = reinterpret_cast<FORM_INFO_1 *>(forms);
- // the form sizes are specified in 1000th of a mm,
- // convert the size to Points
- QSizeF size((formArray[i].Size.cx * 72/25.4)/1000.0,
- (formArray[i].Size.cy * 72/25.4)/1000.0);
- if (qAbs(d->paper_size.width() - size.width()) <= 2
- && qAbs(d->paper_size.height() - size.height()) <= 2)
- {
- d->devModeW()->dmPaperSize = i+1;
- break;
- }
+ int orientation = d->devMode->dmOrientation;
+ DWORD needed = 0;
+ DWORD returned = 0;
+ if (!EnumForms(d->hPrinter, 1, 0, 0, &needed, &returned)) {
+ BYTE *forms = (BYTE *) malloc(needed);
+ if (EnumForms(d->hPrinter, 1, forms, needed, &needed, &returned)) {
+ for (DWORD i=0; i< returned; ++i) {
+ FORM_INFO_1 *formArray = reinterpret_cast<FORM_INFO_1 *>(forms);
+ // the form sizes are specified in 1000th of a mm,
+ // convert the size to Points
+ QSizeF size((formArray[i].Size.cx * 72/25.4)/1000.0,
+ (formArray[i].Size.cy * 72/25.4)/1000.0);
+ if (qAbs(d->paper_size.width() - size.width()) <= 2
+ && qAbs(d->paper_size.height() - size.height()) <= 2)
+ {
+ d->devMode->dmPaperSize = i + 1;
+ break;
}
}
- free(forms);
}
- }, {
- orientation = d->devModeA()->dmOrientation;
- } );
+ free(forms);
+ }
if (orientation != DMORIENT_PORTRAIT)
d->paper_size = QSizeF(d->paper_size.height(), d->paper_size.width());
break;
@@ -1496,13 +1388,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
if (!d->devMode) {
value = QPrinter::Color;
} else {
- int mode;
- QT_WA( {
- mode = d->devModeW()->dmColor;
- }, {
- mode = d->devModeA()->dmColor;
- } );
- value = mode == DMCOLOR_COLOR ? QPrinter::Color : QPrinter::GrayScale;
+ value = (d->devMode->dmColor == DMCOLOR_COLOR) ? QPrinter::Color : QPrinter::GrayScale;
}
}
break;
@@ -1524,9 +1410,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
if (!d->devMode) {
value = QPrinter::Portrait;
} else {
- int o;
- QT_WA( { o = d->devModeW()->dmOrientation; }, { o = d->devModeA()->dmOrientation; } );
- value = o == DMORIENT_LANDSCAPE ? QPrinter::Landscape : QPrinter::Portrait;
+ value = (d->devMode->dmOrientation == DMORIENT_LANDSCAPE) ? QPrinter::Landscape : QPrinter::Portrait;
}
}
break;
@@ -1560,11 +1444,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
if (!d->devMode) {
value = QPrinter::A4;
} else {
- QT_WA( {
- value = mapDevmodePaperSize(d->devModeW()->dmPaperSize);
- }, {
- value = mapDevmodePaperSize(d->devModeA()->dmPaperSize);
- } );
+ value = mapDevmodePaperSize(d->devMode->dmPaperSize);
}
}
break;
@@ -1583,11 +1463,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
if (!d->devMode) {
value = QPrinter::Auto;
} else {
- QT_WA( {
- value = mapDevmodePaperSource(d->devModeW()->dmDefaultSource);
- }, {
- value = mapDevmodePaperSource(d->devModeA()->dmDefaultSource);
- } );
+ value = mapDevmodePaperSource(d->devMode->dmDefaultSource);
}
break;
@@ -1608,38 +1484,21 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
if (!d->devMode) {
value = -1;
} else {
- QT_WA( {
- value = d->devModeW()->dmPaperSize;
- }, {
- value = d->devModeA()->dmPaperSize;
- } );
+ value = d->devMode->dmPaperSize;
}
break;
case PPK_PaperSources:
{
- int available, count;
- WORD *data;
-
- QT_WA({
- available = DeviceCapabilitiesW((const WCHAR *)d->name.utf16(), (const WCHAR *)d->port.utf16(), DC_BINS, 0,
- d->devModeW());
- }, {
- available = DeviceCapabilitiesA(d->name.toLatin1(), d->port.toLatin1(), DC_BINS, 0,
- d->devModeA());
- });
+ int available = DeviceCapabilities((const wchar_t *)d->name.utf16(),
+ (const wchar_t *)d->port.utf16(), DC_BINS, 0, d->devMode);
if (available <= 0)
break;
- data = (WORD *) malloc(available * sizeof(WORD));
- QT_WA({
- count = DeviceCapabilitiesW((const WCHAR *)d->name.utf16(), (const WCHAR *)d->port.utf16(), DC_BINS, (WCHAR *)data,
- d->devModeW());
- }, {
- count = DeviceCapabilitiesA(d->name.toLatin1(), d->port.toLatin1(), DC_BINS,
- (char *) data, d->devModeA());
- });
+ wchar_t *data = new wchar_t[available];
+ int count = DeviceCapabilities((const wchar_t *)d->name.utf16(),
+ (const wchar_t *)d->port.utf16(), DC_BINS, data, d->devMode);
QList<QVariant> out;
for (int i=0; i<count; ++i) {
@@ -1648,7 +1507,8 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
out << (int) src;
}
value = out;
- free(data);
+
+ delete [] data;
}
break;
@@ -1693,24 +1553,23 @@ void QWin32PrintEngine::releaseDC(HDC) const
HGLOBAL *QWin32PrintEnginePrivate::createDevNames()
{
- QT_WA( {
- int size = sizeof(DEVNAMES)
- + program.length() * 2 + 2
- + name.length() * 2 + 2
- + port.length() * 2 + 2;
- HGLOBAL *hGlobal = (HGLOBAL *) GlobalAlloc(GMEM_MOVEABLE, size);
- DEVNAMES *dn = (DEVNAMES*) GlobalLock(hGlobal);
+ int size = sizeof(DEVNAMES)
+ + program.length() * 2 + 2
+ + name.length() * 2 + 2
+ + port.length() * 2 + 2;
+ HGLOBAL *hGlobal = (HGLOBAL *) GlobalAlloc(GMEM_MOVEABLE, size);
+ DEVNAMES *dn = (DEVNAMES*) GlobalLock(hGlobal);
- dn->wDriverOffset = sizeof(DEVNAMES) / sizeof(TCHAR);
- dn->wDeviceOffset = dn->wDriverOffset + program.length() + 1;
- dn->wOutputOffset = dn->wDeviceOffset + name.length() + 1;
+ dn->wDriverOffset = sizeof(DEVNAMES) / sizeof(wchar_t);
+ dn->wDeviceOffset = dn->wDriverOffset + program.length() + 1;
+ dn->wOutputOffset = dn->wDeviceOffset + name.length() + 1;
- memcpy((ushort*)dn + dn->wDriverOffset, program.utf16(), program.length() * 2 + 2);
- memcpy((ushort*)dn + dn->wDeviceOffset, name.utf16(), name.length() * 2 + 2);
- memcpy((ushort*)dn + dn->wOutputOffset, port.utf16(), port.length() * 2 + 2);
- dn->wDefault = 0;
+ memcpy((ushort*)dn + dn->wDriverOffset, program.utf16(), program.length() * 2 + 2);
+ memcpy((ushort*)dn + dn->wDeviceOffset, name.utf16(), name.length() * 2 + 2);
+ memcpy((ushort*)dn + dn->wOutputOffset, port.utf16(), port.length() * 2 + 2);
+ dn->wDefault = 0;
- GlobalUnlock(hGlobal);
+ GlobalUnlock(hGlobal);
// printf("QPrintDialogWinPrivate::createDevNames()\n"
// " -> wDriverOffset: %d\n"
@@ -1721,89 +1580,46 @@ HGLOBAL *QWin32PrintEnginePrivate::createDevNames()
// dn->wOutputOffset);
// printf("QPrintDialogWinPrivate::createDevNames(): %s, %s, %s\n",
-// QString::fromUtf16((ushort*)(dn) + dn->wDriverOffset).latin1(),
-// QString::fromUtf16((ushort*)(dn) + dn->wDeviceOffset).latin1(),
-// QString::fromUtf16((ushort*)(dn) + dn->wOutputOffset).latin1());
-
- return hGlobal;
- }, {
- int size = sizeof(DEVNAMES)
- + program.length() + 2
- + name.length() + 2
- + port.length() + 2;
- HGLOBAL *hGlobal = (HGLOBAL *) GlobalAlloc(GMEM_MOVEABLE, size);
- DEVNAMES *dn = (DEVNAMES*) GlobalLock(hGlobal);
-
- dn->wDriverOffset = sizeof(DEVNAMES);
- dn->wDeviceOffset = dn->wDriverOffset + program.length() + 1;
- dn->wOutputOffset = dn->wDeviceOffset + name.length() + 1;
-
- memcpy((char*)dn + dn->wDriverOffset, program.toLatin1(), program.length() + 2);
- memcpy((char*)dn + dn->wDeviceOffset, name.toLatin1(), name.length() + 2);
- memcpy((char*)dn + dn->wOutputOffset, port.toLatin1(), port.length() + 2);
- dn->wDefault = 0;
-
- GlobalUnlock(hGlobal);
- return hGlobal;
- } );
+// QString::fromWCharArray((wchar_t*)(dn) + dn->wDriverOffset).latin1(),
+// QString::fromWCharArray((wchar_t*)(dn) + dn->wDeviceOffset).latin1(),
+// QString::fromWCharArray((wchar_t*)(dn) + dn->wOutputOffset).latin1());
+
+ return hGlobal;
}
void QWin32PrintEnginePrivate::readDevnames(HGLOBAL globalDevnames)
{
if (globalDevnames) {
- QT_WA( {
- DEVNAMES *dn = (DEVNAMES*) GlobalLock(globalDevnames);
- name = QString::fromUtf16((ushort*)(dn) + dn->wDeviceOffset);
- port = QString::fromUtf16((ushort*)(dn) + dn->wOutputOffset);
- program = QString::fromUtf16((ushort*)(dn) + dn->wDriverOffset);
- GlobalUnlock(globalDevnames);
- }, {
- DEVNAMES *dn = (DEVNAMES*) GlobalLock(globalDevnames);
- name = QString::fromLatin1((char*)(dn) + dn->wDeviceOffset);
- port = QString::fromLatin1((char*)(dn) + dn->wOutputOffset);
- program = QString::fromLatin1((char*)(dn) + dn->wDriverOffset);
- GlobalUnlock(globalDevnames);
- } );
+ DEVNAMES *dn = (DEVNAMES*) GlobalLock(globalDevnames);
+ name = QString::fromWCharArray((wchar_t*)(dn) + dn->wDeviceOffset);
+ port = QString::fromWCharArray((wchar_t*)(dn) + dn->wOutputOffset);
+ program = QString::fromWCharArray((wchar_t*)(dn) + dn->wDriverOffset);
+ GlobalUnlock(globalDevnames);
}
}
void QWin32PrintEnginePrivate::readDevmode(HGLOBAL globalDevmode)
{
if (globalDevmode) {
- QT_WA( {
- DEVMODE *dm = (DEVMODE*) GlobalLock(globalDevmode);
- release();
- globalDevMode = globalDevmode;
- devMode = dm;
- hdc = CreateDC(reinterpret_cast<const wchar_t *>(program.utf16()),
- reinterpret_cast<const wchar_t *>(name.utf16()), 0, dm);
-
- num_copies = devModeW()->dmCopies;
- if (!OpenPrinterW((LPWSTR)name.utf16(), (LPHANDLE)&hPrinter, 0))
- qWarning("QPrinter: OpenPrinter() failed after reading DEVMODE.");
- }, {
- DEVMODEA *dm = (DEVMODEA*) GlobalLock(globalDevmode);
- release();
- globalDevMode = globalDevmode;
- devMode = dm;
- hdc = CreateDCA(program.toLatin1(), name.toLatin1(), 0, dm);
-
- num_copies = devModeA()->dmCopies;
- if (!OpenPrinterA((LPSTR)name.toLatin1().data(), (LPHANDLE)&hPrinter, 0))
- qWarning("QPrinter: OpenPrinter() failed after reading DEVMODE.");
- } );
+ DEVMODE *dm = (DEVMODE*) GlobalLock(globalDevmode);
+ release();
+ globalDevMode = globalDevmode;
+ devMode = dm;
+ hdc = CreateDC(reinterpret_cast<const wchar_t *>(program.utf16()),
+ reinterpret_cast<const wchar_t *>(name.utf16()), 0, dm);
+
+ num_copies = devMode->dmCopies;
+ if (!OpenPrinter((wchar_t*)name.utf16(), &hPrinter, 0))
+ qWarning("QPrinter: OpenPrinter() failed after reading DEVMODE.");
}
if (hdc)
initHDC();
}
-static void draw_text_item_win(const QPointF &_pos, const QTextItemInt &ti, HDC hdc,
+static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC hdc,
bool convertToText, const QTransform &xform, const QPointF &topLeft)
{
-
- // Make sure we translate for systems that can't handle world transforms
- QPointF pos(QT_WA_INLINE(_pos, _pos + QPointF(xform.dx(), xform.dy())));
QFontEngine *fe = ti.fontEngine;
QPointF baseline_pos = xform.inverted().map(xform.map(pos) - topLeft);
@@ -1815,12 +1631,10 @@ static void draw_text_item_win(const QPointF &_pos, const QTextItemInt &ti, HDC
HFONT hfont;
bool ttf = false;
- bool useTextOutA = false;
if (winfe) {
hfont = winfe->hfont;
ttf = winfe->ttf;
- useTextOutA = winfe->useTextOutA;
} else {
hfont = (HFONT)GetStockObject(ANSI_VAR_FONT);
}
@@ -1830,153 +1644,115 @@ static void draw_text_item_win(const QPointF &_pos, const QTextItemInt &ti, HDC
wchar_t *convertedGlyphs = (wchar_t *)ti.chars;
QGlyphLayout glyphs = ti.glyphs;
- if (!(ti.flags & QTextItem::RightToLeft) && useTextOutA) {
- qreal x = pos.x();
- qreal y = pos.y();
-
- // hack to get symbol fonts working on Win95. See also QFontEngine constructor
- // can only happen if !ttf
- for(int i = 0; i < glyphs.numGlyphs; i++) {
- QString str(QChar(glyphs.glyphs[i]));
- QT_WA({
- TextOutW(hdc, qRound(x + glyphs.offsets[i].x.toReal()),
- qRound(y + glyphs.offsets[i].y.toReal()),
- (LPWSTR)str.utf16(), str.length());
- } , {
- QByteArray cstr = str.toLocal8Bit();
- TextOutA(hdc, qRound(x + glyphs.offsets[i].x.toReal()),
- qRound(y + glyphs.offsets[i].y.toReal()),
- cstr.data(), cstr.length());
- });
- x += glyphs.effectiveAdvance(i).toReal();
- }
- } else {
- bool fast = !has_kerning && !(ti.flags & QTextItem::RightToLeft);
- for(int i = 0; fast && i < glyphs.numGlyphs; i++) {
- if (glyphs.offsets[i].x != 0 || glyphs.offsets[i].y != 0 || glyphs.justifications[i].space_18d6 != 0
- || glyphs.attributes[i].dontPrint) {
- fast = false;
- break;
- }
+ bool fast = !has_kerning && !(ti.flags & QTextItem::RightToLeft);
+ for (int i = 0; fast && i < glyphs.numGlyphs; i++) {
+ if (glyphs.offsets[i].x != 0 || glyphs.offsets[i].y != 0 || glyphs.justifications[i].space_18d6 != 0
+ || glyphs.attributes[i].dontPrint) {
+ fast = false;
+ break;
}
+ }
#if !defined(Q_OS_WINCE)
- // Scale, rotate and translate here. This is only valid for systems > Windows Me.
- // We should never get here on Windows Me or lower if the transformation specifies
- // scaling or rotation.
- QT_WA({
- XFORM win_xform;
- win_xform.eM11 = xform.m11();
- win_xform.eM12 = xform.m12();
- win_xform.eM21 = xform.m21();
- win_xform.eM22 = xform.m22();
- win_xform.eDx = xform.dx();
- win_xform.eDy = xform.dy();
- SetGraphicsMode(hdc, GM_ADVANCED);
- SetWorldTransform(hdc, &win_xform);
- }, {
- // nothing
- });
+ // Scale, rotate and translate here.
+ XFORM win_xform;
+ win_xform.eM11 = xform.m11();
+ win_xform.eM12 = xform.m12();
+ win_xform.eM21 = xform.m21();
+ win_xform.eM22 = xform.m22();
+ win_xform.eDx = xform.dx();
+ win_xform.eDy = xform.dy();
+
+ SetGraphicsMode(hdc, GM_ADVANCED);
+ SetWorldTransform(hdc, &win_xform);
#endif
- if (fast) {
- // fast path
- QVarLengthArray<wchar_t> g(glyphs.numGlyphs);
- for (int i = 0; i < glyphs.numGlyphs; ++i)
- g[i] = glyphs.glyphs[i];
- ExtTextOutW(hdc,
- qRound(baseline_pos.x() + glyphs.offsets[0].x.toReal()),
- qRound(baseline_pos.y() + glyphs.offsets[0].y.toReal()),
- options, 0, convertToText ? convertedGlyphs : g.data(), glyphs.numGlyphs, 0);
- } else {
- QVarLengthArray<QFixedPoint> positions;
- QVarLengthArray<glyph_t> _glyphs;
-
- QTransform matrix = QTransform::fromTranslate(baseline_pos.x(), baseline_pos.y());
- ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags,
- _glyphs, positions);
- if (_glyphs.size() == 0) {
- SelectObject(hdc, old_font);
- return;
- }
-
- convertToText = convertToText && glyphs.numGlyphs == _glyphs.size();
-
- bool outputEntireItem = (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
- && QSysInfo::WindowsVersion != QSysInfo::WV_NT
- && _glyphs.size() > 0;
+ if (fast) {
+ // fast path
+ QVarLengthArray<wchar_t> g(glyphs.numGlyphs);
+ for (int i = 0; i < glyphs.numGlyphs; ++i)
+ g[i] = glyphs.glyphs[i];
+ ExtTextOut(hdc,
+ qRound(baseline_pos.x() + glyphs.offsets[0].x.toReal()),
+ qRound(baseline_pos.y() + glyphs.offsets[0].y.toReal()),
+ options, 0, convertToText ? convertedGlyphs : g.data(), glyphs.numGlyphs, 0);
+ } else {
+ QVarLengthArray<QFixedPoint> positions;
+ QVarLengthArray<glyph_t> _glyphs;
+
+ QTransform matrix = QTransform::fromTranslate(baseline_pos.x(), baseline_pos.y());
+ ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags,
+ _glyphs, positions);
+ if (_glyphs.size() == 0) {
+ SelectObject(hdc, old_font);
+ return;
+ }
- if (outputEntireItem) {
- options |= ETO_PDY;
- QVarLengthArray<INT> glyphDistances(_glyphs.size() * 2);
- QVarLengthArray<wchar_t> g(_glyphs.size());
- for (int i=0; i<_glyphs.size() - 1; ++i) {
- glyphDistances[i * 2] = qRound(positions[i + 1].x) - qRound(positions[i].x);
- glyphDistances[i * 2 + 1] = qRound(positions[i + 1].y) - qRound(positions[i].y);
- g[i] = _glyphs[i];
- }
- glyphDistances[(_glyphs.size() - 1) * 2] = 0;
- glyphDistances[(_glyphs.size() - 1) * 2 + 1] = 0;
- g[_glyphs.size() - 1] = _glyphs[_glyphs.size() - 1];
- ExtTextOutW(hdc, qRound(positions[0].x), qRound(positions[0].y), options, 0,
- convertToText ? convertedGlyphs : g.data(), _glyphs.size(),
- glyphDistances.data());
- } else {
- int i = 0;
- while(i < _glyphs.size()) {
- wchar_t g = _glyphs[i];
-
- ExtTextOutW(hdc, qRound(positions[i].x),
- qRound(positions[i].y), options, 0,
- convertToText ? convertedGlyphs + i : &g, 1, 0);
- ++i;
- }
+ convertToText = convertToText && glyphs.numGlyphs == _glyphs.size();
+ bool outputEntireItem = _glyphs.size() > 0;
+
+ if (outputEntireItem) {
+ options |= ETO_PDY;
+ QVarLengthArray<INT> glyphDistances(_glyphs.size() * 2);
+ QVarLengthArray<wchar_t> g(_glyphs.size());
+ for (int i=0; i<_glyphs.size() - 1; ++i) {
+ glyphDistances[i * 2] = qRound(positions[i + 1].x) - qRound(positions[i].x);
+ glyphDistances[i * 2 + 1] = qRound(positions[i + 1].y) - qRound(positions[i].y);
+ g[i] = _glyphs[i];
+ }
+ glyphDistances[(_glyphs.size() - 1) * 2] = 0;
+ glyphDistances[(_glyphs.size() - 1) * 2 + 1] = 0;
+ g[_glyphs.size() - 1] = _glyphs[_glyphs.size() - 1];
+ ExtTextOut(hdc, qRound(positions[0].x), qRound(positions[0].y), options, 0,
+ convertToText ? convertedGlyphs : g.data(), _glyphs.size(),
+ glyphDistances.data());
+ } else {
+ int i = 0;
+ while(i < _glyphs.size()) {
+ wchar_t g = _glyphs[i];
+
+ ExtTextOut(hdc, qRound(positions[i].x),
+ qRound(positions[i].y), options, 0,
+ convertToText ? convertedGlyphs + i : &g, 1, 0);
+ ++i;
}
}
+ }
#if !defined(Q_OS_WINCE)
- QT_WA({
- XFORM win_xform;
- win_xform.eM11 = win_xform.eM22 = 1.0;
- win_xform.eM12 = win_xform.eM21 = win_xform.eDx = win_xform.eDy = 0.0;
- SetWorldTransform(hdc, &win_xform);
- }, {
- // nothing
- });
+ win_xform.eM11 = win_xform.eM22 = 1.0;
+ win_xform.eM12 = win_xform.eM21 = win_xform.eDx = win_xform.eDy = 0.0;
+ SetWorldTransform(hdc, &win_xform);
#endif
- }
+
SelectObject(hdc, old_font);
}
void QWin32PrintEnginePrivate::updateCustomPaperSize()
{
- QT_WA( {
- uint paperSize = devModeW()->dmPaperSize;
- if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) {
- has_custom_paper_size = true;
- DWORD needed = 0;
- DWORD returned = 0;
- if (!EnumForms(hPrinter, 1, 0, 0, &needed, &returned)) {
- BYTE *forms = (BYTE *) malloc(needed);
- if (EnumForms(hPrinter, 1, forms, needed, &needed, &returned)) {
- if (paperSize <= returned) {
- FORM_INFO_1 *formArray = (FORM_INFO_1 *) forms;
- int width = formArray[paperSize-1].Size.cx; // 1/1000 of a mm
- int height = formArray[paperSize-1].Size.cy; // 1/1000 of a mm
- paper_size = QSizeF((width*72/25.4)/1000.0, (height*72/25.4)/1000.0);
- } else {
- has_custom_paper_size = false;
- }
+ uint paperSize = devMode->dmPaperSize;
+ if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) {
+ has_custom_paper_size = true;
+ DWORD needed = 0;
+ DWORD returned = 0;
+ if (!EnumForms(hPrinter, 1, 0, 0, &needed, &returned)) {
+ BYTE *forms = (BYTE *) malloc(needed);
+ if (EnumForms(hPrinter, 1, forms, needed, &needed, &returned)) {
+ if (paperSize <= returned) {
+ FORM_INFO_1 *formArray = (FORM_INFO_1 *) forms;
+ int width = formArray[paperSize - 1].Size.cx; // 1/1000 of a mm
+ int height = formArray[paperSize - 1].Size.cy; // 1/1000 of a mm
+ paper_size = QSizeF((width * 72 /25.4) / 1000.0, (height * 72 / 25.4) / 1000.0);
+ } else {
+ has_custom_paper_size = false;
}
- free(forms);
}
- } else {
- has_custom_paper_size = false;
+ free(forms);
}
- }, {
- // Not supported under Win98
- } );
+ } else {
+ has_custom_paper_size = false;
+ }
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qprintengine_win_p.h b/src/gui/painting/qprintengine_win_p.h
index 9eb0b69..36a32e8 100644
--- a/src/gui/painting/qprintengine_win_p.h
+++ b/src/gui/painting/qprintengine_win_p.h
@@ -169,18 +169,8 @@ public:
void readDevmode(HGLOBAL globalDevmode);
void readDevnames(HGLOBAL globalDevnames);
- inline DEVMODEW *devModeW() const { return (DEVMODEW*) devMode; }
- inline DEVMODEA *devModeA() const { return (DEVMODEA*) devMode; }
-
- inline PRINTER_INFO_2W *pInfoW() { return (PRINTER_INFO_2W*) pInfo; };
- inline PRINTER_INFO_2A *pInfoA() { return (PRINTER_INFO_2A*) pInfo; };
-
inline bool resetDC() {
- QT_WA( {
- hdc = ResetDCW(hdc, devModeW());
- }, {
- hdc = ResetDCA(hdc, devModeA());
- } );
+ hdc = ResetDC(hdc, devMode);
return hdc != 0;
}
@@ -202,8 +192,8 @@ public:
HANDLE hPrinter;
HGLOBAL globalDevMode;
- void *devMode;
- void *pInfo;
+ DEVMODE *devMode;
+ PRINTER_INFO_2 *pInfo;
HGLOBAL hMem;
HDC hdc;
diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp
index 2a7553e..efaeb43 100644
--- a/src/gui/painting/qprinter.cpp
+++ b/src/gui/painting/qprinter.cpp
@@ -792,7 +792,8 @@ QPrinter::OutputFormat QPrinter::outputFormat() const
-/*! \reimp */
+/*! \internal
+*/
int QPrinter::devType() const
{
return QInternal::Printer;
diff --git a/src/gui/painting/qprinterinfo_win.cpp b/src/gui/painting/qprinterinfo_win.cpp
index e047f5d..4a92d30 100644
--- a/src/gui/painting/qprinterinfo_win.cpp
+++ b/src/gui/painting/qprinterinfo_win.cpp
@@ -43,7 +43,7 @@
#include <qstringlist.h>
-#include <windows.h>
+#include <qt_windows.h>
QT_BEGIN_NAMESPACE
@@ -95,45 +95,24 @@ QList<QPrinterInfo> QPrinterInfo::availablePrinters()
DWORD needed = 0;
DWORD returned = 0;
- QT_WA({
- if (!EnumPrintersW(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL,
- 4, 0, 0, &needed, &returned))
- {
- buffer = new BYTE[needed];
- if (!EnumPrintersW(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS , NULL,
- 4, buffer, needed, &needed, &returned))
- {
- delete [] buffer;
- return printers;
- }
- PPRINTER_INFO_4 infoList = reinterpret_cast<PPRINTER_INFO_4>(buffer);
- QPrinterInfo defPrn = defaultPrinter();
- for (uint i = 0; i < returned; ++i) {
- printers.append(QPrinterInfo(QString::fromUtf16(reinterpret_cast<const ushort*>(infoList[i].pPrinterName))));
- if (printers.at(i).printerName() == defPrn.printerName())
- printers[i].d_ptr->m_default = true;
- }
- delete [] buffer;
- }
- }, {
- // In Windows 98 networked printers are served through the local connection
- if (!EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, 0, 0, &needed, &returned)) {
- buffer = new BYTE[needed];
- if (!EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, buffer, needed, &needed, &returned)) {
- delete [] buffer;
- return printers;
- }
-
- PPRINTER_INFO_5 infoList = reinterpret_cast<PPRINTER_INFO_5>(buffer);
- QPrinterInfo defPrn = defaultPrinter();
- for (uint i = 0; i < returned; ++i) {
- printers.append(QPrinterInfo(QString::fromLocal8Bit(reinterpret_cast<const char*>(infoList[i].pPrinterName))));
- if (printers.at(i).printerName() == defPrn.printerName())
- printers[i].d_ptr->m_default = true;
- }
- delete [] buffer;
- }
- });
+ if ( !EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, 0, 0, &needed, &returned))
+ {
+ buffer = new BYTE[needed];
+ if (!EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS , NULL,
+ 4, buffer, needed, &needed, &returned))
+ {
+ delete [] buffer;
+ return printers;
+ }
+ PPRINTER_INFO_4 infoList = reinterpret_cast<PPRINTER_INFO_4>(buffer);
+ QPrinterInfo defPrn = defaultPrinter();
+ for (uint i = 0; i < returned; ++i) {
+ printers.append(QPrinterInfo(QString::fromWCharArray(infoList[i].pPrinterName)));
+ if (printers.at(i).printerName() == defPrn.printerName())
+ printers[i].d_ptr->m_default = true;
+ }
+ delete [] buffer;
+ }
return printers;
}
@@ -141,18 +120,9 @@ QList<QPrinterInfo> QPrinterInfo::availablePrinters()
QPrinterInfo QPrinterInfo::defaultPrinter()
{
QString noPrinters(QLatin1String("qt_no_printers"));
- QString output;
- QT_WA({
- ushort buffer[256];
- GetProfileStringW(L"windows", L"device",
- reinterpret_cast<const wchar_t *>(noPrinters.utf16()),
- reinterpret_cast<wchar_t *>(buffer), 256);
- output = QString::fromUtf16(buffer);
- }, {
- char buffer[256];
- GetProfileStringA("windows", "device", noPrinters.toLatin1(), buffer, 256);
- output = QString::fromLocal8Bit(buffer);
- });
+ wchar_t buffer[256];
+ GetProfileString(L"windows", L"device", (wchar_t*)noPrinters.utf16(), buffer, 256);
+ QString output = QString::fromWCharArray(buffer);
// Filter out the name of the printer, which should be everything
// before a comma.
@@ -234,26 +204,16 @@ bool QPrinterInfo::isDefault() const
QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
{
const Q_D(QPrinterInfo);
- DWORD size;
- WORD* papers;
QList<QPrinter::PaperSize> paperList;
- QT_WA({
- size = DeviceCapabilitiesW(reinterpret_cast<const WCHAR*>(d->m_name.utf16()),
- NULL, DC_PAPERS, NULL, NULL);
- if ((int)size == -1)
- return paperList;
- papers = new WORD[size];
- size = DeviceCapabilitiesW(reinterpret_cast<const WCHAR*>(d->m_name.utf16()),
- NULL, DC_PAPERS, reinterpret_cast<WCHAR*>(papers), NULL);
- }, {
- size = DeviceCapabilitiesA(d->m_name.toLatin1().data(), NULL, DC_PAPERS, NULL, NULL);
- if ((int)size == -1)
- return paperList;
- papers = new WORD[size];
- size = DeviceCapabilitiesA(d->m_name.toLatin1().data(), NULL, DC_PAPERS,
- reinterpret_cast<char*>(papers), NULL);
- });
+ DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->m_name.utf16()),
+ NULL, DC_PAPERS, NULL, NULL);
+ if ((int)size == -1)
+ return paperList;
+
+ wchar_t *papers = new wchar_t[size];
+ size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->m_name.utf16()),
+ NULL, DC_PAPERS, papers, NULL);
for (int c = 0; c < (int)size; ++c) {
paperList.append(mapDevmodePaperSize(papers[c]));
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 44de29e..7289a6b 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -92,10 +92,6 @@ QT_BEGIN_NAMESPACE
Example of using complex regions:
\snippet doc/src/snippets/code/src_gui_painting_qregion.cpp 0
- \warning Due to window system limitations, the whole coordinate space for a
- region is limited to the points between -32767 and 32767 on Windows
- 95/98/ME. You can circumvent this limitation by using a QPainterPath.
-
\section1 Additional License Information
On Embedded Linux, Windows CE and X11 platforms, parts of this class rely on
diff --git a/src/gui/painting/qregion_win.cpp b/src/gui/painting/qregion_win.cpp
index 873439e..249b1a6 100644
--- a/src/gui/painting/qregion_win.cpp
+++ b/src/gui/painting/qregion_win.cpp
@@ -59,7 +59,7 @@ HRGN qt_tryCreateRegion(QRegion::RegionType type, int left, int top, int right,
{
const int tries = 10;
for (int i = 0; i < tries; ++i) {
- HRGN region;
+ HRGN region = 0;
switch (type) {
case QRegion::Rectangle:
region = CreateRectRgn(left, top, right, bottom);
diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp
index 639bc92..d5a5c20 100644
--- a/src/gui/painting/qwindowsurface_qws.cpp
+++ b/src/gui/painting/qwindowsurface_qws.cpp
@@ -421,7 +421,8 @@ QWSWindowSurface::QWSWindowSurface(QWidget *widget)
QWSWindowSurface::~QWSWindowSurface()
{
#ifdef Q_BACKINGSTORE_SUBSURFACES
- winIdToSurfaceMap()->remove(winId());
+ if (d_ptr->winId)
+ winIdToSurfaceMap()->remove(d_ptr->winId);
#endif
delete d_ptr;
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index fadf6a6..63b39b2 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -43,6 +43,7 @@
#include <qglobal.h> // for Q_WS_WIN define (non-PCH)
#ifdef Q_WS_WIN
+#include <qlibrary.h>
#include <qt_windows.h>
#endif
@@ -67,10 +68,6 @@
QT_BEGIN_NAMESPACE
-#ifdef Q_WS_WIN
-PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect;
-#endif
-
class QRasterWindowSurfacePrivate
{
public:
@@ -82,9 +79,6 @@ public:
uint translucentBackground : 1;
#endif
#endif
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
- uint canUseLayeredWindow : 1;
-#endif
uint inSetGeometry : 1;
};
@@ -98,10 +92,6 @@ QRasterWindowSurface::QRasterWindowSurface(QWidget *window)
&& window->x11Info().depth() == 32;
#endif
#endif
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
- d_ptr->canUseLayeredWindow = ptrUpdateLayeredWindowIndirect
- && (qt_widget_private(window)->data.window_flags & Qt::FramelessWindowHint);
-#endif
d_ptr->image = 0;
d_ptr->inSetGeometry = false;
setStaticContentsSupport(true);
@@ -128,8 +118,7 @@ void QRasterWindowSurface::beginPaint(const QRegion &rgn)
#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE))
if (!qt_widget_private(window())->isOpaque) {
#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
- if (d_ptr->image->image.format() != QImage::Format_ARGB32_Premultiplied
- && d_ptr->canUseLayeredWindow)
+ if (d_ptr->image->image.format() != QImage::Format_ARGB32_Premultiplied)
prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
#endif
QPainter p(&d_ptr->image->image);
@@ -158,7 +147,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
QRect br = rgn.boundingRect();
#ifndef Q_WS_WINCE
- if (!qt_widget_private(window())->isOpaque && d->canUseLayeredWindow) {
+ if (!qt_widget_private(window())->isOpaque) {
QRect r = window()->frameGeometry();
QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft();
QRect dirtyRect = br.translated(offset + frameOffset);
@@ -166,12 +155,11 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
SIZE size = {r.width(), r.height()};
POINT ptDst = {r.x(), r.y()};
POINT ptSrc = {0, 0};
- Q_BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA};
+ BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA};
RECT dirty = {dirtyRect.x(), dirtyRect.y(),
dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, d->image->hdc, &ptSrc, 0, &blend, Q_ULW_ALPHA, &dirty};
-
- (*ptrUpdateLayeredWindowIndirect)(window()->internalWinId(), &info);
+ ptrUpdateLayeredWindowIndirect(window()->internalWinId(), &info);
} else
#endif
{
@@ -312,7 +300,7 @@ void QRasterWindowSurface::setGeometry(const QRect &rect)
#ifndef Q_WS_WIN
if (d_ptr->translucentBackground)
#else
- if (!qt_widget_private(window())->isOpaque && d->canUseLayeredWindow)
+ if (!qt_widget_private(window())->isOpaque)
#endif
prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
else
diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h
index 0f02a45..b3256b3 100644
--- a/src/gui/painting/qwindowsurface_raster_p.h
+++ b/src/gui/painting/qwindowsurface_raster_p.h
@@ -64,13 +64,6 @@ QT_BEGIN_NAMESPACE
#define Q_ULW_ALPHA 0x00000002 // copied from ULW_ALPHA in winuser.h
#define Q_AC_SRC_ALPHA 0x00000001 // copied from AC_SRC_ALPHA in winuser.h
-struct Q_BLENDFUNCTION {
- BYTE BlendOp;
- BYTE BlendFlags;
- BYTE SourceConstantAlpha;
- BYTE AlphaFormat;
-};
-
struct Q_UPDATELAYEREDWINDOWINFO {
DWORD cbSize;
HDC hdcDst;
@@ -79,12 +72,16 @@ struct Q_UPDATELAYEREDWINDOWINFO {
HDC hdcSrc;
const POINT *pptSrc;
COLORREF crKey;
- const Q_BLENDFUNCTION *pblend;
+ const BLENDFUNCTION *pblend;
DWORD dwFlags;
const RECT *prcDirty;
};
+typedef BOOL (WINAPI *PtrUpdateLayeredWindow)(HWND hwnd, HDC hdcDst, const POINT *pptDst,
+ const SIZE *psize, HDC hdcSrc, const POINT *pptSrc, COLORREF crKey,
+ const BLENDFUNCTION *pblend, DWORD dwflags);
typedef BOOL (WINAPI *PtrUpdateLayeredWindowIndirect)(HWND hwnd, const Q_UPDATELAYEREDWINDOWINFO *pULWInfo);
+extern PtrUpdateLayeredWindow ptrUpdateLayeredWindow;
extern PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect;
#endif
diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp
index f553d27..c2c7876 100644
--- a/src/gui/styles/gtksymbols.cpp
+++ b/src/gui/styles/gtksymbols.cpp
@@ -68,6 +68,7 @@
#include <QtGui/QStatusBar>
#include <QtGui/QMenuBar>
#include <QtGui/QToolBar>
+#include <QtGui/QToolButton>
#include <QtGui/QX11Info>
#include <X11/Xlib.h>
@@ -166,6 +167,7 @@ Ptr_gtk_file_filter_set_name QGtk::gtk_file_filter_set_name = 0;
Ptr_gtk_file_filter_add_pattern QGtk::gtk_file_filter_add_pattern = 0;
Ptr_gtk_file_chooser_add_filter QGtk::gtk_file_chooser_add_filter = 0;
Ptr_gtk_file_chooser_set_filter QGtk::gtk_file_chooser_set_filter = 0;
+Ptr_gtk_file_chooser_get_filter QGtk::gtk_file_chooser_get_filter = 0;
Ptr_gtk_file_chooser_dialog_new QGtk::gtk_file_chooser_dialog_new = 0;
Ptr_gtk_file_chooser_set_current_folder QGtk::gtk_file_chooser_set_current_folder = 0;
Ptr_gtk_file_chooser_get_filename QGtk::gtk_file_chooser_get_filename = 0;
@@ -220,6 +222,7 @@ static void resolveGtk()
QGtk::gtk_file_filter_add_pattern = (Ptr_gtk_file_filter_add_pattern)libgtk.resolve("gtk_file_filter_add_pattern");
QGtk::gtk_file_chooser_add_filter = (Ptr_gtk_file_chooser_add_filter)libgtk.resolve("gtk_file_chooser_add_filter");
QGtk::gtk_file_chooser_set_filter = (Ptr_gtk_file_chooser_set_filter)libgtk.resolve("gtk_file_chooser_set_filter");
+ QGtk::gtk_file_chooser_get_filter = (Ptr_gtk_file_chooser_get_filter)libgtk.resolve("gtk_file_chooser_get_filter");
QGtk::gtk_file_chooser_dialog_new = (Ptr_gtk_file_chooser_dialog_new)libgtk.resolve("gtk_file_chooser_dialog_new");
QGtk::gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)libgtk.resolve("gtk_file_chooser_set_current_folder");
QGtk::gtk_file_chooser_get_filename = (Ptr_gtk_file_chooser_get_filename)libgtk.resolve("gtk_file_chooser_get_filename");
@@ -633,6 +636,20 @@ GtkStyle* QGtk::gtkStyle(const QString &path)
return 0;
}
+static void update_toolbar_style(GtkWidget *gtkToolBar, GParamSpec *pspec, gpointer user_data)
+{
+ GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
+ g_object_get(gtkToolBar, "toolbar-style", &toolbar_style, NULL);
+ QWidgetList widgets = QApplication::allWidgets();
+ for (int i = 0; i < widgets.size(); ++i) {
+ QWidget *widget = widgets.at(i);
+ if (qobject_cast<QToolButton*>(widget)) {
+ QEvent event(QEvent::StyleChange);
+ QApplication::sendEvent(widget, &event);
+ }
+ }
+}
+
void QGtk::initGtkWidgets()
{
// From gtkmain.c
@@ -679,6 +696,7 @@ void QGtk::initGtkWidgets()
add_widget(QGtk::gtk_spin_button_new((GtkAdjustment*)
(QGtk::gtk_adjustment_new(1, 0, 1, 0, 0, 0)), 0.1, 3));
GtkWidget *toolbar = QGtk::gtk_toolbar_new();
+ g_signal_connect (toolbar, "notify::toolbar-style", G_CALLBACK (update_toolbar_style), toolbar);
QGtk::gtk_toolbar_insert((GtkToolbar*)toolbar, QGtk::gtk_separator_tool_item_new(), -1);
add_widget(toolbar);
init_gtk_treeview();
@@ -720,7 +738,8 @@ extern QStringList qt_make_filter_list(const QString &filter);
static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
const QString &dir, const QString &filter, QString *selectedFilter,
- QFileDialog::Options options, bool isSaveDialog = false)
+ QFileDialog::Options options, bool isSaveDialog = false,
+ QMap<GtkFileFilter *, QString> *filterMap = 0)
{
g_object_set(gtkFileChooser, "do-overwrite-confirmation", gboolean(!(options & QFileDialog::DontConfirmOverwrite)), NULL);
g_object_set(gtkFileChooser, "local_only", gboolean(true), NULL);
@@ -735,6 +754,8 @@ static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
foreach (const QString &fileExtension, extensions) {
QGtk::gtk_file_filter_add_pattern (gtkFilter, qPrintable(fileExtension));
}
+ if (filterMap)
+ filterMap->insert(gtkFilter, rawfilter);
QGtk::gtk_file_chooser_add_filter((GtkFileChooser*)gtkFileChooser, gtkFilter);
if (selectedFilter && (rawfilter == *selectedFilter))
QGtk::gtk_file_chooser_set_filter((GtkFileChooser*)gtkFileChooser, gtkFilter);
@@ -771,7 +792,7 @@ static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
QString QGtk::openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options)
{
-
+ QMap<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -779,7 +800,7 @@ QString QGtk::openFilename(QWidget *parent, const QString &caption, const QStrin
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
- setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options);
+ setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap);
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
@@ -791,6 +812,10 @@ QString QGtk::openFilename(QWidget *parent, const QString &caption, const QStrin
char *gtk_filename = QGtk::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
filename = QString::fromUtf8(gtk_filename);
g_free (gtk_filename);
+ if (selectedFilter) {
+ GtkFileFilter *gtkFilter = QGtk::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
+ *selectedFilter = filterMap.value(gtkFilter);
+ }
}
QApplicationPrivate::leaveModal(&modal_widget);
@@ -801,6 +826,7 @@ QString QGtk::openFilename(QWidget *parent, const QString &caption, const QStrin
QString QGtk::openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options)
{
+ QMap<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
@@ -830,6 +856,7 @@ QStringList QGtk::openFilenames(QWidget *parent, const QString &caption, const Q
QString *selectedFilter, QFileDialog::Options options)
{
QStringList filenames;
+ QMap<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -837,7 +864,7 @@ QStringList QGtk::openFilenames(QWidget *parent, const QString &caption, const Q
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
- setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options);
+ setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap);
g_object_set(gtkFileChooser, "select-multiple", gboolean(true), NULL);
QWidget modal_widget;
@@ -850,6 +877,10 @@ QStringList QGtk::openFilenames(QWidget *parent, const QString &caption, const Q
for (GSList *iterator = gtk_file_names ; iterator; iterator = iterator->next)
filenames << QString::fromUtf8((const char*)iterator->data);
g_slist_free(gtk_file_names);
+ if (selectedFilter) {
+ GtkFileFilter *gtkFilter = QGtk::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
+ *selectedFilter = filterMap.value(gtkFilter);
+ }
}
QApplicationPrivate::leaveModal(&modal_widget);
@@ -860,13 +891,14 @@ QStringList QGtk::openFilenames(QWidget *parent, const QString &caption, const Q
QString QGtk::saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options)
{
+ QMap<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
- setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, true);
+ setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, true, &filterMap);
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
@@ -878,6 +910,10 @@ QString QGtk::saveFilename(QWidget *parent, const QString &caption, const QStrin
char *gtk_filename = QGtk::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
filename = QString::fromUtf8(gtk_filename);
g_free (gtk_filename);
+ if (selectedFilter) {
+ GtkFileFilter *gtkFilter = QGtk::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
+ *selectedFilter = filterMap.value(gtkFilter);
+ }
}
QApplicationPrivate::leaveModal(&modal_widget);
diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/gtksymbols_p.h
index b0195d2..18c6dc5 100644
--- a/src/gui/styles/gtksymbols_p.h
+++ b/src/gui/styles/gtksymbols_p.h
@@ -162,6 +162,7 @@ typedef void (*Ptr_gtk_file_filter_set_name)(GtkFileFilter *, const gchar *);
typedef void (*Ptr_gtk_file_filter_add_pattern)(GtkFileFilter *filter, const gchar *pattern);
typedef void (*Ptr_gtk_file_chooser_add_filter)(GtkFileChooser *chooser, GtkFileFilter *filter);
typedef void (*Ptr_gtk_file_chooser_set_filter)(GtkFileChooser *chooser, GtkFileFilter *filter);
+typedef GtkFileFilter* (*Ptr_gtk_file_chooser_get_filter)(GtkFileChooser *chooser);
typedef gchar* (*Ptr_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
typedef GSList* (*Ptr_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
typedef GtkWidget* (*Ptr_gtk_file_chooser_dialog_new)(const gchar *title,
@@ -302,6 +303,7 @@ public:
static Ptr_gtk_file_filter_add_pattern gtk_file_filter_add_pattern;
static Ptr_gtk_file_chooser_add_filter gtk_file_chooser_add_filter;
static Ptr_gtk_file_chooser_set_filter gtk_file_chooser_set_filter;
+ static Ptr_gtk_file_chooser_get_filter gtk_file_chooser_get_filter;
static Ptr_gtk_file_chooser_dialog_new gtk_file_chooser_dialog_new;
static Ptr_gtk_file_chooser_set_current_folder gtk_file_chooser_set_current_folder;
static Ptr_gtk_file_chooser_get_filename gtk_file_chooser_get_filename;
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 3855ba7..8f88781 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -1745,10 +1745,9 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
int maxWidth = rect.width() - 4;
int minWidth = 4;
- qint64 progress = (qint64)qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
- double vc6_workaround = ((progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * maxWidth);
- int progressBarWidth = (int(vc6_workaround) > minWidth ) ? int(vc6_workaround) : minWidth;
- int width = indeterminate ? maxWidth : progressBarWidth;
+ qreal progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
+ int progressBarWidth = (progress - bar->minimum) * qreal(maxWidth) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
+ int width = indeterminate ? maxWidth : qMax(minWidth, progressBarWidth);
bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
if (inverted)
@@ -2042,6 +2041,12 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
s = s.left(t);
}
QFont font = menuitem->font;
+ // font may not have any "hard" flags set. We override
+ // the point size so that when it is resolved against the device, this font will win.
+ // This is mainly to handle cases where someone sets the font on the window
+ // and then the combo inherits it and passes it onward. At that point the resolve mask
+ // is very, very weak. This makes it stonger.
+ font.setPointSizeF(menuItem->font.pointSizeF());
if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
font.setBold(true);
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 7b8b75e..308a0b8 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -84,6 +84,8 @@
#ifdef Q_WS_X11
# include <private/qt_x11_p.h>
+#elif defined(Q_WS_MAC)
+# include <private/qt_cocoa_helpers_mac_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -840,6 +842,11 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
#ifdef Q_WS_X11 // These functions are used to parse the X11 freedesktop icon spec
+static int kdeVersion()
+{
+ static int kdeVersion = qgetenv("KDE_SESSION_VERSION").toInt();
+ return kdeVersion;
+}
void QCommonStylePrivate::lookupIconTheme() const
{
@@ -858,8 +865,7 @@ void QCommonStylePrivate::lookupIconTheme() const
QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde"));
QDir dir(fileInfo.canonicalFilePath());
- int kdeVersion = qgetenv("KDE_SESSION_VERSION").toInt();
- QString kdeDefault = kdeVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg");
+ QString kdeDefault = kdeVersion() >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg");
QString defaultTheme = fileInfo.exists() ? dir.dirName() : kdeDefault;
QSettings settings(QApplicationPrivate::kdeHome() +
QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
@@ -997,6 +1003,29 @@ QIcon QCommonStylePrivate::createIcon(const QString &name) const
icon.addPixmap(findIcon(32, name));
return icon;
}
+/*!internal
+
+Checks if you are running KDE and looks up the toolbar
+from the KDE configuration file
+
+*/
+int QCommonStylePrivate::lookupToolButtonStyle() const
+{
+ int result = Qt::ToolButtonIconOnly;
+ if (kdeVersion() >= 4) {
+ QSettings settings(QApplicationPrivate::kdeHome() +
+ QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
+ settings.beginGroup(QLatin1String("Toolbar style"));
+ QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString();
+ if (toolbarStyle == QLatin1String("TextBesideIcon"))
+ result = Qt::ToolButtonTextBesideIcon;
+ else if (toolbarStyle == QLatin1String("TextOnly"))
+ result = Qt::ToolButtonTextOnly;
+ else if (toolbarStyle == QLatin1String("TextUnderIcon"))
+ result = Qt::ToolButtonTextUnderIcon;
+ }
+ return result;
+}
#endif //Q_WS_X11
@@ -1155,8 +1184,14 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt
}
}
-/* Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore
- opt->rect and return rectangles in infinite space */
+/*! \internal
+ compute the position for the different component of an item (pixmap, text, checkbox)
+
+ Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore
+ opt->rect and return rectangles in infinite space
+
+ Code duplicated in QItemDelegate::doLayout
+*/
void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRect *checkRect,
QRect *pixmapRect, QRect *textRect, bool sizehint) const
{
@@ -1177,8 +1212,10 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRe
int y = opt->rect.top();
int w, h;
- if (textRect->height() == 0 && !hasPixmap)
+ if (textRect->height() == 0 && (!hasPixmap || !sizehint)) {
+ //if there is no text, we still want to have a decent height for the item sizeHint and the editor size
textRect->setHeight(opt->fontMetrics.height());
+ }
QSize pm(0, 0);
if (hasPixmap) {
@@ -4841,7 +4878,14 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_MessageBoxIconSize:
- ret = int(QStyleHelper::dpiScaled(32.));
+#ifdef Q_WS_MAC
+ if (QApplication::desktopSettingsAware()) {
+ ret = 64; // No DPI scaling, it's handled elsewhere.
+ } else
+#endif
+ {
+ ret = int(QStyleHelper::dpiScaled(32.));
+ }
break;
case PM_TextCursorWidth:
ret = 1;
@@ -5290,6 +5334,16 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_DockWidget_ButtonsHaveFrame:
ret = true;
break;
+ case SH_ToolButtonStyle:
+ ret = Qt::ToolButtonIconOnly;
+#ifdef Q_WS_X11
+ {
+ Q_D(const QCommonStyle);
+ static int buttonStyle = d->lookupToolButtonStyle();
+ return buttonStyle;
+ }
+#endif
+ break;
default:
ret = 0;
break;
@@ -5729,9 +5783,9 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
const QWidget *widget) const
{
QIcon icon;
-#ifdef Q_WS_X11
- Q_D(const QCommonStyle);
if (QApplication::desktopSettingsAware()) {
+#ifdef Q_WS_X11
+ Q_D(const QCommonStyle);
d->lookupIconTheme();
QPixmap pixmap;
switch (standardIcon) {
@@ -5750,6 +5804,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
case SP_MessageBoxWarning:
{
icon = d->createIcon(QLatin1String("dialog-warning.png"));
+ icon = d->createIcon(QLatin1String("dialog-warning.png"));
if (icon.isNull())
icon = d->createIcon(QLatin1String("messagebox_warning.png"));
break;
@@ -5975,8 +6030,101 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
}
if (!icon.isNull())
return icon;
+#elif defined(Q_WS_MAC)
+ OSType iconType = 0;
+ switch (standardIcon) {
+ case QStyle::SP_MessageBoxQuestion:
+ case QStyle::SP_MessageBoxInformation:
+ case QStyle::SP_MessageBoxWarning:
+ case QStyle::SP_MessageBoxCritical:
+ iconType = kGenericApplicationIcon;
+ break;
+ case SP_DesktopIcon:
+ iconType = kDesktopIcon;
+ break;
+ case SP_TrashIcon:
+ iconType = kTrashIcon;
+ break;
+ case SP_ComputerIcon:
+ iconType = kComputerIcon;
+ break;
+ case SP_DriveFDIcon:
+ iconType = kGenericFloppyIcon;
+ break;
+ case SP_DriveHDIcon:
+ iconType = kGenericHardDiskIcon;
+ break;
+ case SP_DriveCDIcon:
+ case SP_DriveDVDIcon:
+ iconType = kGenericCDROMIcon;
+ break;
+ case SP_DriveNetIcon:
+ iconType = kGenericNetworkIcon;
+ break;
+ case SP_DirOpenIcon:
+ iconType = kOpenFolderIcon;
+ break;
+ case SP_DirClosedIcon:
+ case SP_DirLinkIcon:
+ iconType = kGenericFolderIcon;
+ break;
+ case SP_FileLinkIcon:
+ case SP_FileIcon:
+ iconType = kGenericDocumentIcon;
+ break;
+ case SP_DirIcon: {
+ // A rather special case
+ QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget);
+ QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget);
+ closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On);
+ closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On);
+ closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On);
+ closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On);
+ return closeIcon;
}
-#endif//Q_WS_X11
+ case SP_TitleBarNormalButton:
+ case SP_TitleBarCloseButton: {
+ QIcon titleBarIcon;
+ if (standardIcon == SP_TitleBarCloseButton) {
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png"));
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
+ } else {
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png"));
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
+ }
+ return titleBarIcon;
+ }
+ default:
+ break;
+ }
+ if (iconType != 0) {
+ QIcon retIcon;
+ IconRef icon;
+ IconRef overlayIcon = 0;
+ if (iconType != kGenericApplicationIcon) {
+ GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
+ } else {
+ FSRef fsRef;
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ GetProcessBundleLocation(&psn, &fsRef);
+ GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
+ if (standardIcon == SP_MessageBoxCritical) {
+ overlayIcon = icon;
+ GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
+ }
+ }
+ if (icon) {
+ qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon);
+ ReleaseIconRef(icon);
+ }
+ if (overlayIcon)
+ ReleaseIconRef(overlayIcon);
+ return retIcon;
+ }
+
+#endif //Q_WS_X11 || Q_WS_MAC
+ }
+
switch (standardIcon) {
#ifndef QT_NO_IMAGEFORMAT_PNG
diff --git a/src/gui/styles/qcommonstyle_p.h b/src/gui/styles/qcommonstyle_p.h
index 27ebc05..f2af5b2 100644
--- a/src/gui/styles/qcommonstyle_p.h
+++ b/src/gui/styles/qcommonstyle_p.h
@@ -126,6 +126,7 @@ public:
//icon detection on X11
#ifdef Q_WS_X11
void lookupIconTheme() const;
+ int lookupToolButtonStyle() const;
QIcon createIcon(const QString &) const;
QPixmap findIcon(int size, const QString &) const;
QPixmap findIconHelper(int size, const QString &, const QString &, QStringList &visited) const;
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 67586ac..660b4c3 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -70,6 +70,7 @@
#include <qpixmapcache.h>
#undef signals // Collides with GTK stymbols
#include "qgtkpainter_p.h"
+#include "qstylehelper_p.h"
#include <private/qcleanlooksstyle_p.h>
@@ -208,17 +209,6 @@ static GdkColor fromQColor(const QColor &color)
return retval;
}
-// Note this is different from uniqueName as used in QGtkPainter
-static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
-{
- QString tmp;
- const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
- tmp.sprintf("%s-%d-%d-%d-%lld-%dx%d", key.toLatin1().constData(), uint(option->state),
- option->direction, complexOption ? uint(complexOption->activeSubControls) : uint(0),
- option->palette.cacheKey(), size.width(), size.height());
- return tmp;
-}
-
/*!
\class QGtkStyle
\brief The QGtkStyle class provides a widget style rendered by GTK+
@@ -609,6 +599,26 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg
break;
+ case SH_ToolButtonStyle:
+ {
+ if (QGtk::isKDE4Session())
+ return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
+ GtkWidget *gtkToolbar = QGtk::gtkWidget(QLS("GtkToolbar"));
+ GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
+ g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL);
+ switch (toolbar_style) {
+ case GTK_TOOLBAR_TEXT:
+ return Qt::ToolButtonTextOnly;
+ case GTK_TOOLBAR_BOTH:
+ return Qt::ToolButtonTextUnderIcon;
+ case GTK_TOOLBAR_BOTH_HORIZ:
+ return Qt::ToolButtonTextBesideIcon;
+ case GTK_TOOLBAR_ICONS:
+ default:
+ return Qt::ToolButtonIconOnly;
+ }
+ }
+ break;
case SH_SpinControls_DisableOnBounds:
return int(true);
@@ -2065,8 +2075,8 @@ void QGtkStyle::drawControl(ControlElement element,
}
if (vertical)
rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
- const int progressIndicatorPos = static_cast<int>((bar->progress - qint64(bar->minimum)) /
- qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * rect.width());
+ const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() /
+ qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height());
if (vertical)
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index b20db5b..2f93034 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -558,7 +558,6 @@ QT_END_INCLUDE_NAMESPACE
External functions
*****************************************************************************/
extern CGContextRef qt_mac_cg_context(const QPaintDevice *); //qpaintdevice_mac.cpp
-extern QPixmap qt_mac_convert_iconref(const IconRef, int, int); //qpixmap_mac.cpp
extern QRegion qt_mac_convert_mac_region(HIShapeRef); //qregion_mac.cpp
void qt_mac_dispose_rgn(RgnHandle r); //qregion_mac.cpp
extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp
@@ -1871,24 +1870,23 @@ QPixmap QMacStylePrivate::generateBackgroundPattern() const
Fills the given \a rect with the pattern stored in \a brush. As an optimization,
HIThemeSetFill us used directly if we are filling with the standard background.
*/
-void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush)
+void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush)
{
QPoint dummy;
const QPaintDevice *target = painter->device();
const QPaintDevice *redirected = QPainter::redirected(target, &dummy);
const bool usePainter = redirected && redirected != target;
- const QRegion translated = rgn.translated(offset);
if (!usePainter && qt_mac_backgroundPattern
&& qt_mac_backgroundPattern->cacheKey() == brush.texture().cacheKey()) {
- painter->setClipRegion(translated);
+ painter->setClipRegion(rgn);
CGContextRef cg = qt_mac_cg_context(target);
CGContextSaveGState(cg);
HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted);
- const QVector<QRect> &rects = translated.rects();
+ const QVector<QRect> &rects = rgn.rects();
for (int i = 0; i < rects.size(); ++i) {
const QRect rect(rects.at(i));
// Anchor the pattern to the top so it stays put when the window is resized.
@@ -1899,8 +1897,8 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint
CGContextRestoreGState(cg);
} else {
- const QRect rect(translated.boundingRect());
- painter->setClipRegion(translated);
+ const QRect rect(rgn.boundingRect());
+ painter->setClipRegion(rgn);
painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
}
}
@@ -2304,9 +2302,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case PM_ToolBarItemSpacing:
ret = 4;
break;
- case PM_MessageBoxIconSize:
- ret = 64;
- break;
case PM_SplitterWidth:
ret = qMax(7, QApplication::globalStrut().width());
break;
@@ -3362,6 +3357,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pixmap);
break; }
+ default:
+ Q_ASSERT(false);
+ break;
}
if (needText) {
@@ -3991,8 +3989,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
const int xm = macItemFrame + maxpmw + macItemHMargin;
QFont myFont = mi->font;
- if (mi->state & QStyle::State_Mini)
- myFont.setPointSize(mi->font.pointSize());
+ // myFont may not have any "hard" flags set. We override
+ // the point size so that when it is resolved against the device, this font will win.
+ // This is mainly to handle cases where someone sets the font on the window
+ // and then the combo inherits it and passes it onward. At that point the resolve mask
+ // is very, very weak. This makes it stonger.
+ myFont.setPointSizeF(mi->font.pointSizeF());
p->setFont(myFont);
p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth + 1,
contentRect.height(), text_flags ^ Qt::AlignRight, s);
@@ -5852,76 +5854,12 @@ bool QMacStyle::event(QEvent *e)
return false;
}
-void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon, QStyle::StandardPixmap standardIcon = QStyle::SP_CustomBase)
-{
- int size = 16;
- while (size <= 128) {
-
- const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size);
- QPixmap mainIcon;
- if (standardIcon >= QStyle::SP_CustomBase) {
- mainIcon = qt_mac_convert_iconref(icon, size, size);
- } else if (QPixmapCache::find(cacheKey, mainIcon) == false) {
- mainIcon = qt_mac_convert_iconref(icon, size, size);
- QPixmapCache::insert(cacheKey, mainIcon);
- }
-
- if (overlayIcon) {
- int littleSize = size / 2;
- QPixmap overlayPix = qt_mac_convert_iconref(overlayIcon, littleSize, littleSize);
- QPainter painter(&mainIcon);
- painter.drawPixmap(size - littleSize, size - littleSize, overlayPix);
- }
-
- retIcon->addPixmap(mainIcon);
- size += size; // 16 -> 32 -> 64 -> 128
- }
-}
-
QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt,
const QWidget *widget) const
{
- OSType iconType = 0;
switch (standardIcon) {
- case QStyle::SP_MessageBoxQuestion:
- case QStyle::SP_MessageBoxInformation:
- case QStyle::SP_MessageBoxWarning:
- case QStyle::SP_MessageBoxCritical:
- iconType = kGenericApplicationIcon;
- break;
- case SP_DesktopIcon:
- iconType = kDesktopIcon;
- break;
- case SP_TrashIcon:
- iconType = kTrashIcon;
- break;
- case SP_ComputerIcon:
- iconType = kComputerIcon;
- break;
- case SP_DriveFDIcon:
- iconType = kGenericFloppyIcon;
- break;
- case SP_DriveHDIcon:
- iconType = kGenericHardDiskIcon;
- break;
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- iconType = kGenericCDROMIcon;
- break;
- case SP_DriveNetIcon:
- iconType = kGenericNetworkIcon;
- break;
- case SP_DirOpenIcon:
- iconType = kOpenFolderIcon;
- break;
- case SP_DirClosedIcon:
- case SP_DirLinkIcon:
- iconType = kGenericFolderIcon;
- break;
- case SP_FileLinkIcon:
- case SP_FileIcon:
- iconType = kGenericDocumentIcon;
- break;
+ default:
+ return QWindowsStyle::standardIconImplementation(standardIcon, opt, widget);
case SP_ToolBarHorizontalExtensionButton:
case SP_ToolBarVerticalExtensionButton: {
QPixmap pixmap(qt_mac_toolbar_ext);
@@ -5935,58 +5873,8 @@ QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const Q
return pix2;
}
return pixmap;
- }
- break;
- case SP_DirIcon: {
- // A rather special case
- QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, opt, widget);
- QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, opt, widget);
- closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On);
- closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On);
- closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On);
- closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On);
- return closeIcon;
- }
- case SP_TitleBarNormalButton:
- case SP_TitleBarCloseButton: {
- QIcon titleBarIcon;
- if (standardIcon == SP_TitleBarCloseButton) {
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png"));
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
- } else {
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png"));
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
- }
- return titleBarIcon;
- }
- default:
- break;
}
- if (iconType != 0) {
- QIcon retIcon;
- IconRef icon;
- IconRef overlayIcon = 0;
- if (iconType != kGenericApplicationIcon) {
- GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
- } else {
- FSRef fsRef;
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- GetProcessBundleLocation(&psn, &fsRef);
- GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
- if (standardIcon == SP_MessageBoxCritical) {
- overlayIcon = icon;
- GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
- }
- }
- if (icon) {
- qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon);
- ReleaseIconRef(icon);
- }
- if (overlayIcon)
- ReleaseIconRef(overlayIcon);
- return retIcon;
}
- return QWindowsStyle::standardIconImplementation(standardIcon, opt, widget);
}
int QMacStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1,
diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp
index 12aa679..80c9881 100644
--- a/src/gui/styles/qplastiquestyle.cpp
+++ b/src/gui/styles/qplastiquestyle.cpp
@@ -730,16 +730,6 @@ static QColor mergedColors(const QColor &colorA, const QColor &colorB, int facto
return tmp;
}
-static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
-{
- QString tmp;
- const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
- tmp.sprintf("%s-%d-%d-%d-%lld-%dx%d", key.toLatin1().constData(), uint(option->state),
- option->direction, complexOption ? uint(complexOption->activeSubControls) : uint(0),
- option->palette.cacheKey(), size.width(), size.height());
- return tmp;
-}
-
static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart,
const QColor &gradientStop)
{
@@ -1512,7 +1502,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
rect.adjust(2, 0, -2, 0);
}
#endif
- QString pixmapName = uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(rect.size());
cache.fill(Qt::transparent);
@@ -2581,8 +2571,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
painter->setTransform(m, true);
}
- double vc6_workaround = ((bar->progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * rect.width());
- int progressIndicatorPos = int(vc6_workaround);
+ int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum) * rect.width();
bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted)
|| ((bar->direction == Qt::LeftToRight) && inverted))) || (vertical && ((!inverted && !bottomToTop) || (inverted && bottomToTop)));
@@ -2777,7 +2766,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// contents
painter->setPen(QPen());
- QString progressBarName = uniqueName(QLatin1String("progressBarContents"),
+ QString progressBarName = QStyleHelper::uniqueName(QLatin1String("progressBarContents"),
option, rect.size());
QPixmap cache;
if (!QPixmapCache::find(progressBarName, cache) && rect.height() > 7) {
@@ -2837,7 +2826,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// Draws the header in tables.
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
QPixmap cache;
- QString pixmapName = uniqueName(QLatin1String("headersection"), option, option->rect.size());
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size());
pixmapName += QString::number(- int(header->position));
pixmapName += QString::number(- int(header->orientation));
@@ -3084,7 +3073,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// Draws a menu bar item; File, Edit, Help etc..
if ((option->state & State_Selected)) {
QPixmap cache;
- QString pixmapName = uniqueName(QLatin1String("menubaritem"), option, option->rect.size());
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("menubaritem"), option, option->rect.size());
if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
@@ -3447,7 +3436,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
bool reverse = scrollBar->direction == Qt::RightToLeft;
bool sunken = scrollBar->state & State_Sunken;
- QString addLinePixmapName = uniqueName(QLatin1String("scrollbar_addline"), option, option->rect.size());
+ QString addLinePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_addline"), option, option->rect.size());
QPixmap cache;
if (!QPixmapCache::find(addLinePixmapName, cache)) {
cache = QPixmap(option->rect.size());
@@ -3519,7 +3508,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
bool sunken = scrollBar->state & State_Sunken;
bool horizontal = scrollBar->orientation == Qt::Horizontal;
- QString groovePixmapName = uniqueName(QLatin1String("scrollbar_groove"), option, option->rect.size());
+ QString groovePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_groove"), option, option->rect.size());
if (sunken)
groovePixmapName += QLatin1String("-sunken");
if (element == CE_ScrollBarAddPage)
@@ -3578,7 +3567,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
button2.setRect(scrollBarSubLine.left(), scrollBarSubLine.bottom() - (scrollBarExtent - 1), scrollBarSubLine.width(), scrollBarExtent);
}
- QString subLinePixmapName = uniqueName(QLatin1String("scrollbar_subline"), option, button1.size());
+ QString subLinePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_subline"), option, button1.size());
QPixmap cache;
if (!QPixmapCache::find(subLinePixmapName, cache)) {
cache = QPixmap(button1.size());
@@ -3653,7 +3642,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// The slider
if (option->rect.isValid()) {
- QString sliderPixmapName = uniqueName(QLatin1String("scrollbar_slider"), option, option->rect.size());
+ QString sliderPixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_slider"), option, option->rect.size());
if (horizontal)
sliderPixmapName += QLatin1String("-horizontal");
@@ -3873,7 +3862,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
if ((option->subControls & SC_SliderHandle) && handle.isValid()) {
- QString handlePixmapName = uniqueName(QLatin1String("slider_handle"), option, handle.size());
+ QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size());
if (ticksAbove && !ticksBelow)
handlePixmapName += QLatin1String("-flipped");
if ((option->activeSubControls & SC_SliderHandle) && (option->state & State_Sunken))
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index 797886c..a5ab80e 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -526,8 +526,9 @@ void QStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, c
}
if (!enabled) {
if (styleHint(SH_DitherDisabledText)) {
- painter->drawText(rect, alignment, text);
- painter->fillRect(painter->boundingRect(rect, alignment, text), QBrush(painter->background().color(), Qt::Dense5Pattern));
+ QRect br;
+ painter->drawText(rect, alignment, text, &br);
+ painter->fillRect(br, QBrush(painter->background().color(), Qt::Dense5Pattern));
return;
} else if (styleHint(SH_EtchDisabledText)) {
QPen pen = painter->pen();
@@ -1865,6 +1866,8 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SH_DockWidget_ButtonsHaveFrame Determines if dockwidget buttons should have frames. Default is true.
+ \value SH_ToolButtonStyle Determines the default system style for tool buttons that uses Qt::ToolButtonFollowStyle.
+
\omitvalue SH_UnderlineAccelerator
\sa styleHint()
diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h
index d79c39c..f22bf55 100644
--- a/src/gui/styles/qstyle.h
+++ b/src/gui/styles/qstyle.h
@@ -730,7 +730,7 @@ public:
SH_ItemView_DrawDelegateFrame,
SH_TabBar_CloseButtonPosition,
SH_DockWidget_ButtonsHaveFrame,
-
+ SH_ToolButtonStyle,
// Add new style hint values here
#ifdef QT3_SUPPORT
diff --git a/src/gui/styles/qstyle_p.h b/src/gui/styles/qstyle_p.h
index da1debd..11be2f8 100644
--- a/src/gui/styles/qstyle_p.h
+++ b/src/gui/styles/qstyle_p.h
@@ -43,6 +43,7 @@
#define QSTYLE_P_H
#include "private/qobject_p.h"
+#include "private/qstylehelper_p.h"
#include <QtGui/qstyle.h>
QT_BEGIN_NAMESPACE
@@ -78,7 +79,7 @@ public:
QPixmap internalPixmapCache; \
QImage imageCache; \
QPainter *p = painter; \
- QString unique = uniqueName((a), option, option->rect.size()); \
+ QString unique = QStyleHelper::uniqueName((a), option, option->rect.size()); \
int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
bool doPixmapCache = txType <= QTransform::TxTranslate; \
if (doPixmapCache && QPixmapCache::find(unique, internalPixmapCache)) { \
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index f9010e8..4877ec4 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -60,11 +60,10 @@ namespace QStyleHelper {
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
{
- QString tmp;
const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
- tmp.sprintf("%s-%d-%d-%lld-%dx%d-%d", key.toLatin1().constData(), uint(option->state),
- complexOption ? uint(complexOption->activeSubControls) : uint(0),
- option->palette.cacheKey(), size.width(), size.height(), option->direction);
+ QString tmp = QString::fromLatin1("%1-%2-%3-%4-%5-%6x%7").arg(key).arg(uint(option->state)).arg(option->direction)
+ .arg(complexOption ? uint(complexOption->activeSubControls) : uint(0))
+ .arg(option->palette.cacheKey()).arg(size.width()).arg(size.height());
#ifndef QT_NO_SPINBOX
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
tmp.append(QLatin1Char('-'));
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 01d8aad..2efa4a7 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -4171,7 +4171,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
if (!rule.hasDrawable()) {
QWidget *container = containerWidget(w);
if (autoFillDisabledWidgets->contains(container)
- && (container == w || !renderRule(container, opt).hasDrawable())) {
+ && (container == w || !renderRule(container, opt).hasBackground())) {
//we do not have a background, but we disabled the autofillbackground anyway. so fill the background now.
// (this may happen if we have rules like :focus)
p->fillRect(opt->rect, opt->palette.brush(w->backgroundRole()));
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index ea8ee87..bc1df9d 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -127,8 +127,6 @@ static const int windowsTabSpacing = 12; // space between text and tab
static const int windowsRightBorder = 15; // right border on windows
static const int windowsCheckMarkWidth = 12; // checkmarks width on windows
-static bool use2000style = true;
-
enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
/*
@@ -270,9 +268,6 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
*/
QWindowsStyle::QWindowsStyle() : QCommonStyle(*new QWindowsStylePrivate)
{
-#if defined(Q_OS_WIN32)
- use2000style = QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95;
-#endif
}
/*!
@@ -282,9 +277,6 @@ QWindowsStyle::QWindowsStyle() : QCommonStyle(*new QWindowsStylePrivate)
*/
QWindowsStyle::QWindowsStyle(QWindowsStylePrivate &dd) : QCommonStyle(dd)
{
-#if defined(Q_OS_WIN32)
- use2000style = QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95;
-#endif
}
@@ -1070,6 +1062,8 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl
}
}
break;
+ default:
+ break;
}
if (!desktopIcon.isNull()) {
return desktopIcon;
@@ -1138,12 +1132,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
#endif
break;
case SH_ItemView_ChangeHighlightOnFocus:
-#if defined(Q_WS_WIN)
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT)
- ret = 1;
- else
-#endif
- ret = 0;
+ ret = 1;
break;
case SH_ToolBox_SelectedPageTitleBold:
ret = 0;
@@ -1151,36 +1140,34 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
#if defined(Q_WS_WIN)
case SH_UnderlineShortcut:
+ {
ret = 1;
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95
- && QSysInfo::WindowsVersion != QSysInfo::WV_98
- && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- BOOL cues;
- SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0);
- ret = int(cues);
- // Do nothing if we always paint underlines
- Q_D(const QWindowsStyle);
- if (!ret && widget && d) {
+ BOOL cues = false;
+ SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0);
+ ret = int(cues);
+ // Do nothing if we always paint underlines
+ Q_D(const QWindowsStyle);
+ if (!ret && widget && d) {
#ifndef QT_NO_MENUBAR
- const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
- if (!menuBar && qobject_cast<const QMenu *>(widget)) {
- QWidget *w = QApplication::activeWindow();
- if (w && w != widget)
- menuBar = qFindChild<QMenuBar *>(w);
- }
- // If we paint a menu bar draw underlines if is in the keyboardState
- if (menuBar) {
- if (menuBar->d_func()->keyboardState || d->altDown())
- ret = 1;
- // Otherwise draw underlines if the toplevel widget has seen an alt-press
- } else
-#endif // QT_NO_MENUBAR
- if (d->hasSeenAlt(widget)) {
+ const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
+ if (!menuBar && qobject_cast<const QMenu *>(widget)) {
+ QWidget *w = QApplication::activeWindow();
+ if (w && w != widget)
+ menuBar = qFindChild<QMenuBar *>(w);
+ }
+ // If we paint a menu bar draw underlines if is in the keyboardState
+ if (menuBar) {
+ if (menuBar->d_func()->keyboardState || d->altDown())
ret = 1;
- }
+ // Otherwise draw underlines if the toplevel widget has seen an alt-press
+ } else
+#endif // QT_NO_MENUBAR
+ if (d->hasSeenAlt(widget)) {
+ ret = 1;
}
}
break;
+ }
#endif
#ifndef QT_NO_RUBBERBAND
case SH_RubberBand_Mask:
@@ -1318,7 +1305,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
if ((!(opt->state & State_Sunken ))
&& (!(opt->state & State_Enabled)
|| !(opt->state & State_MouseOver && opt->state & State_AutoRaise))
- && (opt->state & State_On) && use2000style) {
+ && (opt->state & State_On)) {
fill = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
stippled = true;
} else {
@@ -1391,11 +1378,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
QRect r = opt->rect;
int size = qMin(r.height(), r.width());
QPixmap pixmap;
- QString pixmapName;
- pixmapName.sprintf("%s-%s-%d-%d-%d-%lld",
- "$qt_ia", metaObject()->className(),
- uint(opt->state), pe,
- size, opt->palette.cacheKey());
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-") + QLatin1String(metaObject()->className()), opt, QSize(size, size))
+ + QLatin1Char('-') + QString::number(pe);
if (!QPixmapCache::find(pixmapName, pixmap)) {
int border = size/5;
int sqsize = 2*(size/2);
@@ -1632,9 +1616,9 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
popupPal.setColor(QPalette::Light, frame->palette.background().color());
popupPal.setColor(QPalette::Midlight, frame->palette.light().color());
}
- if (use2000style && pe == PE_Frame && (frame->state & State_Raised))
+ if (pe == PE_Frame && (frame->state & State_Raised))
qDrawWinButton(p, frame->rect, popupPal, frame->state & State_Sunken);
- else if (use2000style && pe == PE_Frame && (frame->state & State_Sunken))
+ else if (pe == PE_Frame && (frame->state & State_Sunken))
{
popupPal.setColor(QPalette::Midlight, frame->palette.background().color());
qDrawWinPanel(p, frame->rect, popupPal, frame->state & State_Sunken);
@@ -1785,11 +1769,12 @@ case PE_FrameDockWidget:
break;
#endif // QT_NO_PROGRESSBAR
- case PE_FrameTabWidget:
- if (use2000style) {
- qDrawWinButton(p, opt->rect, opt->palette, false, 0);
- break;
- }
+ case PE_FrameTabWidget: {
+ QRect rect = opt->rect;
+ QPalette pal = opt->palette;
+ qDrawWinButton(p, opt->rect, opt->palette, false, 0);
+ break;
+ }
default:
QCommonStyle::drawPrimitive(pe, opt, p, w);
}
@@ -2065,10 +2050,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->setPen(light);
p->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
p->drawPoint(x1 + 1, y1 + 1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x1 + 1, y1 + 2, x1 + 1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
- }
}
// Top
{
@@ -2076,10 +2057,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
int end = x2 - (nextSelected ? 0 : 2);
p->setPen(light);
p->drawLine(beg, y1, end, y1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(beg, y1 + 1, end, y1 + 1);
- }
}
// Right
if (lastTab || selected || onlyOne || !nextSelected) {
@@ -2109,10 +2086,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->setPen(light);
p->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
p->drawPoint(x1 + 1, y2 - 1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x1 + 1, y2 - 2, x1 + 1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
- }
}
// Bottom
{
@@ -2151,10 +2124,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->setPen(light);
p->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);
p->drawPoint(x1 + 1, y1 + 1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x1 + 2, y1 + 1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1 + 1);
- }
}
// Left
{
@@ -2162,10 +2131,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
int end = y2 - (nextSelected ? 0 : 2);
p->setPen(light);
p->drawLine(x1, beg, x1, end);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x1 + 1, beg, x1 + 1, end);
- }
}
// Bottom
if (lastTab || selected || onlyOne || !nextSelected) {
@@ -2197,11 +2162,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->setPen(light);
p->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);
p->drawPoint(x2 - 1, y1 + 1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x2 - 3, y1 + 1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1 + 1);
- p->drawPoint(x2 - 1, y1);
- }
}
// Right
{
@@ -2238,7 +2198,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
#ifndef QT_NO_SCROLLBAR
case CE_ScrollBarSubLine:
case CE_ScrollBarAddLine: {
- if (use2000style && (opt->state & State_Sunken)) {
+ if ((opt->state & State_Sunken)) {
p->setPen(opt->palette.dark().color());
p->setBrush(opt->palette.brush(QPalette::Button));
p->drawRect(opt->rect.adjusted(0, 0, -1, -1));
@@ -3024,8 +2984,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
if ((cmb->subControls & SC_ComboBoxFrame)) {
if (cmb->frame) {
QPalette shadePal = opt->palette;
- if (use2000style)
- shadePal.setColor(QPalette::Midlight, shadePal.button().color());
+ shadePal.setColor(QPalette::Midlight, shadePal.button().color());
qDrawWinPanel(p, opt->rect, shadePal, true, &editBrush);
}
else {
@@ -3101,8 +3060,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
QBrush editBrush = sb->palette.brush(QPalette::Base);
QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
QPalette shadePal = sb->palette;
- if (use2000style)
- shadePal.setColor(QPalette::Midlight, shadePal.button().color());
+ shadePal.setColor(QPalette::Midlight, shadePal.button().color());
qDrawWinPanel(p, r, shadePal, true, &editBrush);
}
@@ -3231,7 +3189,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
+ 2 * windowsItemFrame));
}
int maxpmw = mi->maxIconWidth;
- int tabSpacing = use2000style ? 20 :windowsTabSpacing;
+ int tabSpacing = 20;
if (mi->text.contains(QLatin1Char('\t')))
w += tabSpacing;
else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu)
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index 5f0f053..f3d0f04 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -196,17 +196,15 @@ void Animation::paint(QPainter *painter, const QStyleOption *option)
Q_UNUSED(painter);
}
-/*
-* ! \internal
-*
-* Helperfunction to paint the current transition state
-* between two animation frames.
-*
-* The result is a blended image consisting of
-* ((alpha)*_primaryImage) + ((1-alpha)*_secondaryImage)
-*
-*/
+/*! \internal
+ Helperfunction to paint the current transition state between two
+ animation frames.
+
+ The result is a blended image consisting of ((alpha)*_primaryImage)
+ + ((1-alpha)*_secondaryImage)
+
+*/
void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
if (_secondaryImage.isNull() || _primaryImage.isNull())
return;
@@ -248,14 +246,11 @@ void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
painter->drawImage(rect, _tempImage);
}
-/*
-* ! \internal
-*
-* Paints a transition state. The result will be a mix between the
-* initial and final state of the transition, depending on the
-* time difference between _startTime and current time.
+/*! \internal
+ Paints a transition state. The result will be a mix between the
+ initial and final state of the transition, depending on the time
+ difference between _startTime and current time.
*/
-
void Transition::paint(QPainter *painter, const QStyleOption *option)
{
float alpha = 1.0;
@@ -278,15 +273,11 @@ void Transition::paint(QPainter *painter, const QStyleOption *option)
drawBlendedImage(painter, option->rect, alpha);
}
-/*
-* ! \internal
-*
-* Paints a pulse. The result will be a mix between the
-* primary and secondary pulse images depending on the
-* time difference between _startTime and current time.
+/*! \internal
+ Paints a pulse. The result will be a mix between the primary and
+ secondary pulse images depending on the time difference between
+ _startTime and current time.
*/
-
-
void Pulse::paint(QPainter *painter, const QStyleOption *option)
{
float alpha = 1.0;
@@ -308,31 +299,37 @@ void Pulse::paint(QPainter *painter, const QStyleOption *option)
/*!
- \reimp
- *
- * Animations are used for some state transitions on specific widgets.
- *
- * Only one running animation can exist for a widget at any specific time.
- * Animations can be added through QWindowsVistaStylePrivate::startAnimation(Animation *)
- * and any existing animation on a widget can be retrieved with
- * QWindowsVistaStylePrivate::widgetAnimation(Widget *).
- *
- * Once an animation has been started, QWindowsVistaStylePrivate::timerEvent(QTimerEvent *)
- * will continuously call update() on the widget until it is stopped, meaning that drawPrimitive
- * will be called many times until the transition has completed. During this time, the result
- * will be retrieved by the Animation::paint(...) function and not by the style itself.
- *
- * To determine if a transition should occur, the style needs to know the previous state of the
- * widget as well as the current one. This is solved by updating dynamic properties on the widget
- * every time the function is called.
- *
- * Transitions interrupting existing transitions should always be smooth, so whenever a hover-transition
- * is started on a pulsating button, it uses the current frame of the pulse-animation as the
- * starting image for the hover transition.
- *
+ \internal
+
+ Animations are used for some state transitions on specific widgets.
+
+ Only one running animation can exist for a widget at any specific
+ time. Animations can be added through
+ QWindowsVistaStylePrivate::startAnimation(Animation *) and any
+ existing animation on a widget can be retrieved with
+ QWindowsVistaStylePrivate::widgetAnimation(Widget *).
+
+ Once an animation has been started,
+ QWindowsVistaStylePrivate::timerEvent(QTimerEvent *) will
+ continuously call update() on the widget until it is stopped,
+ meaning that drawPrimitive will be called many times until the
+ transition has completed. During this time, the result will be
+ retrieved by the Animation::paint(...) function and not by the style
+ itself.
+
+ To determine if a transition should occur, the style needs to know
+ the previous state of the widget as well as the current one. This is
+ solved by updating dynamic properties on the widget every time the
+ function is called.
+
+ Transitions interrupting existing transitions should always be
+ smooth, so whenever a hover-transition is started on a pulsating
+ button, it uses the current frame of the pulse-animation as the
+ starting image for the hover transition.
+
*/
void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const
+ QPainter *painter, const QWidget *widget) const
{
QWindowsVistaStylePrivate *d = const_cast<QWindowsVistaStylePrivate*>(d_func());
@@ -738,7 +735,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
if (listview->viewMode() == QListView::IconMode)
newStyle = true;
- } else if (const QTreeView* treeview = qobject_cast<const QTreeView *>(widget)) {
+ } else if (qobject_cast<const QTreeView *>(widget)) {
newStyle = true;
}
if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
@@ -877,11 +874,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
/*!
-
- \reimp
+ \internal
see drawPrimitive for comments on the animation support
-
*/
void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption *option,
QPainter *painter, const QWidget *widget) const
@@ -1098,7 +1093,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
XPThemeData theme(widget, painter, QLatin1String("PROGRESS"), vertical ? PP_FILLVERT : PP_FILL);
theme.rect = option->rect;
- bool reverse = bar->direction == Qt::LeftToRight && inverted || bar->direction == Qt::RightToLeft && !inverted;
+ bool reverse = bar->direction == (Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted);
QTime current = QTime::currentTime();
if (isIndeterminate) {
@@ -1276,7 +1271,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
int yoff = y-2 + h / 2;
QPoint p1 = QPoint(x + checkcol, yoff);
QPoint p2 = QPoint(x + w + 6 , yoff);
- int stateId = stateId = MBI_HOT;
+ stateId = MBI_HOT;
QRect subRect(p1.x(), p1.y(), p2.x() - p1.x(), 6);
subRect = QStyle::visualRect(option->direction, option->rect, subRect );
XPThemeData theme2(widget, painter, QLatin1String("MENU"), MENU_POPUPSEPARATOR, stateId, subRect);
@@ -1288,7 +1283,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
menuitem->rect.y(), checkcol - 6, menuitem->rect.height()));
if (act) {
- int stateId = stateId = MBI_HOT;
+ stateId = MBI_HOT;
XPThemeData theme2(widget, painter, QLatin1String("MENU"), MENU_POPUPITEM, stateId, option->rect);
d->drawBackground(theme2);
}
@@ -1408,7 +1403,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
break;
case CE_MenuBarEmptyArea:
{
- int stateId = MBI_NORMAL;
+ stateId = MBI_NORMAL;
if (!(state & State_Enabled))
stateId = MBI_DISABLED;
XPThemeData theme(widget, painter, QLatin1String("MENU"), MENU_BARBACKGROUND, stateId, option->rect);
@@ -1505,7 +1500,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
if (listview->viewMode() == QListView::IconMode)
newStyle = true;
- } else if (const QTreeView* treeview = qobject_cast<const QTreeView *>(widget)) {
+ } else if (qobject_cast<const QTreeView *>(widget)) {
newStyle = true;
}
if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
@@ -1541,7 +1536,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
}
/*!
- \reimp
+ \internal
see drawPrimitive for comments on the animation support
@@ -1927,7 +1922,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
}
/*!
- \reimp
+ \internal
*/
QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
const QSize &size, const QWidget *widget) const
@@ -2004,7 +1999,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
}
/*!
- \reimp
+ \internal
*/
QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
{
@@ -2019,7 +2014,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
MARGINS borderSize;
HTHEME theme = pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"Button");
if (theme) {
- int stateId;
+ int stateId = PBS_NORMAL;
if (!(option->state & State_Enabled))
stateId = PBS_DISABLED;
else if (option->state & State_Sunken)
@@ -2028,8 +2023,6 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
stateId = PBS_HOT;
else if (btn->features & QStyleOptionButton::DefaultButton)
stateId = PBS_DEFAULTED;
- else
- stateId = PBS_NORMAL;
int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
rect = option->rect.adjusted(border, border, -border, -border);
@@ -2102,7 +2095,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
rect = QCommonStyle::subElementRect(SE_ProgressBarGroove, option, widget);
break;
case SE_ItemViewItemDecoration:
- if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))
+ if (qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))
rect.adjust(-2, 0, 2, 0);
break;
case SE_ItemViewItemFocusRect:
@@ -2175,7 +2168,7 @@ static bool buttonVisible(const QStyle::SubControl sc, const QStyleOptionTitleBa
}
-/*! \reimp */
+/*! \internal */
int QWindowsVistaStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget,
QStyleHintReturn *returnData) const
{
@@ -2209,7 +2202,7 @@ int QWindowsVistaStyle::styleHint(StyleHint hint, const QStyleOption *option, co
/*!
- \reimp
+ \internal
*/
QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option,
SubControl subControl, const QWidget *widget) const
@@ -2308,6 +2301,8 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
rect = visualRect(option->direction, option->rect, rect);
}
break;
+ default:
+ break;
}
}
break;
@@ -2318,7 +2313,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
}
/*!
- \reimp
+ \internal
*/
bool QWindowsVistaStyle::event(QEvent *e)
{
@@ -2341,7 +2336,7 @@ bool QWindowsVistaStyle::event(QEvent *e)
}
/*!
- \reimp
+ \internal
*/
QStyle::SubControl QWindowsVistaStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option,
const QPoint &pos, const QWidget *widget) const
@@ -2353,7 +2348,7 @@ QStyle::SubControl QWindowsVistaStyle::hitTestComplexControl(ComplexControl cont
}
/*!
- \reimp
+ \internal
*/
int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
@@ -2378,7 +2373,7 @@ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *opti
}
/*!
- \reimp
+ \internal
*/
QPalette QWindowsVistaStyle::standardPalette() const
{
@@ -2386,7 +2381,7 @@ QPalette QWindowsVistaStyle::standardPalette() const
}
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::polish(QApplication *app)
{
@@ -2394,7 +2389,7 @@ void QWindowsVistaStyle::polish(QApplication *app)
}
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::polish(QWidget *widget)
{
@@ -2448,7 +2443,7 @@ void QWindowsVistaStyle::polish(QWidget *widget)
}
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::unpolish(QWidget *widget)
{
@@ -2490,7 +2485,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::unpolish(QApplication *app)
{
@@ -2498,7 +2493,7 @@ void QWindowsVistaStyle::unpolish(QApplication *app)
}
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::polish(QPalette &pal)
{
@@ -2507,7 +2502,7 @@ void QWindowsVistaStyle::polish(QPalette &pal)
}
/*!
- \reimp
+ \internal
*/
QPixmap QWindowsVistaStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option,
const QWidget *widget) const
@@ -2576,9 +2571,7 @@ void QWindowsVistaStylePrivate::startAnimation(Animation *t)
bool QWindowsVistaStylePrivate::transitionsEnabled() const
{
BOOL animEnabled = false;
- if (QT_WA_INLINE(SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0),
- SystemParametersInfoA(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0)
- ))
+ if (SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0))
{
if (animEnabled)
return true;
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index 322bfac..9560c4b 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -161,8 +161,7 @@ HTHEME XPThemeData::handle()
htheme = QWindowsXPStylePrivate::handleMap->operator[](name);
if (!htheme) {
- htheme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget),
- (TCHAR*)name.utf16());
+ htheme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), (wchar_t*)name.utf16());
if (htheme) {
if (!QWindowsXPStylePrivate::handleMap)
QWindowsXPStylePrivate::handleMap = new QMap<QString, HTHEME>;
@@ -1203,7 +1202,8 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option,
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
MARGINS borderSize;
if (widget) {
- HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button");
+ XPThemeData buttontheme(widget, 0, QLatin1String("Button"));
+ HTHEME theme = buttontheme.handle();
if (theme) {
int stateId;
if (!(option->state & State_Enabled))
@@ -1547,11 +1547,11 @@ case PE_Frame:
if (widget) {
bool useGradient = true;
const int maxlength = 256;
- WCHAR themeFileName[maxlength];
- WCHAR themeColor[maxlength];
+ wchar_t themeFileName[maxlength];
+ wchar_t themeColor[maxlength];
// Due to a a scaling issue with the XP Silver theme, tab gradients are not used with it
if (pGetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) {
- WCHAR* offset;
+ wchar_t *offset = 0;
if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) {
offset++;
if (!lstrcmp(offset, L"Luna.msstyles") && !lstrcmp(offset, L"Metallic")) {
@@ -1919,8 +1919,8 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
{
name = QLatin1String("BUTTON");
partId = BP_PUSHBUTTON;
- bool justFlat = (btn->features & QStyleOptionButton::Flat) && !(flags & (State_On|State_Sunken))
- || (btn->features & QStyleOptionButton::CommandLinkButton
+ bool justFlat = ((btn->features & QStyleOptionButton::Flat) && !(flags & (State_On|State_Sunken)))
+ || ((btn->features & QStyleOptionButton::CommandLinkButton)
&& !(flags & State_MouseOver)
&& !(btn->features & QStyleOptionButton::DefaultButton));
if (!(flags & State_Enabled) && !(btn->features & QStyleOptionButton::Flat))
@@ -3245,7 +3245,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
if (theme.isValid()) {
SIZE size;
pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
- res = (pm == PM_IndicatorWidth ? size.cx : res = size.cy);
+ res = (pm == PM_IndicatorWidth) ? size.cx : size.cy;
}
}
break;
@@ -3257,7 +3257,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
if (theme.isValid()) {
SIZE size;
pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
- res = (pm == PM_ExclusiveIndicatorWidth ? size.cx : res = size.cy);
+ res = (pm == PM_ExclusiveIndicatorWidth) ? size.cx : size.cy;
}
}
break;
@@ -3537,6 +3537,8 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
rect = QRect(frameWidth + hPad, controlTop + vPad, iconSize.width(), iconSize.height());
}
break;
+ default:
+ break;
}
}
break;
@@ -3563,6 +3565,9 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
case SC_ComboBoxListBoxPopup:
rect = cmb->rect;
break;
+
+ default:
+ break;
}
}
break;
@@ -3627,7 +3632,8 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
case CT_LineEdit:
case CT_ComboBox:
{
- HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button");
+ XPThemeData buttontheme(widget, 0, QLatin1String("Button"));
+ HTHEME theme = buttontheme.handle();
MARGINS borderSize;
if (theme) {
int result = pGetThemeMargins(theme,
@@ -3803,6 +3809,8 @@ QPixmap QWindowsXPStyle::standardPixmap(StandardPixmap standardPixmap, const QSt
}
}
break;
+ default:
+ break;
}
return QWindowsStyle::standardPixmap(standardPixmap, option, widget);
}
@@ -3924,6 +3932,8 @@ QIcon QWindowsXPStyle::standardIconImplementation(StandardPixmap standardIcon,
}
break;
+ default:
+ break;
}
return QWindowsStyle::standardIconImplementation(standardIcon, option, widget);
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index 8d7540c..04df2aa 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -79,6 +79,7 @@ QT_BEGIN_NAMESPACE
\class QTextObjectInterface
\brief The QTextObjectInterface class allows drawing of
custom text objects in \l{QTextDocument}s.
+ \since 4.5
A text object describes the structure of one or more elements in a
text document; for instance, images imported from HTML are
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index e6bdcc6..99374b5 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -200,6 +200,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
{ "link", Value_Link },
{ "link-visited", Value_LinkVisited },
{ "lower-alpha", Value_LowerAlpha },
+ { "lower-roman", Value_LowerRoman },
{ "lowercase", Value_Lowercase },
{ "medium", Value_Medium },
{ "mid", Value_Mid },
@@ -231,6 +232,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
{ "transparent", Value_Transparent },
{ "underline", Value_Underline },
{ "upper-alpha", Value_UpperAlpha },
+ { "upper-roman", Value_UpperRoman },
{ "uppercase", Value_Uppercase },
{ "wave", Value_Wave },
{ "window", Value_Window },
@@ -240,10 +242,10 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
};
//Map id to strings as they appears in the 'values' array above
-static const short indexOfId[NumKnownValues] = { 0, 40, 47, 41, 48, 53, 34, 26, 68, 69, 25, 42, 5, 62, 46,
- 29, 57, 58, 27, 50, 60, 6, 10, 38, 55, 19, 13, 17, 18, 20, 21, 49, 24, 45, 65, 36, 3, 2, 39, 61, 16,
- 11, 56, 14, 32, 63, 54, 64, 33, 67, 8, 28, 37, 12, 35, 59, 7, 9, 4, 66, 52, 22, 23, 30, 31, 1, 15, 0,
- 51, 44, 43 };
+static const short indexOfId[NumKnownValues] = { 0, 41, 48, 42, 49, 54, 35, 26, 70, 71, 25, 43, 5, 63, 47,
+ 29, 58, 59, 27, 51, 61, 6, 10, 39, 56, 19, 13, 17, 18, 20, 21, 50, 24, 46, 67, 37, 3, 2, 40, 62, 16,
+ 11, 57, 14, 32, 64, 33, 65, 55, 66, 34, 69, 8, 28, 38, 12, 36, 60, 7, 9, 4, 68, 53, 22, 23, 30, 31,
+ 1, 15, 0, 52, 45, 44 };
QString Value::toString() const
{
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index 8056f4d..b07acd5 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -223,6 +223,8 @@ enum KnownValue {
Value_Decimal,
Value_LowerAlpha,
Value_UpperAlpha,
+ Value_LowerRoman,
+ Value_UpperRoman,
Value_SmallCaps,
Value_Uppercase,
Value_Lowercase,
diff --git a/src/gui/text/qfont_win.cpp b/src/gui/text/qfont_win.cpp
index 2c27c9b..2293973 100644
--- a/src/gui/text/qfont_win.cpp
+++ b/src/gui/text/qfont_win.cpp
@@ -39,11 +39,6 @@
**
****************************************************************************/
-// the miscrosoft platform SDK says that the Unicode versions of
-// TextOut and GetTextExtentsPoint32 are supported on all platforms, so we use them
-// exclusively to simplify code, save a lot of conversions into the local encoding
-// and have generally better unicode support :)
-
#include "qfont.h"
#include "qfont_p.h"
#include "qfontengine_p.h"
@@ -67,8 +62,7 @@ extern HDC shared_dc(); // common dc for all fonts
// ### maybe move to qapplication_win
QFont qt_LOGFONTtoQFont(LOGFONT& lf, bool /*scale*/)
{
- QString family = QT_WA_INLINE(QString::fromUtf16((ushort*)lf.lfFaceName),
- QString::fromLocal8Bit((char*)lf.lfFaceName));
+ QString family = QString::fromWCharArray(lf.lfFaceName);
QFont qf(family);
qf.setItalic(lf.lfItalic);
if (lf.lfWeight != FW_DONTCARE) {
diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp
index 1ac87ea..ff6af98 100644
--- a/src/gui/text/qfontdatabase_qws.cpp
+++ b/src/gui/text/qfontdatabase_qws.cpp
@@ -54,6 +54,7 @@
#endif
#include "qfontengine_qpf_p.h"
#include "private/qfactoryloader_p.h"
+#include "private/qcore_unix_p.h" // overrides QT_OPEN
#include "qabstractfontengine_qws.h"
#include "qabstractfontengine_p.h"
#include <qdatetime.h>
@@ -90,7 +91,7 @@ void QFontDatabasePrivate::addQPF2File(const QByteArray &file)
struct stat st;
if (stat(file.constData(), &st))
return;
- int f = ::open(file, O_RDONLY, 0);
+ int f = QT_OPEN(file, O_RDONLY, 0);
if (f < 0)
return;
const uchar *data = (const uchar *)mmap(0, st.st_size, PROT_READ, MAP_SHARED, f, 0);
@@ -138,7 +139,7 @@ void QFontDatabasePrivate::addQPF2File(const QByteArray &file)
#endif
}
#ifndef QT_FONTS_ARE_RESOURCES
- ::close(f);
+ QT_CLOSE(f);
#endif
}
#endif // QT_NO_QWS_QPF2
diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp
index 2c0223b..974b955 100644
--- a/src/gui/text/qfontdatabase_win.cpp
+++ b/src/gui/text/qfontdatabase_win.cpp
@@ -195,21 +195,12 @@ static QString getEnglishName(const QString &familyName)
QString i18n_name;
HDC hdc = GetDC( 0 );
- HFONT hfont;
- QT_WA( {
- LOGFONTW lf;
- memset( &lf, 0, sizeof( LOGFONTW ) );
- memcpy( lf.lfFaceName, familyName.utf16(), qMin(LF_FACESIZE, familyName.length())*sizeof(QChar) );
- lf.lfCharSet = DEFAULT_CHARSET;
- hfont = CreateFontIndirectW( &lf );
- }, {
- LOGFONTA lf;
- memset( &lf, 0, sizeof( LOGFONTA ) );
- QByteArray lfam = familyName.toLocal8Bit();
- memcpy( lf.lfFaceName, lfam, qMin(LF_FACESIZE, lfam.size()) );
- lf.lfCharSet = DEFAULT_CHARSET;
- hfont = CreateFontIndirectA( &lf );
- } );
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(LOGFONT));
+ memcpy(lf.lfFaceName, familyName.utf16(), qMin(LF_FACESIZE, familyName.length()) * sizeof(wchar_t));
+ lf.lfCharSet = DEFAULT_CHARSET;
+ HFONT hfont = CreateFontIndirect(&lf);
+
if(!hfont) {
ReleaseDC(0, hdc);
return QString();
@@ -245,32 +236,6 @@ error:
return i18n_name;
}
-static void getFontSignature(const QString &familyName,
- NEWTEXTMETRICEX *textmetric,
- FONTSIGNATURE *signature)
-{
- QT_WA({
- Q_UNUSED(familyName);
- *signature = textmetric->ntmFontSig;
- }, {
- // the textmetric structure we get from EnumFontFamiliesEx on Win9x has
- // a FONTSIGNATURE, but that one is uninitialized and doesn't work. Have to go
- // the hard way and load the font to find out.
- HDC hdc = GetDC(0);
- LOGFONTA lf;
- memset(&lf, 0, sizeof(LOGFONTA));
- QByteArray lfam = familyName.toLocal8Bit();
- memcpy(lf.lfFaceName, lfam.data(), qMin(LF_FACESIZE, lfam.length()));
- lf.lfCharSet = DEFAULT_CHARSET;
- HFONT hfont = CreateFontIndirectA(&lf);
- HGDIOBJ oldobj = SelectObject(hdc, hfont);
- GetTextCharsetInfo(hdc, signature, 0);
- SelectObject(hdc, oldobj);
- DeleteObject(hfont);
- ReleaseDC(0, hdc);
- });
-}
-
static
void addFontToDatabase(QString familyName, const QString &scriptName,
TEXTMETRIC *textmetric,
@@ -288,26 +253,17 @@ void addFontToDatabase(QString familyName, const QString &scriptName,
bool scalable;
int size;
-// QString escript = QString::fromUtf16((ushort *)f->elfScript);
+// QString escript = QString::fromWCharArray(f->elfScript);
// qDebug("script=%s", escript.latin1());
- QT_WA({
- NEWTEXTMETRIC *tm = (NEWTEXTMETRIC *)textmetric;
- fixed = !(tm->tmPitchAndFamily & TMPF_FIXED_PITCH);
- ttf = (tm->tmPitchAndFamily & TMPF_TRUETYPE);
- scalable = tm->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE);
- size = scalable ? SMOOTH_SCALABLE : tm->tmHeight;
- italic = tm->tmItalic;
- weight = tm->tmWeight;
- } , {
- NEWTEXTMETRICA *tm = (NEWTEXTMETRICA *)textmetric;
- fixed = !(tm->tmPitchAndFamily & TMPF_FIXED_PITCH);
- ttf = (tm->tmPitchAndFamily & TMPF_TRUETYPE);
- scalable = tm->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE);
- size = scalable ? SMOOTH_SCALABLE : tm->tmHeight;
- italic = tm->tmItalic;
- weight = tm->tmWeight;
- });
+ NEWTEXTMETRIC *tm = (NEWTEXTMETRIC *)textmetric;
+ fixed = !(tm->tmPitchAndFamily & TMPF_FIXED_PITCH);
+ ttf = (tm->tmPitchAndFamily & TMPF_TRUETYPE);
+ scalable = tm->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE);
+ size = scalable ? SMOOTH_SCALABLE : tm->tmHeight;
+ italic = tm->tmItalic;
+ weight = tm->tmWeight;
+
// the "@family" fonts are just the same as "family". Ignore them.
if (familyName[0] != QLatin1Char('@') && !familyName.startsWith(QLatin1String("WST_"))) {
QtFontStyle::Key styleKey;
@@ -420,18 +376,10 @@ static
int CALLBACK
storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, int type, LPARAM /*p*/)
{
- QString familyName;
- QT_WA({
- familyName = QString::fromUtf16((ushort*)f->elfLogFont.lfFaceName);
- },{
- ENUMLOGFONTEXA *fa = (ENUMLOGFONTEXA *)f;
- familyName = QString::fromLocal8Bit(fa->elfLogFont.lfFaceName);
- });
- QString script = QT_WA_INLINE(QString::fromUtf16((const ushort *)f->elfScript),
- QString::fromLocal8Bit((const char *)((ENUMLOGFONTEXA *)f)->elfScript));
-
- FONTSIGNATURE signature;
- getFontSignature(familyName, textmetric, &signature);
+ QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName);
+ QString script = QString::fromWCharArray(f->elfScript);
+
+ FONTSIGNATURE signature = textmetric->ntmFontSig;
// NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is
// identical to a TEXTMETRIC except for the last four members, which we don't use
@@ -459,33 +407,17 @@ void populate_database(const QString& fam)
HDC dummy = GetDC(0);
- QT_WA({
- LOGFONT lf;
- lf.lfCharSet = DEFAULT_CHARSET;
- if (fam.isNull()) {
- lf.lfFaceName[0] = 0;
- } else {
- memcpy(lf.lfFaceName, fam.utf16(), sizeof(TCHAR)*qMin(fam.length()+1,32)); // 32 = Windows hard-coded
- }
- lf.lfPitchAndFamily = 0;
-
- EnumFontFamiliesEx(dummy, &lf,
- (FONTENUMPROC)storeFont, (LPARAM)privateDb(), 0);
- } , {
- LOGFONTA lf;
- lf.lfCharSet = DEFAULT_CHARSET;
- if (fam.isNull()) {
- lf.lfFaceName[0] = 0;
- } else {
- QByteArray lname = fam.toLocal8Bit();
- memcpy(lf.lfFaceName,lname.data(),
- qMin(lname.length()+1,32)); // 32 = Windows hard-coded
- }
- lf.lfPitchAndFamily = 0;
+ LOGFONT lf;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ if (fam.isNull()) {
+ lf.lfFaceName[0] = 0;
+ } else {
+ memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded
+ }
+ lf.lfPitchAndFamily = 0;
- EnumFontFamiliesExA(dummy, &lf,
- (FONTENUMPROCA)storeFont, (LPARAM)privateDb(), 0);
- });
+ EnumFontFamiliesEx(dummy, &lf,
+ (FONTENUMPROC)storeFont, (LPARAM)privateDb(), 0);
ReleaseDC(0, dummy);
@@ -496,21 +428,11 @@ void populate_database(const QString& fam)
for (int j = 0; j < fnt.families.count(); ++j) {
const QString familyName = fnt.families.at(j);
HDC hdc = GetDC(0);
- HFONT hfont;
- QT_WA({
- LOGFONTW lf;
- memset(&lf, 0, sizeof(LOGFONTW));
- memcpy(lf.lfFaceName, familyName.utf16(), qMin(LF_FACESIZE, familyName.size()));
- lf.lfCharSet = DEFAULT_CHARSET;
- hfont = CreateFontIndirectW(&lf);
- } , {
- LOGFONTA lf;
- memset(&lf, 0, sizeof(LOGFONTA));
- QByteArray lfam = familyName.toLocal8Bit();
- memcpy(lf.lfFaceName, lfam.data(), qMin(LF_FACESIZE, lfam.length()));
- lf.lfCharSet = DEFAULT_CHARSET;
- hfont = CreateFontIndirectA(&lf);
- });
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(LOGFONT));
+ memcpy(lf.lfFaceName, familyName.utf16(), sizeof(wchar_t) * qMin(LF_FACESIZE, familyName.size()));
+ lf.lfCharSet = DEFAULT_CHARSET;
+ HFONT hfont = CreateFontIndirect(&lf);
HGDIOBJ oldobj = SelectObject(hdc, hfont);
TEXTMETRIC textMetrics;
@@ -598,17 +520,10 @@ static void initFontInfo(QFontEngineWin *fe, const QFontDef &request, const QFon
HDC dc = ((request.styleStrategy & QFont::PreferDevice) && fp->hdc) ? fp->hdc : shared_dc();
SelectObject(dc, fe->hfont);
- QT_WA({
- TCHAR n[64];
- GetTextFaceW(dc, 64, n);
- fe->fontDef.family = QString::fromUtf16((ushort*)n);
- fe->fontDef.fixedPitch = !(fe->tm.w.tmPitchAndFamily & TMPF_FIXED_PITCH);
- } , {
- char an[64];
- GetTextFaceA(dc, 64, an);
- fe->fontDef.family = QString::fromLocal8Bit(an);
- fe->fontDef.fixedPitch = !(fe->tm.a.tmPitchAndFamily & TMPF_FIXED_PITCH);
- });
+ wchar_t n[64];
+ GetTextFace(dc, 64, n);
+ fe->fontDef.family = QString::fromWCharArray(n);
+ fe->fontDef.fixedPitch = !(fe->tm.tmPitchAndFamily & TMPF_FIXED_PITCH);
if (fe->fontDef.pointSize < 0) {
fe->fontDef.pointSize = fe->fontDef.pixelSize * 72. / fp->dpi;
} else if (fe->fontDef.pixelSize == -1) {
@@ -704,12 +619,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ
HFONT hfont = 0;
if (fp->rawMode) { // will choose a stock font
- int f, deffnt;
- // ### why different?
- if ((QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) || QSysInfo::WindowsVersion == QSysInfo::WV_32s)
- deffnt = SYSTEM_FONT;
- else
- deffnt = DEFAULT_GUI_FONT;
+ int f, deffnt = SYSTEM_FONT;
QString fam = desc->family->name.toLower();
if (fam == QLatin1String("default"))
f = deffnt;
@@ -778,11 +688,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ
} else if (request.styleStrategy & QFont::PreferDevice) {
strat = OUT_DEVICE_PRECIS;
} else if (request.styleStrategy & QFont::PreferOutline) {
- QT_WA({
- strat = OUT_OUTLINE_PRECIS;
- } , {
- strat = OUT_TT_PRECIS;
- });
+ strat = OUT_OUTLINE_PRECIS;
} else if (request.styleStrategy & QFont::ForceOutline) {
strat = OUT_TT_ONLY_PRECIS;
#endif
@@ -801,7 +707,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ
if (request.styleStrategy & QFont::PreferAntialias) {
if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP) {
- qual = 5; // == CLEARTYPE_QUALITY;
+ qual = CLEARTYPE_QUALITY;
preferClearTypeAA = true;
} else {
qual = ANTIALIASED_QUALITY;
@@ -827,16 +733,8 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ
if (fam == QLatin1String("Courier") && !(request.styleStrategy & QFont::PreferBitmap))
fam = QLatin1String("Courier New");
- QT_WA({
- memcpy(lf.lfFaceName, fam.utf16(), sizeof(TCHAR)*qMin(fam.length()+1,32)); // 32 = Windows hard-coded
- hfont = CreateFontIndirect(&lf);
- } , {
- // LOGFONTA and LOGFONTW are binary compatible
- QByteArray lname = fam.toLocal8Bit();
- memcpy(lf.lfFaceName,lname.data(),
- qMin(lname.length()+1,32)); // 32 = Windows hard-coded
- hfont = CreateFontIndirectA((LOGFONTA*)&lf);
- });
+ memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded
+ hfont = CreateFontIndirect(&lf);
if (!hfont)
qErrnoWarning("QFontEngine::loadEngine: CreateFontIndirect failed");
@@ -845,17 +743,12 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ
int avWidth = 0;
BOOL res;
HGDIOBJ oldObj = SelectObject(hdc, hfont);
- QT_WA({
- TEXTMETRICW tm;
- res = GetTextMetricsW(hdc, &tm);
- avWidth = tm.tmAveCharWidth;
- ttf = tm.tmPitchAndFamily & TMPF_TRUETYPE;
- } , {
- TEXTMETRICA tm;
- res = GetTextMetricsA(hdc, &tm);
- avWidth = tm.tmAveCharWidth;
- ttf = tm.tmPitchAndFamily & TMPF_TRUETYPE;
- });
+
+ TEXTMETRIC tm;
+ res = GetTextMetrics(hdc, &tm);
+ avWidth = tm.tmAveCharWidth;
+ ttf = tm.tmPitchAndFamily & TMPF_TRUETYPE;
+
SelectObject(hdc, oldObj);
if (hfont && (!ttf || request.stretch != 100)) {
@@ -863,11 +756,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ
if (!res)
qErrnoWarning("QFontEngine::loadEngine: GetTextMetrics failed");
lf.lfWidth = avWidth * request.stretch/100;
- QT_WA({
- hfont = CreateFontIndirect(&lf);
- } , {
- hfont = CreateFontIndirectA((LOGFONTA*)&lf);
- });
+ hfont = CreateFontIndirect(&lf);
if (!hfont)
qErrnoWarning("QFontEngine::loadEngine: CreateFontIndirect with stretch failed");
}
@@ -969,12 +858,6 @@ static QFontEngine *loadWin(const QFontPrivate *d, int script, const QFontDef &r
// list of families to try
QStringList family_list = familyList(req);
- if(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based && req.family.toLower() == QLatin1String("ms sans serif")) {
- // small hack for Dos based machines to get the right font for non
- // latin text when using the default font.
- family_list << QLatin1String("Arial");
- }
-
const char *stylehint = styleHint(d->request);
if (stylehint)
family_list << QLatin1String(stylehint);
@@ -1143,6 +1026,8 @@ static void getFamiliesAndSignatures(const QByteArray &fontData, QFontDatabasePr
signature.fsCsb[0] = qFromBigEndian<quint32>(table + 78);
signature.fsCsb[1] = qFromBigEndian<quint32>(table + 82);
+ } else {
+ memset(&signature, 0, sizeof(signature));
}
appFont->signatures << signature;
}
@@ -1165,21 +1050,21 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
HANDLE handle = 0;
{
-#ifdef QT_NO_TEMPORARYFILE
- TCHAR lpBuffer[MAX_PATH];
+#ifdef QT_NO_TEMPORARYFILE
+ wchar_t lpBuffer[MAX_PATH];
GetTempPath(MAX_PATH, lpBuffer);
- QString s = QString::fromUtf16((const ushort *) lpBuffer);
+ QString s = QString::fromWCharArray(lpBuffer);
QFile tempfile(s + QLatin1String("/font") + QString::number(GetTickCount()) + QLatin1String(".ttf"));
if (!tempfile.open(QIODevice::ReadWrite))
#else
QTemporaryFile tempfile(QLatin1String("XXXXXXXX.ttf"));
if (!tempfile.open())
-#endif
+#endif // QT_NO_TEMPORARYFILE
return;
if (tempfile.write(fnt->data) == -1)
return;
-#ifndef QT_NO_TEMPORARYFILE
+#ifndef QT_NO_TEMPORARYFILE
tempfile.setAutoRemove(false);
#endif
fnt->fileName = QFileInfo(tempfile.fileName()).absoluteFilePath();
@@ -1191,13 +1076,11 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
}
#else
DWORD dummy = 0;
- HANDLE handle = ptrAddFontMemResourceEx((void *)fnt->data.constData(),
- fnt->data.size(),
- 0,
- &dummy);
+ HANDLE handle = ptrAddFontMemResourceEx((void *)fnt->data.constData(), fnt->data.size(), 0,
+ &dummy);
if (handle == 0)
return;
-#endif
+#endif // Q_OS_WINCE
fnt->handle = handle;
fnt->data = QByteArray();
@@ -1219,12 +1102,10 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
// supported from 2000 on, so no need to deal with the *A variant
PtrAddFontResourceExW ptrAddFontResourceExW = (PtrAddFontResourceExW)QLibrary::resolve(QLatin1String("gdi32"),
"AddFontResourceExW");
- if (!ptrAddFontResourceExW)
+ if (!ptrAddFontResourceExW
+ || ptrAddFontResourceExW((wchar_t*)fnt->fileName.utf16(), FR_PRIVATE, 0) == 0)
return;
-
- if (ptrAddFontResourceExW((LPCWSTR)fnt->fileName.utf16(), FR_PRIVATE, 0) == 0)
- return;
-#endif
+#endif // Q_OS_WINCE
fnt->memoryFont = false;
}
@@ -1250,12 +1131,10 @@ bool QFontDatabase::removeApplicationFont(int handle)
#else
PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx = (PtrRemoveFontMemResourceEx)QLibrary::resolve(QLatin1String("gdi32"),
"RemoveFontMemResourceEx");
- if (!ptrRemoveFontMemResourceEx)
- return false;
-
- if (!ptrRemoveFontMemResourceEx(font.handle))
+ if (!ptrRemoveFontMemResourceEx
+ || !ptrRemoveFontMemResourceEx(font.handle))
return false;
-#endif
+#endif // Q_OS_WINCE
} else {
#ifdef Q_OS_WINCE
if (!RemoveFontResource((LPCWSTR)font.fileName.utf16()))
@@ -1263,12 +1142,10 @@ bool QFontDatabase::removeApplicationFont(int handle)
#else
PtrRemoveFontResourceExW ptrRemoveFontResourceExW = (PtrRemoveFontResourceExW)QLibrary::resolve(QLatin1String("gdi32"),
"RemoveFontResourceExW");
- if (!ptrRemoveFontResourceExW)
- return false;
-
- if (!ptrRemoveFontResourceExW((LPCWSTR)font.fileName.utf16(), FR_PRIVATE, 0))
+ if (!ptrRemoveFontResourceExW
+ || !ptrRemoveFontResourceExW((LPCWSTR)font.fileName.utf16(), FR_PRIVATE, 0))
return false;
-#endif
+#endif // Q_OS_WINCE
}
db->invalidate();
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 9aaa1ac..232f839 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -51,6 +51,7 @@
#if !defined(QT_NO_FREETYPE)
#include "private/qfontengine_ft_p.h"
#endif
+#include "private/qcore_unix_p.h" // overrides QT_OPEN
// for mmap
#include <stdlib.h>
@@ -252,7 +253,7 @@ QList<QByteArray> QFontEngineQPF::cleanUpAfterClientCrash(const QList<int> &cras
for (int i = 0; i < int(dir.count()); ++i) {
const QByteArray fileName = QFile::encodeName(dir.absoluteFilePath(dir[i]));
- int fd = ::open(fileName.constData(), O_RDONLY, 0);
+ int fd = QT_OPEN(fileName.constData(), O_RDONLY, 0);
if (fd >= 0) {
void *header = ::mmap(0, sizeof(QFontEngineQPF::Header), PROT_READ, MAP_SHARED, fd, 0);
if (header && header != MAP_FAILED) {
@@ -265,7 +266,7 @@ QList<QByteArray> QFontEngineQPF::cleanUpAfterClientCrash(const QList<int> &cras
::munmap(header, sizeof(QFontEngineQPF::Header));
}
- ::close(fd);
+ QT_CLOSE(fd);
}
}
if (!removedFonts.isEmpty())
@@ -330,16 +331,16 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng
#if defined(DEBUG_FONTENGINE)
qDebug() << "found existing qpf:" << fileName;
#endif
- if (::access(encodedFileName, W_OK | R_OK) == 0)
- fd = ::open(encodedFileName, O_RDWR, 0);
- else if (::access(encodedFileName, R_OK) == 0)
- fd = ::open(encodedFileName, O_RDONLY, 0);
+ if (::access(encodedName, W_OK | R_OK) == 0)
+ fd = QT_OPEN(encodedName, O_RDWR, 0);
+ else if (::access(encodedName, R_OK) == 0)
+ fd = QT_OPEN(encodedName, O_RDONLY, 0);
} else {
#if defined(DEBUG_FONTENGINE)
qDebug() << "creating qpf on the fly:" << fileName;
#endif
if (::access(QFile::encodeName(qws_fontCacheDir()), W_OK) == 0) {
- fd = ::open(encodedFileName, O_RDWR | O_EXCL | O_CREAT, 0644);
+ fd = QT_OPEN(encodedName, O_RDWR | O_EXCL | O_CREAT, 0644);
QBuffer buffer;
buffer.open(QIODevice::ReadWrite);
diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp
index 6fb4f15..70ce8f9 100644
--- a/src/gui/text/qfontengine_qws.cpp
+++ b/src/gui/text/qfontengine_qws.cpp
@@ -47,6 +47,7 @@
#include <private/qpaintengine_raster_p.h>
#include <private/qpdf_p.h>
#include "qtextengine_p.h"
+#include "private/qcore_unix_p.h" // overrides QT_OPEN
#include <qdebug.h>
@@ -387,7 +388,7 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn)
{
cache_cost = 1;
- int f = ::open( QFile::encodeName(fn), O_RDONLY, 0);
+ int f = QT_OPEN( QFile::encodeName(fn), O_RDONLY, 0);
Q_ASSERT(f>=0);
QT_STATBUF st;
if ( QT_FSTAT( f, &st ) )
@@ -406,7 +407,7 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn)
#endif
if ( !data || data == (uchar*)MAP_FAILED )
qFatal("Failed to mmap %s",QFile::encodeName(fn).data());
- ::close(f);
+ QT_CLOSE(f);
d = new QFontEngineQPF1Data;
memcpy(reinterpret_cast<char*>(&d->fm),data,sizeof(d->fm));
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index 9715aef..c6717e3 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -48,7 +48,6 @@
#include <qlibrary.h>
#include <qpaintdevice.h>
#include <qpainter.h>
-#include <qlibrary.h>
#include <limits.h>
#include <qendian.h>
@@ -85,8 +84,6 @@
((quint32)(ch1)) \
)
-typedef BOOL (WINAPI *PtrGetCharWidthI)(HDC, UINT, UINT, LPWORD, LPINT);
-
// common DC for all fonts
QT_BEGIN_NAMESPACE
@@ -128,8 +125,7 @@ HDC shared_dc()
}
#endif
-static HFONT stock_sysfont = 0;
-
+typedef BOOL (WINAPI *PtrGetCharWidthI)(HDC, UINT, UINT, LPWORD, LPINT);
static PtrGetCharWidthI ptrGetCharWidthI = 0;
static bool resolvedGetCharWidthI = false;
@@ -141,27 +137,6 @@ static void resolveGetCharWidthI()
ptrGetCharWidthI = (PtrGetCharWidthI)QLibrary::resolve(QLatin1String("gdi32"), "GetCharWidthI");
}
-// Copy a LOGFONTW struct into a LOGFONTA by converting the face name to an 8 bit value.
-// This is needed when calling CreateFontIndirect on non-unicode windowses.
-inline static void wa_copy_logfont(LOGFONTW *lfw, LOGFONTA *lfa)
-{
- lfa->lfHeight = lfw->lfHeight;
- lfa->lfWidth = lfw->lfWidth;
- lfa->lfEscapement = lfw->lfEscapement;
- lfa->lfOrientation = lfw->lfOrientation;
- lfa->lfWeight = lfw->lfWeight;
- lfa->lfItalic = lfw->lfItalic;
- lfa->lfUnderline = lfw->lfUnderline;
- lfa->lfCharSet = lfw->lfCharSet;
- lfa->lfOutPrecision = lfw->lfOutPrecision;
- lfa->lfClipPrecision = lfw->lfClipPrecision;
- lfa->lfQuality = lfw->lfQuality;
- lfa->lfPitchAndFamily = lfw->lfPitchAndFamily;
-
- QString fam = QString::fromUtf16((const ushort*)lfw->lfFaceName);
- memcpy(lfa->lfFaceName, fam.toLocal8Bit().constData(), fam.length() + 1);
-}
-
// defined in qtextengine_win.cpp
typedef void *SCRIPT_CACHE;
typedef HRESULT (WINAPI *fScriptFreeCache)(SCRIPT_CACHE *);
@@ -187,14 +162,6 @@ static inline quint16 getUShort(unsigned char *p)
return val;
}
-static inline HFONT systemFont()
-{
- if (stock_sysfont == 0)
- stock_sysfont = (HFONT)GetStockObject(SYSTEM_FONT);
- return stock_sysfont;
-}
-
-
// general font engine
QFixed QFontEngineWin::lineThickness() const
@@ -205,33 +172,18 @@ QFixed QFontEngineWin::lineThickness() const
return QFontEngine::lineThickness();
}
-#if defined(Q_WS_WINCE)
-static OUTLINETEXTMETRICW *getOutlineTextMetric(HDC hdc)
-{
- int size;
- size = GetOutlineTextMetricsW(hdc, 0, 0);
- OUTLINETEXTMETRICW *otm = (OUTLINETEXTMETRICW *)malloc(size);
- GetOutlineTextMetricsW(hdc, size, otm);
- return otm;
-}
-#else
-static OUTLINETEXTMETRICA *getOutlineTextMetric(HDC hdc)
+static OUTLINETEXTMETRIC *getOutlineTextMetric(HDC hdc)
{
int size;
- size = GetOutlineTextMetricsA(hdc, 0, 0);
- OUTLINETEXTMETRICA *otm = (OUTLINETEXTMETRICA *)malloc(size);
- GetOutlineTextMetricsA(hdc, size, otm);
+ size = GetOutlineTextMetrics(hdc, 0, 0);
+ OUTLINETEXTMETRIC *otm = (OUTLINETEXTMETRIC *)malloc(size);
+ GetOutlineTextMetrics(hdc, size, otm);
return otm;
}
-#endif
void QFontEngineWin::getCMap()
{
- QT_WA({
- ttf = (bool)(tm.w.tmPitchAndFamily & TMPF_TRUETYPE);
- } , {
- ttf = (bool)(tm.a.tmPitchAndFamily & TMPF_TRUETYPE);
- });
+ ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE);
HDC hdc = shared_dc();
SelectObject(hdc, hfont);
bool symb = false;
@@ -249,11 +201,7 @@ void QFontEngineWin::getCMap()
designToDevice = 1;
_faceId.index = 0;
if(cmap) {
-#if defined(Q_WS_WINCE)
- OUTLINETEXTMETRICW *otm = getOutlineTextMetric(hdc);
-#else
- OUTLINETEXTMETRICA *otm = getOutlineTextMetric(hdc);
-#endif
+ OUTLINETEXTMETRIC *otm = getOutlineTextMetric(hdc);
designToDevice = QFixed((int)otm->otmEMSquare)/int(otm->otmTextMetrics.tmHeight);
unitsPerEm = otm->otmEMSquare;
x_height = (int)otm->otmsXHeight;
@@ -263,7 +211,7 @@ void QFontEngineWin::getCMap()
fsType = otm->otmfsType;
free(otm);
} else {
- unitsPerEm = tm.w.tmHeight;
+ unitsPerEm = tm.tmHeight;
}
}
@@ -303,19 +251,14 @@ int QFontEngineWin::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout
}
} else {
#endif
- ushort first, last;
- QT_WA({
- first = tm.w.tmFirstChar;
- last = tm.w.tmLastChar;
- }, {
- first = tm.a.tmFirstChar;
- last = tm.a.tmLastChar;
- });
+ wchar_t first = tm.tmFirstChar;
+ wchar_t last = tm.tmLastChar;
+
for (; i < numChars; ++i, ++glyph_pos) {
uint ucs = QChar::mirroredChar(getChar(str, i, numChars));
if (
#ifdef Q_WS_WINCE
- tm.w.tmFirstChar > 60000 || // see line 375
+ tm.tmFirstChar > 60000 || // see line 375
#endif
ucs >= first && ucs <= last)
glyphs->glyphs[glyph_pos] = ucs;
@@ -341,19 +284,14 @@ int QFontEngineWin::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout
}
} else {
#endif
- ushort first, last;
- QT_WA({
- first = tm.w.tmFirstChar;
- last = tm.w.tmLastChar;
- }, {
- first = tm.a.tmFirstChar;
- last = tm.a.tmLastChar;
- });
+ wchar_t first = tm.tmFirstChar;
+ wchar_t last = tm.tmLastChar;
+
for (; i < numChars; ++i, ++glyph_pos) {
uint uc = getChar(str, i, numChars);
if (
#ifdef Q_WS_WINCE
- tm.w.tmFirstChar > 60000 || // see comment in QFontEngineWin
+ tm.tmFirstChar > 60000 || // see comment in QFontEngineWin
#endif
uc >= first && uc <= last)
glyphs->glyphs[glyph_pos] = uc;
@@ -387,28 +325,14 @@ QFontEngineWin::QFontEngineWin(const QString &name, HFONT _hfont, bool stockFont
lineWidth = -1;
x_height = -1;
- BOOL res;
- QT_WA({
- res = GetTextMetricsW(hdc, &tm.w);
- } , {
- res = GetTextMetricsA(hdc, &tm.a);
- });
- fontDef.fixedPitch = !(tm.w.tmPitchAndFamily & TMPF_FIXED_PITCH);
+ BOOL res = GetTextMetrics(hdc, &tm);
+ fontDef.fixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH);
if (!res)
qErrnoWarning("QFontEngineWin: GetTextMetrics failed");
- cache_cost = tm.w.tmHeight * tm.w.tmAveCharWidth * 2000;
+ cache_cost = tm.tmHeight * tm.tmAveCharWidth * 2000;
getCMap();
- useTextOutA = false;
-#ifndef Q_OS_WINCE
- // TextOutW doesn't work for symbol fonts on Windows 95!
- // since we're using glyph indices we don't care for ttfs about this!
- if (QSysInfo::WindowsVersion == QSysInfo::WV_95 && !ttf &&
- (_name == QLatin1String("Marlett") || _name == QLatin1String("Symbol") ||
- _name == QLatin1String("Webdings") || _name == QLatin1String("Wingdings")))
- useTextOutA = true;
-#endif
widthCache = 0;
widthCacheSize = 0;
designAdvances = 0;
@@ -427,7 +351,7 @@ QFontEngineWin::~QFontEngineWin()
free(widthCache);
// make sure we aren't by accident still selected
- SelectObject(shared_dc(), systemFont());
+ SelectObject(shared_dc(), (HFONT)GetStockObject(SYSTEM_FONT));
if (!stockFont) {
if (!DeleteObject(hfont))
@@ -435,39 +359,12 @@ QFontEngineWin::~QFontEngineWin()
}
}
-HGDIOBJ QFontEngineWin::selectDesignFont(QFixed *overhang) const
+HGDIOBJ QFontEngineWin::selectDesignFont() const
{
LOGFONT f = logfont;
f.lfHeight = unitsPerEm;
- HFONT designFont;
- QT_WA({
- designFont = CreateFontIndirectW(&f);
- }, {
- LOGFONTA fa;
- wa_copy_logfont(&f, &fa);
- designFont = CreateFontIndirectA(&fa);
- });
- HGDIOBJ oldFont = SelectObject(shared_dc(), designFont);
-
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
- BOOL res;
- QT_WA({
- TEXTMETRICW tm;
- res = GetTextMetricsW(shared_dc(), &tm);
- if (!res)
- qErrnoWarning("QFontEngineWin: GetTextMetrics failed");
- *overhang = QFixed((int)tm.tmOverhang) / designToDevice;
- } , {
- TEXTMETRICA tm;
- res = GetTextMetricsA(shared_dc(), &tm);
- if (!res)
- qErrnoWarning("QFontEngineWin: GetTextMetrics failed");
- *overhang = QFixed((int)tm.tmOverhang) / designToDevice;
- });
- } else {
- *overhang = 0;
- }
- return oldFont;
+ HFONT designFont = CreateFontIndirect(&f);
+ return SelectObject(shared_dc(), designFont);
}
bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
@@ -486,8 +383,6 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph
HDC hdc = shared_dc();
if (flags & QTextEngine::DesignMetrics) {
HGDIOBJ oldFont = 0;
- QFixed overhang = 0;
-
int glyph_pos = 0;
for(register int i = 0; i < len; i++) {
bool surrogate = (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 && i < len-1
@@ -502,9 +397,9 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph
}
if(designAdvances[glyph] < -999999) {
if(!oldFont)
- oldFont = selectDesignFont(&overhang);
+ oldFont = selectDesignFont();
SIZE size = {0, 0};
- GetTextExtentPoint32W(hdc, (wchar_t *)(str+i), surrogate ? 2 : 1, &size);
+ GetTextExtentPoint32(hdc, (wchar_t *)(str+i), surrogate ? 2 : 1, &size);
designAdvances[glyph] = QFixed((int)size.cx)/designToDevice;
}
glyphs->advances_x[glyph_pos] = designAdvances[glyph];
@@ -538,7 +433,7 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph
SIZE size = {0, 0};
if (!oldFont)
oldFont = SelectObject(hdc, hfont);
- GetTextExtentPoint32W(hdc, (wchar_t *)str + i, surrogate ? 2 : 1, &size);
+ GetTextExtentPoint32(hdc, (wchar_t *)str + i, surrogate ? 2 : 1, &size);
glyphs->advances_x[glyph_pos] = size.cx;
// if glyph's within cache range, store it for later
if (size.cx > 0 && size.cx < 0x100)
@@ -564,8 +459,6 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
HGDIOBJ oldFont = 0;
HDC hdc = shared_dc();
if (ttf && (flags & QTextEngine::DesignMetrics)) {
- QFixed overhang = 0;
-
for(int i = 0; i < glyphs->numGlyphs; i++) {
unsigned int glyph = glyphs->glyphs[i];
if(int(glyph) >= designAdvancesSize) {
@@ -575,35 +468,14 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
designAdvances[i] = -1000000;
designAdvancesSize = newSize;
}
- if(designAdvances[glyph] < -999999) {
- if(!oldFont)
- oldFont = selectDesignFont(&overhang);
+ if (designAdvances[glyph] < -999999) {
+ if (!oldFont)
+ oldFont = selectDesignFont();
- if (ptrGetCharWidthI) {
- int width = 0;
+ int width = 0;
+ if (ptrGetCharWidthI)
ptrGetCharWidthI(hdc, glyph, 1, 0, &width);
-
- designAdvances[glyph] = QFixed(width) / designToDevice;
- } else {
-#ifndef Q_WS_WINCE
- GLYPHMETRICS gm;
- DWORD res = GDI_ERROR;
- MAT2 mat;
- mat.eM11.value = mat.eM22.value = 1;
- mat.eM11.fract = mat.eM22.fract = 0;
- mat.eM21.value = mat.eM12.value = 0;
- mat.eM21.fract = mat.eM12.fract = 0;
- QT_WA({
- res = GetGlyphOutlineW(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX|GGO_NATIVE, &gm, 0, 0, &mat);
- } , {
- res = GetGlyphOutlineA(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX|GGO_NATIVE, &gm, 0, 0, &mat);
- });
-
- if (res != GDI_ERROR) {
- designAdvances[glyph] = QFixed(gm.gmCellIncX) / designToDevice;
- }
-#endif
- }
+ designAdvances[glyph] = QFixed(width) / designToDevice;
}
glyphs->advances_x[i] = designAdvances[glyph];
glyphs->advances_y[i] = 0;
@@ -611,8 +483,6 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
if(oldFont)
DeleteObject(SelectObject(hdc, oldFont));
} else {
- int overhang = (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) ? tm.a.tmOverhang : 0;
-
for(int i = 0; i < glyphs->numGlyphs; i++) {
unsigned int glyph = glyphs->glyphs[i];
@@ -640,31 +510,10 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
++chrLen;
}
SIZE size = {0, 0};
- GetTextExtentPoint32W(hdc, (wchar_t *)ch, chrLen, &size);
+ GetTextExtentPoint32(hdc, (wchar_t *)ch, chrLen, &size);
width = size.cx;
} else if (ptrGetCharWidthI) {
ptrGetCharWidthI(hdc, glyph, 1, 0, &width);
-
- width -= overhang;
- } else {
-#ifndef Q_WS_WINCE
- GLYPHMETRICS gm;
- DWORD res = GDI_ERROR;
- MAT2 mat;
- mat.eM11.value = mat.eM22.value = 1;
- mat.eM11.fract = mat.eM22.fract = 0;
- mat.eM21.value = mat.eM12.value = 0;
- mat.eM21.fract = mat.eM12.fract = 0;
- QT_WA({
- res = GetGlyphOutlineW(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat);
- } , {
- res = GetGlyphOutlineA(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat);
- });
-
- if (res != GDI_ERROR) {
- width = gm.gmCellIncX;
- }
-#endif
}
glyphs->advances_x[i] = width;
// if glyph's within cache range, store it for later
@@ -687,17 +536,10 @@ glyph_metrics_t QFontEngineWin::boundingBox(const QGlyphLayout &glyphs)
for (int i = 0; i < glyphs.numGlyphs; ++i)
w += glyphs.effectiveAdvance(i);
- return glyph_metrics_t(0, -tm.w.tmAscent, w, tm.w.tmHeight, w, 0);
+ return glyph_metrics_t(0, -tm.tmAscent, w, tm.tmHeight, w, 0);
}
-
-
-#ifndef Q_WS_WINCE
-typedef HRESULT (WINAPI *pGetCharABCWidthsFloat)(HDC, UINT, UINT, LPABCFLOAT);
-static pGetCharABCWidthsFloat qt_GetCharABCWidthsFloat = 0;
-#endif
-
glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t)
{
#ifndef Q_WS_WINCE
@@ -705,30 +547,13 @@ glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t)
HDC hdc = shared_dc();
SelectObject(hdc, hfont);
- if(!ttf) {
- SIZE s = {0, 0};
- WCHAR ch = glyph;
- int width;
- int overhang = 0;
- static bool resolved = false;
- if (!resolved) {
- QLibrary lib(QLatin1String("gdi32"));
- qt_GetCharABCWidthsFloat = (pGetCharABCWidthsFloat) lib.resolve("GetCharABCWidthsFloatW");
- resolved = true;
- }
- if (QT_WA_INLINE(true, false) && qt_GetCharABCWidthsFloat) {
- ABCFLOAT abc;
- qt_GetCharABCWidthsFloat(hdc, ch, ch, &abc);
- width = qRound(abc.abcfB);
- } else {
- GetTextExtentPoint32W(hdc, &ch, 1, &s);
- overhang = (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) ? tm.a.tmOverhang : 0;
- width = s.cx;
- }
+ if (!ttf) {
+ wchar_t ch = glyph;
+ ABCFLOAT abc;
+ GetCharABCWidthsFloat(hdc, ch, ch, &abc);
+ int width = qRound(abc.abcfB);
- return glyph_metrics_t(0, -tm.a.tmAscent,
- width, tm.a.tmHeight,
- width-overhang, 0).transformed(t);
+ return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, width, 0).transformed(t);
} else {
DWORD res = 0;
MAT2 mat;
@@ -753,11 +578,8 @@ glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t)
SetWorldTransform(hdc, &xform);
}
- QT_WA({
- res = GetGlyphOutlineW(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat);
- } , {
- res = GetGlyphOutlineA(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat);
- });
+ res = GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, 0, &mat);
+
if (t.type() > QTransform::TxTranslate) {
XFORM xform;
xform.eM11 = xform.eM22 = 1;
@@ -793,28 +615,28 @@ glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t)
else
#endif
{ // fallback
- width = tm.w.tmMaxCharWidth;
+ width = tm.tmMaxCharWidth;
advance = width;
}
SelectObject(hdc, oldFont);
- return glyph_metrics_t(0, -tm.w.tmAscent, width, tm.w.tmHeight, advance, 0).transformed(t);
+ return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, advance, 0).transformed(t);
#endif
}
QFixed QFontEngineWin::ascent() const
{
- return tm.w.tmAscent;
+ return tm.tmAscent;
}
QFixed QFontEngineWin::descent() const
{
- return tm.w.tmDescent;
+ return tm.tmDescent;
}
QFixed QFontEngineWin::leading() const
{
- return tm.w.tmExternalLeading;
+ return tm.tmExternalLeading;
}
@@ -827,12 +649,12 @@ QFixed QFontEngineWin::xHeight() const
QFixed QFontEngineWin::averageCharWidth() const
{
- return tm.w.tmAveCharWidth;
+ return tm.tmAveCharWidth;
}
qreal QFontEngineWin::maxCharWidth() const
{
- return tm.w.tmMaxCharWidth;
+ return tm.tmMaxCharWidth;
}
enum { max_font_count = 256 };
@@ -879,10 +701,10 @@ qreal QFontEngineWin::minRightBearing() const
SelectObject(hdc, hfont);
if (ttf) {
ABC *abc = 0;
- int n = QT_WA_INLINE(tm.w.tmLastChar - tm.w.tmFirstChar, tm.a.tmLastChar - tm.a.tmFirstChar);
+ int n = tm.tmLastChar - tm.tmFirstChar;
if (n <= max_font_count) {
abc = new ABC[n+1];
- GetCharABCWidths(hdc, tm.w.tmFirstChar, tm.w.tmLastChar, abc);
+ GetCharABCWidths(hdc, tm.tmFirstChar, tm.tmLastChar, abc);
} else {
abc = new ABC[char_table_entries+1];
for(int i = 0; i < char_table_entries; i++)
@@ -898,9 +720,6 @@ qreal QFontEngineWin::minRightBearing() const
}
}
delete [] abc;
- } else {
- ml = 0;
- mr = -tm.a.tmOverhang;
}
lbearing = ml;
rbearing = mr;
@@ -915,28 +734,14 @@ qreal QFontEngineWin::minRightBearing() const
SelectObject(hdc, hfont);
if (ttf) {
ABC *abc = 0;
- int n = QT_WA_INLINE(tm.w.tmLastChar - tm.w.tmFirstChar, tm.a.tmLastChar - tm.a.tmFirstChar);
+ int n = tm.tmLastChar - tm.tmFirstChar;
if (n <= max_font_count) {
abc = new ABC[n+1];
- QT_WA({
- GetCharABCWidths(hdc, tm.w.tmFirstChar, tm.w.tmLastChar, abc);
- }, {
- GetCharABCWidthsA(hdc,tm.a.tmFirstChar,tm.a.tmLastChar,abc);
- });
+ GetCharABCWidths(hdc, tm.tmFirstChar, tm.tmLastChar, abc);
} else {
abc = new ABC[char_table_entries+1];
- QT_WA({
- for(int i = 0; i < char_table_entries; i++)
- GetCharABCWidths(hdc, char_table[i], char_table[i], abc+i);
- }, {
- for(int i = 0; i < char_table_entries; i++) {
- QByteArray w = QString(QChar(char_table[i])).toLocal8Bit();
- if (w.length() == 1) {
- uint ch8 = (uchar)w[0];
- GetCharABCWidthsA(hdc, ch8, ch8, abc+i);
- }
- }
- });
+ for(int i = 0; i < char_table_entries; i++)
+ GetCharABCWidths(hdc, char_table[i], char_table[i], abc + i);
n = char_table_entries;
}
ml = abc[0].abcA;
@@ -949,33 +754,28 @@ qreal QFontEngineWin::minRightBearing() const
}
delete [] abc;
} else {
- QT_WA({
- ABCFLOAT *abc = 0;
- int n = tm.w.tmLastChar - tm.w.tmFirstChar+1;
- if (n <= max_font_count) {
- abc = new ABCFLOAT[n];
- GetCharABCWidthsFloat(hdc, tm.w.tmFirstChar, tm.w.tmLastChar, abc);
- } else {
- abc = new ABCFLOAT[char_table_entries];
- for(int i = 0; i < char_table_entries; i++)
- GetCharABCWidthsFloat(hdc, char_table[i], char_table[i], abc+i);
- n = char_table_entries;
- }
- float fml = abc[0].abcfA;
- float fmr = abc[0].abcfC;
- for (int i=1; i<n; i++) {
- if (abc[i].abcfA + abc[i].abcfB + abc[i].abcfC != 0) {
- fml = qMin(fml,abc[i].abcfA);
- fmr = qMin(fmr,abc[i].abcfC);
- }
+ ABCFLOAT *abc = 0;
+ int n = tm.tmLastChar - tm.tmFirstChar+1;
+ if (n <= max_font_count) {
+ abc = new ABCFLOAT[n];
+ GetCharABCWidthsFloat(hdc, tm.tmFirstChar, tm.tmLastChar, abc);
+ } else {
+ abc = new ABCFLOAT[char_table_entries];
+ for(int i = 0; i < char_table_entries; i++)
+ GetCharABCWidthsFloat(hdc, char_table[i], char_table[i], abc+i);
+ n = char_table_entries;
+ }
+ float fml = abc[0].abcfA;
+ float fmr = abc[0].abcfC;
+ for (int i=1; i<n; i++) {
+ if (abc[i].abcfA + abc[i].abcfB + abc[i].abcfC != 0) {
+ fml = qMin(fml,abc[i].abcfA);
+ fmr = qMin(fmr,abc[i].abcfC);
}
- ml = int(fml-0.9999);
- mr = int(fmr-0.9999);
- delete [] abc;
- } , {
- ml = 0;
- mr = -tm.a.tmOverhang;
- });
+ }
+ ml = int(fml - 0.9999);
+ mr = int(fmr - 0.9999);
+ delete [] abc;
}
lbearing = ml;
rbearing = mr;
@@ -1012,17 +812,10 @@ bool QFontEngineWin::canRender(const QChar *string, int len)
return false;
}
} else {
- QT_WA({
- while(len--) {
- if (tm.w.tmFirstChar > string->unicode() || tm.w.tmLastChar < string->unicode())
- return false;
- }
- }, {
- while(len--) {
- if (tm.a.tmFirstChar > string->unicode() || tm.a.tmLastChar < string->unicode())
- return false;
- }
- });
+ while(len--) {
+ if (tm.tmFirstChar > string->unicode() || tm.tmLastChar < string->unicode())
+ return false;
+ }
}
return true;
}
@@ -1065,11 +858,7 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc,
memset(&gMetric, 0, sizeof(GLYPHMETRICS));
int bufferSize = GDI_ERROR;
#if !defined(Q_WS_WINCE)
- QT_WA( {
- bufferSize = GetGlyphOutlineW(hdc, glyph, glyphFormat, &gMetric, 0, 0, &mat);
- }, {
- bufferSize = GetGlyphOutlineA(hdc, glyph, glyphFormat, &gMetric, 0, 0, &mat);
- });
+ bufferSize = GetGlyphOutline(hdc, glyph, glyphFormat, &gMetric, 0, 0, &mat);
#endif
if ((DWORD)bufferSize == GDI_ERROR) {
return false;
@@ -1078,13 +867,7 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc,
void *dataBuffer = new char[bufferSize];
DWORD ret = GDI_ERROR;
#if !defined(Q_WS_WINCE)
- QT_WA( {
- ret = GetGlyphOutlineW(hdc, glyph, glyphFormat, &gMetric, bufferSize,
- dataBuffer, &mat);
- }, {
- ret = GetGlyphOutlineA(hdc, glyph, glyphFormat, &gMetric, bufferSize,
- dataBuffer, &mat);
- } );
+ ret = GetGlyphOutline(hdc, glyph, glyphFormat, &gMetric, bufferSize, dataBuffer, &mat);
#endif
if (ret == GDI_ERROR) {
delete [](char *)dataBuffer;
@@ -1171,14 +954,7 @@ void QFontEngineWin::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, in
// font at the correct pixel size.
lf.lfHeight = -unitsPerEm;
lf.lfWidth = 0;
- HFONT hf;
- QT_WA({
- hf = CreateFontIndirectW(&lf);
- }, {
- LOGFONTA lfa;
- wa_copy_logfont(&lf, &lfa);
- hf = CreateFontIndirectA(&lfa);
- });
+ HFONT hf = CreateFontIndirect(&lf);
HDC hdc = shared_dc();
HGDIOBJ oldfont = SelectObject(hdc, hf);
@@ -1200,7 +976,7 @@ void QFontEngineWin::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyp
QPainterPath *path, QTextItem::RenderFlags flags)
{
#if !defined(Q_WS_WINCE)
- if(tm.w.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) {
+ if(tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) {
hasOutline = true;
QFontEngine::addOutlineToPath(x, y, glyphs, path, flags);
if (hasOutline) {
@@ -1234,11 +1010,11 @@ int QFontEngineWin::synthesized() const
uchar data[4];
GetFontData(hdc, HEAD, 44, &data, 4);
USHORT macStyle = getUShort(data);
- if (tm.w.tmItalic && !(macStyle & 2))
+ if (tm.tmItalic && !(macStyle & 2))
synthesized_flags = SynthesizedItalic;
if (fontDef.stretch != 100 && ttf)
synthesized_flags |= SynthesizedStretch;
- if (tm.w.tmWeight >= 500 && !(macStyle & 1))
+ if (tm.tmWeight >= 500 && !(macStyle & 1))
synthesized_flags |= SynthesizedBold;
//qDebug() << "font is" << _name <<
// "it=" << (macStyle & 2) << fontDef.style << "flags=" << synthesized_flags;
@@ -1254,24 +1030,12 @@ QFixed QFontEngineWin::emSquareSize() const
QFontEngine::Properties QFontEngineWin::properties() const
{
-
LOGFONT lf = logfont;
lf.lfHeight = unitsPerEm;
- HFONT hf;
- QT_WA({
- hf = CreateFontIndirectW(&lf);
- }, {
- LOGFONTA lfa;
- wa_copy_logfont(&lf, &lfa);
- hf = CreateFontIndirectA(&lfa);
- });
+ HFONT hf = CreateFontIndirect(&lf);
HDC hdc = shared_dc();
HGDIOBJ oldfont = SelectObject(hdc, hf);
-#if defined(Q_WS_WINCE)
- OUTLINETEXTMETRICW *otm = getOutlineTextMetric(hdc);
-#else
- OUTLINETEXTMETRICA *otm = getOutlineTextMetric(hdc);
-#endif
+ OUTLINETEXTMETRIC *otm = getOutlineTextMetric(hdc);
Properties p;
p.emSquare = unitsPerEm;
p.italicAngle = otm->otmItalicAngle;
@@ -1301,14 +1065,7 @@ void QFontEngineWin::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_m
if(flags & SynthesizedItalic)
lf.lfItalic = false;
lf.lfWidth = 0;
- HFONT hf;
- QT_WA({
- hf = CreateFontIndirectW(&lf);
- }, {
- LOGFONTA lfa;
- wa_copy_logfont(&lf, &lfa);
- hf = CreateFontIndirectA(&lfa);
- });
+ HFONT hf = CreateFontIndirect(&lf);
HDC hdc = shared_dc();
HGDIOBJ oldfont = SelectObject(hdc, hf);
QFixedPoint p;
@@ -1377,14 +1134,7 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin
memset(&mat, 0, sizeof(mat));
mat.eM11.value = mat.eM22.value = 1;
- int error = 0;
- QT_WA( {
- error = GetGlyphOutlineW(hdc, glyph, ggo_options, &tgm, 0, 0, &mat);
- }, {
- error = GetGlyphOutlineA(hdc, glyph, ggo_options, &tgm, 0, 0, &mat);
- } );
-
- if (error == GDI_ERROR) {
+ if (GetGlyphOutline(hdc, glyph, ggo_options, &tgm, 0, 0, &mat) == GDI_ERROR) {
qWarning("QWinFontEngine: unable to query transformed glyph metrics...");
return 0;
}
@@ -1430,11 +1180,11 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin
if (has_transformation) {
SetGraphicsMode(hdc, GM_ADVANCED);
SetWorldTransform(hdc, &xform);
- ExtTextOutW(hdc, 0, 0, options, 0, (LPCWSTR) &glyph, 1, 0);
+ ExtTextOut(hdc, 0, 0, options, 0, (LPCWSTR) &glyph, 1, 0);
} else
#endif
{
- ExtTextOutW(hdc, -gx + margin, -gy + margin, options, 0, (LPCWSTR) &glyph, 1, 0);
+ ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, (LPCWSTR) &glyph, 1, 0);
}
SelectObject(hdc, old_font);
@@ -1450,7 +1200,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
if (qt_cleartype_enabled) {
LOGFONT lf = logfont;
lf.lfQuality = ANTIALIASED_QUALITY;
- font = CreateFontIndirectW(&lf);
+ font = CreateFontIndirect(&lf);
}
QImage::Format mask_format = QNativeImage::systemFormat();
#ifndef Q_OS_WINCE
@@ -1557,17 +1307,9 @@ void QFontEngineMultiWin::loadEngine(int at)
QString fam = fallbacks.at(at-1);
LOGFONT lf = static_cast<QFontEngineWin *>(engines.at(0))->logfont;
- HFONT hfont;
- QT_WA({
- memcpy(lf.lfFaceName, fam.utf16(), sizeof(TCHAR)*qMin(fam.length()+1,32)); // 32 = Windows hard-coded
- hfont = CreateFontIndirectW(&lf);
- } , {
- // LOGFONTA and LOGFONTW are binary compatible
- QByteArray lname = fam.toLocal8Bit();
- memcpy(lf.lfFaceName,lname.data(),
- qMin(lname.length()+1,32)); // 32 = Windows hard-coded
- hfont = CreateFontIndirectA((LOGFONTA*)&lf);
- });
+ memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded
+ HFONT hfont = CreateFontIndirect(&lf);
+
bool stockFont = false;
if (hfont == 0) {
hfont = (HFONT)GetStockObject(ANSI_VAR_FONT);
diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h
index a8da78a..b86bd00 100644
--- a/src/gui/text/qfontengine_win_p.h
+++ b/src/gui/text/qfontengine_win_p.h
@@ -80,7 +80,7 @@ public:
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
QPainterPath *path, QTextItem::RenderFlags flags);
- HGDIOBJ selectDesignFont(QFixed *) const;
+ HGDIOBJ selectDesignFont() const;
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
virtual glyph_metrics_t boundingBox(glyph_t g) { return boundingBox(g, QTransform()); }
@@ -109,18 +109,14 @@ public:
int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const;
void getCMap();
- QString _name;
- HFONT hfont;
+ QString _name;
+ HFONT hfont;
LOGFONT logfont;
- uint stockFont : 1;
- uint useTextOutA : 1;
- uint ttf : 1;
+ uint stockFont : 1;
+ uint ttf : 1;
uint hasOutline : 1;
- union {
- TEXTMETRICW w;
- TEXTMETRICA a;
- } tm;
- int lw;
+ TEXTMETRIC tm;
+ int lw;
const unsigned char *cmap;
QByteArray cmapTable;
mutable qreal lbearing;
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index db1a38e..56c7ca1 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -65,6 +65,18 @@ public:
void _q_reformatBlocks(int from, int charsRemoved, int charsAdded);
void reformatBlock(QTextBlock block);
+
+ inline void rehighlight(QTextCursor &cursor, QTextCursor::MoveOperation operation) {
+ QObject::disconnect(doc, SIGNAL(contentsChange(int,int,int)),
+ q_func(), SLOT(_q_reformatBlocks(int,int,int)));
+ cursor.beginEditBlock();
+ int from = cursor.position();
+ cursor.movePosition(operation);
+ _q_reformatBlocks(from, 0, cursor.position() - from);
+ cursor.endEditBlock();
+ QObject::connect(doc, SIGNAL(contentsChange(int,int,int)),
+ q_func(), SLOT(_q_reformatBlocks(int,int,int)));
+ }
inline void _q_delayedRehighlight() {
if (!rehighlightPending)
@@ -355,7 +367,9 @@ QTextDocument *QSyntaxHighlighter::document() const
/*!
\since 4.2
- Redoes the highlighting of the whole document.
+ Reapplies the highlighting to the whole document.
+
+ \sa rehighlightBlock()
*/
void QSyntaxHighlighter::rehighlight()
{
@@ -363,15 +377,25 @@ void QSyntaxHighlighter::rehighlight()
if (!d->doc)
return;
- disconnect(d->doc, SIGNAL(contentsChange(int,int,int)),
- this, SLOT(_q_reformatBlocks(int,int,int)));
QTextCursor cursor(d->doc);
- cursor.beginEditBlock();
- cursor.movePosition(QTextCursor::End);
- d->_q_reformatBlocks(0, 0, cursor.position());
- cursor.endEditBlock();
- connect(d->doc, SIGNAL(contentsChange(int,int,int)),
- this, SLOT(_q_reformatBlocks(int,int,int)));
+ d->rehighlight(cursor, QTextCursor::End);
+}
+
+/*!
+ \since 4.6
+
+ Reapplies the highlighting to the given QTextBlock \a block.
+
+ \sa rehighlight()
+*/
+void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block)
+{
+ Q_D(QSyntaxHighlighter);
+ if (!d->doc)
+ return;
+
+ QTextCursor cursor(block);
+ d->rehighlight(cursor, QTextCursor::EndOfBlock);
}
/*!
diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h
index 4e5271b..ee249b8 100644
--- a/src/gui/text/qsyntaxhighlighter.h
+++ b/src/gui/text/qsyntaxhighlighter.h
@@ -78,6 +78,7 @@ public:
public Q_SLOTS:
void rehighlight();
+ void rehighlightBlock(const QTextBlock &block);
protected:
virtual void highlightBlock(const QString &text) = 0;
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 88f8028..78fd13b 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1245,7 +1245,8 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e)
process:
{
QString text = e->text();
- if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) {
+ if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t')) &&
+ ((e->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) {
if (overwriteMode
// no need to call deleteChar() if we have a selection, insertText
// does it already
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 0e3cb56..19d4cc4 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1856,6 +1856,8 @@ bool QTextCursor::atStart() const
}
/*!
+ \since 4.6
+
Returns true if the cursor is at the end of the document;
otherwise returns false.
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 3287f31..3531699 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2416,7 +2416,10 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
static bool isOrderedList(int style)
{
return style == QTextListFormat::ListDecimal || style == QTextListFormat::ListLowerAlpha
- || style == QTextListFormat::ListUpperAlpha;
+ || style == QTextListFormat::ListUpperAlpha
+ || style == QTextListFormat::ListUpperRoman
+ || style == QTextListFormat::ListLowerRoman
+ ;
}
void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
@@ -2513,6 +2516,8 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
case QTextListFormat::ListSquare: html += QLatin1String("<ul type=\"square\""); break;
case QTextListFormat::ListLowerAlpha: html += QLatin1String("<ol type=\"a\""); break;
case QTextListFormat::ListUpperAlpha: html += QLatin1String("<ol type=\"A\""); break;
+ case QTextListFormat::ListLowerRoman: html += QLatin1String("<ol type=\"i\""); break;
+ case QTextListFormat::ListUpperRoman: html += QLatin1String("<ol type=\"I\""); break;
default: html += QLatin1String("<ul"); // ### should not happen
}
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 125d74c..f1d9091 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -1383,6 +1383,8 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
case QTextListFormat::ListDecimal:
case QTextListFormat::ListLowerAlpha:
case QTextListFormat::ListUpperAlpha:
+ case QTextListFormat::ListLowerRoman:
+ case QTextListFormat::ListUpperRoman:
itemText = static_cast<QTextList *>(object)->itemText(bl);
size.setWidth(fontMetrics.width(itemText));
size.setHeight(fontMetrics.height());
@@ -1426,7 +1428,9 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
switch (style) {
case QTextListFormat::ListDecimal:
case QTextListFormat::ListLowerAlpha:
- case QTextListFormat::ListUpperAlpha: {
+ case QTextListFormat::ListUpperAlpha:
+ case QTextListFormat::ListLowerRoman:
+ case QTextListFormat::ListUpperRoman: {
QTextLayout layout(itemText, font, q->paintDevice());
layout.setCacheEnabled(true);
QTextOption option(Qt::AlignLeft | Qt::AlignAbsolute);
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 9bc62b1..4e43418 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -2078,6 +2078,8 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
\value ListDecimal decimal values in ascending order
\value ListLowerAlpha lower case Latin characters in alphabetical order
\value ListUpperAlpha upper case Latin characters in alphabetical order
+ \value ListLowerRoman lower case roman numerals (supports up to 4999 items only)
+ \value ListUpperRoman upper case roman numerals (supports up to 4999 items only)
\omitvalue ListStyleUndefined
*/
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index d269687..9697105 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -604,6 +604,8 @@ public:
ListDecimal = -4,
ListLowerAlpha = -5,
ListUpperAlpha = -6,
+ ListLowerRoman = -7,
+ ListUpperRoman = -8,
ListStyleUndefined = 0
};
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 1bff162..a88cd17 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1206,6 +1206,8 @@ void QTextHtmlParserNode::setListStyle(const QVector<QCss::Value> &cssValues)
case QCss::Value_Decimal: hasOwnListStyle = true; listStyle = QTextListFormat::ListDecimal; break;
case QCss::Value_LowerAlpha: hasOwnListStyle = true; listStyle = QTextListFormat::ListLowerAlpha; break;
case QCss::Value_UpperAlpha: hasOwnListStyle = true; listStyle = QTextListFormat::ListUpperAlpha; break;
+ case QCss::Value_LowerRoman: hasOwnListStyle = true; listStyle = QTextListFormat::ListLowerRoman; break;
+ case QCss::Value_UpperRoman: hasOwnListStyle = true; listStyle = QTextListFormat::ListUpperRoman; break;
default: break;
}
}
@@ -1540,6 +1542,10 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
node->listStyle = QTextListFormat::ListLowerAlpha;
} else if (value == QLatin1String("A")) {
node->listStyle = QTextListFormat::ListUpperAlpha;
+ } else if (value == QLatin1String("i")) {
+ node->listStyle = QTextListFormat::ListLowerRoman;
+ } else if (value == QLatin1String("I")) {
+ node->listStyle = QTextListFormat::ListUpperRoman;
} else {
value = value.toLower();
if (value == QLatin1String("square"))
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index addd7a5..02b1c63 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -212,6 +212,55 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
}
}
break;
+ case QTextListFormat::ListLowerRoman:
+ case QTextListFormat::ListUpperRoman:
+ {
+ if (item < 5000) {
+ QByteArray romanNumeral;
+
+ // works for up to 4999 items
+ static const char romanSymbolsLower[] = "iiivixxxlxcccdcmmmm";
+ static const char romanSymbolsUpper[] = "IIIVIXXXLXCCCDCMMMM";
+ QByteArray romanSymbols; // wrap to have "mid"
+ if (style == QTextListFormat::ListLowerRoman)
+ romanSymbols = QByteArray::fromRawData(romanSymbolsLower, sizeof(romanSymbolsLower));
+ else
+ romanSymbols = QByteArray::fromRawData(romanSymbolsUpper, sizeof(romanSymbolsUpper));
+
+ int c[] = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 };
+ int n = item;
+ for (int i = 12; i >= 0; n %= c[i], i--) {
+ int q = n / c[i];
+ if (q > 0) {
+ int startDigit = i + (i+3)/4;
+ int numDigits;
+ if (i % 4) {
+ // c[i] == 4|5|9|40|50|90|400|500|900
+ if ((i-2) % 4) {
+ // c[i] == 4|9|40|90|400|900 => with substraction (IV, IX, XL, XC, ...)
+ numDigits = 2;
+ }
+ else {
+ // c[i] == 5|50|500 (V, L, D)
+ numDigits = 1;
+ }
+ }
+ else {
+ // c[i] == 1|10|100|1000 (I, II, III, X, XX, ...)
+ numDigits = q;
+ }
+
+ romanNumeral.append(romanSymbols.mid(startDigit, numDigits));
+ }
+ }
+ result = QString::fromLatin1(romanNumeral);
+ }
+ else {
+ result = QLatin1String("?");
+ }
+
+ }
+ break;
default:
Q_ASSERT(false);
}
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index b0c16ee..883cf80 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -174,6 +174,10 @@ static QString bulletChar(QTextListFormat::Style style)
return QString::fromLatin1("a");
case QTextListFormat::ListUpperAlpha:
return QString::fromLatin1("A");
+ case QTextListFormat::ListLowerRoman:
+ return QString::fromLatin1("i");
+ case QTextListFormat::ListUpperRoman:
+ return QString::fromLatin1("I");
default:
case QTextListFormat::ListStyleUndefined:
return QString();
@@ -619,7 +623,9 @@ void QTextOdfWriter::writeListFormat(QXmlStreamWriter &writer, QTextListFormat f
QTextListFormat::Style style = format.style();
if (style == QTextListFormat::ListDecimal || style == QTextListFormat::ListLowerAlpha
- || style == QTextListFormat::ListUpperAlpha) {
+ || style == QTextListFormat::ListUpperAlpha
+ || style == QTextListFormat::ListLowerRoman
+ || style == QTextListFormat::ListUpperRoman) {
writer.writeStartElement(textNS, QString::fromLatin1("list-level-style-number"));
writer.writeAttribute(styleNS, QString::fromLatin1("num-format"), bulletChar(style));
writer.writeAttribute(styleNS, QString::fromLatin1("num-suffix"), QString::fromLatin1("."));
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 75ce713..e4e54cf 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -56,13 +56,23 @@
#if defined(Q_OS_WIN)
#undef S_IFREG
#define S_IFREG 0100000
-# define S_ISDIR(x) ((x) & 0040000) > 0
-# define S_ISREG(x) ((x) & 0170000) == S_IFREG
+# ifndef S_ISDIR
+# define S_ISDIR(x) ((x) & 0040000) > 0
+# endif
+# ifndef S_ISREG
+# define S_ISREG(x) ((x) & 0170000) == S_IFREG
+# endif
# define S_IFLNK 020000
# define S_ISLNK(x) ((x) & S_IFLNK) > 0
-# define S_IRUSR 0400
-# define S_IWUSR 0200
-# define S_IXUSR 0100
+# ifndef S_IRUSR
+# define S_IRUSR 0400
+# endif
+# ifndef S_IWUSR
+# define S_IWUSR 0200
+# endif
+# ifndef S_IXUSR
+# define S_IXUSR 0100
+# endif
# define S_IRGRP 0040
# define S_IWGRP 0020
# define S_IXGRP 0010
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index 8fe32bd..0ce3b3c 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -134,7 +134,7 @@
To provide completions, QCompleter needs to know the path from an index.
This is provided by pathFromIndex(). The default implementation of
- pathFromIndex(), returns the data for the \l{Qt::EditRole}{edit role}
+ pathFromIndex(), returns the data for the \l{Qt::EditRole}{edit role}
for list models and the absolute file path if the mode is a QDirModel.
\sa QAbstractItemModel, QLineEdit, QComboBox, {Completer Example}
@@ -772,7 +772,7 @@ QMatchData QUnsortedModelEngine::filter(const QString& part, const QModelIndex&
///////////////////////////////////////////////////////////////////////////////
QCompleterPrivate::QCompleterPrivate()
: widget(0), proxy(0), popup(0), cs(Qt::CaseSensitive), role(Qt::EditRole), column(0),
- sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true)
+ sorting(QCompleter::UnsortedModel), wrap(true), maxVisibleItems(7), eatFocusOut(true)
{
}
@@ -861,7 +861,7 @@ void QCompleterPrivate::showPopup(const QRect& rect)
Qt::LayoutDirection dir = widget->layoutDirection();
QPoint pos;
int rw, rh, w;
- int h = (popup->sizeHintForRow(0) * qMin(7, popup->model()->rowCount()) + 3) + 3;
+ int h = (popup->sizeHintForRow(0) * qMin(maxVisibleItems, popup->model()->rowCount()) + 3) + 3;
QScrollBar *hsb = popup->horizontalScrollBar();
if (hsb && hsb->isVisible())
h += popup->horizontalScrollBar()->sizeHint().height();
@@ -1182,7 +1182,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
case Qt::Key_Up:
if (!curIndex.isValid()) {
int rowCount = d->proxy->rowCount();
- QModelIndex lastIndex = d->proxy->index(rowCount - 1, 0);
+ QModelIndex lastIndex = d->proxy->index(rowCount - 1, d->column);
d->setCurrentIndex(lastIndex);
return true;
} else if (curIndex.row() == 0) {
@@ -1194,7 +1194,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
case Qt::Key_Down:
if (!curIndex.isValid()) {
- QModelIndex firstIndex = d->proxy->index(0, 0);
+ QModelIndex firstIndex = d->proxy->index(0, d->column);
d->setCurrentIndex(firstIndex);
return true;
} else if (curIndex.row() == d->proxy->rowCount() - 1) {
@@ -1510,6 +1510,30 @@ bool QCompleter::wrapAround() const
}
/*!
+ \property QCompleter::maxVisibleItems
+ \brief the maximum allowed size on screen of the completer, measured in items
+ \since 4.6
+
+ By default, this property has a value of 7.
+*/
+int QCompleter::maxVisibleItems() const
+{
+ Q_D(const QCompleter);
+ return d->maxVisibleItems;
+}
+
+void QCompleter::setMaxVisibleItems(int maxItems)
+{
+ Q_D(QCompleter);
+ if (maxItems < 0) {
+ qWarning("QCompleter::setMaxVisibleItems: "
+ "Invalid max visible items (%d) must be >= 0", maxItems);
+ return;
+ }
+ d->maxVisibleItems = maxItems;
+}
+
+/*!
\property QCompleter::caseSensitivity
\brief the case sensitivity of the matching
@@ -1582,6 +1606,10 @@ QString QCompleter::currentCompletion() const
that contains all the possible matches for the current completion prefix.
The completion model is auto-updated to reflect the current completions.
+ \note The return value of this function is defined to be an QAbstractItemModel
+ purely for generality. This actual kind of model returned is an instance of an
+ QAbstractProxyModel subclass.
+
\sa completionPrefix, model()
*/
QAbstractItemModel *QCompleter::completionModel() const
diff --git a/src/gui/util/qcompleter.h b/src/gui/util/qcompleter.h
index c1169ef..a419154 100644
--- a/src/gui/util/qcompleter.h
+++ b/src/gui/util/qcompleter.h
@@ -69,6 +69,7 @@ class Q_GUI_EXPORT QCompleter : public QObject
Q_PROPERTY(CompletionMode completionMode READ completionMode WRITE setCompletionMode)
Q_PROPERTY(int completionColumn READ completionColumn WRITE setCompletionColumn)
Q_PROPERTY(int completionRole READ completionRole WRITE setCompletionRole)
+ Q_PROPERTY(int maxVisibleItems READ maxVisibleItems WRITE setMaxVisibleItems)
Q_PROPERTY(Qt::CaseSensitivity caseSensitivity READ caseSensitivity WRITE setCaseSensitivity)
Q_PROPERTY(bool wrapAround READ wrapAround WRITE setWrapAround)
@@ -118,6 +119,9 @@ public:
bool wrapAround() const;
+ int maxVisibleItems() const;
+ void setMaxVisibleItems(int maxItems);
+
int completionCount() const;
bool setCurrentRow(int row);
int currentRow() const;
diff --git a/src/gui/util/qcompleter_p.h b/src/gui/util/qcompleter_p.h
index dc4189f..288f531 100644
--- a/src/gui/util/qcompleter_p.h
+++ b/src/gui/util/qcompleter_p.h
@@ -87,6 +87,7 @@ public:
Qt::CaseSensitivity cs;
int role;
int column;
+ int maxVisibleItems;
QCompleter::ModelSorting sorting;
bool wrap;
diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp
index 2cc478d..62ab2f7 100644
--- a/src/gui/util/qdesktopservices_win.cpp
+++ b/src/gui/util/qdesktopservices_win.cpp
@@ -47,7 +47,7 @@
#include <qtemporaryfile.h>
#include <qcoreapplication.h>
-#include <windows.h>
+#include <qt_windows.h>
#include <shlobj.h>
#if !defined(Q_OS_WINCE)
# include <intshcut.h>
@@ -62,33 +62,25 @@
QT_BEGIN_NAMESPACE
-//#undef UNICODE
-
static bool openDocument(const QUrl &file)
{
if (!file.isValid())
return false;
-
- quintptr returnValue;
- QT_WA({
- returnValue = (quintptr)ShellExecute(0, 0, (TCHAR *)file.toString().utf16(), 0, 0, SW_SHOWNORMAL);
- } , {
- returnValue = (quintptr)ShellExecuteA(0, 0, file.toString().toLocal8Bit().constData(), 0, 0, SW_SHOWNORMAL);
- });
+ QString filePath = file.toLocalFile();
+ if (filePath.isEmpty())
+ filePath = file.toString();
+ quintptr returnValue = (quintptr)ShellExecute(0, 0, (wchar_t*)filePath.utf16(), 0, 0, SW_SHOWNORMAL);
return (returnValue > 32); //ShellExecute returns a value greater than 32 if successful
}
static QString expandEnvStrings(const QString &command)
{
-
#if defined(Q_OS_WINCE)
return command;
#else
- QByteArray path = command.toLocal8Bit();
- char commandValue[2 * MAX_PATH] = {0};
- DWORD returnValue = ExpandEnvironmentStringsA(path.data(), commandValue, MAX_PATH);
- if (returnValue)
- return QString::fromLocal8Bit(commandValue);
+ wchar_t buffer[MAX_PATH];
+ if (ExpandEnvironmentStrings((wchar_t*)command.utf16(), buffer, MAX_PATH))
+ return QString::fromWCharArray(buffer);
else
return command;
#endif
@@ -129,8 +121,9 @@ static bool launchWebBrowser(const QUrl &url)
command = QString::fromRawData((QChar*)keyValue, bufferSize);
RegCloseKey(handle);
- if(returnValue)
+ if (returnValue)
return false;
+
command = expandEnvStrings(command);
command = command.trimmed();
//Make sure the path for the process is in quotes
@@ -152,7 +145,7 @@ static bool launchWebBrowser(const QUrl &url)
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
- returnValue = CreateProcess(NULL, (TCHAR*)command.utf16(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+ returnValue = CreateProcess(NULL, (wchar_t*)command.utf16(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
if (!returnValue)
return false;
@@ -168,9 +161,8 @@ static bool launchWebBrowser(const QUrl &url)
if (url.scheme().isEmpty())
return openDocument(url);
- quintptr returnValue;
- returnValue = (quintptr)ShellExecute(0, 0, (TCHAR *) QString::fromUtf8(url.toEncoded().constData()).utf16(),
- 0, 0, SW_SHOWNORMAL);
+ quintptr returnValue = (quintptr)ShellExecute(0, 0, (wchar_t *)QString::fromUtf8(url.toEncoded().constData()).utf16(),
+ 0, 0, SW_SHOWNORMAL);
return (returnValue > 32);
}
diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp
index d2ce1be..85eae26 100644
--- a/src/gui/util/qsystemtrayicon_win.cpp
+++ b/src/gui/util/qsystemtrayicon_win.cpp
@@ -41,8 +41,7 @@
#include "qsystemtrayicon_p.h"
#ifndef QT_NO_SYSTEMTRAYICON
-//#define _WIN32_IE 0x0500
-#define _WIN32_IE 0x0600 //required for NOTIFYICONDATAW_V2_SIZE
+#define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE
//missing defines for MINGW :
#ifndef NIN_BALLOONTIMEOUT
@@ -77,25 +76,14 @@ static const UINT q_uNOTIFYICONID = 0;
static uint MYWM_TASKBARCREATED = 0;
#define MYWM_NOTIFYICON (WM_APP+101)
-typedef BOOL (WINAPI *PtrShell_NotifyIcon)(DWORD,PNOTIFYICONDATA);
-static PtrShell_NotifyIcon ptrShell_NotifyIcon = 0;
+struct Q_NOTIFYICONIDENTIFIER {
+ DWORD cbSize;
+ HWND hWnd;
+ UINT uID;
+ GUID guidItem;
+};
-static void resolveLibs()
-{
- static bool triedResolve = false;
-#if defined Q_OS_WINCE
- QString libName(QLatin1String("coredll"));
- const char* funcName = "Shell_NotifyIcon";
-#else
- QString libName(QLatin1String("shell32"));
- const char* funcName = "Shell_NotifyIconW";
-#endif
- if (!triedResolve) {
- QLibrary lib(libName);
- triedResolve = true;
- ptrShell_NotifyIcon = (PtrShell_NotifyIcon) lib.resolve(funcName);
- }
-}
+typedef HRESULT (WINAPI *PtrShell_NotifyIconGetRect)(const Q_NOTIFYICONIDENTIFIER* identifier, RECT* iconLocation);
class QSystemTrayIconSys : QWidget
{
@@ -103,37 +91,26 @@ public:
QSystemTrayIconSys(QSystemTrayIcon *object);
~QSystemTrayIconSys();
bool winEvent( MSG *m, long *result );
- bool trayMessageA(DWORD msg);
- bool trayMessageW(DWORD msg);
bool trayMessage(DWORD msg);
bool iconDrawItem(LPDRAWITEMSTRUCT lpdi);
- void setIconContentsW(NOTIFYICONDATAW &data);
- void setIconContentsA(NOTIFYICONDATAA &data);
- bool showMessageW(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs);
- bool showMessageA(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs);
+ void setIconContents(NOTIFYICONDATA &data);
+ bool showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs);
bool allowsMessages();
bool supportsMessages();
QRect findIconGeometry(const int a_iButtonID);
- QRect findTrayGeometry();
HBITMAP createIconMask(const QBitmap &bitmap);
void createIcon();
- int detectShellVersion() const;
HICON hIcon;
QPoint globalPos;
QSystemTrayIcon *q;
private:
- uint notifyIconSizeW;
- uint notifyIconSizeA;
- int currentShellVersion;
+ uint notifyIconSize;
int maxTipLength;
};
-// Checks for the shell32 dll version number, since only version
-// 5 or later of supports ballon messages
bool QSystemTrayIconSys::allowsMessages()
{
#ifndef QT_NO_SETTINGS
-
QSettings settings(QLatin1String("HKEY_CURRENT_USER\\Software\\Microsoft"
"\\Windows\\CurrentVersion\\Explorer\\Advanced"), QSettings::NativeFormat);
return settings.value(QLatin1String("EnableBalloonTips"), true).toBool();
@@ -142,63 +119,28 @@ bool QSystemTrayIconSys::allowsMessages()
#endif
}
-// Checks for the shell32 dll version number, since only version
-// 5 or later of supports ballon messages
bool QSystemTrayIconSys::supportsMessages()
{
-#if NOTIFYICON_VERSION >= 3
- if (currentShellVersion >= 5)
- return allowsMessages();
- else
-#endif
- return false;
-}
-
-//Returns the runtime major version of the shell32 dll
-int QSystemTrayIconSys::detectShellVersion() const
-{
#ifndef Q_OS_WINCE
- int shellVersion = 4; //NT 4.0 and W95
- DLLGETVERSIONPROC pDllGetVersion = (DLLGETVERSIONPROC)QLibrary::resolve(
- QLatin1String("shell32"), "DllGetVersion");
- if (pDllGetVersion)
- {
- DLLVERSIONINFO dvi;
- HRESULT hr;
- ZeroMemory(&dvi, sizeof(dvi));
- dvi.cbSize = sizeof(dvi);
- hr = (*pDllGetVersion)(&dvi);
- if (SUCCEEDED(hr)) {
- if (dvi.dwMajorVersion >= 5)
- {
- shellVersion = dvi.dwMajorVersion;
- }
- }
- }
- return shellVersion;
+ return allowsMessages();
#endif
- return 4; //No ballonMessages and MaxTipLength = 64 for WindowsCE
+ return false;
}
QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
: hIcon(0), q(object)
{
- currentShellVersion = detectShellVersion();
- notifyIconSizeA = FIELD_OFFSET(NOTIFYICONDATAA, szTip[64]); // NOTIFYICONDATAA_V1_SIZE
- notifyIconSizeW = FIELD_OFFSET(NOTIFYICONDATAW, szTip[64]); // NOTIFYICONDATAW_V1_SIZE;
+#ifndef Q_OS_WINCE
+ notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, guidItem); // NOTIFYICONDATAW_V2_SIZE;
+ maxTipLength = 128;
+#else
+ notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE;
maxTipLength = 64;
-
-#if NOTIFYICON_VERSION >= 3
- if (currentShellVersion >=5) {
- notifyIconSizeA = FIELD_OFFSET(NOTIFYICONDATAA, guidItem); // NOTIFYICONDATAA_V2_SIZE
- notifyIconSizeW = FIELD_OFFSET(NOTIFYICONDATAW, guidItem); // NOTIFYICONDATAW_V2_SIZE;
- maxTipLength = 128;
- }
#endif
// For restoring the tray icon after explorer crashes
if (!MYWM_TASKBARCREATED) {
- MYWM_TASKBARCREATED = QT_WA_INLINE(RegisterWindowMessageW(L"TaskbarCreated"),RegisterWindowMessageA("TaskbarCreated"));
+ MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");
}
}
@@ -208,118 +150,60 @@ QSystemTrayIconSys::~QSystemTrayIconSys()
DestroyIcon(hIcon);
}
-void QSystemTrayIconSys::setIconContentsW(NOTIFYICONDATAW &tnd)
-{
- tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
- tnd.uCallbackMessage = MYWM_NOTIFYICON;
- tnd.hIcon = hIcon;
- QString tip = q->toolTip();
-
- if (!tip.isNull()) {
- // Tip is limited to maxTipLength - NULL; lstrcpyn appends a NULL terminator.
- tip = tip.left(maxTipLength - 1) + QChar();
-#if defined(Q_OS_WINCE)
- wcsncpy(tnd.szTip, reinterpret_cast<const wchar_t *> (tip.utf16()), qMin(tip.length()+1, maxTipLength));
-#else
- lstrcpynW(tnd.szTip, (TCHAR*)tip.utf16(), qMin(tip.length()+1, maxTipLength));
-#endif
- }
-}
-
-void QSystemTrayIconSys::setIconContentsA(NOTIFYICONDATAA &tnd)
+void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd)
{
- tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
+ tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnd.uCallbackMessage = MYWM_NOTIFYICON;
tnd.hIcon = hIcon;
QString tip = q->toolTip();
if (!tip.isNull()) {
- // Tip is limited to maxTipLength - NULL; lstrcpyn appends a NULL terminator.
tip = tip.left(maxTipLength - 1) + QChar();
-#if defined(Q_OS_WINCE)
- strncpy(tnd.szTip, tip.toLocal8Bit().constData(), qMin(tip.length()+1, maxTipLength));
-#else
- lstrcpynA(tnd.szTip, tip.toLocal8Bit().constData(), qMin(tip.length()+1, maxTipLength));
-#endif
+ memcpy(tnd.szTip, tip.utf16(), qMin(tip.length() + 1, maxTipLength) * sizeof(wchar_t));
}
}
-int iconFlag( QSystemTrayIcon::MessageIcon icon )
+static int iconFlag( QSystemTrayIcon::MessageIcon icon )
{
- int flag = 0;
#if NOTIFYICON_VERSION >= 3
switch (icon) {
- case QSystemTrayIcon::NoIcon:
- break;
- case QSystemTrayIcon::Critical:
- flag = NIIF_ERROR;
- break;
- case QSystemTrayIcon::Warning:
- flag = NIIF_WARNING;
- break;
case QSystemTrayIcon::Information:
- default : // fall through
- flag = NIIF_INFO;
+ return NIIF_INFO;
+ case QSystemTrayIcon::Warning:
+ return NIIF_WARNING;
+ case QSystemTrayIcon::Critical:
+ return NIIF_ERROR;
+ case QSystemTrayIcon::NoIcon:
+ return NIIF_NONE;
+ default:
+ Q_ASSERT_X(false, "QSystemTrayIconSys::showMessage", "Invalid QSystemTrayIcon::MessageIcon value");
+ return NIIF_NONE;
}
#else
Q_UNUSED(icon);
+ return 0;
#endif
- return flag;
}
-bool QSystemTrayIconSys::showMessageW(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs)
+bool QSystemTrayIconSys::showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs)
{
-#if NOTIFYICON_VERSION>=3
+#if NOTIFYICON_VERSION >= 3
NOTIFYICONDATA tnd;
- memset(&tnd, 0, notifyIconSizeW);
+ memset(&tnd, 0, notifyIconSize);
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- setIconContentsW(tnd);
-#if defined(Q_OS_WINCE)
- wcsncpy(tnd.szInfo, message.utf16(), qMin(message.length() + 1, 256));
- wcsncpy(tnd.szInfoTitle, title.utf16(), qMin(title.length()+1, 64));
-#else
- lstrcpynW(tnd.szInfo, (TCHAR*)message.utf16(), qMin(message.length() + 1, 256));
- lstrcpynW(tnd.szInfoTitle, (TCHAR*)title.utf16(), qMin(title.length() + 1, 64));
-#endif
- tnd.uID = q_uNOTIFYICONID;
- tnd.dwInfoFlags = iconFlag(type);
- tnd.cbSize = notifyIconSizeW;
- tnd.hWnd = winId();
- tnd.uTimeout = uSecs;
- tnd.uFlags = NIF_INFO;
- return ptrShell_NotifyIcon(NIM_MODIFY, &tnd);
-#else
- Q_UNUSED(title);
- Q_UNUSED(message);
- Q_UNUSED(type);
- Q_UNUSED(uSecs);
- return false;
-#endif
-}
-
-bool QSystemTrayIconSys::showMessageA(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs)
-{
-#if NOTIFYICON_VERSION>=3
- NOTIFYICONDATAA tnd;
- memset(&tnd, 0, notifyIconSizeA);
- Q_ASSERT(testAttribute(Qt::WA_WState_Created));
+ setIconContents(tnd);
+ memcpy(tnd.szInfo, message.utf16(), qMin(message.length() + 1, 256) * sizeof(wchar_t));
+ memcpy(tnd.szInfoTitle, title.utf16(), qMin(title.length() + 1, 64) * sizeof(wchar_t));
- setIconContentsA(tnd);
-#if defined(Q_OS_WINCE)
- strncpy(tnd.szInfo, message.toLocal8Bit().constData(), qMin(message.length() + 1, 256));
- strncpy(tnd.szInfoTitle, title.toLocal8Bit().constData(), qMin(title.length()+1, 64));
-#else
- lstrcpynA(tnd.szInfo, message.toLocal8Bit().constData(), qMin(message.length() + 1, 256));
- lstrcpynA(tnd.szInfoTitle, title.toLocal8Bit().constData(), qMin(title.length() + 1, 64));
-#endif
tnd.uID = q_uNOTIFYICONID;
tnd.dwInfoFlags = iconFlag(type);
- tnd.cbSize = notifyIconSizeA;
+ tnd.cbSize = notifyIconSize;
tnd.hWnd = winId();
tnd.uTimeout = uSecs;
tnd.uFlags = NIF_INFO;
- return Shell_NotifyIconA(NIM_MODIFY, &tnd);
+
+ return Shell_NotifyIcon(NIM_MODIFY, &tnd);
#else
Q_UNUSED(title);
Q_UNUSED(message);
@@ -329,53 +213,21 @@ bool QSystemTrayIconSys::showMessageA(const QString &title, const QString &messa
#endif
}
-bool QSystemTrayIconSys::trayMessageA(DWORD msg)
+bool QSystemTrayIconSys::trayMessage(DWORD msg)
{
-#if !defined(Q_WS_WINCE)
- NOTIFYICONDATAA tnd;
- memset(&tnd, 0, notifyIconSizeA);
+ NOTIFYICONDATA tnd;
+ memset(&tnd, 0, notifyIconSize);
tnd.uID = q_uNOTIFYICONID;
- tnd.cbSize = notifyIconSizeA;
+ tnd.cbSize = notifyIconSize;
tnd.hWnd = winId();
- Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- if (msg != NIM_DELETE) {
- setIconContentsA(tnd);
- }
- return Shell_NotifyIconA(msg, &tnd);
-#else
- Q_UNUSED(msg);
- return false;
-#endif
-}
-
-bool QSystemTrayIconSys::trayMessageW(DWORD msg)
-{
- NOTIFYICONDATAW tnd;
- memset(&tnd, 0, notifyIconSizeW);
- tnd.uID = q_uNOTIFYICONID;
- tnd.cbSize = notifyIconSizeW;
- tnd.hWnd = winId();
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
if (msg != NIM_DELETE) {
- setIconContentsW(tnd);
+ setIconContents(tnd);
}
- return ptrShell_NotifyIcon(msg, &tnd);
-}
-
-bool QSystemTrayIconSys::trayMessage(DWORD msg)
-{
- resolveLibs();
- if (!(ptrShell_NotifyIcon))
- return false;
- QT_WA({
- return trayMessageW(msg);
- },
- {
- return trayMessageA(msg);
- });
+ return Shell_NotifyIcon(msg, &tnd);
}
bool QSystemTrayIconSys::iconDrawItem(LPDRAWITEMSTRUCT lpdi)
@@ -462,7 +314,6 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
emit q->activated(QSystemTrayIcon::Trigger);
break;
-#if !defined(Q_WS_WINCE)
case WM_LBUTTONDBLCLK:
emit q->activated(QSystemTrayIcon::DoubleClick);
break;
@@ -470,20 +321,30 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
case WM_RBUTTONUP:
if (q->contextMenu()) {
q->contextMenu()->popup(gpos);
+#if defined(Q_WS_WINCE)
+ // We must ensure that the popup menu doesn't show up behind the task bar.
+ QRect desktopRect = qApp->desktop()->availableGeometry();
+ int maxY = desktopRect.y() + desktopRect.height() - q->contextMenu()->height();
+ if (gpos.y() > maxY) {
+ gpos.ry() = maxY;
+ q->contextMenu()->move(gpos);
+ }
+#endif
q->contextMenu()->activateWindow();
//Must be activated for proper keyboardfocus and menu closing on windows:
}
emit q->activated(QSystemTrayIcon::Context);
break;
+#if !defined(Q_WS_WINCE)
case NIN_BALLOONUSERCLICK:
emit q->messageClicked();
break;
+#endif
case WM_MBUTTONUP:
emit q->activated(QSystemTrayIcon::MiddleClick);
break;
-#endif
default:
break;
}
@@ -514,33 +375,6 @@ void QSystemTrayIconPrivate::install_sys()
}
}
-//fallback on win 95/98
-QRect QSystemTrayIconSys::findTrayGeometry()
-{
- //Use lower right corner as fallback
- QPoint brCorner = QApplication::desktop()->screenGeometry().bottomRight();
- QRect ret(brCorner.x() - 10, brCorner.y() - 10, 10, 10);
-#if defined(Q_OS_WINCE)
- HWND trayHandle = FindWindowW(L"Shell_TrayWnd", NULL);
-#else
- HWND trayHandle = FindWindowA("Shell_TrayWnd", NULL);
-#endif
- if (trayHandle) {
-#if defined(Q_OS_WINCE)
- trayHandle = FindWindowW(L"TrayNotifyWnd", NULL);
-#else
- trayHandle = FindWindowExA(trayHandle, NULL, "TrayNotifyWnd", NULL);
-#endif
- if (trayHandle) {
- RECT r;
- if (GetWindowRect(trayHandle, &r)) {
- ret = QRect(r.left, r.top, r.right- r.left, r.bottom - r.top);
- }
- }
- }
- return ret;
-}
-
/*
* This function tries to determine the icon geometry from the tray
*
@@ -548,26 +382,39 @@ QRect QSystemTrayIconSys::findTrayGeometry()
*/
QRect QSystemTrayIconSys::findIconGeometry(const int iconId)
{
+ static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect =
+ (PtrShell_NotifyIconGetRect)QLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect");
+
+ if (Shell_NotifyIconGetRect) {
+ Q_NOTIFYICONIDENTIFIER nid;
+ memset(&nid, 0, sizeof(nid));
+ nid.cbSize = sizeof(nid);
+ nid.hWnd = winId();
+ nid.uID = iconId;
+
+ RECT rect;
+ HRESULT hr = Shell_NotifyIconGetRect(&nid, &rect);
+ if (SUCCEEDED(hr)) {
+ return QRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
+ }
+ }
+
QRect ret;
TBBUTTON buttonData;
DWORD processID = 0;
-#if defined(Q_OS_WINCE)
- HWND trayHandle = FindWindowW(L"Shell_TrayWnd", NULL);
-#else
- HWND trayHandle = FindWindowA("Shell_TrayWnd", NULL);
-#endif
+ HWND trayHandle = FindWindow(L"Shell_TrayWnd", NULL);
//find the toolbar used in the notification area
if (trayHandle) {
#if defined(Q_OS_WINCE)
- trayHandle = FindWindowW(L"TrayNotifyWnd", NULL);
+ trayHandle = FindWindow(L"TrayNotifyWnd", NULL);
#else
- trayHandle = FindWindowExA(trayHandle, NULL, "TrayNotifyWnd", NULL);
+ trayHandle = FindWindowEx(trayHandle, NULL, L"TrayNotifyWnd", NULL);
#endif
if (trayHandle) {
#if defined(Q_OS_WINCE)
- HWND hwnd = FindWindowW(L"SysPager", NULL);
+ HWND hwnd = FindWindow(L"SysPager", NULL);
#else
HWND hwnd = FindWindowEx(trayHandle, NULL, L"SysPager", NULL);
#endif
@@ -612,10 +459,10 @@ QRect QSystemTrayIconSys::findIconGeometry(const int iconId)
DWORD appData[2] = { 0, 0 };
SendMessage(trayHandle, TB_GETBUTTON, toolbarButton , (LPARAM)data);
- if(!ReadProcessMemory(trayProcess, data, &buttonData, sizeof(TBBUTTON), &numBytes))
+ if (!ReadProcessMemory(trayProcess, data, &buttonData, sizeof(TBBUTTON), &numBytes))
continue;
- if(!ReadProcessMemory(trayProcess, (LPVOID) buttonData.dwData, appData, sizeof(appData), &numBytes))
+ if (!ReadProcessMemory(trayProcess, (LPVOID) buttonData.dwData, appData, sizeof(appData), &numBytes))
continue;
int currentIconId = appData[1];
@@ -646,7 +493,6 @@ QRect QSystemTrayIconSys::findIconGeometry(const int iconId)
return ret;
}
-
void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, int timeOut)
{
if (!sys || !sys->allowsMessages())
@@ -657,8 +503,6 @@ void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString
uSecs = 10000; //10 sec default
else uSecs = (int)timeOut;
- resolveLibs();
-
//message is limited to 255 chars + NULL
QString messageString;
if (message.isEmpty() && !title.isEmpty())
@@ -670,20 +514,12 @@ void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString
QString titleString = title.left(63) + QChar();
if (sys->supportsMessages()) {
- QT_WA({
- sys->showMessageW(titleString, messageString, type, (unsigned int)uSecs);
- }, {
- sys->showMessageA(titleString, messageString, type, (unsigned int)uSecs);
- });
+ sys->showMessage(titleString, messageString, type, (unsigned int)uSecs);
} else {
- //use fallbacks
- QRect iconPos = sys->findIconGeometry(0);
+ //use fallback
+ QRect iconPos = sys->findIconGeometry(q_uNOTIFYICONID);
if (iconPos.isValid()) {
QBalloonTip::showBalloon(type, title, message, sys->q, iconPos.center(), uSecs, true);
- } else {
- QRect trayRect = sys->findTrayGeometry();
- QBalloonTip::showBalloon(type, title, message, sys->q, QPoint(trayRect.left(),
- trayRect.center().y()), uSecs, false);
}
}
}
@@ -692,7 +528,7 @@ QRect QSystemTrayIconPrivate::geometry_sys() const
{
if (!sys)
return QRect();
- return sys->findIconGeometry(0);
+ return sys->findIconGeometry(q_uNOTIFYICONID);
}
void QSystemTrayIconPrivate::remove_sys()
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index a00f77a..391e095 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -51,10 +51,13 @@
#include "qdebug.h"
#include "qboxlayout.h"
#include "qpainter.h"
+#include "qstandardgestures.h"
#include "qabstractscrollarea_p.h"
#include <qwidget.h>
+#include <private/qapplication_p.h>
+
#ifdef Q_WS_MAC
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
@@ -157,6 +160,9 @@ QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate()
:hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded),
viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0),
xoffset(0), yoffset(0), viewportFilter(0)
+#ifdef Q_WS_WIN
+ , singleFingerPanEnabled(false)
+#endif
{
}
@@ -290,6 +296,32 @@ void QAbstractScrollAreaPrivate::init()
layoutChildren();
}
+void QAbstractScrollAreaPrivate::setupGestures()
+{
+#ifdef Q_OS_WIN
+ if (!viewport)
+ return;
+ QApplicationPrivate* getQApplicationPrivateInternal();
+ QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
+ bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn
+ || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum()));
+
+ bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn
+ || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum()));
+ if (qAppPriv->SetGestureConfig && (needh || needv)) {
+ GESTURECONFIG gc[1];
+ gc[0].dwID = GID_PAN;
+ gc[0].dwWant = GC_PAN;
+ gc[0].dwBlock = 0;
+ if (needv && singleFingerPanEnabled)
+ gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
+ if (needh && singleFingerPanEnabled)
+ gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
+ qAppPriv->SetGestureConfig(viewport->winId(), 0, 1, gc, sizeof(gc));
+ }
+#endif // Q_OS_WIN
+}
+
void QAbstractScrollAreaPrivate::layoutChildren()
{
Q_Q(QAbstractScrollArea);
@@ -459,9 +491,6 @@ void QAbstractScrollAreaPrivate::layoutChildren()
viewport->setGeometry(QStyle::visualRect(opt.direction, opt.rect, viewportRect)); // resize the viewport last
}
-// ### Fix for 4.4, talk to Bjoern E or Girish.
-void QAbstractScrollAreaPrivate::scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy) {}
-
/*!
\internal
@@ -920,7 +949,6 @@ bool QAbstractScrollArea::event(QEvent *e)
case QEvent::DragMove:
case QEvent::DragLeave:
#endif
- case QEvent::Gesture:
return false;
case QEvent::StyleChange:
case QEvent::LayoutDirectionChange:
@@ -1250,6 +1278,7 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y)
void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars()
{
layoutChildren();
+ setupGestures();
}
QPoint QAbstractScrollAreaPrivate::contentsOffset() const
diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h
index 3a5ee4e..f8ea843 100644
--- a/src/gui/widgets/qabstractscrollarea_p.h
+++ b/src/gui/widgets/qabstractscrollarea_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
class QScrollBar;
class QAbstractScrollAreaScrollBarContainer;
-class QAbstractScrollAreaPrivate: public QFramePrivate
+class Q_AUTOTEST_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate
{
Q_DECLARE_PUBLIC(QAbstractScrollArea)
@@ -88,7 +88,7 @@ public:
void init();
void layoutChildren();
// ### Fix for 4.4, talk to Bjoern E or Girish.
- virtual void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy);
+ virtual void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy) {}
void _q_hslide(int);
void _q_vslide(int);
@@ -99,6 +99,11 @@ public:
inline bool viewportEvent(QEvent *event)
{ return q_func()->viewportEvent(event); }
QScopedPointer<QObject> viewportFilter;
+
+#ifdef Q_WS_WIN
+ bool singleFingerPanEnabled;
+#endif
+ void setupGestures();
};
class QAbstractScrollAreaFilter : public QObject
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index 155fe3e..8027f9e 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -57,6 +57,9 @@
#include <qpalette.h>
#include <qstylepainter.h>
#include <qdebug.h>
+#ifndef QT_NO_ACCESSIBILITY
+# include <qaccessible.h>
+#endif
#if defined(Q_WS_X11)
#include <limits.h>
@@ -962,6 +965,9 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
d->buttonState = (Keyboard | (up ? Up : Down));
}
stepBy(steps);
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged);
+#endif
return;
}
#ifdef QT_KEYPAD_NAVIGATION
@@ -1559,6 +1565,9 @@ void QAbstractSpinBoxPrivate::updateState(bool up)
spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval);
buttonState = (up ? (Mouse | Up) : (Mouse | Down));
q->stepBy(up ? 1 : -1);
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::updateAccessibility(q, 0, QAccessible::ValueChanged);
+#endif
}
}
@@ -1579,7 +1588,7 @@ void QAbstractSpinBox::initStyleOption(QStyleOptionSpinBox *option) const
option->initFrom(this);
option->activeSubControls = QStyle::SC_None;
option->buttonSymbols = d->buttonSymbols;
- option->subControls = QStyle::SC_SpinBoxFrame;
+ option->subControls = QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField;
if (d->buttonSymbols != QAbstractSpinBox::NoButtons) {
option->subControls |= QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown;
if (d->buttonState & Up) {
diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac.mm b/src/gui/widgets/qcocoatoolbardelegate_mac.mm
index 894028e..10fe9b0 100644
--- a/src/gui/widgets/qcocoatoolbardelegate_mac.mm
+++ b/src/gui/widgets/qcocoatoolbardelegate_mac.mm
@@ -43,6 +43,7 @@
#ifdef QT_MAC_USE_COCOA
#include <private/qmainwindowlayout_p.h>
#include <private/qt_mac_p.h>
+#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qcocoaview_mac_p.h>
#include <private/qwidget_p.h>
#include <qtoolbar.h>
@@ -99,7 +100,7 @@ QT_FORWARD_DECLARE_CLASS(QCFString);
{
Q_UNUSED(flag);
Q_UNUSED(nstoolbar);
- QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(QCFString::toQString(CFStringRef(itemIdentifier)));
+ QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(qt_mac_NSStringToQString(itemIdentifier));
NSToolbarItem *item = nil;
if (tb) {
item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier];
@@ -111,7 +112,7 @@ QT_FORWARD_DECLARE_CLASS(QCFString);
- (void)toolbarWillAddItem:(NSNotification *)notification
{
NSToolbarItem *item = [[notification userInfo] valueForKey:@"item"];
- QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(QCFString::toQString(CFStringRef([item itemIdentifier])));
+ QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(qt_mac_NSStringToQString([item itemIdentifier]));
if (!tb)
return; // I can't really do anything about this.
[item retain];
@@ -119,12 +120,9 @@ QT_FORWARD_DECLARE_CLASS(QCFString);
NSArray *items = [[qt_mac_window_for(mainWindowLayout->layoutState.mainWindow->window()) toolbar] items];
int someIndex = 0;
- bool foundItem = false;
for (NSToolbarItem *i in items) {
- if (i == item) {
- foundItem = true;
+ if (i == item)
break;
- }
++someIndex;
}
mainWindowLayout->toolbarItemsCopy.insert(someIndex, item);
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 7b91731..b6fae10 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -148,8 +148,10 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
menuOption.rect = option.rect;
// Make sure fonts set on the combo box also overrides the font for the popup menu.
- if (mCombo->testAttribute(Qt::WA_SetFont) || mCombo->testAttribute(Qt::WA_MacSmallSize)
- || mCombo->testAttribute(Qt::WA_MacMiniSize))
+ if (mCombo->testAttribute(Qt::WA_SetFont)
+ || mCombo->testAttribute(Qt::WA_MacSmallSize)
+ || mCombo->testAttribute(Qt::WA_MacMiniSize)
+ || mCombo->font() != qt_app_fonts_hash()->value("QComboBox", QFont()))
menuOption.font = mCombo->font();
else
menuOption.font = qt_app_fonts_hash()->value("QComboMenuItem", mCombo->font());
diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
index 648847a..db57b43 100644
--- a/src/gui/widgets/qdatetimeedit.cpp
+++ b/src/gui/widgets/qdatetimeedit.cpp
@@ -1936,7 +1936,6 @@ QDateTime QDateTimeEditPrivate::validateAndInterpret(QString &input, int &positi
/*!
\internal
- \reimp
*/
QString QDateTimeEditPrivate::textFromValue(const QVariant &f) const
@@ -1947,7 +1946,6 @@ QString QDateTimeEditPrivate::textFromValue(const QVariant &f) const
/*!
\internal
- \reimp
This function's name is slightly confusing; it is not to be confused
with QAbstractSpinBox::valueFromText().
@@ -2105,7 +2103,6 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c
/*!
\internal
- \reimp
*/
void QDateTimeEditPrivate::emitSignals(EmitPolicy ep, const QVariant &old)
@@ -2135,7 +2132,6 @@ void QDateTimeEditPrivate::emitSignals(EmitPolicy ep, const QVariant &old)
/*!
\internal
- \reimp
*/
void QDateTimeEditPrivate::_q_editorCursorPositionChanged(int oldpos, int newpos)
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index 9828413..ee29b55 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1488,7 +1488,7 @@ bool QDockAreaLayoutInfo::hasFixedSize() const
void QDockAreaLayoutInfo::apply(bool animate)
{
- QWidgetAnimator *widgetAnimator = mainWindowLayout()->widgetAnimator;
+ QWidgetAnimator &widgetAnimator = mainWindowLayout()->widgetAnimator;
#ifndef QT_NO_TABBAR
if (tabbed) {
@@ -1521,7 +1521,7 @@ void QDockAreaLayoutInfo::apply(bool animate)
}
}
- widgetAnimator->animate(tabBar, tab_rect, animate);
+ widgetAnimator.animate(tabBar, tab_rect, animate);
}
#endif // QT_NO_TABBAR
@@ -1544,7 +1544,7 @@ void QDockAreaLayoutInfo::apply(bool animate)
QWidget *w = item.widgetItem->widget();
QRect geo = w->geometry();
- widgetAnimator->animate(w, r, animate);
+ widgetAnimator.animate(w, r, animate);
if (!w->isHidden()) {
QDockWidget *dw = qobject_cast<QDockWidget*>(w);
if (!r.isValid() && geo.right() >= 0 && geo.bottom() >= 0) {
@@ -1707,7 +1707,7 @@ QDockAreaLayoutItem &QDockAreaLayoutInfo::item(const QList<int> &path)
Q_ASSERT(!path.isEmpty());
const int index = path.first();
if (path.count() > 1) {
- const QDockAreaLayoutItem &item = item_list.at(index);
+ const QDockAreaLayoutItem &item = item_list[index];
Q_ASSERT(item.subinfo != 0);
return item.subinfo->item(path.mid(1));
}
@@ -2074,7 +2074,7 @@ void QDockAreaLayoutInfo::updateTabBar() const
QDockAreaLayoutInfo *that = const_cast<QDockAreaLayoutInfo*>(this);
- if (tabBar == 0) {
+ if (that->tabBar == 0) {
that->tabBar = mainWindowLayout()->getTabBar();
that->tabBar->setShape(static_cast<QTabBar::Shape>(tabBarShape));
that->tabBar->setDrawBase(true);
@@ -3064,13 +3064,13 @@ void QDockAreaLayout::splitDockWidget(QDockWidget *after,
void QDockAreaLayout::apply(bool animate)
{
- QWidgetAnimator *widgetAnimator
+ QWidgetAnimator &widgetAnimator
= qobject_cast<QMainWindowLayout*>(mainWindow->layout())->widgetAnimator;
for (int i = 0; i < QInternal::DockCount; ++i)
docks[i].apply(animate);
if (centralWidgetItem != 0 && !centralWidgetItem->isEmpty()) {
- widgetAnimator->animate(centralWidgetItem->widget(), centralWidgetRect,
+ widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect,
animate);
}
diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp
index 065a2e0..f3b1b76 100644
--- a/src/gui/widgets/qeffects.cpp
+++ b/src/gui/widgets/qeffects.cpp
@@ -126,9 +126,9 @@ QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f)
QAlphaWidget::~QAlphaWidget()
{
-#ifdef Q_WS_WIN
+#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
// Restore user-defined opacity value
- if (widget && QSysInfo::WindowsVersion >= QSysInfo::WV_2000 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
+ if (widget)
widget->setWindowOpacity(windowOpacity);
#endif
}
@@ -160,43 +160,40 @@ void QAlphaWidget::run(int time)
checkTime.start();
showWidget = true;
-#if defined(Q_OS_WIN)
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) {
- qApp->installEventFilter(this);
- widget->setWindowOpacity(0.0);
- widget->show();
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ qApp->installEventFilter(this);
+ widget->setWindowOpacity(0.0);
+ widget->show();
+ connect(&anim, SIGNAL(timeout()), this, SLOT(render()));
+ anim.start(1);
+#else
+ //This is roughly equivalent to calling setVisible(true) without actually showing the widget
+ widget->setAttribute(Qt::WA_WState_ExplicitShowHide, true);
+ widget->setAttribute(Qt::WA_WState_Hidden, false);
+
+ qApp->installEventFilter(this);
+
+ move(widget->geometry().x(),widget->geometry().y());
+ resize(widget->size().width(), widget->size().height());
+
+ frontImage = QPixmap::grabWidget(widget).toImage();
+ backImage = QPixmap::grabWindow(QApplication::desktop()->winId(),
+ widget->geometry().x(), widget->geometry().y(),
+ widget->geometry().width(), widget->geometry().height()).toImage();
+
+ if (!backImage.isNull() && checkTime.elapsed() < duration / 2) {
+ mixedImage = backImage.copy();
+ pm = QPixmap::fromImage(mixedImage);
+ show();
+ setEnabled(false);
+
connect(&anim, SIGNAL(timeout()), this, SLOT(render()));
anim.start(1);
- } else
-#endif
- {
- //This is roughly equivalent to calling setVisible(true) without actually showing the widget
- widget->setAttribute(Qt::WA_WState_ExplicitShowHide, true);
- widget->setAttribute(Qt::WA_WState_Hidden, false);
-
- qApp->installEventFilter(this);
-
- move(widget->geometry().x(),widget->geometry().y());
- resize(widget->size().width(), widget->size().height());
-
- frontImage = QPixmap::grabWidget(widget).toImage();
- backImage = QPixmap::grabWindow(QApplication::desktop()->winId(),
- widget->geometry().x(), widget->geometry().y(),
- widget->geometry().width(), widget->geometry().height()).toImage();
-
- if (!backImage.isNull() && checkTime.elapsed() < duration / 2) {
- mixedImage = backImage.copy();
- pm = QPixmap::fromImage(mixedImage);
- show();
- setEnabled(false);
-
- connect(&anim, SIGNAL(timeout()), this, SLOT(render()));
- anim.start(1);
- } else {
- duration = 0;
- render();
- }
+ } else {
+ duration = 0;
+ render();
}
+#endif
}
/*
@@ -270,19 +267,17 @@ void QAlphaWidget::render()
else
alpha = 1;
-#if defined(Q_OS_WIN)
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) {
- if (alpha >= windowOpacity || !showWidget) {
- anim.stop();
- qApp->removeEventFilter(this);
- widget->setWindowOpacity(windowOpacity);
- q_blend = 0;
- deleteLater();
- } else {
- widget->setWindowOpacity(alpha);
- }
- } else
-#endif
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ if (alpha >= windowOpacity || !showWidget) {
+ anim.stop();
+ qApp->removeEventFilter(this);
+ widget->setWindowOpacity(windowOpacity);
+ q_blend = 0;
+ deleteLater();
+ } else {
+ widget->setWindowOpacity(alpha);
+ }
+#else
if (alpha >= 1 || !showWidget) {
anim.stop();
qApp->removeEventFilter(this);
@@ -292,7 +287,7 @@ void QAlphaWidget::render()
#ifdef Q_WS_WIN
setEnabled(true);
setFocus();
-#endif
+#endif // Q_WS_WIN
widget->hide();
} else {
//Since we are faking the visibility of the widget
@@ -309,6 +304,7 @@ void QAlphaWidget::render()
pm = QPixmap::fromImage(mixedImage);
repaint();
}
+#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
}
/*
diff --git a/src/gui/widgets/qfontcombobox.cpp b/src/gui/widgets/qfontcombobox.cpp
index 9660399..f87ccd3 100644
--- a/src/gui/widgets/qfontcombobox.cpp
+++ b/src/gui/widgets/qfontcombobox.cpp
@@ -263,7 +263,7 @@ void QFontComboBoxPrivate::_q_currentChanged(const QString &text)
{
Q_Q(QFontComboBox);
QFont newFont(text);
- if (currentFont != newFont) {
+ if (currentFont.family() != newFont.family()) {
currentFont = newFont;
emit q->currentFontChanged(currentFont);
}
diff --git a/src/gui/widgets/qframe.cpp b/src/gui/widgets/qframe.cpp
index b9e769d..a87ec85 100644
--- a/src/gui/widgets/qframe.cpp
+++ b/src/gui/widgets/qframe.cpp
@@ -135,7 +135,7 @@ inline void QFramePrivate::init()
\value VLine QFrame draws a vertical line that frames nothing
(useful as separator)
\value WinPanel draws a rectangular panel that can be raised or
- sunken like those in Windows 95. Specifying this shape sets
+ sunken like those in Windows 2000. Specifying this shape sets
the line width to 2 pixels. WinPanel is provided for compatibility.
For GUI style independence we recommend using StyledPanel instead.
diff --git a/src/gui/widgets/qgroupbox.cpp b/src/gui/widgets/qgroupbox.cpp
index 0bfa8c0..5758b6a 100644
--- a/src/gui/widgets/qgroupbox.cpp
+++ b/src/gui/widgets/qgroupbox.cpp
@@ -431,7 +431,7 @@ void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason)
{
Q_Q(QGroupBox);
QWidget *fw = q->focusWidget();
- if (!fw) {
+ if (!fw || fw == q) {
QWidget * best = 0;
QWidget * candidate = 0;
QWidget * w = q;
@@ -449,8 +449,7 @@ void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason)
}
if (best)
fw = best;
- else
- if (candidate)
+ else if (candidate)
fw = candidate;
}
if (fw)
@@ -479,11 +478,7 @@ void QGroupBox::focusInEvent(QFocusEvent *fe)
if (focusPolicy() == Qt::NoFocus) {
d->_q_fixFocus(fe->reason());
} else {
- QStyleOptionGroupBox box;
- initStyleOption(&box);
- QRect rect = style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this)
- | style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxLabel, this);
- update(rect);
+ QWidget::focusInEvent(fe);
}
}
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 4d69a9f..01d5711 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -2181,7 +2181,8 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
if (unknown && !d->readOnly) {
QString t = event->text();
- if (!t.isEmpty() && t.at(0).isPrint()) {
+ if (!t.isEmpty() && t.at(0).isPrint() &&
+ ((event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) {
insert(t);
#ifndef QT_NO_COMPLETER
d->complete(event->key());
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index c9706cf..b75b5ea 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -1374,20 +1374,25 @@ bool QMainWindow::event(QEvent *event)
#ifdef Q_WS_MAC
case QEvent::Show:
if (unifiedTitleAndToolBarOnMac())
- macWindowToolbarShow(this, true);
+ d->layout->syncUnifiedToolbarVisibility();
+ d->layout->blockVisiblityCheck = false;
break;
-# ifdef QT_MAC_USE_COCOA
case QEvent::WindowStateChange:
{
+ if (isHidden()) {
+ // We are coming out of a minimize, leave things as is.
+ d->layout->blockVisiblityCheck = true;
+ }
+# ifdef QT_MAC_USE_COCOA
// We need to update the HIToolbar status when we go out of or into fullscreen.
QWindowStateChangeEvent *wce = static_cast<QWindowStateChangeEvent *>(event);
if ((windowState() & Qt::WindowFullScreen) || (wce->oldState() & Qt::WindowFullScreen)) {
d->layout->updateHIToolBarStatus();
}
+# endif // Cocoa
}
break;
-# endif // Cocoa
-#endif
+#endif // Q_WS_MAC
#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
case QEvent::CursorChange:
if (d->cursorAdjusted) {
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index 526e7a5..3936a67 100644
--- a/src/gui/widgets/qmainwindowlayout.cpp
+++ b/src/gui/widgets/qmainwindowlayout.cpp
@@ -237,7 +237,7 @@ void QMainWindowLayoutState::apply(bool animated)
if (centralWidgetItem != 0) {
QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
Q_ASSERT(layout != 0);
- layout->widgetAnimator->animate(centralWidgetItem->widget(), centralWidgetRect, animated);
+ layout->widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect, animated);
}
#endif
}
@@ -426,42 +426,42 @@ QList<int> QMainWindowLayoutState::gapIndex(QWidget *widget,
return result;
}
-bool QMainWindowLayoutState::insertGap(QList<int> path, QLayoutItem *item)
+bool QMainWindowLayoutState::insertGap(const QList<int> &path, QLayoutItem *item)
{
if (path.isEmpty())
return false;
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0) {
Q_ASSERT(qobject_cast<QToolBar*>(item->widget()) != 0);
- return toolBarAreaLayout.insertGap(path, item);
+ return toolBarAreaLayout.insertGap(path.mid(1), item);
}
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1) {
Q_ASSERT(qobject_cast<QDockWidget*>(item->widget()) != 0);
- return dockAreaLayout.insertGap(path, item);
+ return dockAreaLayout.insertGap(path.mid(1), item);
}
#endif //QT_NO_DOCKWIDGET
return false;
}
-void QMainWindowLayoutState::remove(QList<int> path)
+void QMainWindowLayoutState::remove(const QList<int> &path)
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- toolBarAreaLayout.remove(path);
+ toolBarAreaLayout.remove(path.mid(1));
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- dockAreaLayout.remove(path);
+ dockAreaLayout.remove(path.mid(1));
#endif //QT_NO_DOCKWIDGET
}
@@ -501,88 +501,88 @@ bool QMainWindowLayoutState::isValid() const
return rect.isValid();
}
-QLayoutItem *QMainWindowLayoutState::item(QList<int> path)
+QLayoutItem *QMainWindowLayoutState::item(const QList<int> &path)
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- return toolBarAreaLayout.item(path).widgetItem;
+ return toolBarAreaLayout.item(path.mid(1)).widgetItem;
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.item(path).widgetItem;
+ return dockAreaLayout.item(path.mid(1)).widgetItem;
#endif //QT_NO_DOCKWIDGET
return 0;
}
-QRect QMainWindowLayoutState::itemRect(QList<int> path) const
+QRect QMainWindowLayoutState::itemRect(const QList<int> &path) const
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- return toolBarAreaLayout.itemRect(path);
+ return toolBarAreaLayout.itemRect(path.mid(1));
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.itemRect(path);
+ return dockAreaLayout.itemRect(path.mid(1));
#endif //QT_NO_DOCKWIDGET
return QRect();
}
-QRect QMainWindowLayoutState::gapRect(QList<int> path) const
+QRect QMainWindowLayoutState::gapRect(const QList<int> &path) const
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- return toolBarAreaLayout.itemRect(path);
+ return toolBarAreaLayout.itemRect(path.mid(1));
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.gapRect(path);
+ return dockAreaLayout.gapRect(path.mid(1));
#endif //QT_NO_DOCKWIDGET
return QRect();
}
-QLayoutItem *QMainWindowLayoutState::plug(QList<int> path)
+QLayoutItem *QMainWindowLayoutState::plug(const QList<int> &path)
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- return toolBarAreaLayout.plug(path);
+ return toolBarAreaLayout.plug(path.mid(1));
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.plug(path);
+ return dockAreaLayout.plug(path.mid(1));
#endif //QT_NO_DOCKWIDGET
return 0;
}
-QLayoutItem *QMainWindowLayoutState::unplug(QList<int> path, QMainWindowLayoutState *other)
+QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowLayoutState *other)
{
- int i = path.takeFirst();
+ int i = path.first();
#ifdef QT_NO_TOOLBAR
Q_UNUSED(other);
#else
if (i == 0)
- return toolBarAreaLayout.unplug(path, other ? &other->toolBarAreaLayout : 0);
+ return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.unplug(path);
+ return dockAreaLayout.unplug(path.mid(1));
#endif //QT_NO_DOCKWIDGET
return 0;
@@ -939,16 +939,70 @@ void QMainWindowLayout::getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar
void QMainWindowLayout::toggleToolBarsVisible()
{
- layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible;
- if (!layoutState.mainWindow->isMaximized()){
- QPoint topLeft = parentWidget()->geometry().topLeft();
- QRect r = parentWidget()->geometry();
- r = layoutState.toolBarAreaLayout.rectHint(r);
- r.moveTo(topLeft);
- parentWidget()->setGeometry(r);
-// widgetAnimator->animate(parentWidget(), r, true);
- } else{
- update();
+ bool updateNonUnifiedParts = true;
+#ifdef Q_WS_MAC
+ if (layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) {
+ // If we hit this case, someone has pressed the "toolbar button" which will
+ // toggle the unified toolbar visiblity, because that's what the user wants.
+ // We might be in a situation where someone has hidden all the toolbars
+ // beforehand (maybe in construction), but now they've hit this button and
+ // and are expecting the items to show. What do we do?
+ // 1) Check the visibility of all the toolbars, if one is visible, do nothing, this
+ // preserves what people would expect (these toolbars were visible when I clicked last time).
+ // 2) If NONE are visible, then show them all. Again, this preserves the user expectation
+ // of, "I want to see the toolbars." The user may get more toolbars than expected, but this
+ // is better seeing nothing.
+ // Don't worry about any of this if we are going invisible. This does mean we may get
+ // into issues when switching into and out of fullscreen mode, but this is probably minor.
+ // If we ever need to do hiding, that would have to be taken care of after the unified toolbar
+ // has finished hiding.
+ // People can of course handle the QEvent::ToolBarChange event themselves and do
+ // WHATEVER they want if they don't like what we are doing (though the unified toolbar
+ // will fire regardless).
+
+ // Check if we REALLY need to update the geometry below. If we only have items in the
+ // unified toolbar, all the docks will be empty, so there's very little point
+ // in doing the geometry as Apple will do it (we also avoid flicker in Cocoa as well).
+ // FWIW, layoutState.toolBarAreaLayout.visible and the state of the unified toolbar
+ // visibility can get out of sync. I really don't think it's a big issue. It is kept
+ // to a minimum because we only change the visibility if we absolutely must.
+ // update the "non unified parts."
+ updateNonUnifiedParts = !layoutState.toolBarAreaLayout.isEmpty();
+
+ // We get this function before the unified toolbar does its thing.
+ // So, the value will be opposite of what we expect.
+ bool goingVisible = !macWindowToolbarIsVisible(qt_mac_window_for(layoutState.mainWindow));
+ if (goingVisible) {
+ const int ToolBarCount = qtoolbarsInUnifiedToolbarList.size();
+ bool needAllVisible = true;
+ for (int i = 0; i < ToolBarCount; ++i) {
+ if (!qtoolbarsInUnifiedToolbarList.at(i)->isHidden()) {
+ needAllVisible = false;
+ break;
+ }
+ }
+ if (needAllVisible) {
+ QBoolBlocker blocker(blockVisiblityCheck); // Disable the visibilty check because
+ // the toggle has already happened.
+ for (int i = 0; i < ToolBarCount; ++i)
+ qtoolbarsInUnifiedToolbarList.at(i)->setVisible(true);
+ }
+ }
+ if (!updateNonUnifiedParts)
+ layoutState.toolBarAreaLayout.visible = goingVisible;
+ }
+#endif
+ if (updateNonUnifiedParts) {
+ layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible;
+ if (!layoutState.mainWindow->isMaximized()) {
+ QPoint topLeft = parentWidget()->geometry().topLeft();
+ QRect r = parentWidget()->geometry();
+ r = layoutState.toolBarAreaLayout.rectHint(r);
+ r.moveTo(topLeft);
+ parentWidget()->setGeometry(r);
+ } else {
+ update();
+ }
}
}
@@ -1361,7 +1415,7 @@ QLayoutItem *QMainWindowLayout::takeAt(int index)
if (QLayoutItem *ret = layoutState.takeAt(index, &x)) {
// the widget might in fact have been destroyed by now
if (QWidget *w = ret->widget()) {
- widgetAnimator->abort(w);
+ widgetAnimator.abort(w);
if (w == pluggingWidget)
pluggingWidget = 0;
}
@@ -1528,75 +1582,28 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem)
layoutState.remove(previousPath);
pluggingWidget = widget;
- if (dockOptions & QMainWindow::AnimatedDocks) {
- QRect globalRect = currentGapRect;
- globalRect.moveTopLeft(parentWidget()->mapToGlobal(globalRect.topLeft()));
+ QRect globalRect = currentGapRect;
+ globalRect.moveTopLeft(parentWidget()->mapToGlobal(globalRect.topLeft()));
#ifndef QT_NO_DOCKWIDGET
- if (qobject_cast<QDockWidget*>(widget) != 0) {
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(widget->layout());
- if (layout->nativeWindowDeco()) {
- globalRect.adjust(0, layout->titleHeight(), 0, 0);
- } else {
- int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget);
- globalRect.adjust(-fw, -fw, fw, fw);
- }
+ if (qobject_cast<QDockWidget*>(widget) != 0) {
+ QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(widget->layout());
+ if (layout->nativeWindowDeco()) {
+ globalRect.adjust(0, layout->titleHeight(), 0, 0);
+ } else {
+ int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget);
+ globalRect.adjust(-fw, -fw, fw, fw);
}
-#endif
- widgetAnimator->animate(widget, globalRect,
- dockOptions & QMainWindow::AnimatedDocks);
- } else {
-#ifndef QT_NO_DOCKWIDGET
- if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget))
- dw->d_func()->plug(currentGapRect);
-#endif
-#ifndef QT_NO_TOOLBAR
- if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
- tb->d_func()->plug(currentGapRect);
-#endif
- applyState(layoutState);
- savedState.clear();
-#ifndef QT_NO_DOCKWIDGET
- parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
-#endif
- currentGapPos.clear();
- updateGapIndicator();
- pluggingWidget = 0;
}
+#endif
+ widgetAnimator.animate(widget, globalRect, dockOptions & QMainWindow::AnimatedDocks);
return true;
}
-void QMainWindowLayout::allAnimationsFinished()
-{
-#ifndef QT_NO_DOCKWIDGET
- parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
-
-#ifndef QT_NO_TABBAR
- foreach (QTabBar *tab_bar, usedTabBars)
- tab_bar->show();
-#endif // QT_NO_TABBAR
-#endif // QT_NO_DOCKWIDGET
-
- updateGapIndicator();
-}
-
void QMainWindowLayout::animationFinished(QWidget *widget)
{
-
- /* This signal is delivered from QWidgetAnimator over a qeued connection. The problem is that
- the widget can be deleted. This is handled as follows:
-
- The animator only ever animates widgets that have been added to this layout. If a widget
- is deleted during animation, the widget's destructor removes the widget form this layout.
- This in turn aborts the animation (see takeAt()) and this signal will never be delivered.
-
- If the widget is deleted after the animation is finished but before this qeued signal
- is delivered, the widget is no longer in the layout and we catch it here. The key is that
- QMainWindowLayoutState::contains() never dereferences the pointer. */
-
- if (!layoutState.contains(widget))
- return;
-
+ //this function is called from within the Widget Animator whenever an animation is finished
+ //on a certain widget
#ifndef QT_NO_TOOLBAR
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
@@ -1609,32 +1616,44 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
}
#endif
- if (widget != pluggingWidget)
- return;
+ if (widget == pluggingWidget) {
#ifndef QT_NO_DOCKWIDGET
- if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget))
- dw->d_func()->plug(currentGapRect);
+ if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget))
+ dw->d_func()->plug(currentGapRect);
#endif
#ifndef QT_NO_TOOLBAR
- if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
- tb->d_func()->plug(currentGapRect);
+ if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
+ tb->d_func()->plug(currentGapRect);
#endif
- applyState(layoutState, false);
#ifndef QT_NO_DOCKWIDGET
#ifndef QT_NO_TABBAR
- if (qobject_cast<QDockWidget*>(widget) != 0) {
- // info() might return null if the widget is destroyed while
- // animating but before the animationFinished signal is received.
- if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget))
- info->setCurrentTab(widget);
- }
+ if (qobject_cast<QDockWidget*>(widget) != 0) {
+ // info() might return null if the widget is destroyed while
+ // animating but before the animationFinished signal is received.
+ if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget))
+ info->setCurrentTab(widget);
+ }
#endif
#endif
- savedState.clear();
- currentGapPos.clear();
- pluggingWidget = 0;
+
+ savedState.clear();
+ currentGapPos.clear();
+ pluggingWidget = 0;
+ }
+
+ if (!widgetAnimator.animating()) {
+ //all animations are finished
+#ifndef QT_NO_DOCKWIDGET
+ parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
+#ifndef QT_NO_TABBAR
+ foreach (QTabBar *tab_bar, usedTabBars)
+ tab_bar->show();
+#endif // QT_NO_TABBAR
+#endif // QT_NO_DOCKWIDGET
+ }
+
updateGapIndicator();
}
@@ -1667,6 +1686,14 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow)
#endif
#endif
#endif // QT_NO_DOCKWIDGET
+ , widgetAnimator(this)
+ , pluggingWidget(0)
+#ifndef QT_NO_RUBBERBAND
+ , gapIndicator(new QRubberBand(QRubberBand::Rectangle, mainwindow))
+#endif //QT_NO_RUBBERBAND
+#ifdef Q_WS_MAC
+ , blockVisiblityCheck(false)
+#endif
{
#ifndef QT_NO_DOCKWIDGET
#ifndef QT_NO_TABBAR
@@ -1680,20 +1707,13 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow)
#endif // QT_NO_DOCKWIDGET
#ifndef QT_NO_RUBBERBAND
- gapIndicator = new QRubberBand(QRubberBand::Rectangle, mainwindow);
// For accessibility to identify this special widget.
gapIndicator->setObjectName(QLatin1String("qt_rubberband"));
-
gapIndicator->hide();
#endif
pluggingWidget = 0;
setObjectName(mainwindow->objectName() + QLatin1String("_layout"));
- widgetAnimator = new QWidgetAnimator(this);
- connect(widgetAnimator, SIGNAL(finished(QWidget*)),
- this, SLOT(animationFinished(QWidget*)), Qt::QueuedConnection);
- connect(widgetAnimator, SIGNAL(finishedAll()),
- this, SLOT(allAnimationsFinished()));
}
QMainWindowLayout::~QMainWindowLayout()
@@ -1795,14 +1815,8 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget)
void QMainWindowLayout::updateGapIndicator()
{
#ifndef QT_NO_RUBBERBAND
- if (widgetAnimator->animating() || currentGapPos.isEmpty()) {
- gapIndicator->hide();
- } else {
- if (gapIndicator->geometry() != currentGapRect)
- gapIndicator->setGeometry(currentGapRect);
- if (!gapIndicator->isVisible())
- gapIndicator->show();
- }
+ gapIndicator->setVisible(!widgetAnimator.animating() && !currentGapPos.isEmpty());
+ gapIndicator->setGeometry(currentGapRect);
#endif
}
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 6632be7..61719c2 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -338,18 +338,16 @@ void QMainWindowLayout::updateHIToolBarStatus()
0, kWindowUnifiedTitleAndToolbarAttribute);
}
#endif
- macWindowToolbarShow(layoutState.mainWindow, useMacToolbar);
layoutState.mainWindow->setUpdatesEnabled(false); // reduces a little bit of flicker, not all though
if (!useMacToolbar) {
- OSWindowRef windowRef = qt_mac_window_for(parentWidget());
- macWindowToolbarShow(parentWidget(), false);
+ macWindowToolbarShow(layoutState.mainWindow, false);
// Move everything out of the HIToolbar into the main toolbar.
while (!qtoolbarsInUnifiedToolbarList.isEmpty()) {
// Should shrink the list by one every time.
layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, qtoolbarsInUnifiedToolbarList.first());
}
- macWindowToolbarSet(windowRef, NULL);
+ macWindowToolbarSet(qt_mac_window_for(layoutState.mainWindow), 0);
} else {
QList<QToolBar *> toolbars = layoutState.mainWindow->findChildren<QToolBar *>();
for (int i = 0; i < toolbars.size(); ++i) {
@@ -359,6 +357,7 @@ void QMainWindowLayout::updateHIToolBarStatus()
layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, toolbar);
}
}
+ syncUnifiedToolbarVisibility();
}
layoutState.mainWindow->setUpdatesEnabled(true);
}
@@ -439,7 +438,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
#else
NSString *toolbarID = kQToolBarNSToolbarIdentifier;
toolbarID = [toolbarID stringByAppendingFormat:@"%p", toolbar];
- cocoaItemIDToToolbarHash.insert(QCFString::toQString(CFStringRef(toolbarID)), toolbar);
+ cocoaItemIDToToolbarHash.insert(qt_mac_NSStringToQString(toolbarID), toolbar);
[macToolbar insertItemWithItemIdentifier:toolbarID atIndex:beforeIndex];
#endif
}
@@ -487,6 +486,7 @@ void QMainWindowLayout::cleanUpMacToolbarItems()
void QMainWindowLayout::fixSizeInUnifiedToolbar(QToolBar *tb) const
{
+#ifdef QT_MAC_USE_COCOA
QHash<void *, QToolBar *>::const_iterator it = unifiedToolbarHash.constBegin();
NSToolbarItem *item = nil;
while (it != unifiedToolbarHash.constEnd()) {
@@ -507,5 +507,26 @@ void QMainWindowLayout::fixSizeInUnifiedToolbar(QToolBar *tb) const
nssize.height = size.height() - 2;
[item setMinSize:nssize];
}
+#else
+ Q_UNUSED(tb);
+#endif
}
+
+void QMainWindowLayout::syncUnifiedToolbarVisibility()
+{
+ if (blockVisiblityCheck)
+ return;
+
+ Q_ASSERT(layoutState.mainWindow->unifiedTitleAndToolBarOnMac());
+ bool show = false;
+ const int ToolBarCount = qtoolbarsInUnifiedToolbarList.count();
+ for (int i = 0; i < ToolBarCount; ++i) {
+ if (qtoolbarsInUnifiedToolbarList.at(i)->isVisible()) {
+ show = true;
+ break;
+ }
+ }
+ macWindowToolbarShow(layoutState.mainWindow, show);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h
index 26f8633..524fdbf 100644
--- a/src/gui/widgets/qmainwindowlayout_p.h
+++ b/src/gui/widgets/qmainwindowlayout_p.h
@@ -63,6 +63,7 @@
#include "QtCore/qset.h"
#include "QtCore/qbasictimer.h"
#include "private/qlayoutengine_p.h"
+#include "private/qwidgetanimator_p.h"
#include "qdockarealayout_p.h"
#include "qtoolbararealayout_p.h"
@@ -89,7 +90,6 @@ typedef const struct __CFString * CFStringRef;
QT_BEGIN_NAMESPACE
class QToolBar;
-class QWidgetAnimator;
class QRubberBand;
/* This data structure represents the state of all the tool-bars and dock-widgets. It's value based
@@ -128,9 +128,9 @@ public:
QLayoutItem *itemAt(int index, int *x) const;
QLayoutItem *takeAt(int index, int *x);
QList<int> indexOf(QWidget *widget) const;
- QLayoutItem *item(QList<int> path);
- QRect itemRect(QList<int> path) const;
- QRect gapRect(QList<int> path) const; // ### get rid of this, use itemRect() instead
+ QLayoutItem *item(const QList<int> &path);
+ QRect itemRect(const QList<int> &path) const;
+ QRect gapRect(const QList<int> &path) const; // ### get rid of this, use itemRect() instead
bool contains(QWidget *widget) const;
@@ -138,14 +138,14 @@ public:
QWidget *centralWidget() const;
QList<int> gapIndex(QWidget *widget, const QPoint &pos) const;
- bool insertGap(QList<int> path, QLayoutItem *item);
- void remove(QList<int> path);
+ bool insertGap(const QList<int> &path, QLayoutItem *item);
+ void remove(const QList<int> &path);
void remove(QLayoutItem *item);
void clear();
bool isValid() const;
- QLayoutItem *plug(QList<int> path);
- QLayoutItem *unplug(QList<int> path, QMainWindowLayoutState *savedState = 0);
+ QLayoutItem *plug(const QList<int> &path);
+ QLayoutItem *unplug(const QList<int> &path, QMainWindowLayoutState *savedState = 0);
void saveState(QDataStream &stream) const;
bool checkFormat(QDataStream &stream, bool pre43);
@@ -278,7 +278,7 @@ public:
// animations
- QWidgetAnimator *widgetAnimator;
+ QWidgetAnimator widgetAnimator;
QList<int> currentGapPos;
QRect currentGapRect;
QWidget *pluggingWidget;
@@ -295,10 +295,9 @@ public:
void applyState(QMainWindowLayoutState &newState, bool animate = true);
void restore(bool keepSavedState = false);
void updateHIToolBarStatus();
-
-private slots:
void animationFinished(QWidget *widget);
- void allAnimationsFinished();
+
+private Q_SLOTS:
#ifndef QT_NO_DOCKWIDGET
#ifndef QT_NO_TABBAR
void tabChanged();
@@ -336,6 +335,8 @@ public:
void cleanUpMacToolbarItems();
void fixSizeInUnifiedToolbar(QToolBar *tb) const;
bool useHIToolBar;
+ void syncUnifiedToolbarVisibility();
+ bool blockVisiblityCheck;
#endif
};
QT_END_NAMESPACE
diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/gui/widgets/qmdisubwindow.cpp
index 25bc724..e8de957 100644
--- a/src/gui/widgets/qmdisubwindow.cpp
+++ b/src/gui/widgets/qmdisubwindow.cpp
@@ -1066,7 +1066,7 @@ void QMdiSubWindowPrivate::createSystemMenu()
addToSystemMenu(CloseAction, QMdiSubWindow::tr("&Close"), SLOT(close()));
actions[CloseAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarCloseButton, 0, q));
#if !defined(QT_NO_SHORTCUT)
- actions[CloseAction]->setShortcut(QKeySequence::Close);
+ actions[CloseAction]->setShortcuts(QKeySequence::Close);
#endif
updateActions();
}
@@ -1946,26 +1946,21 @@ QPalette QMdiSubWindowPrivate::desktopPalette() const
colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT)));
newPalette.setColor(QPalette::Inactive, QPalette::HighlightedText,
colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT)));
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95
- && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- colorsInitialized = true;
- BOOL hasGradient;
- QT_WA({
- SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &hasGradient, 0);
- } , {
- SystemParametersInfoA(SPI_GETGRADIENTCAPTIONS, 0, &hasGradient, 0);
- });
- if (hasGradient) {
- newPalette.setColor(QPalette::Active, QPalette::Base,
- colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)));
- newPalette.setColor(QPalette::Inactive, QPalette::Base,
- colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)));
- } else {
- newPalette.setColor(QPalette::Active, QPalette::Base,
- newPalette.color(QPalette::Active, QPalette::Highlight));
- newPalette.setColor(QPalette::Inactive, QPalette::Base,
- newPalette.color(QPalette::Inactive, QPalette::Highlight));
- }
+
+ colorsInitialized = true;
+ BOOL hasGradient = false;
+ SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &hasGradient, 0);
+
+ if (hasGradient) {
+ newPalette.setColor(QPalette::Active, QPalette::Base,
+ colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)));
+ newPalette.setColor(QPalette::Inactive, QPalette::Base,
+ colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)));
+ } else {
+ newPalette.setColor(QPalette::Active, QPalette::Base,
+ newPalette.color(QPalette::Active, QPalette::Highlight));
+ newPalette.setColor(QPalette::Inactive, QPalette::Base,
+ newPalette.color(QPalette::Inactive, QPalette::Highlight));
}
}
#endif // Q_WS_WIN
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 43dc33a..b69e8bb 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -164,6 +164,12 @@ void QMenuPrivate::init()
}
}
+int QMenuPrivate::scrollerHeight() const
+{
+ Q_Q(const QMenu);
+ return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q));
+}
+
//Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't
QRect QMenuPrivate::popupGeometry(int screen) const
{
@@ -258,7 +264,6 @@ void QMenuPrivate::updateActionRects() const
//let the style modify the above size..
QStyleOptionMenuItem opt;
q->initStyleOption(&opt, action);
- opt.rect = q->rect();
const QFontMetrics &fm = opt.fontMetrics;
QSize sz;
@@ -281,10 +286,7 @@ void QMenuPrivate::updateActionRects() const
tabWidth = qMax(int(tabWidth), qfm.width(seq));
#endif
}
- int w = fm.boundingRect(QRect(), Qt::TextSingleLine, s).width();
- w -= s.count(QLatin1Char('&')) * fm.width(QLatin1Char('&'));
- w += s.count(QLatin1String("&&")) * fm.width(QLatin1Char('&'));
- sz.setWidth(w);
+ sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width());
sz.setHeight(qMax(fm.height(), qfm.height()));
QIcon is = action->icon();
@@ -484,17 +486,17 @@ void QMenuPrivate::setSyncAction()
void QMenuPrivate::setFirstActionActive()
{
Q_Q(QMenu);
- const int scrollerHeight = q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q);
+ updateActionRects();
for(int i = 0, saccum = 0; i < actions.count(); i++) {
- QAction *act = actions.at(i);
const QRect &rect = actionRects.at(i);
if (rect.isNull())
continue;
if (scroll && scroll->scrollFlags & QMenuScroller::ScrollUp) {
saccum -= rect.height();
- if (saccum > scroll->scrollOffset-scrollerHeight)
+ if (saccum > scroll->scrollOffset - scrollerHeight())
continue;
}
+ QAction *act = actions.at(i);
if (!act->isSeparator() &&
(q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)
|| act->isEnabled())) {
@@ -673,17 +675,16 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc
Q_Q(QMenu);
if (!scroll || !scroll->scrollFlags)
return;
+ updateActionRects();
int newOffset = 0;
- const int scrollHeight = q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q);
- const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollHeight : 0;
- const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollHeight : 0;
+ const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollerHeight() : 0;
+ const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollerHeight() : 0;
const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q);
const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
if (location == QMenuScroller::ScrollTop) {
for(int i = 0, saccum = 0; i < actions.count(); i++) {
- QAction *act = actions.at(i);
- if (act == action) {
+ if (actions.at(i) == action) {
newOffset = topScroll - saccum;
break;
}
@@ -691,9 +692,8 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc
}
} else {
for(int i = 0, saccum = 0; i < actions.count(); i++) {
- QAction *act = actions.at(i);
saccum += actionRects.at(i).height();
- if (act == action) {
+ if (actions.at(i) == action) {
if (location == QMenuScroller::ScrollCenter)
newOffset = ((q->height() / 2) - botScroll) - (saccum - topScroll);
else
@@ -762,9 +762,19 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc
}
//actually update flags
- scroll->scrollOffset = newOffset;
- if (scroll->scrollOffset > 0)
- scroll->scrollOffset = 0;
+ const int delta = qMin(0, newOffset) - scroll->scrollOffset; //make sure the new offset is always negative
+ if (!itemsDirty && delta) {
+ //we've scrolled so we need to update the action rects
+ for (int i = 0; i < actionRects.count(); ++i) {
+ QRect &current = actionRects[i];
+ current.moveTop(current.top() + delta);
+
+ //we need to update the widgets geometry
+ if (QWidget *w = widgetItems.at(i))
+ w->setGeometry(current);
+ }
+ }
+ scroll->scrollOffset += delta;
scroll->scrollFlags = newScrollFlags;
if (active)
setCurrentAction(action);
@@ -775,6 +785,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc
void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool active)
{
Q_Q(QMenu);
+ updateActionRects();
if(location == QMenuScroller::ScrollBottom) {
for(int i = actions.size()-1; i >= 0; --i) {
QAction *act = actions.at(i);
@@ -814,9 +825,9 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollDirection direction, bool pag
Q_Q(QMenu);
if (!scroll || !(scroll->scrollFlags & direction)) //not really possible...
return;
- const int scrollHeight = q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q);
- const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollHeight : 0;
- const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollHeight : 0;
+ updateActionRects();
+ const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollerHeight() : 0;
+ const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollerHeight() : 0;
const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q);
const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
const int offset = topScroll ? topScroll-vmargin : 0;
@@ -863,13 +874,12 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
if (scroll && !activeMenu) { //let the scroller "steal" the event
bool isScroll = false;
if (pos.x() >= 0 && pos.x() < q->width()) {
- const int scrollerHeight = q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q);
for(int dir = QMenuScroller::ScrollUp; dir <= QMenuScroller::ScrollDown; dir = dir << 1) {
if (scroll->scrollFlags & dir) {
if (dir == QMenuScroller::ScrollUp)
- isScroll = (pos.y() <= scrollerHeight);
+ isScroll = (pos.y() <= scrollerHeight());
else if (dir == QMenuScroller::ScrollDown)
- isScroll = (pos.y() >= q->height()-scrollerHeight);
+ isScroll = (pos.y() >= q->height() - scrollerHeight());
if (isScroll) {
scroll->scrollDirection = dir;
break;
@@ -878,19 +888,17 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
}
}
if (isScroll) {
- if (!scroll->scrollTimer)
- scroll->scrollTimer = new QBasicTimer;
- scroll->scrollTimer->start(50, q);
+ scroll->scrollTimer.start(50, q);
return true;
- } else if (scroll->scrollTimer && scroll->scrollTimer->isActive()) {
- scroll->scrollTimer->stop();
+ } else {
+ scroll->scrollTimer.stop();
}
}
if (tearoff) { //let the tear off thingie "steal" the event..
QRect tearRect(0, 0, q->width(), q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, q));
if (scroll && scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
- tearRect.translate(0, q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q));
+ tearRect.translate(0, scrollerHeight());
q->update(tearRect);
if (tearRect.contains(pos) && hasMouseMoved(e->globalPos())) {
setCurrentAction(0);
@@ -1351,8 +1359,7 @@ QMenu::~QMenu()
if (d->eventLoop)
d->eventLoop->exit();
- if (d->tornPopup)
- d->tornPopup->close();
+ hideTearOffMenu();
}
/*!
@@ -1563,8 +1570,8 @@ void QMenu::setTearOffEnabled(bool b)
Q_D(QMenu);
if (d->tearoff == b)
return;
- if (!b && d->tornPopup)
- d->tornPopup->close();
+ if (!b)
+ hideTearOffMenu();
d->tearoff = b;
d->itemsDirty = true;
@@ -1599,8 +1606,8 @@ bool QMenu::isTearOffMenuVisible() const
*/
void QMenu::hideTearOffMenu()
{
- if (d_func()->tornPopup)
- d_func()->tornPopup->close();
+ if (QWidget *w = d_func()->tornPopup)
+ w->close();
}
@@ -1715,8 +1722,6 @@ QSize QMenu::sizeHint() const
if (rect.right() >= s.width())
s.setWidth(rect.x() + rect.width());
}
- if (d->tearoff)
- s.rheight() += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, this);
// Note that the action rects calculated above already include
// the top and left margins, so we only need to add margins for
// the bottom and right.
@@ -2076,6 +2081,8 @@ void QMenu::hideEvent(QHideEvent *)
d->hasHadMouse = false;
d->causedPopup.widget = 0;
d->causedPopup.action = 0;
+ if (d->scroll)
+ d->scroll->scrollTimer.stop(); //make sure the timer stops
}
/*!
@@ -2084,6 +2091,7 @@ void QMenu::hideEvent(QHideEvent *)
void QMenu::paintEvent(QPaintEvent *e)
{
Q_D(QMenu);
+ d->updateActionRects();
QPainter p(this);
QRegion emptyArea = QRegion(rect());
@@ -2116,18 +2124,17 @@ void QMenu::paintEvent(QPaintEvent *e)
const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
//draw the scroller regions..
if (d->scroll) {
- const int scrollerHeight = style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, this);
menuOpt.menuItemType = QStyleOptionMenuItem::Scroller;
menuOpt.state |= QStyle::State_Enabled;
if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) {
- menuOpt.rect.setRect(fw, fw, width() - (fw * 2), scrollerHeight);
+ menuOpt.rect.setRect(fw, fw, width() - (fw * 2), d->scrollerHeight());
emptyArea -= QRegion(menuOpt.rect);
p.setClipRect(menuOpt.rect);
style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, &p, this);
}
if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) {
- menuOpt.rect.setRect(fw, height() - scrollerHeight - fw, width() - (fw * 2),
- scrollerHeight);
+ menuOpt.rect.setRect(fw, height() - d->scrollerHeight() - fw, width() - (fw * 2),
+ d->scrollerHeight());
emptyArea -= QRegion(menuOpt.rect);
menuOpt.state |= QStyle::State_DownArrow;
p.setClipRect(menuOpt.rect);
@@ -2140,7 +2147,7 @@ void QMenu::paintEvent(QPaintEvent *e)
menuOpt.rect.setRect(fw, fw, width() - (fw * 2),
style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this));
if (d->scroll && d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
- menuOpt.rect.translate(0, style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, this));
+ menuOpt.rect.translate(0, d->scrollerHeight());
emptyArea -= QRegion(menuOpt.rect);
p.setClipRect(menuOpt.rect);
menuOpt.state = QStyle::State_None;
@@ -2370,6 +2377,7 @@ bool QMenu::focusNextPrevChild(bool next)
void QMenu::keyPressEvent(QKeyEvent *e)
{
Q_D(QMenu);
+ d->updateActionRects();
int key = e->key();
if (isRightToLeft()) { // in reverse mode open/close key for submenues are reversed
if (key == Qt::Key_Left)
@@ -2469,7 +2477,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
continue;
nextAction = next;
if (d->scroll && (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)) {
- int topVisible = style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, this);
+ int topVisible = d->scrollerHeight();
if (d->tearoff)
topVisible += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this);
if (((y + d->scroll->scrollOffset) - topVisible) <= d->actionRects.at(next_i).height())
@@ -2500,10 +2508,9 @@ void QMenu::keyPressEvent(QKeyEvent *e)
continue;
nextAction = next;
if (d->scroll && (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown)) {
- const int scrollerHeight = style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, this);
- int bottomVisible = height()-scrollerHeight;
+ int bottomVisible = height() - d->scrollerHeight();
if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
- bottomVisible -= scrollerHeight;
+ bottomVisible -= d->scrollerHeight();
if (d->tearoff)
bottomVisible -= style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this);
if ((y + d->scroll->scrollOffset + d->actionRects.at(next_i).height()) > bottomVisible)
@@ -2519,8 +2526,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
}
if (nextAction) {
if (d->scroll && scroll_loc != QMenuPrivate::QMenuScroller::ScrollStay) {
- if (d->scroll->scrollTimer)
- d->scroll->scrollTimer->stop();
+ d->scroll->scrollTimer.stop();
d->scrollMenu(nextAction, scroll_loc);
}
d->setCurrentAction(nextAction, /*popup*/-1, QMenuPrivate::SelectedFromKeyboard);
@@ -2782,10 +2788,10 @@ void
QMenu::timerEvent(QTimerEvent *e)
{
Q_D(QMenu);
- if (d->scroll && d->scroll->scrollTimer && d->scroll->scrollTimer->timerId() == e->timerId()) {
+ if (d->scroll && d->scroll->scrollTimer.timerId() == e->timerId()) {
d->scrollMenu((QMenuPrivate::QMenuScroller::ScrollDirection)d->scroll->scrollDirection);
if (d->scroll->scrollFlags == QMenuPrivate::QMenuScroller::ScrollNone)
- d->scroll->scrollTimer->stop();
+ d->scroll->scrollTimer.stop();
} else if(QMenuPrivate::menuDelayTimer.timerId() == e->timerId()) {
QMenuPrivate::menuDelayTimer.stop();
internalDelayedPopup();
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 77e98c4..87f6f82 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -1376,8 +1376,9 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action)
accel = qt_mac_menu_merge_accel(action);
}
}
+ // Show multiple key sequences as part of the menu text.
if (accel.count() > 1)
- text += QLatin1String(" (****)"); //just to denote a multi stroke shortcut
+ text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")");
QString finalString = qt_mac_removeMnemonics(text);
@@ -1459,14 +1460,15 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action)
data.whichData |= kMenuItemDataCmdKey;
data.whichData |= kMenuItemDataCmdKeyModifiers;
data.whichData |= kMenuItemDataCmdKeyGlyph;
- if (!accel.isEmpty()) {
+ if (accel.count() == 1) {
qt_mac_get_accel(accel[0], (quint32*)&data.cmdKeyModifiers, (quint32*)&data.cmdKeyGlyph);
if (data.cmdKeyGlyph == 0)
data.cmdKey = (UniChar)accel[0];
}
#else
[item setSubmenu:0];
- if (!accel.isEmpty()) {
+ // No key equivalent set for multiple key QKeySequence.
+ if (accel.count() == 1) {
[item setKeyEquivalent:keySequenceToKeyEqivalent(accel)];
[item setKeyEquivalentModifierMask:keySequenceModifierMask(accel)];
} else {
diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h
index d9ad422..355ecb4 100644
--- a/src/gui/widgets/qmenu_p.h
+++ b/src/gui/widgets/qmenu_p.h
@@ -170,6 +170,8 @@ public:
}
void init();
+ int scrollerHeight() const;
+
//item calculations
mutable uint itemsDirty : 1;
mutable uint maxIconWidth, tabWidth;
@@ -208,10 +210,10 @@ public:
enum ScrollDirection { ScrollNone=0, ScrollUp=0x01, ScrollDown=0x02 };
uint scrollFlags : 2, scrollDirection : 2;
int scrollOffset;
- QBasicTimer *scrollTimer;
+ QBasicTimer scrollTimer;
- QMenuScroller() : scrollFlags(ScrollNone), scrollDirection(ScrollNone), scrollOffset(0), scrollTimer(0) { }
- ~QMenuScroller() { delete scrollTimer; }
+ QMenuScroller() : scrollFlags(ScrollNone), scrollDirection(ScrollNone), scrollOffset(0) { }
+ ~QMenuScroller() { }
} *scroll;
void scrollMenu(QMenuScroller::ScrollLocation location, bool active=false);
void scrollMenu(QMenuScroller::ScrollDirection direction, bool page=false, bool active=false);
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 4607fc3..bb1dd29 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -218,7 +218,7 @@ void QMenuBarPrivate::updateGeometries()
bool hasHiddenActions = false;
for (int i = 0; i < actions.count(); ++i) {
const QRect &rect = actionRects.at(i);
- if (!menuRect.contains(rect)) {
+ if (rect.isValid() && !menuRect.contains(rect)) {
hasHiddenActions = true;
break;
}
@@ -229,7 +229,7 @@ void QMenuBarPrivate::updateGeometries()
menuRect = this->menuRect(true);
for (int i = 0; i < actions.count(); ++i) {
const QRect &rect = actionRects.at(i);
- if (!menuRect.contains(rect)) {
+ if (rect.isValid() && !menuRect.contains(rect)) {
hiddenActions.append(actions.at(i));
}
}
@@ -279,6 +279,7 @@ QRect QMenuBarPrivate::actionRect(QAction *act) const
void QMenuBarPrivate::focusFirstAction()
{
if(!currentAction) {
+ updateGeometries();
int index = 0;
while (index < actions.count() && actionRects.at(index).isNull()) ++index;
if (index < actions.count())
@@ -446,10 +447,7 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const
} else {
const QString s = action->text();
if(!s.isEmpty()) {
- const int w = fm.width(s)
- - s.count(QLatin1Char('&')) * fm.width(QLatin1Char('&'))
- + s.count(QLatin1String("&&")) * fm.width(QLatin1Char('&'));
- sz = QSize(w, fm.height());
+ sz = fm.size(Qt::TextShowMnemonic, s);
}
QIcon is = action->icon();
@@ -764,6 +762,7 @@ void QMenuBarPrivate::init()
QAction *QMenuBarPrivate::getNextAction(const int _start, const int increment) const
{
Q_Q(const QMenuBar);
+ const_cast<QMenuBarPrivate*>(this)->updateGeometries();
bool allowActiveAndDisabled = q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q);
const int start = (_start == -1 && increment == -1) ? actions.count() : _start;
const int end = increment == -1 ? 0 : actions.count() - 1;
@@ -964,6 +963,13 @@ void QMenuBar::setActiveAction(QAction *act)
/*!
Removes all the actions from the menu bar.
+ \note On Mac OS X, menu items that have been merged to the system
+ menu bar are not removed by this function. One way to handle this
+ would be to remove the extra actions yourself. You can set the
+ \l{QAction::MenuRole}{menu role} on the different menus, so that
+ you know ahead of time which menu items get merged and which do
+ not. Then decide what to recreate or remove yourself.
+
\sa removeAction()
*/
void QMenuBar::clear()
@@ -1140,6 +1146,7 @@ void QMenuBar::mouseReleaseEvent(QMouseEvent *e)
void QMenuBar::keyPressEvent(QKeyEvent *e)
{
Q_D(QMenuBar);
+ d->updateGeometries();
int key = e->key();
if(isRightToLeft()) { // in reverse mode open/close key for submenues are reversed
if(key == Qt::Key_Left)
@@ -1630,6 +1637,7 @@ QSize QMenuBar::minimumSizeHint() const
ensurePolished();
QSize ret(0, 0);
+ const_cast<QMenuBarPrivate*>(d)->updateGeometries();
const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, this);
const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this);
int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this);
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index c2ef5e4..7d9d2b5 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -66,6 +66,8 @@
#include <qtexttable.h>
#include <qvariant.h>
+#include <qstandardgestures.h>
+
#include <qinputcontext.h>
#ifndef QT_NO_TEXTEDIT
@@ -255,7 +257,7 @@ QPlainTextDocumentLayoutPrivate *QPlainTextDocumentLayout::priv() const
*/
void QPlainTextDocumentLayout::requestUpdate()
{
- emit update(QRectF(0., -4., 1000000000., 1000000000.));
+ emit update(QRectF(0., -document()->documentMargin(), 1000000000., 1000000000.));
}
@@ -350,8 +352,7 @@ void QPlainTextDocumentLayout::documentChanged(int from, int /*charsRemoved*/, i
}
if (!d->blockUpdate)
- emit update(); // optimization potential
-
+ emit update(QRectF(0., -doc->documentMargin(), 1000000000., 1000000000.)); // optimization potential
}
@@ -732,6 +733,9 @@ QPlainTextEditPrivate::QPlainTextEditPrivate()
backgroundVisible = false;
centerOnScroll = false;
inDrag = false;
+#ifdef Q_WS_WIN
+ singleFingerPanEnabled = true;
+#endif
}
@@ -787,6 +791,9 @@ void QPlainTextEditPrivate::init(const QString &txt)
#ifndef QT_NO_CURSOR
viewport->setCursor(Qt::IBeamCursor);
#endif
+ originalOffsetY = 0;
+ panGesture = new QPanGesture(q);
+ QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered()));
}
void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect)
@@ -2915,6 +2922,30 @@ QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() cons
(\a available is true) or unavailable (\a available is false).
*/
+void QPlainTextEditPrivate::_q_gestureTriggered()
+{
+ Q_Q(QPlainTextEdit);
+ QPanGesture *g = qobject_cast<QPanGesture*>(q->sender());
+ if (!g)
+ return;
+ QScrollBar *hBar = q->horizontalScrollBar();
+ QScrollBar *vBar = q->verticalScrollBar();
+ if (g->state() == Qt::GestureStarted)
+ originalOffsetY = vBar->value();
+ QSize totalOffset = g->totalOffset();
+ if (!totalOffset.isNull()) {
+ if (QApplication::isRightToLeft())
+ totalOffset.rwidth() *= -1;
+ // QPlainTextEdit scrolls by lines only in vertical direction
+ QFontMetrics fm(q->document()->defaultFont());
+ int lineHeight = fm.height();
+ int newX = hBar->value() - g->lastOffset().width();
+ int newY = originalOffsetY - totalOffset.height()/lineHeight;
+ hbar->setValue(newX);
+ vbar->setValue(newY);
+ }
+}
+
QT_END_NAMESPACE
#include "moc_qplaintextedit.cpp"
diff --git a/src/gui/widgets/qplaintextedit.h b/src/gui/widgets/qplaintextedit.h
index dc0851b..35bbc37 100644
--- a/src/gui/widgets/qplaintextedit.h
+++ b/src/gui/widgets/qplaintextedit.h
@@ -269,6 +269,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars())
Q_PRIVATE_SLOT(d_func(), void _q_verticalScrollbarActionTriggered(int))
Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged())
+ Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered())
friend class QPlainTextEditControl;
};
diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h
index 851702d..739fd89 100644
--- a/src/gui/widgets/qplaintextedit_p.h
+++ b/src/gui/widgets/qplaintextedit_p.h
@@ -72,6 +72,7 @@ class QMimeData;
class QPlainTextEdit;
class ExtraArea;
+class QPanGesture;
class QPlainTextEditControl : public QTextControl
{
@@ -177,6 +178,10 @@ public:
void _q_cursorPositionChanged();
void _q_modificationChanged(bool);
+
+ void _q_gestureTriggered();
+ int originalOffsetY;
+ QPanGesture *panGesture;
};
QT_END_NAMESPACE
diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp
index ac3338b..6593cd6 100644
--- a/src/gui/widgets/qprogressbar.cpp
+++ b/src/gui/widgets/qprogressbar.cpp
@@ -204,7 +204,7 @@ bool QProgressBarPrivate::repaintRequired() const
\o A progress bar shown in the Plastique widget style.
\endtable
- \sa QTimeLine, QProgressDialog, {fowler}{GUI Design Handbook: Progress Indicator}
+ \sa QProgressDialog, {fowler}{GUI Design Handbook: Progress Indicator}
*/
/*!
@@ -443,11 +443,11 @@ QSize QProgressBar::minimumSizeHint() const
QString QProgressBar::text() const
{
Q_D(const QProgressBar);
- if (d->maximum == 0 || d->value < d->minimum
+ if ((d->maximum == 0 && d->minimum == 0) || d->value < d->minimum
|| (d->value == INT_MIN && d->minimum == INT_MIN))
return QString();
- qint64 totalSteps = qint64(d->maximum) - qint64(d->minimum);
+ qint64 totalSteps = qint64(d->maximum) - d->minimum;
QString result = d->format;
result.replace(QLatin1String("%m"), QString::number(totalSteps));
@@ -461,7 +461,7 @@ QString QProgressBar::text() const
return result;
}
- int progress = int(((qreal(d->value) - qreal(d->minimum)) * 100.0) / totalSteps);
+ int progress = (qreal(d->value) - d->minimum) * 100.0 / totalSteps;
result.replace(QLatin1String("%p"), QString::number(progress));
return result;
}
diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp
index d263b9c..c6aae68 100644
--- a/src/gui/widgets/qsizegrip.cpp
+++ b/src/gui/widgets/qsizegrip.cpp
@@ -335,8 +335,7 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e)
orientation = d->atLeft() ? SZ_SIZETOPLEFT : SZ_SIZETOPRIGHT;
ReleaseCapture();
- QT_WA_INLINE(PostMessageW(tlw->winId(), WM_SYSCOMMAND, orientation, 0),
- PostMessageA(tlw->winId(), WM_SYSCOMMAND, orientation, 0));
+ PostMessage(tlw->winId(), WM_SYSCOMMAND, orientation, 0);
return;
}
#endif // Q_WS_WIN
diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp
index 9ec21d6..193b15c 100644
--- a/src/gui/widgets/qspinbox.cpp
+++ b/src/gui/widgets/qspinbox.cpp
@@ -50,6 +50,7 @@
#include <qdebug.h>
#include <math.h>
+#include <float.h>
QT_BEGIN_NAMESPACE
@@ -832,8 +833,8 @@ void QDoubleSpinBox::setRange(double minimum, double maximum)
Sets how many decimals the spinbox will use for displaying and
interpreting doubles.
- \warning The results might not be reliable with very high values
- for \a decimals.
+ \warning The maximum value for \a decimals is DBL_MAX_10_EXP +
+ DBL_DIG (ie. 323) because of the limitations of the double type.
Note: The maximum, minimum and value might change as a result of
changing this property.
@@ -849,7 +850,7 @@ int QDoubleSpinBox::decimals() const
void QDoubleSpinBox::setDecimals(int decimals)
{
Q_D(QDoubleSpinBox);
- d->decimals = qMax(0, decimals);
+ d->decimals = qBound(0, decimals, DBL_MAX_10_EXP + DBL_DIG);
setRange(minimum(), maximum()); // make sure values are rounded
setValue(value());
@@ -1214,7 +1215,7 @@ bool QDoubleSpinBoxPrivate::isIntermediateValue(const QString &str) const
return false;
}
if (doright) {
- QSBDEBUG("match %lld min_left %lld max_left %lld", match, min_left, max_left);
+ QSBDEBUG() << "match" << match << "min_left" << min_left << "max_left" << max_left;
if (!doleft) {
if (min_left == max_left) {
const bool ret = isIntermediateValueHelper(qAbs(left),
@@ -1481,7 +1482,7 @@ QString QDoubleSpinBoxPrivate::textFromValue(const QVariant &f) const
static bool isIntermediateValueHelper(qint64 num, qint64 min, qint64 max, qint64 *match)
{
- QSBDEBUG("%lld %lld %lld", num, min, max);
+ QSBDEBUG() << num << min << max;
if (num >= min && num <= max) {
if (match)
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 11cb6a1..690e624 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -663,7 +663,7 @@ void QTabBarPrivate::refresh()
if (pressedIndex != -1
&& movable
&& QApplication::mouseButtons() == Qt::NoButton) {
- _q_moveTabFinished(pressedIndex);
+ moveTabFinished(pressedIndex);
if (!validIndex(pressedIndex))
pressedIndex = -1;
}
@@ -1662,26 +1662,17 @@ void QTabBarPrivate::slide(int from, int to)
q->setUpdatesEnabled(true);
int postLocation = vertical ? q->tabRect(to).y() : q->tabRect(to).x();
int length = postLocation - preLocation;
- tabList[to].makeTimeLine(q);
- tabList[to].dragOffset += -1 * length;
- tabList[to].timeLine->setFrameRange(tabList[to].dragOffset, 0);
- animations[tabList[to].timeLine] = to;
- tabList[to].timeLine->setDuration(ANIMATION_DURATION);
- if (tabList[to].timeLine->state() != QTimeLine::Running)
- tabList[to].timeLine->start();
+ tabList[to].dragOffset -= length;
+ tabList[to].startAnimation(this, ANIMATION_DURATION);
}
-void QTabBarPrivate::_q_moveTab(int offset)
+void QTabBarPrivate::moveTab(int index, int offset)
{
- Q_Q(QTabBar);
- if (QTimeLine *timeLine = qobject_cast<QTimeLine *>(q->sender())) {
- int index = animations[timeLine];
- if (!validIndex(index))
- return;
- tabList[index].dragOffset = offset;
- layoutTab(index); // Make buttons follow tab
- q->update();
- }
+ if (!validIndex(index))
+ return;
+ tabList[index].dragOffset = offset;
+ layoutTab(index); // Make buttons follow tab
+ q_func()->update();
}
/*!\reimp
@@ -1695,7 +1686,7 @@ void QTabBar::mousePressEvent(QMouseEvent *event)
}
// Be safe!
if (d->pressedIndex != -1 && d->movable)
- d->_q_moveTabFinished(d->pressedIndex);
+ d->moveTabFinished(d->pressedIndex);
d->pressedIndex = d->indexAtPos(event->pos());
if (d->validIndex(d->pressedIndex)) {
@@ -1721,7 +1712,7 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
// Be safe!
if (d->pressedIndex != -1
&& event->buttons() == Qt::NoButton)
- d->_q_moveTabFinished(d->pressedIndex);
+ d->moveTabFinished(d->pressedIndex);
// Start drag
if (!d->dragInProgress && d->pressedIndex != -1) {
@@ -1789,16 +1780,6 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
optTabBase.documentMode = d->documentMode;
}
-void QTabBarPrivate::_q_moveTabFinished()
-{
- Q_Q(QTabBar);
- if (QTimeLine *timeLine = qobject_cast<QTimeLine *>(q->sender())) {
- int index = animations[timeLine];
- animations.remove(timeLine);
- _q_moveTabFinished(index);
- }
-}
-
void QTabBarPrivate::setupMovableTab()
{
Q_Q(QTabBar);
@@ -1838,11 +1819,19 @@ void QTabBarPrivate::setupMovableTab()
movingTab->setVisible(true);
}
-void QTabBarPrivate::_q_moveTabFinished(int index)
+void QTabBarPrivate::moveTabFinished(int index)
{
Q_Q(QTabBar);
bool cleanup = (pressedIndex == index) || (pressedIndex == -1) || !validIndex(index);
- if (animations.isEmpty() && cleanup) {
+ bool allAnimationsFinished = true;
+#ifndef QT_NO_ANIMATION
+ for(int i = 0; allAnimationsFinished && i < tabList.count(); ++i) {
+ const Tab &t = tabList.at(i);
+ if (t.animation && t.animation->state() == QAbstractAnimation::Running)
+ allAnimationsFinished = false;
+ }
+#endif //QT_NO_ANIMATION
+ if (allAnimationsFinished && cleanup) {
movingTab->setVisible(false); // We might not get a mouse release
for (int i = 0; i < tabList.count(); ++i) {
tabList[i].dragOffset = 0;
@@ -1877,17 +1866,8 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event)
? tabRect(d->pressedIndex).height()
: tabRect(d->pressedIndex).width();
int duration = qMin(ANIMATION_DURATION,
- ((length < 0 ? (-1 * length) : length) * ANIMATION_DURATION) / width);
- if (duration > 0) {
- d->tabList[d->pressedIndex].makeTimeLine(this);
- d->tabList[d->pressedIndex].timeLine->setFrameRange(length, 0);
- d->animations[d->tabList[d->pressedIndex].timeLine] = d->pressedIndex;
- d->tabList[d->pressedIndex].timeLine->setDuration(duration);
- if (d->tabList[d->pressedIndex].timeLine->state() != QTimeLine::Running)
- d->tabList[d->pressedIndex].timeLine->start();
- } else {
- d->_q_moveTabFinished(d->pressedIndex);
- }
+ (qAbs(length) * ANIMATION_DURATION) / width);
+ d->tabList[d->pressedIndex].startAnimation(d, duration);
d->dragInProgress = false;
d->movingTab->setVisible(false);
d->dragStartPosition = QPoint();
diff --git a/src/gui/widgets/qtabbar.h b/src/gui/widgets/qtabbar.h
index 7514486..402f54b 100644
--- a/src/gui/widgets/qtabbar.h
+++ b/src/gui/widgets/qtabbar.h
@@ -215,8 +215,6 @@ private:
Q_DECLARE_PRIVATE(QTabBar)
Q_PRIVATE_SLOT(d_func(), void _q_scrollTabs())
Q_PRIVATE_SLOT(d_func(), void _q_closeTab())
- Q_PRIVATE_SLOT(d_func(), void _q_moveTab(int))
- Q_PRIVATE_SLOT(d_func(), void _q_moveTabFinished())
};
#endif // QT_NO_TABBAR
diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h
index dbae055..b9b9fba 100644
--- a/src/gui/widgets/qtabbar_p.h
+++ b/src/gui/widgets/qtabbar_p.h
@@ -58,9 +58,8 @@
#include <qicon.h>
#include <qtoolbutton.h>
-#include <qtimeline.h>
-#include <qhash.h>
#include <qdebug.h>
+#include <qvariantanimation.h>
#ifndef QT_NO_TABBAR
@@ -75,9 +74,10 @@ class QTabBarPrivate : public QWidgetPrivate
Q_DECLARE_PUBLIC(QTabBar)
public:
QTabBarPrivate()
- :currentIndex(-1), pressedIndex(-1),
- shape(QTabBar::RoundedNorth),
- layoutDirty(false), drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), movingTab(0) {}
+ :currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false),
+ drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false),
+ selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false),
+ dragInProgress(false), documentMode(false), movingTab(0) {}
int currentIndex;
int pressedIndex;
@@ -88,16 +88,13 @@ public:
struct Tab {
inline Tab(const QIcon &ico, const QString &txt)
- : enabled(true)
- , shortcutId(0)
- , text(txt)
- , icon(ico)
- , leftWidget(0)
- , rightWidget(0)
- , lastTab(-1)
- , timeLine(0)
- , dragOffset(0)
+ : enabled(true) , shortcutId(0), text(txt), icon(ico),
+ leftWidget(0), rightWidget(0), lastTab(-1), dragOffset(0)
+#ifndef QT_NO_ANIMATION
+ , animation(0)
+#endif //QT_NO_ANIMATION
{}
+ bool operator==(const Tab &other) const { return &other == this; }
bool enabled;
int shortcutId;
QString text;
@@ -117,21 +114,39 @@ public:
QWidget *leftWidget;
QWidget *rightWidget;
int lastTab;
-
- QTimeLine *timeLine;
int dragOffset;
- void makeTimeLine(QWidget *q) {
- if (timeLine)
- return;
- timeLine = new QTimeLine(ANIMATION_DURATION, q);
- q->connect(timeLine, SIGNAL(frameChanged(int)), q, SLOT(_q_moveTab(int)));
- q->connect(timeLine, SIGNAL(finished()), q, SLOT(_q_moveTabFinished()));
+#ifndef QT_NO_ANIMATION
+ ~Tab() { delete animation; }
+ struct TabBarAnimation : public QVariantAnimation {
+ TabBarAnimation(Tab *t, QTabBarPrivate *_priv) : tab(t), priv(_priv)
+ { setEasingCurve(QEasingCurve::InOutQuad); }
+
+ void updateCurrentValue(const QVariant &current)
+ { priv->moveTab(priv->tabList.indexOf(*tab), current.toInt()); }
+
+ void updateState(State, State newState)
+ { if (newState == Stopped) priv->moveTabFinished(priv->tabList.indexOf(*tab)); }
+ private:
+ //these are needed for the callbacks
+ Tab *tab;
+ QTabBarPrivate *priv;
+ } *animation;
+
+ void startAnimation(QTabBarPrivate *priv, int duration) {
+ if (!animation)
+ animation = new TabBarAnimation(this, priv);
+ animation->setStartValue(dragOffset);
+ animation->setEndValue(0);
+ animation->setDuration(duration);
+ animation->start();
}
-
+#else
+ void startAnimation(QTabBarPrivate *priv, int duration)
+ { Q_UNUSED(duration); priv->moveTabFinished(priv->tabList.indexOf(*this)); }
+#endif //QT_NO_ANIMATION
};
QList<Tab> tabList;
- QHash<QTimeLine*, int> animations;
int calculateNewPosition(int from, int to, int index) const;
void slide(int from, int to);
@@ -152,9 +167,8 @@ public:
void _q_scrollTabs();
void _q_closeTab();
- void _q_moveTab(int);
- void _q_moveTabFinished();
- void _q_moveTabFinished(int offset);
+ void moveTab(int index, int offset);
+ void moveTabFinished(int index);
QRect hoverRect;
void refresh();
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 3bac94b..2de661a 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -67,6 +67,8 @@
#include <qtexttable.h>
#include <qvariant.h>
+#include <qstandardgestures.h>
+
#include <qinputcontext.h>
#endif
@@ -116,6 +118,9 @@ QTextEditPrivate::QTextEditPrivate()
preferRichText = false;
showCursorOnInitialShow = true;
inDrag = false;
+#ifdef Q_WS_WIN
+ singleFingerPanEnabled = true;
+#endif
}
void QTextEditPrivate::createAutoBulletList()
@@ -183,6 +188,8 @@ void QTextEditPrivate::init(const QString &html)
#ifndef QT_NO_CURSOR
viewport->setCursor(Qt::IBeamCursor);
#endif
+ panGesture = new QPanGesture(q);
+ QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered()));
}
void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect)
@@ -2624,6 +2631,25 @@ void QTextEdit::ensureCursorVisible()
d->control->ensureCursorVisible();
}
+void QTextEditPrivate::_q_gestureTriggered()
+{
+ Q_Q(QTextEdit);
+ QPanGesture *g = qobject_cast<QPanGesture*>(q->sender());
+ if (!g)
+ return;
+ QScrollBar *hBar = q->horizontalScrollBar();
+ QScrollBar *vBar = q->verticalScrollBar();
+ QPoint delta = g->pos() - (g->lastPos().isNull() ? g->pos() : g->lastPos());
+ if (!delta.isNull()) {
+ if (QApplication::isRightToLeft())
+ delta.rx() *= -1;
+ int newX = hBar->value() - delta.x();
+ int newY = vBar->value() - delta.y();
+ hbar->setValue(newX);
+ vbar->setValue(newY);
+ }
+}
+
/*!
\enum QTextEdit::KeyboardAction
diff --git a/src/gui/widgets/qtextedit.h b/src/gui/widgets/qtextedit.h
index 617822a..9e10e07 100644
--- a/src/gui/widgets/qtextedit.h
+++ b/src/gui/widgets/qtextedit.h
@@ -414,6 +414,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_currentCharFormatChanged(const QTextCharFormat &))
Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars())
Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &))
+ Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered())
friend class QTextEditControl;
friend class QTextDocument;
friend class QTextControl;
diff --git a/src/gui/widgets/qtextedit_p.h b/src/gui/widgets/qtextedit_p.h
index 75e7a35..cf87a86 100644
--- a/src/gui/widgets/qtextedit_p.h
+++ b/src/gui/widgets/qtextedit_p.h
@@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTEDIT
class QMimeData;
-
+class QPanGesture;
class QTextEditPrivate : public QAbstractScrollAreaPrivate
{
Q_DECLARE_PUBLIC(QTextEdit)
@@ -130,6 +130,9 @@ public:
QString anchorToScrollToWhenVisible;
+ void _q_gestureTriggered();
+ QPanGesture *panGesture;
+
#ifdef QT_KEYPAD_NAVIGATION
QBasicTimer deleteAllTimer;
#endif
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index b635628..426c3e1 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -70,6 +70,8 @@
#include "qdebug.h"
+#define POPUP_TIMER_INTERVAL 500
+
QT_BEGIN_NAMESPACE
#ifdef Q_WS_MAC
@@ -87,14 +89,6 @@ static void qt_mac_updateToolBarButtonHint(QWidget *parentWidget)
void QToolBarPrivate::init()
{
Q_Q(QToolBar);
-
- waitForPopupTimer = new QTimer(q);
- waitForPopupTimer->setSingleShot(false);
- waitForPopupTimer->setInterval(500);
- QObject::connect(waitForPopupTimer, SIGNAL(timeout()), q, SLOT(_q_waitForPopup()));
-
- floatable = true;
- movable = true;
q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
q->setBackgroundRole(QPalette::Button);
q->setAttribute(Qt::WA_Hover);
@@ -880,7 +874,7 @@ QAction *QToolBar::insertSeparator(QAction *before)
If you add a QToolButton with this method, the tools bar's
Qt::ToolButtonStyle will not be respected.
- Note: You should use QAction::setVisible() to change the
+ \note You should use QAction::setVisible() to change the
visibility of the widget. Using QWidget::setVisible(),
QWidget::show() and QWidget::hide() does not work.
@@ -1080,19 +1074,46 @@ static bool waitForPopup(QToolBar *tb, QWidget *popup)
return false;
}
+#if defined(Q_WS_MAC)
+static bool toolbarInUnifiedToolBar(QToolBar *toolbar)
+{
+ const QMainWindow *mainWindow = qobject_cast<const QMainWindow *>(toolbar->parentWidget());
+ return mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()
+ && mainWindow->toolBarArea(toolbar) == Qt::TopToolBarArea;
+}
+#endif
+
/*! \reimp */
bool QToolBar::event(QEvent *event)
{
Q_D(QToolBar);
switch (event->type()) {
+ case QEvent::Timer:
+ if (d->waitForPopupTimer.timerId() == static_cast<QTimerEvent*>(event)->timerId()) {
+ QWidget *w = QApplication::activePopupWidget();
+ if (!waitForPopup(this, w)) {
+ d->waitForPopupTimer.stop();
+ if (!this->underMouse())
+ d->layout->setExpanded(false);
+ }
+ }
+ break;
case QEvent::Hide:
if (!isHidden())
break;
// fallthrough intended
case QEvent::Show:
d->toggleViewAction->setChecked(event->type() == QEvent::Show);
-#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
+#if defined(Q_WS_MAC)
+ if (toolbarInUnifiedToolBar(this)) {
+ // I can static_cast because I did the qobject_cast in the if above, therefore
+ // we must have a QMainWindowLayout here.
+ QMainWindowLayout *mwLayout = static_cast<QMainWindowLayout *>(parentWidget()->layout());
+ mwLayout->fixSizeInUnifiedToolbar(this);
+ mwLayout->syncUnifiedToolbarVisibility();
+ }
+# if !defined(QT_MAC_USE_COCOA)
// Fall through
case QEvent::LayoutRequest: {
// There's currently no way to invalidate the size and let
@@ -1107,10 +1128,9 @@ bool QToolBar::event(QEvent *event)
}
if (needUpdate) {
- OSWindowRef windowRef = qt_mac_window_for(this);
- if (mainWindow->unifiedTitleAndToolBarOnMac()
- && mainWindow->toolBarArea(this) == Qt::TopToolBarArea
- && macWindowToolbarVisible(windowRef)) {
+ OSWindowRef windowRef = qt_mac_window_for(mainWindow);
+ if (toolbarInUnifiedToolBar(this)
+ && macWindowToolbarIsVisible(windowRef)) {
DisableScreenUpdates();
macWindowToolbarShow(this, false);
macWindowToolbarShow(this, true);
@@ -1122,7 +1142,8 @@ bool QToolBar::event(QEvent *event)
return earlyResult;
}
}
-#endif
+# endif // !QT_MAC_USE_COCOA
+#endif // Q_WS_MAC
break;
case QEvent::ParentChange:
d->layout->checkUsePopupMenu();
@@ -1141,6 +1162,10 @@ bool QToolBar::event(QEvent *event)
if (d->mouseReleaseEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
+ case QEvent::HoverEnter:
+ case QEvent::HoverLeave:
+ // there's nothing special to do here and we don't want to update the whole widget
+ return true;
case QEvent::HoverMove: {
#ifndef QT_NO_CURSOR
QHoverEvent *e = static_cast<QHoverEvent*>(event);
@@ -1183,11 +1208,11 @@ bool QToolBar::event(QEvent *event)
QWidget *w = QApplication::activePopupWidget();
if (waitForPopup(this, w)) {
- d->waitForPopupTimer->start();
+ d->waitForPopupTimer.start(POPUP_TIMER_INTERVAL, this);
break;
}
- d->waitForPopupTimer->stop();
+ d->waitForPopupTimer.stop();
d->layout->setExpanded(false);
break;
}
@@ -1197,18 +1222,6 @@ bool QToolBar::event(QEvent *event)
return QWidget::event(event);
}
-void QToolBarPrivate::_q_waitForPopup()
-{
- Q_Q(QToolBar);
-
- QWidget *w = QApplication::activePopupWidget();
- if (!waitForPopup(q, w)) {
- waitForPopupTimer->stop();
- if (!q->underMouse())
- layout->setExpanded(false);
- }
-}
-
/*!
Returns a checkable action that can be used to show or hide this
toolbar.
diff --git a/src/gui/widgets/qtoolbar.h b/src/gui/widgets/qtoolbar.h
index 2ab4ffd..07502b3 100644
--- a/src/gui/widgets/qtoolbar.h
+++ b/src/gui/widgets/qtoolbar.h
@@ -167,7 +167,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool))
Q_PRIVATE_SLOT(d_func(), void _q_updateIconSize(const QSize &))
Q_PRIVATE_SLOT(d_func(), void _q_updateToolButtonStyle(Qt::ToolButtonStyle))
- Q_PRIVATE_SLOT(d_func(), void _q_waitForPopup())
friend class QMainWindow;
friend class QMainWindowLayout;
diff --git a/src/gui/widgets/qtoolbar_p.h b/src/gui/widgets/qtoolbar_p.h
index b03c460..42ea97f 100644
--- a/src/gui/widgets/qtoolbar_p.h
+++ b/src/gui/widgets/qtoolbar_p.h
@@ -56,6 +56,7 @@
#include "qtoolbar.h"
#include "QtGui/qaction.h"
#include "private/qwidget_p.h"
+#include <QtCore/qbasictimer.h>
QT_BEGIN_NAMESPACE
@@ -70,7 +71,7 @@ class QToolBarPrivate : public QWidgetPrivate
public:
inline QToolBarPrivate()
- : explicitIconSize(false), explicitToolButtonStyle(false), movable(false),
+ : explicitIconSize(false), explicitToolButtonStyle(false), movable(true), floatable(true),
allowedAreas(Qt::AllToolBarAreas), orientation(Qt::Horizontal),
toolButtonStyle(Qt::ToolButtonIconOnly),
layout(0), state(0)
@@ -84,16 +85,15 @@ public:
void _q_toggleView(bool b);
void _q_updateIconSize(const QSize &sz);
void _q_updateToolButtonStyle(Qt::ToolButtonStyle style);
- void _q_waitForPopup();
bool explicitIconSize;
bool explicitToolButtonStyle;
bool movable;
+ bool floatable;
Qt::ToolBarAreas allowedAreas;
Qt::Orientation orientation;
Qt::ToolButtonStyle toolButtonStyle;
QSize iconSize;
- bool floatable;
QAction *toggleViewAction;
@@ -125,7 +125,7 @@ public:
void unplug(const QRect &r);
void plug(const QRect &r);
- QTimer *waitForPopupTimer;
+ QBasicTimer waitForPopupTimer;
};
#endif // QT_NO_TOOLBAR
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index db2afd6..b4a0ef0 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -156,21 +156,15 @@ void QToolBarAreaLayoutLine::fitLayout()
if (item.skip())
continue;
- QToolBarLayout *tblayout = qobject_cast<QToolBarLayout*>(item.widgetItem->widget()->layout());
- if (tblayout)
+ if (QToolBarLayout *tblayout = qobject_cast<QToolBarLayout*>(item.widgetItem->widget()->layout()))
tblayout->checkUsePopupMenu();
- int itemMin = pick(o, item.minimumSize());
- int itemHint = pick(o, item.sizeHint());
- //we ensure the extraspace is not too low
- item.size = qMax(item.size, itemHint);
- if (item.preferredSize > 0) {
- //preferredSize would be the default size
- item.size = item.preferredSize;
- }
+ const int itemMin = pick(o, item.minimumSize());
+ //preferredSize is the default if it is set, otherwise, we take the sizehint
+ item.size = item.preferredSize > 0 ? item.preferredSize : pick(o, item.sizeHint());
//the extraspace is the space above the item minimum sizehint
- int extraSpace = qMin(item.size - itemMin, extra);
+ const int extraSpace = qMin(item.size - itemMin, extra);
item.size = itemMin + extraSpace; //that is the real size
extra -= extraSpace;
@@ -932,7 +926,7 @@ void QToolBarAreaLayout::apply(bool animate)
if (visible && dock.o == Qt::Horizontal)
geo = QStyle::visualRect(dir, line.rect, geo);
- layout->widgetAnimator->animate(widget, geo, animate);
+ layout->widgetAnimator.animate(widget, geo, animate);
}
}
}
diff --git a/src/gui/widgets/qtoolbutton.cpp b/src/gui/widgets/qtoolbutton.cpp
index 6dcbfec..2c85dc5 100644
--- a/src/gui/widgets/qtoolbutton.cpp
+++ b/src/gui/widgets/qtoolbutton.cpp
@@ -378,7 +378,17 @@ void QToolButton::initStyleOption(QStyleOptionToolButton *option) const
if (d->hasMenu())
option->features |= QStyleOptionToolButton::HasMenu;
#endif
- option->toolButtonStyle = d->toolButtonStyle;
+ if (d->toolButtonStyle == Qt::ToolButtonFollowStyle) {
+ option->toolButtonStyle = Qt::ToolButtonStyle(style()->styleHint(QStyle::SH_ToolButtonStyle, option, this));
+ } else
+ option->toolButtonStyle = d->toolButtonStyle;
+
+ if (option->toolButtonStyle == Qt::ToolButtonTextBesideIcon) {
+ // If the action is not prioritized, remove the text label to save space
+ if (d->defaultAction && d->defaultAction->priority() < QAction::NormalPriority)
+ option->toolButtonStyle = Qt::ToolButtonIconOnly;
+ }
+
if (d->icon.isNull() && d->arrowType == Qt::NoArrow && !forceNoText) {
if (!d->text.isEmpty())
option->toolButtonStyle = Qt::ToolButtonTextOnly;
@@ -476,6 +486,9 @@ QSize QToolButton::minimumSizeHint() const
The default is Qt::ToolButtonIconOnly.
+ To have the style of toolbuttons follow the system settings (as available
+ in GNOME and KDE desktop environments), set this property to Qt::ToolButtonFollowStyle.
+
QToolButton automatically connects this slot to the relevant
signal in the QMainWindow in which is resides.
*/
diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp
index c67be4a..1a93b51 100644
--- a/src/gui/widgets/qwidgetanimator.cpp
+++ b/src/gui/widgets/qwidgetanimator.cpp
@@ -39,158 +39,80 @@
**
****************************************************************************/
-#include <QtCore/qtimer.h>
-#include <QtCore/qdatetime.h>
+#include <QtCore/qpropertyanimation.h>
#include <QtGui/qwidget.h>
-#include <QtGui/qtextedit.h>
-#include <QtGui/private/qwidget_p.h>
-#include <qdebug.h>
+#include <QtGui/private/qmainwindowlayout_p.h>
#include "qwidgetanimator_p.h"
QT_BEGIN_NAMESPACE
-static const int g_animation_steps = 12;
-static const int g_animation_interval = 16;
-
-// 1000 * (x/(1 + x*x) + 0.5) on interval [-1, 1]
-static const int g_animate_function[] =
-{
- 0, 1, 5, 12, 23, 38, 58, 84, 116, 155, 199, 251, 307, 368,
- 433, 500, 566, 631, 692, 748, 799, 844, 883, 915, 941, 961,
- 976, 987, 994, 998, 1000
-};
-static const int g_animate_function_points = sizeof(g_animate_function)/sizeof(int);
-
-static inline int animateHelper(int start, int stop, int step, int steps)
-{
- if (start == stop)
- return start;
- if (step == 0)
- return start;
- if (step == steps)
- return stop;
-
- int x = g_animate_function_points*step/(steps + 1);
- return start + g_animate_function[x]*(stop - start)/1000;
-}
-
-QWidgetAnimator::QWidgetAnimator(QObject *parent)
- : QObject(parent)
+QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout(layout)
{
- m_time = new QTime();
- m_timer = new QTimer(this);
- m_timer->setInterval(g_animation_interval);
- connect(m_timer, SIGNAL(timeout()), this, SLOT(animationStep()));
}
-QWidgetAnimator::~QWidgetAnimator()
+void QWidgetAnimator::abort(QWidget *w)
{
- delete m_time;
+#ifndef QT_NO_ANIMATION
+ AnimationMap::iterator it = m_animation_map.find(w);
+ if (it == m_animation_map.end())
+ return;
+ QPropertyAnimation *anim = *it;
+ m_animation_map.erase(it);
+ anim->stop();
+ m_mainWindowLayout->animationFinished(w);
+#else
+ Q_UNUSED(w); //there is no animation to abort
+#endif //QT_NO_ANIMATION
}
-void QWidgetAnimator::abort(QWidget *w)
+#ifndef QT_NO_ANIMATION
+void QWidgetAnimator::animationFinished()
{
- if (m_animation_map.remove(w) == 0)
- return;
- if (m_animation_map.isEmpty()) {
- m_timer->stop();
- emit finishedAll();
- }
+ QPropertyAnimation *anim = qobject_cast<QPropertyAnimation*>(sender());
+ abort(static_cast<QWidget*>(anim->targetObject()));
}
+#endif //QT_NO_ANIMATION
void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate)
{
- QRect final_geometry = _final_geometry;
-
QRect r = widget->geometry();
if (r.right() < 0 || r.bottom() < 0)
r = QRect();
- if (r.isNull() || final_geometry.isNull())
- animate = false;
+ animate = animate && !r.isNull() && !_final_geometry.isNull();
- AnimationMap::const_iterator it = m_animation_map.constFind(widget);
- if (it == m_animation_map.constEnd()) {
- if (r == final_geometry) {
- emit finished(widget);
- return;
- }
- } else {
- if ((*it).r2 == final_geometry)
- return;
- }
-
- if (animate) {
- AnimationItem item(widget, r, final_geometry);
- m_animation_map[widget] = item;
- if (!m_timer->isActive()) {
- m_timer->start();
- m_time->start();
- }
- } else {
- m_animation_map.remove(widget);
- if (m_animation_map.isEmpty())
- m_timer->stop();
-
- if (!final_geometry.isValid() && !widget->isWindow()) {
- // Make the wigdet go away by sending it to negative space
- QSize s = widget->size();
- final_geometry = QRect(-500 - s.width(), -500 - s.height(), s.width(), s.height());
- }
- widget->setGeometry(final_geometry);
-
- emit finished(widget);
-
- if (m_animation_map.isEmpty())
- emit finishedAll();
+ // might make the wigdet go away by sending it to negative space
+ const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry :
+ QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size());
+ if (r == final_geometry)
+ return; //the widget is already where it should be
+#ifndef QT_NO_ANIMATION
+ AnimationMap::const_iterator it = m_animation_map.constFind(widget);
+ if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry)
return;
- }
-}
-
-void QWidgetAnimator::animationStep()
-{
- int steps = (1 + m_time->restart())/g_animation_interval;
- AnimationMap::iterator it = m_animation_map.begin();
- while (it != m_animation_map.end()) {
- AnimationItem &item = *it;
-
- item.step = qMin(item.step + steps, g_animation_steps);
-
- int x = animateHelper(item.r1.left(), item.r2.left(),
- item.step, g_animation_steps);
- int y = animateHelper(item.r1.top(), item.r2.top(),
- item.step, g_animation_steps);
- int w = animateHelper(item.r1.width(), item.r2.width(),
- item.step, g_animation_steps);
- int h = animateHelper(item.r1.height(), item.r2.height(),
- item.step, g_animation_steps);
-
- item.widget->setGeometry(x, y, w, h);
-
- if (item.step == g_animation_steps) {
- emit finished(item.widget);
- AnimationMap::iterator tmp = it;
- ++it;
- m_animation_map.erase(tmp);
- } else {
- ++it;
- }
- }
- if (m_animation_map.isEmpty()) {
- m_timer->stop();
- emit finishedAll();
- }
+ QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry");
+ anim->setDuration(animate ? 200 : 0);
+ anim->setEasingCurve(QEasingCurve::InOutQuad);
+ anim->setEndValue(final_geometry);
+ m_animation_map[widget] = anim;
+ connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
+ anim->start(QPropertyAnimation::DeleteWhenStopped);
+#else
+ //we do it in one shot
+ widget->setGeometry(final_geometry);
+ m_mainWindowLayout->animationFinished(widget);
+#endif //QT_NO_ANIMATION
}
bool QWidgetAnimator::animating() const
{
- return m_timer->isActive();
+ return !m_animation_map.isEmpty();
}
-bool QWidgetAnimator::animating(QWidget *widget)
+bool QWidgetAnimator::animating(QWidget *widget) const
{
return m_animation_map.contains(widget);
}
diff --git a/src/gui/widgets/qwidgetanimator_p.h b/src/gui/widgets/qwidgetanimator_p.h
index 6ee150b..5a3e39d 100644
--- a/src/gui/widgets/qwidgetanimator_p.h
+++ b/src/gui/widgets/qwidgetanimator_p.h
@@ -54,47 +54,35 @@
//
#include <qobject.h>
-#include <qrect.h>
#include <qmap.h>
QT_BEGIN_NAMESPACE
class QWidget;
-class QTimer;
-class QTime;
+class QMainWindowLayout;
+class QPropertyAnimation;
+class QRect;
class QWidgetAnimator : public QObject
{
Q_OBJECT
public:
- QWidgetAnimator(QObject *parent = 0);
- ~QWidgetAnimator();
+ QWidgetAnimator(QMainWindowLayout *layout);
void animate(QWidget *widget, const QRect &final_geometry, bool animate);
bool animating() const;
- bool animating(QWidget *widget);
+ bool animating(QWidget *widget) const;
void abort(QWidget *widget);
-signals:
- void finished(QWidget *widget);
- void finishedAll();
-
-private slots:
- void animationStep();
+#ifndef QT_NO_ANIMATION
+private Q_SLOTS:
+ void animationFinished();
+#endif
private:
- struct AnimationItem {
- AnimationItem(QWidget *_widget = 0, const QRect &_r1 = QRect(),
- const QRect &_r2 = QRect())
- : widget(_widget), r1(_r1), r2(_r2), step(0) {}
- QWidget *widget;
- QRect r1, r2;
- int step;
- };
- typedef QMap<QWidget*, AnimationItem> AnimationMap;
+ typedef QMap<QWidget*, QPropertyAnimation*> AnimationMap;
AnimationMap m_animation_map;
- QTimer *m_timer;
- QTime *m_time;
+ QMainWindowLayout *m_mainWindowLayout;
};
QT_END_NAMESPACE
diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp
index 58ef1e3..2833c08 100644
--- a/src/gui/widgets/qworkspace.cpp
+++ b/src/gui/widgets/qworkspace.cpp
@@ -397,21 +397,17 @@ void QWorkspaceTitleBarPrivate::readColors()
pal.setColor(QPalette::Inactive, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION)));
pal.setColor(QPalette::Active, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT)));
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT)));
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- colorsInitialized = true;
- BOOL gradient;
- QT_WA({
- SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
- } , {
- SystemParametersInfoA(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
- });
- if (gradient) {
- pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)));
- pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)));
- } else {
- pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight));
- pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight));
- }
+
+ colorsInitialized = true;
+ BOOL gradient = false;
+ SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
+
+ if (gradient) {
+ pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)));
+ pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)));
+ } else {
+ pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight));
+ pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight));
}
}
#endif // Q_WS_WIN
diff --git a/src/network/access/qabstractnetworkcache.cpp b/src/network/access/qabstractnetworkcache.cpp
index cfc9fe7..3f44059 100644
--- a/src/network/access/qabstractnetworkcache.cpp
+++ b/src/network/access/qabstractnetworkcache.cpp
@@ -283,6 +283,8 @@ void QNetworkCacheMetaData::setExpirationDate(const QDateTime &dateTime)
}
/*!
+ \since 4.6
+
Returns all the attributes stored with this cache item.
\sa setAttributes(), QNetworkRequest::Attribute
@@ -293,6 +295,8 @@ QNetworkCacheMetaData::AttributesMap QNetworkCacheMetaData::attributes() const
}
/*!
+ \since 4.6
+
Sets all attributes of this cache item to be the map \a attributes.
\sa attributes(), QNetworkRequest::setAttribute()
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index 6fc0626..acf1a27 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -871,6 +871,9 @@ void QFtpPI::connected()
#if defined(QFTPPI_DEBUG)
// qDebug("QFtpPI state: %d [connected()]", state);
#endif
+ // try to improve performance by setting TCP_NODELAY
+ commandSocket.setSocketOption(QAbstractSocket::LowDelayOption, 1);
+
emit connectState(QFtp::Connected);
}
diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp
index 91f9f4e..bb72f89 100644
--- a/src/network/access/qhttp.cpp
+++ b/src/network/access/qhttp.cpp
@@ -513,6 +513,7 @@ public:
/*!
\class QHttpHeader
+ \obsolete
\brief The QHttpHeader class contains header information for HTTP.
\ingroup io
@@ -1006,6 +1007,7 @@ public:
/*!
\class QHttpResponseHeader
+ \obsolete
\brief The QHttpResponseHeader class contains response header information for HTTP.
\ingroup io
@@ -1151,7 +1153,7 @@ int QHttpResponseHeader::minorVersion() const
return d->minVer;
}
-/*! \reimp
+/*! \internal
*/
bool QHttpResponseHeader::parseLine(const QString &line, int number)
{
@@ -1210,6 +1212,7 @@ public:
/*!
\class QHttpRequestHeader
+ \obsolete
\brief The QHttpRequestHeader class contains request header information for HTTP.
\ingroup io
@@ -1365,7 +1368,7 @@ int QHttpRequestHeader::minorVersion() const
return d->minVer;
}
-/*! \reimp
+/*! \internal
*/
bool QHttpRequestHeader::parseLine(const QString &line, int number)
{
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 827681f..d67f84b 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -177,26 +177,43 @@ bool QHttpNetworkConnectionPrivate::isSocketReading(QAbstractSocket *socket) con
return (i != -1 && (channels[i].state & ReadingState));
}
+void QHttpNetworkConnectionPrivate::appendUncompressedData(QHttpNetworkReply &reply, QByteArray &qba)
+{
+ reply.d_func()->responseData.append(qba);
+
+ // clear the original! helps with implicit sharing and
+ // avoiding memcpy when the user is reading the data
+ qba.clear();
+}
-void QHttpNetworkConnectionPrivate::appendUncompressedData(QHttpNetworkReply &reply, const QByteArray &fragment)
+void QHttpNetworkConnectionPrivate::appendUncompressedData(QHttpNetworkReply &reply, QByteDataBuffer &data)
{
- char *dst = reply.d_func()->responseData.reserve(fragment.size());
- qMemCopy(dst, fragment.constData(), fragment.size());
+ reply.d_func()->responseData.append(data);
+
+ // clear the original! helps with implicit sharing and
+ // avoiding memcpy when the user is reading the data
+ data.clear();
}
-void QHttpNetworkConnectionPrivate::appendCompressedData(QHttpNetworkReply &reply, const QByteArray &fragment)
+void QHttpNetworkConnectionPrivate::appendCompressedData(QHttpNetworkReply &reply, QByteDataBuffer &data)
{
- reply.d_func()->compressedData.append(fragment);
+ // Work in progress: Later we will directly use a list of QByteArray or a QRingBuffer
+ // instead of one QByteArray.
+ for(int i = 0; i < data.bufferCount(); i++) {
+ QByteArray &byteData = data[i];
+ reply.d_func()->compressedData.append(byteData.constData(), byteData.size());
+ }
+ data.clear();
}
qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailable(const QHttpNetworkReply &reply) const
{
- return reply.d_func()->responseData.size();
+ return reply.d_func()->responseData.byteAmount();
}
qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailableNextBlock(const QHttpNetworkReply &reply) const
{
- return reply.d_func()->responseData.nextDataBlockSize();
+ return reply.d_func()->responseData.sizeNextBlock();
}
qint64 QHttpNetworkConnectionPrivate::compressedBytesAvailable(const QHttpNetworkReply &reply) const
@@ -204,21 +221,6 @@ qint64 QHttpNetworkConnectionPrivate::compressedBytesAvailable(const QHttpNetwor
return reply.d_func()->compressedData.size();
}
-qint64 QHttpNetworkConnectionPrivate::read(QHttpNetworkReply &reply, QByteArray &data, qint64 maxSize)
-{
- QRingBuffer *rb = &reply.d_func()->responseData;
- if (maxSize == -1 || maxSize >= rb->size()) {
- // read the whole data
- data = rb->readAll();
- rb->clear();
- } else {
- // read only the requested length
- data.resize(maxSize);
- rb->read(data.data(), maxSize);
- }
- return data.size();
-}
-
void QHttpNetworkConnectionPrivate::eraseData(QHttpNetworkReply *reply)
{
reply->d_func()->compressedData.clear();
@@ -261,7 +263,12 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair)
#ifndef QT_NO_NETWORKPROXY
}
#endif
- // set the gzip header
+
+ // If the request had a accept-encoding set, we better not mess
+ // with it. If it was not set, we announce that we understand gzip
+ // and remember this fact in request.d->autoDecompress so that
+ // we can later decompress the HTTP reply if it has such an
+ // encoding.
value = request.headerField("accept-encoding");
if (value.isEmpty()) {
#ifndef QT_NO_COMPRESS
@@ -335,8 +342,9 @@ bool QHttpNetworkConnectionPrivate::ensureConnection(QAbstractSocket *socket)
#ifndef QT_NO_OPENSSL
QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket);
sslSocket->connectToHostEncrypted(connectHost, connectPort);
- if (channels[index].ignoreSSLErrors)
+ if (channels[index].ignoreAllSslErrors)
sslSocket->ignoreSslErrors();
+ sslSocket->ignoreSslErrors(channels[index].ignoreSslErrorsList);
#else
emitReplyError(socket, channels[index].reply, QNetworkReply::ProtocolUnknownError);
#endif
@@ -403,6 +411,7 @@ bool QHttpNetworkConnectionPrivate::sendRequest(QAbstractSocket *socket)
channels[i].bytesTotal = channels[i].request.contentLength();
} else {
+ socket->flush(); // ### Remove this when pipelining is implemented. We want less TCP packets!
channels[i].state = WaitingState;
break;
}
@@ -558,6 +567,8 @@ bool QHttpNetworkConnectionPrivate::expand(QAbstractSocket *socket, QHttpNetwork
reply->d_func()->totalProgress += inflated.size();
appendUncompressedData(*reply, inflated);
if (shouldEmitSignals(reply)) {
+ // important: At the point of this readyRead(), inflated must be cleared,
+ // else implicit sharing will trigger memcpy when the user is reading data!
emit reply->readyRead();
// make sure that the reply is valid
if (channels[i].reply != reply)
@@ -674,18 +685,19 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN
{
// use the traditional slower reading (for compressed encoding, chunked encoding,
// no content-length etc)
- QBuffer fragment;
- fragment.open(QIODevice::WriteOnly);
- bytes = reply->d_func()->readBody(socket, &fragment);
+ QByteDataBuffer byteDatas;
+ bytes = reply->d_func()->readBody(socket, &byteDatas);
if (bytes) {
if (reply->d_func()->autoDecompress)
- appendCompressedData(*reply, fragment.data());
+ appendCompressedData(*reply, byteDatas);
else
- appendUncompressedData(*reply, fragment.data());
+ appendUncompressedData(*reply, byteDatas);
if (!reply->d_func()->autoDecompress) {
- reply->d_func()->totalProgress += fragment.size();
+ reply->d_func()->totalProgress += bytes;
if (shouldEmitSignals(reply)) {
+ // important: At the point of this readyRead(), the byteDatas list must be empty,
+ // else implicit sharing will trigger memcpy when the user is reading data!
emit reply->readyRead();
// make sure that the reply is valid
if (channels[i].reply != reply)
@@ -1189,6 +1201,10 @@ void QHttpNetworkConnectionPrivate::_q_connected()
QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(q->sender());
if (!socket)
return; // ### error
+
+ // improve performance since we get the request sent by the kernel ASAP
+ socket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
+
int i = indexOf(socket);
// ### FIXME: if the server closes the connection unexpectedly, we shouldn't send the same broken request again!
//channels[i].reconnectAttempts = 2;
@@ -1440,15 +1456,32 @@ void QHttpNetworkConnection::ignoreSslErrors(int channel)
if (channel == -1) { // ignore for all channels
for (int i = 0; i < d->channelCount; ++i) {
static_cast<QSslSocket *>(d->channels[i].socket)->ignoreSslErrors();
- d->channels[i].ignoreSSLErrors = true;
+ d->channels[i].ignoreAllSslErrors = true;
}
} else {
static_cast<QSslSocket *>(d->channels[channel].socket)->ignoreSslErrors();
- d->channels[channel].ignoreSSLErrors = true;
+ d->channels[channel].ignoreAllSslErrors = true;
}
}
+void QHttpNetworkConnection::ignoreSslErrors(const QList<QSslError> &errors, int channel)
+{
+ Q_D(QHttpNetworkConnection);
+ if (!d->encrypt)
+ return;
+
+ if (channel == -1) { // ignore for all channels
+ for (int i = 0; i < d->channelCount; ++i) {
+ static_cast<QSslSocket *>(d->channels[i].socket)->ignoreSslErrors(errors);
+ d->channels[i].ignoreSslErrorsList = errors;
+ }
+
+ } else {
+ static_cast<QSslSocket *>(d->channels[channel].socket)->ignoreSslErrors(errors);
+ d->channels[channel].ignoreSslErrorsList = errors;
+ }
+}
#endif //QT_NO_OPENSSL
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index a0813d4..52a73a7 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -79,6 +79,7 @@ QT_BEGIN_NAMESPACE
class QHttpNetworkRequest;
class QHttpNetworkReply;
+class QByteArray;
class QHttpNetworkConnectionPrivate;
class Q_AUTOTEST_EXPORT QHttpNetworkConnection : public QObject
@@ -116,6 +117,7 @@ public:
#ifndef QT_NO_OPENSSL
void setSslConfiguration(const QSslConfiguration &config);
void ignoreSslErrors(int channel = -1);
+ void ignoreSslErrors(const QList<QSslError> &errors, int channel = -1);
Q_SIGNALS:
void sslErrors(const QList<QSslError> &errors);
@@ -240,13 +242,14 @@ public:
QAuthenticator authenticator;
QAuthenticator proxyAuthenticator;
#ifndef QT_NO_OPENSSL
- bool ignoreSSLErrors;
+ bool ignoreAllSslErrors;
+ QList<QSslError> ignoreSslErrorsList;
#endif
Channel() : socket(0), state(IdleState), reply(0), written(0), bytesTotal(0), resendCurrent(false),
lastStatus(0), pendingEncrypt(false), reconnectAttempts(2),
authMehtod(QAuthenticatorPrivate::None), proxyAuthMehtod(QAuthenticatorPrivate::None)
#ifndef QT_NO_OPENSSL
- , ignoreSSLErrors(false)
+ , ignoreAllSslErrors(false)
#endif
{}
};
@@ -255,15 +258,14 @@ public:
bool pendingAuthSignal; // there is an incomplete authentication signal
bool pendingProxyAuthSignal; // there is an incomplete proxy authentication signal
- void appendUncompressedData(QHttpNetworkReply &reply, const QByteArray &fragment);
- void appendCompressedData(QHttpNetworkReply &reply, const QByteArray &fragment);
+ void appendUncompressedData(QHttpNetworkReply &reply, QByteArray &qba);
+ void appendUncompressedData(QHttpNetworkReply &reply, QByteDataBuffer &data);
+ void appendCompressedData(QHttpNetworkReply &reply, QByteDataBuffer &data);
qint64 uncompressedBytesAvailable(const QHttpNetworkReply &reply) const;
qint64 uncompressedBytesAvailableNextBlock(const QHttpNetworkReply &reply) const;
qint64 compressedBytesAvailable(const QHttpNetworkReply &reply) const;
- qint64 read(QHttpNetworkReply &reply, QByteArray &data, qint64 maxSize);
-
void emitReplyError(QAbstractSocket *socket, QHttpNetworkReply *reply, QNetworkReply::NetworkError errorCode);
bool handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply, bool isProxy, bool &resend);
void allDone(QAbstractSocket *socket, QHttpNetworkReply *reply);
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index ef4a865..c11b1a6 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -176,13 +176,10 @@ qint64 QHttpNetworkReply::bytesAvailableNextBlock() const
return -1;
}
-QByteArray QHttpNetworkReply::read(qint64 maxSize)
+QByteArray QHttpNetworkReply::readAny()
{
Q_D(QHttpNetworkReply);
- QByteArray data;
- if (d->connection)
- d->connection->d_func()->read(*this, data, maxSize);
- return data;
+ return d->responseData.read();
}
bool QHttpNetworkReply::isFinished() const
@@ -195,8 +192,9 @@ bool QHttpNetworkReply::isFinished() const
QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl)
: QHttpNetworkHeaderPrivate(newUrl), state(NothingDoneState), statusCode(100),
majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0),
+ chunkedTransferEncoding(0),
currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false),
- autoDecompress(false), requestIsPrepared(false)
+ autoDecompress(false), responseData(), requestIsPrepared(false)
{
}
@@ -498,6 +496,9 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket)
state = ReadingDataState;
fragment.clear(); // next fragment
bodyLength = contentLength(); // cache the length
+
+ // cache isChunked() since it is called often
+ chunkedTransferEncoding = headerField("transfer-encoding").toLower().contains("chunked");
}
return bytes;
}
@@ -538,7 +539,7 @@ void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header)
bool QHttpNetworkReplyPrivate::isChunked()
{
- return headerField("transfer-encoding").toLower().contains("chunked");
+ return chunkedTransferEncoding;
}
bool QHttpNetworkReplyPrivate::connectionCloseEnabled()
@@ -549,17 +550,19 @@ bool QHttpNetworkReplyPrivate::connectionCloseEnabled()
// note this function can only be used for non-chunked, non-compressed with
// known content length
-qint64 QHttpNetworkReplyPrivate::readBodyFast(QAbstractSocket *socket, QRingBuffer *rb)
-{
- quint64 toBeRead = qMin(socket->bytesAvailable(), bodyLength - contentRead);
- char* dst = rb->reserve(toBeRead);
- qint64 haveRead = socket->read(dst, toBeRead);
+qint64 QHttpNetworkReplyPrivate::readBodyFast(QAbstractSocket *socket, QByteDataBuffer *rb)
+{
+ qint64 toBeRead = qMin(socket->bytesAvailable(), bodyLength - contentRead);
+ QByteArray bd;
+ bd.resize(toBeRead);
+ qint64 haveRead = socket->read(bd.data(), bd.size());
if (haveRead == -1) {
- rb->chop(toBeRead);
+ bd.clear();
return 0; // ### error checking here;
}
+ bd.resize(haveRead);
- rb->chop(toBeRead - haveRead);
+ rb->append(bd);
if (contentRead + haveRead == bodyLength) {
state = AllDoneState;
@@ -571,7 +574,7 @@ qint64 QHttpNetworkReplyPrivate::readBodyFast(QAbstractSocket *socket, QRingBuff
}
-qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QIODevice *out)
+qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QByteDataBuffer *out)
{
qint64 bytes = 0;
if (isChunked()) {
@@ -589,33 +592,35 @@ qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QIODevice *ou
return bytes;
}
-qint64 QHttpNetworkReplyPrivate::readReplyBodyRaw(QIODevice *in, QIODevice *out, qint64 size)
+qint64 QHttpNetworkReplyPrivate::readReplyBodyRaw(QIODevice *in, QByteDataBuffer *out, qint64 size)
{
qint64 bytes = 0;
Q_ASSERT(in);
Q_ASSERT(out);
int toBeRead = qMin<qint64>(128*1024, qMin<qint64>(size, in->bytesAvailable()));
- QByteArray raw(toBeRead, 0);
- while (size > 0) {
- qint64 read = in->read(raw.data(), raw.size());
- if (read == 0)
- return bytes;
- // ### error checking here
- qint64 written = out->write(raw.data(), read);
- if (written == 0)
+ while (toBeRead > 0) {
+ QByteArray byteData;
+ byteData.resize(toBeRead);
+ qint64 haveRead = in->read(byteData.data(), byteData.size());
+ if (haveRead <= 0) {
+ // ### error checking here
+ byteData.clear();
return bytes;
- if (read != written)
- qDebug() << "### read" << read << "written" << written;
- bytes += read;
- size -= read;
- out->waitForBytesWritten(-1); // throttle
+ }
+
+ byteData.resize(haveRead);
+ out->append(byteData);
+ bytes += haveRead;
+ size -= haveRead;
+
+ toBeRead = qMin<qint64>(128*1024, qMin<qint64>(size, in->bytesAvailable()));
}
return bytes;
}
-qint64 QHttpNetworkReplyPrivate::readReplyBodyChunked(QIODevice *in, QIODevice *out)
+qint64 QHttpNetworkReplyPrivate::readReplyBodyChunked(QIODevice *in, QByteDataBuffer *out)
{
qint64 bytes = 0;
while (in->bytesAvailable()) { // while we can read from input
@@ -636,17 +641,14 @@ qint64 QHttpNetworkReplyPrivate::readReplyBodyChunked(QIODevice *in, QIODevice *
state = AllDoneState;
break;
}
- // otherwise, read data
- qint64 readSize = qMin(in->bytesAvailable(), currentChunkSize - currentChunkRead);
- QByteArray buffer(readSize, 0);
- qint64 read = in->read(buffer.data(), readSize);
- bytes += read;
- currentChunkRead += read;
- qint64 written = out->write(buffer);
- Q_UNUSED(written); // Avoid compile warning when building release
- Q_ASSERT(read == written);
+
+ // otherwise, try to read what is missing for this chunk
+ qint64 haveRead = readReplyBodyRaw (in, out, currentChunkSize - currentChunkRead);
+ currentChunkRead += haveRead;
+ bytes += haveRead;
+
// ### error checking here
- out->waitForBytesWritten(-1);
+
}
return bytes;
}
@@ -708,6 +710,13 @@ void QHttpNetworkReply::ignoreSslErrors()
d->connection->ignoreSslErrors();
}
+void QHttpNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)
+{
+ Q_D(QHttpNetworkReply);
+ if (d->connection)
+ d->connection->ignoreSslErrors(errors);
+}
+
#endif //QT_NO_OPENSSL
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index 26e1047..575e824 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -80,6 +80,7 @@ static const unsigned char gz_magic[2] = {0x1f, 0x8b}; // gzip magic header
#include <private/qhttpnetworkrequest_p.h>
#include <private/qauthenticator_p.h>
#include <private/qringbuffer_p.h>
+#include <private/qbytedata_p.h>
QT_BEGIN_NAMESPACE
@@ -122,7 +123,7 @@ public:
qint64 bytesAvailable() const;
qint64 bytesAvailableNextBlock() const;
- QByteArray read(qint64 maxSize = -1);
+ QByteArray readAny();
bool isFinished() const;
@@ -130,6 +131,7 @@ public:
QSslConfiguration sslConfiguration() const;
void setSslConfiguration(const QSslConfiguration &config);
void ignoreSslErrors();
+ void ignoreSslErrors(const QList<QSslError> &errors);
Q_SIGNALS:
void sslErrors(const QList<QSslError> &errors);
@@ -159,14 +161,14 @@ public:
bool parseStatus(const QByteArray &status);
qint64 readHeader(QAbstractSocket *socket);
void parseHeader(const QByteArray &header);
- qint64 readBody(QAbstractSocket *socket, QIODevice *out);
- qint64 readBodyFast(QAbstractSocket *socket, QRingBuffer *rb);
+ qint64 readBody(QAbstractSocket *socket, QByteDataBuffer *out);
+ qint64 readBodyFast(QAbstractSocket *socket, QByteDataBuffer *rb);
bool findChallenge(bool forProxy, QByteArray &challenge) const;
QAuthenticatorPrivate::Method authenticationMethod(bool isProxy) const;
void clear();
- qint64 readReplyBodyRaw(QIODevice *in, QIODevice *out, qint64 size);
- qint64 readReplyBodyChunked(QIODevice *in, QIODevice *out);
+ qint64 readReplyBodyRaw(QIODevice *in, QByteDataBuffer *out, qint64 size);
+ qint64 readReplyBodyChunked(QIODevice *in, QByteDataBuffer *out);
qint64 getChunkSize(QIODevice *in, qint64 *chunkSize);
qint64 bytesAvailable() const;
@@ -197,6 +199,7 @@ public:
qint64 contentRead;
qint64 totalProgress;
QByteArray fragment; // used for header, status, chunk header etc, not for reply data
+ bool chunkedTransferEncoding;
qint64 currentChunkSize;
qint64 currentChunkRead;
QPointer<QHttpNetworkConnection> connection;
@@ -207,7 +210,7 @@ public:
#endif
bool autoDecompress;
- QRingBuffer responseData; // uncompressed body
+ QByteDataBuffer responseData; // uncompressed body
QByteArray compressedData; // compressed body (temporary)
bool requestIsPrepared;
};
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index 88ae894..caaa38e 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -165,6 +165,12 @@ void QNetworkAccessBackend::ignoreSslErrors()
// do nothing
}
+void QNetworkAccessBackend::ignoreSslErrors(const QList<QSslError> &errors)
+{
+ Q_UNUSED(errors);
+ // do nothing
+}
+
void QNetworkAccessBackend::fetchSslConfiguration(QSslConfiguration &) const
{
// do nothing
@@ -217,9 +223,9 @@ qint64 QNetworkAccessBackend::nextDownstreamBlockSize() const
return reply->nextDownstreamBlockSize();
}
-void QNetworkAccessBackend::writeDownstreamData(const QByteArray &data)
+void QNetworkAccessBackend::writeDownstreamData(QByteDataBuffer &list)
{
- reply->appendDownstreamData(data);
+ reply->appendDownstreamData(list);
}
void QNetworkAccessBackend::writeDownstreamData(QIODevice *data)
diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h
index 21cb4a6..27da5bc 100644
--- a/src/network/access/qnetworkaccessbackend_p.h
+++ b/src/network/access/qnetworkaccessbackend_p.h
@@ -118,6 +118,7 @@ public:
virtual void downstreamReadyWrite();
virtual void copyFinished(QIODevice *);
virtual void ignoreSslErrors();
+ virtual void ignoreSslErrors(const QList<QSslError> &errors);
virtual void fetchSslConfiguration(QSslConfiguration &configuration) const;
virtual void setSslConfiguration(const QSslConfiguration &configuration);
@@ -166,7 +167,7 @@ protected:
// these functions control the downstream mechanism
// that is, data that has come via the connection and is going out the backend
qint64 nextDownstreamBlockSize() const;
- void writeDownstreamData(const QByteArray &data);
+ void writeDownstreamData(QByteDataBuffer &list);
public slots:
// for task 251801, needs to be a slot to be called asynchronously
diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp
index f46a50a..8571ba3 100644
--- a/src/network/access/qnetworkaccesscachebackend.cpp
+++ b/src/network/access/qnetworkaccesscachebackend.cpp
@@ -86,6 +86,20 @@ bool QNetworkAccessCacheBackend::sendCacheContents()
setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute));
setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true);
+ // set the raw headers
+ QNetworkCacheMetaData::RawHeaderList rawHeaders = item.rawHeaders();
+ QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(),
+ end = rawHeaders.constEnd();
+ for ( ; it != end; ++it)
+ setRawHeader(it->first, it->second);
+
+ // handle a possible redirect
+ QVariant redirectionTarget = attributes.value(QNetworkRequest::RedirectionTargetAttribute);
+ if (redirectionTarget.isValid()) {
+ setAttribute(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget);
+ redirectionRequested(redirectionTarget.toUrl());
+ }
+
// signal we're open
metaDataChanged();
diff --git a/src/network/access/qnetworkaccessdatabackend.cpp b/src/network/access/qnetworkaccessdatabackend.cpp
index 609f0c5..4436cf4 100644
--- a/src/network/access/qnetworkaccessdatabackend.cpp
+++ b/src/network/access/qnetworkaccessdatabackend.cpp
@@ -117,7 +117,11 @@ void QNetworkAccessDataBackend::open()
setHeader(QNetworkRequest::ContentLengthHeader, payload.size());
emit metaDataChanged();
- writeDownstreamData(payload);
+ QByteDataBuffer list;
+ list.append(payload);
+ payload.clear(); // important because of implicit sharing!
+ writeDownstreamData(list);
+
finished();
return;
}
diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp
index ce768f5..394e196 100644
--- a/src/network/access/qnetworkaccessdebugpipebackend.cpp
+++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp
@@ -155,7 +155,11 @@ void QNetworkAccessDebugPipeBackend::pushFromSocketToDownstream()
// have read something
buffer.resize(haveRead);
bytesDownloaded += haveRead;
- writeDownstreamData(buffer);
+
+ QByteDataBuffer list;
+ list.append(buffer);
+ buffer.clear(); // important because of implicit sharing!
+ writeDownstreamData(list);
}
}
}
@@ -276,7 +280,7 @@ void QNetworkAccessDebugPipeBackend::socketConnected()
bool QNetworkAccessDebugPipeBackend::waitForDownstreamReadyRead(int ms)
{
- Q_UNUSED(ms);
+ Q_UNUSED(ms);
qCritical("QNetworkAccess: Debug pipe backend does not support waitForReadyRead()");
return false;
}
diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp
index e3fc8bf..533fc75 100644
--- a/src/network/access/qnetworkaccessfilebackend.cpp
+++ b/src/network/access/qnetworkaccessfilebackend.cpp
@@ -263,7 +263,11 @@ bool QNetworkAccessFileBackend::readMoreFromFile()
data.resize(actuallyRead);
totalBytes += actuallyRead;
- writeDownstreamData(data);
+
+ QByteDataBuffer list;
+ list.append(data);
+ data.clear(); // important because of implicit sharing!
+ writeDownstreamData(list);
}
return true;
}
diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
index d6276a3..911b31a 100644
--- a/src/network/access/qnetworkaccessftpbackend.cpp
+++ b/src/network/access/qnetworkaccessftpbackend.cpp
@@ -355,7 +355,11 @@ void QNetworkAccessFtpBackend::ftpDone()
void QNetworkAccessFtpBackend::ftpReadyRead()
{
- writeDownstreamData(ftp->readAll());
+ QByteArray data = ftp->readAll();
+ QByteDataBuffer list;
+ list.append(data);
+ data.clear(); // important because of implicit sharing!
+ writeDownstreamData(list);
}
void QNetworkAccessFtpBackend::ftpRawCommandReply(int code, const QString &text)
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index 4bc36db..293f857 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -294,7 +294,7 @@ public:
QNetworkAccessHttpBackend::QNetworkAccessHttpBackend()
: QNetworkAccessBackend(), httpReply(0), http(0), uploadDevice(0)
#ifndef QT_NO_OPENSSL
- , pendingSslConfiguration(0), pendingIgnoreSslErrors(false)
+ , pendingSslConfiguration(0), pendingIgnoreAllSslErrors(false)
#endif
{
}
@@ -521,8 +521,9 @@ void QNetworkAccessHttpBackend::postRequest()
#ifndef QT_NO_OPENSSL
if (pendingSslConfiguration)
httpReply->setSslConfiguration(*pendingSslConfiguration);
- if (pendingIgnoreSslErrors)
+ if (pendingIgnoreAllSslErrors)
httpReply->ignoreSslErrors();
+ httpReply->ignoreSslErrors(pendingIgnoreSslErrorsList);
#endif
connect(httpReply, SIGNAL(readyRead()), SLOT(replyReadyRead()));
@@ -649,16 +650,19 @@ void QNetworkAccessHttpBackend::readFromHttp()
if (!httpReply)
return;
- // We implement the download rate control
- // Don't read from QHttpNetworkAccess more than QNetworkAccessBackend wants
- // One of the two functions above will be called when we can read again
+ // We read possibly more than nextDownstreamBlockSize(), but
+ // this is not a critical thing since it is already in the
+ // memory anyway
- qint64 bytesToRead = qBound<qint64>(0, httpReply->bytesAvailable(), nextDownstreamBlockSize());
- if (!bytesToRead)
- return;
+ QByteDataBuffer list;
+
+ while (httpReply->bytesAvailable() != 0 && nextDownstreamBlockSize() != 0 && nextDownstreamBlockSize() > list.byteAmount()) {
+ QByteArray data = httpReply->readAny();
+ list.append(data);
+ }
- QByteArray data = httpReply->read(bytesToRead);
- writeDownstreamData(data);
+ if (!list.isEmpty())
+ writeDownstreamData(list);
}
void QNetworkAccessHttpBackend::replyFinished()
@@ -885,7 +889,18 @@ void QNetworkAccessHttpBackend::ignoreSslErrors()
if (httpReply)
httpReply->ignoreSslErrors();
else
- pendingIgnoreSslErrors = true;
+ pendingIgnoreAllSslErrors = true;
+}
+
+void QNetworkAccessHttpBackend::ignoreSslErrors(const QList<QSslError> &errors)
+{
+ if (httpReply) {
+ httpReply->ignoreSslErrors(errors);
+ } else {
+ // the pending list is set if QNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)
+ // is called before QNetworkAccessManager::get() (or post(), etc.)
+ pendingIgnoreSslErrorsList = errors;
+ }
}
void QNetworkAccessHttpBackend::fetchSslConfiguration(QSslConfiguration &config) const
diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h
index dec69d0..968f4a5 100644
--- a/src/network/access/qnetworkaccesshttpbackend_p.h
+++ b/src/network/access/qnetworkaccesshttpbackend_p.h
@@ -85,6 +85,7 @@ public:
virtual void copyFinished(QIODevice *);
#ifndef QT_NO_OPENSSL
virtual void ignoreSslErrors();
+ virtual void ignoreSslErrors(const QList<QSslError> &errors);
virtual void fetchSslConfiguration(QSslConfiguration &configuration) const;
virtual void setSslConfiguration(const QSslConfiguration &configuration);
@@ -112,7 +113,8 @@ private:
#ifndef QT_NO_OPENSSL
QSslConfiguration *pendingSslConfiguration;
- bool pendingIgnoreSslErrors;
+ bool pendingIgnoreAllSslErrors;
+ QList<QSslError> pendingIgnoreSslErrorsList;
#endif
void disconnectFromHttp();
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index cd736c8..802e603 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -540,10 +540,10 @@ void QNetworkAccessManager::setCookieJar(QNetworkCookieJar *cookieJar)
}
/*!
- This function is used to post a request to obtain the network
- headers for \a request. It takes its name after the HTTP request
- associated (HEAD). It returns a new QNetworkReply object which
- will contain such headers.
+ Posts a request to obtain the network headers for \a request
+ and returns a new QNetworkReply object which will contain such headers
+
+ The function is named after the HTTP request associated (HEAD).
*/
QNetworkReply *QNetworkAccessManager::head(const QNetworkRequest &request)
{
@@ -551,11 +551,12 @@ QNetworkReply *QNetworkAccessManager::head(const QNetworkRequest &request)
}
/*!
- This function is used to post a request to obtain the contents of
- the target \a request. It will cause the contents to be
- downloaded, along with the headers associated with it. It returns
- a new QNetworkReply object opened for reading which emits its
- QIODevice::readyRead() signal whenever new data arrives.
+ Posts a request to obtain the contents of the target \a request
+ and returns a new QNetworkReply object opened for reading which emits the
+ \l{QIODevice::readyRead()}{readyRead()} signal whenever new data
+ arrives.
+
+ The contents as well as associated headers will be downloaded.
\sa post(), put(), deleteResource()
*/
@@ -565,18 +566,15 @@ QNetworkReply *QNetworkAccessManager::get(const QNetworkRequest &request)
}
/*!
- This function is used to send an HTTP POST request to the
- destination specified by \a request. The contents of the \a data
+ Sends an HTTP POST request to the destination specified by \a request
+ and returns a new QNetworkReply object opened for reading that will
+ contain the reply sent by the server. The contents of the \a data
device will be uploaded to the server.
- \a data must be opened for reading when this function is called
- and must remain valid until the finished() signal is emitted for
- this reply.
-
- The returned QNetworkReply object will be open for reading and
- will contain the reply sent by the server to the POST request.
+ \a data must be open for reading and must remain valid until the
+ finished() signal is emitted for this reply.
- Note: sending a POST request on protocols other than HTTP and
+ \note Sending a POST request on protocols other than HTTP and
HTTPS is undefined and will probably fail.
\sa get(), put(), deleteResource()
@@ -588,8 +586,9 @@ QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, QIODe
/*!
\overload
- This function sends the contents of the \a data byte array to the
- destination specified by \a request.
+
+ Sends the contents of the \a data byte array to the destination
+ specified by \a request.
*/
QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, const QByteArray &data)
{
@@ -603,20 +602,19 @@ QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, const
}
/*!
- This function is used to upload the contents of \a data to the
- destination \a request.
+ Uploads the contents of \a data to the destination \a request and
+ returnes a new QNetworkReply object that will be open for reply.
\a data must be opened for reading when this function is called
and must remain valid until the finished() signal is emitted for
this reply.
- The returned QNetworkReply object will be open for reply, but
- whether anything will be available for reading is protocol
- dependent. For HTTP, the server may send a small HTML page
- indicating the upload was successful (or not). Other protocols
- will probably have content in their replies.
+ Whether anything will be available for reading from the returned
+ object is protocol dependent. For HTTP, the server may send a
+ small HTML page indicating the upload was successful (or not).
+ Other protocols will probably have content in their replies.
- For HTTP, this request will send a PUT request, which most servers
+ \note For HTTP, this request will send a PUT request, which most servers
do not allow. Form upload mechanisms, including that of uploading
files through HTML forms, use the POST mechanism.
@@ -629,8 +627,8 @@ QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, QIODev
/*!
\overload
- This function sends the contents of the \a data byte array to the
- destination specified by \a request.
+ Sends the contents of the \a data byte array to the destination
+ specified by \a request.
*/
QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, const QByteArray &data)
{
@@ -646,9 +644,10 @@ QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, const
/*!
\since 4.6
- This function is used to send a request to delete the resource
- identified by the URL of \a request.
- This feature is currently available for HTTP only, performing an HTTP DELETE request.
+ Sends a request to delete the resource identified by the URL of \a request.
+
+ \note This feature is currently available for HTTP only, performing an
+ HTTP DELETE request.
\sa get(), post(), put()
*/
diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp
index 1b0d9f5..3abf927 100644
--- a/src/network/access/qnetworkreply.cpp
+++ b/src/network/access/qnetworkreply.cpp
@@ -442,6 +442,31 @@ QNetworkReply::NetworkError QNetworkReply::error() const
}
/*!
+ \since 4.6
+
+ Returns true when the reply has finished or was aborted.
+
+ \sa isRunning()
+*/
+bool QNetworkReply::isFinished() const
+{
+ return d_func()->isFinished();
+}
+
+/*!
+ \since 4.6
+
+ Returns true when the request is still processing and the
+ reply has not finished or was aborted yet.
+
+ \sa isFinished()
+*/
+bool QNetworkReply::isRunning() const
+{
+ return !isFinished();
+}
+
+/*!
Returns the URL of the content downloaded or uploaded. Note that
the URL may be different from that of the original request.
@@ -559,6 +584,38 @@ void QNetworkReply::setSslConfiguration(const QSslConfiguration &config)
qt_metacall(QMetaObject::InvokeMetaMethod, id, arr);
}
}
+
+/*!
+ \overload
+ \since 4.6
+
+ If this function is called, the SSL errors given in \a errors
+ will be ignored.
+
+ Note that you can set the expected certificate in the SSL error:
+ If, for instance, you want to issue a request to a server that uses
+ a self-signed certificate, consider the following snippet:
+
+ \snippet doc/src/snippets/code/src_network_access_qnetworkreply.cpp 0
+
+ Multiple calls to this function will replace the list of errors that
+ were passed in previous calls.
+ You can clear the list of errors you want to ignore by calling this
+ function with an empty list.
+
+ \sa sslConfiguration(), sslErrors(), QSslSocket::ignoreSslErrors()
+*/
+void QNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)
+{
+ // do this cryptic trick, because we could not add a virtual method to this class later on
+ // since that breaks binary compatibility
+ int id = metaObject()->indexOfMethod("ignoreSslErrorsImplementation(QList<QSslError>)");
+ if (id != -1) {
+ QList<QSslError> copy(errors);
+ void *arr[] = { 0, &copy };
+ qt_metacall(QMetaObject::InvokeMetaMethod, id, arr);
+ }
+}
#endif
/*!
@@ -573,7 +630,7 @@ void QNetworkReply::setSslConfiguration(const QSslConfiguration &config)
sslErrors() signal, which indicates which errors were
found.
- \sa sslConfiguration(), sslErrors()
+ \sa sslConfiguration(), sslErrors(), QSslSocket::ignoreSslErrors()
*/
void QNetworkReply::ignoreSslErrors()
{
diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h
index 7cb082f..679ab71 100644
--- a/src/network/access/qnetworkreply.h
+++ b/src/network/access/qnetworkreply.h
@@ -116,6 +116,8 @@ public:
QNetworkAccessManager::Operation operation() const;
QNetworkRequest request() const;
NetworkError error() const;
+ bool isFinished() const;
+ bool isRunning() const;
QUrl url() const;
// "cooked" headers
@@ -132,6 +134,7 @@ public:
#ifndef QT_NO_OPENSSL
QSslConfiguration sslConfiguration() const;
void setSslConfiguration(const QSslConfiguration &configuration);
+ void ignoreSslErrors(const QList<QSslError> &errors);
#endif
public Q_SLOTS:
diff --git a/src/network/access/qnetworkreply_p.h b/src/network/access/qnetworkreply_p.h
index c8543f0..b51e3fb 100644
--- a/src/network/access/qnetworkreply_p.h
+++ b/src/network/access/qnetworkreply_p.h
@@ -75,6 +75,8 @@ public:
static inline void setManager(QNetworkReply *reply, QNetworkAccessManager *manager)
{ reply->d_func()->manager = manager; }
+ virtual bool isFinished() const { return false; }
+
Q_DECLARE_PUBLIC(QNetworkReply)
};
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 6eacdf1..de7f8b4 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -91,6 +91,8 @@ void QNetworkReplyImplPrivate::_q_startOperation()
void QNetworkReplyImplPrivate::_q_copyReadyRead()
{
Q_Q(QNetworkReplyImpl);
+ if (state != Working)
+ return;
if (!copyDevice || !q->isOpen())
return;
@@ -101,16 +103,17 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead()
break;
bytesToRead = qBound<qint64>(1, bytesToRead, copyDevice->bytesAvailable());
- char *ptr = readBuffer.reserve(bytesToRead);
- qint64 bytesActuallyRead = copyDevice->read(ptr, bytesToRead);
+ QByteArray byteData;
+ byteData.resize(bytesToRead);
+ qint64 bytesActuallyRead = copyDevice->read(byteData.data(), byteData.size());
if (bytesActuallyRead == -1) {
- readBuffer.chop(bytesToRead);
+ byteData.clear();
backendNotify(NotifyCopyFinished);
break;
}
- if (bytesActuallyRead != bytesToRead)
- readBuffer.chop(bytesToRead - bytesActuallyRead);
+ byteData.resize(bytesActuallyRead);
+ readBuffer.append(byteData);
if (!copyDevice->isSequential() && copyDevice->atEnd()) {
backendNotify(NotifyCopyFinished);
@@ -382,26 +385,33 @@ qint64 QNetworkReplyImplPrivate::nextDownstreamBlockSize() const
if (readBufferMaxSize == 0)
return DesiredBufferSize;
- return qMax<qint64>(0, readBufferMaxSize - readBuffer.size());
+ return qMax<qint64>(0, readBufferMaxSize - readBuffer.byteAmount());
}
// we received downstream data and send this to the cache
// and to our readBuffer (which in turn gets read by the user of QNetworkReply)
-void QNetworkReplyImplPrivate::appendDownstreamData(const QByteArray &data)
+void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data)
{
Q_Q(QNetworkReplyImpl);
if (!q->isOpen())
return;
- char *ptr = readBuffer.reserve(data.size());
- memcpy(ptr, data.constData(), data.size());
-
if (cacheEnabled && !cacheSaveDevice) {
// save the meta data
QNetworkCacheMetaData metaData;
metaData.setUrl(url);
metaData = backend->fetchCacheMetaData(metaData);
+
+ // save the redirect request also in the cache
+ QVariant redirectionTarget = q->attribute(QNetworkRequest::RedirectionTargetAttribute);
+ if (redirectionTarget.isValid()) {
+ QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes();
+ attributes.insert(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget);
+ metaData.setAttributes(attributes);
+ }
+
cacheSaveDevice = networkCache->prepare(metaData);
+
if (!cacheSaveDevice || (cacheSaveDevice && !cacheSaveDevice->isOpen())) {
if (cacheSaveDevice && !cacheSaveDevice->isOpen())
qCritical("QNetworkReplyImpl: network cache returned a device that is not open -- "
@@ -414,10 +424,19 @@ void QNetworkReplyImplPrivate::appendDownstreamData(const QByteArray &data)
}
}
- if (cacheSaveDevice)
- cacheSaveDevice->write(data);
+ qint64 bytesWritten = 0;
+ for (int i = 0; i < data.bufferCount(); i++) {
+ QByteArray item = data[i];
+
+ if (cacheSaveDevice)
+ cacheSaveDevice->write(item.constData(), item.size());
+ readBuffer.append(item);
+
+ bytesWritten += item.size();
+ }
+ data.clear();
- bytesDownloaded += data.size();
+ bytesDownloaded += bytesWritten;
lastBytesDownloaded = bytesDownloaded;
QPointer<QNetworkReplyImpl> qq = q;
@@ -426,6 +445,8 @@ void QNetworkReplyImplPrivate::appendDownstreamData(const QByteArray &data)
pauseNotificationHandling();
emit q->downloadProgress(bytesDownloaded,
totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
+ // important: At the point of this readyRead(), the data parameter list must be empty,
+ // else implicit sharing will trigger memcpy when the user is reading data!
emit q->readyRead();
// hopefully we haven't been deleted here
@@ -462,8 +483,8 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data)
void QNetworkReplyImplPrivate::finished()
{
Q_Q(QNetworkReplyImpl);
- Q_ASSERT_X(state != Finished, "QNetworkReplyImpl",
- "Backend called finished/finishedWithError more than once");
+ if (state == Finished || state == Aborted)
+ return;
state = Finished;
pendingNotifications.clear();
@@ -531,6 +552,11 @@ void QNetworkReplyImplPrivate::sslErrors(const QList<QSslError> &errors)
#endif
}
+bool QNetworkReplyImplPrivate::isFinished() const
+{
+ return (state == Finished || state == Aborted);
+}
+
QNetworkReplyImpl::QNetworkReplyImpl(QObject *parent)
: QNetworkReply(*new QNetworkReplyImplPrivate, parent)
{
@@ -596,14 +622,14 @@ void QNetworkReplyImpl::close()
*/
qint64 QNetworkReplyImpl::bytesAvailable() const
{
- return QNetworkReply::bytesAvailable() + d_func()->readBuffer.size();
+ return QNetworkReply::bytesAvailable() + d_func()->readBuffer.byteAmount();
}
void QNetworkReplyImpl::setReadBufferSize(qint64 size)
{
Q_D(QNetworkReplyImpl);
if (size > d->readBufferMaxSize &&
- size == d->readBuffer.size())
+ size > d->readBuffer.byteAmount())
d->backendNotify(QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite);
QNetworkReply::setReadBufferSize(size);
@@ -633,6 +659,12 @@ void QNetworkReplyImpl::ignoreSslErrors()
d->backend->ignoreSslErrors();
}
+void QNetworkReplyImpl::ignoreSslErrorsImplementation(const QList<QSslError> &errors)
+{
+ Q_D(QNetworkReplyImpl);
+ if (d->backend)
+ d->backend->ignoreSslErrors(errors);
+}
#endif // QT_NO_OPENSSL
/*!
@@ -651,7 +683,7 @@ qint64 QNetworkReplyImpl::readData(char *data, qint64 maxlen)
return 1;
}
- maxlen = qMin<qint64>(maxlen, d->readBuffer.size());
+ maxlen = qMin<qint64>(maxlen, d->readBuffer.byteAmount());
return d->readBuffer.read(data, maxlen);
}
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 3e89a00..fba8d34 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -61,6 +61,7 @@
#include "QtCore/qqueue.h"
#include "QtCore/qbuffer.h"
#include "private/qringbuffer_p.h"
+#include "private/qbytedata_p.h"
QT_BEGIN_NAMESPACE
@@ -88,6 +89,7 @@ public:
Q_INVOKABLE QSslConfiguration sslConfigurationImplementation() const;
Q_INVOKABLE void setSslConfigurationImplementation(const QSslConfiguration &configuration);
virtual void ignoreSslErrors();
+ Q_INVOKABLE virtual void ignoreSslErrorsImplementation(const QList<QSslError> &errors);
#endif
Q_DECLARE_PRIVATE(QNetworkReplyImpl)
@@ -144,7 +146,7 @@ public:
void consume(qint64 count);
void emitUploadProgress(qint64 bytesSent, qint64 bytesTotal);
qint64 nextDownstreamBlockSize() const;
- void appendDownstreamData(const QByteArray &data);
+ void appendDownstreamData(QByteDataBuffer &data);
void appendDownstreamData(QIODevice *data);
void finished();
void error(QNetworkReply::NetworkError code, const QString &errorString);
@@ -152,6 +154,8 @@ public:
void redirectionRequested(const QUrl &target);
void sslErrors(const QList<QSslError> &errors);
+ bool isFinished() const;
+
QNetworkAccessBackend *backend;
QIODevice *outgoingData;
QRingBuffer *outgoingDataBuffer;
@@ -170,7 +174,7 @@ public:
QList<QNetworkProxy> proxyList;
#endif
- QRingBuffer readBuffer;
+ QByteDataBuffer readBuffer;
qint64 bytesDownloaded;
qint64 lastBytesDownloaded;
qint64 bytesUploaded;
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 557143f..caa8669 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -153,9 +153,7 @@ QT_BEGIN_NAMESPACE
future uses. If the value is false, the data obtained will not
be automatically cached. If true, data may be cached, provided
it is cacheable (what is cacheable depends on the protocol
- being used). Note that the default QNetworkAccessManager
- implementation does not support caching, so it will ignore
- this attribute.
+ being used).
\value SourceIsFromCacheAttribute
Replies only, type: QVariant::Bool (default: false)
diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
index 876d167..af1eaf2 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -50,13 +50,12 @@
#include <qurl.h>
#include <qfile.h>
#include <private/qmutexpool_p.h>
+#include <private/qnet_unix_p.h>
-extern "C" {
#include <sys/types.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <resolv.h>
-}
#if defined (QT_NO_GETADDRINFO)
#include <qmutex.h>
@@ -178,7 +177,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
}
results.setHostName(QString::fromLatin1(hbuf));
#else
- in_addr_t inetaddr = inet_addr(hostName.toLatin1().constData());
+ in_addr_t inetaddr = qt_safe_inet_addr(hostName.toLatin1().constData());
struct hostent *ent = gethostbyaddr((const char *)&inetaddr, sizeof(inetaddr), AF_INET);
if (!ent) {
results.setError(QHostInfo::HostNotFound);
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index aa27726..4efbe45 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -43,6 +43,7 @@
#include "qnetworkinterface.h"
#include "qnetworkinterface_p.h"
#include "qalgorithms.h"
+#include "private/qnet_unix_p.h"
#ifndef QT_NO_NETWORKINTERFACE
@@ -123,7 +124,7 @@ static QSet<QByteArray> interfaceNames(int socket)
interfaceList.ifc_len = storageBuffer.size();
// get the interface list
- if (::ioctl(socket, SIOCGIFCONF, &interfaceList) >= 0) {
+ if (qt_safe_ioctl(socket, SIOCGIFCONF, &interfaceList) >= 0) {
if (int(interfaceList.ifc_len + sizeof(ifreq) + 64) < storageBuffer.size()) {
// if the buffer was big enough, break
storageBuffer.resize(interfaceList.ifc_len);
@@ -198,7 +199,7 @@ static QNetworkInterfacePrivate *findInterface(int socket, QList<QNetworkInterfa
#ifdef SIOCGIFNAME
// Get the canonical name
QByteArray oldName = req.ifr_name;
- if (::ioctl(socket, SIOCGIFNAME, &req) >= 0) {
+ if (qt_safe_ioctl(socket, SIOCGIFNAME, &req) >= 0) {
iface->name = QString::fromLatin1(req.ifr_name);
// reset the name:
@@ -211,13 +212,13 @@ static QNetworkInterfacePrivate *findInterface(int socket, QList<QNetworkInterfa
}
// Get interface flags
- if (::ioctl(socket, SIOCGIFFLAGS, &req) >= 0) {
+ if (qt_safe_ioctl(socket, SIOCGIFFLAGS, &req) >= 0) {
iface->flags = convertFlags(req.ifr_flags);
}
#ifdef SIOCGIFHWADDR
// Get the HW address
- if (::ioctl(socket, SIOCGIFHWADDR, &req) >= 0) {
+ if (qt_safe_ioctl(socket, SIOCGIFHWADDR, &req) >= 0) {
uchar *addr = (uchar *)&req.ifr_addr;
iface->hardwareAddress = iface->makeHwAddress(6, addr);
}
@@ -232,7 +233,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
QList<QNetworkInterfacePrivate *> interfaces;
int socket;
- if ((socket = ::socket(AF_INET, SOCK_STREAM, IPPROTO_IP)) == -1)
+ if ((socket = qt_safe_socket(AF_INET, SOCK_STREAM, IPPROTO_IP)) == -1)
return interfaces; // error
QSet<QByteArray> names = interfaceNames(socket);
@@ -247,7 +248,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
// Get the interface broadcast address
QNetworkAddressEntry entry;
if (iface->flags & QNetworkInterface::CanBroadcast) {
- if (::ioctl(socket, SIOCGIFBRDADDR, &req) >= 0) {
+ if (qt_safe_ioctl(socket, SIOCGIFBRDADDR, &req) >= 0) {
sockaddr *sa = &req.ifr_addr;
if (sa->sa_family == AF_INET)
entry.setBroadcast(addressFromSockaddr(sa));
@@ -255,13 +256,13 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
}
// Get the interface netmask
- if (::ioctl(socket, SIOCGIFNETMASK, &req) >= 0) {
+ if (qt_safe_ioctl(socket, SIOCGIFNETMASK, &req) >= 0) {
sockaddr *sa = &req.ifr_addr;
entry.setNetmask(addressFromSockaddr(sa));
}
// Get the address of the interface
- if (::ioctl(socket, SIOCGIFADDR, &req) >= 0) {
+ if (qt_safe_ioctl(socket, SIOCGIFADDR, &req) >= 0) {
sockaddr *sa = &req.ifr_addr;
entry.setIp(addressFromSockaddr(sa));
}
@@ -392,7 +393,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
QList<QNetworkInterfacePrivate *> interfaces;
int socket;
- if ((socket = ::socket(AF_INET, SOCK_STREAM, IPPROTO_IP)) == -1)
+ if ((socket = qt_safe_socket(AF_INET, SOCK_STREAM, IPPROTO_IP)) == -1)
return interfaces; // error
ifaddrs *interfaceListing;
diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp
index a8f5213..1d700c3 100644
--- a/src/network/kernel/qnetworkinterface_win.cpp
+++ b/src/network/kernel/qnetworkinterface_win.cpp
@@ -66,19 +66,14 @@ static void resolveLibs()
if (!done) {
done = true;
- HINSTANCE iphlpapiHnd;
- QT_WA({
- iphlpapiHnd = LoadLibraryW(L"iphlpapi");
- }, {
- iphlpapiHnd = LoadLibraryA("iphlpapi");
- });
+ HINSTANCE iphlpapiHnd = LoadLibrary(L"iphlpapi");
if (iphlpapiHnd == NULL)
- return; // failed to load, probably Windows 95
+ return;
#if defined(Q_OS_WINCE)
- ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddressW(iphlpapiHnd, L"GetAdaptersInfo");
- ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddressW(iphlpapiHnd, L"GetAdaptersAddresses");
- ptrGetNetworkParams = (PtrGetNetworkParams)GetProcAddressW(iphlpapiHnd, L"GetNetworkParams");
+ ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddress(iphlpapiHnd, L"GetAdaptersInfo");
+ ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddress(iphlpapiHnd, L"GetAdaptersAddresses");
+ ptrGetNetworkParams = (PtrGetNetworkParams)GetProcAddress(iphlpapiHnd, L"GetNetworkParams");
#else
ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddress(iphlpapiHnd, "GetAdaptersInfo");
ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddress(iphlpapiHnd, "GetAdaptersAddresses");
diff --git a/src/network/kernel/qnetworkinterface_win_p.h b/src/network/kernel/qnetworkinterface_win_p.h
index c4dff76..15b4859 100644
--- a/src/network/kernel/qnetworkinterface_win_p.h
+++ b/src/network/kernel/qnetworkinterface_win_p.h
@@ -54,7 +54,7 @@
//
#include <winsock2.h>
-#include <windows.h>
+#include <qt_windows.h>
#include <time.h>
QT_BEGIN_NAMESPACE
diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp
index 5fda228..9fab545 100644
--- a/src/network/kernel/qnetworkproxy_win.cpp
+++ b/src/network/kernel/qnetworkproxy_win.cpp
@@ -43,15 +43,13 @@
#ifndef QT_NO_NETWORKPROXY
-#if defined(UNICODE)
-
#include <qmutex.h>
#include <qstringlist.h>
#include <qregexp.h>
#include <qurl.h>
#include <string.h>
-#include <windows.h>
+#include <qt_windows.h>
#include <wininet.h>
/*
@@ -269,15 +267,13 @@ void QWindowsSystemProxy::init()
if (initialized)
return;
initialized = true;
- if (QSysInfo::windowsVersion() & QSysInfo::WV_DOS_based)
- return; // no point, this library is only available on 2k, XP and up
#ifdef Q_OS_WINCE
// Windows CE does not have any of the following API
return;
#else
// load the winhttp.dll library
- HINSTANCE winhttpHnd = LoadLibraryW(L"winhttp");
+ HINSTANCE winhttpHnd = LoadLibrary(L"winhttp");
if (!winhttpHnd)
return; // failed to load
@@ -401,15 +397,6 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
return parseServerList(query, sp->proxyServerList);
}
-#else // !UNICODE
-
-QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &)
-{
- return QList<QNetworkProxy>() << QNetworkProxy::NoProxy;
-}
-
-#endif
-
QT_END_NAMESPACE
#endif
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index f45b77d..9545291 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -332,6 +332,22 @@
\sa QAbstractSocket::state()
*/
+/*!
+ \enum QAbstractSocket::SocketOption
+ \since 4.6
+
+ This enum represents the options that can be set on a socket.
+ If desired, they can be set after having received the connected() signal from
+ the socket or after having received a new socket from a QTcpServer.
+
+ \value LowDelayOption Try to optimize the socket for low latency. For a QTcpSocket
+ this would set the TCP_NODELAY option and disable Nagle's algorithm. Set this to 1
+ to enable.
+ \value KeepAliveOption Set this to 1 to enable the SO_KEEPALIVE socket option
+
+ \sa QAbstractSocket::setSocketOption(), QAbstractSocket::socketOption()
+*/
+
#include "qabstractsocket.h"
#include "qabstractsocket_p.h"
@@ -1549,6 +1565,56 @@ bool QAbstractSocket::setSocketDescriptor(int socketDescriptor, SocketState sock
return true;
}
+/*!
+ Sets the option \a option to the value described by \a value.
+
+ \sa socketOption()
+ \since 4.6
+*/
+void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, QVariant value)
+{
+ if (!d_func()->socketEngine)
+ return;
+
+ switch (option) {
+ case LowDelayOption:
+ d_func()->socketEngine->setOption(QAbstractSocketEngine::LowDelayOption, value.toInt());
+ break;
+
+ case KeepAliveOption:
+ d_func()->socketEngine->setOption(QAbstractSocketEngine::KeepAliveOption, value.toInt());
+ break;
+ }
+}
+
+/*!
+ Returns the value of the \a option option.
+
+ \sa setSocketOption()
+ \since 4.6
+*/
+QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option)
+{
+ if (!d_func()->socketEngine)
+ return QVariant();
+
+ int ret = -1;
+ switch (option) {
+ case LowDelayOption:
+ ret = d_func()->socketEngine->option(QAbstractSocketEngine::LowDelayOption);
+ break;
+
+ case KeepAliveOption:
+ ret = d_func()->socketEngine->option(QAbstractSocketEngine::KeepAliveOption);
+ break;
+ }
+ if (ret == -1)
+ return QVariant();
+ else
+ return QVariant(ret);
+}
+
+
/*
Returns the difference between msecs and elapsed. If msecs is -1,
however, -1 is returned.
diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h
index ed187e5..50a38bb 100644
--- a/src/network/socket/qabstractsocket.h
+++ b/src/network/socket/qabstractsocket.h
@@ -116,6 +116,10 @@ public:
Connection = ConnectedState
#endif
};
+ enum SocketOption {
+ LowDelayOption, // TCP_NODELAY
+ KeepAliveOption // SO_KEEPALIVE
+ };
QAbstractSocket(SocketType socketType, QObject *parent);
virtual ~QAbstractSocket();
@@ -149,6 +153,10 @@ public:
bool setSocketDescriptor(int socketDescriptor, SocketState state = ConnectedState,
OpenMode openMode = ReadWrite);
+ // ### Qt 5: Make virtual?
+ void setSocketOption(QAbstractSocket::SocketOption o, QVariant v);
+ QVariant socketOption(QAbstractSocket::SocketOption o);
+
SocketType socketType() const;
SocketState state() const;
SocketError error() const;
diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h
index b784f65..39c00cc 100644
--- a/src/network/socket/qabstractsocketengine_p.h
+++ b/src/network/socket/qabstractsocketengine_p.h
@@ -92,7 +92,9 @@ public:
SendBufferSocketOption,
AddressReusable,
BindExclusively,
- ReceiveOutOfBandData
+ ReceiveOutOfBandData,
+ LowDelayOption,
+ KeepAliveOption
};
virtual bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) = 0;
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 7bac1f2..84b7c14 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -276,13 +276,30 @@ qint64 QHttpSocketEngine::pendingDatagramSize() const
}
#endif // QT_NO_UDPSOCKET
-int QHttpSocketEngine::option(SocketOption) const
+int QHttpSocketEngine::option(SocketOption option) const
{
+ Q_D(const QHttpSocketEngine);
+ if (d->socket) {
+ // convert the enum and call the real socket
+ if (option == QAbstractSocketEngine::LowDelayOption)
+ return d->socket->socketOption(QAbstractSocket::LowDelayOption).toInt();
+ if (option == QAbstractSocketEngine::KeepAliveOption)
+ return d->socket->socketOption(QAbstractSocket::KeepAliveOption).toInt();
+ }
return -1;
}
-bool QHttpSocketEngine::setOption(SocketOption, int)
+bool QHttpSocketEngine::setOption(SocketOption option, int value)
{
+ Q_D(QHttpSocketEngine);
+ if (d->socket) {
+ // convert the enum and call the real socket
+ if (option == QAbstractSocketEngine::LowDelayOption)
+ d->socket->setSocketOption(QAbstractSocket::LowDelayOption, value);
+ if (option == QAbstractSocketEngine::KeepAliveOption)
+ d->socket->setSocketOption(QAbstractSocket::KeepAliveOption, value);
+ return true;
+ }
return false;
}
@@ -454,6 +471,7 @@ void QHttpSocketEngine::slotSocketConnected()
data += path;
data += " HTTP/1.1\r\n";
data += "Proxy-Connection: keep-alive\r\n"
+ "User-Agent: Mozilla/5.0\r\n"
"Host: " + peerAddress + "\r\n";
QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
//qDebug() << "slotSocketConnected: priv=" << priv << (priv ? (int)priv->method : -1);
diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp
index aa32763..7bb0b01 100644
--- a/src/network/socket/qlocalserver.cpp
+++ b/src/network/socket/qlocalserver.cpp
@@ -78,8 +78,6 @@ QT_BEGIN_NAMESPACE
to use it without one. In that case, you must use waitForNewConnection(),
which blocks until either a connection is available or a timeout expires.
- Note that this feature is not supported on Windows 9x.
-
\sa QLocalSocket, QTcpServer
*/
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index e4bc1aa..01732e4 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -43,6 +43,7 @@
#include "qlocalserver_p.h"
#include "qlocalsocket.h"
#include "qlocalsocket_p.h"
+#include "qnet_unix_p.h"
#ifndef QT_NO_LOCALSERVER
@@ -88,7 +89,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
serverName = requestedServerName;
// create the unix socket
- listenSocket = qSocket(PF_UNIX, SOCK_STREAM, 0);
+ listenSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0);
if (-1 == listenSocket) {
setError(QLatin1String("QLocalServer::listen"));
closeServer();
@@ -125,7 +126,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
#endif
// bind
- if(-1 == qBind(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) {
+ if(-1 == QT_SOCKET_BIND(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) {
setError(QLatin1String("QLocalServer::listen"));
// if address is in use already, just close the socket, but do not delete the file
if(errno == EADDRINUSE)
@@ -138,7 +139,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
}
// listen for connections
- if (-1 == qListen(listenSocket, 50)) {
+ if (-1 == qt_safe_listen(listenSocket, 50)) {
setError(QLatin1String("QLocalServer::listen"));
closeServer();
listenSocket = -1;
@@ -190,7 +191,7 @@ void QLocalServerPrivate::_q_onNewConnection()
::sockaddr_un addr;
QT_SOCKLEN_T length = sizeof(sockaddr_un);
- int connectedSocket = qAccept(listenSocket, (sockaddr *)&addr, &length);
+ int connectedSocket = qt_safe_accept(listenSocket, (sockaddr *)&addr, &length);
if(-1 == connectedSocket) {
setError(QLatin1String("QLocalSocket::activated"));
closeServer();
diff --git a/src/network/socket/qlocalserver_win.cpp b/src/network/socket/qlocalserver_win.cpp
index 6af5ca5..c4f8f3c 100644
--- a/src/network/socket/qlocalserver_win.cpp
+++ b/src/network/socket/qlocalserver_win.cpp
@@ -62,9 +62,8 @@ bool QLocalServerPrivate::addListener()
listeners << Listener();
Listener &listener = listeners.last();
- QT_WA({
- listener.handle = CreateNamedPipeW(
- (TCHAR*)fullServerName.utf16(), // pipe name
+ listener.handle = CreateNamedPipe(
+ (const wchar_t *)fullServerName.utf16(), // pipe name
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, // read/write access
PIPE_TYPE_MESSAGE | // message type pipe
PIPE_READMODE_MESSAGE | // message-read mode
@@ -74,19 +73,7 @@ bool QLocalServerPrivate::addListener()
BUFSIZE, // input buffer size
3000, // client time-out
NULL);
- }, {
- listener.handle = CreateNamedPipeA(
- fullServerName.toLocal8Bit().constData(), // pipe name
- PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, // read/write access
- PIPE_TYPE_MESSAGE | // message type pipe
- PIPE_READMODE_MESSAGE | // message-read mode
- PIPE_WAIT, // blocking mode
- PIPE_UNLIMITED_INSTANCES, // max. instances
- BUFSIZE, // output buffer size
- BUFSIZE, // input buffer size
- 3000, // client time-out
- NULL);
- });
+
if (listener.handle == INVALID_HANDLE_VALUE) {
setError(QLatin1String("QLocalServerPrivate::addListener"));
listeners.removeLast();
diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp
index acacdf2..7809226 100644
--- a/src/network/socket/qlocalsocket.cpp
+++ b/src/network/socket/qlocalsocket.cpp
@@ -63,7 +63,8 @@ QT_BEGIN_NAMESPACE
waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected()
which blocks until the operation is complete or the timeout expires.
- Note that this feature is not supported on Window 9x.
+ Note that this feature is not supported on versions of Windows earlier than
+ Windows XP.
\sa QLocalServer
*/
@@ -102,7 +103,7 @@ QT_BEGIN_NAMESPACE
opened in the mode specified by \a openMode, and enters the socket state
specified by \a socketState.
- Note: It is not possible to initialize two local sockets with the same
+ \note It is not possible to initialize two local sockets with the same
native socket descriptor.
\sa socketDescriptor(), state(), openMode()
@@ -207,10 +208,10 @@ QT_BEGIN_NAMESPACE
Returns true if the socket is valid and ready for use; otherwise
returns false.
- Note: The socket's state must be ConnectedState before reading
+ \note The socket's state must be ConnectedState before reading
and writing can occur.
- \sa state()
+ \sa state(), connectToServer()
*/
/*!
@@ -243,9 +244,9 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool QLocalSocket::waitForConnected(int msec)
+ \fn bool QLocalSocket::waitForConnected(int msecs)
- Waits until the socket is connected, up to \a msec milliseconds. If the
+ Waits until the socket is connected, up to \a msecs milliseconds. If the
connection has been established, this function returns true; otherwise
it returns false. In the case where it returns false, you can call
error() to determine the cause of the error.
@@ -255,7 +256,7 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/code/src_network_socket_qlocalsocket_unix.cpp 0
- If msecs is -1, this function will not time out.
+ If \a msecs is -1, this function will not time out.
\sa connectToServer(), connected()
*/
@@ -274,7 +275,7 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/code/src_network_socket_qlocalsocket_unix.cpp 1
- If msecs is -1, this function will not time out.
+ If \a msecs is -1, this function will not time out.
\sa disconnectFromServer(), close()
*/
@@ -309,9 +310,10 @@ QT_BEGIN_NAMESPACE
parameter describes the type of error that occurred.
QLocalSocket::LocalSocketError is not a registered metatype, so for queued
- connections, you will have to register it with Q_DECLARE_METATYPE.
+ connections, you will have to register it with Q_DECLARE_METATYPE() and
+ qRegisterMetaType().
- \sa error(), errorString()
+ \sa error(), errorString(), {Creating Custom Qt Types}
*/
/*!
@@ -321,9 +323,10 @@ QT_BEGIN_NAMESPACE
The \a socketState parameter is the new state.
QLocalSocket::SocketState is not a registered metatype, so for queued
- connections, you will have to register it with Q_DECLARE_METATYPE.
+ connections, you will have to register it with Q_DECLARE_METATYPE() and
+ qRegisterMetaType().
- \sa state()
+ \sa state(), {Creating Custom Qt Types}
*/
/*!
@@ -365,7 +368,7 @@ QString QLocalSocket::serverName() const
/*!
Returns the server path that the socket is connected to.
- Note: This is platform specific
+ \note The return value of this function is platform specific.
\sa connectToServer(), serverName()
*/
diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h
index 417671a..4bff62e 100644
--- a/src/network/socket/qlocalsocket.h
+++ b/src/network/socket/qlocalsocket.h
@@ -134,6 +134,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_notified())
Q_PRIVATE_SLOT(d_func(), void _q_canWrite())
Q_PRIVATE_SLOT(d_func(), void _q_pipeClosed())
+ Q_PRIVATE_SLOT(d_func(), void _q_emitReadyRead())
#else
Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState))
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError))
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index 24b5dd6..2dae7d9 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -65,6 +65,7 @@
#elif defined(Q_OS_WIN)
# include "private/qwindowspipewriter_p.h"
# include "private/qringbuffer_p.h"
+# include <private/qwineventnotifier_p.h>
#else
# include "private/qnativesocketengine_p.h"
# include <qtcpsocket.h>
@@ -74,43 +75,6 @@
QT_BEGIN_NAMESPACE
-#if !defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP)
-static inline int qSocket(int af, int socketype, int proto)
-{
- int ret;
- while((ret = qt_socket_socket(af, socketype, proto)) == -1 && errno == EINTR){}
- return ret;
-}
-
-static inline int qBind(int fd, const sockaddr *sa, int len)
-{
- int ret;
- while((ret = QT_SOCKET_BIND(fd, (sockaddr*)sa, len)) == -1 && errno == EINTR){}
- return ret;
-}
-
-static inline int qConnect(int fd, const sockaddr *sa, int len)
-{
- int ret;
- while((ret = QT_SOCKET_CONNECT(fd, (sockaddr*)sa, len)) == -1 && errno == EINTR){}
- return ret;
-}
-
-static inline int qListen(int fd, int backlog)
-{
- int ret;
- while((ret = qt_socket_listen(fd, backlog)) == -1 && errno == EINTR){}
- return ret;
-}
-
-static inline int qAccept(int fd, struct sockaddr *addr, QT_SOCKLEN_T *addrlen)
-{
- int ret;
- while((ret = qt_socket_accept(fd, addr, addrlen)) == -1 && errno == EINTR){}
- return ret;
-}
-#endif //#if !defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP)
-
#if !defined(Q_OS_WIN) || defined(QT_LOCALSOCKET_TCP)
class QLocalUnixSocket : public QTcpSocket
{
@@ -172,18 +136,23 @@ public:
void _q_notified();
void _q_canWrite();
void _q_pipeClosed();
- qint64 readData(char *data, qint64 maxSize);
- qint64 bytesAvailable();
- bool readFromSocket();
+ void _q_emitReadyRead();
+ DWORD bytesAvailable();
+ void startAsyncRead();
+ void completeAsyncRead();
+ void checkReadyRead();
HANDLE handle;
OVERLAPPED overlapped;
QWindowsPipeWriter *pipeWriter;
qint64 readBufferMaxSize;
QRingBuffer readBuffer;
- QTimer dataNotifier;
+ int actualReadBufferSize;
+ QWinEventNotifier *dataReadNotifier;
QLocalSocket::LocalSocketError error;
- bool readyReadEmitted;
+ bool readSequenceStarted;
+ bool pendingReadyRead;
bool pipeClosed;
+ static const qint64 initialReadBufferSize = 4096;
#else
QLocalUnixSocket unixSocket;
QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const;
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index cba5a7f..9f39bef 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -41,6 +41,7 @@
#include "qlocalsocket.h"
#include "qlocalsocket_p.h"
+#include "qnet_unix_p.h"
#ifndef QT_NO_LOCALSOCKET
@@ -232,7 +233,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
}
// create the socket
- if (-1 == (d->connectingSocket = qSocket(PF_UNIX, SOCK_STREAM, 0))) {
+ if (-1 == (d->connectingSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0))) {
d->errorOccurred(UnsupportedSocketOperationError,
QLatin1String("QLocalSocket::connectToServer"));
return;
@@ -283,7 +284,7 @@ void QLocalSocketPrivate::_q_connectToSocket()
}
::memcpy(name.sun_path, connectingPathName.toLatin1().data(),
connectingPathName.toLatin1().size() + 1);
- if (-1 == qConnect(connectingSocket, (struct sockaddr *)&name, sizeof(name)) && errno != EISCONN) {
+ if (-1 == qt_safe_connect(connectingSocket, (struct sockaddr *)&name, sizeof(name))) {
QString function = QLatin1String("QLocalSocket::connectToServer");
switch (errno)
{
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 2b8d7e5..3a36ac0 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -48,13 +48,13 @@
QT_BEGIN_NAMESPACE
-#define NOTIFYTIMEOUT 100
-
void QLocalSocketPrivate::init()
{
Q_Q(QLocalSocket);
- QObject::connect(&dataNotifier, SIGNAL(timeout()), q, SLOT(_q_notified()));
+ memset(&overlapped, 0, sizeof(overlapped));
overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ dataReadNotifier = new QWinEventNotifier(overlapped.hEvent, q);
+ q->connect(dataReadNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_notified()));
}
void QLocalSocketPrivate::setErrorString(const QString &function)
@@ -101,8 +101,10 @@ QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(),
handle(INVALID_HANDLE_VALUE),
pipeWriter(0),
readBufferMaxSize(0),
+ actualReadBufferSize(0),
error(QLocalSocket::UnknownSocketError),
- readyReadEmitted(false),
+ readSequenceStarted(false),
+ pendingReadyRead(false),
pipeClosed(false),
state(QLocalSocket::UnconnectedState)
{
@@ -137,25 +139,14 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
forever {
DWORD permissions = (openMode & QIODevice::ReadOnly) ? GENERIC_READ : 0;
permissions |= (openMode & QIODevice::WriteOnly) ? GENERIC_WRITE : 0;
- QT_WA({
- localSocket = CreateFileW(
- (TCHAR*)d->fullServerName.utf16(), // pipe name
- permissions,
- 0, // no sharing
- NULL, // default security attributes
- OPEN_EXISTING, // opens existing pipe
- FILE_FLAG_OVERLAPPED,
- NULL); // no template file
- }, {
- localSocket = CreateFileA(
- d->fullServerName.toLocal8Bit().constData(), // pipe name
- permissions,
- 0, // no sharing
- NULL, // default security attributes
- OPEN_EXISTING, // opens existing pipe
- FILE_FLAG_OVERLAPPED,
- NULL); // no template file
- });
+ localSocket = CreateFile((const wchar_t *)d->fullServerName.utf16(), // pipe name
+ permissions,
+ 0, // no sharing
+ NULL, // default security attributes
+ OPEN_EXISTING, // opens existing pipe
+ FILE_FLAG_OVERLAPPED,
+ NULL); // no template file
+
if (localSocket != INVALID_HANDLE_VALUE)
break;
DWORD error = GetLastError();
@@ -165,13 +156,8 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
}
// All pipe instances are busy, so wait until connected or up to 5 seconds.
- QT_WA({
- if (!WaitNamedPipeW((TCHAR*)d->fullServerName.utf16(), 5000))
- break;
- }, {
- if (!WaitNamedPipeA(d->fullServerName.toLocal8Bit().constData(), 5000))
- break;
- });
+ if (!WaitNamedPipe((const wchar_t *)d->fullServerName.utf16(), 5000))
+ break;
}
if (localSocket == INVALID_HANDLE_VALUE) {
@@ -182,7 +168,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
// we have a valid handle
d->serverName = name;
- if (setSocketDescriptor((quintptr)localSocket), openMode) {
+ if (setSocketDescriptor((quintptr)localSocket, ConnectedState, openMode)) {
d->handle = localSocket;
emit connected();
}
@@ -192,82 +178,103 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
qint64 QLocalSocket::readData(char *data, qint64 maxSize)
{
Q_D(QLocalSocket);
- if (d->readBuffer.isEmpty()) {
- if (!d->readFromSocket()) {
- if (d->pipeClosed)
- return -1;
- return 0;
- }
- }
- if (!d->dataNotifier.isActive() && d->threadData->eventDispatcher)
- d->dataNotifier.start(NOTIFYTIMEOUT);
-
- if (d->readBuffer.isEmpty())
- return qint64(0);
-
- // If readFromSocket() read data, copy it to its destination.
- if (maxSize == 1) {
+ qint64 readSoFar;
+ // If startAsyncRead() read data, copy it to its destination.
+ if (maxSize == 1 && d->actualReadBufferSize > 0) {
*data = d->readBuffer.getChar();
- return 1;
+ d->actualReadBufferSize--;
+ readSoFar = 1;
+ } else {
+ qint64 bytesToRead = qMin(qint64(d->actualReadBufferSize), maxSize);
+ readSoFar = 0;
+ while (readSoFar < bytesToRead) {
+ const char *ptr = d->readBuffer.readPointer();
+ int bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar,
+ qint64(d->readBuffer.nextDataBlockSize()));
+ memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock);
+ readSoFar += bytesToReadFromThisBlock;
+ d->readBuffer.free(bytesToReadFromThisBlock);
+ d->actualReadBufferSize -= bytesToReadFromThisBlock;
+ }
}
- qint64 bytesToRead = qMin(qint64(d->readBuffer.size()), maxSize);
- qint64 readSoFar = 0;
- while (readSoFar < bytesToRead) {
- const char *ptr = d->readBuffer.readPointer();
- int bytesToReadFromThisBlock = qMin(int(bytesToRead - readSoFar),
- d->readBuffer.nextDataBlockSize());
- memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock);
- readSoFar += bytesToReadFromThisBlock;
- d->readBuffer.free(bytesToReadFromThisBlock);
- }
+ if (!d->readSequenceStarted)
+ d->startAsyncRead();
+ d->checkReadyRead();
+
return readSoFar;
}
/*!
\internal
- read from the socket
+ Schedules or cancels a readyRead() emission depending on actual data availability
*/
-qint64 QLocalSocketPrivate::readData(char *data, qint64 maxSize)
+void QLocalSocketPrivate::checkReadyRead()
{
- DWORD bytesRead = 0;
- overlapped.Offset = 0;
- overlapped.OffsetHigh = 0;
- bool success = ReadFile(handle, data, maxSize, &bytesRead, &overlapped);
- if (!success && GetLastError() == ERROR_IO_PENDING)
- if (GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE))
- success = true;
- if (!success) {
- setErrorString(QLatin1String("QLocalSocket::readData"));
- return 0;
+ if (actualReadBufferSize > 0) {
+ if (!pendingReadyRead) {
+ Q_Q(QLocalSocket);
+ QTimer::singleShot(0, q, SLOT(_q_emitReadyRead()));
+ pendingReadyRead = true;
+ }
+ } else {
+ pendingReadyRead = false;
}
- return bytesRead;
}
/*!
\internal
Reads data from the socket into the readbuffer
*/
-bool QLocalSocketPrivate::readFromSocket()
+void QLocalSocketPrivate::startAsyncRead()
{
- qint64 bytesToRead = bytesAvailable();
- if (bytesToRead == 0)
- return false;
+ do {
+ DWORD bytesToRead = bytesAvailable();
+ if (bytesToRead == 0) {
+ // There are no bytes in the pipe but we need to
+ // start the overlapped read with some buffer size.
+ bytesToRead = initialReadBufferSize;
+ }
- if (readBufferMaxSize && bytesToRead
- > (readBufferMaxSize - readBuffer.size()))
- bytesToRead = readBufferMaxSize - readBuffer.size();
+ if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) {
+ bytesToRead = readBufferMaxSize - readBuffer.size();
+ if (bytesToRead == 0) {
+ // Buffer is full. User must read data from the buffer
+ // before we can read more from the pipe.
+ return;
+ }
+ }
- char *ptr = readBuffer.reserve(bytesToRead);
- qint64 readBytes = readData(ptr, bytesToRead);
- if (readBytes == 0) {
- readBuffer.chop(bytesToRead);
- return false;
+ char *ptr = readBuffer.reserve(bytesToRead);
+
+ readSequenceStarted = true;
+ if (ReadFile(handle, ptr, bytesToRead, NULL, &overlapped)) {
+ completeAsyncRead();
+ } else if (GetLastError() != ERROR_IO_PENDING) {
+ setErrorString(QLatin1String("QLocalSocketPrivate::startAsyncRead"));
+ return;
+ }
+ } while (!readSequenceStarted);
+}
+
+/*!
+ \internal
+ Sets the correct size of the read buffer after a read operation.
+ */
+void QLocalSocketPrivate::completeAsyncRead()
+{
+ ResetEvent(overlapped.hEvent);
+ readSequenceStarted = false;
+
+ DWORD bytesRead;
+ if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) {
+ setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead"));
+ return;
}
- readyReadEmitted = false;
- readBuffer.chop(int(bytesToRead - (readBytes < 0 ? qint64(0) : readBytes)));
- return true;
+
+ actualReadBufferSize += bytesRead;
+ readBuffer.truncate(actualReadBufferSize);
}
qint64 QLocalSocket::writeData(const char *data, qint64 maxSize)
@@ -289,11 +296,9 @@ void QLocalSocket::abort()
/*!
The number of bytes available from the pipe
*/
-qint64 QLocalSocketPrivate::bytesAvailable()
+DWORD QLocalSocketPrivate::bytesAvailable()
{
Q_Q(QLocalSocket);
- if (q->state() != QLocalSocket::ConnectedState)
- return 0;
DWORD bytes;
if (PeekNamedPipe(handle, NULL, 0, NULL, &bytes, NULL)) {
return bytes;
@@ -316,7 +321,7 @@ qint64 QLocalSocket::bytesAvailable() const
{
Q_D(const QLocalSocket);
qint64 available = QIODevice::bytesAvailable();
- available += (qint64) d->readBuffer.size();
+ available += (qint64) d->actualReadBufferSize;
return available;
}
@@ -343,7 +348,6 @@ void QLocalSocket::close()
QIODevice::close();
d->state = ClosingState;
emit stateChanged(d->state);
- d->readyReadEmitted = false;
emit readChannelFinished();
d->serverName = QString();
d->fullServerName = QString();
@@ -352,10 +356,13 @@ void QLocalSocket::close()
disconnectFromServer();
return;
}
+ d->readSequenceStarted = false;
+ d->pendingReadyRead = false;
d->pipeClosed = false;
DisconnectNamedPipe(d->handle);
CloseHandle(d->handle);
d->handle = INVALID_HANDLE_VALUE;
+ ResetEvent(d->overlapped.hEvent);
d->state = UnconnectedState;
emit stateChanged(d->state);
emit disconnected();
@@ -363,7 +370,6 @@ void QLocalSocket::close()
delete d->pipeWriter;
d->pipeWriter = 0;
}
- d->dataNotifier.stop();
}
bool QLocalSocket::flush()
@@ -397,12 +403,15 @@ bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor,
{
Q_D(QLocalSocket);
d->readBuffer.clear();
+ d->actualReadBufferSize = 0;
QIODevice::open(openMode);
d->handle = (int*)socketDescriptor;
d->state = socketState;
emit stateChanged(d->state);
- if (d->threadData->eventDispatcher)
- d->dataNotifier.start(NOTIFYTIMEOUT);
+ if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly)) {
+ d->startAsyncRead();
+ d->checkReadyRead();
+ }
return true;
}
@@ -416,20 +425,18 @@ void QLocalSocketPrivate::_q_canWrite()
void QLocalSocketPrivate::_q_notified()
{
Q_Q(QLocalSocket);
- if (0 != bytesAvailable()) {
- if (readBufferMaxSize == 0 || readBuffer.size() < readBufferMaxSize) {
- if (!readFromSocket()) {
- return;
- }
- // wait until buffer is cleared before starting again
- if (readBufferMaxSize && readBuffer.size() == readBufferMaxSize) {
- dataNotifier.stop();
- }
- }
- if (!readyReadEmitted) {
- readyReadEmitted = true;
- q->emit readyRead();
- }
+ completeAsyncRead();
+ startAsyncRead();
+ pendingReadyRead = false;
+ emit q->readyRead();
+}
+
+void QLocalSocketPrivate::_q_emitReadyRead()
+{
+ if (pendingReadyRead) {
+ Q_Q(QLocalSocket);
+ pendingReadyRead = false;
+ emit q->readyRead();
}
}
@@ -462,11 +469,15 @@ bool QLocalSocket::waitForDisconnected(int msecs)
Q_D(QLocalSocket);
if (state() == UnconnectedState)
return false;
+ if (!openMode().testFlag(QIODevice::ReadOnly)) {
+ qWarning("QLocalSocket::waitForDisconnected isn't supported for write only pipes.");
+ return false;
+ }
QIncrementalSleepTimer timer(msecs);
forever {
- d->_q_notified();
- if (d->pipeClosed)
- close();
+ d->bytesAvailable(); // to check if PeekNamedPipe fails
+ if (d->pipeClosed)
+ close();
if (state() == UnconnectedState)
return true;
Sleep(timer.nextSleepTime());
@@ -486,22 +497,24 @@ bool QLocalSocket::isValid() const
bool QLocalSocket::waitForReadyRead(int msecs)
{
Q_D(QLocalSocket);
- QIncrementalSleepTimer timer(msecs);
- forever {
- d->_q_notified();
- if (bytesAvailable() > 0) {
- if (!d->readyReadEmitted) {
- d->readyReadEmitted = true;
- emit readyRead();
- }
- return true;
- }
- Sleep(timer.nextSleepTime());
- if (timer.hasTimedOut())
- break;
+ if (bytesAvailable() > 0)
+ return true;
+
+ if (d->state != QLocalSocket::ConnectedState)
+ return false;
+
+ Q_ASSERT(d->readSequenceStarted);
+ DWORD result = WaitForSingleObject(d->overlapped.hEvent, msecs == -1 ? INFINITE : msecs);
+ switch (result) {
+ case WAIT_OBJECT_0:
+ d->_q_notified();
+ return true;
+ case WAIT_TIMEOUT:
+ return false;
}
+ qWarning("QLocalSocket::waitForReadyRead WaitForSingleObject failed with error code %d.", int(GetLastError()));
return false;
}
@@ -511,27 +524,11 @@ bool QLocalSocket::waitForBytesWritten(int msecs)
if (!d->pipeWriter)
return false;
- QIncrementalSleepTimer timer(msecs);
- forever {
- if (d->pipeWriter->hadWritten())
- return true;
-
- if (d->pipeWriter->bytesToWrite() == 0)
- return false;
-
- // Wait for the pipe writer to acknowledge that it has
- // written. This will succeed if either the pipe writer has
- // already written the data, or if it manages to write data
- // within the given timeout.
- if (d->pipeWriter->waitForWrite(0))
- return true;
-
- Sleep(timer.nextSleepTime());
- if (timer.hasTimedOut())
- break;
- }
-
- return false;
+ // Wait for the pipe writer to acknowledge that it has
+ // written. This will succeed if either the pipe writer has
+ // already written the data, or if it manages to write data
+ // within the given timeout.
+ return d->pipeWriter->waitForWrite(msecs);
}
QT_END_NAMESPACE
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h
index a8d7fff..9136faa 100644
--- a/src/network/socket/qnativesocketengine_p.h
+++ b/src/network/socket/qnativesocketengine_p.h
@@ -67,29 +67,6 @@
QT_BEGIN_NAMESPACE
-
-#ifndef Q_OS_WIN
-// Almost always the same. If not, specify in qplatformdefs.h.
-#if !defined(QT_SOCKOPTLEN_T)
-# define QT_SOCKOPTLEN_T QT_SOCKLEN_T
-#endif
-
-// Tru64 redefines accept -> _accept with _XOPEN_SOURCE_EXTENDED
-static inline int qt_socket_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *addrlen)
-{ return ::accept(s, addr, static_cast<QT_SOCKLEN_T *>(addrlen)); }
-#if defined(accept)
-# undef accept
-#endif
-
-// UnixWare 7 redefines listen -> _listen
-static inline int qt_socket_listen(int s, int backlog)
-{
- return ::listen(s, backlog);
-}
-#if defined(listen)
-# undef listen
-#endif
-
static inline int qt_socket_connect(int s, const struct sockaddr * addrptr, socklen_t namelen)
{
return ::connect(s, addrptr, namelen);
@@ -216,17 +193,6 @@ static inline int qt_socket_setsockopt(int socket, int level, int optname, void
# undef setsockopt
#endif
-// UnixWare 7 redefines socket -> _socket
-static inline int qt_socket_socket(int domain, int type, int protocol)
-{
- return ::socket(domain, type, protocol);
-}
-#if defined(socket)
-# undef socket
-#endif
-
-#endif
-
// Use our own defines and structs which we know are correct
# define QT_SS_MAXSIZE 128
# define QT_SS_ALIGNSIZE (sizeof(qint64))
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 58adaff..ea8e756 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -41,6 +41,7 @@
//#define QNATIVESOCKETENGINE_DEBUG
#include "qnativesocketengine_p.h"
+#include "private/qnet_unix_p.h"
#include "qiodevice.h"
#include "qhostaddress.h"
#include "qvarlengtharray.h"
@@ -67,6 +68,8 @@
#include <ctype.h>
#endif
+#include <netinet/tcp.h>
+
QT_BEGIN_NAMESPACE
#if defined QNATIVESOCKETENGINE_DEBUG
@@ -169,7 +172,7 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
int protocol = AF_INET;
#endif
int type = (socketType == QAbstractSocket::UdpSocket) ? SOCK_DGRAM : SOCK_STREAM;
- int socket = qt_socket_socket(protocol, type, 0);
+ int socket = qt_safe_socket(protocol, type, 0);
if (socket <= 0) {
switch (errno) {
@@ -211,6 +214,8 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
return -1;
int n = -1;
+ int level = SOL_SOCKET; // default
+
switch (opt) {
case QNativeSocketEngine::ReceiveBufferSocketOption:
n = SO_RCVBUF;
@@ -230,11 +235,18 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
case QNativeSocketEngine::ReceiveOutOfBandData:
n = SO_OOBINLINE;
break;
+ case QNativeSocketEngine::LowDelayOption:
+ level = IPPROTO_TCP;
+ n = TCP_NODELAY;
+ break;
+ case QNativeSocketEngine::KeepAliveOption:
+ n = SO_KEEPALIVE;
+ break;
}
int v = -1;
QT_SOCKOPTLEN_T len = sizeof(v);
- if (qt_socket_getsockopt(socketDescriptor, SOL_SOCKET, n, (char *) &v, &len) != -1)
+ if (qt_socket_getsockopt(socketDescriptor, level, n, (char *) &v, &len) != -1)
return v;
return -1;
@@ -251,6 +263,8 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
return false;
int n = 0;
+ int level = SOL_SOCKET; // default
+
switch (opt) {
case QNativeSocketEngine::ReceiveBufferSocketOption:
n = SO_RCVBUF;
@@ -281,7 +295,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
}
case QNativeSocketEngine::AddressReusable:
#ifdef Q_OS_SYMBIAN
- n = SO_REUSEADDR;
+ n = SO_REUSEADDR;
#elif SO_REUSEPORT
n = SO_REUSEPORT;
#else
@@ -293,10 +307,16 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
case QNativeSocketEngine::ReceiveOutOfBandData:
n = SO_OOBINLINE;
break;
+ case QNativeSocketEngine::LowDelayOption:
+ level = IPPROTO_TCP;
+ n = TCP_NODELAY;
+ break;
+ case QNativeSocketEngine::KeepAliveOption:
+ n = SO_KEEPALIVE;
+ break;
}
- return qt_socket_setsockopt(socketDescriptor, SOL_SOCKET, n, (char *) &v, sizeof(v)) == 0;
-
+ return qt_socket_setsockopt(socketDescriptor, level, n, (char *) &v, sizeof(v)) == 0;
}
bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 port)
@@ -485,7 +505,7 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16
bool QNativeSocketEnginePrivate::nativeListen(int backlog)
{
- if (qt_socket_listen(socketDescriptor, backlog) < 0) {
+ if (qt_safe_listen(socketDescriptor, backlog) < 0) {
switch (errno) {
case EADDRINUSE:
setError(QAbstractSocket::AddressInUseError,
@@ -512,7 +532,7 @@ bool QNativeSocketEnginePrivate::nativeListen(int backlog)
int QNativeSocketEnginePrivate::nativeAccept()
{
- int acceptedDescriptor = qt_socket_accept(socketDescriptor, 0, 0);
+ int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0);
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativeAccept() == %i", acceptedDescriptor);
#endif
@@ -533,7 +553,7 @@ qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const
int nbytes = 0;
// gives shorter than true amounts on Unix domain sockets.
qint64 available = 0;
- if (::ioctl(socketDescriptor, FIONREAD, (char *) &nbytes) >= 0)
+ if (qt_safe_ioctl(socketDescriptor, FIONREAD, (char *) &nbytes) >= 0)
available = (qint64) nbytes;
#if defined (QNATIVESOCKETENGINE_DEBUG)
@@ -571,7 +591,7 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
#ifdef Q_OS_SYMBIAN
qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
{
- size_t nbytes = 0;
+ size_t nbytes = 0;
qt_socket_ioctl(socketDescriptor, E32IONREAD, (char *) &nbytes);
return qint64(nbytes-28);
}
@@ -579,7 +599,7 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
{
QVarLengthArray<char, 8192> udpMessagePeekBuffer(8192);
- ssize_t recvResult = -1;
+ ssize_t recvResult = -1;
for (;;) {
// the data written to udpMessagePeekBuffer is discarded, so
@@ -595,7 +615,7 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
udpMessagePeekBuffer.resize(udpMessagePeekBuffer.size() * 2);
}
-
+
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %i", recvResult);
#endif
@@ -667,8 +687,8 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
qt_ignore_sigpipe();
ssize_t sentBytes;
do {
- sentBytes = qt_socket_sendto(socketDescriptor, data, len,
- 0, sockAddrPtr, sockAddrSize);
+ sentBytes = qt_safe_sendto(socketDescriptor, data, len,
+ 0, sockAddrPtr, sockAddrSize);
} while (sentBytes == -1 && errno == EINTR);
if (sentBytes < 0) {
@@ -870,32 +890,27 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
-#ifdef Q_OS_SYMBIAN
+#ifdef Q_OS_SYMBIAN
fd_set fdexec;
FD_ZERO(&fdexec);
- FD_SET(socketDescriptor, &fdexec);
+ FD_SET(socketDescriptor, &fdexec);
#endif
- QTime timer;
- timer.start();
-
int retval;
- do {
- if (selectForRead)
+ if (selectForRead)
#ifndef Q_OS_SYMBIAN
- retval = qt_socket_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv);
-#else
- retval = qt_socket_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv);
-#endif
- else
+ retval = qt_safe_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv);
+#else
+ retval = qt_safe_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv);
+#endif
+ else
#ifndef Q_OS_SYMBIAN
- retval = qt_socket_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv);
-#else
- retval = qt_socket_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv);
-#endif
+ retval = qt_safe_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv);
+#else
+ retval = qt_safe_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv);
+#endif
-
-#ifdef Q_OS_SYMBIAN
+#ifdef Q_OS_SYMBIAN
bool selectForExec = false;
if(retval != 0) {
if(retval < 0) {
@@ -905,27 +920,9 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co
}
if(selectForExec) {
qWarning("nativeSelect (selectForRead %d, retVal %d, errno %d) Unexpected expectfds ready in fd %d",
- selectForRead, retval, errno, socketDescriptor);
+ selectForRead, retval, errno, socketDescriptor);
}
-#endif
-
- if (retval != -1 || errno != EINTR) {
- break;
- }
-
- if (timeout > 0) {
- // recalculate the timeout
- int t = timeout - timer.elapsed();
- if (t < 0) {
- // oops, timeout turned negative?
- retval = -1;
- break;
- }
-
- tv.tv_sec = t / 1000;
- tv.tv_usec = (t % 1000) * 1000;
- }
- } while (true);
+#endif
return retval;
}
@@ -942,25 +939,25 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c
FD_ZERO(&fdwrite);
if (checkWrite)
FD_SET(socketDescriptor, &fdwrite);
-
-#ifdef Q_OS_SYMBIAN
+
+#ifdef Q_OS_SYMBIAN
fd_set fdexec;
FD_ZERO(&fdexec);
- FD_SET(socketDescriptor, &fdexec);
-#endif
+ FD_SET(socketDescriptor, &fdexec);
+#endif
struct timeval tv;
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
+ int ret;
+#ifndef Q_OS_SYMBIAN
+ ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv);
+#else
QTime timer;
timer.start();
- int ret;
do {
-#ifndef Q_OS_SYMBIAN
- ret = qt_socket_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv);
-#else
ret = qt_socket_select(socketDescriptor + 1, &fdread, &fdwrite, &fdexec, timeout < 0 ? 0 : &tv);
bool selectForExec = false;
if(ret != 0) {
@@ -970,18 +967,18 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c
selectForExec = FD_ISSET(socketDescriptor, &fdexec);
}
if(selectForExec) {
- qWarning("nativeSelect (checkRead %d, checkWrite %d, ret %d, errno %d): Unexpected expectfds ready in fd %d",
- checkRead, checkWrite, ret, errno, socketDescriptor);
- if (checkRead)
- FD_SET(socketDescriptor, &fdread);
- if (checkWrite)
- FD_SET(socketDescriptor, &fdwrite);
-
- if ((ret == -1) && ( errno == ECONNREFUSED || errno == EPIPE ))
+ qWarning("nativeSelect (checkRead %d, checkWrite %d, ret %d, errno %d): Unexpected expectfds ready in fd %d",
+ checkRead, checkWrite, ret, errno, socketDescriptor);
+ if (checkRead)
+ FD_SET(socketDescriptor, &fdread);
+ if (checkWrite)
+ FD_SET(socketDescriptor, &fdwrite);
+
+ if ((ret == -1) && ( errno == ECONNREFUSED || errno == EPIPE ))
ret = 1;
-
+
}
-#endif
+
if (ret != -1 || errno != EINTR) {
break;
}
@@ -999,6 +996,8 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c
tv.tv_usec = (t % 1000) * 1000;
}
} while (true);
+#endif
+
if (ret <= 0)
return ret;
*selectForRead = FD_ISSET(socketDescriptor, &fdread);
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 59a3b60..f0b9f0b 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -166,11 +166,11 @@ static QByteArray qt_prettyDebug(const char *data, int len, int maxLength)
Extracts the port and address from a sockaddr, and stores them in
\a port and \a addr if they are non-null.
*/
-static inline void qt_socket_getPortAndAddress(SOCKET socketDescriptor, struct sockaddr *sa, quint16 *port, QHostAddress *address)
+static inline void qt_socket_getPortAndAddress(SOCKET socketDescriptor, const qt_sockaddr *sa, quint16 *port, QHostAddress *address)
{
#if !defined (QT_NO_IPV6)
- if (sa->sa_family == AF_INET6) {
- qt_sockaddr_in6 *sa6 = (qt_sockaddr_in6 *)sa;
+ if (sa->a.sa_family == AF_INET6) {
+ const qt_sockaddr_in6 *sa6 = &sa->a6;
Q_IPV6ADDR tmp;
for (int i = 0; i < 16; ++i)
tmp.c[i] = sa6->sin6_addr.qt_s6_addr[i];
@@ -182,8 +182,8 @@ static inline void qt_socket_getPortAndAddress(SOCKET socketDescriptor, struct s
WSANtohs(socketDescriptor, sa6->sin6_port, port);
} else
#endif
- if (sa->sa_family == AF_INET) {
- struct sockaddr_in *sa4 = (struct sockaddr_in *)sa;
+ if (sa->a.sa_family == AF_INET) {
+ const sockaddr_in *sa4 = &sa->a4;
unsigned long addr;
WSANtohl(socketDescriptor, sa4->sin_addr.s_addr, &addr);
QHostAddress a;
@@ -362,6 +362,8 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
return -1;
int n = -1;
+ int level = SOL_SOCKET; // default
+
switch (opt) {
case QNativeSocketEngine::ReceiveBufferSocketOption:
n = SO_RCVBUF;
@@ -389,11 +391,18 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
case QNativeSocketEngine::ReceiveOutOfBandData:
n = SO_OOBINLINE;
break;
+ case QNativeSocketEngine::LowDelayOption:
+ level = IPPROTO_TCP;
+ n = TCP_NODELAY;
+ break;
+ case QNativeSocketEngine::KeepAliveOption:
+ n = SO_KEEPALIVE;
+ break;
}
int v = -1;
QT_SOCKOPTLEN_T len = sizeof(v);
- if (getsockopt(socketDescriptor, SOL_SOCKET, n, (char *) &v, &len) != -1)
+ if (getsockopt(socketDescriptor, level, n, (char *) &v, &len) != -1)
return v;
return -1;
}
@@ -409,6 +418,8 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
return false;
int n = 0;
+ int level = SOL_SOCKET; // default
+
switch (opt) {
case QNativeSocketEngine::ReceiveBufferSocketOption:
n = SO_RCVBUF;
@@ -440,9 +451,16 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
case QNativeSocketEngine::ReceiveOutOfBandData:
n = SO_OOBINLINE;
break;
+ case QNativeSocketEngine::LowDelayOption:
+ level = IPPROTO_TCP;
+ n = TCP_NODELAY;
+ break;
+ case QNativeSocketEngine::KeepAliveOption:
+ n = SO_KEEPALIVE;
+ break;
}
- if (::setsockopt(socketDescriptor, SOL_SOCKET, n, (char*)&v, sizeof(v)) != 0) {
+ if (::setsockopt(socketDescriptor, level, n, (char*)&v, sizeof(v)) != 0) {
WS_ERROR_DEBUG(WSAGetLastError());
return false;
}
@@ -463,20 +481,15 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
if (socketDescriptor == -1)
return false;
-#if !defined (QT_NO_IPV6)
- struct qt_sockaddr_storage sa;
-#else
- struct sockaddr_in sa;
-#endif
- struct sockaddr *pSa = (struct sockaddr *) &sa;
-
- QT_SOCKLEN_T sz = sizeof(sa);
+ qt_sockaddr sa;
+ QT_SOCKLEN_T sockAddrSize = sizeof(sa);
+ // Determine local address
memset(&sa, 0, sizeof(sa));
- if (::getsockname(socketDescriptor, pSa, &sz) == 0) {
- qt_socket_getPortAndAddress(socketDescriptor, pSa, &localPort, &localAddress);
+ if (::getsockname(socketDescriptor, &sa.a, &sockAddrSize) == 0) {
+ qt_socket_getPortAndAddress(socketDescriptor, &sa, &localPort, &localAddress);
// Determine protocol family
- switch (pSa->sa_family) {
+ switch (sa.a.sa_family) {
case AF_INET:
socketProtocol = QAbstractSocket::IPv4Protocol;
break;
@@ -500,8 +513,8 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
}
memset(&sa, 0, sizeof(sa));
- if (::getpeername(socketDescriptor, pSa, &sz) == 0) {
- qt_socket_getPortAndAddress(socketDescriptor, pSa, &peerPort, &peerAddress);
+ if (::getpeername(socketDescriptor, &sa.a, &sockAddrSize) == 0) {
+ qt_socket_getPortAndAddress(socketDescriptor, &sa, &peerPort, &peerAddress);
} else {
WS_ERROR_DEBUG(WSAGetLastError());
}
@@ -533,8 +546,8 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin
struct sockaddr_in sockAddrIPv4;
qt_sockaddr_in6 sockAddrIPv6;
- struct sockaddr *sockAddrPtr;
- QT_SOCKLEN_T sockAddrSize;
+ struct sockaddr *sockAddrPtr = 0;
+ QT_SOCKLEN_T sockAddrSize = 0;
qt_socket_setPortAndAddress(socketDescriptor, &sockAddrIPv4, &sockAddrIPv6, port, address, &sockAddrPtr, &sockAddrSize);
@@ -638,8 +651,8 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16
{
struct sockaddr_in sockAddrIPv4;
qt_sockaddr_in6 sockAddrIPv6;
- struct sockaddr *sockAddrPtr;
- QT_SOCKLEN_T sockAddrSize;
+ struct sockaddr *sockAddrPtr = 0;
+ QT_SOCKLEN_T sockAddrSize = 0;
qt_socket_setPortAndAddress(socketDescriptor, &sockAddrIPv4, &sockAddrIPv6, port, address, &sockAddrPtr, &sockAddrSize);
@@ -766,20 +779,9 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
{
#if !defined(Q_OS_WINCE)
// Create a sockaddr struct and reset its port number.
-#if !defined(QT_NO_IPV6)
- qt_sockaddr_in6 storage;
- qt_sockaddr_in6 *storagePtrIPv6 = reinterpret_cast<qt_sockaddr_in6 *>(&storage);
- storagePtrIPv6->sin6_port = 0;
-#else
- struct sockaddr storage;
-#endif
- sockaddr *storagePtr = reinterpret_cast<sockaddr *>(&storage);
- storagePtr->sa_family = 0;
-
- sockaddr_in *storagePtrIPv4 = reinterpret_cast<sockaddr_in *>(&storage);
- storagePtrIPv4->sin_port = 0;
+ qt_sockaddr storage;
QT_SOCKLEN_T storageSize = sizeof(storage);
-
+ memset(&storage, 0, storageSize);
bool result = false;
@@ -791,7 +793,7 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
buf.len = sizeof(c);
DWORD available = 0;
DWORD flags = MSG_PEEK;
- int ret = ::WSARecvFrom(socketDescriptor, &buf, 1, &available, &flags, storagePtr, &storageSize,0,0);
+ int ret = ::WSARecvFrom(socketDescriptor, &buf, 1, &available, &flags, &storage.a, &storageSize,0,0);
int err = WSAGetLastError();
if (ret == SOCKET_ERROR && err != WSAEMSGSIZE) {
WS_ERROR_DEBUG(err);
@@ -801,7 +803,7 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
// notifiers.
flags = 0;
::WSARecvFrom(socketDescriptor, &buf, 1, &available, &flags,
- storagePtr, &storageSize, 0, 0);
+ &storage.a, &storageSize, 0, 0);
}
} else {
// If there's no error, or if our buffer was too small, there must be
@@ -893,14 +895,11 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxL
{
qint64 ret = 0;
-#if !defined(QT_NO_IPV6)
- qt_sockaddr_storage aa;
-#else
- struct sockaddr_in aa;
-#endif
+ qt_sockaddr aa;
memset(&aa, 0, sizeof(aa));
QT_SOCKLEN_T sz;
sz = sizeof(aa);
+
WSABUF buf;
buf.buf = data;
buf.len = maxLength;
@@ -915,23 +914,17 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxL
DWORD flags = 0;
DWORD bytesRead = 0;
- int wsaRet = ::WSARecvFrom(socketDescriptor, &buf, 1, &bytesRead, &flags, (struct sockaddr *) &aa, &sz,0,0);
+ int wsaRet = ::WSARecvFrom(socketDescriptor, &buf, 1, &bytesRead, &flags, &aa.a, &sz,0,0);
if (wsaRet == SOCKET_ERROR) {
int err = WSAGetLastError();
- if (err == WSAEMSGSIZE) {
- // it is ok the buffer was to small if bytesRead is larger than
- // maxLength (win 9x) then assume bytes read is really maxLenth
- ret = qint64(bytesRead) > maxLength ? maxLength : qint64(bytesRead);
- } else {
- WS_ERROR_DEBUG(err);
- setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString);
- ret = -1;
- }
+ WS_ERROR_DEBUG(err);
+ setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString);
+ ret = -1;
} else {
ret = qint64(bytesRead);
}
- qt_socket_getPortAndAddress(socketDescriptor, (struct sockaddr *) &aa, port, address);
+ qt_socket_getPortAndAddress(socketDescriptor, &aa, port, address);
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativeReceiveDatagram(%p \"%s\", %li, %s, %i) == %li",
@@ -950,41 +943,37 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
qint64 ret = -1;
struct sockaddr_in sockAddrIPv4;
qt_sockaddr_in6 sockAddrIPv6;
- struct sockaddr *sockAddrPtr;
- QT_SOCKLEN_T sockAddrSize;
+ struct sockaddr *sockAddrPtr = 0;
+ QT_SOCKLEN_T sockAddrSize = 0;
qt_socket_setPortAndAddress(socketDescriptor, &sockAddrIPv4, &sockAddrIPv6, port, address, &sockAddrPtr, &sockAddrSize);
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based && len > qint64(qt_socket_getMaxMsgSize(socketDescriptor))) {
- // WSAEMSGSIZE is not reliable enough (win 9x) so we check max size our self.
- setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString);
- } else {
- WSABUF buf;
+ WSABUF buf;
#if !defined(Q_OS_WINCE)
- buf.buf = len ? (char*)data : 0;
+ buf.buf = len ? (char*)data : 0;
#else
- char tmp;
- buf.buf = len ? (char*)data : &tmp;
+ char tmp;
+ buf.buf = len ? (char*)data : &tmp;
#endif
- buf.len = len;
- DWORD flags = 0;
- DWORD bytesSent = 0;
- if (::WSASendTo(socketDescriptor, &buf, 1, &bytesSent, flags, sockAddrPtr, sockAddrSize, 0,0) == SOCKET_ERROR) {
- int err = WSAGetLastError();
- WS_ERROR_DEBUG(err);
- switch (err) {
- case WSAEMSGSIZE:
- setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString);
- break;
- default:
- setError(QAbstractSocket::NetworkError, SendDatagramErrorString);
- break;
- }
- ret = -1;
- } else {
- ret = qint64(bytesSent);
+ buf.len = len;
+ DWORD flags = 0;
+ DWORD bytesSent = 0;
+ if (::WSASendTo(socketDescriptor, &buf, 1, &bytesSent, flags, sockAddrPtr, sockAddrSize, 0,0) == SOCKET_ERROR) {
+ int err = WSAGetLastError();
+ WS_ERROR_DEBUG(err);
+ switch (err) {
+ case WSAEMSGSIZE:
+ setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString);
+ break;
+ default:
+ setError(QAbstractSocket::NetworkError, SendDatagramErrorString);
+ break;
}
+ ret = -1;
+ } else {
+ ret = qint64(bytesSent);
}
+
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativeSendDatagram(%p \"%s\", %li, \"%s\", %i) == %li", data,
qt_prettyDebug(data, qMin<qint64>(len, 16), len).data(), 0, address.toString().toLatin1().constData(),
diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h
new file mode 100644
index 0000000..03ed3b4
--- /dev/null
+++ b/src/network/socket/qnet_unix_p.h
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNET_UNIX_P_H
+#define QNET_UNIX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of Qt code on Unix. This header file may change from version to
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "private/qcore_unix_p.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+// for inet_addr
+#include <netdb.h>
+#include <arpa/inet.h>
+#include <resolv.h>
+
+
+QT_BEGIN_NAMESPACE
+
+// Almost always the same. If not, specify in qplatformdefs.h.
+#if !defined(QT_SOCKOPTLEN_T)
+# define QT_SOCKOPTLEN_T QT_SOCKLEN_T
+#endif
+
+// UnixWare 7 redefines socket -> _socket
+static inline int qt_safe_socket(int domain, int type, int protocol, int flags = 0)
+{
+ Q_ASSERT((flags & ~O_NONBLOCK) == 0);
+
+ register int fd;
+#ifdef SOCK_CLOEXEC
+ int newtype = type | SOCK_CLOEXEC;
+ if (flags & O_NONBLOCK)
+ newtype |= SOCK_NONBLOCK;
+ fd = ::socket(domain, newtype, protocol);
+ if (fd != -1 || errno != EINVAL)
+ return fd;
+#endif
+
+ fd = ::socket(domain, type, protocol);
+ if (fd == -1)
+ return -1;
+
+ ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+
+ // set non-block too?
+ if (flags & O_NONBLOCK)
+ ::fcntl(fd, F_SETFL, ::fcntl(fd, F_GETFL) | O_NONBLOCK);
+
+ return fd;
+}
+
+// Tru64 redefines accept -> _accept with _XOPEN_SOURCE_EXTENDED
+static inline int qt_safe_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *addrlen, int flags = 0)
+{
+ Q_ASSERT((flags & ~O_NONBLOCK) == 0);
+
+ register int fd;
+#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
+ // use accept4
+ int sockflags = SOCK_CLOEXEC;
+ if (flags & O_NONBLOCK)
+ sockflags |= SOCK_NONBLOCK;
+ fd = ::accept4(s, addr, static_cast<QT_SOCKLEN_T *>(addrlen), sockflags);
+ if (fd != -1 || !(errno == ENOSYS || errno == EINVAL))
+ return fd;
+#endif
+
+ fd = ::accept(s, addr, static_cast<QT_SOCKLEN_T *>(addrlen));
+ if (fd == -1)
+ return -1;
+
+ ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+
+ // set non-block too?
+ if (flags & O_NONBLOCK)
+ ::fcntl(fd, F_SETFL, ::fcntl(fd, F_GETFL) | O_NONBLOCK);
+
+ return fd;
+}
+
+// UnixWare 7 redefines listen -> _listen
+static inline int qt_safe_listen(int s, int backlog)
+{
+ return ::listen(s, backlog);
+}
+
+static inline int qt_safe_connect(int sockfd, const struct sockaddr *addr, QT_SOCKLEN_T addrlen)
+{
+ register int ret;
+ // Solaris e.g. expects a non-const 2nd parameter
+ EINTR_LOOP(ret, QT_SOCKET_CONNECT(sockfd, const_cast<struct sockaddr *>(addr), addrlen));
+ return ret;
+}
+#undef QT_SOCKET_CONNECT
+#define QT_SOCKET_CONNECT qt_safe_connect
+
+#if defined(socket)
+# undef socket
+#endif
+#if defined(accept)
+# undef accept
+#endif
+#if defined(listen)
+# undef listen
+#endif
+
+template <typename T>
+static inline int qt_safe_ioctl(int sockfd, int request, T arg)
+{
+ return ::ioctl(sockfd, request, arg);
+}
+
+static inline in_addr_t qt_safe_inet_addr(const char *cp)
+{
+ return ::inet_addr(cp);
+}
+
+static inline int qt_safe_sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *to, QT_SOCKLEN_T tolen)
+{
+#ifdef MSG_NOSIGNAL
+ flags |= MSG_NOSIGNAL;
+#endif
+
+ register int ret;
+ EINTR_LOOP(ret, ::sendto(sockfd, buf, len, flags, to, tolen));
+ return ret;
+}
+
+QT_END_NAMESPACE
+
+#endif // QNET_UNIX_P_H
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index 46a45c6..25873c6 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -1625,14 +1625,28 @@ qint64 QSocks5SocketEngine::pendingDatagramSize() const
int QSocks5SocketEngine::option(SocketOption option) const
{
- Q_UNUSED(option);
+ Q_D(const QSocks5SocketEngine);
+ if (d->data && d->data->controlSocket) {
+ // convert the enum and call the real socket
+ if (option == QAbstractSocketEngine::LowDelayOption)
+ return d->data->controlSocket->socketOption(QAbstractSocket::LowDelayOption).toInt();
+ if (option == QAbstractSocketEngine::KeepAliveOption)
+ return d->data->controlSocket->socketOption(QAbstractSocket::KeepAliveOption).toInt();
+ }
return -1;
}
bool QSocks5SocketEngine::setOption(SocketOption option, int value)
{
- Q_UNUSED(option);
- Q_UNUSED(value);
+ Q_D(QSocks5SocketEngine);
+ if (d->data && d->data->controlSocket) {
+ // convert the enum and call the real socket
+ if (option == QAbstractSocketEngine::LowDelayOption)
+ d->data->controlSocket->setSocketOption(QAbstractSocket::LowDelayOption, value);
+ if (option == QAbstractSocketEngine::KeepAliveOption)
+ d->data->controlSocket->setSocketOption(QAbstractSocket::KeepAliveOption, value);
+ return true;
+ }
return false;
}
diff --git a/src/network/socket/qtcpsocket.h b/src/network/socket/qtcpsocket.h
index 81f81de..4e1003a 100644
--- a/src/network/socket/qtcpsocket.h
+++ b/src/network/socket/qtcpsocket.h
@@ -43,6 +43,7 @@
#define QTCPSOCKET_H
#include <QtNetwork/qabstractsocket.h>
+#include <QtCore/qvariant.h>
QT_BEGIN_HEADER
diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp
index 61b28ba..32f72df 100644
--- a/src/network/socket/qudpsocket.cpp
+++ b/src/network/socket/qudpsocket.cpp
@@ -70,6 +70,9 @@
pendingDatagramSize() to obtain the size of the first pending
datagram, and readDatagram() to read it.
+ \note An incoming datagram should be read when you receive the readyRead()
+ signal, otherwise this signal will not be emitted for the next datagram.
+
Example:
\snippet doc/src/snippets/code/src_network_socket_qudpsocket.cpp 0
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index dad43d2..2bafe13 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -28,7 +28,8 @@ SOURCES += socket/qabstractsocketengine.cpp \
unix:SOURCES += socket/qnativesocketengine_unix.cpp \
socket/qlocalsocket_unix.cpp \
socket/qlocalserver_unix.cpp
-
+unix:HEADERS += \
+ socket/qnet_unix_p.h
win32:SOURCES += socket/qnativesocketengine_win.cpp \
socket/qlocalsocket_win.cpp \
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index fc297e4..df0afe3 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -356,7 +356,7 @@ QSslSocket::~QSslSocket()
want to ignore the errors and continue connecting, you must call
ignoreSslErrors(), either from inside a slot function connected to
the sslErrors() signal, or prior to entering encrypted mode. If
- ignoreSslErrors is not called, the connection is dropped, signal
+ ignoreSslErrors() is not called, the connection is dropped, signal
disconnected() is emitted, and QSslSocket returns to the
UnconnectedState.
@@ -1592,7 +1592,33 @@ void QSslSocket::startServerEncryption()
void QSslSocket::ignoreSslErrors()
{
Q_D(QSslSocket);
- d->ignoreSslErrors = true;
+ d->ignoreAllSslErrors = true;
+}
+
+/*!
+ \overload
+ \since 4.6
+
+ This method tells QSslSocket to ignore only the errors given in \a
+ errors.
+
+ Note that you can set the expected certificate in the SSL error:
+ If, for instance, you want to connect to a server that uses
+ a self-signed certificate, consider the following snippet:
+
+ \snippet doc/src/snippets/code/src_network_ssl_qsslsocket.cpp 6
+
+ Multiple calls to this function will replace the list of errors that
+ were passed in previous calls.
+ You can clear the list of errors you want to ignore by calling this
+ function with an empty list.
+
+ \sa sslErrors()
+*/
+void QSslSocket::ignoreSslErrors(const QList<QSslError> &errors)
+{
+ Q_D(QSslSocket);
+ d->ignoreErrorsList = errors;
}
/*!
@@ -1732,7 +1758,11 @@ void QSslSocketPrivate::init()
mode = QSslSocket::UnencryptedMode;
autoStartHandshake = false;
connectionEncrypted = false;
- ignoreSslErrors = false;
+ ignoreAllSslErrors = false;
+
+ // we don't want to clear the ignoreErrorsList, so
+ // that it is possible setting it before connecting
+// ignoreErrorsList.clear();
readBuffer.clear();
writeBuffer.clear();
diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h
index 785a083..cab0667 100644
--- a/src/network/ssl/qsslsocket.h
+++ b/src/network/ssl/qsslsocket.h
@@ -169,6 +169,7 @@ public:
QList<QSslError> sslErrors() const;
static bool supportsSsl();
+ void ignoreSslErrors(const QList<QSslError> &errors);
public Q_SLOTS:
void startClientEncryption();
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index ea62a4d..130494e 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -839,7 +839,27 @@ bool QSslSocketBackendPrivate::startHandshake()
if (!errors.isEmpty()) {
sslErrors = errors;
emit q->sslErrors(errors);
- if (doVerifyPeer && !ignoreSslErrors) {
+
+ bool doEmitSslError;
+ if (!ignoreErrorsList.empty()) {
+ // check whether the errors we got are all in the list of expected errors
+ // (applies only if the method QSslSocket::ignoreSslErrors(const QList<QSslError> &errors)
+ // was called)
+ doEmitSslError = false;
+ for (int a = 0; a < errors.count(); a++) {
+ if (!ignoreErrorsList.contains(errors.at(a))) {
+ doEmitSslError = true;
+ break;
+ }
+ }
+ } else {
+ // if QSslSocket::ignoreSslErrors(const QList<QSslError> &errors) was not called and
+ // we get an SSL error, emit a signal unless we ignored all errors (by calling
+ // QSslSocket::ignoreSslErrors() )
+ doEmitSslError = !ignoreAllSslErrors;
+ }
+ // check whether we need to emit an SSL handshake error
+ if (doVerifyPeer && doEmitSslError) {
q->setErrorString(sslErrors.first().errorString());
q->setSocketError(QAbstractSocket::SslHandshakeFailedError);
emit q->error(QAbstractSocket::SslHandshakeFailedError);
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index 4579890..f923924 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -57,7 +57,7 @@
#include "qsslsocket_p.h"
#ifdef Q_OS_WIN
-#include <windows.h>
+#include <qt_windows.h>
#if defined(OCSP_RESPONSE)
#undef OCSP_RESPONSE
#endif
diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h
index dc8e4f5..8fd2154 100644
--- a/src/network/ssl/qsslsocket_p.h
+++ b/src/network/ssl/qsslsocket_p.h
@@ -79,7 +79,8 @@ public:
QSslSocket::SslMode mode;
bool autoStartHandshake;
bool connectionEncrypted;
- bool ignoreSslErrors;
+ bool ignoreAllSslErrors;
+ QList<QSslError> ignoreErrorsList;
bool* readyReadEmittedPointer;
QRingBuffer readBuffer;
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index 4b73ca9..d7c91b8 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -49,6 +49,28 @@
QT_BEGIN_NAMESPACE
+static void QGLEngineShaderManager_free(void *ptr)
+{
+ delete reinterpret_cast<QGLEngineShaderManager *>(ptr);
+}
+
+Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_shader_managers, (QGLEngineShaderManager_free))
+
+QGLEngineShaderManager *QGLEngineShaderManager::managerForContext(const QGLContext *context)
+{
+ QGLEngineShaderManager *p = reinterpret_cast<QGLEngineShaderManager *>(qt_shader_managers()->value(context));
+ if (!p) {
+ QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
+ if (oldContext != context)
+ const_cast<QGLContext *>(context)->makeCurrent();
+ p = new QGLEngineShaderManager(const_cast<QGLContext *>(context));
+ qt_shader_managers()->insert(context, p);
+ if (oldContext && oldContext != context)
+ oldContext->makeCurrent();
+ }
+ return p;
+}
+
const char* QGLEngineShaderManager::qglEngineShaderSourceCode[] = {
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
@@ -190,27 +212,33 @@ QGLEngineShaderManager::~QGLEngineShaderManager()
//###
}
-
-uint QGLEngineShaderManager::getUniformIdentifier(const char *uniformName)
-{
- uniformIdentifiers << uniformName;
- return uniformIdentifiers.size() - 1;
-}
-
-uint QGLEngineShaderManager::getUniformLocation(uint id)
+uint QGLEngineShaderManager::getUniformLocation(Uniform id)
{
QVector<uint> &uniformLocations = currentShaderProg->uniformLocations;
- uint oldSize = uniformLocations.size();
- if (oldSize <= id) {
- uint newSize = id + 1;
- uniformLocations.resize(newSize);
-
- for (uint i = oldSize; i < newSize; ++i)
- uniformLocations[i] = GLuint(-1);
- }
+ if (uniformLocations.isEmpty())
+ uniformLocations.fill(GLuint(-1), NumUniforms);
+
+ static const char *uniformNames[] = {
+ "imageTexture",
+ "patternColor",
+ "globalOpacity",
+ "depth",
+ "pmvMatrix",
+ "maskTexture",
+ "fragmentColor",
+ "linearData",
+ "angle",
+ "halfViewportSize",
+ "fmp",
+ "fmp2_m_radius2",
+ "inverse_2_fmp2_m_radius2",
+ "invertedTextureSize",
+ "brushTransform",
+ "brushTexture"
+ };
if (uniformLocations.at(id) == GLuint(-1))
- uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformIdentifiers.at(id));
+ uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformNames[id]);
return uniformLocations.at(id);
}
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index 34f0768..99711bd40 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -220,6 +220,7 @@
#include <QGLShader>
#include <QGLShaderProgram>
#include <QPainter>
+#include <private/qgl_p.h>
QT_BEGIN_HEADER
@@ -274,6 +275,26 @@ public:
TextureSrcWithPattern = Qt::TexturePattern+4
};
+ enum Uniform {
+ ImageTexture,
+ PatternColor,
+ GlobalOpacity,
+ Depth,
+ PmvMatrix,
+ MaskTexture,
+ FragmentColor,
+ LinearData,
+ Angle,
+ HalfViewportSize,
+ Fmp,
+ Fmp2MRadius2,
+ Inverse2Fmp2MRadius2,
+ InvertedTextureSize,
+ BrushTransform,
+ BrushTexture,
+ NumUniforms
+ };
+
// There are optimisations we can do, depending on the brush transform:
// 1) May not have to apply perspective-correction
// 2) Can use lower precision for matrix
@@ -285,8 +306,7 @@ public:
void setMaskType(MaskType);
void setCompositionMode(QPainter::CompositionMode);
- uint getUniformIdentifier(const char *uniformName);
- uint getUniformLocation(uint id);
+ uint getUniformLocation(Uniform id);
void setDirty(); // someone has manually changed the current shader program
bool useCorrectShaderProg(); // returns true if the shader program needed to be changed
@@ -295,6 +315,8 @@ public:
QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers
QGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer
+ static QGLEngineShaderManager *managerForContext(const QGLContext *context);
+
enum ShaderName {
MainVertexShader,
MainWithTexCoordsVertexShader,
@@ -352,6 +374,7 @@ public:
TotalShaderCount, InvalidShaderName
};
+
/*
// These allow the ShaderName enum to be used as a cache key
const int mainVertexOffset = 0;
@@ -391,8 +414,6 @@ private:
void compileNamedShader(QGLEngineShaderManager::ShaderName name, QGLShader::ShaderType type);
static const char* qglEngineShaderSourceCode[TotalShaderCount];
-
- QVector<const char *> uniformIdentifiers;
};
QT_END_NAMESPACE
diff --git a/src/opengl/gl2paintengineex/qglgradientcache.cpp b/src/opengl/gl2paintengineex/qglgradientcache.cpp
index 8c6b4f0..7c54bb9 100644
--- a/src/opengl/gl2paintengineex/qglgradientcache.cpp
+++ b/src/opengl/gl2paintengineex/qglgradientcache.cpp
@@ -46,6 +46,28 @@
QT_BEGIN_NAMESPACE
+static void QGL2GradientCache_free(void *ptr)
+{
+ delete reinterpret_cast<QGL2GradientCache *>(ptr);
+}
+
+Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_gradient_caches, (QGL2GradientCache_free))
+
+QGL2GradientCache *QGL2GradientCache::cacheForContext(const QGLContext *context)
+{
+ QGL2GradientCache *p = reinterpret_cast<QGL2GradientCache *>(qt_gradient_caches()->value(context));
+ if (!p) {
+ QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
+ if (oldContext != context)
+ const_cast<QGLContext *>(context)->makeCurrent();
+ p = new QGL2GradientCache;
+ qt_gradient_caches()->insert(context, p);
+ if (oldContext && oldContext != context)
+ oldContext->makeCurrent();
+ }
+ return p;
+}
+
void QGL2GradientCache::cleanCache() {
QGLGradientColorTableHash::const_iterator it = cache.constBegin();
for (; it != cache.constEnd(); ++it) {
@@ -55,13 +77,8 @@ void QGL2GradientCache::cleanCache() {
cache.clear();
}
-GLuint QGL2GradientCache::getBuffer(const QGradient &gradient, qreal opacity, const QGLContext *ctx)
+GLuint QGL2GradientCache::getBuffer(const QGradient &gradient, qreal opacity)
{
- if (buffer_ctx && !qgl_share_reg()->checkSharing(buffer_ctx, ctx))
- cleanCache();
-
- buffer_ctx = ctx;
-
quint64 hash_val = 0;
QGradientStops stops = gradient.stops();
diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h
index 55c7b65..ba698bc 100644
--- a/src/opengl/gl2paintengineex/qglgradientcache_p.h
+++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h
@@ -53,12 +53,12 @@
#include <QMultiHash>
#include <QObject>
#include <QtOpenGL/QtOpenGL>
+#include <private/qgl_p.h>
QT_BEGIN_NAMESPACE
-class QGL2GradientCache : public QObject
+class QGL2GradientCache
{
- Q_OBJECT
struct CacheInfo
{
inline CacheInfo(QGradientStops s, qreal op, QGradient::InterpolationMode mode) :
@@ -73,16 +73,12 @@ class QGL2GradientCache : public QObject
typedef QMultiHash<quint64, CacheInfo> QGLGradientColorTableHash;
public:
- QGL2GradientCache() : QObject(), buffer_ctx(0)
- {
-/*
- connect(QGLSignalProxy::instance(),
- SIGNAL(aboutToDestroyContext(const QGLContext *)),
- SLOT(cleanupGLContextRefs(const QGLContext *)));
-*/
- }
+ static QGL2GradientCache *cacheForContext(const QGLContext *context);
+
+ QGL2GradientCache() { }
+ ~QGL2GradientCache() {cleanCache();}
- GLuint getBuffer(const QGradient &gradient, qreal opacity, const QGLContext *ctx);
+ GLuint getBuffer(const QGradient &gradient, qreal opacity);
inline int paletteSize() const { return 1024; }
protected:
@@ -95,15 +91,6 @@ protected:
void cleanCache();
QGLGradientColorTableHash cache;
- const QGLContext *buffer_ctx;
-
-public slots:
- void cleanupGLContextRefs(const QGLContext *context) {
- if (context == buffer_ctx) {
- cleanCache();
- buffer_ctx = 0;
- }
- }
};
QT_END_NAMESPACE
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index c4f5891..5c85b40 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -74,6 +74,7 @@
#include <private/qpainter_p.h>
#include <private/qfontengine_p.h>
#include <private/qtextureglyphcache_p.h>
+#include <private/qpixmapdata_gl_p.h>
#include "qglgradientcache_p.h"
#include "qglengineshadermanager_p.h"
@@ -88,8 +89,9 @@ static const GLuint QT_IMAGE_TEXTURE_UNIT = 0; //Can be the same as brush
static const GLuint QT_MASK_TEXTURE_UNIT = 1;
static const GLuint QT_BACKGROUND_TEXTURE_UNIT = 2;
-class QGLTextureGlyphCache : public QTextureGlyphCache
+class QGLTextureGlyphCache : public QObject, public QTextureGlyphCache
{
+ Q_OBJECT
public:
QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix);
~QGLTextureGlyphCache();
@@ -105,6 +107,25 @@ public:
inline void setPaintEnginePrivate(QGL2PaintEngineExPrivate *p) { pex = p; }
+
+public Q_SLOTS:
+ void contextDestroyed(const QGLContext *context) {
+ if (context == ctx) {
+ QList<const QGLContext *> shares = qgl_share_reg()->shares(ctx);
+ if (shares.isEmpty()) {
+ glDeleteFramebuffers(1, &m_fbo);
+ if (m_width || m_height)
+ glDeleteTextures(1, &m_texture);
+ ctx = 0;
+ } else {
+ // since the context holding the texture is shared, and
+ // about to be destroyed, we have to transfer ownership
+ // of the texture to one of the share contexts
+ ctx = const_cast<QGLContext *>(shares.at(0));
+ }
+ }
+ }
+
private:
QGLContext *ctx;
@@ -126,14 +147,23 @@ QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyph
, m_height(0)
{
glGenFramebuffers(1, &m_fbo);
+ connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext *)),
+ SLOT(contextDestroyed(const QGLContext *)));
}
QGLTextureGlyphCache::~QGLTextureGlyphCache()
{
- glDeleteFramebuffers(1, &m_fbo);
-
- if (m_width || m_height)
- glDeleteTextures(1, &m_texture);
+ if (ctx) {
+ QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
+ if (oldContext != ctx)
+ ctx->makeCurrent();
+ glDeleteFramebuffers(1, &m_fbo);
+
+ if (m_width || m_height)
+ glDeleteTextures(1, &m_texture);
+ if (oldContext && oldContext != ctx)
+ oldContext->makeCurrent();
+ }
}
void QGLTextureGlyphCache::createTextureData(int width, int height)
@@ -231,8 +261,11 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph)
if (mask.format() == QImage::Format_RGB32) {
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, m_height - c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits());
} else {
- mask = mask.convertToFormat(QImage::Format_Indexed8);
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits());
+ // If the width of the uploaded data is not a multiple of four bytes, we get some garbage
+ // in the glyph cache, probably because of a driver bug.
+ // Convert to ARGB32 to get a multiple of 4 bytes per line.
+ mask = mask.convertToFormat(QImage::Format_ARGB32);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits());
}
}
@@ -242,16 +275,12 @@ extern QImage qt_imageForBrush(int brushStyle, bool invert);
QGL2PaintEngineExPrivate::~QGL2PaintEngineExPrivate()
{
- if (shaderManager) {
- delete shaderManager;
- shaderManager = 0;
- }
}
void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id)
{
// glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit?
- if (id != -1 && id == lastTexture)
+ if (id != GLuint(-1) && id == lastTexture)
return;
lastTexture = id;
@@ -271,6 +300,7 @@ void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMod
QColor QGL2PaintEngineExPrivate::premultiplyColor(QColor c, GLfloat opacity)
{
qreal alpha = c.alphaF() * opacity;
+ c.setAlphaF(alpha);
c.setRedF(c.redF() * alpha);
c.setGreenF(c.greenF() * alpha);
c.setBlueF(c.blueF() * alpha);
@@ -314,9 +344,6 @@ void QGL2PaintEngineExPrivate::useSimpleShader()
}
}
-
-Q_GLOBAL_STATIC(QGL2GradientCache, qt_opengl_gradient_cache)
-
void QGL2PaintEngineExPrivate::updateBrushTexture()
{
// qDebug("QGL2PaintEngineExPrivate::updateBrushTexture()");
@@ -337,7 +364,10 @@ void QGL2PaintEngineExPrivate::updateBrushTexture()
// We apply global opacity in the fragment shaders, so we always pass 1.0
// for opacity to the cache.
- GLuint texId = qt_opengl_gradient_cache()->getBuffer(*g, 1.0, ctx);
+ GLuint texId = QGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0);
+
+ glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
+ glBindTexture(GL_TEXTURE_2D, texId);
if (g->spread() == QGradient::RepeatSpread || g->type() == QGradient::ConicalGradient)
updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, true);
@@ -345,9 +375,6 @@ void QGL2PaintEngineExPrivate::updateBrushTexture()
updateTextureFilter(GL_TEXTURE_2D, GL_MIRRORED_REPEAT_IBM, true);
else
updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, true);
-
- glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
- glBindTexture(GL_TEXTURE_2D, texId);
}
else if (style == Qt::TexturePattern) {
const QPixmap& texPixmap = currentBrush->texture();
@@ -372,7 +399,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
if (style == Qt::SolidPattern) {
QColor col = premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue(location(FragmentColor), col);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::FragmentColor), col);
}
else {
// All other brushes have a transform and thus need the translation point:
@@ -383,10 +410,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
QColor col = premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue(location(PatternColor), col);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col);
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize);
}
else if (style == Qt::LinearGradientPattern) {
const QLinearGradient *g = static_cast<const QLinearGradient *>(currentBrush->gradient());
@@ -403,10 +430,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
1.0f / (l.x() * l.x() + l.y() * l.y())
);
- shaderManager->currentProgram()->setUniformValue(location(LinearData), linearData);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::LinearData), linearData);
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize);
}
else if (style == Qt::ConicalGradientPattern) {
const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush->gradient());
@@ -414,10 +441,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0;
- shaderManager->currentProgram()->setUniformValue(location(Angle), angle);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Angle), angle);
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize);
}
else if (style == Qt::RadialGradientPattern) {
const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush->gradient());
@@ -427,15 +454,15 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
translationPoint = realFocal;
QPointF fmp = realCenter - realFocal;
- shaderManager->currentProgram()->setUniformValue(location(Fmp), fmp);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp), fmp);
GLfloat fmp2_m_radius2 = -fmp.x() * fmp.x() - fmp.y() * fmp.y() + realRadius*realRadius;
- shaderManager->currentProgram()->setUniformValue(location(Fmp2MRadius2), fmp2_m_radius2);
- shaderManager->currentProgram()->setUniformValue(location(Inverse2Fmp2MRadius2),
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp2MRadius2), fmp2_m_radius2);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Inverse2Fmp2MRadius2),
GLfloat(1.0 / (2.0*fmp2_m_radius2)));
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize);
}
else if (style == Qt::TexturePattern) {
translationPoint = q->state()->brushOrigin;
@@ -444,14 +471,14 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
if (qHasPixmapTexture(*currentBrush) && currentBrush->texture().isQBitmap()) {
QColor col = premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue(location(PatternColor), col);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col);
}
QSizeF invertedTextureSize( 1.0 / texPixmap.width(), 1.0 / texPixmap.height() );
- shaderManager->currentProgram()->setUniformValue(location(InvertedTextureSize), invertedTextureSize);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::InvertedTextureSize), invertedTextureSize);
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize);
}
else
qWarning("QGL2PaintEngineEx: Unimplemented fill style");
@@ -460,8 +487,8 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
QTransform gl_to_qt(1, 0, 0, -1, 0, height);
QTransform inv_matrix = gl_to_qt * (brushQTransform * q->state()->matrix).inverted() * translate;
- shaderManager->currentProgram()->setUniformValue(location(BrushTransform), inv_matrix);
- shaderManager->currentProgram()->setUniformValue(location(BrushTexture), QT_BRUSH_TEXTURE_UNIT);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTransform), inv_matrix);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTexture), QT_BRUSH_TEXTURE_UNIT);
}
brushUniformsDirty = false;
}
@@ -599,11 +626,11 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s
shaderManager->setSrcPixelType(pattern ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc);
shaderManager->setTextureCoordsEnabled(true);
if (prepareForDraw(opaque))
- shaderManager->currentProgram()->setUniformValue(location(ImageTexture), QT_IMAGE_TEXTURE_UNIT);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
if (pattern) {
QColor col = premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue(location(PatternColor), col);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col);
}
GLfloat dx = 1.0 / textureSize.width();
@@ -655,6 +682,11 @@ void QGL2PaintEngineEx::sync()
glDisable(GL_BLEND);
glActiveTexture(GL_TEXTURE0);
+ glDisable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LESS);
+ glDepthMask(true);
+ glClearDepth(1);
+
d->needsSync = true;
}
@@ -847,17 +879,17 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
updateBrushUniforms();
if (shaderMatrixUniformDirty) {
- shaderManager->currentProgram()->setUniformValue(location(PmvMatrix), pmvMatrix);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PmvMatrix), pmvMatrix);
shaderMatrixUniformDirty = false;
}
if (depthUniformDirty) {
- shaderManager->currentProgram()->setUniformValue(location(Depth), (GLfloat)q->state()->currentDepth);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), (GLfloat)q->state()->currentDepth);
depthUniformDirty = false;
}
if (useGlobalOpacityUniform && opacityUniformDirty) {
- shaderManager->currentProgram()->setUniformValue(location(GlobalOpacity), (GLfloat)q->state()->opacity);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity);
opacityUniformDirty = false;
}
@@ -1023,14 +1055,18 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c
QGLContext *ctx = d->ctx;
glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
- GLuint id = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, true);
+ QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, true, true);
+
+ GLfloat top = texture->yInverted ? (pixmap.height() - src.top()) : src.top();
+ GLfloat bottom = texture->yInverted ? (pixmap.height() - src.bottom()) : src.bottom();
+ QGLRect srcRect(src.left(), top, src.right(), bottom);
bool isBitmap = pixmap.isQBitmap();
bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel();
d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT,
- state()->renderHints & QPainter::SmoothPixmapTransform, id);
- d->drawTexture(dest, src, pixmap.size(), isOpaque, isBitmap);
+ state()->renderHints & QPainter::SmoothPixmapTransform, texture->id);
+ d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap);
}
void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QRectF& src,
@@ -1042,7 +1078,8 @@ void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const
QGLContext *ctx = d->ctx;
glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
- GLuint id = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true);
+ QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true);
+ GLuint id = texture->id;
d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT,
state()->renderHints & QPainter::SmoothPixmapTransform, id);
@@ -1140,7 +1177,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte
prepareForDraw(false); // Text always causes src pixels to be transparent
- shaderManager->currentProgram()->setUniformValue(location(MaskTexture), QT_MASK_TEXTURE_UNIT);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::MaskTexture), QT_MASK_TEXTURE_UNIT);
if (vertexCoordinateArray.data() != oldVertexCoordinateDataPtr)
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data());
@@ -1180,28 +1217,8 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
qt_resolve_version_2_0_functions(d->ctx);
#endif
- if (d->shaderManager) {
- d->shaderManager->setDirty();
- } else {
- d->shaderManager = new QGLEngineShaderManager(d->ctx);
-
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::ImageTexture] = d->shaderManager->getUniformIdentifier("imageTexture");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::PatternColor] = d->shaderManager->getUniformIdentifier("patternColor");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::GlobalOpacity] = d->shaderManager->getUniformIdentifier("globalOpacity");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::Depth] = d->shaderManager->getUniformIdentifier("depth");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::PmvMatrix] = d->shaderManager->getUniformIdentifier("pmvMatrix");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::MaskTexture] = d->shaderManager->getUniformIdentifier("maskTexture");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::FragmentColor] = d->shaderManager->getUniformIdentifier("fragmentColor");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::LinearData] = d->shaderManager->getUniformIdentifier("linearData");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::Angle] = d->shaderManager->getUniformIdentifier("angle");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::HalfViewportSize] = d->shaderManager->getUniformIdentifier("halfViewportSize");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::Fmp] = d->shaderManager->getUniformIdentifier("fmp");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::Fmp2MRadius2] = d->shaderManager->getUniformIdentifier("fmp2_m_radius2");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::Inverse2Fmp2MRadius2] = d->shaderManager->getUniformIdentifier("inverse_2_fmp2_m_radius2");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::InvertedTextureSize] = d->shaderManager->getUniformIdentifier("invertedTextureSize");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::BrushTransform] = d->shaderManager->getUniformIdentifier("brushTransform");
- d->uniformIdentifiers[QGL2PaintEngineExPrivate::BrushTexture] = d->shaderManager->getUniformIdentifier("brushTexture");
- }
+ d->shaderManager = QGLEngineShaderManager::managerForContext(d->ctx);
+ d->shaderManager->setDirty();
glViewport(0, 0, d->width, d->height);
@@ -1276,6 +1293,14 @@ bool QGL2PaintEngineEx::end()
glUseProgram(0);
d->transferMode(BrushDrawingMode);
d->drawable.swapBuffers();
+#if defined(Q_WS_X11)
+ // On some (probably all) drivers, deleting an X pixmap which has been bound to a texture
+ // before calling glFinish/swapBuffers renders garbage. Presumably this is because X deletes
+ // the pixmap behind the driver's back before it's had a chance to use it. To fix this, we
+ // reference all QPixmaps which have been bound to stop them being deleted and only deref
+ // them here, after swapBuffers, where they can be safely deleted.
+ ctx->d_func()->boundPixmaps.clear();
+#endif
d->drawable.doneCurrent();
d->ctx->d_ptr->active_engine = 0;
@@ -1408,7 +1433,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
if (state()->matrix.type() <= QTransform::TxScale) {
rect = state()->matrix.mapRect(rect);
- if (d->use_system_clip && rect.contains(d->systemClip.boundingRect())
+ if ((d->use_system_clip && rect.contains(d->systemClip.boundingRect()))
|| rect.contains(QRect(0, 0, d->width, d->height)))
return;
}
@@ -1606,3 +1631,5 @@ QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState()
}
QT_END_NAMESPACE
+
+#include "qpaintengineex_opengl2.moc"
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 0d28a49..ec447a3 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -221,32 +221,11 @@ public:
void systemStateChanged();
uint use_system_clip : 1;
- enum Uniform {
- ImageTexture,
- PatternColor,
- GlobalOpacity,
- Depth,
- PmvMatrix,
- MaskTexture,
- FragmentColor,
- LinearData,
- Angle,
- HalfViewportSize,
- Fmp,
- Fmp2MRadius2,
- Inverse2Fmp2MRadius2,
- InvertedTextureSize,
- BrushTransform,
- BrushTexture,
- NumUniforms
- };
-
- uint location(Uniform uniform)
+ uint location(QGLEngineShaderManager::Uniform uniform)
{
- return shaderManager->getUniformLocation(uniformIdentifiers[uniform]);
+ return shaderManager->getUniformLocation(uniform);
}
- uint uniformIdentifiers[NumUniforms];
GLuint lastTexture;
bool needsSync;
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 2e99fc7..7211309 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -87,7 +87,6 @@
#include <private/qglpixelbuffer_p.h>
#include <private/qwindowsurface_gl_p.h>
#include "qcolormap.h"
-#include "qcache.h"
#include "qfile.h"
#include "qlibrary.h"
@@ -142,6 +141,7 @@ QGLSignalProxy *QGLSignalProxy::instance()
/*!
\namespace QGL
+ \inmodule QtOpenGL
\brief The QGL namespace specifies miscellaneous identifiers used
in the Qt OpenGL module.
@@ -1394,39 +1394,99 @@ int qt_next_power_of_two(int v)
return v;
}
-class QGLTexture {
-public:
- QGLTexture(const QGLContext *ctx, GLuint tx_id, GLenum tx_target, bool _clean = false)
- : context(ctx), id(tx_id), target(tx_target), clean(_clean) {}
- ~QGLTexture() {
- if (clean) {
- QGLContext *current = const_cast<QGLContext *>(QGLContext::currentContext());
- QGLContext *ctx = const_cast<QGLContext *>(context);
- bool switch_context = current && current != ctx && !qgl_share_reg()->checkSharing(current, ctx);
- if (switch_context)
- ctx->makeCurrent();
- glDeleteTextures(1, &id);
- if (switch_context)
- current->makeCurrent();
- }
- }
-
- const QGLContext *context;
- GLuint id;
- GLenum target;
- bool clean;
-};
-
-typedef QCache<qint64, QGLTexture> QGLTextureCache;
-static int qt_tex_cache_limit = 64*1024; // cache ~64 MB worth of textures - this is not accurate though
-static QGLTextureCache *qt_tex_cache = 0;
-
typedef void (*_qt_pixmap_cleanup_hook_64)(qint64);
typedef void (*_qt_image_cleanup_hook_64)(qint64);
extern Q_GUI_EXPORT _qt_pixmap_cleanup_hook_64 qt_pixmap_cleanup_hook_64;
extern Q_GUI_EXPORT _qt_image_cleanup_hook_64 qt_image_cleanup_hook_64;
+static QGLTextureCache *qt_gl_texture_cache = 0;
+
+QGLTextureCache::QGLTextureCache()
+ : m_cache(64*1024) // cache ~64 MB worth of textures - this is not accurate though
+{
+ Q_ASSERT(qt_gl_texture_cache == 0);
+ qt_gl_texture_cache = this;
+ qt_pixmap_cleanup_hook_64 = cleanupHook;
+ qt_image_cleanup_hook_64 = cleanupHook;
+}
+
+QGLTextureCache::~QGLTextureCache()
+{
+ qt_gl_texture_cache = 0;
+ qt_pixmap_cleanup_hook_64 = 0;
+ qt_image_cleanup_hook_64 = 0;
+}
+
+void QGLTextureCache::insert(QGLContext* ctx, qint64 key, QGLTexture* texture, int cost)
+{
+ if (m_cache.totalCost() + cost > m_cache.maxCost()) {
+ // the cache is full - make an attempt to remove something
+ const QList<qint64> keys = m_cache.keys();
+ int i = 0;
+ while (i < m_cache.count()
+ && (m_cache.totalCost() + cost > m_cache.maxCost())) {
+ QGLTexture *tex = m_cache.object(keys.at(i));
+ if (tex->context == ctx)
+ m_cache.remove(keys.at(i));
+ ++i;
+ }
+ }
+ m_cache.insert(key, texture, cost);
+}
+
+bool QGLTextureCache::remove(QGLContext* ctx, GLuint textureId)
+{
+ QList<qint64> keys = m_cache.keys();
+ for (int i = 0; i < keys.size(); ++i) {
+ QGLTexture *tex = m_cache.object(keys.at(i));
+ if (tex->id == textureId && tex->context == ctx) {
+ tex->clean = true; // forces a glDeleteTextures() call
+ m_cache.remove(keys.at(i));
+ return true;
+ }
+ }
+ return false;
+}
+
+void QGLTextureCache::removeContextTextures(QGLContext* ctx)
+{
+ QList<qint64> keys = m_cache.keys();
+ for (int i = 0; i < keys.size(); ++i) {
+ const qint64 &key = keys.at(i);
+ if (m_cache.object(key)->context == ctx)
+ m_cache.remove(key);
+ }
+}
+
+QGLTextureCache* QGLTextureCache::instance()
+{
+ if (!qt_gl_texture_cache)
+ qt_gl_texture_cache = new QGLTextureCache;
+
+ return qt_gl_texture_cache;
+}
+
+/*
+ a hook that removes textures from the cache when a pixmap/image
+ is deref'ed
+*/
+void QGLTextureCache::cleanupHook(qint64 cacheKey)
+{
+ // ### remove when the GL texture cache becomes thread-safe
+ if (qApp->thread() != QThread::currentThread())
+ return;
+ QGLTexture *texture = instance()->getTexture(cacheKey);
+ if (texture && texture->clean)
+ instance()->remove(cacheKey);
+}
+
+void QGLTextureCache::deleteIfEmpty()
+{
+ if (instance()->size() == 0)
+ delete instance();
+}
+
// DDS format structure
struct DDSFormat {
quint32 dwSize;
@@ -1555,21 +1615,8 @@ QGLContext::~QGLContext()
{
Q_D(QGLContext);
// remove any textures cached in this context
- if (qt_tex_cache) {
- QList<qint64> keys = qt_tex_cache->keys();
- for (int i = 0; i < keys.size(); ++i) {
- const qint64 &key = keys.at(i);
- if (qt_tex_cache->object(key)->context == this)
- qt_tex_cache->remove(key);
- }
- // ### thread safety
- if (qt_tex_cache->size() == 0) {
- qt_pixmap_cleanup_hook_64 = 0;
- qt_image_cleanup_hook_64 = 0;
- delete qt_tex_cache;
- qt_tex_cache = 0;
- }
- }
+ QGLTextureCache::instance()->removeContextTextures(this);
+ QGLTextureCache::deleteIfEmpty(); // ### thread safety
QGLSignalProxy::instance()->emitAboutToDestroyContext(this);
reset();
@@ -1699,21 +1746,6 @@ GLuint QGLContext::bindTexture(const QString &fileName)
return tx_id;
}
-/*
- a hook that removes textures from the cache when a pixmap/image
- is deref'ed
-*/
-static void qt_gl_clean_cache(qint64 cacheKey)
-{
- // ### remove when the GL texture cache becomes thread-safe
- if (qApp->thread() != QThread::currentThread())
- return;
- if (qt_tex_cache) {
- QGLTexture *texture = qt_tex_cache->object(cacheKey);
- if (texture && texture->clean)
- qt_tex_cache->remove(cacheKey);
- }
-}
static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum texture_format)
{
@@ -1833,7 +1865,28 @@ QImage QGLContextPrivate::convertToGLFormat(const QImage &image, bool force_prem
return result;
}
-GLuint QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format,
+/*! \internal */
+QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, bool clean)
+{
+ const qint64 key = image.cacheKey();
+ QGLTexture *texture = textureCacheLookup(key, target);
+ if (texture) {
+ glBindTexture(target, texture->id);
+ return texture;
+ }
+
+ if (!texture)
+ texture = bindTexture(image, target, format, key, clean);
+ // NOTE: bindTexture(const QImage&, GLenum, GLint, const qint64, bool) should never return null
+ Q_ASSERT(texture);
+
+ if (texture->id > 0)
+ const_cast<QImage &>(image).data_ptr()->is_cached = true;
+
+ return texture;
+}
+
+QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format,
const qint64 key, bool clean)
{
Q_Q(QGLContext);
@@ -1851,11 +1904,6 @@ GLuint QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint
// the GL_BGRA format is only present in GL version >= 1.2
GLenum texture_format = (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2)
? GL_BGRA : GL_RGBA;
- if (!qt_tex_cache) {
- qt_tex_cache = new QGLTextureCache(qt_tex_cache_limit);
- qt_pixmap_cleanup_hook_64 = qt_gl_clean_cache;
- qt_image_cleanup_hook_64 = qt_gl_clean_cache;
- }
// Scale the pixmap if needed. GL textures needs to have the
// dimensions 2^n+2(border) x 2^m+2(border), unless we're using GL
@@ -1928,53 +1976,26 @@ GLuint QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint
// this assumes the size of a texture is always smaller than the max cache size
int cost = img.width()*img.height()*4/1024;
- if (qt_tex_cache->totalCost() + cost > qt_tex_cache->maxCost()) {
- // the cache is full - make an attempt to remove something
- const QList<qint64> keys = qt_tex_cache->keys();
- int i = 0;
- while (i < qt_tex_cache->count()
- && (qt_tex_cache->totalCost() + cost > qt_tex_cache->maxCost())) {
- QGLTexture *tex = qt_tex_cache->object(keys.at(i));
- if (tex->context == q)
- qt_tex_cache->remove(keys.at(i));
- ++i;
- }
- }
- qt_tex_cache->insert(key, new QGLTexture(q, tx_id, target, clean), cost);
- return tx_id;
+ QGLTexture *texture = new QGLTexture(q, tx_id, target, clean, false);
+ QGLTextureCache::instance()->insert(q, key, texture, cost);
+ return texture;
}
-bool QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum target, GLuint *id)
+QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum target)
{
Q_Q(QGLContext);
- if (qt_tex_cache) {
- QGLTexture *texture = qt_tex_cache->object(key);
- if (texture && texture->target == target
- && (texture->context == q || qgl_share_reg()->checkSharing(q, texture->context)))
- {
- *id = texture->id;
- return true;
- }
+ QGLTexture *texture = QGLTextureCache::instance()->getTexture(key);
+ if (texture && texture->target == target
+ && (texture->context == q || qgl_share_reg()->checkSharing(q, texture->context)))
+ {
+ return texture;
}
- return false;
+ return 0;
}
-/*! \internal */
-GLuint QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, bool clean)
-{
- const qint64 key = image.cacheKey();
- GLuint id;
- if (textureCacheLookup(key, target, &id)) {
- glBindTexture(target, id);
- return id;
- }
- GLuint cached = bindTexture(image, target, format, key, clean);
- const_cast<QImage &>(image).data_ptr()->is_cached = (cached > 0);
- return cached;
-}
/*! \internal */
-GLuint QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, bool clean)
+QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, bool clean, bool canInvert)
{
Q_Q(QGLContext);
QPixmapData *pd = pixmap.pixmapData();
@@ -1982,20 +2003,41 @@ GLuint QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLin
if (target == GL_TEXTURE_2D && pd->classId() == QPixmapData::OpenGLClass) {
const QGLPixmapData *data = static_cast<const QGLPixmapData *>(pd);
- if (data->isValidContext(q))
- return data->bind();
+ if (data->isValidContext(q)) {
+ data->bind();
+ return data->texture();
+ }
}
#endif
const qint64 key = pixmap.cacheKey();
- GLuint id;
- if (textureCacheLookup(key, target, &id)) {
- glBindTexture(target, id);
- return id;
+ QGLTexture *texture = textureCacheLookup(key, target);
+ if (texture) {
+ glBindTexture(target, texture->id);
+ return texture;
}
- GLuint cached = bindTexture(pixmap.toImage(), target, format, key, clean);
- const_cast<QPixmap &>(pixmap).data_ptr()->is_cached = (cached > 0);
- return cached;
+
+#if defined(Q_WS_X11)
+ // Try to use texture_from_pixmap
+ if (pd->classId() == QPixmapData::X11Class) {
+ QPixmap *thatPixmap = const_cast<QPixmap*>(&pixmap);
+ texture = bindTextureFromNativePixmap(thatPixmap, key, canInvert);
+ if (texture) {
+ texture->clean = clean;
+ boundPixmaps.insert(thatPixmap->data_ptr(), QPixmap(pixmap));
+ }
+ }
+#endif
+
+ if (!texture)
+ texture = bindTexture(pixmap.toImage(), target, format, key, clean);
+ // NOTE: bindTexture(const QImage&, GLenum, GLint, const qint64, bool) should never return null
+ Q_ASSERT(texture);
+
+ if (texture->id > 0)
+ const_cast<QPixmap &>(pixmap).data_ptr()->is_cached = true;
+
+ return texture;
}
/*! \internal */
@@ -2061,7 +2103,8 @@ int QGLContextPrivate::maxTextureSize()
GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format)
{
Q_D(QGLContext);
- return d->bindTexture(image, target, format, false);
+ QGLTexture *texture = d->bindTexture(image, target, format, false);
+ return texture->id;
}
#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
@@ -2069,7 +2112,8 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format)
GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format)
{
Q_D(QGLContext);
- return d->bindTexture(image, GLenum(target), GLint(format), false);
+ QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false);
+ return texture->id;
}
#endif
@@ -2080,7 +2124,8 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa
GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format)
{
Q_D(QGLContext);
- return d->bindTexture(pixmap, target, format, false);
+ QGLTexture *texture = d->bindTexture(pixmap, target, format, false, false);
+ return texture->id;
}
#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
@@ -2088,7 +2133,8 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma
GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format)
{
Q_D(QGLContext);
- return d->bindTexture(pixmap, GLenum(target), GLint(format), false);
+ QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), false, false);
+ return texture->id;
}
#endif
@@ -2101,17 +2147,8 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, Q
*/
void QGLContext::deleteTexture(GLuint id)
{
- if (qt_tex_cache) {
- QList<qint64> keys = qt_tex_cache->keys();
- for (int i = 0; i < keys.size(); ++i) {
- QGLTexture *tex = qt_tex_cache->object(keys.at(i));
- if (tex->id == id && tex->context == this) {
- tex->clean = true; // forces a glDeleteTextures() call
- qt_tex_cache->remove(keys.at(i));
- return;
- }
- }
- }
+ if (QGLTextureCache::instance()->remove(this, id))
+ return;
// check the DDS cache if the texture wasn't found in the pixmap/image
// cache
@@ -2305,9 +2342,7 @@ void QGLContext::drawTexture(const QPointF &point, QMacCompatGLuint textureId, Q
*/
void QGLContext::setTextureCacheLimit(int size)
{
- qt_tex_cache_limit = size;
- if (qt_tex_cache)
- qt_tex_cache->setMaxCost(qt_tex_cache_limit);
+ QGLTextureCache::instance()->setMaxCost(size);
}
/*!
@@ -2317,7 +2352,7 @@ void QGLContext::setTextureCacheLimit(int size)
*/
int QGLContext::textureCacheLimit()
{
- return qt_tex_cache_limit;
+ return QGLTextureCache::instance()->maxCost();
}
@@ -3361,8 +3396,13 @@ bool QGLWidget::event(QEvent *e)
#elif defined(Q_WS_WIN)
if (e->type() == QEvent::ParentChange) {
QGLContext *newContext = new QGLContext(d->glcx->requestedFormat(), this);
- qgl_share_reg()->replaceShare(d->glcx, newContext);
+ QList<const QGLContext *> shares = qgl_share_reg()->shares(d->glcx);
setContext(newContext);
+ for (int i = 0; i < shares.size(); ++i) {
+ if (newContext != shares.at(i))
+ qgl_share_reg()->addShare(newContext, shares.at(i));
+ }
+
// the overlay needs to be recreated as well
delete d->olcx;
if (isValid() && context()->format().hasOverlay()) {
@@ -4332,6 +4372,9 @@ void QGLExtensions::init_extensions()
if (extensions.contains(QLatin1String("EXT_framebuffer_blit")))
glExtensions |= FramebufferBlit;
+ if (extensions.contains(QLatin1String("GL_ARB_texture_non_power_of_two")))
+ glExtensions |= NPOTTextures;
+
QGLContext cx(QGLFormat::defaultFormat());
if (glExtensions & TextureCompression) {
qt_glCompressedTexImage2DARB = (pfn_glCompressedTexImage2DARB) cx.getProcAddress(QLatin1String("glCompressedTexImage2DARB"));
@@ -4539,32 +4582,34 @@ QGLFormat QGLDrawable::format() const
GLuint QGLDrawable::bindTexture(const QImage &image, GLenum target, GLint format)
{
+ QGLTexture *texture;
if (widget)
- return widget->d_func()->glcx->d_func()->bindTexture(image, target, format, true);
+ texture = widget->d_func()->glcx->d_func()->bindTexture(image, target, format, true);
else if (buffer)
- return buffer->d_func()->qctx->d_func()->bindTexture(image, target, format, true);
+ texture = buffer->d_func()->qctx->d_func()->bindTexture(image, target, format, true);
else if (fbo && QGLContext::currentContext())
- return const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(image, target, format, true);
+ texture = const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(image, target, format, true);
#if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL))
else if (wsurf)
- return wsurf->context()->d_func()->bindTexture(image, target, format, true);
+ texture = wsurf->context()->d_func()->bindTexture(image, target, format, true);
#endif
- return 0;
+ return texture->id;
}
GLuint QGLDrawable::bindTexture(const QPixmap &pixmap, GLenum target, GLint format)
{
+ QGLTexture *texture;
if (widget)
- return widget->d_func()->glcx->d_func()->bindTexture(pixmap, target, format, true);
+ texture = widget->d_func()->glcx->d_func()->bindTexture(pixmap, target, format, true, true);
else if (buffer)
- return buffer->d_func()->qctx->d_func()->bindTexture(pixmap, target, format, true);
+ texture = buffer->d_func()->qctx->d_func()->bindTexture(pixmap, target, format, true, true);
else if (fbo && QGLContext::currentContext())
- return const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(pixmap, target, format, true);
+ texture = const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(pixmap, target, format, true, true);
#if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL))
else if (wsurf)
- return wsurf->context()->d_func()->bindTexture(pixmap, target, format, true);
+ texture = wsurf->context()->d_func()->bindTexture(pixmap, target, format, true, true);
#endif
- return 0;
+ return texture->id;
}
QColor QGLDrawable::backgroundColor() const
@@ -4610,4 +4655,156 @@ bool QGLDrawable::autoFillBackground() const
return false;
}
+
+bool QGLShareRegister::checkSharing(const QGLContext *context1, const QGLContext *context2) {
+ bool sharing = (context1 && context2 && context1->d_ptr->groupResources == context2->d_ptr->groupResources);
+ return sharing;
+}
+
+void QGLShareRegister::addShare(const QGLContext *context, const QGLContext *share) {
+ Q_ASSERT(context && share);
+ if (context->d_ptr->groupResources == share->d_ptr->groupResources)
+ return;
+
+ // Make sure 'context' is not already shared with another group of contexts.
+ Q_ASSERT(reg.find(context->d_ptr->groupResources) == reg.end());
+ Q_ASSERT(context->d_ptr->groupResources->refs == 1);
+
+ // Free 'context' group resources and make it use the same resources as 'share'.
+ delete context->d_ptr->groupResources;
+ context->d_ptr->groupResources = share->d_ptr->groupResources;
+ context->d_ptr->groupResources->refs.ref();
+
+ // Maintain a list of all the contexts in each group of sharing contexts.
+ SharingHash::iterator it = reg.find(share->d_ptr->groupResources);
+ if (it == reg.end())
+ it = reg.insert(share->d_ptr->groupResources, ContextList() << share);
+ it.value() << context;
+}
+
+QList<const QGLContext *> QGLShareRegister::shares(const QGLContext *context) {
+ SharingHash::const_iterator it = reg.find(context->d_ptr->groupResources);
+ if (it == reg.end())
+ return ContextList();
+ return it.value();
+}
+
+void QGLShareRegister::removeShare(const QGLContext *context) {
+ SharingHash::iterator it = reg.find(context->d_ptr->groupResources);
+ if (it == reg.end())
+ return;
+
+ int count = it.value().removeAll(context);
+ Q_ASSERT(count == 1);
+
+ Q_ASSERT(it.value().size() != 0);
+ if (it.value().size() == 1)
+ reg.erase(it);
+}
+
+QGLContextResource::QGLContextResource(FreeFunc f, QObject *parent)
+ : QObject(parent), free(f)
+{
+ connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext *)), this, SLOT(aboutToDestroyContext(const QGLContext *)));
+}
+
+QGLContextResource::~QGLContextResource()
+{
+ while (!m_resources.empty())
+ remove(m_resources.begin().key());
+}
+
+void QGLContextResource::insert(const QGLContext *key, void *value)
+{
+ QList<const QGLContext *> shares = qgl_share_reg()->shares(key);
+ if (shares.size() == 0)
+ shares.append(key);
+ void *oldValue = 0;
+ for (int i = 0; i < shares.size(); ++i) {
+ ResourceHash::iterator it = m_resources.find(shares.at(i));
+ if (it != m_resources.end()) {
+ Q_ASSERT(oldValue == 0 || oldValue == it.value());
+ oldValue = it.value();
+ it.value() = value;
+ } else {
+ m_resources.insert(shares.at(i), value);
+ }
+ }
+ if (oldValue != 0 && oldValue != value) {
+ QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
+ if (oldContext != key)
+ const_cast<QGLContext *>(key)->makeCurrent();
+ free(oldValue);
+ if (oldContext && oldContext != key)
+ oldContext->makeCurrent();
+ }
+}
+
+void *QGLContextResource::value(const QGLContext *key)
+{
+ ResourceHash::const_iterator it = m_resources.find(key);
+ // Check if there is a value associated with 'key'.
+ if (it != m_resources.end())
+ return it.value();
+ // Check if there is a value associated with sharing contexts.
+ QList<const QGLContext *> shares = qgl_share_reg()->shares(key);
+ for (int i = 0; i < shares.size() && it == m_resources.end(); ++i)
+ it = m_resources.find(shares.at(i));
+ if (it == m_resources.end())
+ return 0; // Didn't find anything.
+
+ // Found something! Share this info with all the buddies.
+ for (int i = 0; i < shares.size(); ++i)
+ m_resources.insert(shares.at(i), it.value());
+ return it.value();
+}
+
+void QGLContextResource::remove(const QGLContext *key)
+{
+ QList<const QGLContext *> shares = qgl_share_reg()->shares(key);
+ if (shares.size() == 0)
+ shares.append(key);
+ void *oldValue = 0;
+ for (int i = 0; i < shares.size(); ++i) {
+ ResourceHash::iterator it = m_resources.find(shares.at(i));
+ if (it != m_resources.end()) {
+ Q_ASSERT(oldValue == 0 || oldValue == it.value());
+ oldValue = it.value();
+ m_resources.erase(it);
+ }
+ }
+ if (oldValue != 0) {
+ QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
+ if (oldContext != key)
+ const_cast<QGLContext *>(key)->makeCurrent();
+ free(oldValue);
+ if (oldContext && oldContext != key)
+ oldContext->makeCurrent();
+ }
+}
+
+void QGLContextResource::aboutToDestroyContext(const QGLContext *key)
+{
+ ResourceHash::iterator it = m_resources.find(key);
+ if (it == m_resources.end())
+ return;
+
+ QList<const QGLContext *> shares = qgl_share_reg()->shares(key);
+ if (shares.size() > 1) {
+ Q_ASSERT(key->isSharing());
+ // At least one of the shared contexts must stay in the cache.
+ // Otherwise, the value pointer is lost.
+ for (int i = 0; i < 2/*shares.size()*/; ++i)
+ m_resources.insert(shares.at(i), it.value());
+ } else {
+ QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
+ if (oldContext != key)
+ const_cast<QGLContext *>(key)->makeCurrent();
+ free(it.value());
+ if (oldContext && oldContext != key)
+ oldContext->makeCurrent();
+ }
+ m_resources.erase(it);
+}
+
QT_END_NAMESPACE
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 24a4bbb..9ee200b 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -365,6 +365,7 @@ private:
friend class QGLPixmapData;
friend class QGLPixmapFilterBase;
friend class QGLTextureGlyphCache;
+ friend class QGLShareRegister;
friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags();
#ifdef Q_WS_MAC
public:
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 85e9bd7..85dae0d 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -60,10 +60,7 @@
#include "QtCore/qthreadstorage.h"
#include "QtCore/qhash.h"
#include "private/qwidget_p.h"
-
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
-#include "private/qpixmapdata_gl_p.h"
-#endif
+#include "qcache.h"
#ifndef QT_OPENGL_ES_1_CL
#define q_vertexType float
@@ -196,17 +193,26 @@ public:
#endif
};
+struct QGLContextGroupResources
+{
+ QGLContextGroupResources() : refs(1) { }
+ QGLExtensionFuncs extensionFuncs;
+ QAtomicInt refs;
+};
+
+class QGLTexture;
+
class QGLContextPrivate
{
Q_DECLARE_PUBLIC(QGLContext)
public:
- explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {}
- ~QGLContextPrivate() {}
- GLuint bindTexture(const QImage &image, GLenum target, GLint format, const qint64 key,
+ explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {groupResources = new QGLContextGroupResources;}
+ ~QGLContextPrivate() {if (!groupResources->refs.deref()) delete groupResources;}
+ QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, bool clean);
+ QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, const qint64 key,
bool clean = false);
- GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, bool clean);
- GLuint bindTexture(const QImage &image, GLenum target, GLint format, bool clean);
- bool textureCacheLookup(const qint64 key, GLenum target, GLuint *id);
+ QGLTexture *bindTexture(const QPixmap &pixmap, GLenum target, GLint format, bool clean, bool canInvert = false);
+ QGLTexture *textureCacheLookup(const qint64 key, GLenum target);
void init(QPaintDevice *dev, const QGLFormat &format);
QImage convertToGLFormat(const QImage &image, bool force_premul, GLenum texture_format);
int maxTextureSize();
@@ -234,6 +240,8 @@ public:
void* pbuf;
quint32 gpm;
int screen;
+ QHash<QPixmapData*, QPixmap> boundPixmaps;
+ QGLTexture *bindTextureFromNativePixmap(QPixmap *pm, const qint64 key, bool internal);
#endif
#if defined(Q_WS_MAC)
bool update;
@@ -257,14 +265,14 @@ public:
QGLContext *q_ptr;
QGLFormat::OpenGLVersionFlags version_flags;
- QGLExtensionFuncs extensionFuncs;
+ QGLContextGroupResources *groupResources;
GLint max_texture_size;
GLuint current_fbo;
QPaintEngine *active_engine;
#ifdef Q_WS_WIN
- static inline QGLExtensionFuncs& qt_get_extension_funcs(const QGLContext *ctx) { return ctx->d_ptr->extensionFuncs; }
+ static inline QGLExtensionFuncs& qt_get_extension_funcs(const QGLContext *ctx) { return ctx->d_ptr->groupResources->extensionFuncs; }
#endif
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
@@ -293,6 +301,7 @@ class QGLPixelBuffer;
class QGLFramebufferObject;
class QWSGLWindowSurface;
class QGLWindowSurface;
+class QGLPixmapData;
class QGLDrawable {
public:
QGLDrawable() : widget(0), buffer(0), fbo(0)
@@ -353,7 +362,8 @@ public:
PackedDepthStencil = 0x00000200,
NVFloatBuffer = 0x00000400,
PixelBufferObject = 0x00000800,
- FramebufferBlit = 0x00001000
+ FramebufferBlit = 0x00001000,
+ NPOTTextures = 0x00002000
};
Q_DECLARE_FLAGS(Extensions, Extension)
@@ -371,61 +381,89 @@ struct QGLThreadContext {
};
extern QThreadStorage<QGLThreadContext *> qgl_context_storage;
-typedef QMultiHash<const QGLContext *, const QGLContext *> QGLSharingHash;
class QGLShareRegister
{
public:
QGLShareRegister() {}
~QGLShareRegister() { reg.clear(); }
- bool checkSharing(const QGLContext *context1, const QGLContext *context2, const QGLContext * skip=0) {
- if (context1 == context2)
- return true;
- QList<const QGLContext *> shares = reg.values(context1);
- for (int k=0; k<shares.size(); ++k) {
- const QGLContext *ctx = shares.at(k);
- if (ctx == skip) // avoid an indirect circular loop (infinite recursion)
- continue;
- if (ctx == context2)
- return true;
- if (checkSharing(ctx, context2, context1))
- return true;
- }
- return false;
- }
+ bool checkSharing(const QGLContext *context1, const QGLContext *context2);
+ void addShare(const QGLContext *context, const QGLContext *share);
+ QList<const QGLContext *> shares(const QGLContext *context);
+ void removeShare(const QGLContext *context);
+private:
+ // Use a context's 'groupResources' pointer to uniquely identify a group.
+ typedef QList<const QGLContext *> ContextList;
+ typedef QHash<const QGLContextGroupResources *, ContextList> SharingHash;
+ SharingHash reg;
+};
- void addShare(const QGLContext *context, const QGLContext *share) {
- reg.insert(context, share); // context sharing works both ways
- reg.insert(share, context);
- }
+extern Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg();
- void removeShare(const QGLContext *context) {
- QGLSharingHash::iterator it = reg.begin();
- while (it != reg.end()) {
- if (it.key() == context || it.value() == context)
- it = reg.erase(it);
- else
- ++it;
+class QGLTexture {
+public:
+ QGLTexture(QGLContext *ctx = 0, GLuint tx_id = 0, GLenum tx_target = GL_TEXTURE_2D,
+ bool _clean = false, bool _yInverted = false)
+ : context(ctx), id(tx_id), target(tx_target), clean(_clean), yInverted(_yInverted)
+#if defined(Q_WS_X11)
+ , boundPixmap(0)
+#endif
+ {}
+
+ ~QGLTexture() {
+ if (clean) {
+ QGLContext *current = const_cast<QGLContext *>(QGLContext::currentContext());
+ QGLContext *ctx = const_cast<QGLContext *>(context);
+ Q_ASSERT(ctx);
+ bool switch_context = current != ctx && !qgl_share_reg()->checkSharing(current, ctx);
+ if (switch_context)
+ ctx->makeCurrent();
+#if defined(Q_WS_X11)
+ // Although glXReleaseTexImage is a glX call, it must be called while there
+ // is a current context - the context the pixmap was bound to a texture in.
+ // Otherwise the release doesn't do anything and you get BadDrawable errors
+ // when you come to delete the context.
+ deleteBoundPixmap();
+#endif
+ glDeleteTextures(1, &id);
+ if (switch_context && current)
+ current->makeCurrent();
}
- }
+ }
- void replaceShare(const QGLContext *oldContext, const QGLContext *newContext) {
- QGLSharingHash::iterator it = reg.begin();
- while (it != reg.end()) {
- if (it.key() == oldContext)
- reg.insert(newContext, it.value());
- else if (it.value() == oldContext)
- reg.insert(it.key(), newContext);
- ++it;
- }
- removeShare(oldContext);
- }
+ QGLContext *context;
+ GLuint id;
+ GLenum target;
+ bool clean;
+ bool yInverted; // NOTE: Y-Inverted textures are for internal use only!
+#if defined(Q_WS_X11)
+ Qt::HANDLE boundPixmap;
+ void deleteBoundPixmap(); // in qgl_x11.cpp/qgl_x11egl.cpp
+#endif
+};
+
+class QGLTextureCache {
+public:
+ QGLTextureCache();
+ ~QGLTextureCache();
+
+ void insert(QGLContext *ctx, qint64 key, QGLTexture *texture, int cost);
+ void remove(quint64 key) { m_cache.remove(key); }
+ bool remove(QGLContext *ctx, GLuint textureId);
+ void removeContextTextures(QGLContext *ctx);
+ int size() { return m_cache.size(); }
+ void setMaxCost(int newMax) { m_cache.setMaxCost(newMax); }
+ int maxCost() {return m_cache.maxCost(); }
+ QGLTexture* getTexture(quint64 key) { return m_cache.object(key); }
+
+ static QGLTextureCache *instance();
+ static void deleteIfEmpty();
+ static void cleanupHook(qint64 cacheKey);
private:
- QGLSharingHash reg;
+ QCache<qint64, QGLTexture> m_cache;
};
-extern Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg();
#ifdef Q_WS_QWS
extern QPaintEngine* qt_qgl_paint_engine();
@@ -460,6 +498,29 @@ inline GLenum qt_gl_preferredTextureTarget()
#endif
}
+// One resource per group of shared contexts.
+class QGLContextResource : public QObject
+{
+ Q_OBJECT
+public:
+ typedef void (*FreeFunc)(void *);
+ QGLContextResource(FreeFunc f, QObject *parent = 0);
+ ~QGLContextResource();
+ // Set resource 'value' for 'key' and all its shared contexts.
+ void insert(const QGLContext *key, void *value);
+ // Return resource for 'key' or a shared context.
+ void *value(const QGLContext *key);
+ // Free resource for 'key' and all its shared contexts.
+ void remove(const QGLContext *key);
+private slots:
+ // Remove entry 'key' from cache and delete resource if there are no shared contexts.
+ void aboutToDestroyContext(const QGLContext *key);
+private:
+ typedef QHash<const QGLContext *, void *> ResourceHash;
+ ResourceHash m_resources;
+ FreeFunc free;
+};
+
QT_END_NAMESPACE
#endif // QGL_P_H
diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp
index 40b0ce7..232d47b 100644
--- a/src/opengl/qgl_win.cpp
+++ b/src/opengl/qgl_win.cpp
@@ -51,7 +51,7 @@
#include <qdebug.h>
#include <qcolor.h>
-#include <windows.h>
+#include <qt_windows.h>
typedef bool (APIENTRY *PFNWGLGETPIXELFORMATATTRIBIVARB)(HDC hdc,
int iPixelFormat,
@@ -642,14 +642,10 @@ public:
QString windowClassName = qt_getRegisteredWndClass();
if (parent && !parent->internalWinId())
parent = parent->nativeParentWidget();
- QT_WA({
- const TCHAR *cname = (TCHAR*)windowClassName.utf16();
- dmy_id = CreateWindow(cname, 0, 0, 0, 0, 1, 1,
- parent ? parent->winId() : 0, 0, qWinAppInst(), 0);
- } , {
- dmy_id = CreateWindowA(windowClassName.toLatin1(), 0, 0, 0, 0, 1, 1,
- parent ? parent->winId() : 0, 0, qWinAppInst(), 0);
- });
+
+ dmy_id = CreateWindow((const wchar_t *)windowClassName.utf16(),
+ 0, 0, 0, 0, 1, 1,
+ parent ? parent->winId() : 0, 0, qWinAppInst(), 0);
dmy_pdc = GetDC(dmy_id);
PIXELFORMATDESCRIPTOR dmy_pfd;
@@ -1417,7 +1413,7 @@ void QGLWidget::setContext(QGLContext *context,
}
if (!d->glcx->isValid()) {
- bool wasSharing = shareContext || oldcx && oldcx->isSharing();
+ bool wasSharing = shareContext || (oldcx && oldcx->isSharing());
d->glcx->create(shareContext ? shareContext : oldcx);
// the above is a trick to keep disp lists etc when a
// QGLWidget has been reparented, so remove the sharing
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index 631625b..43bdec7 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -52,6 +52,7 @@
#include "qdebug.h"
#include <private/qfontengine_ft_p.h>
#include <private/qt_x11_p.h>
+#include <private/qpixmap_x11_p.h>
#ifdef Q_OS_HPUX
// for GLXPBuffer
#include <private/qglpixelbuffer_p.h>
@@ -81,6 +82,25 @@ extern const QX11Info *qt_x11Info(const QPaintDevice *pd);
#define GLX_SAMPLES_ARB 100001
#endif
+#ifndef GLX_EXT_texture_from_pixmap
+#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
+#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
+#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
+#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
+#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
+#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
+#define GLX_Y_INVERTED_EXT 0x20D4
+#define GLX_TEXTURE_FORMAT_EXT 0x20D5
+#define GLX_TEXTURE_TARGET_EXT 0x20D6
+#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
+#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
+#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
+#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
+#define GLX_TEXTURE_2D_EXT 0x20DC
+#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
+#define GLX_FRONT_LEFT_EXT 0x20DE
+#endif
+
/*
The qt_gl_choose_cmap function is internal and used by QGLWidget::setContext()
and GLX (not Windows). If the application can't find any sharable
@@ -1516,4 +1536,124 @@ void QGLExtensions::init()
}
}
+
+typedef void (*qt_glXBindTexImageEXT)(Display*, GLXDrawable, int, const int*);
+typedef void (*qt_glXReleaseTexImageEXT)(Display*, GLXDrawable, int);
+static qt_glXBindTexImageEXT glXBindTexImageEXT = 0;
+static qt_glXReleaseTexImageEXT glXReleaseTexImageEXT = 0;
+static bool qt_resolved_texture_from_pixmap = false;
+
+QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pm, const qint64 key, bool canInvert)
+{
+ Q_Q(QGLContext);
+
+ if (pm->data_ptr()->classId() != QPixmapData::X11Class)
+ return 0;
+ QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pm->data_ptr());
+ const QX11Info *x11Info = qt_x11Info(pm);
+
+
+ // Check to see if we have NPOT texture support
+ // TODO: Use GLX_TEXTURE_RECTANGLE_EXT texture target on systems without npot textures
+ if ( !(QGLExtensions::glExtensions & QGLExtensions::NPOTTextures) &&
+ !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0))
+ return 0;
+
+ if (!qt_resolved_texture_from_pixmap) {
+ qt_resolved_texture_from_pixmap = true;
+
+ QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS));
+ if (glxExt.contains(QLatin1String("GLX_EXT_texture_from_pixmap"))) {
+#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
+ void *handle = dlopen(NULL, RTLD_LAZY);
+ if (handle) {
+ glXBindTexImageEXT = (qt_glXBindTexImageEXT) dlsym(handle, "glXBindTexImageEXT");
+ glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) dlsym(handle, "glXReleaseTexImageEXT");
+ dlclose(handle);
+ }
+ if (!glXBindTexImageEXT)
+#endif
+ {
+ extern const QString qt_gl_library_name();
+ QLibrary lib(qt_gl_library_name());
+ glXBindTexImageEXT = (qt_glXBindTexImageEXT) lib.resolve("glXBindTexImageEXT");
+ glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) lib.resolve("glXReleaseTexImageEXT");
+ }
+ }
+ }
+
+ if (!glXBindTexImageEXT)
+ return 0;
+
+#if !defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX)
+ return 0;
+#else
+ GLXFBConfig *configList = 0;
+ GLXFBConfig glxPixmapConfig;
+ int configCount = 0;
+ bool hasAlpha = pixmapData->hasAlphaChannel();
+
+ int configAttribs[] = {
+ hasAlpha ? GLX_BIND_TO_TEXTURE_RGBA_EXT : GLX_BIND_TO_TEXTURE_RGB_EXT, True,
+ GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
+ GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT,
+ // QGLContext::bindTexture() can't return an inverted texture, but QPainter::drawPixmap() can:
+ GLX_Y_INVERTED_EXT, canInvert ? GLX_DONT_CARE : False,
+ XNone
+// GLX_BIND_TO_MIPMAP_TEXTURE_EXT, False,
+// GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_1D_BIT_EXT or GLX_TEXTURE_2D_BIT_EXT or GLX_TEXTURE_RECTANGLE_BIT_EXT
+ };
+ configList = glXChooseFBConfig(x11Info->display(), x11Info->screen(), configAttribs, &configCount);
+ if (!configList)
+ return 0;
+ glxPixmapConfig = configList[0];
+ XFree(configList);
+
+ GLXPixmap glxPixmap;
+ int pixmapAttribs[] = {
+ GLX_TEXTURE_FORMAT_EXT, hasAlpha ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT,
+ GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
+ GLX_MIPMAP_TEXTURE_EXT, False,
+ XNone
+// GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT or GLX_TEXTURE_FORMAT_RGB_EXT or GLX_TEXTURE_FORMAT_NONE_EXT,
+// GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT or GLX_TEXTURE_RECTANGLE_EXT,
+// GLX_MIPMAP_TEXTURE_EXT, True or False,
+ };
+
+ // Wrap the X Pixmap into a GLXPixmap:
+ glxPixmap = glXCreatePixmap(x11Info->display(), glxPixmapConfig, pixmapData->handle(), pixmapAttribs);
+
+ if (!glxPixmap)
+ return 0;
+
+ int yInverted;
+ glXGetFBConfigAttrib(x11Info->display(), glxPixmapConfig, GLX_Y_INVERTED_EXT, &yInverted);
+
+ GLuint textureId;
+ glGenTextures(1, &textureId);
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ glXBindTexImageEXT(x11Info->display(), glxPixmap, GLX_FRONT_LEFT_EXT, 0);
+
+ glBindTexture(GL_TEXTURE_2D, textureId);
+
+ QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, canInvert, yInverted);
+ texture->boundPixmap = glxPixmap;
+
+ // We assume the cost of bound pixmaps is zero
+ QGLTextureCache::instance()->insert(q, key, texture, 0);
+
+ return texture;
+#endif //!defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX)
+}
+
+void QGLTexture::deleteBoundPixmap()
+{
+ if (boundPixmap) {
+ glXReleaseTexImageEXT(QX11Info::display(), boundPixmap, GLX_FRONT_LEFT_EXT);
+ glXDestroyPixmap(QX11Info::display(), boundPixmap);
+ boundPixmap = 0;
+ }
+}
+
+
QT_END_NAMESPACE
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 9db3a30..99b026d 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -469,4 +469,15 @@ void QGLWidgetPrivate::recreateEglSurface(bool force)
}
}
+QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pm, const qint64 key, bool canInvert)
+{
+ // TODO
+ return 0;
+}
+
+void QGLTexture::deleteBoundPixmap()
+{
+ //TODO
+}
+
QT_END_NAMESPACE
diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h
index 3bb42c8..4f15197 100644
--- a/src/opengl/qglextensions_p.h
+++ b/src/opengl/qglextensions_p.h
@@ -535,7 +535,7 @@ struct QGLExtensionFuncs
#endif
#ifndef GL_MAX_SAMPLES_EXT
-#define GL_MAX_SAMPLES_EXT 0x8D5
+#define GL_MAX_SAMPLES_EXT 0x8D57
#endif
#ifndef GL_DRAW_FRAMEBUFFER_EXT
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index e033076..f8607cc 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -109,8 +109,6 @@ public:
*/
/*!
- \since 4.6
-
Creates a QGLFramebufferObjectFormat object with properties specifying
the format of an OpenGL framebuffer object.
@@ -146,8 +144,6 @@ QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(int samples,
}
/*!
- \since 4.6
-
Constructs a copy of \a other.
*/
@@ -158,8 +154,6 @@ QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(const QGLFramebufferObjec
}
/*!
- \since 4.6
-
Assigns \a other to this object.
*/
@@ -170,8 +164,6 @@ QGLFramebufferObjectFormat &QGLFramebufferObjectFormat::operator=(const QGLFrame
}
/*!
- \since 4.6
-
Destroys the QGLFramebufferObjectFormat.
*/
QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat()
@@ -180,8 +172,6 @@ QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat()
}
/*!
- \since 4.6
-
Sets the number of samples per pixel for a multisample framebuffer object
to \a samples.
A sample count of 0 represents a regular non-multisample framebuffer object.
@@ -194,8 +184,6 @@ void QGLFramebufferObjectFormat::setSamples(int samples)
}
/*!
- \since 4.6
-
Returns the number of samples per pixel if a framebuffer object
is a multisample framebuffer object. Otherwise, returns 0.
@@ -207,8 +195,6 @@ int QGLFramebufferObjectFormat::samples() const
}
/*!
- \since 4.6
-
Sets the attachments a framebuffer object should have to \a attachment.
\sa attachment()
@@ -219,8 +205,6 @@ void QGLFramebufferObjectFormat::setAttachment(QGLFramebufferObject::Attachment
}
/*!
- \since 4.6
-
Returns the status of the depth and stencil buffers attached to
a framebuffer object.
@@ -232,8 +216,6 @@ QGLFramebufferObject::Attachment QGLFramebufferObjectFormat::attachment() const
}
/*!
- \since 4.6
-
Sets the texture target of the texture attached to a framebuffer object to
\a target. Ignored for multisample framebuffer objects.
@@ -245,8 +227,6 @@ void QGLFramebufferObjectFormat::setTextureTarget(GLenum target)
}
/*!
- \since 4.6
-
Returns the texture target of the texture attached to a framebuffer object.
Ignored for multisample framebuffer objects.
@@ -258,8 +238,6 @@ GLenum QGLFramebufferObjectFormat::textureTarget() const
}
/*!
- \since 4.6
-
Sets the internal format of a framebuffer object's texture or multisample
framebuffer object's color buffer to \a internalFormat.
@@ -271,8 +249,6 @@ void QGLFramebufferObjectFormat::setInternalFormat(GLenum internalFormat)
}
/*!
- \since 4.6
-
Returns the internal format of a framebuffer object's texture or
multisample framebuffer object's color buffer.
@@ -1055,8 +1031,7 @@ GLuint QGLFramebufferObject::handle() const
}
/*! \fn int QGLFramebufferObject::devType() const
-
- \reimp
+ \internal
*/
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 2669cb3..e40a037 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -590,7 +590,7 @@ QGLFormat QGLPixelBuffer::format() const
}
/*! \fn int QGLPixelBuffer::devType() const
- \reimp
+ \internal
*/
QT_END_NAMESPACE
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index 7514743..5a06763 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const
{
- const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, true);
+ const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, true, false);
}
void QGLPixmapFilterBase::drawImpl(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF& source) const
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index cd04379..63ce73a 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -3963,7 +3963,7 @@ void QOpenGLPaintEnginePrivate::strokePath(const QPainterPath &path, bool use_ca
QPen pen = cpen;
if (txscale != 1)
- pen.setWidthF(pen.width() * txscale);
+ pen.setWidthF(pen.widthF() * txscale);
if (use_cache)
fillPath(qt_opengl_stroke_cache()->getStrokedPath(temp.map(path), pen));
else
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index f0c7e20..e3ee2b2 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -97,7 +97,6 @@ static int qt_gl_pixmap_serial = 0;
QGLPixmapData::QGLPixmapData(PixelType type)
: QPixmapData(type, OpenGLClass)
, m_renderFbo(0)
- , m_textureId(0)
, m_engine(0)
, m_ctx(0)
, m_dirty(false)
@@ -113,9 +112,9 @@ QGLPixmapData::~QGLPixmapData()
if (!shareWidget)
return;
- if (m_textureId) {
+ if (m_texture.id) {
QGLShareContextScope ctx(shareWidget->context());
- glDeleteTextures(1, &m_textureId);
+ glDeleteTextures(1, &m_texture.id);
}
}
@@ -148,10 +147,10 @@ void QGLPixmapData::resize(int width, int height)
is_null = (w <= 0 || h <= 0);
d = pixelType() == QPixmapData::PixmapType ? 32 : 1;
- if (m_textureId) {
+ if (m_texture.id) {
QGLShareContextScope ctx(qt_gl_share_widget()->context());
- glDeleteTextures(1, &m_textureId);
- m_textureId = 0;
+ glDeleteTextures(1, &m_texture.id);
+ m_texture.id = 0;
}
m_source = QImage();
@@ -172,9 +171,9 @@ void QGLPixmapData::ensureCreated() const
const GLenum format = qt_gl_preferredTextureFormat();
const GLenum target = GL_TEXTURE_2D;
- if (!m_textureId) {
- glGenTextures(1, &m_textureId);
- glBindTexture(target, m_textureId);
+ if (!m_texture.id) {
+ glGenTextures(1, &m_texture.id);
+ glBindTexture(target, m_texture.id);
GLenum format = m_hasAlpha ? GL_RGBA : GL_RGB;
glTexImage2D(target, 0, format, w, h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, 0);
@@ -185,13 +184,15 @@ void QGLPixmapData::ensureCreated() const
if (!m_source.isNull()) {
const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, format);
- glBindTexture(target, m_textureId);
+ glBindTexture(target, m_texture.id);
glTexSubImage2D(target, 0, 0, 0, w, h, format,
GL_UNSIGNED_BYTE, tx.bits());
if (useFramebufferObjects())
m_source = QImage();
}
+
+ m_texture.clean = false;
}
QGLFramebufferObject *QGLPixmapData::fbo() const
@@ -223,10 +224,10 @@ void QGLPixmapData::fromImage(const QImage &image,
is_null = (w <= 0 || h <= 0);
d = pixelType() == QPixmapData::PixmapType ? 32 : 1;
- if (m_textureId) {
+ if (m_texture.id) {
QGLShareContextScope ctx(qt_gl_share_widget()->context());
- glDeleteTextures(1, &m_textureId);
- m_textureId = 0;
+ glDeleteTextures(1, &m_texture.id);
+ m_texture.id = 0;
}
}
@@ -256,9 +257,9 @@ void QGLPixmapData::fill(const QColor &color)
bool hasAlpha = color.alpha() != 255;
if (hasAlpha && !m_hasAlpha) {
- if (m_textureId) {
- glDeleteTextures(1, &m_textureId);
- m_textureId = 0;
+ if (m_texture.id) {
+ glDeleteTextures(1, &m_texture.id);
+ m_texture.id = 0;
m_dirty = true;
}
m_hasAlpha = color.alpha() != 255;
@@ -303,6 +304,8 @@ QImage QGLPixmapData::fillImage(const QColor &color) const
return img;
}
+extern QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha);
+
QImage QGLPixmapData::toImage() const
{
if (!isValid())
@@ -319,8 +322,7 @@ QImage QGLPixmapData::toImage() const
}
QGLShareContextScope ctx(qt_gl_share_widget()->context());
- extern QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha);
- glBindTexture(GL_TEXTURE_2D, m_textureId);
+ glBindTexture(GL_TEXTURE_2D, m_texture.id);
return qt_gl_read_texture(QSize(w, h), true, true);
}
@@ -350,7 +352,7 @@ void QGLPixmapData::copyBackFromRenderFbo(bool keepCurrentFboBound) const
glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, m_textureId, 0);
+ GL_TEXTURE_2D, m_texture.id, 0);
const int x0 = 0;
const int x1 = w;
@@ -488,7 +490,7 @@ GLuint QGLPixmapData::bind(bool copyBack) const
ensureCreated();
}
- GLuint id = m_textureId;
+ GLuint id = m_texture.id;
glBindTexture(GL_TEXTURE_2D, id);
return id;
}
@@ -496,7 +498,12 @@ GLuint QGLPixmapData::bind(bool copyBack) const
GLuint QGLPixmapData::textureId() const
{
ensureCreated();
- return m_textureId;
+ return m_texture.id;
+}
+
+QGLTexture* QGLPixmapData::texture() const
+{
+ return &m_texture;
}
extern int qt_defaultDpiX();
diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h
index a6aa22d..671f9a7 100644
--- a/src/opengl/qpixmapdata_gl_p.h
+++ b/src/opengl/qpixmapdata_gl_p.h
@@ -53,6 +53,7 @@
// We mean it.
//
+#include "qgl_p.h"
#include "qgl.h"
#include "private/qpixmapdata_p.h"
@@ -80,10 +81,11 @@ public:
void fill(const QColor &color);
bool hasAlphaChannel() const;
QImage toImage() const;
- QPaintEngine* paintEngine() const;
+ QPaintEngine *paintEngine() const;
GLuint bind(bool copyBack = true) const;
GLuint textureId() const;
+ QGLTexture *texture() const;
bool isValidContext(const QGLContext *ctx) const;
@@ -116,10 +118,10 @@ private:
QImage fillImage(const QColor &color) const;
mutable QGLFramebufferObject *m_renderFbo;
- mutable GLuint m_textureId;
mutable QPaintEngine *m_engine;
mutable QGLContext *m_ctx;
mutable QImage m_source;
+ mutable QGLTexture m_texture;
// the texture is not in sync with the source image
mutable bool m_dirty;
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 3a7a07e..eec725e 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -171,7 +171,7 @@ QGLGraphicsSystem::QGLGraphicsSystem()
}
}
#elif defined(Q_WS_WIN)
- QGLWindowSurface::surfaceFormat.setDoubleBuffer(false);
+ QGLWindowSurface::surfaceFormat.setDoubleBuffer(true);
qt_win_owndc_required = true;
#endif
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 1aed769..a9ecffc 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -142,6 +142,8 @@ public:
void ensureMask(QVGPaintEngine *engine, int width, int height);
void modifyMask
(QVGPaintEngine *engine, VGMaskOperation op, const QRegion& region);
+ void modifyMask
+ (QVGPaintEngine *engine, VGMaskOperation op, const QRect& rect);
#endif
VGint maxScissorRects; // Maximum scissor rectangles for clipping.
@@ -1320,11 +1322,11 @@ QPainterState *QVGPaintEngine::createState(QPainterState *orig) const
if (!orig) {
return new QVGPainterState();
} else {
- QVGPaintEnginePrivate *d =
- static_cast<QVGPaintEnginePrivate *>(d_ptr.data());
+ Q_D(const QVGPaintEngine);
+ QVGPaintEnginePrivate *d2 = const_cast<QVGPaintEnginePrivate*>(d.data());
QVGPainterState *origState = static_cast<QVGPainterState *>(orig);
- origState->savedDirty = d->dirty;
- d->dirty = 0;
+ origState->savedDirty = d2->dirty;
+ d2->dirty = 0;
return new QVGPainterState(*origState);
}
}
@@ -1611,13 +1613,106 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
{
- clip(QRegion(rect), op);
+ Q_D(QVGPaintEngine);
+
+ d->dirty |= QPaintEngine::DirtyClipRegion;
+
+ // If we have a non-simple transform, then use path-based clipping.
+ if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) {
+ QPaintEngineEx::clip(rect, op);
+ return;
+ }
+
+ switch (op) {
+ case Qt::NoClip:
+ {
+ d->maskValid = false;
+ d->maskIsSet = true;
+ d->maskRect = QRect();
+ vgSeti(VG_MASKING, VG_FALSE);
+ }
+ break;
+
+ case Qt::ReplaceClip:
+ {
+ QRect r = d->transform.mapRect(rect);
+ if (isDefaultClipRect(r)) {
+ // Replacing the clip with a full-window region is the
+ // same as turning off clipping.
+ if (d->maskValid)
+ vgSeti(VG_MASKING, VG_FALSE);
+ d->maskValid = false;
+ d->maskIsSet = true;
+ d->maskRect = QRect();
+ } else {
+ // Special case: if the intersection of the system
+ // clip and "r" is a single rectangle, then use the
+ // scissor for clipping. We try to avoid allocating a
+ // QRegion copy on the heap for the test if we can.
+ QRegion clip = d->systemClip; // Reference-counted, no alloc.
+ QRect clipRect;
+ if (clip.numRects() == 1) {
+ clipRect = clip.boundingRect().intersected(r);
+ } else if (clip.isEmpty()) {
+ clipRect = r;
+ } else {
+ clip = clip.intersect(r);
+ if (clip.numRects() != 1) {
+ d->maskValid = false;
+ d->maskIsSet = false;
+ d->maskRect = QRect();
+ d->modifyMask(this, VG_FILL_MASK, r);
+ break;
+ }
+ clipRect = clip.boundingRect();
+ }
+ d->maskValid = false;
+ d->maskIsSet = false;
+ d->maskRect = clipRect;
+ vgSeti(VG_MASKING, VG_FALSE);
+ updateScissor();
+ }
+ }
+ break;
+
+ case Qt::IntersectClip:
+ {
+ QRect r = d->transform.mapRect(rect);
+ if (d->maskIsSet && isDefaultClipRect(r)) {
+ // Intersecting a full-window clip with a full-window
+ // region is the same as turning off clipping.
+ if (d->maskValid)
+ vgSeti(VG_MASKING, VG_FALSE);
+ d->maskValid = false;
+ d->maskIsSet = true;
+ d->maskRect = QRect();
+ } else {
+ d->modifyMask(this, VG_INTERSECT_MASK, r);
+ }
+ }
+ break;
+
+ case Qt::UniteClip:
+ {
+ // If we already have a full-window clip, then uniting a
+ // region with it will do nothing. Otherwise union.
+ if (!(d->maskIsSet))
+ d->modifyMask(this, VG_UNION_MASK, d->transform.mapRect(rect));
+ }
+ break;
+ }
}
void QVGPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
{
Q_D(QVGPaintEngine);
+ // Use the QRect case if the region consists of a single rectangle.
+ if (region.numRects() == 1) {
+ clip(region.boundingRect(), op);
+ return;
+ }
+
d->dirty |= QPaintEngine::DirtyClipRegion;
// If we have a non-simple transform, then use path-based clipping.
@@ -1656,10 +1751,10 @@ void QVGPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
clip = r;
else
clip = clip.intersect(r);
- if (r.numRects() == 1) {
+ if (clip.numRects() == 1) {
d->maskValid = false;
d->maskIsSet = false;
- d->maskRect = r.boundingRect();
+ d->maskRect = clip.boundingRect();
vgSeti(VG_MASKING, VG_FALSE);
updateScissor();
} else {
@@ -1707,11 +1802,61 @@ void QVGPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
}
}
+#if !defined(QVG_NO_RENDER_TO_MASK)
+
+// Copied from qpathclipper.cpp.
+static bool qt_vg_pathToRect(const QPainterPath &path, QRectF *rect)
+{
+ if (path.elementCount() != 5)
+ return false;
+
+ const bool mightBeRect = path.elementAt(0).isMoveTo()
+ && path.elementAt(1).isLineTo()
+ && path.elementAt(2).isLineTo()
+ && path.elementAt(3).isLineTo()
+ && path.elementAt(4).isLineTo();
+
+ if (!mightBeRect)
+ return false;
+
+ const qreal x1 = path.elementAt(0).x;
+ const qreal y1 = path.elementAt(0).y;
+
+ const qreal x2 = path.elementAt(1).x;
+ const qreal y2 = path.elementAt(2).y;
+
+ if (path.elementAt(1).y != y1)
+ return false;
+
+ if (path.elementAt(2).x != x2)
+ return false;
+
+ if (path.elementAt(3).x != x1 || path.elementAt(3).y != y2)
+ return false;
+
+ if (path.elementAt(4).x != x1 || path.elementAt(4).y != y1)
+ return false;
+
+ if (rect)
+ *rect = QRectF(QPointF(x1, y1), QPointF(x2, y2));
+
+ return true;
+}
+
+#endif
+
void QVGPaintEngine::clip(const QPainterPath &path, Qt::ClipOperation op)
{
#if !defined(QVG_NO_RENDER_TO_MASK)
Q_D(QVGPaintEngine);
+ // If the path is a simple rectangle, then use clip(QRect) instead.
+ QRectF simpleRect;
+ if (qt_vg_pathToRect(path, &simpleRect)) {
+ clip(simpleRect.toRect(), op);
+ return;
+ }
+
d->dirty |= QPaintEngine::DirtyClipRegion;
if (op == Qt::NoClip) {
@@ -1765,7 +1910,7 @@ void QVGPaintEnginePrivate::ensureMask
maskRect = QRect();
} else {
vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, 0, 0, width, height);
- if (!maskRect.isNull()) {
+ if (maskRect.isValid()) {
vgMask(VG_INVALID_HANDLE, VG_FILL_MASK,
maskRect.x(), height - maskRect.y() - maskRect.height(),
maskRect.width(), maskRect.height());
@@ -1797,6 +1942,27 @@ void QVGPaintEnginePrivate::modifyMask
maskIsSet = false;
}
+void QVGPaintEnginePrivate::modifyMask
+ (QVGPaintEngine *engine, VGMaskOperation op, const QRect& rect)
+{
+ QPaintDevice *pdev = engine->paintDevice();
+ int width = pdev->width();
+ int height = pdev->height();
+
+ if (!maskValid)
+ ensureMask(engine, width, height);
+
+ if (rect.isValid()) {
+ vgMask(VG_INVALID_HANDLE, op,
+ rect.x(), height - rect.y() - rect.height(),
+ rect.width(), rect.height());
+ }
+
+ vgSeti(VG_MASKING, VG_TRUE);
+ maskValid = true;
+ maskIsSet = false;
+}
+
#endif // !QVG_SCISSOR_CLIP
void QVGPaintEngine::updateScissor()
@@ -1892,6 +2058,16 @@ bool QVGPaintEngine::isDefaultClipRegion(const QRegion& region)
rect.width() == width && rect.height() == height);
}
+bool QVGPaintEngine::isDefaultClipRect(const QRect& rect)
+{
+ QPaintDevice *pdev = paintDevice();
+ int width = pdev->width();
+ int height = pdev->height();
+
+ return (rect.x() == 0 && rect.y() == 0 &&
+ rect.width() == width && rect.height() == height);
+}
+
void QVGPaintEngine::clipEnabledChanged()
{
#if defined(QVG_SCISSOR_CLIP)
diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h
index a390c80..bde06e5 100644
--- a/src/openvg/qpaintengine_vg_p.h
+++ b/src/openvg/qpaintengine_vg_p.h
@@ -154,6 +154,7 @@ private:
void updateScissor();
QRegion defaultClipRegion();
bool isDefaultClipRegion(const QRegion& region);
+ bool isDefaultClipRect(const QRect& rect);
bool clearRect(const QRectF &rect, const QColor &color);
};
diff --git a/src/plugins/accessible/compat/q3complexwidgets.cpp b/src/plugins/accessible/compat/q3complexwidgets.cpp
index 696bc99..b911d5e 100644
--- a/src/plugins/accessible/compat/q3complexwidgets.cpp
+++ b/src/plugins/accessible/compat/q3complexwidgets.cpp
@@ -274,7 +274,7 @@ QString Q3AccessibleTitleBar::text(Text t, int child) const
return Q3TitleBar::tr("Contains commands to manipulate the window");
case 3:
if (window && window->isMinimized())
- return Q3TitleBar::tr("Puts a minimized back to normal");
+ return Q3TitleBar::tr("Puts a minimized window back to normal");
return Q3TitleBar::tr("Moves the window out of the way");
case 4:
if (window && window->isMaximized())
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
index ed59db8..b5376b1 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
@@ -78,7 +78,7 @@ private:
DFBEvent event;
int bytesRead;
-private slots:
+private Q_SLOTS:
void readKeyboardData();
};
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
index 15fb6f4..142993d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
@@ -71,7 +71,7 @@ private:
DFBEvent event;
uint bytesRead;
-private slots:
+private Q_SLOTS:
void readMouseData();
};
@@ -101,7 +101,7 @@ QDirectFBMouseHandlerPrivate::QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler
#endif
DFBInputDeviceCapabilities caps;
- caps = DFBInputDeviceCapabilities(DICAPS_BUTTONS | DICAPS_AXES);
+ caps = DICAPS_BUTTONS | DICAPS_AXES;
result = fb->CreateInputEventBuffer(fb, caps, DFB_TRUE, &eventBuffer);
if (result != DFB_OK) {
DirectFBError("QDirectFBMouseHandler: "
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
index 905fec3..86e92f7 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
@@ -56,20 +56,17 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const
}
-void QDirectFBPaintDevice::lockDirectFB(uint flags)
+void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags)
{
if (!(lock & flags)) {
if (lock)
unlockDirectFB();
- if ((mem = QDirectFBScreen::lockSurface(dfbSurface, flags, &bpl))) {
- const QSize s = size();
- lockedImage = new QImage(mem, s.width(), s.height(), bpl,
- QDirectFBScreen::getImageFormat(dfbSurface));
- lock = flags;
- Q_ASSERT(mem);
- } else {
- lock = 0;
- }
+ mem = QDirectFBScreen::lockSurface(dfbSurface, flags, &bpl);
+ Q_ASSERT(mem);
+ const QSize s = size();
+ lockedImage = new QImage(mem, s.width(), s.height(), bpl,
+ QDirectFBScreen::getImageFormat(dfbSurface));
+ lock = flags;
}
}
@@ -83,17 +80,12 @@ void QDirectFBPaintDevice::unlockDirectFB()
delete lockedImage;
lockedImage = 0;
mem = 0;
- lock = 0;
+ lock = DFBSurfaceLockFlags(0);
}
void *QDirectFBPaintDevice::memory() const
{
- if (lock != (DSLF_READ|DSLF_WRITE)) {
- QDirectFBPaintDevice *that = const_cast<QDirectFBPaintDevice*>(this);
- that->lockDirectFB(DSLF_READ|DSLF_WRITE);
- Q_ASSERT(that->lockedImage);
- }
return mem;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
index 32c49bb..248a15b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
@@ -51,14 +51,14 @@ QT_BEGIN_HEADER
QT_MODULE(Gui)
// Inherited by both window surface and pixmap
-class QDirectFBPaintDevice : public QCustomRasterPaintDevice
+ class QDirectFBPaintDevice : public QCustomRasterPaintDevice
{
public:
~QDirectFBPaintDevice();
IDirectFBSurface *directFBSurface() const;
- void lockDirectFB(uint flags);
+ void lockDirectFB(DFBSurfaceLockFlags lock);
void unlockDirectFB();
// Reimplemented from QCustomRasterPaintDevice:
@@ -67,16 +67,12 @@ public:
int bytesPerLine() const;
QSize size() const;
int metric(QPaintDevice::PaintDeviceMetric metric) const;
- uint lockFlags() const { return lock; }
+ DFBSurfaceLockFlags lockFlags() const { return lock; }
protected:
// Shouldn't create QDirectFBPaintDevice by itself but only sub-class it:
QDirectFBPaintDevice(QDirectFBScreen *scr = QDirectFBScreen::instance())
- : QCustomRasterPaintDevice(0),
- dfbSurface(0),
- lockedImage(0),
- screen(scr),
- lock(0),
- mem(0)
+ : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr),
+ lock(DFBSurfaceLockFlags(0)), mem(0)
{}
inline int dotsPerMeterX() const
@@ -92,11 +88,11 @@ protected:
QImage *lockedImage;
QDirectFBScreen *screen;
int bpl;
- uint lock;
+ DFBSurfaceLockFlags lock;
uchar *mem;
private:
Q_DISABLE_COPY(QDirectFBPaintDevice)
-};
+ };
QT_END_HEADER
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index ade8554..94f1aeb 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -54,173 +54,22 @@
#include <private/qpixmapdata_p.h>
#include <private/qpixmap_raster_p.h>
-#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
-#define VOID_ARG() static_cast<bool>(false)
-enum PaintOperation {
- DRAW_RECTS = 0x0001,
- DRAW_LINES = 0x0002,
- DRAW_IMAGE = 0x0004,
- DRAW_PIXMAP = 0x0008,
- DRAW_TILED_PIXMAP = 0x0010,
- STROKE_PATH = 0x0020,
- DRAW_PATH = 0x0040,
- DRAW_POINTS = 0x0080,
- DRAW_ELLIPSE = 0x0100,
- DRAW_POLYGON = 0x0200,
- DRAW_TEXT = 0x0400,
- FILL_PATH = 0x0800,
- FILL_RECT = 0x1000,
- DRAW_COLORSPANS = 0x2000,
- ALL = 0xffff
-};
-#endif
-
-#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
-template <typename T> inline const T *ptr(const T &t) { return &t; }
-template <> inline const bool* ptr<bool>(const bool &) { return 0; }
-template <typename device, typename T1, typename T2, typename T3>
-static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
- int scale, bool matrixRotShear, bool simplePen,
- bool dfbHandledClip, bool unsupportedCompositionMode,
- const char *nameOne, const T1 &one,
- const char *nameTwo, const T2 &two,
- const char *nameThree, const T3 &three)
-{
- QString out;
- QDebug dbg(&out);
- dbg << msg << (QByteArray(func) + "()") << "painting on";
- if (dev->devType() == QInternal::Widget) {
- dbg << static_cast<const QWidget*>(dev);
- } else {
- dbg << dev << "of type" << dev->devType();
- }
-
- dbg << "scale" << scale
- << "matrixRotShear" << matrixRotShear
- << "simplePen" << simplePen
- << "dfbHandledClip" << dfbHandledClip
- << "unsupportedCompositionMode" << unsupportedCompositionMode;
-
- const T1 *t1 = ptr(one);
- const T2 *t2 = ptr(two);
- const T3 *t3 = ptr(three);
-
- if (t1) {
- dbg << nameOne << *t1;
- if (t2) {
- dbg << nameTwo << *t2;
- if (t3) {
- dbg << nameThree << *t3;
- }
- }
- }
- qWarning("%s", qPrintable(out));
-}
-#endif
-
-#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
-#define RASTERFALLBACK(op, one, two, three) \
- if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
- rasterFallbackWarn("Disabled raster engine operation", \
- __FUNCTION__, state()->painter->device(), \
- d_func()->scale, d_func()->matrixRotShear, \
- d_func()->simplePen, d_func()->dfbCanHandleClip(), \
- d_func()->unsupportedCompositionMode, \
- #one, one, #two, two, #three, three); \
- if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
- return;
-#elif defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
-#define RASTERFALLBACK(op, one, two, three) \
- if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
- return;
-#elif defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
-#define RASTERFALLBACK(op, one, two, three) \
- if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
- rasterFallbackWarn("Falling back to raster engine for", \
- __FUNCTION__, state()->painter->device(), \
- d_func()->scale, d_func()->matrixRotShear, \
- d_func()->simplePen, d_func()->dfbCanHandleClip(), \
- d_func()->unsupportedCompositionMode, \
- #one, one, #two, two, #three, three);
-#else
-#define RASTERFALLBACK(op, one, two, three)
-#endif
-
-static inline uint ALPHA_MUL(uint x, uint a)
-{
- uint t = x * a;
- t = ((t + (t >> 8) + 0x80) >> 8) & 0xff;
- return t;
-}
-
-class SurfaceCache
-{
-public:
- SurfaceCache() : surface(0), buffer(0), bufsize(0) {}
- ~SurfaceCache() { clear(); }
-
-
- IDirectFBSurface *getSurface(const uint *buf, int size)
- {
- if (buffer == buf && bufsize == size)
- return surface;
-
- clear();
-
- const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size);
- surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface);
- if (!surface)
- qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface");
-
- buffer = const_cast<uint*>(buf);
- bufsize = size;
-
- return surface;
- }
-
- void clear()
- {
- if (surface && QDirectFBScreen::instance())
- QDirectFBScreen::instance()->releaseDFBSurface(surface);
- surface = 0;
- buffer = 0;
- bufsize = 0;
- }
-private:
- IDirectFBSurface *surface;
- uint *buffer;
- int bufsize;
-};
-
-
-#ifdef QT_DIRECTFB_IMAGECACHE
-#include <private/qimage_p.h>
-struct CachedImage
-{
- IDirectFBSurface *surface;
- ~CachedImage()
- {
- if (surface && QDirectFBScreen::instance()) {
- QDirectFBScreen::instance()->releaseDFBSurface(surface);
- }
- }
-};
-static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB
-#endif
-
+class SurfaceCache;
class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate
{
public:
- enum Scale { NoScale, Scaled, NegativeScale };
-
+ enum TransformationTypeFlags {
+ NegativeScale = 0x100,
+ RectsUnsupported = (QTransform::TxRotate|QTransform::TxShear|QTransform::TxProject),
+ BlitUnsupported = (NegativeScale|RectsUnsupported)
+ };
QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p);
~QDirectFBPaintEnginePrivate();
- void setTransform(const QTransform &m);
- void setPen(const QPen &pen);
+ inline void setTransform(const QTransform &transforma);
+ inline void setPen(const QPen &pen);
inline void setCompositionMode(QPainter::CompositionMode mode);
- inline void setOpacity(quint8 value);
- void setRenderHints(QPainter::RenderHints hints);
+ inline void setRenderHints(QPainter::RenderHints hints);
inline void setDFBColor(const QColor &color);
@@ -232,20 +81,11 @@ public:
inline bool dfbCanHandleClip() const;
inline bool isSimpleBrush(const QBrush &brush) const;
- void drawLines(const QLine *lines, int count);
- void drawLines(const QLineF *lines, int count);
-
- void fillRegion(const QRegion &r);
- void fillRects(const QRect *rects, int count);
- void drawRects(const QRect *rects, int count);
- void fillRects(const QRectF *rects, int count);
- void drawRects(const QRectF *rects, int count);
-
- void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap);
+ void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos);
void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src);
inline void updateClip();
- void systemStateChanged();
+ virtual void systemStateChanged();
static IDirectFBSurface *getSurface(const QImage &img, bool *release);
@@ -257,22 +97,14 @@ public:
private:
IDirectFBSurface *surface;
- QPen pen;
-
bool antialiased;
-
bool simplePen;
- bool matrixRotShear;
- Scale scale;
+ uint transformationType; // this is QTransform::type() + NegativeScale if qMin(transform.m11(), transform.m22()) < 0
SurfaceCache *surfaceCache;
- QTransform transform;
- int lastLockedHeight;
IDirectFB *fb;
- int fbWidth;
- int fbHeight;
quint8 opacity;
@@ -280,13 +112,97 @@ private:
bool dfbHandledClip;
bool ignoreSystemClip;
QDirectFBPaintDevice *dfbDevice;
- void *lockedMemory;
bool unsupportedCompositionMode;
QDirectFBPaintEngine *q;
+ QRect currentClip;
friend class QDirectFBPaintEngine;
};
+class SurfaceCache
+{
+public:
+ SurfaceCache() : surface(0), buffer(0), bufsize(0) {}
+ ~SurfaceCache() { clear(); }
+ IDirectFBSurface *getSurface(const uint *buf, int size);
+ void clear();
+private:
+ IDirectFBSurface *surface;
+ uint *buffer;
+ int bufsize;
+};
+
+
+#ifdef QT_DIRECTFB_IMAGECACHE
+#include <private/qimage_p.h>
+struct CachedImage
+{
+ IDirectFBSurface *surface;
+ ~CachedImage()
+ {
+ if (surface && QDirectFBScreen::instance()) {
+ QDirectFBScreen::instance()->releaseDFBSurface(surface);
+ }
+ }
+};
+static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB
+#endif
+
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#define VOID_ARG() static_cast<bool>(false)
+enum PaintOperation {
+ DRAW_RECTS = 0x0001, DRAW_LINES = 0x0002, DRAW_IMAGE = 0x0004,
+ DRAW_PIXMAP = 0x0008, DRAW_TILED_PIXMAP = 0x0010, STROKE_PATH = 0x0020,
+ DRAW_PATH = 0x0040, DRAW_POINTS = 0x0080, DRAW_ELLIPSE = 0x0100,
+ DRAW_POLYGON = 0x0200, DRAW_TEXT = 0x0400, FILL_PATH = 0x0800,
+ FILL_RECT = 0x1000, DRAW_COLORSPANS = 0x2000, ALL = 0xffff
+};
+#endif
+
+#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+template <typename device, typename T1, typename T2, typename T3>
+static void rasterFallbackWarn(const char *msg, const char *, const device *, uint, bool, bool, bool,
+ const char *, const T1 &, const char *, const T2 &, const char *, const T3 &);
+#endif
+
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#define RASTERFALLBACK(op, one, two, three) \
+ if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
+ rasterFallbackWarn("Disabled raster engine operation", \
+ __FUNCTION__, state()->painter->device(), \
+ d_func()->transformationType, \
+ d_func()->simplePen, \
+ d_func()->dfbCanHandleClip(), \
+ d_func()->unsupportedCompositionMode, \
+ #one, one, #two, two, #three, three); \
+ if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
+ return;
+#elif defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#define RASTERFALLBACK(op, one, two, three) \
+ if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
+ return;
+#elif defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+#define RASTERFALLBACK(op, one, two, three) \
+ if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
+ rasterFallbackWarn("Falling back to raster engine for", \
+ __FUNCTION__, state()->painter->device(), \
+ d_func()->transformationType, \
+ d_func()->simplePen, \
+ d_func()->dfbCanHandleClip(), \
+ d_func()->unsupportedCompositionMode, \
+ #one, one, #two, two, #three, three);
+#else
+#define RASTERFALLBACK(op, one, two, three)
+#endif
+
+
+template <class T>
+static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface);
+template <class T>
+static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface);
+template <class T>
+static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface);
+
QDirectFBPaintEngine::QDirectFBPaintEngine(QPaintDevice *device)
: QRasterPaintEngine(*(new QDirectFBPaintEnginePrivate(this)), device)
{
@@ -299,7 +215,6 @@ QDirectFBPaintEngine::~QDirectFBPaintEngine()
bool QDirectFBPaintEngine::begin(QPaintDevice *device)
{
Q_D(QDirectFBPaintEngine);
- d->lastLockedHeight = -1;
if (device->devType() == QInternal::CustomRaster) {
d->dfbDevice = static_cast<QDirectFBPaintDevice*>(device);
} else if (device->devType() == QInternal::Pixmap) {
@@ -316,23 +231,10 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device)
qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x",
device->devType());
}
- d->lockedMemory = 0;
-
- d->surface->GetSize(d->surface, &d->fbWidth, &d->fbHeight);
-
- d->setTransform(QTransform());
- d->antialiased = false;
- d->setOpacity(255);
- d->setCompositionMode(state()->compositionMode());
- d->dirtyClip = true;
- d->setPen(state()->pen);
-
- const bool status = QRasterPaintEngine::begin(device);
- // XXX: QRasterPaintEngine::begin() resets the capabilities
- gccaps |= PorterDuff;
+ d->prepare(d->dfbDevice);
- return status;
+ return QRasterPaintEngine::begin(device);
}
bool QDirectFBPaintEngine::end()
@@ -343,6 +245,7 @@ bool QDirectFBPaintEngine::end()
#if (Q_DIRECTFB_VERSION >= 0x010000)
d->surface->ReleaseSource(d->surface);
#endif
+ d->currentClip = QRect();
d->surface->SetClip(d->surface, NULL);
d->surface = 0;
return QRasterPaintEngine::end();
@@ -366,7 +269,7 @@ void QDirectFBPaintEngine::penChanged()
void QDirectFBPaintEngine::opacityChanged()
{
Q_D(QDirectFBPaintEngine);
- d->setOpacity(quint8(state()->opacity * 255));
+ d->opacity = quint8(state()->opacity * 255);
QRasterPaintEngine::opacityChanged();
}
@@ -387,32 +290,26 @@ void QDirectFBPaintEngine::renderHintsChanged()
void QDirectFBPaintEngine::transformChanged()
{
Q_D(QDirectFBPaintEngine);
- const QDirectFBPaintEnginePrivate::Scale old = d->scale;
- d->setTransform(state()->transform());
- if (d->scale != old) {
- d->setPen(state()->pen);
- }
+ d->setTransform(state()->matrix);
QRasterPaintEngine::transformChanged();
}
-void QDirectFBPaintEngine::setState(QPainterState *s)
+void QDirectFBPaintEngine::setState(QPainterState *state)
{
Q_D(QDirectFBPaintEngine);
- QRasterPaintEngine::setState(s);
+ QRasterPaintEngine::setState(state);
d->dirtyClip = true;
- d->setPen(state()->pen);
- d->setOpacity(quint8(state()->opacity * 255));
- d->setCompositionMode(state()->compositionMode());
- d->setTransform(state()->transform());
+ d->setPen(state->pen);
+ d->opacity = quint8(state->opacity * 255);
+ d->setCompositionMode(state->compositionMode());
+ d->setTransform(state->transform());
+ d->setRenderHints(state->renderHints);
}
void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
{
Q_D(QDirectFBPaintEngine);
d->dirtyClip = true;
- const QPoint bottom = d->transform.map(QPoint(0, int(path.controlPointRect().bottom())));
- if (bottom.y() > d->lastLockedHeight)
- d->lock();
QRasterPaintEngine::clip(path, op);
}
@@ -420,12 +317,6 @@ void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
{
Q_D(QDirectFBPaintEngine);
d->dirtyClip = true;
- if (d->clip() && !d->clip()->hasRectClip && d->clip()->enabled) {
- const QPoint bottom = d->transform.map(QPoint(0, rect.bottom()));
- if (bottom.y() > d->lastLockedHeight)
- d->lock();
- }
-
QRasterPaintEngine::clip(rect, op);
}
@@ -434,8 +325,11 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
Q_D(QDirectFBPaintEngine);
d->updateClip();
const QBrush &brush = state()->brush;
- if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear
- || !d->simplePen || !d->isSimpleBrush(brush)) {
+ if (d->unsupportedCompositionMode
+ || (d->transformationType & QDirectFBPaintEnginePrivate::RectsUnsupported)
+ || !d->simplePen
+ || !d->dfbCanHandleClip()
+ || !d->isSimpleBrush(brush)) {
RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
@@ -446,11 +340,12 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- d->fillRects(rects, rectCount);
+ ::fillRects<QRect>(rects, rectCount, state()->matrix, d->surface);
}
- if (d->pen != Qt::NoPen) {
- d->setDFBColor(d->pen.color());
- d->drawRects(rects, rectCount);
+ const QPen &pen = state()->pen;
+ if (pen != Qt::NoPen) {
+ d->setDFBColor(pen.color());
+ ::drawRects<QRect>(rects, rectCount, state()->matrix, d->surface);
}
}
@@ -459,8 +354,11 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
Q_D(QDirectFBPaintEngine);
d->updateClip();
const QBrush &brush = state()->brush;
- if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear
- || !d->simplePen || !d->isSimpleBrush(brush)) {
+ if (d->unsupportedCompositionMode
+ || (d->transformationType & QDirectFBPaintEnginePrivate::RectsUnsupported)
+ || !d->simplePen
+ || !d->dfbCanHandleClip()
+ || !d->isSimpleBrush(brush)) {
RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
@@ -471,11 +369,12 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- d->fillRects(rects, rectCount);
+ ::fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface);
}
- if (d->pen != Qt::NoPen) {
- d->setDFBColor(d->pen.color());
- d->drawRects(rects, rectCount);
+ const QPen &pen = state()->pen;
+ if (pen != Qt::NoPen) {
+ d->setDFBColor(pen.color());
+ ::drawRects<QRectF>(rects, rectCount, state()->matrix, d->surface);
}
}
@@ -490,10 +389,11 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
return;
}
- if (d->pen != Qt::NoPen) {
+ const QPen &pen = state()->pen;
+ if (pen != Qt::NoPen) {
d->unlock();
- d->setDFBColor(d->pen.color());
- d->drawLines(lines, lineCount);
+ d->setDFBColor(pen.color());
+ ::drawLines<QLine>(lines, lineCount, state()->matrix, d->surface);
}
}
@@ -508,10 +408,11 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
return;
}
- if (d->pen != Qt::NoPen) {
+ const QPen &pen = state()->pen;
+ if (pen != Qt::NoPen) {
d->unlock();
- d->setDFBColor(d->pen.color());
- d->drawLines(lines, lineCount);
+ d->setDFBColor(pen.color());
+ ::drawLines<QLineF>(lines, lineCount, state()->matrix, d->surface);
}
}
@@ -542,8 +443,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
d->updateClip();
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
if (d->unsupportedCompositionMode
- || d->matrixRotShear
- || d->scale == QDirectFBPaintEnginePrivate::NegativeScale
+ || (d->transformationType & QDirectFBPaintEnginePrivate::BlitUnsupported)
|| !d->dfbCanHandleClip(r)
#ifndef QT_DIRECTFB_IMAGECACHE
|| QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN
@@ -588,8 +488,9 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
d->lock();
QRasterPaintEngine::drawPixmap(r, pixmap, sr);
- } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear
- || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) {
+ } else if (d->unsupportedCompositionMode
+ || (d->transformationType & QDirectFBPaintEnginePrivate::BlitUnsupported)
+ || !d->dfbCanHandleClip(r)) {
RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
d->lock();
@@ -613,30 +514,27 @@ void QDirectFBPaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
const QPixmap &pixmap,
- const QPointF &sp)
+ const QPointF &offset)
{
Q_D(QDirectFBPaintEngine);
d->updateClip();
if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) {
- RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp);
+ RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
d->lock();
- QRasterPaintEngine::drawTiledPixmap(r, pixmap, sp);
- } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull()
- || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) {
- RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp);
+ QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset);
+ } else if (d->unsupportedCompositionMode
+ || (d->transformationType & QDirectFBPaintEnginePrivate::BlitUnsupported)
+ || !d->dfbCanHandleClip(r)) {
+ RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
d->lock();
QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType);
data->fromImage(*img, Qt::AutoColor);
const QPixmap pix(data);
- QRasterPaintEngine::drawTiledPixmap(r, pix, sp);
+ QRasterPaintEngine::drawTiledPixmap(r, pix, offset);
} else {
d->unlock();
- QPixmapData *data = pixmap.pixmapData();
- Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
- QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- dfbData->unlockDirectFB();
- d->drawTiledPixmap(r, pixmap);
+ d->drawTiledPixmap(r, pixmap, offset);
}
}
@@ -721,7 +619,9 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
{
Q_D(QDirectFBPaintEngine);
d->updateClip();
- if (!d->unsupportedCompositionMode && d->dfbCanHandleClip(rect) && !d->matrixRotShear) {
+ if (!d->unsupportedCompositionMode
+ && !(d->transformationType & (QDirectFBPaintEnginePrivate::RectsUnsupported))
+ && d->dfbCanHandleClip(rect)) {
switch (brush.style()) {
case Qt::SolidPattern: {
const QColor color = brush.color();
@@ -729,18 +629,21 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
return;
d->unlock();
d->setDFBColor(color);
- const QRect r = d->transform.mapRect(rect).toRect();
+ const QRect r = state()->matrix.mapRect(rect).toRect();
d->surface->FillRectangle(d->surface, r.x(), r.y(),
r.width(), r.height());
return; }
- case Qt::TexturePattern:
- if (state()->brushOrigin == QPointF() && brush.transform().isIdentity()) {
- //could handle certain types of brush.transform() E.g. scale
- d->unlock();
- d->drawTiledPixmap(rect, brush.texture());
- return;
- }
- break;
+ case Qt::TexturePattern: {
+ if (d->transformationType & QDirectFBPaintEnginePrivate::NegativeScale)
+ break;
+
+ const QPixmap texture = brush.texture();
+ if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass)
+ break;
+
+ d->unlock();
+ d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin);
+ return; }
default:
break;
}
@@ -756,51 +659,21 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
return;
Q_D(QDirectFBPaintEngine);
d->updateClip();
- if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear) {
+ if (d->unsupportedCompositionMode
+ || (d->transformationType & QDirectFBPaintEnginePrivate::RectsUnsupported)
+ || !d->dfbCanHandleClip()) {
RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG());
d->lock();
QRasterPaintEngine::fillRect(rect, color);
} else {
d->unlock();
d->setDFBColor(color);
- const QRect r = d->transform.mapRect(rect).toRect();
+ const QRect r = state()->matrix.mapRect(rect).toRect();
d->surface->FillRectangle(d->surface, r.x(), r.y(),
r.width(), r.height());
}
}
-void QDirectFBPaintEngine::drawColorSpans(const QSpan *spans, int count,
- uint color)
-{
- Q_D(QDirectFBPaintEngine);
- color = INV_PREMUL(color);
-
- QVarLengthArray<DFBRegion> lines(count);
- int j = 0;
- for (int i = 0; i < count; ++i) {
- if (spans[i].coverage == 255) {
- lines[j].x1 = spans[i].x;
- lines[j].y1 = spans[i].y;
- lines[j].x2 = spans[i].x + spans[i].len - 1;
- lines[j].y2 = spans[i].y;
- ++j;
- } else {
- DFBSpan span = { spans[i].x, spans[i].len };
- uint c = BYTE_MUL(color, spans[i].coverage);
- // ### how does this play with setDFBColor
- d->surface->SetColor(d->surface,
- qRed(c), qGreen(c), qBlue(c), qAlpha(c));
- d->surface->FillSpans(d->surface, spans[i].y, &span, 1);
- }
- }
- if (j > 0) {
- d->surface->SetColor(d->surface,
- qRed(color), qGreen(color), qBlue(color),
- qAlpha(color));
- d->surface->DrawLines(d->surface, lines.data(), j);
- }
-}
-
void QDirectFBPaintEngine::drawBufferSpan(const uint *buffer, int bufsize,
int x, int y, int length,
uint const_alpha)
@@ -834,9 +707,8 @@ void QDirectFBPaintEngine::initImageCache(int size)
QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p)
: surface(0), antialiased(false), simplePen(false),
- matrixRotShear(false), scale(NoScale), lastLockedHeight(-1),
- fbWidth(-1), fbHeight(-1), opacity(255), dirtyClip(true),
- dfbHandledClip(false), dfbDevice(0), lockedMemory(0),
+ transformationType(0), opacity(255), dirtyClip(true),
+ dfbHandledClip(false), dfbDevice(0),
unsupportedCompositionMode(false), q(p)
{
fb = QDirectFBScreen::instance()->dfb();
@@ -877,12 +749,9 @@ void QDirectFBPaintEnginePrivate::lock()
// lock so we need to call the base implementation of prepare so
// it updates its rasterBuffer to point to the new buffer address.
Q_ASSERT(dfbDevice);
- if (dfbDevice->lockFlags() != (DSLF_WRITE|DSLF_READ)
- || dfbDevice->height() != lastLockedHeight
- || dfbDevice->memory() != lockedMemory) {
+ if (dfbDevice->lockFlags() != (DSLF_WRITE|DSLF_READ)) {
+ dfbDevice->lockDirectFB(DSLF_READ|DSLF_WRITE);
prepare(dfbDevice);
- lastLockedHeight = dfbDevice->height();
- lockedMemory = dfbDevice->memory();
}
}
@@ -890,32 +759,26 @@ void QDirectFBPaintEnginePrivate::unlock()
{
Q_ASSERT(dfbDevice);
dfbDevice->unlockDirectFB();
- lockedMemory = 0;
}
-void QDirectFBPaintEnginePrivate::setTransform(const QTransform &m)
+void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform)
{
- transform = m;
- matrixRotShear = (transform.m12() != 0 || transform.m21() != 0);
+ transformationType = transform.type();
if (qMin(transform.m11(), transform.m22()) < 0) {
- scale = NegativeScale;
- } else if (transform.m11() != 1 || transform.m22() != 1) {
- scale = Scaled;
- } else {
- scale = NoScale;
+ transformationType |= QDirectFBPaintEnginePrivate::NegativeScale;
}
+ setPen(q->state()->pen);
}
-void QDirectFBPaintEnginePrivate::setPen(const QPen &p)
+void QDirectFBPaintEnginePrivate::setPen(const QPen &pen)
{
- pen = p;
if (pen.style() == Qt::NoPen) {
simplePen = true;
} else if (pen.style() == Qt::SolidLine
&& !antialiased
&& pen.brush().style() == Qt::SolidPattern
&& pen.widthF() <= 1.0
- && (scale == NoScale || pen.isCosmetic())) {
+ && (transformationType < QTransform::TxScale || pen.isCosmetic())) {
simplePen = true;
} else {
simplePen = false;
@@ -927,12 +790,6 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
unsupportedCompositionMode = (mode != QPainter::CompositionMode_SourceOver);
}
-
-void QDirectFBPaintEnginePrivate::setOpacity(quint8 op)
-{
- opacity = op;
-}
-
void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints)
{
const bool old = antialiased;
@@ -952,6 +809,13 @@ void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha)
surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blittingFlags));
}
+static inline uint ALPHA_MUL(uint x, uint a)
+{
+ uint t = x * a;
+ t = ((t + (t >> 8) + 0x80) >> 8) & 0xff;
+ return t;
+}
+
void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color)
{
Q_ASSERT(surface);
@@ -962,67 +826,6 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color)
surface->SetDrawingFlags(surface, alpha == 255 ? DSDRAW_NOFX : DSDRAW_BLEND);
}
-void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n)
-{
- for (int i = 0; i < n; ++i) {
- const QLine l = transform.map(lines[i]);
- surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2());
- }
-}
-
-void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n)
-{
- for (int i = 0; i < n; ++i) {
- const QLine l = transform.map(lines[i]).toLine();
- surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2());
- }
-}
-
-void QDirectFBPaintEnginePrivate::fillRegion(const QRegion &region)
-{
- Q_ASSERT(isSimpleBrush(q->state()->brush));
- setDFBColor(q->state()->brush.color());
- const QVector<QRect> rects = region.rects();
- const int n = rects.size();
- fillRects(rects.constData(), n);
-}
-
-void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n)
-{
- for (int i = 0; i < n; ++i) {
- const QRect r = transform.mapRect(rects[i]);
- surface->FillRectangle(surface, r.x(), r.y(),
- r.width(), r.height());
- }
-}
-
-void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n)
-{
- for (int i = 0; i < n; ++i) {
- const QRect r = transform.mapRect(rects[i]).toRect();
- surface->FillRectangle(surface, r.x(), r.y(),
- r.width(), r.height());
- }
-}
-
-void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n)
-{
- for (int i = 0; i < n; ++i) {
- const QRect r = transform.mapRect(rects[i]);
- surface->DrawRectangle(surface, r.x(), r.y(),
- r.width() + 1, r.height() + 1);
- }
-}
-
-void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n)
-{
- for (int i = 0; i < n; ++i) {
- const QRect r = transform.mapRect(rects[i]).toRect();
- surface->DrawRectangle(surface, r.x(), r.y(),
- r.width() + 1, r.height() + 1);
- }
-}
-
IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release)
{
#ifndef QT_DIRECTFB_IMAGECACHE
@@ -1061,7 +864,7 @@ IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, boo
void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, const QRectF &src)
{
const QRect sr = src.toRect();
- const QRect dr = transform.mapRect(dest).toRect();
+ const QRect dr = q->state()->matrix.mapRect(dest).toRect();
if (dr.isEmpty())
return;
const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() };
@@ -1077,55 +880,107 @@ void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s,
DirectFBError("QDirectFBPaintEngine::drawPixmap()", result);
}
-void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest,
- const QPixmap &pixmap)
+static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset)
+{
+ qreal pos = rect_pos - offset;
+ while (pos > rect_pos)
+ pos -= pixmapSize;
+ while (pos + pixmapSize < rect_pos)
+ pos += pixmapSize;
+ return pos;
+}
+
+void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off)
{
+ Q_ASSERT(!dirtyClip);
+ Q_ASSERT(!(transformationType & BlitUnsupported));
+ const QTransform &transform = q->state()->matrix;
+ const QRect destinationRect = transform.mapRect(dest).toRect().normalized();
+ QRect newClip = destinationRect;
+ if (!currentClip.isEmpty())
+ newClip &= currentClip;
+
+ if (newClip.isNull())
+ return;
+
+ const DFBRegion clip = {
+ newClip.x(),
+ newClip.y(),
+ newClip.x() + newClip.width() - 1,
+ newClip.y() + newClip.height() - 1
+ };
+ surface->SetClip(surface, &clip);
+
+ QPointF offset = off;
+ Q_ASSERT(transform.type() <= QTransform::TxScale);
prepareForBlit(pixmap.hasAlphaChannel());
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- IDirectFBSurface *s = dfbData->directFBSurface();
- const QRect dr = transform.mapRect(dest).toRect();
- DFBResult result = DFB_OK;
-
- if (scale == NoScale && dr == QRect(0, 0, fbWidth, fbHeight)) {
- result = surface->TileBlit(surface, s, 0, 0, 0);
- } else if (scale == NoScale) {
- const int dx = pixmap.width();
- const int dy = pixmap.height();
- const DFBRectangle rect = { 0, 0, dx, dy };
- QVarLengthArray<DFBRectangle> rects;
- QVarLengthArray<DFBPoint> points;
-
- for (int y = dr.y(); y <= dr.bottom(); y += dy) {
- for (int x = dr.x(); x <= dr.right(); x += dx) {
- rects.append(rect);
- const DFBPoint point = { x, y };
- points.append(point);
+ dfbData->unlockDirectFB();
+ const QSize pixmapSize = dfbData->size();
+ IDirectFBSurface *sourceSurface = dfbData->directFBSurface();
+ if (transform.isScaling()) {
+ Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0);
+ offset.rx() *= transform.m11();
+ offset.ry() *= transform.m22();
+
+ const QSizeF mappedSize(pixmapSize.width() * transform.m11(), pixmapSize.height() * transform.m22());
+ qreal y = ::fixCoord(destinationRect.y(), mappedSize.height(), offset.y());
+ const qreal startX = ::fixCoord(destinationRect.x(), mappedSize.width(), offset.x());
+ while (y <= destinationRect.bottom()) {
+ qreal x = startX;
+ while (x <= destinationRect.right()) {
+ const DFBRectangle destination = { qRound(x), qRound(y), mappedSize.width(), mappedSize.height() };
+ surface->StretchBlit(surface, sourceSurface, 0, &destination);
+ x += mappedSize.width();
}
+ y += mappedSize.height();
}
- result = surface->BatchBlit(surface, s, rects.constData(),
- points.constData(), points.size());
} else {
- const QRect sr = transform.mapRect(QRect(0, 0, pixmap.width(), pixmap.height()));
- const int dx = sr.width();
- const int dy = sr.height();
- const DFBRectangle sRect = { 0, 0, dx, dy };
-
- for (int y = dr.y(); y <= dr.bottom(); y += dy) {
- for (int x = dr.x(); x <= dr.right(); x += dx) {
- const DFBRectangle dRect = { x, y, dx, dy };
- result = surface->StretchBlit(surface, s, &sRect, &dRect);
- if (result != DFB_OK) {
- y = dr.bottom() + 1;
- break;
- }
+ qreal y = ::fixCoord(destinationRect.y(), pixmapSize.height(), offset.y());
+ const qreal startX = ::fixCoord(destinationRect.x(), pixmapSize.width(), offset.x());
+ int horizontal = qMax(1, destinationRect.width() / pixmapSize.width()) + 1;
+ if (startX != destinationRect.x())
+ ++horizontal;
+ int vertical = qMax(1, destinationRect.height() / pixmapSize.height()) + 1;
+ if (y != destinationRect.y())
+ ++vertical;
+
+ const int maxCount = (vertical * horizontal);
+ QVarLengthArray<DFBRectangle, 16> sourceRects(maxCount);
+ QVarLengthArray<DFBPoint, 16> points(maxCount);
+
+ int i = 0;
+ while (y <= destinationRect.bottom()) {
+ Q_ASSERT(i < maxCount);
+ qreal x = startX;
+ while (x <= destinationRect.right()) {
+ points[i].x = qRound(x);
+ points[i].y = qRound(y);
+ sourceRects[i].x = 0;
+ sourceRects[i].y = 0;
+ sourceRects[i].w = int(pixmapSize.width());
+ sourceRects[i].h = int(pixmapSize.height());
+ x += pixmapSize.width();
+ ++i;
}
+ y += pixmapSize.height();
}
+ surface->BatchBlit(surface, sourceSurface, sourceRects.constData(), points.constData(), i);
}
- if (result != DFB_OK)
- DirectFBError("QDirectFBPaintEngine::drawTiledPixmap()", result);
+ if (currentClip.isEmpty()) {
+ surface->SetClip(surface, 0);
+ } else {
+ const DFBRegion clip = {
+ currentClip.x(),
+ currentClip.y(),
+ currentClip.x() + currentClip.width(),
+ currentClip.y() + currentClip.height()
+ };
+ surface->SetClip(surface, &clip);
+ }
}
void QDirectFBPaintEnginePrivate::updateClip()
@@ -1133,6 +988,7 @@ void QDirectFBPaintEnginePrivate::updateClip()
if (!dirtyClip)
return;
+ currentClip = QRect();
const QClipData *clipData = clip();
if (!clipData || !clipData->enabled) {
surface->SetClip(surface, NULL);
@@ -1145,6 +1001,8 @@ void QDirectFBPaintEnginePrivate::updateClip()
clipData->clipRect.y() + clipData->clipRect.height()
};
surface->SetClip(surface, &r);
+ currentClip = clipData->clipRect.normalized();
+ // ### is this guaranteed to always be normalized?
dfbHandledClip = true;
} else if (clipData->hasRegionClip && ignoreSystemClip && clipData->clipRegion == systemClip) {
dfbHandledClip = true;
@@ -1161,4 +1019,126 @@ void QDirectFBPaintEnginePrivate::systemStateChanged()
QRasterPaintEnginePrivate::systemStateChanged();
}
+IDirectFBSurface *SurfaceCache::getSurface(const uint *buf, int size)
+{
+ if (buffer == buf && bufsize == size)
+ return surface;
+
+ clear();
+
+ const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size);
+ surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface);
+ if (!surface)
+ qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface");
+
+ buffer = const_cast<uint*>(buf);
+ bufsize = size;
+
+ return surface;
+}
+
+void SurfaceCache::clear()
+{
+ if (surface && QDirectFBScreen::instance())
+ QDirectFBScreen::instance()->releaseDFBSurface(surface);
+ surface = 0;
+ buffer = 0;
+ bufsize = 0;
+}
+
+
+static inline QRect mapRect(const QTransform &transform, const QRect &rect) { return transform.mapRect(rect); }
+static inline QRect mapRect(const QTransform &transform, const QRectF &rect) { return transform.mapRect(rect).toRect(); }
+static inline QLine map(const QTransform &transform, const QLine &line) { return transform.map(line); }
+static inline QLine map(const QTransform &transform, const QLineF &line) { return transform.map(line).toLine(); }
+template <class T>
+static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface)
+{
+ if (n == 1) {
+ const QLine l = ::map(transform, lines[0]);
+ surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2());
+ } else {
+ QVarLengthArray<DFBRegion, 32> lineArray(n);
+ for (int i=0; i<n; ++i) {
+ const QLine l = ::map(transform, lines[i]);
+ lineArray[i].x1 = l.x1();
+ lineArray[i].y1 = l.y1();
+ lineArray[i].x2 = l.x2();
+ lineArray[i].y2 = l.y2();
+ }
+ surface->DrawLines(surface, lineArray.constData(), n);
+ }
+}
+
+template <class T>
+static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
+{
+ if (n == 1) {
+ const QRect r = ::mapRect(transform, rects[0]);
+ surface->FillRectangle(surface, r.x(), r.y(), r.width(), r.height());
+ } else {
+ QVarLengthArray<DFBRectangle, 32> rectArray(n);
+ for (int i=0; i<n; ++i) {
+ const QRect r = ::mapRect(transform, rects[i]);
+ rectArray[i].x = r.x();
+ rectArray[i].y = r.y();
+ rectArray[i].w = r.width();
+ rectArray[i].h = r.height();
+ }
+ surface->FillRectangles(surface, rectArray.constData(), n);
+ }
+}
+
+template <class T>
+static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
+{
+ for (int i=0; i<n; ++i) {
+ const QRect r = ::mapRect(transform, rects[i]);
+ surface->DrawRectangle(surface, r.x(), r.y(), r.width(), r.height());
+ }
+}
+
+#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+template <typename T> inline const T *ptr(const T &t) { return &t; }
+template <> inline const bool* ptr<bool>(const bool &) { return 0; }
+template <typename device, typename T1, typename T2, typename T3>
+static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
+ uint transformationType, bool simplePen,
+ bool dfbHandledClip, bool unsupportedCompositionMode,
+ const char *nameOne, const T1 &one,
+ const char *nameTwo, const T2 &two,
+ const char *nameThree, const T3 &three)
+{
+ QString out;
+ QDebug dbg(&out);
+ dbg << msg << (QByteArray(func) + "()") << "painting on";
+ if (dev->devType() == QInternal::Widget) {
+ dbg << static_cast<const QWidget*>(dev);
+ } else {
+ dbg << dev << "of type" << dev->devType();
+ }
+
+ dbg << QString("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0'))
+ << "simplePen" << simplePen
+ << "dfbHandledClip" << dfbHandledClip
+ << "unsupportedCompositionMode" << unsupportedCompositionMode;
+
+ const T1 *t1 = ptr(one);
+ const T2 *t2 = ptr(two);
+ const T3 *t3 = ptr(three);
+
+ if (t1) {
+ dbg << nameOne << *t1;
+ if (t2) {
+ dbg << nameTwo << *t2;
+ if (t3) {
+ dbg << nameThree << *t3;
+ }
+ }
+ }
+ qWarning("%s", qPrintable(out));
+}
+#endif
+
+
#endif // QT_NO_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
index 8c5877b..6148b14 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
@@ -56,43 +56,40 @@ class QDirectFBPaintEngine : public QRasterPaintEngine
Q_DECLARE_PRIVATE(QDirectFBPaintEngine)
public:
QDirectFBPaintEngine(QPaintDevice *device);
- ~QDirectFBPaintEngine();
+ virtual ~QDirectFBPaintEngine();
- bool begin(QPaintDevice *device);
- bool end();
+ virtual bool begin(QPaintDevice *device);
+ virtual bool end();
- void drawRects(const QRect *rects, int rectCount);
- void drawRects(const QRectF *rects, int rectCount);
+ virtual void drawRects(const QRect *rects, int rectCount);
+ virtual void drawRects(const QRectF *rects, int rectCount);
- void fillRect(const QRectF &r, const QBrush &brush);
- void fillRect(const QRectF &r, const QColor &color);
+ virtual void fillRect(const QRectF &r, const QBrush &brush);
+ virtual void fillRect(const QRectF &r, const QColor &color);
- void drawLines(const QLine *line, int lineCount);
- void drawLines(const QLineF *line, int lineCount);
+ virtual void drawLines(const QLine *line, int lineCount);
+ virtual void drawLines(const QLineF *line, int lineCount);
- void drawImage(const QPointF &p, const QImage &img);
- void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags falgs = Qt::AutoColor);
+ virtual void drawImage(const QPointF &p, const QImage &img);
+ virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
+ Qt::ImageConversionFlags falgs = Qt::AutoColor);
- void drawPixmap(const QPointF &p, const QPixmap &pm);
- void drawPixmap(const QRectF &r, const QPixmap &pixmap, const QRectF &sr);
- void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
+ virtual void drawPixmap(const QPointF &p, const QPixmap &pm);
+ virtual void drawPixmap(const QRectF &r, const QPixmap &pixmap, const QRectF &sr);
+ virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
- void drawColorSpans(const QSpan *spans, int count, uint color);
- void drawBufferSpan(const uint *buffer, int bufsize,
- int x, int y, int length, uint const_alpha);
+ virtual void drawBufferSpan(const uint *buffer, int bufsize,
+ int x, int y, int length, uint const_alpha);
-
- // The following methods simply lock the surface & call the base implementation
- void stroke(const QVectorPath &path, const QPen &pen);
- void drawPath(const QPainterPath &path);
- void drawPoints(const QPointF *points, int pointCount);
- void drawPoints(const QPoint *points, int pointCount);
- void drawEllipse(const QRectF &rect);
- void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
- void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
- void drawTextItem(const QPointF &p, const QTextItem &textItem);
- void fill(const QVectorPath &path, const QBrush &brush);
+ virtual void stroke(const QVectorPath &path, const QPen &pen);
+ virtual void drawPath(const QPainterPath &path);
+ virtual void drawPoints(const QPointF *points, int pointCount);
+ virtual void drawPoints(const QPoint *points, int pointCount);
+ virtual void drawEllipse(const QRectF &rect);
+ virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
+ virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
+ virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
+ virtual void fill(const QVectorPath &path, const QBrush &brush);
virtual void clipEnabledChanged();
virtual void penChanged();
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index c9d5d7c..52e85ba 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -345,6 +345,10 @@ QImage QDirectFBPixmapData::toImage() const
if (!dfbSurface)
return QImage();
+#if 0
+ // In later versions of DirectFB one can set a flag to tell
+ // DirectFB not to move the surface to videomemory. When that
+ // happens we can use this (hopefully faster) codepath
#ifndef QT_NO_DIRECTFB_PREALLOCATED
QImage ret(w, h, QDirectFBScreen::getImageFormat(dfbSurface));
if (IDirectFBSurface *imgSurface = screen->createDFBSurface(ret, QDirectFBScreen::DontTrackSurface)) {
@@ -362,6 +366,7 @@ QImage QDirectFBPixmapData::toImage() const
return ret;
}
#endif
+#endif
QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
const QImage *img = that->buffer();
@@ -385,7 +390,7 @@ QImage *QDirectFBPixmapData::buffer()
return lockedImage;
}
-QImage * QDirectFBPixmapData::buffer(uint lockFlags)
+QImage * QDirectFBPixmapData::buffer(DFBSurfaceLockFlags lockFlags)
{
lockDirectFB(lockFlags);
return lockedImage;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
index e81aef4..0204061 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
@@ -71,7 +71,7 @@ public:
virtual QImage *buffer();
virtual int metric(QPaintDevice::PaintDeviceMetric m) const {return QDirectFBPaintDevice::metric(m);}
- QImage *buffer(uint lockFlags);
+ QImage *buffer(DFBSurfaceLockFlags lockFlags);
// Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice
inline QImage::Format pixelFormat() const { return format; }
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 76064ad..0928643 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -208,7 +208,7 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size,
{
DFBSurfaceDescription desc;
memset(&desc, 0, sizeof(DFBSurfaceDescription));
- desc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH|DSDESC_HEIGHT);
+ desc.flags |= DSDESC_WIDTH|DSDESC_HEIGHT;
if (!QDirectFBScreen::initSurfaceDescriptionPixelFormat(&desc, format))
return 0;
desc.width = size.width();
@@ -226,13 +226,15 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc,
return 0;
}
- if (d_ptr->directFBFlags & VideoOnly && !(desc.flags & DSDESC_PREALLOCATED)) {
+ if (d_ptr->directFBFlags & VideoOnly
+ && !(desc.flags & DSDESC_PREALLOCATED)
+ && (!(desc.flags & DSDESC_CAPS) || !(desc.caps & DSCAPS_SYSTEMONLY))) {
// Add the video only capability. This means the surface will be created in video ram
if (!(desc.flags & DSDESC_CAPS)) {
desc.caps = DSCAPS_VIDEOONLY;
- desc.flags = DFBSurfaceDescriptionFlags(desc.flags | DSDESC_CAPS);
+ desc.flags |= DSDESC_CAPS;
} else {
- desc.caps = DFBSurfaceCapabilities(desc.caps | DSCAPS_VIDEOONLY);
+ desc.caps |= DSCAPS_VIDEOONLY;
}
result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &desc, &newSurface);
if (result != DFB_OK
@@ -247,11 +249,11 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc,
desc.preallocated[0].data, desc.preallocated[0].pitch,
DirectFBErrorString(result));
}
- desc.caps = DFBSurfaceCapabilities(desc.caps & ~DSCAPS_VIDEOONLY);
+ desc.caps &= ~DSCAPS_VIDEOONLY;
}
if (d_ptr->directFBFlags & SystemOnly)
- desc.caps = DFBSurfaceCapabilities(desc.caps | DSCAPS_SYSTEMONLY);
+ desc.caps |= DSCAPS_SYSTEMONLY;
if (!newSurface)
result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &desc, &newSurface);
@@ -459,20 +461,16 @@ DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const QImage &image
const DFBSurfacePixelFormat format = getSurfacePixelFormat(image.format());
if (format == DSPF_UNKNOWN || image.isNull()) {
- description.flags = DFBSurfaceDescriptionFlags(0);
+ description.flags = DSDESC_NONE;
return description;
}
- description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH
- | DSDESC_HEIGHT
-#ifndef QT_NO_DIRECTFB_PREALLOCATED
- | DSDESC_PREALLOCATED
-#endif
- | DSDESC_PIXELFORMAT);
+ description.flags = DSDESC_WIDTH|DSDESC_HEIGHT|DSDESC_PIXELFORMAT;
QDirectFBScreen::initSurfaceDescriptionPixelFormat(&description, image.format());
description.width = image.width();
description.height = image.height();
#ifndef QT_NO_DIRECTFB_PREALLOCATED
+ description.flags |= DSDESC_PREALLOCATED;
description.preallocated[0].data = (void*)(image.bits());
description.preallocated[0].pitch = image.bytesPerLine();
description.preallocated[1].data = 0;
@@ -491,11 +489,7 @@ DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer,
DFBSurfaceDescription description;
memset(&description, 0, sizeof(DFBSurfaceDescription));
- description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS
- | DSDESC_WIDTH
- | DSDESC_HEIGHT
- | DSDESC_PIXELFORMAT
- | DSDESC_PREALLOCATED);
+ description.flags = DSDESC_CAPS|DSDESC_WIDTH|DSDESC_HEIGHT|DSDESC_PIXELFORMAT|DSDESC_PREALLOCATED;
description.caps = DSCAPS_PREMULTIPLIED;
description.width = length;
description.height = 1;
@@ -504,8 +498,7 @@ DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer,
description.preallocated[0].pitch = length * sizeof(uint);
description.preallocated[1].data = 0;
description.preallocated[1].pitch = 0;
-
- return description;
+return description;
}
#ifndef QT_NO_DIRECTFB_PALETTE
@@ -727,19 +720,19 @@ void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args)
flipFlags = DSFLIP_NONE;
foreach(const QString &flip, flips) {
if (flip == QLatin1String("wait"))
- flipFlags = DFBSurfaceFlipFlags(flipFlags | DSFLIP_WAIT);
+ flipFlags |= DSFLIP_WAIT;
else if (flip == QLatin1String("blit"))
- flipFlags = DFBSurfaceFlipFlags(flipFlags | DSFLIP_BLIT);
+ flipFlags |= DSFLIP_BLIT;
else if (flip == QLatin1String("onsync"))
- flipFlags = DFBSurfaceFlipFlags(flipFlags | DSFLIP_ONSYNC);
+ flipFlags |= DSFLIP_ONSYNC;
else if (flip == QLatin1String("pipeline"))
- flipFlags = DFBSurfaceFlipFlags(flipFlags | DSFLIP_PIPELINE);
+ flipFlags |= DSFLIP_PIPELINE;
else
qWarning("QDirectFBScreen: Unknown flip argument: %s",
qPrintable(flip));
}
} else {
- flipFlags = DFBSurfaceFlipFlags(DSFLIP_BLIT);
+ flipFlags = DSFLIP_BLIT;
}
}
@@ -751,7 +744,12 @@ QPixmapData *QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType typ
return new QDirectFBPixmapData(type);
}
-#ifndef QT_NO_DEBUG
+#ifdef QT_NO_DEBUG
+struct FlagDescription;
+static const FlagDescription *accelerationDescriptions = 0;
+static const FlagDescription *blitDescriptions = 0;
+static const FlagDescription *drawDescriptions = 0;
+#else
struct FlagDescription {
const char *name;
uint flag;
@@ -928,13 +926,13 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
DFBSurfaceDescription description;
memset(&description, 0, sizeof(DFBSurfaceDescription));
- description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS);
+ description.flags = DSDESC_CAPS;
if (::setIntOption(displayArgs, QLatin1String("width"), &description.width))
- description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_WIDTH);
+ description.flags |= DSDESC_WIDTH;
if (::setIntOption(displayArgs, QLatin1String("height"), &description.height))
- description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_HEIGHT);
+ description.flags |= DSDESC_HEIGHT;
- uint caps = DSCAPS_PRIMARY|DSCAPS_DOUBLE;
+ description.caps = DSCAPS_PRIMARY|DSCAPS_DOUBLE;
struct {
const char *name;
const DFBSurfaceCapabilities cap;
@@ -948,14 +946,13 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
};
for (int i=0; capabilities[i].name; ++i) {
if (displayArgs.contains(QString::fromLatin1(capabilities[i].name), Qt::CaseInsensitive))
- caps |= capabilities[i].cap;
+ description.caps |= capabilities[i].cap;
}
if (displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive)) {
- caps |= DSCAPS_PREMULTIPLIED;
+ description.caps |= DSCAPS_PREMULTIPLIED;
}
- description.caps = DFBSurfaceCapabilities(caps);
// We don't track the primary surface as it's released in disconnect
d_ptr->dfbSurface = createDFBSurface(description, DontTrackSurface);
if (!d_ptr->dfbSurface) {
@@ -1213,10 +1210,10 @@ void QDirectFBScreen::compose(const QRegion &region)
DFBSurfaceBlittingFlags flags = DSBLIT_NOFX;
if (!win->isOpaque()) {
- flags = DFBSurfaceBlittingFlags(flags | DSBLIT_BLEND_ALPHACHANNEL);
+ flags |= DSBLIT_BLEND_ALPHACHANNEL;
const uint opacity = win->opacity();
if (opacity < 255) {
- flags = DFBSurfaceBlittingFlags(flags | DSBLIT_BLEND_COLORALPHA);
+ flags |= DSBLIT_BLEND_COLORALPHA;
d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface, 0xff, 0xff, 0xff, opacity);
}
}
@@ -1356,14 +1353,14 @@ bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *d
const DFBSurfacePixelFormat pixelformat = QDirectFBScreen::getSurfacePixelFormat(format);
if (pixelformat == DSPF_UNKNOWN)
return false;
- description->flags = DFBSurfaceDescriptionFlags(description->flags | DSDESC_PIXELFORMAT);
+ description->flags |= DSDESC_PIXELFORMAT;
description->pixelformat = pixelformat;
if (QDirectFBScreen::isPremultiplied(format)) {
if (!(description->flags & DSDESC_CAPS)) {
description->caps = DSCAPS_PREMULTIPLIED;
- description->flags = DFBSurfaceDescriptionFlags(description->flags | DSDESC_CAPS);
+ description->flags |= DSDESC_CAPS;
} else {
- description->caps = DFBSurfaceCapabilities(description->caps | DSCAPS_PREMULTIPLIED);
+ description->caps |= DSCAPS_PREMULTIPLIED;
}
}
return true;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 4239156..69b09e9 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -44,6 +44,7 @@
#include <QtGui/qscreen_qws.h>
#include <directfb.h>
+#include <directfb_version.h>
QT_BEGIN_HEADER
@@ -51,8 +52,24 @@ QT_MODULE(Gui)
#define Q_DIRECTFB_VERSION ((DIRECTFB_MAJOR_VERSION << 16) | (DIRECTFB_MINOR_VERION << 8) | DIRECTFB_MICRO_VERSION)
-class QDirectFBScreenPrivate;
+#include <QDebug>
+#define DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(F) \
+ static inline F operator~(F f) { return F(~int(f)); } \
+ static inline F operator&(F left, F right) { return F(int(left) & int(right)); } \
+ static inline F operator|(F left, F right) { return F(int(left) | int(right)); } \
+ static inline F &operator|=(F &left, F right) { left = (left | right); return left; } \
+ static inline F &operator&=(F &left, F right) { left = (left & right); return left; }
+
+DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBInputDeviceCapabilities);
+DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowDescriptionFlags);
+DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceDescriptionFlags);
+DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceCapabilities);
+DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceLockFlags);
+DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceBlittingFlags);
+DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceDrawingFlags);
+DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceFlipFlags);
+class QDirectFBScreenPrivate;
class Q_GUI_EXPORT QDirectFBScreen : public QScreen
{
public:
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 86ee62c..7dcf398 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -106,18 +106,16 @@ void QDirectFBWindowSurface::createWindow()
qFatal("QDirectFBWindowSurface: Unable to get primary display layer!");
DFBWindowDescription description;
- description.caps = DFBWindowCapabilities(DWCAPS_NODECORATION);
- description.flags = DFBWindowDescriptionFlags(DWDESC_CAPS
- |DWDESC_SURFACE_CAPS
- |DWDESC_PIXELFORMAT);
+ description.caps = DWCAPS_NODECORATION;
+ description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT;
description.surface_caps = DSCAPS_NONE;
if (screen->directFBFlags() & QDirectFBScreen::VideoOnly)
- description.surface_caps = DFBSurfaceCapabilities(description.surface_caps|DSCAPS_VIDEOONLY);
+ description.surface_caps |= DSCAPS_VIDEOONLY;
const QImage::Format format = screen->pixelFormat();
description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format);
if (QDirectFBScreen::isPremultiplied(format))
- description.surface_caps = DFBSurfaceCapabilities(DSCAPS_PREMULTIPLIED|description.caps);
+ description.surface_caps = DSCAPS_PREMULTIPLIED;
DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow);
if (result != DFB_OK)
@@ -370,7 +368,7 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion &region,
} else {
if (!boundingRectFlip && region.numRects() > 1) {
const QVector<QRect> rects = region.rects();
- const DFBSurfaceFlipFlags nonWaitFlags = DFBSurfaceFlipFlags(flipFlags & ~DSFLIP_WAIT);
+ const DFBSurfaceFlipFlags nonWaitFlags = flipFlags & ~DSFLIP_WAIT;
for (int i=0; i<rects.size(); ++i) {
const QRect &r = rects.at(i);
const DFBRegion dfbReg = { r.x() + offset.x(), r.y() + offset.y(),
diff --git a/src/plugins/graphicssystems/openvg/openvg.pro b/src/plugins/graphicssystems/openvg/openvg.pro
index 0abbfbd..d36570c 100644
--- a/src/plugins/graphicssystems/openvg/openvg.pro
+++ b/src/plugins/graphicssystems/openvg/openvg.pro
@@ -10,11 +10,3 @@ HEADERS = qgraphicssystem_vg_p.h
target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
INSTALLS += target
-
-!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG
-!isEmpty(QMAKE_LIBDIR_OPENVG): LIBS += -L$$QMAKE_LIBDIR_OPENVG
-!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG
-
-!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
-!isEmpty(QMAKE_LIBDIR_EGL): LIBS += -L$$QMAKE_LIBDIR_EGL
-!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
diff --git a/src/plugins/graphicssystems/shivavg/shivavg.pro b/src/plugins/graphicssystems/shivavg/shivavg.pro
index 68345af..b8ea12a 100644
--- a/src/plugins/graphicssystems/shivavg/shivavg.pro
+++ b/src/plugins/graphicssystems/shivavg/shivavg.pro
@@ -10,7 +10,3 @@ HEADERS = shivavggraphicssystem.h shivavgwindowsurface.h
target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
INSTALLS += target
-
-!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG
-!isEmpty(QMAKE_LIBDIR_OPENVG): LIBS += -L$$QMAKE_LIBDIR_OPENVG
-!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index 43e35c0..c9e04a4 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -522,6 +522,18 @@ QImage ICOReader::iconAt(int index)
ICONDIRENTRY iconEntry;
if (readIconEntry(index, &iconEntry)) {
+ static const uchar pngMagicData[] = { 137, 80, 78, 71, 13, 10, 26, 10 };
+
+ iod->seek(iconEntry.dwImageOffset);
+
+ const QByteArray pngMagic = QByteArray::fromRawData((char*)pngMagicData, sizeof(pngMagicData));
+ const bool isPngImage = (iod->read(pngMagic.size()) == pngMagic);
+
+ if (isPngImage) {
+ iod->seek(iconEntry.dwImageOffset);
+ return QImage::fromData(iod->read(iconEntry.dwBytesInRes), "png");
+ }
+
BMP_INFOHDR header;
if (readBMPHeader(iconEntry.dwImageOffset, &header)) {
icoAttrib.nbits = header.biBitCount ? header.biBitCount : iconEntry.wBitCount;
diff --git a/src/plugins/kbddrivers/kbddrivers.pro b/src/plugins/kbddrivers/kbddrivers.pro
index a34b780..dbab47b 100644
--- a/src/plugins/kbddrivers/kbddrivers.pro
+++ b/src/plugins/kbddrivers/kbddrivers.pro
@@ -1,5 +1,2 @@
TEMPLATE = subdirs
contains(kbd-plugins, linuxinput): SUBDIRS += linuxinput
-contains(kbd-plugins, sl5000): SUBDIRS += sl5000
-contains(kbd-plugins, vr41xx): SUBDIRS += vr41xx
-contains(kbd-plugins, yopy): SUBDIRS += yopy
diff --git a/src/plugins/kbddrivers/sl5000/sl5000.pro b/src/plugins/kbddrivers/sl5000/sl5000.pro
deleted file mode 100644
index e52cf0d..0000000
--- a/src/plugins/kbddrivers/sl5000/sl5000.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qsl5000kbddriver
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/kbddrivers
-target.path = $$[QT_INSTALL_PLUGINS]/kbddrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_KBD_SL5000 QT_QWS_KBD_TTY
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qkbdsl5000_qws.h \
- $$QT_SOURCE_TREE/src/gui/embedded/qkbdtty_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qkbdsl5000_qws.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qkbdtty_qws.cpp
-
diff --git a/src/plugins/kbddrivers/vr41xx/vr41xx.pro b/src/plugins/kbddrivers/vr41xx/vr41xx.pro
deleted file mode 100644
index f9f103f..0000000
--- a/src/plugins/kbddrivers/vr41xx/vr41xx.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qvr41xxkbddriver
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/kbddrivers
-target.path = $$[QT_INSTALL_PLUGINS]/kbddrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_KBD_VR41XX
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qkbdvr41xx_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qkbdvr41xx_qws.cpp
-
diff --git a/src/plugins/kbddrivers/yopy/yopy.pro b/src/plugins/kbddrivers/yopy/yopy.pro
deleted file mode 100644
index 66a663c..0000000
--- a/src/plugins/kbddrivers/yopy/yopy.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qyopykbddriver
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/kbddrivers
-target.path = $$[QT_INSTALL_PLUGINS]/kbddrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_KBD_YOPY
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qkbdyopy_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qkbdyopy_qws.cpp
-
diff --git a/src/plugins/mousedrivers/bus/bus.pro b/src/plugins/mousedrivers/bus/bus.pro
deleted file mode 100644
index cdb0332..0000000
--- a/src/plugins/mousedrivers/bus/bus.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qbusmousedriver
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/mousedrivers
-target.path = $$[QT_INSTALL_PLUGINS]/mousedrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_MOUSE_BUS
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qmousebus_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qmousebus_qws.cpp
-
diff --git a/src/plugins/mousedrivers/linuxis/linuxis.pro b/src/plugins/mousedrivers/linuxis/linuxis.pro
deleted file mode 100644
index bcc209b..0000000
--- a/src/plugins/mousedrivers/linuxis/linuxis.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TARGET = linuxismousehandler
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/mousedrivers
-target.path = $$[QT_INSTALL_PLUGINS]/mousedrivers
-INSTALLS += target
-
-HEADERS = linuxismousedriverplugin.h linuxismousehandler.h
-SOURCES = linuxismousedriverplugin.cpp linuxismousehandler.cpp
-
diff --git a/src/plugins/mousedrivers/linuxis/linuxismousedriverplugin.h b/src/plugins/mousedrivers/linuxis/linuxismousedriverplugin.h
deleted file mode 100644
index 57759c5..0000000
--- a/src/plugins/mousedrivers/linuxis/linuxismousedriverplugin.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LINUXISMOUSEDRIVERPLUGIN_H
-#define LINUXISMOUSEDRIVERPLUGIN_H
-
-#include <QtGui/QWSMouseHandlerFactoryInterface>
-
-class LinuxInputSubsystemMouseDriverPlugin : public QMouseDriverPlugin {
- Q_OBJECT
-public:
- LinuxInputSubsystemMouseDriverPlugin( QObject *parent = 0 );
- ~LinuxInputSubsystemMouseDriverPlugin();
-
- QWSMouseHandler* create(const QString& driver);
- QWSMouseHandler* create(const QString& driver, const QString& device);
- QStringList keys()const;
-};
-
-#endif // LINUXISMOUSEDRIVERPLUGIN_H
diff --git a/src/plugins/mousedrivers/linuxis/linuxismousehandler.cpp b/src/plugins/mousedrivers/linuxis/linuxismousehandler.cpp
deleted file mode 100644
index aaa6eae..0000000
--- a/src/plugins/mousedrivers/linuxis/linuxismousehandler.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "linuxismousehandler.h"
-
-#include <QFile>
-#include <QTextStream>
-#include <QScreen>
-#include <QSocketNotifier>
-#include <QDebug>
-
-#include <qdebug.h>
-
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <limits.h>
-
-#include <linux/input.h>
-
-
-#if 1
-#define qLog(x) qDebug()
-#else
-#define qLog(x) while (0) qDebug()
-#endif
-
-
-// sanity check values of the range of possible mouse positions
-#define MOUSE_SAMPLE_MIN 0
-#define MOUSE_SAMPLE_MAX 2000
-
-LinuxInputSubsystemMouseHandler::LinuxInputSubsystemMouseHandler(const QString &device)
- : mouseX(0), mouseY(0), mouseBtn(0), mouseIdx(0)
-{
- qLog(Input) << "Loaded LinuxInputSubsystem touchscreen plugin!";
- setObjectName("LinuxInputSubsystem Mouse Handler");
- mouseFd = ::open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY);
- // mouseFd = ::open(device.toLocal8Bit().constData(), O_RDONLY);
- if (mouseFd >= 0) {
- qLog(Input) << "Opened" << device << "as touchscreen input";
- m_notify = new QSocketNotifier(mouseFd, QSocketNotifier::Read, this);
- connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
- } else {
- qWarning("Cannot open %s for touchscreen input (%s)",
- device.toLocal8Bit().constData(), strerror(errno));
- return;
- }
-}
-
-LinuxInputSubsystemMouseHandler::~LinuxInputSubsystemMouseHandler()
-{
- if (mouseFd >= 0)
- ::close(mouseFd);
-}
-
-void LinuxInputSubsystemMouseHandler::suspend()
-{
- m_notify->setEnabled( false );
-}
-
-void LinuxInputSubsystemMouseHandler::resume()
-{
- m_notify->setEnabled( true );
-}
-
-void LinuxInputSubsystemMouseHandler::readMouseData()
-{
- if (!qt_screen)
- return;
-
- int n;
-
- do {
- n = read(mouseFd, mouseBuf + mouseIdx, mouseBufSize - mouseIdx);
- if (n > 0)
- mouseIdx += n;
-
- struct input_event *data;
- int idx = 0;
-
- while (mouseIdx-idx >= (int)sizeof(struct input_event)) {
- uchar *mb = mouseBuf + idx;
- data = (struct input_event *) mb;
- // qLog(Input) << "mouse event type =" << data->type << "code =" << data->code << "value =" << data->value;
- bool unknown = false;
- if (data->type == EV_ABS) {
- if (data->code == ABS_X) {
- //qLog(Input) << "\tABS_X" << data->value;
- mouseX = data->value;
- } else if (data->code == ABS_Y) {
- //qLog(Input) << "\tABS_Y" << data->value;
- mouseY = data->value;
- } else {
- unknown = true;
- }
- } else if (data->type == EV_REL) {
- //qLog(Input) << "\tEV_REL" << hex << data->code << dec << data->value;
- if (data->code == REL_X) {
- mouseX += data->value;
- } else if (data->code == REL_Y) {
- mouseY += data->value;
- } else {
- unknown = true;
- }
- } else if (data->type == EV_KEY && data->code == BTN_TOUCH) {
- qLog(Input) << "\tBTN_TOUCH" << data->value;
- mouseBtn = data->value ? Qt::LeftButton : 0;
- } else if (data->type == EV_KEY) {
- int button = 0;
- switch (data->code) {
- case BTN_LEFT: button = Qt::LeftButton; break;
- case BTN_MIDDLE: button = Qt::MidButton; break;
- case BTN_RIGHT: button = Qt::RightButton; break;
- }
- if (data->value)
- mouseBtn |= button;
- else
- mouseBtn &= ~button;
- } else if (data->type == EV_SYN && data->code == SYN_REPORT) {
- QPoint pos( mouseX, mouseY );
- oldmouse = transform( pos );
- //qLog(Input) << "\tSYN_REPORT" << mouseBtn << pos << oldmouse;
- emit mouseChanged(oldmouse, mouseBtn);
-
- } else {
- unknown = true;
- }
- if (unknown) {
- qWarning("unknown mouse event type=%x, code=%x, value=%x", data->type, data->code, data->value);
- }
- idx += sizeof(struct input_event);
- }
- int surplus = mouseIdx - idx;
- for (int i = 0; i < surplus; i++)
- mouseBuf[i] = mouseBuf[idx+i];
- mouseIdx = surplus;
- } while (n > 0);
-}
-
diff --git a/src/plugins/mousedrivers/linuxis/linuxismousehandler.h b/src/plugins/mousedrivers/linuxis/linuxismousehandler.h
deleted file mode 100644
index c898ddb..0000000
--- a/src/plugins/mousedrivers/linuxis/linuxismousehandler.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LINUXISMOUSEHANDLER_H
-#define LINUXISMOUSEHANDLER_H
-
-#include <QtGui/QWSCalibratedMouseHandler>
-
-class QSocketNotifier;
-class LinuxInputSubsystemMouseHandler : public QObject, public QWSCalibratedMouseHandler {
- Q_OBJECT
-public:
- LinuxInputSubsystemMouseHandler(const QString &device = QString("/dev/input/event0"));
- ~LinuxInputSubsystemMouseHandler();
-
- void suspend();
- void resume();
-
-private:
- int mouseX, mouseY;
- int mouseBtn;
- static const int mouseBufSize = 2048;
- uchar mouseBuf[mouseBufSize];
- int mouseIdx;
- QPoint oldmouse;
-
- QSocketNotifier *m_notify;
- int mouseFd;
-
-private Q_SLOTS:
- void readMouseData();
-};
-
-#endif // LINUXISMOUSEHANDLER_H
diff --git a/src/plugins/mousedrivers/mousedrivers.pro b/src/plugins/mousedrivers/mousedrivers.pro
index e644361..f89682b 100644
--- a/src/plugins/mousedrivers/mousedrivers.pro
+++ b/src/plugins/mousedrivers/mousedrivers.pro
@@ -1,8 +1,5 @@
TEMPLATE = subdirs
-contains(mouse-plugins, bus): SUBDIRS += bus
contains(mouse-plugins, linuxtp): SUBDIRS += linuxtp
contains(mouse-plugins, pc): SUBDIRS += pc
contains(mouse-plugins, tslib): SUBDIRS += tslib
-contains(mouse-plugins, vr41xx): SUBDIRS += vr41xx
-contains(mouse-plugins, yopy): SUBDIRS += yopy
-contains(mouse-plugins, linuxis): SUBDIRS += linuxis
+contains(mouse-plugins, linuxinput): SUBDIRS += linuxinput
diff --git a/src/plugins/mousedrivers/vr41xx/vr41xx.pro b/src/plugins/mousedrivers/vr41xx/vr41xx.pro
deleted file mode 100644
index 1c22d04..0000000
--- a/src/plugins/mousedrivers/vr41xx/vr41xx.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qvr41xxmousedriver
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/mousedrivers
-target.path = $$[QT_INSTALL_PLUGINS]/mousedrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_MOUSE_VR41XX
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qmousevr41xx_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qmousevr41xx_qws.cpp
-
diff --git a/src/plugins/mousedrivers/yopy/yopy.pro b/src/plugins/mousedrivers/yopy/yopy.pro
deleted file mode 100644
index 3045430..0000000
--- a/src/plugins/mousedrivers/yopy/yopy.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qyopymousedriver
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/mousedrivers
-target.path = $$[QT_INSTALL_PLUGINS]/mousedrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_MOUSE_YOPY
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qmouseyopy_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qmouseyopy_qws.cpp
-
diff --git a/src/qt3support/canvas/q3canvas.cpp b/src/qt3support/canvas/q3canvas.cpp
index 034aff5..948935c 100644
--- a/src/qt3support/canvas/q3canvas.cpp
+++ b/src/qt3support/canvas/q3canvas.cpp
@@ -4828,7 +4828,7 @@ void Q3CanvasText::draw(QPainter& painter)
}
/*!
- \reimp
+ \internal
*/
void Q3CanvasText::changeChunks()
{
diff --git a/src/qt3support/dialogs/q3filedialog.cpp b/src/qt3support/dialogs/q3filedialog.cpp
index 031170e..a285fd8 100644
--- a/src/qt3support/dialogs/q3filedialog.cpp
+++ b/src/qt3support/dialogs/q3filedialog.cpp
@@ -507,45 +507,7 @@ static void updateLastSize(Q3FileDialog *that)
lastHeight = that->height() - extHeight;
}
-// Don't remove the lines below!
-//
-// resolving the W methods manually is needed, because Windows 95 doesn't include
-// these methods in Shell32.lib (not even stubs!), so you'd get an unresolved symbol
-// when Qt calls getEsistingDirectory(), etc.
#if defined(Q_WS_WIN)
-
-typedef UINT (WINAPI *PtrExtractIconEx)(LPCTSTR,int,HICON*,HICON*,UINT);
-static PtrExtractIconEx ptrExtractIconEx = 0;
-
-static void resolveLibs()
-{
-#ifndef Q_OS_WINCE
- static bool triedResolve = false;
-
- if (!triedResolve) {
-#ifndef QT_NO_THREAD
- // protect initialization
- QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve));
- // check triedResolve again, since another thread may have already
- // done the initialization
- if (triedResolve) {
- // another thread did initialize the security function pointers,
- // so we shouldn't do it again.
- return;
- }
-#endif
- triedResolve = true;
- if (qt_winUnicode()) {
- QLibrary lib(QLatin1String("shell32"));
- ptrExtractIconEx = (PtrExtractIconEx) lib.resolve("ExtractIconExW");
- }
- }
-#endif
-}
-#ifdef Q_OS_WINCE
-#define PtrExtractIconEx ExtractIconEx
-#endif
-
class QWindowsIconProvider : public Q3FileIconProvider
{
public:
@@ -2566,11 +2528,7 @@ void Q3FileDialog::init()
d->modeButtons->insert(d->previewInfo);
d->previewContents = new QToolButton(this, "preview info view");
-#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
- if ((qWinVersion() & Qt::WV_NT_based) > Qt::WV_NT)
-#else
if (!qstrcmp(style()->className(), "QWindowsStyle"))
-#endif
{
d->goBack->setAutoRaise(true);
d->cdToParent->setAutoRaise(true);
@@ -4878,33 +4836,20 @@ Q3FileIconProvider * Q3FileDialog::iconProvider()
static QString getWindowsRegString(HKEY key, const QString &subKey)
{
QString s;
- QT_WA({
- char buf[1024];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueEx(key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)buf, &bsz);
- if (r == ERROR_SUCCESS) {
- s = QString::fromUcs2((unsigned short *)buf);
- } else if (r == ERROR_MORE_DATA) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueEx(key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)ptr, &bsz);
- if (r == ERROR_SUCCESS)
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- } , {
- char buf[512];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueExA(key, subKey.local8Bit(), 0, 0, (LPBYTE)buf, &bsz);
- if (r == ERROR_SUCCESS) {
- s = QLatin1String(buf);
- } else if (r == ERROR_MORE_DATA) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueExA(key, subKey.local8Bit(), 0, 0, (LPBYTE)ptr, &bsz);
- if (r == ERROR_SUCCESS)
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- });
+
+ wchar_t buf[1024];
+ DWORD bsz = sizeof(buf) / sizeof(wchar_t);
+ int r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)buf, &bsz);
+ if (r == ERROR_SUCCESS) {
+ s = QString::fromWCharArray(buf);
+ } else if (r == ERROR_MORE_DATA) {
+ char *ptr = new char[bsz+1];
+ r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)ptr, &bsz);
+ if (r == ERROR_SUCCESS)
+ s = QLatin1String(ptr);
+ delete [] ptr;
+ }
+
return s;
}
@@ -4925,22 +4870,13 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name)
HKEY k;
HICON si;
- int r;
QString s;
UINT res = 0;
// ---------- get default folder pixmap
const wchar_t iconFolder[] = L"folder\\DefaultIcon"; // workaround for Borland
- QT_WA({
- r = RegOpenKeyEx(HKEY_CLASSES_ROOT,
- iconFolder,
- 0, KEY_READ, &k);
- } , {
- r = RegOpenKeyExA(HKEY_CLASSES_ROOT,
- "folder\\DefaultIcon",
- 0, KEY_READ, &k);
- });
- resolveLibs();
+ int r = RegOpenKeyEx(HKEY_CLASSES_ROOT, iconFolder, 0, KEY_READ, &k);
+
if (r == ERROR_SUCCESS) {
s = getWindowsRegString(k, QString());
RegCloseKey(k);
@@ -4948,21 +4884,7 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name)
QStringList lst = QStringList::split(QLatin1String(","), s);
if (lst.count() >= 2) { // don't just assume that lst has two entries
-#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx((TCHAR*)lst[0].simplifyWhiteSpace().ucs2(),
- lst[1].simplifyWhiteSpace().toInt(),
- 0, &si, 1);
- } , {
- res = ExtractIconExA(lst[0].simplifyWhiteSpace().local8Bit(),
- lst[1].simplifyWhiteSpace().toInt(),
- 0, &si, 1);
- });
-#else
- res = (UINT)ExtractIconEx((TCHAR*)lst[0].simplifyWhiteSpace().ucs2(),
- lst[1].simplifyWhiteSpace().toInt(),
- 0, &si, 1);
-#endif
+ res = ExtractIconEx((wchar_t*)lst[0].simplifyWhiteSpace().utf16(), lst[1].simplifyWhiteSpace().toInt(), 0, &si, 1);
}
if (res) {
@@ -4978,18 +4900,7 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name)
}
//------------------------------- get default file pixmap
-#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx(L"shell32.dll",
- 0, 0, &si, 1);
- } , {
- res = ExtractIconExA("shell32.dll",
- 0, 0, &si, 1);
- });
-#else
- res = (UINT)ExtractIconEx(L"shell32.dll",
- 0, 0, &si, 1);
-#endif
+ res = ExtractIconEx(L"shell32.dll", 0, 0, &si, 1);
if (res) {
defaultFile = fromHICON(si);
@@ -5002,16 +4913,9 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name)
//------------------------------- get default exe pixmap
#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx(L"shell32.dll",
- 2, 0, &si, 1);
- } , {
- res = ExtractIconExA("shell32.dll",
- 2, 0, &si, 1);
- });
+ res = ExtractIconEx(L"shell32.dll", 2, 0, &si, 1);
#else
- res = (UINT)ExtractIconEx(L"ceshell.dll",
- 10, 0, &si, 1);
+ res = ExtractIconEx(L"ceshell.dll", 10, 0, &si, 1);
#endif
if (res) {
@@ -5050,14 +4954,7 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi)
return &(*it);
HKEY k, k2;
- int r;
- QT_WA({
- r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (TCHAR*)ext.ucs2(),
- 0, KEY_READ, &k);
- } , {
- r = RegOpenKeyExA(HKEY_CLASSES_ROOT, ext.local8Bit(),
- 0, KEY_READ, &k);
- });
+ int r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (wchar_t*)ext.utf16(), 0, KEY_READ, &k);
QString s;
if (r == ERROR_SUCCESS) {
s = getWindowsRegString(k, QString());
@@ -5068,13 +4965,8 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi)
}
RegCloseKey(k);
- QT_WA({
- r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (TCHAR*)QString(s + QLatin1String("\\DefaultIcon")).ucs2(),
- 0, KEY_READ, &k2);
- } , {
- r = RegOpenKeyExA(HKEY_CLASSES_ROOT, QString(s + QLatin1String("\\DefaultIcon")).local8Bit() ,
- 0, KEY_READ, &k2);
- });
+ r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (wchar_t*)QString(s + QLatin1String("\\DefaultIcon")).utf16(),
+ 0, KEY_READ, &k2);
if (r == ERROR_SUCCESS) {
s = getWindowsRegString(k2, QString());
} else {
@@ -5104,19 +4996,7 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi)
if (filepath[0] == QLatin1Char('"') && filepath[(int)filepath.length()-1] == QLatin1Char('"'))
filepath = filepath.mid(1, filepath.length()-2);
- resolveLibs();
-#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx((TCHAR*)filepath.ucs2(), lst[1].stripWhiteSpace().toInt(),
- 0, &si, 1);
- } , {
- res = ExtractIconExA(filepath.local8Bit(), lst[1].stripWhiteSpace().toInt(),
- 0, &si, 1);
- });
-#else
- res = (UINT)ExtractIconEx((TCHAR*)filepath.ucs2(), lst[1].stripWhiteSpace().toInt(),
- 0, &si, 1);
-#endif
+ res = ExtractIconEx((wchar_t*)filepath.utf16(), lst[1].stripWhiteSpace().toInt(), 0, &si, 1);
}
}
if (res) {
@@ -5133,32 +5013,9 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi)
HICON si;
UINT res = 0;
if (!fi.absFilePath().isEmpty()) {
-#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), -1,
- 0, 0, 1);
- } , {
- res = ExtractIconExA(fi.absFilePath().local8Bit(), -1,
- 0, 0, 1);
- });
-
- if (res) {
- QT_WA({
- res = ptrExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), res - 1,
- 0, &si, 1);
- } , {
- res = ExtractIconExA(fi.absFilePath().local8Bit(), res - 1,
- 0, &si, 1);
- });
- }
-#else
- res = (UINT)ExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), -1,
- 0, 0, 1);
- if (res)
- res = (UINT)ExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), res - 1,
- 0, &si, 1);
-#endif
-
+ res = ExtractIconEx((wchar_t*)fi.absFilePath().utf16(), -1, 0, 0, 1);
+ if (res)
+ res = ExtractIconEx((wchar_t*)fi.absFilePath().utf16(), res - 1, 0, &si, 1);
}
if (res) {
@@ -5760,13 +5617,8 @@ void Q3FileDialog::insertEntry(const Q3ValueList<QUrlInfo> &lst, Q3NetworkOperat
if (!file.endsWith(QLatin1Char('/')))
file.append(QLatin1Char('/'));
file += inf.name();
- QT_WA({
- if (GetFileAttributesW((TCHAR*)file.ucs2()) & FILE_ATTRIBUTE_HIDDEN)
- continue;
- } , {
- if (GetFileAttributesA(file.local8Bit()) & FILE_ATTRIBUTE_HIDDEN)
- continue;
- });
+ if (GetFileAttributes((wchar_t*)file.utf16()) & FILE_ATTRIBUTE_HIDDEN)
+ continue;
} else {
if (inf.name() != QLatin1String("..") && inf.name()[0] == QLatin1Char('.'))
continue;
diff --git a/src/qt3support/dialogs/q3filedialog_win.cpp b/src/qt3support/dialogs/q3filedialog_win.cpp
index ed86fa2..487097a 100644
--- a/src/qt3support/dialogs/q3filedialog_win.cpp
+++ b/src/qt3support/dialogs/q3filedialog_win.cpp
@@ -64,49 +64,6 @@
QT_BEGIN_NAMESPACE
-// Don't remove the lines below!
-//
-// resolving the W methods manually is needed, because Windows 95 doesn't include
-// these methods in Shell32.lib (not even stubs!), so you'd get an unresolved symbol
-// when Qt calls getEsistingDirectory(), etc.
-typedef LPITEMIDLIST (WINAPI *PtrSHBrowseForFolder)(BROWSEINFO*);
-static PtrSHBrowseForFolder ptrSHBrowseForFolder = 0;
-typedef BOOL (WINAPI *PtrSHGetPathFromIDList)(LPITEMIDLIST,LPWSTR);
-static PtrSHGetPathFromIDList ptrSHGetPathFromIDList = 0;
-
-static void resolveLibs()
-{
-#ifndef Q_OS_WINCE
- static bool triedResolve = false;
-
- if (!triedResolve) {
-#ifndef QT_NO_THREAD
- // protect initialization
- QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve));
- // check triedResolve again, since another thread may have already
- // done the initialization
- if (triedResolve) {
- // another thread did initialize the security function pointers,
- // so we shouldn't do it again.
- return;
- }
-#endif
-
- triedResolve = true;
- if (qt_winUnicode()) {
- QLibrary lib(QLatin1String("shell32"));
- ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW");
- ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW");
- }
- }
-#endif
-}
-#ifdef Q_OS_WINCE
-#define PtrSHBrowseForFolder SHBrowseForFolder ;
-#define PtrSHGetPathFromIDList SHGetPathFromIDList;
-#endif
-
-
extern const char qt3_file_dialog_filter_reg_exp[]; // defined in qfiledialog.cpp
const int maxNameLen = 1023;
@@ -168,80 +125,8 @@ static QString selFilter(const QString& filter, DWORD idx)
return filterLst[(int)idx - 1];
}
-#ifndef Q_OS_WINCE
-// Static vars for OFNA funcs:
-static QByteArray aInitDir;
-static QByteArray aInitSel;
-static QByteArray aTitle;
-static QByteArray aFilter;
-// Use ANSI strings and API
-
-// If you change this, then make sure you change makeOFN (below) too
-static
-OPENFILENAMEA* makeOFNA(QWidget* parent,
- const QString& initialSelection,
- const QString& initialDirectory,
- const QString& title,
- const QString& filters,
- Q3FileDialog::Mode mode)
-{
- if (parent)
- parent = parent->window();
- else
- parent = qApp->activeWindow();
-
- aTitle = title.local8Bit();
- aInitDir = QDir::toNativeSeparators(initialDirectory).local8Bit();
- if (initialSelection.isEmpty())
- aInitSel = "";
- else
- aInitSel = QDir::toNativeSeparators(initialSelection).local8Bit();
- int maxLen = mode == Q3FileDialog::ExistingFiles ? maxMultiLen : maxNameLen;
- aInitSel.resize(maxLen + 1); // make room for return value
- aFilter = filters.local8Bit();
-
- OPENFILENAMEA* ofn = new OPENFILENAMEA;
- memset(ofn, 0, sizeof(OPENFILENAMEA));
-
-#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500)
- // according to the MSDN, this should also be necessary for MSVC, but
- // OPENFILENAME_SIZE_VERSION_400A is in not Microsoft header, as it seems
- if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) {
- ofn->lStructSize= OPENFILENAME_SIZE_VERSION_400A;
- } else {
- ofn->lStructSize= sizeof(OPENFILENAMEA);
- }
-#else
- ofn->lStructSize = sizeof(OPENFILENAMEA);
-#endif
- ofn->hwndOwner = parent ? parent->winId() : 0;
- ofn->lpstrFilter = aFilter;
- ofn->lpstrFile = aInitSel.data();
- ofn->nMaxFile = maxLen;
- ofn->lpstrInitialDir = aInitDir.data();
- ofn->lpstrTitle = aTitle.data();
- ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY);
-
- if (mode == Q3FileDialog::ExistingFile ||
- mode == Q3FileDialog::ExistingFiles)
- ofn->Flags |= (OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST);
- if (mode == Q3FileDialog::ExistingFiles)
- ofn->Flags |= (OFN_ALLOWMULTISELECT | OFN_EXPLORER);
-
- return ofn;
-}
-
-static void cleanUpOFNA(OPENFILENAMEA** ofn)
-{
- delete *ofn;
- *ofn = 0;
-}
-#endif
-
static QString tFilters, tTitle, tInitDir;
-#ifdef UNICODE
-// If you change this, then make sure you change makeOFNA (above) too
static
OPENFILENAME* makeOFN(QWidget* parent,
const QString& initialSelection,
@@ -261,33 +146,23 @@ OPENFILENAME* makeOFN(QWidget* parent,
QString initSel = QDir::toNativeSeparators(initialSelection);
int maxLen = mode == Q3FileDialog::ExistingFiles ? maxMultiLen : maxNameLen;
- TCHAR *tInitSel = new TCHAR[maxLen+1];
+ wchar_t *tInitSel = new wchar_t[maxLen+1];
if (initSel.length() > 0 && initSel.length() <= maxLen)
- memcpy(tInitSel, initSel.ucs2(), (initSel.length()+1)*sizeof(QChar));
+ memcpy(tInitSel, initSel.utf16(), (initSel.length() + 1) * sizeof(wchar_t));
else
tInitSel[0] = 0;
OPENFILENAME* ofn = new OPENFILENAME;
memset(ofn, 0, sizeof(OPENFILENAME));
-#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500)
- // according to the MSDN, this should also be necessary for MSVC, but
- // OPENFILENAME_SIZE_VERSION_400 is in not Microsoft header, as it seems
- if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) {
- ofn->lStructSize= OPENFILENAME_SIZE_VERSION_400;
- } else {
- ofn->lStructSize = sizeof(OPENFILENAME);
- }
-#else
- ofn->lStructSize = sizeof(OPENFILENAME);
-#endif
- ofn->hwndOwner = parent ? parent->winId() : 0;
- ofn->lpstrFilter = (TCHAR *)tFilters.ucs2();
- ofn->lpstrFile = tInitSel;
+ ofn->lStructSize = sizeof(OPENFILENAME);
+ ofn->hwndOwner = parent ? parent->winId() : 0;
+ ofn->lpstrFilter = (wchar_t*)tFilters.utf16();
+ ofn->lpstrFile = tInitSel;
ofn->nMaxFile = maxLen;
- ofn->lpstrInitialDir = (TCHAR *)tInitDir.ucs2();
- ofn->lpstrTitle = (TCHAR *)tTitle.ucs2();
- ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY);
+ ofn->lpstrInitialDir = (wchar_t*)tInitDir.utf16();
+ ofn->lpstrTitle = (wchar_t*)tTitle.utf16();
+ ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY);
if (mode == Q3FileDialog::ExistingFile ||
mode == Q3FileDialog::ExistingFiles)
@@ -298,7 +173,6 @@ OPENFILENAME* makeOFN(QWidget* parent,
return ofn;
}
-
static void cleanUpOFN(OPENFILENAME** ofn)
{
delete (*ofn)->lpstrFile;
@@ -306,8 +180,6 @@ static void cleanUpOFN(OPENFILENAME** ofn)
*ofn = 0;
}
-#endif // UNICODE
-
QString Q3FileDialog::winGetOpenFileName(const QString &initialSelection,
const QString &filter,
QString* initialDirectory,
@@ -349,31 +221,18 @@ QString Q3FileDialog::winGetOpenFileName(const QString &initialSelection,
QApplication::sendEvent(parent, &e);
QApplicationPrivate::enterModal(parent);
}
- QT_WA({
- // Use Unicode strings and API
- OPENFILENAME* ofn = makeOFN(parent, isel,
- *initialDirectory, title,
- winFilter(filter), ExistingFile);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileName(ofn)) {
- result = QString::fromUcs2((ushort*)ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- cleanUpOFN(&ofn);
- } , {
- // Use ANSI strings and API
- OPENFILENAMEA* ofn = makeOFNA(parent, isel,
- *initialDirectory, title,
- winFilter(filter), ExistingFile);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileNameA(ofn)) {
- result = QString::fromLocal8Bit(ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- cleanUpOFNA(&ofn);
- });
+
+ OPENFILENAME* ofn = makeOFN(parent, isel,
+ *initialDirectory, title,
+ winFilter(filter), ExistingFile);
+ if (idx)
+ ofn->nFilterIndex = idx + 1;
+ if (GetOpenFileName(ofn)) {
+ result = QString::fromWCharArray(ofn->lpstrFile);
+ selFilIdx = ofn->nFilterIndex;
+ }
+ cleanUpOFN(&ofn);
+
if (parent) {
QApplicationPrivate::leaveModal(parent);
QEvent e(QEvent::WindowUnblocked);
@@ -433,31 +292,18 @@ QString Q3FileDialog::winGetSaveFileName(const QString &initialSelection,
QApplication::sendEvent(parent, &e);
QApplicationPrivate::enterModal(parent);
}
- QT_WA({
- // Use Unicode strings and API
- OPENFILENAME* ofn = makeOFN(parent, isel,
- *initialDirectory, title,
- winFilter(filter), AnyFile);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetSaveFileName(ofn)) {
- result = QString::fromUcs2((ushort*)ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- cleanUpOFN(&ofn);
- } , {
- // Use ANSI strings and API
- OPENFILENAMEA* ofn = makeOFNA(parent, isel,
- *initialDirectory, title,
- winFilter(filter), AnyFile);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetSaveFileNameA(ofn)) {
- result = QString::fromLocal8Bit(ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- cleanUpOFNA(&ofn);
- });
+
+ OPENFILENAME* ofn = makeOFN(parent, isel,
+ *initialDirectory, title,
+ winFilter(filter), AnyFile);
+ if (idx)
+ ofn->nFilterIndex = idx + 1;
+ if (GetSaveFileName(ofn)) {
+ result = QString::fromWCharArray(ofn->lpstrFile);
+ selFilIdx = ofn->nFilterIndex;
+ }
+ cleanUpOFN(&ofn);
+
if (parent) {
QApplicationPrivate::leaveModal(parent);
QEvent e(QEvent::WindowUnblocked);
@@ -519,69 +365,38 @@ QStringList Q3FileDialog::winGetOpenFileNames(const QString &filter,
QApplication::sendEvent(parent, &e);
QApplicationPrivate::enterModal(parent);
}
- QT_WA({
- OPENFILENAME* ofn = makeOFN(parent, isel,
- *initialDirectory, title,
- winFilter(filter), ExistingFiles);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileName(ofn)) {
- QString fileOrDir = QString::fromUcs2((ushort*)ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- int offset = fileOrDir.length() + 1;
- if (ofn->lpstrFile[offset] == 0) {
- // Only one file selected; has full path
- fi.setFile(fileOrDir);
- QString res = fi.absFilePath();
- if (!res.isEmpty())
- result.append(res);
- }
- else {
- // Several files selected; first string is path
- dir.setPath(fileOrDir);
- QString f;
- while(!(f = QString::fromUcs2((ushort*)ofn->lpstrFile+offset)).isEmpty()) {
- fi.setFile(dir, f);
- QString res = fi.absFilePath();
- if (!res.isEmpty())
- result.append(res);
- offset += f.length() + 1;
- }
- }
+
+ OPENFILENAME* ofn = makeOFN(parent, isel,
+ *initialDirectory, title,
+ winFilter(filter), ExistingFiles);
+ if (idx)
+ ofn->nFilterIndex = idx + 1;
+ if (GetOpenFileName(ofn)) {
+ QString fileOrDir = QString::fromWCharArray(ofn->lpstrFile);
+ selFilIdx = ofn->nFilterIndex;
+ int offset = fileOrDir.length() + 1;
+ if (ofn->lpstrFile[offset] == 0) {
+ // Only one file selected; has full path
+ fi.setFile(fileOrDir);
+ QString res = fi.absFilePath();
+ if (!res.isEmpty())
+ result.append(res);
}
- cleanUpOFN(&ofn);
- } , {
- OPENFILENAMEA* ofn = makeOFNA(parent, isel,
- *initialDirectory, title,
- winFilter(filter), ExistingFiles);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileNameA(ofn)) {
- QByteArray fileOrDir(ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- int offset = fileOrDir.length() + 1;
- if (ofn->lpstrFile[offset] == '\0') {
- // Only one file selected; has full path
- fi.setFile(QString::fromLocal8Bit(fileOrDir));
+ else {
+ // Several files selected; first string is path
+ dir.setPath(fileOrDir);
+ QString f;
+ while (!(f = QString::fromWCharArray(ofn->lpstrFile + offset)).isEmpty()) {
+ fi.setFile(dir, f);
QString res = fi.absFilePath();
if (!res.isEmpty())
result.append(res);
+ offset += f.length() + 1;
}
- else {
- // Several files selected; first string is path
- dir.setPath(QString::fromLocal8Bit(fileOrDir));
- QByteArray f;
- while(!(f = QByteArray(ofn->lpstrFile + offset)).isEmpty()) {
- fi.setFile(dir, QString::fromLocal8Bit(f));
- QString res = fi.absFilePath();
- if (!res.isEmpty())
- result.append(res);
- offset += f.length() + 1;
- }
- }
- cleanUpOFNA(&ofn);
}
- });
+ }
+ cleanUpOFN(&ofn);
+
if (parent) {
QApplicationPrivate::leaveModal(parent);
QEvent e(QEvent::WindowUnblocked);
@@ -607,34 +422,17 @@ static int __stdcall winGetExistDirCallbackProc(HWND hwnd,
if (uMsg == BFFM_INITIALIZED && lpData != 0) {
QString *initDir = (QString *)(lpData);
if (!initDir->isEmpty()) {
- // ### Lars asks: is this correct for the A version????
- QT_WA({
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG(initDir->ucs2()));
- } , {
- SendMessageA(hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG(initDir->ucs2()));
- });
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG(initDir->utf16()));
}
} else if (uMsg == BFFM_SELCHANGED) {
- QT_WA({
- resolveLibs();
- TCHAR path[MAX_PATH];
- ptrSHGetPathFromIDList(LPITEMIDLIST(lParam), path);
- QString tmpStr = QString::fromUcs2((ushort*)path);
- if (!tmpStr.isEmpty())
- SendMessage(hwnd, BFFM_ENABLEOK, 1, 1);
- else
- SendMessage(hwnd, BFFM_ENABLEOK, 0, 0);
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG(path));
- } , {
- char path[MAX_PATH];
- SHGetPathFromIDListA(LPITEMIDLIST(lParam), path);
- QString tmpStr = QString::fromLocal8Bit(path);
- if (!tmpStr.isEmpty())
- SendMessageA(hwnd, BFFM_ENABLEOK, 1, 1);
- else
- SendMessageA(hwnd, BFFM_ENABLEOK, 0, 0);
- SendMessageA(hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG(path));
- });
+ wchar_t path[MAX_PATH];
+ SHGetPathFromIDList(LPITEMIDLIST(lParam), path);
+ QString tmpStr = QString::fromWCharArray(path);
+ if (!tmpStr.isEmpty())
+ SendMessage(hwnd, BFFM_ENABLEOK, 1, 1);
+ else
+ SendMessage(hwnd, BFFM_ENABLEOK, 0, 0);
+ SendMessage(hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG(path));
}
#endif
return 0;
@@ -666,76 +464,42 @@ QString Q3FileDialog::winGetExistingDirectory(const QString& initialDirectory,
QApplication::sendEvent(parent, &e);
QApplicationPrivate::enterModal(parent);
}
- QT_WA({
- resolveLibs();
- QString initDir = QDir::toNativeSeparators(initialDirectory);
- TCHAR path[MAX_PATH];
- TCHAR initPath[MAX_PATH];
- initPath[0] = 0;
- path[0] = 0;
- tTitle = title;
- BROWSEINFO bi;
- bi.hwndOwner = (parent ? parent->winId() : 0);
- bi.pidlRoot = NULL;
- bi.lpszTitle = (TCHAR*)tTitle.ucs2();
- bi.pszDisplayName = initPath;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
- bi.lpfn = winGetExistDirCallbackProc;
- bi.lParam = Q_ULONG(&initDir);
- LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder(&bi);
- if (pItemIDList) {
- ptrSHGetPathFromIDList(pItemIDList, path);
- IMalloc *pMalloc;
- if (SHGetMalloc(&pMalloc) != NOERROR)
- result.clear();
- else {
- pMalloc->Free(pItemIDList);
- pMalloc->Release();
- result = QString::fromUcs2((ushort*)path);
- }
- } else
- result.clear();
- tTitle.clear();
- } , {
- QString initDir = QDir::toNativeSeparators(initialDirectory);
- char path[MAX_PATH];
- char initPath[MAX_PATH];
- QByteArray ctitle = title.toLocal8Bit();
- initPath[0]=0;
- path[0]=0;
- BROWSEINFOA bi;
- bi.hwndOwner = (parent ? parent->winId() : 0);
- bi.pidlRoot = NULL;
- bi.lpszTitle = ctitle;
- bi.pszDisplayName = initPath;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
- bi.lpfn = winGetExistDirCallbackProc;
- bi.lParam = Q_ULONG(&initDir);
- LPITEMIDLIST pItemIDList = SHBrowseForFolderA(&bi);
- if (pItemIDList) {
- SHGetPathFromIDListA(pItemIDList, path);
- IMalloc *pMalloc;
- if (SHGetMalloc(&pMalloc) != NOERROR)
- result.clear();
- else {
- pMalloc->Free(pItemIDList);
- pMalloc->Release();
- result = QString::fromLocal8Bit(path);
- }
- } else
+
+ QString initDir = QDir::toNativeSeparators(initialDirectory);
+ wchar_t path[MAX_PATH];
+ wchar_t initPath[MAX_PATH];
+ initPath[0] = 0;
+ path[0] = 0;
+ tTitle = title;
+ BROWSEINFO bi;
+ bi.hwndOwner = (parent ? parent->winId() : 0);
+ bi.pidlRoot = NULL;
+ bi.lpszTitle = (wchar_t*)tTitle.utf16();
+ bi.pszDisplayName = initPath;
+ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
+ bi.lpfn = winGetExistDirCallbackProc;
+ bi.lParam = Q_ULONG(&initDir);
+ LPITEMIDLIST pItemIDList = SHBrowseForFolder(&bi);
+ if (pItemIDList) {
+ SHGetPathFromIDList(pItemIDList, path);
+ IMalloc *pMalloc;
+ if (SHGetMalloc(&pMalloc) != NOERROR)
result.clear();
- });
+ else {
+ pMalloc->Free(pItemIDList);
+ pMalloc->Release();
+ result = QString::fromWCharArray(path);
+ }
+ } else
+ result.clear();
+ tTitle.clear();
+
if (parent) {
QApplicationPrivate::leaveModal(parent);
QEvent e(QEvent::WindowUnblocked);
QApplication::sendEvent(parent, &e);
}
- // Due to a bug on Windows Me, we need to reset the current
- // directory
- if ((qWinVersion() == Qt::WV_98 || qWinVersion() == Qt::WV_Me) && QDir::currentDirPath() != currentDir)
- QDir::setCurrent(currentDir);
-
if (!result.isEmpty())
result.replace(QLatin1Char('\\'), QLatin1Char('/'));
return result;
diff --git a/src/qt3support/dialogs/q3tabdialog.cpp b/src/qt3support/dialogs/q3tabdialog.cpp
index 50dbd48..a65affc 100644
--- a/src/qt3support/dialogs/q3tabdialog.cpp
+++ b/src/qt3support/dialogs/q3tabdialog.cpp
@@ -1038,7 +1038,7 @@ QString Q3TabDialog::tabLabel(QWidget * w)
}
-/*! \reimp
+/*! \internal
*/
void Q3TabDialog::styleChange(QStyle& s)
{
diff --git a/src/qt3support/itemviews/q3table.cpp b/src/qt3support/itemviews/q3table.cpp
index 8e6c570..9d1ae97 100644
--- a/src/qt3support/itemviews/q3table.cpp
+++ b/src/qt3support/itemviews/q3table.cpp
@@ -6412,7 +6412,7 @@ void Q3Table::startDrag()
#endif
-/*! \reimp */
+/*! \internal */
void Q3Table::windowActivationChange(bool oldActive)
{
if (oldActive && autoScrollTimer)
diff --git a/src/qt3support/network/q3dns.cpp b/src/qt3support/network/q3dns.cpp
index b80b76b..6d514c1 100644
--- a/src/qt3support/network/q3dns.cpp
+++ b/src/qt3support/network/q3dns.cpp
@@ -2242,53 +2242,31 @@ typedef struct {
typedef DWORD (WINAPI *GNP)( PFIXED_INFO, PULONG );
// ### FIXME: this code is duplicated in qfiledialog.cpp
-static QString getWindowsRegString( HKEY key, const QString &subKey )
+static QString getWindowsRegString(HKEY key, const QString &subKey)
{
QString s;
- QT_WA( {
- char buf[1024];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueEx( key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)buf, &bsz );
- if ( r == ERROR_SUCCESS ) {
- s = QString::fromUcs2( (unsigned short *)buf );
- } else if ( r == ERROR_MORE_DATA ) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueEx( key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)ptr, &bsz );
- if ( r == ERROR_SUCCESS )
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- } , {
- char buf[512];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueExA( key, subKey.local8Bit(), 0, 0, (LPBYTE)buf, &bsz );
- if ( r == ERROR_SUCCESS ) {
- s = QLatin1String(buf);
- } else if ( r == ERROR_MORE_DATA ) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueExA( key, subKey.local8Bit(), 0, 0, (LPBYTE)ptr, &bsz );
- if ( r == ERROR_SUCCESS )
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- } );
+
+ wchar_t buf[1024];
+ DWORD bsz = sizeof(buf) / sizeof(wchar_t);
+ int r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)buf, &bsz);
+ if (r == ERROR_SUCCESS) {
+ s = QString::fromWCharArray(buf);
+ } else if (r == ERROR_MORE_DATA) {
+ char *ptr = new char[bsz+1];
+ r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)ptr, &bsz);
+ if (r == ERROR_SUCCESS)
+ s = QLatin1String(ptr);
+ delete [] ptr;
+ }
+
return s;
}
static bool getDnsParamsFromRegistry( const QString &path,
- QString *domainName, QString *nameServer, QString *searchList )
+ QString *domainName, QString *nameServer, QString *searchList )
{
HKEY k;
- int r;
- QT_WA( {
- r = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
- (TCHAR*)path.ucs2(),
- 0, KEY_READ, &k );
- } , {
- r = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
- path.latin1(),
- 0, KEY_READ, &k );
- } );
+ int r = RegOpenKeyEx( HKEY_LOCAL_MACHINE, (wchar_t*)path.utf16(), 0, KEY_READ, &k );
if ( r == ERROR_SUCCESS ) {
*domainName = getWindowsRegString( k, QLatin1String("DhcpDomain") );
@@ -2321,14 +2299,10 @@ void Q3Dns::doResInit()
bool gotNetworkParams = false;
// try the API call GetNetworkParams() first and use registry lookup only
// as a fallback
-#ifdef Q_OS_WINCE
- HINSTANCE hinstLib = LoadLibraryW( L"iphlpapi" );
-#else
- HINSTANCE hinstLib = LoadLibraryA( "iphlpapi" );
-#endif
+ HINSTANCE hinstLib = LoadLibrary( L"iphlpapi" );
if ( hinstLib != 0 ) {
#ifdef Q_OS_WINCE
- GNP getNetworkParams = (GNP) GetProcAddressW( hinstLib, L"GetNetworkParams" );
+ GNP getNetworkParams = (GNP) GetProcAddress( hinstLib, L"GetNetworkParams" );
#else
GNP getNetworkParams = (GNP) GetProcAddress( hinstLib, "GetNetworkParams" );
#endif
@@ -2362,13 +2336,7 @@ void Q3Dns::doResInit()
if ( getDnsParamsFromRegistry(
QLatin1String("System\\CurrentControlSet\\Services\\Tcpip\\Parameters"),
&domainName, &nameServer, &searchList )) {
- // for NT
separator = ' ';
- } else if ( getDnsParamsFromRegistry(
- QLatin1String("System\\CurrentControlSet\\Services\\VxD\\MSTCP"),
- &domainName, &nameServer, &searchList )) {
- // for Windows 98
- separator = ',';
} else {
// Could not access the TCP/IP parameters
domainName = QLatin1String("");
diff --git a/src/qt3support/network/q3http.cpp b/src/qt3support/network/q3http.cpp
index 59adc27..dba4e88 100644
--- a/src/qt3support/network/q3http.cpp
+++ b/src/qt3support/network/q3http.cpp
@@ -785,7 +785,7 @@ int Q3HttpResponseHeader::minorVersion() const
return minVer;
}
-/*! \reimp
+/*! \internal
*/
bool Q3HttpResponseHeader::parseLine( const QString& line, int number )
{
@@ -952,7 +952,7 @@ int Q3HttpRequestHeader::minorVersion() const
return minVer;
}
-/*! \reimp
+/*! \internal
*/
bool Q3HttpRequestHeader::parseLine( const QString& line, int number )
{
diff --git a/src/qt3support/network/q3socketdevice_win.cpp b/src/qt3support/network/q3socketdevice_win.cpp
index 926d699..a0f0c0f 100644
--- a/src/qt3support/network/q3socketdevice_win.cpp
+++ b/src/qt3support/network/q3socketdevice_win.cpp
@@ -47,20 +47,15 @@
#include <string.h>
+# include <qt_windows.h>
#if defined (QT_NO_IPV6)
-# include <windows.h>
# include <winsock.h>
#else
# if defined (Q_CC_BOR) || defined (Q_CC_GNU)
# include <winsock2.h>
-# elif defined (Q_CC_INTEL)
-# include <winsock.h>
# else
-# include <windows.h>
-# if defined(Q_OS_WINCE)
# include <winsock.h>
# endif
-# endif
// Use our own defines and structs which we know are correct
# define QT_SS_MAXSIZE 128
# define QT_SS_ALIGNSIZE (sizeof(__int64))
diff --git a/src/qt3support/other/q3dragobject.cpp b/src/qt3support/other/q3dragobject.cpp
index 0c17e0c..93a6079 100644
--- a/src/qt3support/other/q3dragobject.cpp
+++ b/src/qt3support/other/q3dragobject.cpp
@@ -191,8 +191,7 @@ Q3DragObject::~Q3DragObject()
Set the pixmap, \a pm, to display while dragging the object. The
platform-specific implementation will use this where it can - so
provide a small masked pixmap, and do not assume that the user
- will actually see it. For example, cursors on Windows 95 are of
- limited size.
+ will actually see it.
The \a hotspot is the point on (or off) the pixmap that should be
under the cursor as it is dragged. It is relative to the top-left
@@ -553,10 +552,6 @@ QTextCodec* qt_findcharset(const QByteArray& mimetype)
i = cs.indexOf(';');
if (i >= 0)
cs = cs.left(i);
- // win98 often has charset=utf16, and we need to get the correct codec for
- // it to be able to get Unicode text drops.
- if (cs == "utf16")
- cs = "ISO-10646-UCS-2";
// May return 0 if unknown charset
return QTextCodec::codecForName(cs);
}
diff --git a/src/qt3support/other/q3process_win.cpp b/src/qt3support/other/q3process_win.cpp
index 352e497..0952663 100644
--- a/src/qt3support/other/q3process_win.cpp
+++ b/src/qt3support/other/q3process_win.cpp
@@ -308,108 +308,60 @@ bool Q3Process::start( QStringList *env )
// CreateProcess()
bool success;
d->newPid();
-#ifdef UNICODE
- if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) {
- STARTUPINFOW startupInfo = {
- sizeof( STARTUPINFO ), 0, 0, 0,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- 0, 0, 0,
- STARTF_USESTDHANDLES,
- 0, 0, 0,
- d->pipeStdin[0], d->pipeStdout[1], d->pipeStderr[1]
- };
- TCHAR *applicationName;
- if ( appName.isNull() )
- applicationName = 0;
- else
- applicationName = _wcsdup( (TCHAR*)appName.ucs2() );
- TCHAR *commandLine = _wcsdup( (TCHAR*)args.ucs2() );
- QByteArray envlist;
- if ( env != 0 ) {
- int pos = 0;
- // add PATH if necessary (for DLL loading)
- QByteArray path = qgetenv( "PATH" );
- if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) {
- QString tmp = QString::fromLatin1("PATH=%1").arg(QLatin1String(path.constData()));
- uint tmpSize = sizeof(TCHAR) * (tmp.length()+1);
- envlist.resize( envlist.size() + tmpSize );
- memcpy( envlist.data()+pos, tmp.ucs2(), tmpSize );
- pos += tmpSize;
- }
- // add the user environment
- for ( QStringList::Iterator it = env->begin(); it != env->end(); it++ ) {
- QString tmp = *it;
- uint tmpSize = sizeof(TCHAR) * (tmp.length()+1);
- envlist.resize( envlist.size() + tmpSize );
- memcpy( envlist.data()+pos, tmp.ucs2(), tmpSize );
- pos += tmpSize;
- }
- // add the 2 terminating 0 (actually 4, just to be on the safe side)
- envlist.resize( envlist.size()+4 );
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- }
- success = CreateProcessW( applicationName, commandLine,
- 0, 0, TRUE, ( comms==0 ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW )
+
+ STARTUPINFOW startupInfo = {
+ sizeof( STARTUPINFO ), 0, 0, 0,
+ (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
+ 0, 0, 0,
+ STARTF_USESTDHANDLES,
+ 0, 0, 0,
+ d->pipeStdin[0], d->pipeStdout[1], d->pipeStderr[1]
+ };
+ wchar_t *applicationName;
+ if ( appName.isNull() )
+ applicationName = 0;
+ else
+ applicationName = _wcsdup( (wchar_t*)appName.utf16() );
+ wchar_t *commandLine = _wcsdup( (wchar_t*)args.utf16() );
+ QByteArray envlist;
+ if ( env != 0 ) {
+ int pos = 0;
+ // add PATH if necessary (for DLL loading)
+ QByteArray path = qgetenv( "PATH" );
+ if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) {
+ QString tmp = QString::fromLatin1("PATH=%1").arg(QLatin1String(path.constData()));
+ uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
+ envlist.resize( envlist.size() + tmpSize );
+ memcpy( envlist.data() + pos, tmp.utf16(), tmpSize );
+ pos += tmpSize;
+ }
+ // add the user environment
+ for ( QStringList::Iterator it = env->begin(); it != env->end(); it++ ) {
+ QString tmp = *it;
+ uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
+ envlist.resize( envlist.size() + tmpSize );
+ memcpy( envlist.data() + pos, tmp.utf16(), tmpSize );
+ pos += tmpSize;
+ }
+ // add the 2 terminating 0 (actually 4, just to be on the safe side)
+ envlist.resize( envlist.size()+4 );
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ }
+ success = CreateProcess( applicationName, commandLine,
+ 0, 0, TRUE, ( comms == 0 ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW )
#ifndef Q_OS_WINCE
- | CREATE_UNICODE_ENVIRONMENT
+ | CREATE_UNICODE_ENVIRONMENT
#endif
- , env==0 ? 0 : envlist.data(),
- (TCHAR*)QDir::toNativeSeparators(workingDir.absPath()).ucs2(),
- &startupInfo, d->pid );
- free( applicationName );
- free( commandLine );
- } else
-#endif // UNICODE
- {
-#ifndef Q_OS_WINCE
- STARTUPINFOA startupInfo = { sizeof( STARTUPINFOA ), 0, 0, 0,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- 0, 0, 0,
- STARTF_USESTDHANDLES,
- 0, 0, 0,
- d->pipeStdin[0], d->pipeStdout[1], d->pipeStderr[1]
- };
- QByteArray envlist;
- if ( env != 0 ) {
- int pos = 0;
- // add PATH if necessary (for DLL loading)
- QByteArray path = qgetenv( "PATH" );
- if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) {
- Q3CString tmp = QString::fromLatin1("PATH=%1").arg(QString::fromLatin1(path.constData())).local8Bit();
- uint tmpSize = tmp.length() + 1;
- envlist.resize( envlist.size() + tmpSize );
- memcpy( envlist.data()+pos, tmp.data(), tmpSize );
- pos += tmpSize;
- }
- // add the user environment
- for ( QStringList::Iterator it = env->begin(); it != env->end(); it++ ) {
- Q3CString tmp = (*it).local8Bit();
- uint tmpSize = tmp.length() + 1;
- envlist.resize( envlist.size() + tmpSize );
- memcpy( envlist.data()+pos, tmp.data(), tmpSize );
- pos += tmpSize;
- }
- // add the terminating 0 (actually 2, just to be on the safe side)
- envlist.resize( envlist.size()+2 );
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- }
- char *applicationName;
- if ( appName.isNull() )
- applicationName = 0;
- else
- applicationName = const_cast<char *>(appName.toLocal8Bit().data());
- success = CreateProcessA( applicationName,
- const_cast<char *>(args.toLocal8Bit().data()),
- 0, 0, TRUE, comms==0 ? CREATE_NEW_CONSOLE : DETACHED_PROCESS,
- env==0 ? 0 : envlist.data(),
- (const char*)QDir::toNativeSeparators(workingDir.absPath()).local8Bit(),
- &startupInfo, d->pid );
-#endif // Q_OS_WINCE
- }
+ , env == 0 ? 0 : envlist.data(),
+ (wchar_t*)QDir::toNativeSeparators(workingDir.absPath()).utf16(),
+ &startupInfo, d->pid );
+
+ free( applicationName );
+ free( commandLine );
+
if ( !success ) {
d->deletePid();
return false;
diff --git a/src/qt3support/sql/q3datatable.cpp b/src/qt3support/sql/q3datatable.cpp
index 638aff8..d8d3c2b 100644
--- a/src/qt3support/sql/q3datatable.cpp
+++ b/src/qt3support/sql/q3datatable.cpp
@@ -1726,8 +1726,6 @@ void Q3DataTable::repaintCell( int row, int col )
the content coordinate system. If \a selected is true the cell has
been selected and would normally be rendered differently than an
unselected cell.
-
- \sa QSql::isNull()
*/
void Q3DataTable::paintCell( QPainter * p, int row, int col, const QRect & cr,
diff --git a/src/qt3support/tools/q3cstring.cpp b/src/qt3support/tools/q3cstring.cpp
index 39f1c43..b33b9b6 100644
--- a/src/qt3support/tools/q3cstring.cpp
+++ b/src/qt3support/tools/q3cstring.cpp
@@ -77,11 +77,23 @@ QT_BEGIN_NAMESPACE
and '\0' (NUL byte) terminated; otherwise the results are
undefined.
- A Q3CString that has not been assigned to anything is \e null, i.e.
- both the length and the data pointer is 0. A Q3CString that
- references the empty string ("", a single '\0' char) is \e empty.
- Both null and empty Q3CStrings are legal parameters to the methods.
- Assigning \c{const char *} 0 to Q3CString produces a null Q3CString.
+ A default constructed Q3CString is \e null, i.e. both the length
+ and the data pointer are 0 and isNull() returns true.
+
+ \note However, if you ask for the data pointer of a null Q3CString
+ by calling data(), then because the internal representation of the
+ null Q3CString is shared, it will be detached and replaced with a
+ non-shared, empty representation, a non-null data pointer will be
+ returned, and subsequent calls to isNull() will return false. But
+ if you ask for the data pointer of a null Q3CString by calling
+ constData(), the shared internal representation is not detached, a
+ null data pointer is returned, and subsequent calls to isNull()
+ will continue to return true.
+
+ A Q3CString that references the empty string ("", a single '\0'
+ char) is \e empty, i.e. isEmpty() returns true. Both null and
+ empty Q3CStrings are legal parameters to the methods. Assigning
+ \c{const char *} 0 to Q3CString produces a null Q3CString.
The length() function returns the length of the string; resize()
resizes the string and truncate() truncates the string. A string
@@ -321,6 +333,16 @@ QT_BEGIN_NAMESPACE
Returns true if the string is null, i.e. if data() == 0; otherwise
returns false. A null string is also an empty string.
+ \note If you ask for the data pointer of a null Q3CString by
+ calling data(), then because the internal representation of the
+ null Q3CString is shared, it will be detached and replaced with a
+ non-shared, empty representation, a non-null data pointer will be
+ returned, and subsequent calls to isNull() will return false. But
+ if you ask for the data pointer of a null Q3CString by calling
+ constData(), the shared internal representation is not detached, a
+ null data pointer is returned, and subsequent calls to isNull()
+ will continue to return true.
+
Example:
\snippet doc/src/snippets/code/src.qt3support.tools.q3cstring.cpp 1
diff --git a/src/qt3support/widgets/q3datetimeedit.cpp b/src/qt3support/widgets/q3datetimeedit.cpp
index b6e303c..71a8ffd 100644
--- a/src/qt3support/widgets/q3datetimeedit.cpp
+++ b/src/qt3support/widgets/q3datetimeedit.cpp
@@ -114,39 +114,21 @@ static void readLocaleSettings()
lTimeSep = new QString();
#if defined(Q_WS_WIN)
- QT_WA({
- TCHAR data[10];
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, data, 10);
- *lDateSep = QString::fromUtf16((ushort*)data);
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, data, 10);
- *lTimeSep = QString::fromUtf16((ushort*)data);
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, data, 10);
- lAMPM = QString::fromUtf16((ushort*)data).toInt()==0;
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, data, 10);
- QString am = QString::fromUtf16((ushort*)data);
- if (!am.isEmpty())
- lAM = new QString(am);
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, data, 10);
- QString pm = QString::fromUtf16((ushort*)data);
- if (!pm.isEmpty() )
- lPM = new QString(pm);
- } , {
- char data[10];
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDATE, (char*)&data, 10);
- *lDateSep = QString::fromLocal8Bit(data);
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STIME, (char*)&data, 10);
- *lTimeSep = QString::fromLocal8Bit(data);
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ITIME, (char*)&data, 10);
- lAMPM = QString::fromLocal8Bit(data).toInt()==0;
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S1159, (char*)&data, 10);
- QString am = QString::fromLocal8Bit(data);
- if (!am.isEmpty())
- lAM = new QString(am);
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S2359, (char*)&data, 10);
- QString pm = QString::fromLocal8Bit(data);
- if (!pm.isEmpty())
- lPM = new QString(pm);
- });
+ wchar_t data[10];
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, data, 10);
+ *lDateSep = QString::fromWCharArray(data);
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, data, 10);
+ *lTimeSep = QString::fromWCharArray(data);
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, data, 10);
+ lAMPM = QString::fromWCharArray(data).toInt() == 0;
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, data, 10);
+ QString am = QString::fromWCharArray(data);
+ if (!am.isEmpty())
+ lAM = new QString(am);
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, data, 10);
+ QString pm = QString::fromWCharArray(data);
+ if (!pm.isEmpty() )
+ lPM = new QString(pm);
#else
*lDateSep = QLatin1Char('-');
*lTimeSep = QLatin1Char(':');
@@ -1262,7 +1244,7 @@ Q3DateEdit::Order Q3DateEdit::order() const
}
-/*! \reimp
+/*! \internal
*/
void Q3DateEdit::stepUp()
@@ -1294,7 +1276,7 @@ void Q3DateEdit::stepUp()
-/*! \reimp
+/*! \internal
*/
@@ -1458,7 +1440,7 @@ bool Q3DateEdit::outOfRange(int y, int m, int d) const
return false; /* assume ok */
}
-/*! \reimp
+/*! \internal
*/
@@ -1552,7 +1534,7 @@ void Q3DateEdit::addNumber(int sec, int num)
}
-/*! \reimp
+/*! \internal
*/
@@ -1699,7 +1681,7 @@ void Q3DateEdit::removeFirstNumber(int sec)
d->ed->repaint(d->ed->rect());
}
-/*! \reimp
+/*! \internal
*/
@@ -2077,7 +2059,7 @@ void Q3TimeEdit::timerEvent(QTimerEvent *)
}
-/*! \reimp
+/*! \internal
*/
@@ -2123,7 +2105,7 @@ void Q3TimeEdit::stepUp()
}
-/*! \reimp
+/*! \internal
*/
@@ -2191,7 +2173,7 @@ QString Q3TimeEdit::sectionFormattedText(int sec)
}
-/*! \reimp
+/*! \internal
*/
@@ -2326,7 +2308,7 @@ bool Q3TimeEdit::outOfRange(int h, int m, int s) const
return true;
}
-/*! \reimp
+/*! \internal
*/
@@ -2495,7 +2477,7 @@ void Q3TimeEdit::removeFirstNumber(int sec)
d->ed->repaint(d->ed->rect());
}
-/*! \reimp
+/*! \internal
*/
void Q3TimeEdit::removeLastNumber(int sec)
@@ -2666,13 +2648,12 @@ Q3DateTimeEdit::~Q3DateTimeEdit()
}
-/*!
+/*! \fn void Q3DateTimeEdit::resizeEvent(QResizeEvent *event)
\reimp
- Intercepts and handles resize events which have special meaning
- for the Q3DateTimeEdit.
+ Intercepts and handles the resize \a event, which hase a
+ special meaning for the Q3DateTimeEdit.
*/
-
void Q3DateTimeEdit::resizeEvent(QResizeEvent *)
{
int dw = de->sizeHint().width();
diff --git a/src/qt3support/widgets/q3dockarea.cpp b/src/qt3support/widgets/q3dockarea.cpp
index a00bc81..d76835a 100644
--- a/src/qt3support/widgets/q3dockarea.cpp
+++ b/src/qt3support/widgets/q3dockarea.cpp
@@ -473,24 +473,25 @@ int Q3DockAreaLayout::widthForHeight(int h) const
contain Q3ToolBars since Q3ToolBar is a Q3DockWindow subclass.
QMainWindow contains four Q3DockAreas which you can use for your
- Q3ToolBars and Q3DockWindows, so in most situations you do not need
- to use the Q3DockArea class directly. Although QMainWindow contains
- support for its own dock areas it isn't convenient for adding new
- Q3DockAreas. If you need to create your own dock areas we suggest
- that you create a subclass of QWidget and add your Q3DockAreas to
- your subclass.
+ Q3ToolBars and Q3DockWindows, so in most situations you do not
+ need to use the Q3DockArea class directly. Although QMainWindow
+ contains support for its own dock areas, you can't add new ones.
+ You also can't add a Q3DockArea to your own subclass of QWidget.
+ It won't be shown.
\img qmainwindow-qdockareas.png QMainWindow's Q3DockAreas
\target lines
- \e Lines. Q3DockArea uses the concept of lines. A line is a
- horizontal region which may contain dock windows side-by-side. A
- dock area may have room for more than one line. When dock windows
- are docked into a dock area they are usually added at the right
- hand side of the top-most line that has room (unless manually
- placed by the user). When users move dock windows they may leave
- empty lines or gaps in non-empty lines. Qt::Dock windows can be lined
- up to minimize wasted space using the lineUp() function.
+ \section1 Lines.
+
+ Q3DockArea uses the concept of lines. A line is a horizontal
+ region which may contain dock windows side-by-side. A dock area
+ may have room for more than one line. When dock windows are docked
+ into a dock area they are usually added at the right hand side of
+ the top-most line that has room (unless manually placed by the
+ user). When users move dock windows they may leave empty lines or
+ gaps in non-empty lines. Qt::Dock windows can be lined up to
+ minimize wasted space using the lineUp() function.
The Q3DockArea class maintains a position list of all its child
dock windows. Qt::Dock windows are added to a dock area from position
diff --git a/src/qt3support/widgets/q3scrollview.cpp b/src/qt3support/widgets/q3scrollview.cpp
index cea385a..95e2117 100644
--- a/src/qt3support/widgets/q3scrollview.cpp
+++ b/src/qt3support/widgets/q3scrollview.cpp
@@ -669,7 +669,7 @@ bool Q3ScrollView::isVerticalSliderPressed()
}
/*!
- \reimp
+ \internal
*/
void Q3ScrollView::styleChange(QStyle& old)
{
@@ -679,7 +679,7 @@ void Q3ScrollView::styleChange(QStyle& old)
}
/*!
- \reimp
+ \internal
*/
void Q3ScrollView::fontChange(const QFont &old)
{
diff --git a/src/qt3support/widgets/q3titlebar.cpp b/src/qt3support/widgets/q3titlebar.cpp
index a05e4e5..ee3decf 100644
--- a/src/qt3support/widgets/q3titlebar.cpp
+++ b/src/qt3support/widgets/q3titlebar.cpp
@@ -173,35 +173,20 @@ void Q3TitleBarPrivate::readColors()
bool colorsInitialized = false;
#ifdef Q_WS_WIN // ask system properties on windows
-#ifndef SPI_GETGRADIENTCAPTIONS
-#define SPI_GETGRADIENTCAPTIONS 0x1008
-#endif
-#ifndef COLOR_GRADIENTACTIVECAPTION
-#define COLOR_GRADIENTACTIVECAPTION 27
-#endif
-#ifndef COLOR_GRADIENTINACTIVECAPTION
-#define COLOR_GRADIENTINACTIVECAPTION 28
-#endif
if (QApplication::desktopSettingsAware()) {
pal.setColor(QPalette::Active, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION)));
pal.setColor(QPalette::Inactive, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION)));
pal.setColor(QPalette::Active, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT)));
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT)));
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- colorsInitialized = true;
- BOOL gradient;
- QT_WA({
- SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
- } , {
- SystemParametersInfoA(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
- });
- if (gradient) {
- pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)));
- pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)));
- } else {
- pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight));
- pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight));
- }
+ colorsInitialized = true;
+ BOOL gradient = false;
+ SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
+ if (gradient) {
+ pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)));
+ pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)));
+ } else {
+ pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight));
+ pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight));
}
}
#endif // Q_WS_WIN
diff --git a/src/script/qscriptvalue.cpp b/src/script/qscriptvalue.cpp
index d99e912..0c8426f 100644
--- a/src/script/qscriptvalue.cpp
+++ b/src/script/qscriptvalue.cpp
@@ -574,9 +574,11 @@ void QScriptValue::setPrototype(const QScriptValue &prototype)
}
/*!
- Returns the scope object of this QScriptValue. This function is only
- relevant for function objects. The scope determines how variables are
- resolved when the function is invoked.
+ \since 4.6
+
+ Returns the scope object of this QScriptValue. This function is only
+ relevant for function objects. The scope determines how variables are
+ resolved when the function is invoked.
*/
QScriptValue QScriptValue::scope() const
{
@@ -588,9 +590,11 @@ QScriptValue QScriptValue::scope() const
}
/*!
- Sets the \a scope object of this QScriptValue. This function is only
- relevant for function objects. Changing the scope is useful when creating
- closures; see \l{Nested Functions and the Scope Chain}.
+ \since 4.6
+
+ Sets the \a scope object of this QScriptValue. This function is only
+ relevant for function objects. Changing the scope is useful when creating
+ closures; see \l{Nested Functions and the Scope Chain}.
*/
void QScriptValue::setScope(const QScriptValue &scope)
{
diff --git a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp
index 1324c01..92fa36c 100644
--- a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp
@@ -460,7 +460,7 @@ void QScriptDebuggerScriptedConsoleCommandJob::handleResponse(
}
/*!
- \reimp
+ \internal
*/
QString QScriptDebuggerScriptedConsoleCommand::name() const
{
@@ -469,7 +469,7 @@ QString QScriptDebuggerScriptedConsoleCommand::name() const
}
/*!
- \reimp
+ \internal
*/
QString QScriptDebuggerScriptedConsoleCommand::group() const
{
@@ -478,7 +478,7 @@ QString QScriptDebuggerScriptedConsoleCommand::group() const
}
/*!
- \reimp
+ \internal
*/
QString QScriptDebuggerScriptedConsoleCommand::shortDescription() const
{
@@ -487,7 +487,7 @@ QString QScriptDebuggerScriptedConsoleCommand::shortDescription() const
}
/*!
- \reimp
+ \internal
*/
QString QScriptDebuggerScriptedConsoleCommand::longDescription() const
{
@@ -496,7 +496,7 @@ QString QScriptDebuggerScriptedConsoleCommand::longDescription() const
}
/*!
- \reimp
+ \internal
*/
QStringList QScriptDebuggerScriptedConsoleCommand::aliases() const
{
@@ -505,7 +505,7 @@ QStringList QScriptDebuggerScriptedConsoleCommand::aliases() const
}
/*!
- \reimp
+ \internal
*/
QStringList QScriptDebuggerScriptedConsoleCommand::seeAlso() const
{
@@ -514,7 +514,7 @@ QStringList QScriptDebuggerScriptedConsoleCommand::seeAlso() const
}
/*!
- \reimp
+ \internal
*/
QStringList QScriptDebuggerScriptedConsoleCommand::argumentTypes() const
{
@@ -523,7 +523,7 @@ QStringList QScriptDebuggerScriptedConsoleCommand::argumentTypes() const
}
/*!
- \reimp
+ \internal
*/
QStringList QScriptDebuggerScriptedConsoleCommand::subCommands() const
{
@@ -532,7 +532,7 @@ QStringList QScriptDebuggerScriptedConsoleCommand::subCommands() const
}
/*!
- \reimp
+ \internal
*/
QScriptDebuggerConsoleCommandJob *QScriptDebuggerScriptedConsoleCommand::createJob(
const QStringList &arguments,
diff --git a/src/scripttools/debugging/qscriptenginedebuggerfrontend.cpp b/src/scripttools/debugging/qscriptenginedebuggerfrontend.cpp
index c5e21ef..5b58c52 100644
--- a/src/scripttools/debugging/qscriptenginedebuggerfrontend.cpp
+++ b/src/scripttools/debugging/qscriptenginedebuggerfrontend.cpp
@@ -323,7 +323,7 @@ QScriptDebuggerBackend *QScriptEngineDebuggerFrontend::backend() const
}
/*!
- \reimp
+ \internal
*/
void QScriptEngineDebuggerFrontend::processCommand(int id, const QScriptDebuggerCommand &command)
{
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index 1a82377..474c53d 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -51,10 +51,6 @@
#include <qvector.h>
#include <QDebug>
-#ifndef UNICODE
-#define UNICODE
-#endif
-
#if defined(Q_CC_BOR)
// DB2's sqlsystm.h (included through sqlcli1.h) defines the SQL_BIGINT_TYPE
// and SQL_BIGUINT_TYPE to wrong the types for Borland; so do the defines to
@@ -63,6 +59,8 @@
#define SQL_BIGUINT_TYPE quint64
#endif
+#define UNICODE
+
#include <sqlcli1.h>
#include <string.h>
@@ -111,22 +109,14 @@ public:
static QString qFromTChar(SQLTCHAR* str)
{
-#ifdef UNICODE
return QString::fromUtf16(str);
-#else
- return QString::fromLocal8Bit((const char*) str);
-#endif
}
// dangerous!! (but fast). Don't use in functions that
// require out parameters!
static SQLTCHAR* qToTChar(const QString& str)
{
-#ifdef UNICODE
return (SQLTCHAR*)str.utf16();
-#else
- return (unsigned char*) str.ascii();
-#endif
}
static QString qWarnDB2Handle(int handleType, SQLHANDLE handle)
@@ -347,12 +337,8 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool& is
while (true) {
r = SQLGetData(hStmt,
- column+1,
-#ifdef UNICODE
+ column + 1,
SQL_C_WCHAR,
-#else
- SQL_C_CHAR,
-#endif
(SQLPOINTER)buf,
colSize * sizeof(SQLTCHAR),
&lengthIndicator);
@@ -740,7 +726,6 @@ bool QDB2Result::exec()
ind);
break; }
case QVariant::String:
-#ifdef UNICODE
{
QString str(values.at(i).toString());
if (*ind != SQL_NULL_DATA)
@@ -774,8 +759,6 @@ bool QDB2Result::exec()
}
break;
}
-#endif
- // fall through
default: {
QByteArray ba = values.at(i).toString().toAscii();
int len = ba.length() + 1;
@@ -849,12 +832,9 @@ bool QDB2Result::exec()
case QVariant::ByteArray:
break;
case QVariant::String:
-#ifdef UNICODE
if (bindValueType(i) & QSql::Out)
values[i] = QString::fromUtf16((ushort*)tmpStorage.takeFirst().constData());
break;
-#endif
- // fall through
default: {
values[i] = QString::fromAscii(tmpStorage.takeFirst().constData());
break; }
@@ -1542,13 +1522,7 @@ bool QDB2Driver::hasFeature(DriverFeature f) const
case FinishQuery:
return true;
case Unicode:
- // this is the query that shows the codepage for the types:
- // select typename, codepage from syscat.datatypes
-#ifdef UNICODE
return true;
-#else
- return false;
-#endif
}
return false;
}
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index e91ca56..2df0073 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -89,7 +89,8 @@ public:
enum DefaultCase{Lower, Mixed, Upper, Sensitive};
QODBCDriverPrivate()
: hEnv(0), hDbc(0), useSchema(false), disconnectCount(0), isMySqlServer(false),
- isMSSqlServer(false), hasSQLFetchScroll(true), hasMultiResultSets(false)
+ isMSSqlServer(false), hasSQLFetchScroll(true), hasMultiResultSets(false),
+ isQuoteInitialized(false), quote(QLatin1Char('"'))
{
unicode = false;
}
@@ -116,7 +117,10 @@ public:
QString &schema, QString &table);
DefaultCase defaultCase() const;
QString adjustCase(const QString&) const;
- QChar quoteChar() const;
+ QChar quoteChar();
+private:
+ bool isQuoteInitialized;
+ QChar quote;
};
class QODBCPrivate
@@ -566,10 +570,8 @@ static int qGetODBCVersion(const QString &connOpts)
return SQL_OV_ODBC2;
}
-QChar QODBCDriverPrivate::quoteChar() const
+QChar QODBCDriverPrivate::quoteChar()
{
- static bool isQuoteInitialized = false;
- static QChar quote = QChar::fromLatin1('"');
if (!isQuoteInitialized) {
char driverResponse[4];
SQLSMALLINT length;
@@ -579,9 +581,9 @@ QChar QODBCDriverPrivate::quoteChar() const
sizeof(driverResponse),
&length);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
- quote = QChar::fromLatin1(driverResponse[0]);
+ quote = QLatin1Char(driverResponse[0]);
} else {
- quote = QChar::fromLatin1('"');
+ quote = QLatin1Char('"');
}
isQuoteInitialized = true;
}
@@ -1781,7 +1783,7 @@ bool QODBCDriver::open(const QString & db,
if (!d->checkDriver()) {
setLastError(qMakeError(tr("Unable to connect - Driver doesn't support all "
- "needed functionality"), QSqlError::ConnectionError, d));
+ "functionality required"), QSqlError::ConnectionError, d));
setOpenError(true);
return false;
}
@@ -1845,14 +1847,7 @@ void QODBCDriverPrivate::checkUnicode()
unicode = false;
return;
#endif
-#if defined(Q_WS_WIN)
- QT_WA(
- {},
- {
- unicode = false;
- return;
- })
-#endif
+
SQLRETURN r;
SQLUINTEGER fFunc;
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 2c67c8d..c61c526 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -54,11 +54,33 @@
#include <qstringlist.h>
#include <qmutex.h>
+
#include <libpq-fe.h>
#include <pg_config.h>
#include <stdlib.h>
#include <math.h>
+// below code taken from an example at http://www.gnu.org/software/hello/manual/autoconf/Function-Portability.html
+#ifndef isnan
+ # define isnan(x) \
+ (sizeof (x) == sizeof (long double) ? isnan_ld (x) \
+ : sizeof (x) == sizeof (double) ? isnan_d (x) \
+ : isnan_f (x))
+ static inline int isnan_f (float x) { return x != x; }
+ static inline int isnan_d (double x) { return x != x; }
+ static inline int isnan_ld (long double x) { return x != x; }
+#endif
+
+#ifndef isinf
+ # define isinf(x) \
+ (sizeof (x) == sizeof (long double) ? isinf_ld (x) \
+ : sizeof (x) == sizeof (double) ? isinf_d (x) \
+ : isinf_f (x))
+ static inline int isinf_f (float x) { return isnan (x - x); }
+ static inline int isinf_d (double x) { return isnan (x - x); }
+ static inline int isinf_ld (long double x) { return isnan (x - x); }
+#endif
+
// workaround for postgres defining their OIDs in a private header file
#define QBOOLOID 16
@@ -601,10 +623,9 @@ static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection)
{
QPSQLDriver::Protocol serverVersion = QPSQLDriver::Version6;
PGresult* result = PQexec(connection, "select version()");
- int status = PQresultStatus(result);
+ int status = PQresultStatus(result);
if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) {
QString val = QString::fromAscii(PQgetvalue(result, 0, 0));
- PQclear(result);
QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)"));
rx.setMinimal(true); // enforce non-greedy RegExp
if (rx.indexIn(val) != -1) {
@@ -645,6 +666,7 @@ static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection)
}
}
}
+ PQclear(result);
if (serverVersion < QPSQLDriver::Version71)
qWarning("This version of PostgreSQL is not supported and may not work.");
@@ -1161,6 +1183,21 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
qPQfreemem(data);
break;
}
+ case QVariant::Double: {
+ double val = field.value().toDouble();
+ if (isnan(val))
+ r = QLatin1String("'NaN'");
+ else {
+ int res = isinf(val);
+ if (res == 1)
+ r = QLatin1String("'Infinity'");
+ else if (res == -1)
+ r = QLatin1String("'-Infinity'");
+ else
+ r = QSqlDriver::formatValue(field, trimStrings);
+ }
+ break;
+ }
default:
r = QSqlDriver::formatValue(field, trimStrings);
break;
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
index 1989c45..d30e82c 100644
--- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
+++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
@@ -388,7 +388,7 @@ bool QSQLite2Driver::open(const QString & db, const QString &, const QString &,
char* err = 0;
d->access = sqlite_open(QFile::encodeName(db), 0, &err);
if (err) {
- setLastError(QSqlError(tr("Error to open database"), QString::fromAscii(err),
+ setLastError(QSqlError(tr("Error opening database"), QString::fromAscii(err),
QSqlError::ConnectionError));
sqlite_freemem(err);
err = 0;
@@ -463,7 +463,7 @@ bool QSQLite2Driver::rollbackTransaction()
if (res == SQLITE_OK)
return true;
- setLastError(QSqlError(tr("Unable to rollback Transaction"),
+ setLastError(QSqlError(tr("Unable to rollback transaction"),
QString::fromAscii(err), QSqlError::TransactionError, res));
sqlite_freemem(err);
return false;
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index 5aef39e..4950303 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -1481,18 +1481,21 @@ QString QSqlDatabase::connectionName() const
}
/*!
- Sets the default numerical precision policy used by queries created
- on this database connection to \a precisionPolicy.
+ \since 4.6
- Note: Drivers that don't support fetching numerical values with low
- precision will ignore the precision policy. You can use
- QSqlDriver::hasFeature() to find out whether a driver supports this
- feature.
+ Sets the default numerical precision policy used by queries created
+ on this database connection to \a precisionPolicy.
- Note: Setting the default precision policy to \a precisionPolicy
- doesn't affect any currently active queries.
+ Note: Drivers that don't support fetching numerical values with low
+ precision will ignore the precision policy. You can use
+ QSqlDriver::hasFeature() to find out whether a driver supports this
+ feature.
- \sa QSql::NumericalPrecisionPolicy, numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy(), QSqlQuery::numericalPrecisionPolicy()
+ Note: Setting the default precision policy to \a precisionPolicy
+ doesn't affect any currently active queries.
+
+ \sa QSql::NumericalPrecisionPolicy, numericalPrecisionPolicy(),
+ QSqlQuery::setNumericalPrecisionPolicy(), QSqlQuery::numericalPrecisionPolicy()
*/
void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)
{
@@ -1502,9 +1505,12 @@ void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy pr
}
/*!
- Returns the current default precision policy for the database connection.
+ \since 4.6
+
+ Returns the current default precision policy for the database connection.
- \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(), QSqlQuery::numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy()
+ \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(),
+ QSqlQuery::numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy()
*/
QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy() const
{
diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp
index 77e389f..ca0da66 100644
--- a/src/sql/kernel/qsqldriver.cpp
+++ b/src/sql/kernel/qsqldriver.cpp
@@ -865,6 +865,8 @@ QStringList QSqlDriver::subscribedToNotificationsImplementation() const
}
/*!
+ \since 4.6
+
This slot returns whether \a identifier is escaped according to the database rules.
\a identifier can either be a table name or field name, dependent
on \a type.
@@ -876,7 +878,6 @@ QStringList QSqlDriver::subscribedToNotificationsImplementation() const
slot in your own QSqlDriver if your database engine uses a different
delimiter character.
- \since 4.5
\sa isIdentifierEscaped()
*/
bool QSqlDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const
@@ -888,6 +889,8 @@ bool QSqlDriver::isIdentifierEscapedImplementation(const QString &identifier, Id
}
/*!
+ \since 4.6
+
This slot returns \a identifier with the leading and trailing delimiters removed,
\a identifier can either be a tablename or field name, dependent on \a type.
If \a identifier does not have leading and trailing delimiter characters, \a
@@ -898,7 +901,6 @@ bool QSqlDriver::isIdentifierEscapedImplementation(const QString &identifier, Id
dynamically detect and call \e this slot. It generally unnecessary
to reimplement this slot.
- \since 4.5
\sa stripDelimiters()
*/
QString QSqlDriver::stripDelimitersImplementation(const QString &identifier, IdentifierType type) const
@@ -914,13 +916,16 @@ QString QSqlDriver::stripDelimitersImplementation(const QString &identifier, Ide
}
/*!
- Sets the default numerical precision policy used by queries created
- by this driver to \a precisionPolicy.
+ \since 4.6
+
+ Sets the default numerical precision policy used by queries created
+ by this driver to \a precisionPolicy.
- Note: Setting the default precision policy to \a precisionPolicy
- doesn't affect any currently active queries.
+ Note: Setting the default precision policy to \a precisionPolicy
+ doesn't affect any currently active queries.
- \sa QSql::NumericalPrecisionPolicy, numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy(), QSqlQuery::numericalPrecisionPolicy()
+ \sa QSql::NumericalPrecisionPolicy, numericalPrecisionPolicy(),
+ QSqlQuery::setNumericalPrecisionPolicy(), QSqlQuery::numericalPrecisionPolicy()
*/
void QSqlDriver::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)
{
@@ -928,9 +933,12 @@ void QSqlDriver::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy prec
}
/*!
- Returns the current default precision policy for the database connection.
+ \since 4.6
+
+ Returns the current default precision policy for the database connection.
- \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(), QSqlQuery::numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy()
+ \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(),
+ QSqlQuery::numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy()
*/
QSql::NumericalPrecisionPolicy QSqlDriver::numericalPrecisionPolicy() const
{
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 156af26..4315a8c 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -205,7 +205,7 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement,
editQuery.addBindValue(rec.value(i));
}
for (i = 0; i < whereValues.count(); ++i) {
- if (whereValues.isGenerated(i))
+ if (whereValues.isGenerated(i) && !whereValues.isNull(i))
editQuery.addBindValue(whereValues.value(i));
}
@@ -538,6 +538,7 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in
isOk = updateRowInTable(index.row(), d->editBuffer);
if (isOk)
select();
+ emit dataChanged(index, index);
break; }
case OnRowChange:
if (index.row() == d->insertIndex) {
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 345dcf3..5857e1c 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -68,6 +68,7 @@
QT_BEGIN_NAMESPACE
+
double qstrtod(const char *s00, char const **se, bool *ok);
static bool parsePathDataFast(const QStringRef &data, QPainterPath &path);
@@ -320,6 +321,7 @@ static qreal toDouble(const QChar *&str)
++str;
}
}
+
temp[pos] = '\0';
qreal val;
@@ -365,16 +367,24 @@ static qreal toDouble(const QChar *&str)
return val;
}
-static qreal toDouble(const QString &str)
+static qreal toDouble(const QString &str, bool *ok = NULL)
{
const QChar *c = str.constData();
- return toDouble(c);
+ qreal res = toDouble(c);
+ if (ok) {
+ *ok = ((*c) == QLatin1Char('\0'));
+ }
+ return res;
}
-static qreal toDouble(const QStringRef &str)
+static qreal toDouble(const QStringRef &str, bool *ok = NULL)
{
const QChar *c = str.constData();
- return toDouble(c);
+ qreal res = toDouble(c);
+ if (ok) {
+ *ok = (c == (str.constData() + str.length()));
+ }
+ return res;
}
static QVector<qreal> parseNumbersList(const QChar *&str)
@@ -497,14 +507,17 @@ static bool constructColor(const QString &colorStr, const QString &opacity,
if (!resolveColor(colorStr, color, handler))
return false;
if (!opacity.isEmpty()) {
- qreal op = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity)));
+ bool ok = true;
+ qreal op = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity, &ok)));
+ if (!ok)
+ op = 1.0;
color.setAlphaF(op);
}
return true;
}
static qreal parseLength(const QString &str, QSvgHandler::LengthType &type,
- QSvgHandler *handler)
+ QSvgHandler *handler, bool *ok = NULL)
{
QString numStr = str.trimmed();
@@ -533,15 +546,15 @@ static qreal parseLength(const QString &str, QSvgHandler::LengthType &type,
type = handler->defaultCoordinateSystem();
//type = QSvgHandler::LT_OTHER;
}
- qreal len = toDouble(numStr);
+ qreal len = toDouble(numStr, ok);
//qDebug()<<"len is "<<len<<", from '"<<numStr << "'";
return len;
}
-static inline qreal convertToNumber(const QString &str, QSvgHandler *handler)
+static inline qreal convertToNumber(const QString &str, QSvgHandler *handler, bool *ok = NULL)
{
QSvgHandler::LengthType type;
- qreal num = parseLength(str, type, handler);
+ qreal num = parseLength(str, type, handler, ok);
if (type == QSvgHandler::LT_PERCENT) {
num = num/100.0;
}
@@ -631,15 +644,25 @@ static void parseBrush(QSvgNode *node,
QString opacity = attributes.value(QLatin1String("fill-opacity")).toString();
QString myId = someId(attributes);
- value = value.trimmed();
- fillRule = fillRule.trimmed();
- if (!value.isEmpty() || !fillRule.isEmpty()) {
- Qt::FillRule f = Qt::WindingFill;
+ QSvgFillStyle *prop = new QSvgFillStyle(0);
+
+ //fill-rule attribute handling
+ if (!fillRule.isEmpty() && fillRule != QLatin1String("inherit")) {
if (fillRule == QLatin1String("evenodd"))
- f = Qt::OddEvenFill;
+ prop->setFillRule(Qt::OddEvenFill);
+ else if (fillRule == QLatin1String("nonzero"))
+ prop->setFillRule(Qt::WindingFill);
+ }
+
+ //fill-opacity atttribute handling
+ if (!opacity.isEmpty() && opacity != QLatin1String("inherit")) {
+ prop->setFillOpacity(qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity))));
+ }
+
+ //fill attribute handling
+ if ((!value.isEmpty()) && (value != QLatin1String("inherit")) ) {
if (value.startsWith(QLatin1String("url"))) {
value = value.remove(0, 3);
- QSvgFillStyle *prop = new QSvgFillStyle(0);
QSvgStyleProperty *style = styleFromUrl(node, value);
if (style) {
prop->setFillStyle(style);
@@ -648,30 +671,18 @@ static void parseBrush(QSvgNode *node,
prop->setGradientId(id);
prop->setGradientResolved(false);
}
- if (!opacity.isEmpty()) {
- qreal clampedOpacity = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity)));
- prop->setFillOpacity(clampedOpacity);
- }
- if (!fillRule.isEmpty())
- prop->setFillRule(f);
- node->appendStyleProperty(prop,myId);
} else if (value != QLatin1String("none")) {
QColor color;
- if (constructColor(value, opacity, color, handler)) {
- QSvgFillStyle *prop = new QSvgFillStyle(QBrush(color));
- if (!fillRule.isEmpty())
- prop->setFillRule(f);
- node->appendStyleProperty(prop, myId);
- }
+ if (resolveColor(value, color, handler))
+ prop->setBrush(QBrush(color));
} else {
- QSvgFillStyle *prop = new QSvgFillStyle(QBrush(Qt::NoBrush));
- if (!fillRule.isEmpty())
- prop->setFillRule(f);
- node->appendStyleProperty(prop, myId);
+ prop->setBrush(QBrush(Qt::NoBrush));
}
}
+ node->appendStyleProperty(prop,myId);
}
+
static void parseQPen(QPen &pen, QSvgNode *node,
const QSvgAttributes &attributes,
QSvgHandler *handler)
@@ -908,103 +919,155 @@ static void parsePen(QSvgNode *node,
//qDebug()<<"Node "<<node->type()<<", attrs are "<<value<<width;
- if (!value.isEmpty() || !width.isEmpty() || !linecap.isEmpty() || !linejoin.isEmpty()) {
- if (value != QLatin1String("none")) {
- QSvgStrokeStyle *inherited =
- static_cast<QSvgStrokeStyle*>(node->styleProperty(
- QSvgStyleProperty::STROKE));
- if (!inherited)
- inherited = static_cast<QSvgStrokeStyle*>(node->parent()->styleProperty(
- QSvgStyleProperty::STROKE));
- QPen pen(handler->defaultPen());
- if (inherited)
- pen = inherited->qpen();
+ /* All the below checks needed because g (or any container element) can have only one of these attributes.
+ * If it doesn't has any one of these, then processing below not needed */
+
+ if (!value.isEmpty() || !width.isEmpty() || !dashArray.isEmpty() || !linecap.isEmpty() ||
+ !linejoin.isEmpty() || !miterlimit.isEmpty() || !opacity.isEmpty() || !dashOffset.isEmpty() ) {
+ //if (value != QLatin1String("none")) {
+ /* If stroke = "none" then also, we need to parse below, because elements like 'g' may
+ have other defined stroke attributes, which will be inherited by its children */
+ QSvgStrokeStyle *inherited =
+ static_cast<QSvgStrokeStyle*>(node->parent()->styleProperty(
+ QSvgStyleProperty::STROKE));
+
+ QPen pen(handler->defaultPen());
+ bool stroke = false;
+ if (inherited) {
+ pen = inherited->qpen();
+ stroke = inherited->strokePresent();
+ }
- if (!value.isEmpty()) {
- if (value.startsWith(QLatin1String("url"))) {
- value = value.remove(0, 3);
- QSvgStyleProperty *style = styleFromUrl(node, value);
- if (style) {
- if (style->type() == QSvgStyleProperty::GRADIENT) {
- QBrush b(*((QSvgGradientStyle*)style)->qgradient());
- pen.setBrush(b);
- } else if (style->type() == QSvgStyleProperty::SOLID_COLOR) {
- pen.setColor(
- ((QSvgSolidColorStyle*)style)->qcolor());
- }
- } else {
- qWarning() << "QSvgHandler::parsePen could not resolve property" << idFromUrl(value);
+ // stroke-opacity attribute handling
+ qreal strokeAlpha;
+ if (!opacity.isEmpty() && opacity != QLatin1String("inherit")) {
+ strokeAlpha = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity)));
+ } else {
+ strokeAlpha = pen.color().alphaF();
+ }
+
+ //stroke attribute handling
+ if (!value.isEmpty() && value != QLatin1String("inherit")) {
+ if (value.startsWith(QLatin1String("url"))) {
+ value = value.remove(0, 3);
+ QSvgStyleProperty *style = styleFromUrl(node, value);
+ if (style) {
+ if (style->type() == QSvgStyleProperty::GRADIENT) {
+ QBrush b(*((QSvgGradientStyle*)style)->qgradient());
+ pen.setBrush(b);
+ } else if (style->type() == QSvgStyleProperty::SOLID_COLOR) {
+ pen.setColor(
+ ((QSvgSolidColorStyle*)style)->qcolor());
}
+ pen.setStyle(Qt::SolidLine);
+ stroke = true;
} else {
- QColor color;
- if (constructColor(value, opacity, color, handler))
- pen.setColor(color);
+ qWarning() << "QSvgHandler::parsePen could not resolve property" << idFromUrl(value);
}
- //since we could inherit stroke="none"
- //we need to reset the style of our stroke to something
- pen.setStyle(Qt::SolidLine);
- }
- if (!width.isEmpty()) {
- QSvgHandler::LengthType lt;
- qreal widthF = parseLength(width, lt, handler);
- //### fixme
- if (!widthF) {
- pen.setStyle(Qt::NoPen);
- return;
+ } else if (value == QLatin1String("none")) {
+ QColor color; //### fixme: dafalut value for color.
+ color.setAlphaF(strokeAlpha);
+ pen.setColor(color);
+ stroke = false; // This is required because, parent may have a valid stroke but the child may have stroke = "none"
+ } else {
+ QColor color;
+ if (resolveColor(value, color, handler)) {
+ color.setAlphaF(strokeAlpha);
+ pen.setColor(color);
}
- pen.setWidthF(widthF);
- }
-
- if (!linejoin.isEmpty()) {
- if (linejoin == QLatin1String("miter"))
- pen.setJoinStyle(Qt::SvgMiterJoin);
- else if (linejoin == QLatin1String("round"))
- pen.setJoinStyle(Qt::RoundJoin);
- else if (linejoin == QLatin1String("bevel"))
- pen.setJoinStyle(Qt::BevelJoin);
+ stroke = true;
}
+ } else {
+ QColor color = pen.color();
+ color.setAlphaF(strokeAlpha);
+ pen.setColor(color);
+ }
- if (!linecap.isEmpty()) {
- if (linecap == QLatin1String("butt"))
- pen.setCapStyle(Qt::FlatCap);
- else if (linecap == QLatin1String("round"))
- pen.setCapStyle(Qt::RoundCap);
- else if (linecap == QLatin1String("square"))
- pen.setCapStyle(Qt::SquareCap);
- }
+ //stroke-width handling
+ if (!width.isEmpty() && width != QLatin1String("inherit")) {
+ qreal widthF;
+ QSvgHandler::LengthType lt;
+ widthF = parseLength(width, lt, handler);
+ pen.setWidthF(widthF);
+ } else if (inherited){
+ qreal widthF = inherited->qpen().widthF();
+ pen.setWidthF(widthF);
+ }
- qreal penw = pen.widthF();
- if (!dashArray.isEmpty()) {
- const QChar *s = dashArray.constData();
- QVector<qreal> dashes = parseNumbersList(s);
- qreal *d = dashes.data();
- if(penw != 0)
- for (int i = 0; i < dashes.size(); ++i) {
- *d /= penw;
- ++d;
- }
+ //stroke-linejoin attribute handling
+ if (!linejoin.isEmpty()) {
+ if (linejoin == QLatin1String("miter"))
+ pen.setJoinStyle(Qt::SvgMiterJoin);
+ else if (linejoin == QLatin1String("round"))
+ pen.setJoinStyle(Qt::RoundJoin);
+ else if (linejoin == QLatin1String("bevel"))
+ pen.setJoinStyle(Qt::BevelJoin);
+ }
- // if the dash count is odd the dashes should be duplicated
- if (dashes.size() % 2 != 0)
- dashes << QVector<qreal>(dashes);
+ //stroke-linecap attribute handling
+ if (!linecap.isEmpty()) {
+ if (linecap == QLatin1String("butt"))
+ pen.setCapStyle(Qt::FlatCap);
+ else if (linecap == QLatin1String("round"))
+ pen.setCapStyle(Qt::RoundCap);
+ else if (linecap == QLatin1String("square"))
+ pen.setCapStyle(Qt::SquareCap);
+ }
- pen.setDashPattern(dashes);
- }
- if (!dashOffset.isEmpty()) {
- qreal doffset = toDouble(dashOffset);
- if (penw != 0)
- doffset /= penw;
- pen.setDashOffset(doffset);
+ //strok-dasharray attribute handling
+ qreal penw = pen.widthF();
+ if (!dashArray.isEmpty() && dashArray != QLatin1String("inherit")) {
+ const QChar *s = dashArray.constData();
+ QVector<qreal> dashes = parseNumbersList(s);
+ qreal *d = dashes.data();
+ if (penw != 0)
+ for (int i = 0; i < dashes.size(); ++i) {
+ *d /= penw;
+ ++d;
+ }
+ // if the dash count is odd the dashes should be duplicated
+ if (dashes.size() % 2 != 0)
+ dashes << QVector<qreal>(dashes);
+ pen.setDashPattern(dashes);
+ } else if (inherited) {
+ QVector<qreal> dashes(inherited->qpen().dashPattern());
+ qreal *d = dashes.data();
+ if (!penw)
+ penw = 1.0;
+ qreal inheritpenw = inherited->qpen().widthF();
+ if (!inheritpenw)
+ inheritpenw = 1.0;
+ for ( int i = 0; i < dashes.size(); ++i) {
+ *d *= (inheritpenw/ penw);
+ ++d;
}
- if (!miterlimit.isEmpty())
- pen.setMiterLimit(toDouble(miterlimit));
+ pen.setDashPattern(dashes);
+ }
- node->appendStyleProperty(new QSvgStrokeStyle(pen), myId);
- } else {
- QPen pen(handler->defaultPen());
- pen.setStyle(Qt::NoPen);
- node->appendStyleProperty(new QSvgStrokeStyle(pen), myId);
+
+ //stroke-dashoffset attribute handling
+ if (!dashOffset.isEmpty() && dashOffset != QLatin1String("inherit")) {
+ qreal doffset = toDouble(dashOffset);
+ if (penw != 0)
+ doffset /= penw;
+ pen.setDashOffset(doffset);
+ } else if (inherited) {
+ qreal doffset = pen.dashOffset();
+ if (!penw)
+ penw = 1.0;
+ qreal inheritpenw = inherited->qpen().widthF();
+ if (!inheritpenw)
+ inheritpenw = 1.0;
+ doffset *= (inheritpenw/ penw);
+ pen.setDashOffset(doffset);
}
+
+ if (!miterlimit.isEmpty() && miterlimit != QLatin1String("inherit"))
+ pen.setMiterLimit(toDouble(miterlimit));
+
+ QSvgStrokeStyle *prop = new QSvgStrokeStyle(pen);
+ prop->setStroke(stroke);
+ node->appendStyleProperty(prop, myId);
}
}
@@ -1071,10 +1134,14 @@ static bool parseQFont(const QSvgAttributes &attributes,
font.setFamily(family.trimmed());
}
if (!size.isEmpty()) {
- QSvgHandler::LengthType dummy; // should always be pixel size
- fontSize = parseLength(size, dummy, handler);
- if (fontSize <= 0)
- fontSize = 1;
+ if (size == QLatin1String("inherit")) {
+ //inherited already
+ } else {
+ QSvgHandler::LengthType dummy; // should always be pixel size
+ fontSize = parseLength(size, dummy, handler);
+ if (fontSize <= 0)
+ fontSize = 1;
+ }
font.setPixelSize(qMax(1, int(fontSize)));
}
if (!style.isEmpty()) {
@@ -1154,9 +1221,13 @@ static void parseFont(QSvgNode *node,
font = inherited->qfont();
fontSize = inherited->pointSize();
}
- if (parseQFont(attributes, font, fontSize, handler)) {
+ // group or any container element can have only text-anchor and should
+ // be processed, because its children can inherit from it.
+ // So checking for text-anchor before parseQfont()
+ QString anchor = attributes.value(QLatin1String("text-anchor")).toString();
+ if (parseQFont(attributes, font, fontSize, handler) || (!anchor.isEmpty())) {
QString myId = someId(attributes);
- QString anchor = attributes.value(QLatin1String("text-anchor")).toString();
+ //QString anchor = attributes.value(QLatin1String("text-anchor")).toString();
QSvgTinyDocument *doc = node->document();
QSvgFontStyle *fontStyle = 0;
QString family = (font.family().isEmpty())?myId:font.family();
@@ -1865,7 +1936,7 @@ static bool parseDefaultTextStyle(QSvgNode *node,
if (fontStyle) {
font = fontStyle->qfont();
fontSize = fontStyle->pointSize();
- if (anchor.isEmpty())
+ if (anchor.isEmpty() || anchor == QLatin1String("inherit"))
anchor = fontStyle->textAnchor();
}
@@ -2946,7 +3017,11 @@ static bool parseStopNode(QSvgStyleProperty *parent,
QString colorStr = attrs.value(QString(), QLatin1String("stop-color")).toString();
QString opacityStr = attrs.value(QString(), QLatin1String("stop-opacity")).toString();
QColor color;
- qreal offset = convertToNumber(offsetStr, handler);
+
+ bool ok = true;
+ qreal offset = convertToNumber(offsetStr, handler, &ok);
+ if (!ok)
+ offset = 0.0;
if (colorStr.isEmpty()) {
colorStr = QLatin1String("#000000");
}
@@ -3035,12 +3110,16 @@ static QSvgNode *createSvgNode(QSvgNode *parent,
QStringList lst = viewBoxStr.split(QLatin1Char(' '), QString::SkipEmptyParts);
if (lst.count() != 4)
lst = viewBoxStr.split(QLatin1Char(','), QString::SkipEmptyParts);
+ int count = lst.count();
+ while (count < 4) {
+ lst.append(QLatin1String(""));
+ count++;
+ }
QString xStr = lst.at(0).trimmed();
QString yStr = lst.at(1).trimmed();
QString widthStr = lst.at(2).trimmed();
QString heightStr = lst.at(3).trimmed();
-
QSvgHandler::LengthType lt;
qreal x = parseLength(xStr, lt, handler);
qreal y = parseLength(yStr, lt, handler);
@@ -3048,15 +3127,14 @@ static QSvgNode *createSvgNode(QSvgNode *parent,
qreal h = parseLength(heightStr, lt, handler);
node->setViewBox(QRectF(x, y, w, h));
- } else if (width && height){
+
+ } else if (width && height) {
if (type == QSvgHandler::LT_PT) {
width = convertToPixels(width, false, type);
height = convertToPixels(height, false, type);
}
-
node->setViewBox(QRectF(0, 0, width, height));
}
-
handler->setDefaultCoordinateSystem(QSvgHandler::LT_PX);
return node;
@@ -3395,7 +3473,7 @@ void QSvgHandler::init()
m_style = 0;
m_animEnd = 0;
m_defaultCoords = LT_PX;
- m_defaultPen = QPen(Qt::black, 1, Qt::NoPen, Qt::FlatCap, Qt::SvgMiterJoin);
+ m_defaultPen = QPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::SvgMiterJoin);
m_defaultPen.setMiterLimit(4);
parse();
}
diff --git a/src/svg/qsvgnode.cpp b/src/svg/qsvgnode.cpp
index 75c01a9..ce8b3fa 100644
--- a/src/svg/qsvgnode.cpp
+++ b/src/svg/qsvgnode.cpp
@@ -320,7 +320,7 @@ qreal QSvgNode::strokeWidth() const
{
QSvgStrokeStyle *stroke = static_cast<QSvgStrokeStyle*>(
styleProperty(QSvgStyleProperty::STROKE));
- if (!stroke || stroke->qpen().style() == Qt::NoPen)
+ if (!stroke || !stroke->strokePresent())
return 0;
return stroke->qpen().widthF();
}
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index fec6231..c3c0a68 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -81,12 +81,25 @@ void QSvgQualityStyle::revert(QPainter *, QSvgExtraStates &)
}
QSvgFillStyle::QSvgFillStyle(const QBrush &brush)
- : m_fill(brush), m_style(0), m_fillRuleSet(false), m_fillOpacitySet(false), m_gradientResolved (true)
+ : m_fill(brush)
+ , m_style(0)
+ , m_fillRuleSet(false)
+ , m_fillRule(Qt::WindingFill)
+ , m_fillOpacitySet(false)
+ , m_fillOpacity(1.0)
+ , m_gradientResolved(true)
+ , m_fillSet(true)
{
}
QSvgFillStyle::QSvgFillStyle(QSvgStyleProperty *style)
- : m_style(style), m_fillRuleSet(false), m_fillOpacitySet(false), m_gradientResolved (true)
+ : m_style(style)
+ , m_fillRuleSet(false)
+ , m_fillRule(Qt::WindingFill)
+ , m_fillOpacitySet(false)
+ , m_fillOpacity(1.0)
+ , m_gradientResolved(true)
+ , m_fillSet(style != 0)
{
}
@@ -102,6 +115,19 @@ void QSvgFillStyle::setFillOpacity(qreal opacity)
m_fillOpacity = opacity;
}
+void QSvgFillStyle::setFillStyle(QSvgStyleProperty* style)
+{
+ m_style = style;
+ m_fillSet = true;
+}
+
+void QSvgFillStyle::setBrush(QBrush brush)
+{
+ m_fill = brush;
+ m_style = 0;
+ m_fillSet = true;
+}
+
static void recursivelySetFill(QSvgNode *node, Qt::FillRule f)
{
if (node->type() == QSvgNode::PATH) {
@@ -126,20 +152,26 @@ void QSvgFillStyle::apply(QPainter *p, const QRectF &rect, QSvgNode *node, QSvgE
recursivelySetFill(node, m_fillRule);
m_fillRuleSet = false;//set it only on the first run
}
- p->setBrush(m_fill);
+ if (m_fillSet) {
+ if (m_style)
+ m_style->apply(p, rect, node, states);
+ else
+ p->setBrush(m_fill);
+ }
if (m_fillOpacitySet)
states.fillOpacity = m_fillOpacity;
- if (m_style)
- m_style->apply(p, rect, node, states);
}
void QSvgFillStyle::revert(QPainter *p, QSvgExtraStates &states)
{
- if (m_style)
- m_style->revert(p, states);
- p->setBrush(m_oldFill);
if (m_fillOpacitySet)
states.fillOpacity = m_oldOpacity;
+ if (m_fillSet) {
+ if (m_style)
+ m_style->revert(p, states);
+ else
+ p->setBrush(m_oldFill);
+ }
}
QSvgViewportFillStyle::QSvgViewportFillStyle(const QBrush &brush)
@@ -195,14 +227,18 @@ void QSvgFontStyle::revert(QPainter *p, QSvgExtraStates &)
}
QSvgStrokeStyle::QSvgStrokeStyle(const QPen &pen)
- : m_stroke(pen)
+ : m_stroke(pen), m_strokePresent(true)
{
}
void QSvgStrokeStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &)
{
m_oldStroke = p->pen();
- p->setPen(m_stroke);
+ if (!m_strokePresent || !m_stroke.widthF() || !m_stroke.color().alphaF()) {
+ p->setPen(Qt::NoPen);
+ } else {
+ p->setPen(m_stroke);
+ }
}
void QSvgStrokeStyle::revert(QPainter *p, QSvgExtraStates &)
diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h
index e65b6f5..70ecf5b 100644
--- a/src/svg/qsvgstyle_p.h
+++ b/src/svg/qsvgstyle_p.h
@@ -224,12 +224,29 @@ public:
void setFillRule(Qt::FillRule f);
void setFillOpacity(qreal opacity);
+ void setFillStyle(QSvgStyleProperty* style);
+ void setBrush(QBrush brush);
const QBrush & qbrush() const
{
return m_fill;
}
+ qreal fillOpacity() const
+ {
+ return m_fillOpacity;
+ }
+
+ Qt::FillRule fillRule() const
+ {
+ return m_fillRule;
+ }
+
+ QSvgStyleProperty* style() const
+ {
+ return m_style;
+ }
+
void setGradientId(const QString &Id)
{
m_gradientId = Id;
@@ -240,7 +257,6 @@ public:
return m_gradientId;
}
-
void setGradientResolved(bool resolved)
{
m_gradientResolved = resolved;
@@ -251,16 +267,6 @@ public:
return m_gradientResolved;
}
- void setFillStyle(QSvgStyleProperty* style)
- {
- m_style = style;
- }
-
- void setBrush(QBrush brush)
- {
- m_fill = brush;
- }
-
private:
// fill v v 'inherit' | <Paint.datatype>
// fill-opacity v v 'inherit' | <OpacityValue.datatype>
@@ -275,6 +281,7 @@ private:
qreal m_oldOpacity;
QString m_gradientId;
bool m_gradientResolved;
+ bool m_fillSet;
};
class QSvgViewportFillStyle : public QSvgStyleProperty
@@ -345,6 +352,16 @@ public:
virtual void revert(QPainter *p, QSvgExtraStates &states);
virtual Type type() const;
+ void setStroke(bool stroke)
+ {
+ m_strokePresent = stroke;
+ }
+
+ bool strokePresent() const
+ {
+ return m_strokePresent;
+ }
+
const QPen & qpen() const
{
return m_stroke;
@@ -359,8 +376,8 @@ private:
// stroke-opacity v v 'inherit' | <OpacityValue.datatype>
// stroke-width v v 'inherit' | <StrokeWidthValue.datatype>
QPen m_stroke;
-
QPen m_oldStroke;
+ bool m_strokePresent;
};
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index ce4bb5d..3560331 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -155,7 +155,7 @@ namespace QTest {
int length = strlen(str);
for (int pos = 0; pos < length; pos +=255) {
QString uniText = QString::fromLatin1(str + pos, 255);
- OutputDebugStringW((const LPCWSTR) uniText.utf16());
+ OutputDebugString((wchar_t*)uniText.utf16());
}
if (QTestLog::outputFileName())
#elif defined(Q_OS_WIN)
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 00e532a..a8a4b1a 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -72,6 +72,8 @@
#include <windows.h> // for Sleep
#endif
#ifdef Q_OS_UNIX
+#include <errno.h>
+#include <signal.h>
#include <time.h>
#endif
@@ -406,7 +408,8 @@ QT_BEGIN_NAMESPACE
\overload
- Simulates clicking of \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ Simulates clicking of \a key with an optional \a modifier on a \a widget.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds.
Example:
\snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 13
@@ -419,7 +422,8 @@ QT_BEGIN_NAMESPACE
/*! \fn void QTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
- Simulates clicking of \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ Simulates clicking of \a key with an optional \a modifier on a \a widget.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds.
Examples:
\snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 14
@@ -434,20 +438,25 @@ QT_BEGIN_NAMESPACE
/*! \fn void QTest::keyEvent(KeyAction action, QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
- Sends a Qt key event to \a widget with the given \a key and an associated \a action. Optionally, a keyboard \a modifier can be specified, as well as a \a delay (in milliseconds) of the test before sending the event.
+ Sends a Qt key event to \a widget with the given \a key and an associated \a action.
+ Optionally, a keyboard \a modifier can be specified, as well as a \a delay
+ (in milliseconds) of the test before sending the event.
*/
/*! \fn void QTest::keyEvent(KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
\overload
- Sends a Qt key event to \a widget with the given key \a ascii and an associated \a action. Optionally, a keyboard \a modifier can be specified, as well as a \a delay (in milliseconds) of the test before sending the event.
+ Sends a Qt key event to \a widget with the given key \a ascii and an associated \a action.
+ Optionally, a keyboard \a modifier can be specified, as well as a \a delay
+ (in milliseconds) of the test before sending the event.
*/
/*! \fn void QTest::keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
- Simulates pressing a \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ Simulates pressing a \a key with an optional \a modifier on a \a widget. If \a delay
+ is larger than 0, the test will wait for \a delay milliseconds.
\bold {Note:} At some point you should release the key using \l keyRelease().
@@ -458,7 +467,8 @@ QT_BEGIN_NAMESPACE
\overload
- Simulates pressing a \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ Simulates pressing a \a key with an optional \a modifier on a \a widget.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds.
\bold {Note:} At some point you should release the key using \l keyRelease().
@@ -467,7 +477,8 @@ QT_BEGIN_NAMESPACE
/*! \fn void QTest::keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
- Simulates releasing a \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ Simulates releasing a \a key with an optional \a modifier on a \a widget.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds.
\sa QTest::keyPress(), QTest::keyClick()
*/
@@ -476,7 +487,8 @@ QT_BEGIN_NAMESPACE
\overload
- Simulates releasing a \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ Simulates releasing a \a key with an optional \a modifier on a \a widget.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds.
\sa QTest::keyClick()
*/
@@ -692,6 +704,84 @@ QT_BEGIN_NAMESPACE
\sa QTest::qSleep()
*/
+/*!
+ \class QTest::QTouchEventSequence
+ \inmodule QtTest
+ \since 4.6
+
+ \brief The QTouchEventSequence class is used to simulate a sequence of touch events.
+
+ To simulate a sequence of touch events on a specific device for a widget, call
+ QTest::touchEvent to create a QTouchEventSequence instance. Add touch events to
+ the sequence by calling press(), move(), release() and stationary(), and let the
+ instance run out of scope to commit the sequence to the event system.
+*/
+
+/*!
+ \fn QTest::QTouchEventSequence::~QTouchEventSequence()
+
+ Commits this sequence of touch events and frees allocated resources.
+*/
+
+/*!
+ \fn QTouchEventSequence &QTest::QTouchEventSequence::press(int touchId, const QPoint &pt, QWidget *widget)
+
+ Adds a press event for touchpoint \a touchId at position \a pt to this sequence and returns
+ a reference to this QTouchEventSequence.
+
+ The position \a pt is interpreted as relative to \a widget. If \a widget is the null pointer, then
+ \a pt is interpreted as relative to the widget provided when instantiating this QTouchEventSequence.
+
+ Simulates that the user pressed the touch screen or pad with the finger identified by \a touchId.
+*/
+
+/*!
+ \fn QTouchEventSequence &QTest::QTouchEventSequence::move(int touchId, const QPoint &pt, QWidget *widget)
+
+ Adds a move event for touchpoint \a touchId at position \a pt to this sequence and returns
+ a reference to this QTouchEventSequence.
+
+ The position \a pt is interpreted as relative to \a widget. If \a widget is the null pointer, then
+ \a pt is interpreted as relative to the widget provided when instantiating this QTouchEventSequence.
+
+ Simulates that the user moved the finger identified by \a touchId.
+*/
+
+/*!
+ \fn QTouchEventSequence &QTest::QTouchEventSequence::release(int touchId, const QPoint &pt, QWidget *widget)
+
+ Adds a release event for touchpoint \a touchId at position \a pt to this sequence and returns
+ a reference to this QTouchEventSequence.
+
+ The position \a pt is interpreted as relative to \a widget. If \a widget is the null pointer, then
+ \a pt is interpreted as relative to the widget provided when instantiating this QTouchEventSequence.
+
+ Simulates that the user lifted the finger identified by \a touchId.
+*/
+
+/*!
+ \fn QTouchEventSequence &QTest::QTouchEventSequence::stationary(int touchId)
+
+ Adds a stationary event for touchpoint \a touchId to this sequence and returns
+ a reference to this QTouchEventSequence.
+
+ Simulates that the user did not move the finger identified by \a touchId.
+*/
+
+/*!
+ \fn QTouchEventSequence QTest::touchEvent(QWidget *widget, QTouchEvent::DeviceType deviceType)
+
+ Creates and returns a QTouchEventSequence for the device \a deviceType to
+ simulate events for \a widget.
+
+ When adding touch events to the sequence, \a widget will also be used to translate
+ the position provided to screen coordinates, unless another widget is provided in the
+ respective calls to press(), move() etc.
+
+ The touch events are committed to the event system when the destructor of the
+ QTouchEventSequence is called (ie when the object returned runs out of scope).
+*/
+
namespace QTest
{
static QObject *currentTestObject = 0;
@@ -852,7 +942,7 @@ static void qParseArgs(int argc, char *argv[])
" -iterations n : Sets the number of accumulation iterations.\n"
" -median n : Sets the number of median iterations.\n"
" -vb : Print out verbose benchmarking information.\n"
-#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS)
+#if !defined(QT_NO_PROCESS) && !defined(QT_NO_SETTINGS)
" -chart : Create chart based on the benchmark result.\n"
#endif
"\n"
@@ -968,7 +1058,7 @@ static void qParseArgs(int argc, char *argv[])
} else if (strcmp(argv[i], "-vb") == 0) {
QBenchmarkGlobalData::current->verboseOutput = true;
-#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS)
+#if !defined(QT_NO_PROCESS) && !defined(QT_NO_SETTINGS)
} else if (strcmp(argv[i], "-chart") == 0) {
QBenchmarkGlobalData::current->createChart = true;
QTestLog::setLogMode(QTestLog::XML);
@@ -1335,6 +1425,80 @@ static void qInvokeTestMethods(QObject *testObject)
QTestLog::stopLogging();
}
+#ifdef Q_OS_UNIX
+class FatalSignalHandler
+{
+public:
+ FatalSignalHandler();
+ ~FatalSignalHandler();
+
+private:
+ static void signal(int);
+ sigset_t handledSignals;
+};
+
+void FatalSignalHandler::signal(int signum)
+{
+ qFatal("Received signal %d", signum);
+}
+
+FatalSignalHandler::FatalSignalHandler()
+{
+ sigemptyset(&handledSignals);
+
+ const int fatalSignals[] = {
+ SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGFPE, SIGSEGV, SIGPIPE, SIGTERM, 0 };
+
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = FatalSignalHandler::signal;
+
+ // Remove the handler after it is invoked.
+ act.sa_flags = SA_RESETHAND;
+
+ // Block all fatal signals in our signal handler so we don't try to close
+ // the testlog twice.
+ sigemptyset(&act.sa_mask);
+ for (int i = 0; fatalSignals[i]; ++i)
+ sigaddset(&act.sa_mask, fatalSignals[i]);
+
+ struct sigaction oldact;
+
+ for (int i = 0; fatalSignals[i]; ++i) {
+ sigaction(fatalSignals[i], &act, &oldact);
+ // Don't overwrite any non-default handlers
+ if (oldact.sa_flags & SA_SIGINFO || oldact.sa_handler != SIG_DFL) {
+ sigaction(fatalSignals[i], &oldact, 0);
+ } else {
+ sigaddset(&handledSignals, fatalSignals[i]);
+ }
+ }
+}
+
+
+FatalSignalHandler::~FatalSignalHandler()
+{
+ // Unregister any of our remaining signal handlers
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = SIG_DFL;
+
+ struct sigaction oldact;
+
+ for (int i = 1; i < 32; ++i) {
+ if (!sigismember(&handledSignals, i))
+ continue;
+ sigaction(i, &act, &oldact);
+
+ // If someone overwrote it in the mean time, put it back
+ if (oldact.sa_handler != FatalSignalHandler::signal)
+ sigaction(i, &oldact, 0);
+ }
+}
+
+#endif
+
+
} // namespace
/*!
@@ -1434,14 +1598,14 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
QBenchmarkValgrindUtils::cleanup();
- } else {
+ } else
+#endif
+ {
+#ifdef Q_OS_UNIX
+ FatalSignalHandler handler;
#endif
-
qInvokeTestMethods(testObject);
-
-#ifdef QTESTLIB_USE_VALGRIND
}
-#endif
#ifndef QT_NO_EXCEPTIONS
} catch (...) {
@@ -1473,7 +1637,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
#endif
-#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS)
+#if !defined(QT_NO_PROCESS) && !defined(QT_NO_SETTINGS)
if (QBenchmarkGlobalData::current->createChart) {
QString chartLocation = QLibraryInfo::location(QLibraryInfo::BinariesPath);
#ifdef Q_OS_WIN
@@ -1937,8 +2101,4 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac
\internal
*/
-/*! \fn int QTest::qt_snprintf(char *str, int size, const char *format, ...)
- \internal
-*/
-
QT_END_NAMESPACE
diff --git a/src/testlib/qtestfilelogger.cpp b/src/testlib/qtestfilelogger.cpp
index 0c146b4..a717058 100644
--- a/src/testlib/qtestfilelogger.cpp
+++ b/src/testlib/qtestfilelogger.cpp
@@ -72,15 +72,24 @@ void QTestFileLogger::init()
QTest::qt_snprintf(filename, sizeof(filename), "%s.log",
QTestResult::currentTestObjectName());
- #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
- if (::fopen_s(&QTest::stream, filename, "wt")) {
- #else
- QTest::stream = ::fopen(filename, "wt");
- if (!QTest::stream) {
- #endif
- printf("Unable to open file for simple logging: %s", filename);
- ::exit(1);
+ // Keep filenames simple
+ for (int i = 0; i < sizeof(filename) && filename[i]; ++i) {
+ char& c = filename[i];
+ if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '-'
+ || c == '.')) {
+ c = '_';
}
+ }
+
+#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
+ if (::fopen_s(&QTest::stream, filename, "wt")) {
+#else
+ QTest::stream = ::fopen(filename, "wt");
+ if (!QTest::stream) {
+#endif
+ printf("Unable to open file for simple logging: %s", filename);
+ ::exit(1);
+ }
}
void QTestFileLogger::flush(const char *msg)
diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri
index 4726653..6261b30 100644
--- a/src/tools/bootstrap/bootstrap.pri
+++ b/src/tools/bootstrap/bootstrap.pri
@@ -28,26 +28,26 @@ win32:DEFINES += QT_NODLL
INCLUDEPATH += $$QT_BUILD_TREE/include \
$$QT_BUILD_TREE/include/QtCore \
$$QT_BUILD_TREE/include/QtXml \
- ../../xml
+ $$QT_SOURCE_TREE/src/xml
DEPENDPATH += $$INCLUDEPATH \
- ../../corelib/global \
- ../../corelib/kernel \
- ../../corelib/tools \
- ../../corelib/io \
- ../../corelib/codecs \
- ../../xml
+ $$QT_SOURCE_TREE/src/corelib/global \
+ $$QT_SOURCE_TREE/src/corelib/kernel \
+ $$QT_SOURCE_TREE/src/corelib/tools \
+ $$QT_SOURCE_TREE/src/corelib/io \
+ $$QT_SOURCE_TREE/src/corelib/codecs \
+ $$QT_SOURCE_TREE/src/xml
hpux-acc*|hpuxi-acc* {
LIBS += ../bootstrap/libbootstrap.a
} else {
contains(CONFIG, debug_and_release_target) {
CONFIG(debug, debug|release) {
- LIBS+=-L../bootstrap/debug
+ LIBS+=-L$$QT_BUILD_TREE/src/tools/bootstrap/debug
} else {
- LIBS+=-L../bootstrap/release
+ LIBS+=-L$$QT_BUILD_TREE/src/tools/bootstrap/release
}
} else {
- LIBS += -L../bootstrap
+ LIBS += -L$$QT_BUILD_TREE/src/tools/bootstrap
}
LIBS += -lbootstrap
}
diff --git a/src/tools/idc/main.cpp b/src/tools/idc/main.cpp
index 48ce9cc..8fe8a70 100644
--- a/src/tools/idc/main.cpp
+++ b/src/tools/idc/main.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include <QFile>
-#include <QSysInfo>
#include <QProcess>
#include <QLibraryInfo>
#include <qt_windows.h>
@@ -87,37 +86,19 @@ static bool runWithQtInEnvironment(const QString &cmd)
static bool attachTypeLibrary(const QString &applicationName, int resource, const QByteArray &data, QString *errorMessage)
{
- HANDLE hExe = 0;
- QT_WA({
- TCHAR *resourceName = MAKEINTRESOURCEW(resource);
- hExe = BeginUpdateResourceW((TCHAR*)applicationName.utf16(), false);
- if (hExe == 0) {
- if (errorMessage)
- *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not open file.").arg(applicationName);
- return false;
- }
- if (!UpdateResourceW(hExe,L"TYPELIB",resourceName,0,(void*)data.data(),data.count())) {
- EndUpdateResource(hExe, true);
- if (errorMessage)
- *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not update file.").arg(applicationName);
- return false;
- }
- }, {
- char *resourceName = MAKEINTRESOURCEA(resource);
- hExe = BeginUpdateResourceA(applicationName.toLocal8Bit(), false);
- if (hExe == 0) {
- if (errorMessage)
- *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not open file.").arg(applicationName);
- return false;
- }
- if (!UpdateResourceA(hExe,"TYPELIB",resourceName,0,(void*)data.data(),data.count())) {
- EndUpdateResource(hExe, true);
- if (errorMessage)
- *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not update file.").arg(applicationName);
- return false;
- }
- });
-
+ HANDLE hExe = BeginUpdateResource((const wchar_t *)applicationName.utf16(), false);
+ if (hExe == 0) {
+ if (errorMessage)
+ *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not open file.").arg(applicationName);
+ return false;
+ }
+ if (!UpdateResource(hExe, L"TYPELIB", MAKEINTRESOURCE(resource), 0, (void*)data.data(), data.count())) {
+ EndUpdateResource(hExe, true);
+ if (errorMessage)
+ *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not update file.").arg(applicationName);
+ return false;
+ }
+
if (!EndUpdateResource(hExe,false)) {
if (errorMessage)
*errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not write file.").arg(applicationName);
@@ -135,12 +116,7 @@ static bool registerServer(const QString &input)
if (input.endsWith(QLatin1String(".exe"))) {
ok = runWithQtInEnvironment(quotePath(input) + QLatin1String(" -regserver"));
} else {
- HMODULE hdll = 0;
- QT_WA({
- hdll = LoadLibraryW((TCHAR*)input.utf16());
- }, {
- hdll = LoadLibraryA(input.toLocal8Bit());
- });
+ HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16());
if (!hdll) {
fprintf(stderr, "Couldn't load library file %s\n", (const char*)input.toLocal8Bit().data());
return false;
@@ -162,12 +138,7 @@ static bool unregisterServer(const QString &input)
if (input.endsWith(QLatin1String(".exe"))) {
ok = runWithQtInEnvironment(quotePath(input) + QLatin1String(" -unregserver"));
} else {
- HMODULE hdll = 0;
- QT_WA({
- hdll = LoadLibraryW((TCHAR*)input.utf16());
- }, {
- hdll = LoadLibraryA(input.toLocal8Bit());
- });
+ HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16());
if (!hdll) {
fprintf(stderr, "Couldn't load library file %s\n", (const char*)input.toLocal8Bit().data());
return false;
@@ -191,12 +162,7 @@ static HRESULT dumpIdl(const QString &input, const QString &idlfile, const QStri
if (runWithQtInEnvironment(quotePath(input) + QLatin1String(" -dumpidl ") + idlfile + QLatin1String(" -version ") + version))
res = S_OK;
} else {
- HMODULE hdll = 0;
- QT_WA({
- hdll = LoadLibraryW((TCHAR*)input.utf16());
- }, {
- hdll = LoadLibraryA(input.toLocal8Bit());
- });
+ HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16());
if (!hdll) {
fprintf(stderr, "Couldn't load library file %s\n", (const char*)input.toLocal8Bit().data());
return 3;
@@ -254,9 +220,6 @@ int runIdc(int argc, char **argv)
else
version = QLatin1String(argv[i]);
} else if (p == QLatin1String("/tlb") || p == QLatin1String("-tlb")) {
- if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)
- fprintf(stderr, "IDC requires Windows NT/2000/XP!\n");
-
++i;
if (i > argc) {
error = QLatin1String("Missing name for type library file!");
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index da5733a..797595f 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -337,11 +337,10 @@ bool Moc::testFunctionAttribute(Token tok, FunctionDef *def)
bool Moc::parseFunction(FunctionDef *def, bool inMacro)
{
def->isVirtual = false;
- while (test(INLINE) || test(STATIC) || test(VIRTUAL)
- || testFunctionAttribute(def)) {
- if (lookup() == VIRTUAL)
- def->isVirtual = true;
- }
+ //skip modifiers and attributes
+ while (test(INLINE) || test(STATIC) ||
+ (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual
+ || testFunctionAttribute(def)) {}
bool templateFunction = (lookup() == TEMPLATE);
def->type = parseType();
if (def->type.name.isEmpty()) {
@@ -429,11 +428,10 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro)
bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
{
def->isVirtual = false;
- while (test(EXPLICIT) || test(INLINE) || test(STATIC) || test(VIRTUAL)
- || testFunctionAttribute(def)) {
- if (lookup() == VIRTUAL)
- def->isVirtual = true;
- }
+ //skip modifiers and attributes
+ while (test(INLINE) || test(STATIC) ||
+ (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual
+ || testFunctionAttribute(def)) {}
bool tilde = test(TILDE);
def->type = parseType();
if (def->type.name.isEmpty())
@@ -862,7 +860,7 @@ void Moc::parseSignals(ClassDef *def)
funcDef.access = FunctionDef::Protected;
parseFunction(&funcDef);
if (funcDef.isVirtual)
- error("Signals cannot be declared virtual");
+ warning("Signals cannot be declared virtual");
if (funcDef.inlineCode)
error("Not a signal declaration");
def->signalList += funcDef;
diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp
index 1c6e3a5..bbb3af7 100644
--- a/src/tools/uic/uic.cpp
+++ b/src/tools/uic/uic.cpp
@@ -137,12 +137,12 @@ void Uic::writeCopyrightHeader(DomUI *ui)
out << "/*\n" << comment << "\n*/\n\n";
out << "/********************************************************************************\n";
- out << "** Form generated from reading ui file '" << QFileInfo(opt.inputFile).fileName() << "'\n";
+ out << "** Form generated from reading UI file '" << QFileInfo(opt.inputFile).fileName() << "'\n";
out << "**\n";
out << "** Created: " << QDateTime::currentDateTime().toString() << "\n";
out << "** " << QString::fromLatin1("by: Qt User Interface Compiler version %1\n").arg(QLatin1String(QT_VERSION_STR));
out << "**\n";
- out << "** WARNING! All changes made in this file will be lost when recompiling ui file!\n";
+ out << "** WARNING! All changes made in this file will be lost when recompiling UI file!\n";
out << "********************************************************************************/\n\n";
}
diff --git a/src/tools/uic3/main.cpp b/src/tools/uic3/main.cpp
index 38afc60..f4a9cba 100644
--- a/src/tools/uic3/main.cpp
+++ b/src/tools/uic3/main.cpp
@@ -114,7 +114,7 @@ int runUic3(int argc, char * argv[])
wrap = true;
if (opt == "wrap" || opt[1] == '\0') {
if (!(n < argc-1)) {
- error = "Missing name of converted ui file";
+ error = "Missing name of converted UI file";
break;
}
convertedUiFile = argv[++n];
@@ -230,7 +230,7 @@ int runUic3(int argc, char * argv[])
" %s [options] -decl <uiheaderfile> <uifile>\n"
"\t<uiheaderfile> name of the data file\n"
" %s [options] -wrap <converteduifile> <uifile>\n"
- "\t<converteduifile> name of the converted ui file\n"
+ "\t<converteduifile> name of the converted UI file\n"
"Generate implementation:\n"
" %s [options] -impl <headerfile> <uifile>\n"
"\t<headerfile> name of the declaration file\n"
@@ -254,7 +254,7 @@ int runUic3(int argc, char * argv[])
"\t-pch file Add #include \"file\" as the first statement in implementation\n"
"\t-nofwd Omit forward declarations of custom classes\n"
"\t-no-implicit-includes Do not generate #include-directives for custom classes\n"
- "\t-nounload Don't unload plugins after processing\n"
+ "\t-nounload Do not unload plugins after processing\n"
"\t-tr func Use func() instead of tr() for i18n\n"
"\t-L path Additional plugin search path\n"
"\t-version Display version of uic\n"
diff --git a/src/tools/uic3/uic.cpp b/src/tools/uic3/uic.cpp
index e911844..16b2754 100644
--- a/src/tools/uic3/uic.cpp
+++ b/src/tools/uic3/uic.cpp
@@ -144,12 +144,12 @@ void Uic::writeCopyrightHeader(DomUI *ui)
out << "/*\n" << comment << "\n*/\n\n";
out << "/********************************************************************************\n";
- out << "** Form generated from reading ui file '" << QFileInfo(opt.inputFile).fileName() << "'\n";
+ out << "** Form generated from reading UI file '" << QFileInfo(opt.inputFile).fileName() << "'\n";
out << "**\n";
out << "** Created: " << QDateTime::currentDateTime().toString() << "\n";
out << "** " << QString::fromLatin1("by: Qt User Interface Compiler version %1\n").arg(QLatin1String(QT_VERSION_STR));
out << "**\n";
- out << "** WARNING! All changes made in this file will be lost when recompiling ui file!\n";
+ out << "** WARNING! All changes made in this file will be lost when recompiling UI file!\n";
out << "********************************************************************************/\n\n";
}
diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp
index c266cbf..5f929d6 100644
--- a/src/winmain/qtmain_win.cpp
+++ b/src/winmain/qtmain_win.cpp
@@ -89,18 +89,12 @@ extern "C"
int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR /*cmdParamarg*/, int cmdShow)
#endif
{
- QByteArray cmdParam;
- QT_WA({
- LPTSTR cmdline = GetCommandLineW();
- cmdParam = QString::fromUtf16((const unsigned short *)cmdline).toLocal8Bit();
- }, {
- cmdParam = GetCommandLineA();
- });
+ QByteArray cmdParam = QString::fromWCharArray(GetCommandLine()).toLocal8Bit();
#if defined(Q_OS_WINCE)
- TCHAR appName[256];
- GetModuleFileName(0, appName, 255);
- cmdParam.prepend(QString::fromLatin1("\"%1\" ").arg(QString::fromUtf16((const unsigned short *)appName)).toLocal8Bit());
+ wchar_t appName[MAX_PATH];
+ GetModuleFileName(0, appName, MAX_PATH);
+ cmdParam.prepend(QString(QLatin1String("\"%1\" ")).arg(QString::fromWCharArray(appName)).toLocal8Bit());
#endif
int argc = 0;
@@ -108,9 +102,9 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR /*cmdPara
qWinMain(instance, prevInstance, cmdParam.data(), cmdShow, argc, argv);
#if defined(Q_OS_WINCE)
- TCHAR uniqueAppID[256];
- GetModuleFileName(0, uniqueAppID, 255);
- QString uid = QString::fromUtf16((const unsigned short *)uniqueAppID).toLower().replace(QLatin1Char('\\'), QLatin1Char('_'));
+ wchar_t uniqueAppID[MAX_PATH];
+ GetModuleFileName(0, uniqueAppID, MAX_PATH);
+ QString uid = QString::fromWCharArray(uniqueAppID).toLower().replace(QLatin1String("\\"), QLatin1String("_"));
// If there exists an other instance of this application
// it will be the owner of a mutex with the unique ID.
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index dec273d..125e939 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -2411,7 +2411,7 @@ events are reported.
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
void QXmlDefaultHandler::setDocumentLocator(QXmlLocator*)
{
@@ -2420,7 +2420,7 @@ void QXmlDefaultHandler::setDocumentLocator(QXmlLocator*)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::startDocument()
{
@@ -2430,7 +2430,7 @@ bool QXmlDefaultHandler::startDocument()
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::endDocument()
{
@@ -2440,7 +2440,7 @@ bool QXmlDefaultHandler::endDocument()
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::startPrefixMapping(const QString&, const QString&)
{
@@ -2450,7 +2450,7 @@ bool QXmlDefaultHandler::startPrefixMapping(const QString&, const QString&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::endPrefixMapping(const QString&)
{
@@ -2460,7 +2460,7 @@ bool QXmlDefaultHandler::endPrefixMapping(const QString&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::startElement(const QString&, const QString&,
const QString&, const QXmlAttributes&)
@@ -2471,7 +2471,7 @@ bool QXmlDefaultHandler::startElement(const QString&, const QString&,
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::endElement(const QString&, const QString&,
const QString&)
@@ -2482,7 +2482,7 @@ bool QXmlDefaultHandler::endElement(const QString&, const QString&,
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::characters(const QString&)
{
@@ -2492,7 +2492,7 @@ bool QXmlDefaultHandler::characters(const QString&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::ignorableWhitespace(const QString&)
{
@@ -2502,7 +2502,7 @@ bool QXmlDefaultHandler::ignorableWhitespace(const QString&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::processingInstruction(const QString&,
const QString&)
@@ -2513,7 +2513,7 @@ bool QXmlDefaultHandler::processingInstruction(const QString&,
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::skippedEntity(const QString&)
{
@@ -2523,7 +2523,7 @@ bool QXmlDefaultHandler::skippedEntity(const QString&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::warning(const QXmlParseException&)
{
@@ -2533,7 +2533,7 @@ bool QXmlDefaultHandler::warning(const QXmlParseException&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::error(const QXmlParseException&)
{
@@ -2543,7 +2543,7 @@ bool QXmlDefaultHandler::error(const QXmlParseException&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::fatalError(const QXmlParseException&)
{
@@ -2553,7 +2553,7 @@ bool QXmlDefaultHandler::fatalError(const QXmlParseException&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::notationDecl(const QString&, const QString&,
const QString&)
@@ -2564,7 +2564,7 @@ bool QXmlDefaultHandler::notationDecl(const QString&, const QString&,
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::unparsedEntityDecl(const QString&, const QString&,
const QString&, const QString&)
@@ -2598,7 +2598,7 @@ QString QXmlDefaultHandler::errorString() const
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::startDTD(const QString&, const QString&, const QString&)
{
@@ -2608,7 +2608,7 @@ bool QXmlDefaultHandler::startDTD(const QString&, const QString&, const QString&
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::endDTD()
{
@@ -2618,7 +2618,7 @@ bool QXmlDefaultHandler::endDTD()
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::startEntity(const QString&)
{
@@ -2628,7 +2628,7 @@ bool QXmlDefaultHandler::startEntity(const QString&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::endEntity(const QString&)
{
@@ -2638,7 +2638,7 @@ bool QXmlDefaultHandler::endEntity(const QString&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::startCDATA()
{
@@ -2648,7 +2648,7 @@ bool QXmlDefaultHandler::startCDATA()
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::endCDATA()
{
@@ -2658,7 +2658,7 @@ bool QXmlDefaultHandler::endCDATA()
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::comment(const QString&)
{
@@ -2668,7 +2668,7 @@ bool QXmlDefaultHandler::comment(const QString&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::attributeDecl(const QString&, const QString&, const QString&, const QString&, const QString&)
{
@@ -2678,7 +2678,7 @@ bool QXmlDefaultHandler::attributeDecl(const QString&, const QString&, const QSt
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::internalEntityDecl(const QString&, const QString&)
{
@@ -2688,7 +2688,7 @@ bool QXmlDefaultHandler::internalEntityDecl(const QString&, const QString&)
/*!
\reimp
- Does nothing.
+ This reimplementation does nothing.
*/
bool QXmlDefaultHandler::externalEntityDecl(const QString&, const QString&, const QString&)
{
diff --git a/src/xmlpatterns/Doxyfile b/src/xmlpatterns/Doxyfile
index 60a6c77..83f7062 100644
--- a/src/xmlpatterns/Doxyfile
+++ b/src/xmlpatterns/Doxyfile
@@ -1157,7 +1157,7 @@ DOT_PATH =
# contain dot files that are included in the documentation (see the
# \dotfile command).
-DOTFILE_DIRS =
+DOTFILE_DIRS = schema/doc/
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, which results in a white background.
diff --git a/src/xmlpatterns/acceltree/qacceltree.cpp b/src/xmlpatterns/acceltree/qacceltree.cpp
index 6111af2..83ea949 100644
--- a/src/xmlpatterns/acceltree/qacceltree.cpp
+++ b/src/xmlpatterns/acceltree/qacceltree.cpp
@@ -42,6 +42,7 @@
#include <QStack>
#include "qabstractxmlreceiver.h"
+#include "qabstractxmlnodemodel_p.h"
#include "qacceliterators_p.h"
#include "qacceltree_p.h"
#include "qatomicstring_p.h"
@@ -55,6 +56,37 @@ QT_BEGIN_NAMESPACE
using namespace QPatternist;
+namespace QPatternist {
+
+ class AccelTreePrivate : public QAbstractXmlNodeModelPrivate
+ {
+ public:
+ AccelTreePrivate(AccelTree *accelTree)
+ : m_accelTree(accelTree)
+ {
+ }
+
+ virtual QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const
+ {
+ return m_accelTree->sourceLocation(index);
+ }
+
+ private:
+ AccelTree *m_accelTree;
+ };
+}
+
+AccelTree::AccelTree(const QUrl &docURI, const QUrl &bURI)
+ : QAbstractXmlNodeModel(new AccelTreePrivate(this))
+ , m_documentURI(docURI)
+ , m_baseURI(bURI)
+{
+ /* Pre-allocate at least a little bit. */
+ // TODO. Do it according to what an average 4 KB doc contains.
+ basicData.reserve(100);
+ data.reserve(30);
+}
+
void AccelTree::printStats(const NamePool::Ptr &np) const
{
Q_ASSERT(np);
@@ -674,6 +706,17 @@ void AccelTree::copyNodeTo(const QXmlNodeModelIndex &node,
}
+QSourceLocation AccelTree::sourceLocation(const QXmlNodeModelIndex &index) const
+{
+ const PreNumber key = toPreNumber(index);
+ if (sourcePositions.contains(key)) {
+ const QPair<qint64, qint64> position = sourcePositions.value(key);
+ return QSourceLocation(m_documentURI, position.first, position.second);
+ } else {
+ return QSourceLocation();
+ }
+}
+
void AccelTree::copyChildren(const QXmlNodeModelIndex &node,
QAbstractXmlReceiver *const receiver,
const NodeCopySettings &settings) const
diff --git a/src/xmlpatterns/acceltree/qacceltree_p.h b/src/xmlpatterns/acceltree/qacceltree_p.h
index 38de08c..0c68fab 100644
--- a/src/xmlpatterns/acceltree/qacceltree_p.h
+++ b/src/xmlpatterns/acceltree/qacceltree_p.h
@@ -91,6 +91,7 @@ namespace QPatternist
*/
class AccelTree : public QAbstractXmlNodeModel
{
+ friend class AccelTreePrivate;
public:
using QAbstractXmlNodeModel::createIndex;
@@ -99,15 +100,7 @@ namespace QPatternist
typedef PreNumber PostNumber;
typedef qint8 Depth;
- inline AccelTree(const QUrl &docURI,
- const QUrl &bURI) : m_documentURI(docURI),
- m_baseURI(bURI)
- {
- /* Pre-allocate at least a little bit. */
- // TODO. Do it according to what an average 4 KB doc contains.
- basicData.reserve(100);
- data.reserve(30);
- }
+ AccelTree(const QUrl &docURI, const QUrl &bURI);
/**
* @short Houses data for a node, and that all node kinds have.
@@ -280,6 +273,7 @@ namespace QPatternist
QHash<PreNumber, QString> data;
QVector<BasicNodeData> basicData;
+ QHash<PreNumber, QPair<qint64, qint64> > sourcePositions;
inline QUrl documentUri() const
{
@@ -381,6 +375,11 @@ namespace QPatternist
private:
/**
+ * Returns the source location for the object with the given @p index.
+ */
+ QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const;
+
+ /**
* Copies the children of @p node to @p receiver.
*/
inline void copyChildren(const QXmlNodeModelIndex &node,
diff --git a/src/xmlpatterns/acceltree/qacceltreebuilder.cpp b/src/xmlpatterns/acceltree/qacceltreebuilder.cpp
index 63372ac..e58cc92 100644
--- a/src/xmlpatterns/acceltree/qacceltreebuilder.cpp
+++ b/src/xmlpatterns/acceltree/qacceltreebuilder.cpp
@@ -49,15 +49,17 @@ template <bool FromDocument>
AccelTreeBuilder<FromDocument>::AccelTreeBuilder(const QUrl &docURI,
const QUrl &baseURI,
const NamePool::Ptr &np,
- ReportContext *const context) : m_preNumber(-1)
- , m_isPreviousAtomic(false)
- , m_hasCharacters(false)
- , m_isCharactersCompressed(false)
- , m_namePool(np)
- , m_document(new AccelTree(docURI, baseURI))
- , m_skippedDocumentNodes(0)
- , m_documentURI(docURI)
- , m_context(context)
+ ReportContext *const context,
+ Features features) : m_preNumber(-1)
+ , m_isPreviousAtomic(false)
+ , m_hasCharacters(false)
+ , m_isCharactersCompressed(false)
+ , m_namePool(np)
+ , m_document(new AccelTree(docURI, baseURI))
+ , m_skippedDocumentNodes(0)
+ , m_documentURI(docURI)
+ , m_context(context)
+ , m_features(features)
{
Q_ASSERT(m_namePool);
@@ -126,9 +128,18 @@ void AccelTreeBuilder<FromDocument>::item(const Item &it)
template <bool FromDocument>
void AccelTreeBuilder<FromDocument>::startElement(const QXmlName &name)
{
+ startElement(name, 1, 1);
+}
+
+template <bool FromDocument>
+void AccelTreeBuilder<FromDocument>::startElement(const QXmlName &name, qint64 line, qint64 column)
+{
startStructure();
- m_document->basicData.append(AccelTree::BasicNodeData(currentDepth(), currentParent(), QXmlNodeModelIndex::Element, -1, name));
+ AccelTree::BasicNodeData data(currentDepth(), currentParent(), QXmlNodeModelIndex::Element, -1, name);
+ m_document->basicData.append(data);
+ if (m_features & SourceLocationsFeature)
+ m_document->sourcePositions.insert(m_document->maximumPreNumber(), qMakePair(line, column));
++m_preNumber;
m_ancestors.push(m_preNumber);
diff --git a/src/xmlpatterns/acceltree/qacceltreebuilder_p.h b/src/xmlpatterns/acceltree/qacceltreebuilder_p.h
index 6eb3102..5f6a287 100644
--- a/src/xmlpatterns/acceltree/qacceltreebuilder_p.h
+++ b/src/xmlpatterns/acceltree/qacceltreebuilder_p.h
@@ -90,15 +90,27 @@ namespace QPatternist
typedef QExplicitlySharedDataPointer<AccelTreeBuilder> Ptr;
/**
+ * Describes the memory relevant features the builder shall support.
+ */
+ enum Feature
+ {
+ NoneFeature, ///< No special features are enabled.
+ SourceLocationsFeature = 1 ///< The accel tree builder will store source locations for each start element.
+ };
+ Q_DECLARE_FLAGS(Features, Feature)
+
+ /**
* @param context may be @c null.
*/
AccelTreeBuilder(const QUrl &docURI,
const QUrl &baseURI,
const NamePool::Ptr &np,
- ReportContext *const context);
+ ReportContext *const context,
+ Features features = NoneFeature);
virtual void startDocument();
virtual void endDocument();
virtual void startElement(const QXmlName &name);
+ void startElement(const QXmlName &name, qint64 line, qint64 column);
virtual void endElement();
virtual void attribute(const QXmlName &name, const QStringRef &value);
virtual void characters(const QStringRef &ch);
@@ -175,8 +187,13 @@ namespace QPatternist
* a member.
*/
ReportContext *const m_context;
+
+ Features m_features;
};
+ Q_DECLARE_OPERATORS_FOR_FLAGS(AccelTreeBuilder<true>::Features)
+ Q_DECLARE_OPERATORS_FOR_FLAGS(AccelTreeBuilder<false>::Features)
+
#include "qacceltreebuilder.cpp"
}
diff --git a/src/xmlpatterns/acceltree/qacceltreeresourceloader.cpp b/src/xmlpatterns/acceltree/qacceltreeresourceloader.cpp
index 0e59821..1cd84db 100644
--- a/src/xmlpatterns/acceltree/qacceltreeresourceloader.cpp
+++ b/src/xmlpatterns/acceltree/qacceltreeresourceloader.cpp
@@ -46,7 +46,6 @@
#include <QtNetwork/QNetworkRequest>
-#include "qacceltreebuilder_p.h"
#include "qatomicstring_p.h"
#include "qautoptr_p.h"
#include "qcommonsequencetypes_p.h"
@@ -57,14 +56,12 @@ QT_BEGIN_NAMESPACE
using namespace QPatternist;
-static inline uint qHash(const QUrl &uri)
-{
- return qHash(uri.toString());
-}
-
AccelTreeResourceLoader::AccelTreeResourceLoader(const NamePool::Ptr &np,
- const NetworkAccessDelegator::Ptr &manager) : m_namePool(np)
- , m_networkAccessDelegator(manager)
+ const NetworkAccessDelegator::Ptr &manager,
+ AccelTreeBuilder<true>::Features features)
+ : m_namePool(np)
+ , m_networkAccessDelegator(manager)
+ , m_features(features)
{
Q_ASSERT(m_namePool);
Q_ASSERT(m_networkAccessDelegator);
@@ -74,7 +71,7 @@ bool AccelTreeResourceLoader::retrieveDocument(const QUrl &uri,
const ReportContext::Ptr &context)
{
Q_ASSERT(uri.isValid());
- AccelTreeBuilder<true> builder(uri, uri, m_namePool, context.data());
+ AccelTreeBuilder<true> builder(uri, uri, m_namePool, context.data(), m_features);
const AutoPtr<QNetworkReply> reply(load(uri, m_networkAccessDelegator, context));
@@ -88,18 +85,35 @@ bool AccelTreeResourceLoader::retrieveDocument(const QUrl &uri,
return success;
}
+bool AccelTreeResourceLoader::retrieveDocument(QIODevice *source, const QUrl &documentUri, const ReportContext::Ptr &context)
+{
+ Q_ASSERT(source);
+ Q_ASSERT(source->isReadable());
+ Q_ASSERT(documentUri.isValid());
+
+ AccelTreeBuilder<true> builder(documentUri, documentUri, m_namePool, context.data(), m_features);
+
+ bool success = false;
+ success = streamToReceiver(source, &builder, m_namePool, context, documentUri);
+
+ m_loadedDocuments.insert(documentUri, builder.builtDocument());
+
+ return success;
+}
+
QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri,
const NetworkAccessDelegator::Ptr &networkDelegator,
- const ReportContext::Ptr &context)
+ const ReportContext::Ptr &context, ErrorHandling errorHandling)
{
return load(uri,
networkDelegator->managerFor(uri),
- context);
+ context, errorHandling);
}
QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri,
QNetworkAccessManager *const networkManager,
- const ReportContext::Ptr &context)
+ const ReportContext::Ptr &context, ErrorHandling errorHandling)
+
{
Q_ASSERT(networkManager);
Q_ASSERT(uri.isValid());
@@ -120,7 +134,7 @@ QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri,
const QSourceLocation location(uri);
- if(context)
+ if(context && (errorHandling == FailOnError))
context->error(errorMessage, ReportContext::FODC0002, location);
return 0;
@@ -130,7 +144,7 @@ QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri,
}
bool AccelTreeResourceLoader::streamToReceiver(QIODevice *const dev,
- QAbstractXmlReceiver *const receiver,
+ AccelTreeBuilder<true> *const receiver,
const NamePool::Ptr &np,
const ReportContext::Ptr &context,
const QUrl &uri)
@@ -154,7 +168,7 @@ bool AccelTreeResourceLoader::streamToReceiver(QIODevice *const dev,
{
/* Send the name. */
receiver->startElement(np->allocateQName(reader.namespaceUri().toString(), reader.name().toString(),
- reader.prefix().toString()));
+ reader.prefix().toString()), reader.lineNumber(), reader.columnNumber());
/* Send namespace declarations. */
const QXmlStreamNamespaceDeclarations &nss = reader.namespaceDeclarations();
@@ -263,6 +277,22 @@ Item AccelTreeResourceLoader::openDocument(const QUrl &uri,
}
}
+Item AccelTreeResourceLoader::openDocument(QIODevice *source, const QUrl &documentUri,
+ const ReportContext::Ptr &context)
+{
+ const AccelTree::Ptr doc(m_loadedDocuments.value(documentUri));
+
+ if(doc)
+ return doc->root(QXmlNodeModelIndex()); /* Pass in dummy object. We know AccelTree doesn't use it. */
+ else
+ {
+ if(retrieveDocument(source, documentUri, context))
+ return m_loadedDocuments.value(documentUri)->root(QXmlNodeModelIndex()); /* Pass in dummy object. We know AccelTree doesn't use it. */
+ else
+ return Item();
+ }
+}
+
SequenceType::Ptr AccelTreeResourceLoader::announceDocument(const QUrl &uri, const Usage)
{
// TODO deal with the usage thingy
diff --git a/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h b/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h
index a650dfa..f24a88e 100644
--- a/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h
+++ b/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h
@@ -52,12 +52,12 @@
#ifndef Patternist_AccelTreeResourceLoader_H
#define Patternist_AccelTreeResourceLoader_H
-#include <QtCore/QHash>
#include <QtCore/QEventLoop>
#include <QtNetwork/QNetworkReply>
#include "qabstractxmlreceiver.h"
#include "qacceltree_p.h"
+#include "qacceltreebuilder_p.h"
#include "qdeviceresourceloader_p.h"
#include "qnamepool_p.h"
#include "qnetworkaccessdelegator_p.h"
@@ -115,13 +115,25 @@ namespace QPatternist
{
public:
/**
+ * Describes the behaviour of the resource loader in case of an
+ * error.
+ */
+ enum ErrorHandling
+ {
+ FailOnError, ///< The resource loader will report the error via the report context.
+ ContinueOnError ///< The resource loader will report no error and return an empty QNetworkReply.
+ };
+
+ /**
* AccelTreeResourceLoader does not own @p context.
*/
AccelTreeResourceLoader(const NamePool::Ptr &np,
- const NetworkAccessDelegator::Ptr &networkDelegator);
+ const NetworkAccessDelegator::Ptr &networkDelegator, AccelTreeBuilder<true>::Features = AccelTreeBuilder<true>::NoneFeature);
virtual Item openDocument(const QUrl &uri,
const ReportContext::Ptr &context);
+ virtual Item openDocument(QIODevice *source, const QUrl &documentUri,
+ const ReportContext::Ptr &context);
virtual SequenceType::Ptr announceDocument(const QUrl &uri, const Usage usageHint);
virtual bool isDocumentAvailable(const QUrl &uri);
@@ -133,7 +145,6 @@ namespace QPatternist
const ReportContext::Ptr &context,
const SourceLocationReflection *const where);
-
/**
* @short Helper function that do NetworkAccessDelegator::get(), but
* does it blocked.
@@ -149,14 +160,14 @@ namespace QPatternist
*/
static QNetworkReply *load(const QUrl &uri,
QNetworkAccessManager *const networkManager,
- const ReportContext::Ptr &context);
+ const ReportContext::Ptr &context, ErrorHandling handling = FailOnError);
/**
* @overload
*/
static QNetworkReply *load(const QUrl &uri,
const NetworkAccessDelegator::Ptr &networkDelegator,
- const ReportContext::Ptr &context);
+ const ReportContext::Ptr &context, ErrorHandling handling = FailOnError);
/**
* @short Returns the URIs this AccelTreeResourceLoader has loaded
@@ -165,14 +176,17 @@ namespace QPatternist
virtual QSet<QUrl> deviceURIs() const;
virtual void clear(const QUrl &uri);
+
private:
static bool streamToReceiver(QIODevice *const dev,
- QAbstractXmlReceiver *const receiver,
+ AccelTreeBuilder<true> *const receiver,
const NamePool::Ptr &np,
const ReportContext::Ptr &context,
const QUrl &uri);
bool retrieveDocument(const QUrl &uri,
const ReportContext::Ptr &context);
+ bool retrieveDocument(QIODevice *source, const QUrl &documentUri,
+ const ReportContext::Ptr &context);
/**
* If @p context is @c null, no error reporting should be done.
*/
@@ -185,6 +199,7 @@ namespace QPatternist
const NamePool::Ptr m_namePool;
const NetworkAccessDelegator::Ptr m_networkAccessDelegator;
QHash<QPair<QUrl, QString>, QString> m_unparsedTexts;
+ AccelTreeBuilder<true>::Features m_features;
};
}
diff --git a/src/xmlpatterns/api/api.pri b/src/xmlpatterns/api/api.pri
index a0298f2..9fcc2f5 100644
--- a/src/xmlpatterns/api/api.pri
+++ b/src/xmlpatterns/api/api.pri
@@ -3,11 +3,13 @@ HEADERS += $$PWD/qabstractxmlforwarditerator_p.h \
$$PWD/qabstracturiresolver.h \
$$PWD/qabstractxmlnodemodel.h \
$$PWD/qabstractxmlnodemodel_p.h \
+ $$PWD/qabstractxmlpullprovider_p.h \
$$PWD/qabstractxmlreceiver.h \
$$PWD/qabstractxmlreceiver_p.h \
$$PWD/qdeviceresourceloader_p.h \
$$PWD/qiodevicedelegate_p.h \
$$PWD/qnetworkaccessdelegator_p.h \
+ $$PWD/qpullbridge_p.h \
$$PWD/qresourcedelegator_p.h \
$$PWD/qsimplexmlnodemodel.h \
$$PWD/qsourcelocation.h \
@@ -20,6 +22,10 @@ HEADERS += $$PWD/qabstractxmlforwarditerator_p.h \
$$PWD/qxmlquery_p.h \
$$PWD/qxmlresultitems.h \
$$PWD/qxmlresultitems_p.h \
+ $$PWD/qxmlschema.h \
+ $$PWD/qxmlschema_p.h \
+ $$PWD/qxmlschemavalidator.h \
+ $$PWD/qxmlschemavalidator_p.h \
$$PWD/qxmlserializer.h \
$$PWD/qxmlserializer_p.h \
$$PWD/../../../tools/xmlpatterns/qcoloringmessagehandler_p.h \
@@ -29,9 +35,11 @@ SOURCES += $$PWD/qvariableloader.cpp \
$$PWD/qabstractmessagehandler.cpp \
$$PWD/qabstracturiresolver.cpp \
$$PWD/qabstractxmlnodemodel.cpp \
+ $$PWD/qabstractxmlpullprovider.cpp \
$$PWD/qabstractxmlreceiver.cpp \
$$PWD/qiodevicedelegate.cpp \
$$PWD/qnetworkaccessdelegator.cpp \
+ $$PWD/qpullbridge.cpp \
$$PWD/qresourcedelegator.cpp \
$$PWD/qsimplexmlnodemodel.cpp \
$$PWD/qsourcelocation.cpp \
@@ -41,6 +49,9 @@ SOURCES += $$PWD/qvariableloader.cpp \
$$PWD/qxmlnamepool.cpp \
$$PWD/qxmlquery.cpp \
$$PWD/qxmlresultitems.cpp \
+ $$PWD/qxmlschema.cpp \
+ $$PWD/qxmlschema_p.cpp \
+ $$PWD/qxmlschemavalidator.cpp \
$$PWD/qxmlserializer.cpp \
$$PWD/../../../tools/xmlpatterns/qcoloringmessagehandler.cpp \
$$PWD/../../../tools/xmlpatterns/qcoloroutput.cpp
diff --git a/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h b/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h
index d3188d3..b4eefeb 100644
--- a/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h
+++ b/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h
@@ -55,7 +55,7 @@
#include <QtCore/QList>
#include <QtCore/QVector>
#include <QtCore/QSharedData>
-
+#include <QtCore/QString>
QT_BEGIN_HEADER
@@ -74,6 +74,19 @@ inline bool qIsForwardIteratorEnd(const T &unit)
return !unit;
}
+/**
+ * @short Helper class for StringSplitter
+ *
+ * Needed by the QAbstractXmlForwardIterator sub-class.
+ *
+ * @relates StringSplitter
+ */
+template<>
+inline bool qIsForwardIteratorEnd(const QString &unit)
+{
+ return unit.isNull();
+}
+
template<typename T> class QAbstractXmlForwardIterator;
class QAbstractXmlForwardIteratorPrivate;
diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
index fb45ea7..847d899 100644
--- a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
+++ b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
@@ -1665,4 +1665,20 @@ void QAbstractXmlNodeModel::copyNodeTo(const QXmlNodeModelIndex &node,
"This function is not expected to be called.");
}
+/*!
+ Returns the source location for the object with the given \a index
+ or a default constructed QSourceLocation in case no location
+ information is available.
+
+ \since 4.6
+*/
+QSourceLocation QAbstractXmlNodeModel::sourceLocation(const QXmlNodeModelIndex &index) const
+{
+ // TODO: make this method virtual in Qt5 to allow source location support in custom models
+ if (d_ptr)
+ return d_ptr->sourceLocation(index);
+ else
+ return QSourceLocation();
+}
+
QT_END_NAMESPACE
diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.h b/src/xmlpatterns/api/qabstractxmlnodemodel.h
index 072c12f..71cd93e 100644
--- a/src/xmlpatterns/api/qabstractxmlnodemodel.h
+++ b/src/xmlpatterns/api/qabstractxmlnodemodel.h
@@ -57,6 +57,7 @@ QT_MODULE(XmlPatterns)
class QAbstractXmlNodeModel;
class QAbstractXmlNodeModelPrivate;
class QAbstractXmlReceiver;
+class QSourceLocation;
class QUrl;
class QXmlName;
class QXmlNodeModelIndex;
@@ -70,6 +71,7 @@ namespace QPatternist
class DynamicContext;
class Item;
class ItemType;
+ class XsdValidatedXmlNodeModel;
template<typename TResult, typename TSource, typename TMapper, typename Context> class ItemMappingIterator;
template<typename TResult, typename TSource, typename TMapper> class SequenceMappingIterator;
typedef QExplicitlySharedDataPointer<ItemType> ItemTypePtr;
@@ -316,6 +318,8 @@ public:
QAbstractXmlReceiver *const receiver,
const NodeCopySettings &) const;
+ QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const;
+
protected:
virtual QXmlNodeModelIndex nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &origin) const = 0;
@@ -344,6 +348,7 @@ protected:
private:
friend class QPatternist::ItemMappingIterator<QXmlNodeModelIndex, QXmlNodeModelIndex, const QAbstractXmlNodeModel *, QExplicitlySharedDataPointer<QPatternist::DynamicContext> >;
friend class QPatternist::SequenceMappingIterator<QXmlNodeModelIndex, QXmlNodeModelIndex, const QAbstractXmlNodeModel *>;
+ friend class QPatternist::XsdValidatedXmlNodeModel;
inline QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<QXmlNodeModelIndex> > mapToSequence(const QXmlNodeModelIndex &ni,
const QExplicitlySharedDataPointer<QPatternist::DynamicContext> &) const;
diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel_p.h b/src/xmlpatterns/api/qabstractxmlnodemodel_p.h
index 5d9e0eb..9061616 100644
--- a/src/xmlpatterns/api/qabstractxmlnodemodel_p.h
+++ b/src/xmlpatterns/api/qabstractxmlnodemodel_p.h
@@ -52,6 +52,9 @@
#ifndef QABSTRACTXMLNODEMODEL_P_H
#define QABSTRACTXMLNODEMODEL_P_H
+#include "qabstractxmlnodemodel.h"
+#include "qsourcelocation.h"
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -62,6 +65,13 @@ public:
virtual ~QAbstractXmlNodeModelPrivate()
{
}
+
+ virtual QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const
+ {
+ Q_UNUSED(index);
+
+ return QSourceLocation();
+ }
};
QT_END_NAMESPACE
diff --git a/src/xmlpatterns/api/qabstractxmlpullprovider.cpp b/src/xmlpatterns/api/qabstractxmlpullprovider.cpp
new file mode 100644
index 0000000..f006988
--- /dev/null
+++ b/src/xmlpatterns/api/qabstractxmlpullprovider.cpp
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QHash>
+
+#include "qxmlname.h"
+#include "qnamepool_p.h"
+#include "qabstractxmlpullprovider_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+// TODO have example where query selects, and the events for the result are indented
+
+/*!
+ \internal
+ \class AbstractXmlPullProvider
+ \brief The AbstractXmlPullProvider class provides a pull-based stream interface for the XPath Data Model.
+ \reentrant
+ \ingroup xml-tools
+
+ AbstractXmlPullProvider allows a stream of items from the XPath Data Model -- essentially XML --
+ to be iterated over. The subclass of AbstractXmlPullProvider provides the events, and the
+ user calling next() and so on, consumes them. AbstractXmlPullProvider can be considered
+ a forward-only, non-reversible iterator.
+
+ Note that the content the events describes, are not necessarily a well-formed XML document, but
+ rather an instance of the XPath Data model, to be specific. For instance, maybe a pull provider
+ returns two atomic values, followed by an element tree, and at the end two document nodes.
+
+ If you are subclassing AbstractXmlPullProvider, be careful to correctly implement
+ the behaviors, as described for the individual members and events.
+
+ \sa AbstractXmlPullProvider::Event
+ */
+
+/*!
+ \enum AbstractXmlPullProvider::Event
+ \value StartOfInput The value AbstractXmlPullProvider::current() returns before the first call to next().
+ \value AtomicValue an atomic value such as an \c xs:integer, \c xs:hexBinary, or \c xs:dateTime. Atomic values
+ can only be top level items.
+ \value StartDocument Signals the start of a document node. Note that a AbstractXmlPullProvider can provide
+ a sequence of document nodes.
+ \value EndDocument Signals the end of a document node. StartDocument and EndDocument are always balanced
+ and always top-level events. For instance, StartDocument can never appear after any StartElement
+ events that hasn't been balanced by the corresponding amount of EndElement events.
+ \value StartElement Signals an element start tag.
+ \value EndElement Signals the end of an element. StartElement and EndElement events are always balanced.
+ \value Text Signals a text node. Adjacent text nodes cannot occur.
+ \value ProcessingInstruction A processing instruction. Its name is returned from name(), and its value in stringValue().
+ \value Comment a comment node. Its value can be retrieved with stingValue().
+ \value Attribute Signals an attribute node. Attribute events can only appear after Namespace events, or
+ if no such are sent, after the StartElement. In addition they must appear sequentially,
+ and each name must be unique. The ordering of attribute events is undefined and insignificant.
+ \value Namespace Signals a namespace binding. They occur very infrequently and are not needed for attributes
+ and elements. Namespace events can only appear after the StartElement event. The
+ ordering of namespace events is undefined and insignificant.
+ \value EndOfInput When next() is called after the last event, EndOfInput is returned.
+
+ \sa AbstractXmlPullProvider::current()
+ */
+
+/*!
+ Constucts a AbstractXmlPullProvider instance.
+ */
+AbstractXmlPullProvider::AbstractXmlPullProvider()
+{
+}
+
+/*!
+ Destructs this AbstractXmlPullProvider.
+ */
+AbstractXmlPullProvider::~AbstractXmlPullProvider()
+{
+}
+
+/*!
+ \fn Event AbstractXmlPullProvider::next() = 0;
+ Advances this AbstractXmlPullProvider, and returns the new event.
+
+ \sa current()
+ */
+
+/*!
+ \fn Event AbstractXmlPullProvider::current() const = 0;
+ Returns the event that next() returned the last time it was called. It doesn't
+ alter this AbstractXmlPullProvider.
+
+ current() may not modify this AbstractXmlPullProvider's state. Subsequent calls to current()
+ must return the same value.
+
+ \sa AbstractXmlPullProvider::Event
+ */
+
+/*!
+ \fn QName AbstractXmlPullProvider::name() const = 0;
+ If the current event is StartElement,
+ EndElement, ProcessingInstruction, Attribute, or Namespace, the node's name is returned.
+
+ If the current event is ProcessingInstruction,
+ the processing instruction target is in in the local name.
+
+ If the current event is Namespace, the name's namespace URI is the namespace, and
+ the local name is the prefix the name is binding to.
+
+ In all other cases, an invalid QName is returned.
+ */
+
+/*!
+ \fn QVariant AbstractXmlPullProvider::atomicValue() const = 0;
+
+ If current() event is AtomicValue, the atomic value is returned as a QVariant.
+ In all other cases, this function returns a null QVariant.
+ */
+
+/*!
+ \fn QString AbstractXmlPullProvider::stringValue() const = 0;
+
+ If current() is Text, the text node's value is returned.
+
+ If the current() event is Comment, its value is returned. The subclasser guarantees
+ it does not contain the string "-->".
+
+ If the current() event is ProcessingInstruction, its data is returned. The subclasser
+ guarantees the data does not contain the string "?>".
+
+ In other cases, it returns a default constructed string.
+ */
+
+/*!
+ \fn QHash<QXmlName, QString> AbstractXmlPullProvider::attributes() = 0;
+
+ If the current() is Element, the attributes of the element are returned,
+ an empty list of attributes otherwise.
+ */
+
+QT_END_NAMESPACE
+
diff --git a/src/gui/kernel/qgesturestandardrecognizers_p.h b/src/xmlpatterns/api/qabstractxmlpullprovider_p.h
index 8abc1fb..59dce72 100644
--- a/src/gui/kernel/qgesturestandardrecognizers_p.h
+++ b/src/xmlpatterns/api/qabstractxmlpullprovider_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,93 +39,75 @@
**
****************************************************************************/
-#ifndef QGESTURESTANDARDRECOGNIZERS_P_H
-#define QGESTURESTANDARDRECOGNIZERS_P_H
-
//
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
-//
-
-#include "qevent.h"
-#include "qbasictimer.h"
-#include "qdebug.h"
-
-#include "qgesture.h"
-#include "qgesturerecognizer.h"
-#include "private/qdirectionrecognizer_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGestureRecognizerPan : public QGestureRecognizer
-{
- Q_OBJECT
-public:
- QGestureRecognizerPan(QObject *parent);
- QGestureRecognizer::Result filterEvent(const QEvent *event);
- QGesture* getGesture();
- void reset();
+#ifndef QABSTRACTXMLPULLPROVIDER_H
+#define QABSTRACTXMLPULLPROVIDER_H
-private:
- void internalReset();
+#include <QtCore/QtGlobal>
- QPanningGesture gesture;
+QT_BEGIN_HEADER
- QPoint pressedPos;
- QPoint lastPos;
- QPoint currentPos;
- bool mousePressed;
- Qt::GestureState gestureState;
- Qt::DirectionType lastDirection;
- Qt::DirectionType currentDirection;
- QDirectionDiagonalRecognizer diagonalRecognizer;
- QDirectionSimpleRecognizer simpleRecognizer;
-};
-
-class QDoubleTapGestureRecognizer : public QGestureRecognizer
-{
- Q_OBJECT
-public:
- QDoubleTapGestureRecognizer(QObject *parent);
-
- QGestureRecognizer::Result filterEvent(const QEvent *event);
- QGesture* getGesture();
- void reset();
+QT_BEGIN_NAMESPACE
-private:
- QGesture gesture;
- QPoint pressedPosition;
-};
+class QXmlItem;
+class QXmlName;
+class QString;
+class QVariant;
+template<typename Key, typename Value> class QHash;
-class QTapAndHoldGestureRecognizer : public QGestureRecognizer
+namespace QPatternist
{
- Q_OBJECT
-public:
- QTapAndHoldGestureRecognizer(QObject *parent);
-
- QGestureRecognizer::Result filterEvent(const QEvent *event);
- QGesture* getGesture();
- void reset();
-
-protected:
- void timerEvent(QTimerEvent *event);
-
-private:
- QGesture gesture;
- QPoint pressedPosition;
- QBasicTimer timer;
- int iteration;
- static const int iterationCount;
- static const int iterationTimeout;
-};
+ class AbstractXmlPullProviderPrivate;
+
+ class AbstractXmlPullProvider
+ {
+ public:
+ AbstractXmlPullProvider();
+ virtual ~AbstractXmlPullProvider();
+
+ enum Event
+ {
+ StartOfInput = 1,
+ AtomicValue = 1 << 1,
+ StartDocument = 1 << 2,
+ EndDocument = 1 << 3,
+ StartElement = 1 << 4,
+ EndElement = 1 << 5,
+ Text = 1 << 6,
+ ProcessingInstruction = 1 << 7,
+ Comment = 1 << 8,
+ Attribute = 1 << 9,
+ Namespace = 1 << 10,
+ EndOfInput = 1 << 11
+ };
+
+ virtual Event next() = 0;
+ virtual Event current() const = 0;
+ virtual QXmlName name() const = 0;
+ virtual QVariant atomicValue() const = 0;
+ virtual QString stringValue() const = 0;
+
+ virtual QHash<QXmlName, QString> attributes() = 0;
+ virtual QHash<QXmlName, QXmlItem> attributeItems() = 0;
+
+ /* *** The functions below are internal. */
+ private:
+ Q_DISABLE_COPY(AbstractXmlPullProvider)
+ AbstractXmlPullProviderPrivate *d;
+ };
+}
QT_END_NAMESPACE
-#endif // QGESTURESTANDARDRECOGNIZERS_P_H
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/api/qpullbridge.cpp b/src/xmlpatterns/api/qpullbridge.cpp
new file mode 100644
index 0000000..75df519
--- /dev/null
+++ b/src/xmlpatterns/api/qpullbridge.cpp
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QVariant>
+
+#include "qabstractxmlnodemodel_p.h"
+#include "qitemmappingiterator_p.h"
+#include "qitem_p.h"
+#include "qxmlname.h"
+#include "qxmlquery_p.h"
+
+#include "qpullbridge_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+/*!
+ \brief Bridges a QPatternist::SequenceIterator to QAbstractXmlPullProvider.
+ \class QPatternist::PullBridge
+ \internal
+ \reentrant
+ \ingroup xml-tools
+
+ The approach of this class is rather straight forward since QPatternist::SequenceIterator
+ and QAbstractXmlPullProvider are conceptually similar. While QPatternist::SequenceIterator only
+ delivers top level items(since it's not an event stream, it's a list of items), PullBridge
+ needs to recursively iterate the children of nodes too, which is achieved through the
+ stack m_iterators.
+ */
+
+AbstractXmlPullProvider::Event PullBridge::next()
+{
+ m_index = m_iterators.top().second->next();
+
+ if(!m_index.isNull())
+ {
+ Item item(m_index);
+
+ if(item && item.isAtomicValue())
+ m_current = AtomicValue;
+ else
+ {
+ Q_ASSERT(item.isNode());
+
+ switch(m_index.kind())
+ {
+ case QXmlNodeModelIndex::Attribute:
+ {
+ m_current = Attribute;
+ break;
+ }
+ case QXmlNodeModelIndex::Comment:
+ {
+ m_current = Comment;
+ break;
+ }
+ case QXmlNodeModelIndex::Element:
+ {
+ m_iterators.push(qMakePair(StartElement, m_index.iterate(QXmlNodeModelIndex::AxisChild)));
+ m_current = StartElement;
+ break;
+ }
+ case QXmlNodeModelIndex::Document:
+ {
+ m_iterators.push(qMakePair(StartDocument, m_index.iterate(QXmlNodeModelIndex::AxisChild)));
+ m_current = StartDocument;
+ break;
+ }
+ case QXmlNodeModelIndex::Namespace:
+ {
+ m_current = Namespace;
+ break;
+ }
+ case QXmlNodeModelIndex::ProcessingInstruction:
+ {
+ m_current = ProcessingInstruction;
+ break;
+ }
+ case QXmlNodeModelIndex::Text:
+ {
+ m_current = Text;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ if(m_iterators.isEmpty())
+ m_current = EndOfInput;
+ else
+ {
+ switch(m_iterators.top().first)
+ {
+ case StartOfInput:
+ {
+ m_current = EndOfInput;
+ break;
+ }
+ case StartElement:
+ {
+ m_current = EndElement;
+ m_iterators.pop();
+ break;
+ }
+ case StartDocument:
+ {
+ m_current = EndDocument;
+ m_iterators.pop();
+ break;
+ }
+ default:
+ {
+ Q_ASSERT_X(false, Q_FUNC_INFO,
+ "Invalid value.");
+ m_current = EndOfInput;
+ }
+ }
+ }
+
+ }
+
+ return m_current;
+}
+
+AbstractXmlPullProvider::Event PullBridge::current() const
+{
+ return m_current;
+}
+
+QXmlNodeModelIndex PullBridge::index() const
+{
+ return m_index;
+}
+
+QSourceLocation PullBridge::sourceLocation() const
+{
+ return m_index.model()->sourceLocation(m_index);
+}
+
+QXmlName PullBridge::name() const
+{
+ return m_index.name();
+}
+
+QVariant PullBridge::atomicValue() const
+{
+ return QVariant();
+}
+
+QString PullBridge::stringValue() const
+{
+ return QString();
+}
+
+QHash<QXmlName, QString> PullBridge::attributes()
+{
+ Q_ASSERT(m_current == StartElement);
+
+ QHash<QXmlName, QString> attributes;
+
+ QXmlNodeModelIndex::Iterator::Ptr it = m_index.iterate(QXmlNodeModelIndex::AxisAttribute);
+ QXmlNodeModelIndex index = it->next();
+ while (!index.isNull()) {
+ const Item attribute(index);
+ attributes.insert(index.name(), index.stringValue());
+
+ index = it->next();
+ }
+
+ return attributes;
+}
+
+QHash<QXmlName, QXmlItem> PullBridge::attributeItems()
+{
+ Q_ASSERT(m_current == StartElement);
+
+ QHash<QXmlName, QXmlItem> attributes;
+
+ QXmlNodeModelIndex::Iterator::Ptr it = m_index.iterate(QXmlNodeModelIndex::AxisAttribute);
+ QXmlNodeModelIndex index = it->next();
+ while (!index.isNull()) {
+ const Item attribute(index);
+ attributes.insert(index.name(), QXmlItem(index));
+
+ index = it->next();
+ }
+
+ return attributes;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/xmlpatterns/api/qpullbridge_p.h b/src/xmlpatterns/api/qpullbridge_p.h
new file mode 100644
index 0000000..23b9542
--- /dev/null
+++ b/src/xmlpatterns/api/qpullbridge_p.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef PATTERNIST_PULLBRIDGE_P_H
+#define PATTERNIST_PULLBRIDGE_P_H
+
+#include <QtCore/QPair>
+#include <QtCore/QStack>
+
+#include "qabstractxmlforwarditerator_p.h"
+#include "qabstractxmlpullprovider_p.h"
+#include "qitem_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class PullBridge : public AbstractXmlPullProvider
+ {
+ public:
+ inline PullBridge(const QXmlNodeModelIndex::Iterator::Ptr &it) : m_current(StartOfInput)
+ {
+ Q_ASSERT(it);
+ m_iterators.push(qMakePair(StartOfInput, it));
+ }
+
+ virtual Event next();
+ virtual Event current() const;
+ virtual QXmlName name() const;
+ /**
+ * Returns always an empty QVariant.
+ */
+ virtual QVariant atomicValue() const;
+ virtual QString stringValue() const;
+ virtual QHash<QXmlName, QString> attributes();
+ virtual QHash<QXmlName, QXmlItem> attributeItems();
+
+ QXmlNodeModelIndex index() const;
+ QSourceLocation sourceLocation() const;
+
+ private:
+ typedef QStack<QPair<Event, QXmlNodeModelIndex::Iterator::Ptr> > IteratorStack;
+ IteratorStack m_iterators;
+ QXmlNodeModelIndex m_index;
+ Event m_current;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/api/qresourcedelegator.cpp b/src/xmlpatterns/api/qresourcedelegator.cpp
index 5a5bcf4..ad93848 100644
--- a/src/xmlpatterns/api/qresourcedelegator.cpp
+++ b/src/xmlpatterns/api/qresourcedelegator.cpp
@@ -45,14 +45,6 @@ QT_BEGIN_NAMESPACE
using namespace QPatternist;
-/**
- * Duplicated in qacceltreeresourceloader.cpp.
- */
-static inline uint qHash(const QUrl &uri)
-{
- return qHash(uri.toString());
-}
-
bool ResourceDelegator::isUnparsedTextAvailable(const QUrl &uri,
const QString &encoding)
{
diff --git a/src/xmlpatterns/api/qxmlnamepool.cpp b/src/xmlpatterns/api/qxmlnamepool.cpp
index 5b03975..66eb788 100644
--- a/src/xmlpatterns/api/qxmlnamepool.cpp
+++ b/src/xmlpatterns/api/qxmlnamepool.cpp
@@ -96,6 +96,10 @@ QXmlNamePool::~QXmlNamePool()
{
}
+QXmlNamePool::QXmlNamePool(QPatternist::NamePool *namePool) : d(QExplicitlySharedDataPointer<QPatternist::NamePool>(namePool))
+{
+}
+
/*!
Assigns the \a other name pool to this one.
*/
diff --git a/src/xmlpatterns/api/qxmlnamepool.h b/src/xmlpatterns/api/qxmlnamepool.h
index 68cf627..6c1fe4f 100644
--- a/src/xmlpatterns/api/qxmlnamepool.h
+++ b/src/xmlpatterns/api/qxmlnamepool.h
@@ -54,6 +54,8 @@ QT_MODULE(XmlPatterns)
namespace QPatternist
{
class NamePool;
+ class XsdSchemaParser;
+ class XsdValidatingInstanceReader;
}
namespace QPatternistSDK
@@ -73,10 +75,15 @@ public:
QXmlNamePool &operator=(const QXmlNamePool &other);
private:
+ QXmlNamePool(QPatternist::NamePool *namePool);
friend class QXmlQueryPrivate;
friend class QXmlQuery;
+ friend class QXmlSchemaPrivate;
+ friend class QXmlSchemaValidatorPrivate;
friend class QXmlSerializerPrivate;
friend class QXmlName;
+ friend class QPatternist::XsdSchemaParser;
+ friend class QPatternist::XsdValidatingInstanceReader;
friend class QPatternistSDK::Global;
QExplicitlySharedDataPointer<QPatternist::NamePool> d;
};
diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp
index 3d023a0..79ae7a9 100644
--- a/src/xmlpatterns/api/qxmlquery.cpp
+++ b/src/xmlpatterns/api/qxmlquery.cpp
@@ -231,6 +231,18 @@ QT_BEGIN_NAMESPACE
\value XQuery10 XQuery 1.0.
\value XSLT20 XSLT 2.0
+ \omitvalue XmlSchema11IdentityConstraintSelector The selector, the restricted
+ XPath pattern found in W3C XML Schema 1.1 for uniqueness
+ contraints. Apart from restricting the syntax, the type check stage
+ for the expression assumes a sequence of nodes to be the focus.
+ \omitvalue XmlSchema11IdentityConstraintField The field, the restricted
+ XPath pattern found in W3C XML Schema 1.1 for uniqueness
+ contraints. Apart from restricting the syntax, the type check stage
+ for the expression assumes a sequence of nodes to be the focus.
+ \omitvalue XPath20 Signifies XPath 2.0. Has no effect in the public API, it's
+ used internally. As With XmlSchema11IdentityConstraintSelector and
+ XmlSchema11IdentityConstraintField, the type check stage
+ for the expression assumes a sequence of nodes to be the focus.
\sa setQuery()
*/
@@ -415,7 +427,7 @@ void QXmlQuery::setQuery(QIODevice *sourceCode, const QUrl &documentURI)
return;
}
- d->queryURI = QXmlQueryPrivate::normalizeQueryURI(documentURI);
+ d->queryURI = QPatternist::XPathHelper::normalizeQueryURI(documentURI);
d->expression(sourceCode);
}
@@ -463,12 +475,12 @@ void QXmlQuery::setQuery(const QUrl &queryURI, const QUrl &baseURI)
{
Q_ASSERT_X(queryURI.isValid(), Q_FUNC_INFO, "The passed URI must be valid.");
- const QUrl canonicalURI(QXmlQueryPrivate::normalizeQueryURI(queryURI));
+ const QUrl canonicalURI(QPatternist::XPathHelper::normalizeQueryURI(queryURI));
Q_ASSERT(canonicalURI.isValid());
Q_ASSERT(!canonicalURI.isRelative());
Q_ASSERT(baseURI.isValid() || baseURI.isEmpty());
- d->queryURI = QXmlQueryPrivate::normalizeQueryURI(baseURI.isEmpty() ? queryURI : baseURI);
+ d->queryURI = QPatternist::XPathHelper::normalizeQueryURI(baseURI.isEmpty() ? queryURI : baseURI);
QPatternist::AutoPtr<QIODevice> result;
diff --git a/src/xmlpatterns/api/qxmlquery.h b/src/xmlpatterns/api/qxmlquery.h
index 4ddfc76..b4ac121 100644
--- a/src/xmlpatterns/api/qxmlquery.h
+++ b/src/xmlpatterns/api/qxmlquery.h
@@ -71,6 +71,8 @@ namespace QPatternistSDK
namespace QPatternist
{
+ class XsdSchemaParser;
+ class XsdValidatingInstanceReader;
class VariableLoader;
};
@@ -79,8 +81,11 @@ class Q_XMLPATTERNS_EXPORT QXmlQuery
public:
enum QueryLanguage
{
- XQuery10 = 1,
- XSLT20 = 2
+ XQuery10 = 1,
+ XSLT20 = 2,
+ XmlSchema11IdentityConstraintSelector = 1024,
+ XmlSchema11IdentityConstraintField = 2048,
+ XPath20 = 4096
};
QXmlQuery();
@@ -136,6 +141,8 @@ private:
friend class QXmlName;
friend class QXmlSerializer;
friend class QPatternistSDK::TestCase;
+ friend class QPatternist::XsdSchemaParser;
+ friend class QPatternist::XsdValidatingInstanceReader;
friend class QPatternist::VariableLoader;
template<typename TInputType> friend bool setFocusHelper(QXmlQuery *const queryInstance,
const TInputType &focusValue);
diff --git a/src/xmlpatterns/api/qxmlquery_p.h b/src/xmlpatterns/api/qxmlquery_p.h
index 05222be..cb2bbad 100644
--- a/src/xmlpatterns/api/qxmlquery_p.h
+++ b/src/xmlpatterns/api/qxmlquery_p.h
@@ -142,13 +142,10 @@ public:
if(!m_functionFactory)
{
- if(queryLanguage == QXmlQuery::XQuery10)
- m_functionFactory = QPatternist::FunctionFactoryCollection::xpath20Factory(namePool.d);
- else
- {
- Q_ASSERT(queryLanguage == QXmlQuery::XSLT20);
+ if(queryLanguage == QXmlQuery::XSLT20)
m_functionFactory = QPatternist::FunctionFactoryCollection::xslt20Factory(namePool.d);
- }
+ else
+ m_functionFactory = QPatternist::FunctionFactoryCollection::xpath20Factory(namePool.d);
}
const QPatternist::GenericStaticContext::Ptr genericStaticContext(new QPatternist::GenericStaticContext(namePool.d,
@@ -164,6 +161,14 @@ public:
if(!contextItem.isNull())
m_staticContext = QPatternist::StaticContext::Ptr(new QPatternist::StaticFocusContext(QPatternist::AtomicValue::qtToXDMType(contextItem), m_staticContext));
+ else if( queryLanguage == QXmlQuery::XmlSchema11IdentityConstraintField
+ || queryLanguage == QXmlQuery::XmlSchema11IdentityConstraintSelector
+ || queryLanguage == QXmlQuery::XPath20)
+ m_staticContext = QPatternist::StaticContext::Ptr(new QPatternist::StaticFocusContext(QPatternist::BuiltinTypes::node, m_staticContext));
+
+ for (int i = 0; i < m_additionalNamespaceBindings.count(); ++i) {
+ m_staticContext->namespaceBindings()->addBinding(m_additionalNamespaceBindings.at(i));
+ }
return m_staticContext;
}
@@ -207,19 +212,6 @@ public:
return m_resourceLoader;
}
-
- static inline QUrl normalizeQueryURI(const QUrl &uri)
- {
- Q_ASSERT_X(uri.isEmpty() || uri.isValid(), Q_FUNC_INFO,
- "The URI passed to QXmlQuery::setQuery() must be valid or empty.");
- if(uri.isEmpty())
- return QUrl::fromLocalFile(QCoreApplication::applicationFilePath());
- else if(uri.isRelative())
- return QUrl::fromLocalFile(QCoreApplication::applicationFilePath()).resolved(uri);
- else
- return uri;
- }
-
void setRequiredType(const QPatternist::SequenceType::Ptr &seqType)
{
Q_ASSERT(seqType);
@@ -278,6 +270,11 @@ public:
return m_expr;
}
+ inline void addAdditionalNamespaceBinding(const QXmlName &binding)
+ {
+ m_additionalNamespaceBindings.append(binding);
+ }
+
QXmlNamePool namePool;
QPointer<QAbstractMessageHandler> messageHandler;
/**
@@ -321,6 +318,8 @@ public:
QPatternist::SequenceType::Ptr m_requiredType;
QPatternist::FunctionFactory::Ptr m_functionFactory;
QPatternist::NetworkAccessDelegator::Ptr m_networkAccessDelegator;
+
+ QList<QXmlName> m_additionalNamespaceBindings;
};
QT_END_NAMESPACE
diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp
new file mode 100644
index 0000000..e64b388
--- /dev/null
+++ b/src/xmlpatterns/api/qxmlschema.cpp
@@ -0,0 +1,299 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxmlschema.h"
+#include "qxmlschema_p.h"
+
+#include <QtCore/QIODevice>
+#include <QtCore/QUrl>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QXmlSchema
+
+ \brief The QXmlSchema class provides loading and validation of a W3C XML Schema.
+
+ \reentrant
+ \since 4.6
+ \ingroup xml-tools
+
+ The QXmlSchema class loads, compiles and validates W3C XML Schema files
+ that can be used further for validation of XML instance documents via
+ \l{QXmlSchemaValidator}.
+
+ The following example shows how to load a XML Schema file from the network
+ and test whether it is a valid schema document:
+
+ \snippet doc/src/snippets/qxmlschema/main.cpp 0
+
+ \sa QXmlSchemaValidator, {xmlpatterns/schema}{XML Schema Validation Example}
+*/
+
+/*!
+ Constructs an invalid, empty schema that cannot be used until
+ load() is called.
+ */
+QXmlSchema::QXmlSchema()
+ : d(new QXmlSchemaPrivate(QXmlNamePool()))
+{
+}
+
+/*!
+ Constructs a QXmlSchema that is a copy of \a other. The new
+ instance will share resources with the existing schema
+ to the extent possible.
+ */
+QXmlSchema::QXmlSchema(const QXmlSchema &other)
+ : d(other.d)
+{
+}
+
+/*!
+ Destroys this QXmlSchema.
+ */
+QXmlSchema::~QXmlSchema()
+{
+}
+
+/*!
+ Sets this QXmlSchema to a schema loaded from the \a source
+ URI.
+
+ If the schema \l {isValid()} {is invalid}, \c{false} is returned
+ and the behavior is undefined.
+
+ Example:
+
+ \snippet doc/src/snippets/qxmlschema/main.cpp 0
+
+ \sa isValid()
+ */
+bool QXmlSchema::load(const QUrl &source)
+{
+ d->load(source, QString());
+ return d->isValid();
+}
+
+/*!
+ Sets this QXmlSchema to a schema read from the \a source
+ device. The device must have been opened with at least
+ QIODevice::ReadOnly.
+
+ \a documentUri represents the schema obtained from the \a source
+ device. It is the base URI of the schema, that is used
+ internally to resolve relative URIs that appear in the schema, and
+ for message reporting.
+
+ If \a source is \c null or not readable, or if \a documentUri is not
+ a valid URI, behavior is undefined.
+
+ If the schema \l {isValid()} {is invalid}, \c{false} is returned
+ and the behavior is undefined.
+
+ Example:
+
+ \snippet doc/src/snippets/qxmlschema/main.cpp 1
+
+ \sa isValid()
+ */
+bool QXmlSchema::load(QIODevice *source, const QUrl &documentUri)
+{
+ d->load(source, documentUri, QString());
+ return d->isValid();
+}
+
+/*!
+ Sets this QXmlSchema to a schema read from the \a data
+
+ \a documentUri represents the schema obtained from the \a data.
+ It is the base URI of the schema, that is used internally to
+ resolve relative URIs that appear in the schema, and
+ for message reporting.
+
+ If \a documentUri is not a valid URI, behavior is undefined.
+ \sa isValid()
+
+ If the schema \l {isValid()} {is invalid}, \c{false} is returned
+ and the behavior is undefined.
+
+ Example:
+
+ \snippet doc/src/snippets/qxmlschema/main.cpp 2
+
+ \sa isValid()
+ */
+bool QXmlSchema::load(const QByteArray &data, const QUrl &documentUri)
+{
+ d->load(data, documentUri, QString());
+ return d->isValid();
+}
+
+/*!
+ Returns true if this schema is valid. Examples of invalid schemas
+ are ones that contain syntax errors or that do not conform the
+ W3C XML Schema specification.
+ */
+bool QXmlSchema::isValid() const
+{
+ return d->isValid();
+}
+
+/*!
+ Returns the name pool used by this QXmlSchema for constructing \l
+ {QXmlName} {names}. There is no setter for the name pool, because
+ mixing name pools causes errors due to name confusion.
+ */
+QXmlNamePool QXmlSchema::namePool() const
+{
+ return d->namePool();
+}
+
+/*!
+ Returns the document URI of the schema or an empty URI if no
+ schema has been set.
+ */
+QUrl QXmlSchema::documentUri() const
+{
+ return d->documentUri();
+}
+
+/*!
+ Changes the \l {QAbstractMessageHandler}{message handler} for this
+ QXmlSchema to \a handler. The schema sends all compile and
+ validation messages to this message handler. QXmlSchema does not take
+ ownership of \a handler.
+
+ Normally, the default message handler is sufficient. It writes
+ compile and validation messages to \e stderr. The default message
+ handler includes color codes if \e stderr can render colors.
+
+ When QXmlSchema calls QAbstractMessageHandler::message(),
+ the arguments are as follows:
+
+ \table
+ \header
+ \o message() argument
+ \o Semantics
+ \row
+ \o QtMsgType type
+ \o Only QtWarningMsg and QtFatalMsg are used. The former
+ identifies a warning, while the latter identifies an error.
+ \row
+ \o const QString & description
+ \o An XHTML document which is the actual message. It is translated
+ into the current language.
+ \row
+ \o const QUrl &identifier
+ \o Identifies the error with a URI, where the fragment is
+ the error code, and the rest of the URI is the error namespace.
+ \row
+ \o const QSourceLocation & sourceLocation
+ \o Identifies where the error occurred.
+ \endtable
+
+ */
+void QXmlSchema::setMessageHandler(QAbstractMessageHandler *handler)
+{
+ d->setMessageHandler(handler);
+}
+
+/*!
+ Returns the message handler that handles compile and validation
+ messages for this QXmlSchema.
+ */
+QAbstractMessageHandler *QXmlSchema::messageHandler() const
+{
+ return d->messageHandler();
+}
+
+/*!
+ Sets the URI resolver to \a resolver. QXmlSchema does not take
+ ownership of \a resolver.
+
+ \sa uriResolver()
+ */
+void QXmlSchema::setUriResolver(const QAbstractUriResolver *resolver)
+{
+ d->setUriResolver(resolver);
+}
+
+/*!
+ Returns the schema's URI resolver. If no URI resolver has been set,
+ QtXmlPatterns will use the URIs in schemas as they are.
+
+ The URI resolver provides a level of abstraction, or \e{polymorphic
+ URIs}. A resolver can rewrite \e{logical} URIs to physical ones, or
+ it can translate obsolete or invalid URIs to valid ones.
+
+ When QtXmlPatterns calls QAbstractUriResolver::resolve() the
+ absolute URI is the URI mandated by the schema specification, and the
+ relative URI is the URI specified by the user.
+
+ \sa setUriResolver()
+ */
+const QAbstractUriResolver *QXmlSchema::uriResolver() const
+{
+ return d->uriResolver();
+}
+
+/*!
+ Sets the network manager to \a manager.
+ QXmlSchema does not take ownership of \a manager.
+
+ \sa networkAccessManager()
+ */
+void QXmlSchema::setNetworkAccessManager(QNetworkAccessManager *manager)
+{
+ d->setNetworkAccessManager(manager);
+}
+
+/*!
+ Returns the network manager, or 0 if it has not been set.
+
+ \sa setNetworkAccessManager()
+ */
+QNetworkAccessManager *QXmlSchema::networkAccessManager() const
+{
+ return d->networkAccessManager();
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/embedded/qmouseyopy_qws.h b/src/xmlpatterns/api/qxmlschema.h
index 0d24a8f..b6ac010 100644
--- a/src/gui/embedded/qmouseyopy_qws.h
+++ b/src/xmlpatterns/api/qxmlschema.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,42 +39,59 @@
**
****************************************************************************/
-#ifndef QMOUSEYOPY_QWS_H
-#define QMOUSEYOPY_QWS_H
+#ifndef QXMLSCHEMA_H
+#define QXMLSCHEMA_H
-#include <QtGui/qmouse_qws.h>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QUrl>
+#include <QtXmlPatterns/QXmlNamePool>
QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
+QT_MODULE(XmlPatterns)
-#ifndef QT_NO_QWS_MOUSE_YOPY
+class QAbstractMessageHandler;
+class QAbstractUriResolver;
+class QIODevice;
+class QNetworkAccessManager;
+class QUrl;
+class QXmlNamePool;
+class QXmlSchemaPrivate;
-// YOPY touch panel support based on changes contributed by Ron Victorelli
-// (victorrj at icubed.com) to Custom TP driver.
+class Q_XMLPATTERNS_EXPORT QXmlSchema
+{
+ friend class QXmlSchemaValidatorPrivate;
-class QWSYopyMouseHandlerPrivate;
+ public:
+ QXmlSchema();
+ QXmlSchema(const QXmlSchema &other);
+ ~QXmlSchema();
-class QWSYopyMouseHandler : public QWSMouseHandler
-{
-public:
- explicit QWSYopyMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSYopyMouseHandler();
+ bool load(const QUrl &source);
+ bool load(QIODevice *source, const QUrl &documentUri = QUrl());
+ bool load(const QByteArray &data, const QUrl &documentUri = QUrl());
- void resume();
- void suspend();
+ bool isValid() const;
-protected:
- QWSYopyMouseHandlerPrivate *d;
-};
+ QXmlNamePool namePool() const;
+ QUrl documentUri() const;
-#endif // QT_NO_QWS_MOUSE_YOPY
+ void setMessageHandler(QAbstractMessageHandler *handler);
+ QAbstractMessageHandler *messageHandler() const;
+
+ void setUriResolver(const QAbstractUriResolver *resolver);
+ const QAbstractUriResolver *uriResolver() const;
+
+ void setNetworkAccessManager(QNetworkAccessManager *networkmanager);
+ QNetworkAccessManager *networkAccessManager() const;
+
+ private:
+ QSharedDataPointer<QXmlSchemaPrivate> d;
+};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMOUSEYOPY_QWS_H
+#endif
diff --git a/src/xmlpatterns/api/qxmlschema_p.cpp b/src/xmlpatterns/api/qxmlschema_p.cpp
new file mode 100644
index 0000000..2dad359
--- /dev/null
+++ b/src/xmlpatterns/api/qxmlschema_p.cpp
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qacceltreeresourceloader_p.h"
+#include "qxmlschema.h"
+#include "qxmlschema_p.h"
+
+#include <QtCore/QBuffer>
+#include <QtCore/QIODevice>
+#include <QtCore/QUrl>
+
+QT_BEGIN_NAMESPACE
+
+QXmlSchemaPrivate::QXmlSchemaPrivate(const QXmlNamePool &namePool)
+ : m_namePool(namePool)
+ , m_userMessageHandler(0)
+ , m_uriResolver(0)
+ , m_userNetworkAccessManager(0)
+ , m_schemaContext(new QPatternist::XsdSchemaContext(m_namePool.d))
+ , m_schemaParserContext(new QPatternist::XsdSchemaParserContext(m_namePool.d, m_schemaContext))
+ , m_schemaIsValid(false)
+{
+ m_networkAccessManager = new QPatternist::ReferenceCountedValue<QNetworkAccessManager>(new QNetworkAccessManager());
+ m_messageHandler = new QPatternist::ReferenceCountedValue<QAbstractMessageHandler>(new QPatternist::ColoringMessageHandler());
+}
+
+QXmlSchemaPrivate::QXmlSchemaPrivate(const QPatternist::XsdSchemaContext::Ptr &schemaContext)
+ : m_namePool(QXmlNamePool(schemaContext->namePool().data()))
+ , m_userMessageHandler(0)
+ , m_uriResolver(0)
+ , m_userNetworkAccessManager(0)
+ , m_schemaContext(schemaContext)
+ , m_schemaParserContext(new QPatternist::XsdSchemaParserContext(m_namePool.d, m_schemaContext))
+ , m_schemaIsValid(false)
+{
+ m_networkAccessManager = new QPatternist::ReferenceCountedValue<QNetworkAccessManager>(new QNetworkAccessManager());
+ m_messageHandler = new QPatternist::ReferenceCountedValue<QAbstractMessageHandler>(new QPatternist::ColoringMessageHandler());
+}
+
+QXmlSchemaPrivate::QXmlSchemaPrivate(const QXmlSchemaPrivate &other)
+ : QSharedData(other)
+{
+ m_namePool = other.m_namePool;
+ m_userMessageHandler = other.m_userMessageHandler;
+ m_uriResolver = other.m_uriResolver;
+ m_userNetworkAccessManager = other.m_userNetworkAccessManager;
+ m_messageHandler = other.m_messageHandler;
+ m_networkAccessManager = other.m_networkAccessManager;
+
+ m_schemaContext = other.m_schemaContext;
+ m_schemaParserContext = other.m_schemaParserContext;
+ m_schemaIsValid = other.m_schemaIsValid;
+ m_documentUri = other.m_documentUri;
+}
+
+void QXmlSchemaPrivate::load(const QUrl &source, const QString &targetNamespace)
+{
+ m_documentUri = QPatternist::XPathHelper::normalizeQueryURI(source);
+
+ m_schemaContext->setMessageHandler(messageHandler());
+ m_schemaContext->setUriResolver(uriResolver());
+ m_schemaContext->setNetworkAccessManager(networkAccessManager());
+
+ const QPatternist::AutoPtr<QNetworkReply> reply(QPatternist::AccelTreeResourceLoader::load(source, m_schemaContext->networkAccessManager(),
+ m_schemaContext, QPatternist::AccelTreeResourceLoader::ContinueOnError));
+ if (reply)
+ load(reply.data(), source, targetNamespace);
+}
+
+void QXmlSchemaPrivate::load(const QByteArray &data, const QUrl &documentUri, const QString &targetNamespace)
+{
+ QByteArray localData(data);
+
+ QBuffer buffer(&localData);
+ buffer.open(QIODevice::ReadOnly);
+
+ load(&buffer, documentUri, targetNamespace);
+}
+
+void QXmlSchemaPrivate::load(QIODevice *source, const QUrl &documentUri, const QString &targetNamespace)
+{
+ m_schemaParserContext = QPatternist::XsdSchemaParserContext::Ptr(new QPatternist::XsdSchemaParserContext(m_namePool.d, m_schemaContext));
+ m_schemaIsValid = false;
+
+ if (!source) {
+ qWarning("A null QIODevice pointer cannot be passed.");
+ return;
+ }
+
+ if (!source->isReadable()) {
+ qWarning("The device must be readable.");
+ return;
+ }
+
+ m_documentUri = QPatternist::XPathHelper::normalizeQueryURI(documentUri);
+ m_schemaContext->setMessageHandler(messageHandler());
+ m_schemaContext->setUriResolver(uriResolver());
+ m_schemaContext->setNetworkAccessManager(networkAccessManager());
+
+ QPatternist::XsdSchemaParser parser(m_schemaContext, m_schemaParserContext, source);
+ parser.setDocumentURI(documentUri);
+ parser.setTargetNamespace(targetNamespace);
+
+ try {
+ parser.parse();
+ m_schemaParserContext->resolver()->resolve();
+
+ m_schemaIsValid = true;
+ } catch (QPatternist::Exception exception) {
+ m_schemaIsValid = false;
+ }
+}
+
+bool QXmlSchemaPrivate::isValid() const
+{
+ return m_schemaIsValid;
+}
+
+QXmlNamePool QXmlSchemaPrivate::namePool() const
+{
+ return m_namePool;
+}
+
+QUrl QXmlSchemaPrivate::documentUri() const
+{
+ return m_documentUri;
+}
+
+void QXmlSchemaPrivate::setMessageHandler(QAbstractMessageHandler *handler)
+{
+ m_userMessageHandler = handler;
+}
+
+QAbstractMessageHandler *QXmlSchemaPrivate::messageHandler() const
+{
+ if (m_userMessageHandler)
+ return m_userMessageHandler;
+
+ return m_messageHandler.data()->value;
+}
+
+void QXmlSchemaPrivate::setUriResolver(const QAbstractUriResolver *resolver)
+{
+ m_uriResolver = resolver;
+}
+
+const QAbstractUriResolver *QXmlSchemaPrivate::uriResolver() const
+{
+ return m_uriResolver;
+}
+
+void QXmlSchemaPrivate::setNetworkAccessManager(QNetworkAccessManager *networkmanager)
+{
+ m_userNetworkAccessManager = networkmanager;
+}
+
+QNetworkAccessManager *QXmlSchemaPrivate::networkAccessManager() const
+{
+ if (m_userNetworkAccessManager)
+ return m_userNetworkAccessManager;
+
+ return m_networkAccessManager.data()->value;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/api/qxmlschema_p.h b/src/xmlpatterns/api/qxmlschema_p.h
new file mode 100644
index 0000000..be2ebb8
--- /dev/null
+++ b/src/xmlpatterns/api/qxmlschema_p.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QXMLSCHEMA_P_H
+#define QXMLSCHEMA_P_H
+
+#include "qabstractmessagehandler.h"
+#include "qabstracturiresolver.h"
+#include "qautoptr_p.h"
+#include "qcoloringmessagehandler_p.h"
+#include "qreferencecountedvalue_p.h"
+
+#include "qxsdschemacontext_p.h"
+#include "qxsdschemaparser_p.h"
+#include "qxsdschemaparsercontext_p.h"
+
+#include <QtCore/QSharedData>
+#include <QtNetwork/QNetworkAccessManager>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QXmlSchemaPrivate : public QSharedData
+{
+ public:
+ QXmlSchemaPrivate(const QXmlNamePool &namePool);
+ QXmlSchemaPrivate(const QPatternist::XsdSchemaContext::Ptr &schemaContext);
+ QXmlSchemaPrivate(const QXmlSchemaPrivate &other);
+
+ void load(const QUrl &source, const QString &targetNamespace);
+ void load(QIODevice *source, const QUrl &documentUri, const QString &targetNamespace);
+ void load(const QByteArray &data, const QUrl &documentUri, const QString &targetNamespace);
+ bool isValid() const;
+ QXmlNamePool namePool() const;
+ QUrl documentUri() const;
+ void setMessageHandler(QAbstractMessageHandler *handler);
+ QAbstractMessageHandler *messageHandler() const;
+ void setUriResolver(const QAbstractUriResolver *resolver);
+ const QAbstractUriResolver *uriResolver() const;
+ void setNetworkAccessManager(QNetworkAccessManager *networkmanager);
+ QNetworkAccessManager *networkAccessManager() const;
+
+ QXmlNamePool m_namePool;
+ QAbstractMessageHandler* m_userMessageHandler;
+ const QAbstractUriResolver* m_uriResolver;
+ QNetworkAccessManager* m_userNetworkAccessManager;
+ QPatternist::ReferenceCountedValue<QAbstractMessageHandler>::Ptr m_messageHandler;
+ QPatternist::ReferenceCountedValue<QNetworkAccessManager>::Ptr m_networkAccessManager;
+
+ QPatternist::XsdSchemaContext::Ptr m_schemaContext;
+ QPatternist::XsdSchemaParserContext::Ptr m_schemaParserContext;
+ bool m_schemaIsValid;
+ QUrl m_documentUri;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp
new file mode 100644
index 0000000..a864d40
--- /dev/null
+++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp
@@ -0,0 +1,344 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxmlschemavalidator.h"
+#include "qxmlschemavalidator_p.h"
+
+#include "qacceltreeresourceloader_p.h"
+#include "qxmlschema.h"
+#include "qxmlschema_p.h"
+#include "qxsdvalidatinginstancereader_p.h"
+
+#include <QtCore/QBuffer>
+#include <QtCore/QIODevice>
+#include <QtCore/QUrl>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QXmlSchemaValidator
+
+ \brief The QXmlSchemaValidator class validates XML instance documents against a W3C XML Schema.
+
+ \reentrant
+ \since 4.6
+ \ingroup xml-tools
+
+ The QXmlSchemaValidator class loads, parses an XML instance document and validates it
+ against a W3C XML Schema that has been compiled with \l{QXmlSchema}.
+
+ The following example shows how to load a XML Schema from a local
+ file, check whether it is a valid schema document and use it for validation
+ of an XML instance document:
+
+ \snippet doc/src/snippets/qxmlschemavalidator/main.cpp 3
+
+ \sa QXmlSchema, {xmlpatterns/schema}{XML Schema Validation Example}
+*/
+
+/*!
+ Constructs a schema validator.
+ The schema used for validation must be referenced in the XML instance document
+ via the \c xsi:schemaLocation or \c xsi:noNamespaceSchemaLocation attribute.
+ */
+QXmlSchemaValidator::QXmlSchemaValidator()
+ : d(new QXmlSchemaValidatorPrivate(QXmlSchema()))
+{
+}
+
+/*!
+ Constructs a schema validator that will use \a schema for validation.
+ If an empty \l {QXmlSchema} schema is passed to the validator, the schema used
+ for validation must be referenced in the XML instance document
+ via the \c xsi:schemaLocation or \c xsi:noNamespaceSchemaLocation attribute.
+ */
+QXmlSchemaValidator::QXmlSchemaValidator(const QXmlSchema &schema)
+ : d(new QXmlSchemaValidatorPrivate(schema))
+{
+}
+
+/*!
+ Destroys this QXmlSchemaValidator.
+ */
+QXmlSchemaValidator::~QXmlSchemaValidator()
+{
+ delete d;
+}
+
+/*!
+ Sets the \a schema that shall be used for further validation.
+ If the schema is empty, the schema used for validation must be referenced
+ in the XML instance document via the \c xsi:schemaLocation or
+ \c xsi:noNamespaceSchemaLocation attribute.
+ */
+void QXmlSchemaValidator::setSchema(const QXmlSchema &schema)
+{
+ d->setSchema(schema);
+}
+
+/*!
+ Validates the XML instance document read from \a data with the
+ given \a documentUri against the schema.
+
+ Returns \c true if the XML instance document is valid according to the
+ schema, \c false otherwise.
+
+ Example:
+
+ \snippet doc/src/snippets/qxmlschemavalidator/main.cpp 2
+ */
+bool QXmlSchemaValidator::validate(const QByteArray &data, const QUrl &documentUri) const
+{
+ QByteArray localData(data);
+
+ QBuffer buffer(&localData);
+ buffer.open(QIODevice::ReadOnly);
+
+ return validate(&buffer, documentUri);
+}
+
+/*!
+ Validates the XML instance document read from \a source against the schema.
+
+ Returns \c true if the XML instance document is valid according to the
+ schema, \c false otherwise.
+
+ Example:
+
+ \snippet doc/src/snippets/qxmlschemavalidator/main.cpp 0
+ */
+bool QXmlSchemaValidator::validate(const QUrl &source) const
+{
+ d->m_context->setMessageHandler(messageHandler());
+ d->m_context->setUriResolver(uriResolver());
+ d->m_context->setNetworkAccessManager(networkAccessManager());
+
+ const QPatternist::AutoPtr<QNetworkReply> reply(QPatternist::AccelTreeResourceLoader::load(source, d->m_context->networkAccessManager(),
+ d->m_context, QPatternist::AccelTreeResourceLoader::ContinueOnError));
+ if (reply)
+ return validate(reply.data(), source);
+ else
+ return false;
+}
+
+/*!
+ Validates the XML instance document read from \a source with the
+ given \a documentUri against the schema.
+
+ Returns \c true if the XML instance document is valid according to the
+ schema, \c false otherwise.
+
+ Example:
+
+ \snippet doc/src/snippets/qxmlschemavalidator/main.cpp 1
+ */
+bool QXmlSchemaValidator::validate(QIODevice *source, const QUrl &documentUri) const
+{
+ if (!source) {
+ qWarning("A null QIODevice pointer cannot be passed.");
+ return false;
+ }
+
+ if (!source->isReadable()) {
+ qWarning("The device must be readable.");
+ return false;
+ }
+
+ const QUrl normalizedUri = QPatternist::XPathHelper::normalizeQueryURI(documentUri);
+
+ d->m_context->setMessageHandler(messageHandler());
+ d->m_context->setUriResolver(uriResolver());
+ d->m_context->setNetworkAccessManager(networkAccessManager());
+
+ QPatternist::NetworkAccessDelegator::Ptr delegator(new QPatternist::NetworkAccessDelegator(d->m_context->networkAccessManager(),
+ d->m_context->networkAccessManager()));
+
+ QPatternist::AccelTreeResourceLoader loader(d->m_context->namePool(), delegator, QPatternist::AccelTreeBuilder<true>::SourceLocationsFeature);
+
+ QPatternist::Item item;
+ try {
+ item = loader.openDocument(source, normalizedUri, d->m_context);
+ } catch (QPatternist::Exception exception) {
+ return false;
+ }
+
+ QXmlNodeModelIndex index = item.asNode();
+ const QAbstractXmlNodeModel *model = item.asNode().model();
+
+ QPatternist::XsdValidatedXmlNodeModel *validatedModel = new QPatternist::XsdValidatedXmlNodeModel(model);
+
+ QPatternist::XsdValidatingInstanceReader reader(validatedModel, normalizedUri, d->m_context);
+ if (d->m_schema)
+ reader.addSchema(d->m_schema, d->m_schemaDocumentUri);
+ try {
+ reader.read();
+ } catch (QPatternist::Exception exception) {
+ return false;
+ }
+
+ return true;
+}
+
+/*!
+ Returns the name pool used by this QXmlSchemaValidator for constructing \l
+ {QXmlName} {names}. There is no setter for the name pool, because
+ mixing name pools causes errors due to name confusion.
+ */
+QXmlNamePool QXmlSchemaValidator::namePool() const
+{
+ return d->m_namePool;
+}
+
+/*!
+ Returns the schema that is used for validation.
+ */
+QXmlSchema QXmlSchemaValidator::schema() const
+{
+ return d->m_originalSchema;
+}
+
+/*!
+ Changes the \l {QAbstractMessageHandler}{message handler} for this
+ QXmlSchemaValidator to \a handler. The schema validator sends all parsing and
+ validation messages to this message handler. QXmlSchemaValidator does not take
+ ownership of \a handler.
+
+ Normally, the default message handler is sufficient. It writes
+ compile and validation messages to \e stderr. The default message
+ handler includes color codes if \e stderr can render colors.
+
+ When QXmlSchemaValidator calls QAbstractMessageHandler::message(),
+ the arguments are as follows:
+
+ \table
+ \header
+ \o message() argument
+ \o Semantics
+ \row
+ \o QtMsgType type
+ \o Only QtWarningMsg and QtFatalMsg are used. The former
+ identifies a warning, while the latter identifies an error.
+ \row
+ \o const QString & description
+ \o An XHTML document which is the actual message. It is translated
+ into the current language.
+ \row
+ \o const QUrl &identifier
+ \o Identifies the error with a URI, where the fragment is
+ the error code, and the rest of the URI is the error namespace.
+ \row
+ \o const QSourceLocation & sourceLocation
+ \o Identifies where the error occurred.
+ \endtable
+
+ */
+void QXmlSchemaValidator::setMessageHandler(QAbstractMessageHandler *handler)
+{
+ d->m_userMessageHandler = handler;
+}
+
+/*!
+ Returns the message handler that handles parsing and validation
+ messages for this QXmlSchemaValidator.
+ */
+QAbstractMessageHandler *QXmlSchemaValidator::messageHandler() const
+{
+ if (d->m_userMessageHandler)
+ return d->m_userMessageHandler;
+
+ return d->m_messageHandler.data()->value;
+}
+
+/*!
+ Sets the URI resolver to \a resolver. QXmlSchemaValidator does not take
+ ownership of \a resolver.
+
+ \sa uriResolver()
+ */
+void QXmlSchemaValidator::setUriResolver(const QAbstractUriResolver *resolver)
+{
+ d->m_uriResolver = resolver;
+}
+
+/*!
+ Returns the schema's URI resolver. If no URI resolver has been set,
+ QtXmlPatterns will use the URIs in instance documents as they are.
+
+ The URI resolver provides a level of abstraction, or \e{polymorphic
+ URIs}. A resolver can rewrite \e{logical} URIs to physical ones, or
+ it can translate obsolete or invalid URIs to valid ones.
+
+ When QtXmlPatterns calls QAbstractUriResolver::resolve() the
+ absolute URI is the URI mandated by the schema specification, and the
+ relative URI is the URI specified by the user.
+
+ \sa setUriResolver()
+ */
+const QAbstractUriResolver *QXmlSchemaValidator::uriResolver() const
+{
+ return d->m_uriResolver;
+}
+
+/*!
+ Sets the network manager to \a manager.
+ QXmlSchemaValidator does not take ownership of \a manager.
+
+ \sa networkAccessManager()
+ */
+void QXmlSchemaValidator::setNetworkAccessManager(QNetworkAccessManager *manager)
+{
+ d->m_userNetworkAccessManager = manager;
+}
+
+/*!
+ Returns the network manager, or 0 if it has not been set.
+
+ \sa setNetworkAccessManager()
+ */
+QNetworkAccessManager *QXmlSchemaValidator::networkAccessManager() const
+{
+ if (d->m_userNetworkAccessManager)
+ return d->m_userNetworkAccessManager;
+
+ return d->m_networkAccessManager.data()->value;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/api/qxmlschemavalidator.h b/src/xmlpatterns/api/qxmlschemavalidator.h
new file mode 100644
index 0000000..f32ac07
--- /dev/null
+++ b/src/xmlpatterns/api/qxmlschemavalidator.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QXMLSCHEMAVALIDATOR_H
+#define QXMLSCHEMAVALIDATOR_H
+
+#include <QtCore/QUrl>
+#include <QtXmlPatterns/QXmlNamePool>
+
+QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(XmlPatterns)
+
+class QAbstractMessageHandler;
+class QAbstractUriResolver;
+class QIODevice;
+class QNetworkAccessManager;
+class QUrl;
+class QXmlNamePool;
+class QXmlSchema;
+class QXmlSchemaValidatorPrivate;
+
+class Q_XMLPATTERNS_EXPORT QXmlSchemaValidator
+{
+ public:
+ QXmlSchemaValidator();
+ QXmlSchemaValidator(const QXmlSchema &schema);
+ ~QXmlSchemaValidator();
+
+ void setSchema(const QXmlSchema &schema);
+
+ bool validate(const QUrl &source) const;
+ bool validate(QIODevice *source, const QUrl &documentUri = QUrl()) const;
+ bool validate(const QByteArray &data, const QUrl &documentUri = QUrl()) const;
+
+ QXmlNamePool namePool() const;
+ QXmlSchema schema() const;
+
+ void setMessageHandler(QAbstractMessageHandler *handler);
+ QAbstractMessageHandler *messageHandler() const;
+
+ void setUriResolver(const QAbstractUriResolver *resolver);
+ const QAbstractUriResolver *uriResolver() const;
+
+ void setNetworkAccessManager(QNetworkAccessManager *networkmanager);
+ QNetworkAccessManager *networkAccessManager() const;
+
+ private:
+ QXmlSchemaValidatorPrivate* const d;
+
+ Q_DISABLE_COPY(QXmlSchemaValidator)
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/api/qxmlschemavalidator_p.h b/src/xmlpatterns/api/qxmlschemavalidator_p.h
new file mode 100644
index 0000000..40dbefc
--- /dev/null
+++ b/src/xmlpatterns/api/qxmlschemavalidator_p.h
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QXMLSCHEMAVALIDATOR_P_H
+#define QXMLSCHEMAVALIDATOR_P_H
+
+#include "qabstractmessagehandler.h"
+#include "qabstracturiresolver.h"
+#include "qautoptr_p.h"
+#include "qcoloringmessagehandler_p.h"
+#include "qxmlschema.h"
+#include "qxmlschema_p.h"
+
+#include "qxsdschemacontext_p.h"
+#include "qxsdschema_p.h"
+
+#include <QtNetwork/QNetworkAccessManager>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QXmlSchemaValidatorPrivate
+{
+public:
+ QXmlSchemaValidatorPrivate(const QXmlSchema &schema)
+ : m_namePool(schema.namePool())
+ , m_userMessageHandler(0)
+ , m_uriResolver(0)
+ , m_userNetworkAccessManager(0)
+ {
+ setSchema(schema);
+
+ const QXmlSchemaPrivate *p = schema.d;
+
+ // initialize the environment properties with the ones from the schema
+
+ if (p->m_userNetworkAccessManager) // schema has user defined network access manager
+ m_userNetworkAccessManager = p->m_userNetworkAccessManager;
+ else
+ m_networkAccessManager = p->m_networkAccessManager;
+
+ if (p->m_userMessageHandler) // schema has user defined message handler
+ m_userMessageHandler = p->m_userMessageHandler;
+ else
+ m_messageHandler = p->m_messageHandler;
+
+ m_uriResolver = p->m_uriResolver;
+ }
+
+ void setSchema(const QXmlSchema &schema)
+ {
+ // use same name pool as the schema
+ m_namePool = schema.namePool();
+ m_schema = schema.d->m_schemaParserContext->schema();
+ m_schemaDocumentUri = schema.documentUri();
+
+ // create a new schema context
+ m_context = QPatternist::XsdSchemaContext::Ptr(new QPatternist::XsdSchemaContext(m_namePool.d));
+ m_context->m_schemaTypeFactory = schema.d->m_schemaContext->m_schemaTypeFactory;
+ m_context->m_builtinTypesFacetList = schema.d->m_schemaContext->m_builtinTypesFacetList;
+
+ m_originalSchema = schema;
+ }
+
+ QXmlNamePool m_namePool;
+ QAbstractMessageHandler* m_userMessageHandler;
+ const QAbstractUriResolver* m_uriResolver;
+ QNetworkAccessManager* m_userNetworkAccessManager;
+ QPatternist::ReferenceCountedValue<QAbstractMessageHandler>::Ptr m_messageHandler;
+ QPatternist::ReferenceCountedValue<QNetworkAccessManager>::Ptr m_networkAccessManager;
+
+ QXmlSchema m_originalSchema;
+ QPatternist::XsdSchemaContext::Ptr m_context;
+ QPatternist::XsdSchema::Ptr m_schema;
+ QUrl m_schemaDocumentUri;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/common.pri b/src/xmlpatterns/common.pri
index 2573a26..27253d8 100644
--- a/src/xmlpatterns/common.pri
+++ b/src/xmlpatterns/common.pri
@@ -10,6 +10,7 @@ INCLUDEPATH += $$PWD/acceltree \
$$PWD/iterators \
$$PWD/janitors \
$$PWD/parser \
+ $$PWD/schema \
$$PWD/type \
$$PWD/utils
diff --git a/src/xmlpatterns/data/data.pri b/src/xmlpatterns/data/data.pri
index 99591d4..ccfed42 100644
--- a/src/xmlpatterns/data/data.pri
+++ b/src/xmlpatterns/data/data.pri
@@ -1,8 +1,8 @@
HEADERS += $$PWD/qabstractdatetime_p.h \
$$PWD/qabstractduration_p.h \
$$PWD/qabstractfloatcasters_p.h \
- $$PWD/qabstractfloat_p.h \
$$PWD/qabstractfloatmathematician_p.h \
+ $$PWD/qabstractfloat_p.h \
$$PWD/qanyuri_p.h \
$$PWD/qatomiccaster_p.h \
$$PWD/qatomiccasters_p.h \
@@ -14,8 +14,8 @@ HEADERS += $$PWD/qabstractdatetime_p.h \
$$PWD/qbase64binary_p.h \
$$PWD/qboolean_p.h \
$$PWD/qcommonvalues_p.h \
+ $$PWD/qcomparisonfactory_p.h \
$$PWD/qdate_p.h \
- $$PWD/qschemadatetime_p.h \
$$PWD/qdaytimeduration_p.h \
$$PWD/qdecimal_p.h \
$$PWD/qderivedinteger_p.h \
@@ -24,19 +24,21 @@ HEADERS += $$PWD/qabstractdatetime_p.h \
$$PWD/qgday_p.h \
$$PWD/qgmonthday_p.h \
$$PWD/qgmonth_p.h \
- $$PWD/qgyear_p.h \
$$PWD/qgyearmonth_p.h \
+ $$PWD/qgyear_p.h \
$$PWD/qhexbinary_p.h \
$$PWD/qinteger_p.h \
$$PWD/qitem_p.h \
$$PWD/qnodebuilder_p.h \
- $$PWD/qschemanumeric_p.h \
$$PWD/qqnamevalue_p.h \
$$PWD/qresourceloader_p.h \
- $$PWD/qsorttuple.cpp \
+ $$PWD/qschemadatetime_p.h \
+ $$PWD/qschemanumeric_p.h \
$$PWD/qschematime_p.h \
+ $$PWD/qsorttuple.cpp \
$$PWD/quntypedatomic_p.h \
$$PWD/qvalidationerror_p.h \
+ $$PWD/qvaluefactory_p.h \
$$PWD/qyearmonthduration_p.h
SOURCES += $$PWD/qabstractdatetime.cpp \
@@ -53,8 +55,8 @@ SOURCES += $$PWD/qabstractdatetime.cpp \
$$PWD/qbase64binary.cpp \
$$PWD/qboolean.cpp \
$$PWD/qcommonvalues.cpp \
+ $$PWD/qcomparisonfactory.cpp \
$$PWD/qdate.cpp \
- $$PWD/qschemadatetime.cpp \
$$PWD/qdaytimeduration.cpp \
$$PWD/qdecimal.cpp \
$$PWD/qduration.cpp \
@@ -68,11 +70,13 @@ SOURCES += $$PWD/qabstractdatetime.cpp \
$$PWD/qitem.cpp \
$$PWD/qnodebuilder.cpp \
$$PWD/qnodemodel.cpp \
- $$PWD/qschemanumeric.cpp \
$$PWD/qqnamevalue.cpp \
$$PWD/qresourceloader.cpp \
- $$PWD/qsorttuple.cpp \
+ $$PWD/qschemadatetime.cpp \
+ $$PWD/qschemanumeric.cpp \
$$PWD/qschematime.cpp \
+ $$PWD/qsorttuple.cpp \
$$PWD/quntypedatomic.cpp \
$$PWD/qvalidationerror.cpp \
+ $$PWD/qvaluefactory.cpp \
$$PWD/qyearmonthduration.cpp
diff --git a/src/xmlpatterns/data/qboolean.cpp b/src/xmlpatterns/data/qboolean.cpp
index 07562fd..bb4ece1 100644
--- a/src/xmlpatterns/data/qboolean.cpp
+++ b/src/xmlpatterns/data/qboolean.cpp
@@ -76,7 +76,7 @@ bool Boolean::evaluateEBV(const Item &first,
{
Q_ASSERT(context);
context->error(QtXmlPatterns::tr("Effective Boolean Value cannot be calculated for a sequence "
- "containing two or more atomic values."),
+ "containing two or more atomic values."),
ReportContext::FORG0006,
QSourceLocation());
return false;
diff --git a/src/xmlpatterns/data/qcomparisonfactory.cpp b/src/xmlpatterns/data/qcomparisonfactory.cpp
new file mode 100644
index 0000000..c22d9e7
--- /dev/null
+++ b/src/xmlpatterns/data/qcomparisonfactory.cpp
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomiccomparators_p.h"
+#include "qatomicstring_p.h"
+#include "qcomparisonplatform_p.h"
+#include "qvaluefactory_p.h"
+
+#include "qcomparisonfactory_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+/**
+ * @short Helper class for ComparisonFactory::fromLexical() which exposes
+ * CastingPlatform appropriately.
+ *
+ * @relates ComparisonFactory
+ */
+class PerformComparison : public ComparisonPlatform<PerformComparison, true>
+ , public SourceLocationReflection
+{
+public:
+ PerformComparison(const SourceLocationReflection *const sourceLocationReflection,
+ const AtomicComparator::Operator op) : m_sourceReflection(sourceLocationReflection)
+ , m_operator(op)
+ {
+ Q_ASSERT(m_sourceReflection);
+ }
+
+ bool operator()(const AtomicValue::Ptr &operand1,
+ const AtomicValue::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context)
+ {
+ const ItemType::Ptr asItemType((AtomicType::Ptr(type)));
+
+ /* One area where the Query Transform world differs from the Schema
+ * world is that @c xs:duration is not considedered comparable, because
+ * it's according to Schema is partially comparable. This means
+ * ComparisonPlatform::fetchComparator() flags it as impossible, and
+ * hence we need to override that.
+ *
+ * SchemaType::wxsTypeMatches() will return true for sub-types of @c
+ * xs:duration as well, but that's ok since AbstractDurationComparator
+ * works for them too. */
+ if(BuiltinTypes::xsDuration->wxsTypeMatches(type))
+ prepareComparison(AtomicComparator::Ptr(new AbstractDurationComparator()));
+ else if (BuiltinTypes::xsGYear->wxsTypeMatches(type) ||
+ BuiltinTypes::xsGYearMonth->wxsTypeMatches(type) ||
+ BuiltinTypes::xsGMonth->wxsTypeMatches(type) ||
+ BuiltinTypes::xsGMonthDay->wxsTypeMatches(type) ||
+ BuiltinTypes::xsGDay->wxsTypeMatches(type))
+ prepareComparison(AtomicComparator::Ptr(new AbstractDateTimeComparator()));
+ else
+ prepareComparison(fetchComparator(asItemType, asItemType, context));
+
+ return flexibleCompare(operand1, operand2, context);
+ }
+
+ const SourceLocationReflection *actualReflection() const
+ {
+ return m_sourceReflection;
+ }
+
+ AtomicComparator::Operator operatorID() const
+ {
+ return m_operator;
+ }
+
+private:
+ const SourceLocationReflection *const m_sourceReflection;
+ const AtomicComparator::Operator m_operator;
+};
+
+bool ComparisonFactory::compare(const AtomicValue::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const AtomicValue::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection)
+{
+ Q_ASSERT(operand1);
+ Q_ASSERT(operand2);
+ Q_ASSERT(context);
+ Q_ASSERT(sourceLocationReflection);
+ Q_ASSERT(type);
+ Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
+ "We can only compare atomic values.");
+
+ return PerformComparison(sourceLocationReflection, op)(operand1, operand2, type, context);
+}
+
+bool ComparisonFactory::constructAndCompare(const DerivedString<TypeString>::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const DerivedString<TypeString>::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection)
+{
+ Q_ASSERT(operand1);
+ Q_ASSERT(operand2);
+ Q_ASSERT(context);
+ Q_ASSERT(sourceLocationReflection);
+ Q_ASSERT(type);
+ Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
+ "We can only compare atomic values.");
+
+ const AtomicValue::Ptr value1 = ValueFactory::fromLexical(operand1->stringValue(), type, context, sourceLocationReflection);
+ const AtomicValue::Ptr value2 = ValueFactory::fromLexical(operand2->stringValue(), type, context, sourceLocationReflection);
+
+ return compare(value1, op, value2, type, context, sourceLocationReflection);
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/data/qcomparisonfactory_p.h b/src/xmlpatterns/data/qcomparisonfactory_p.h
new file mode 100644
index 0000000..1234548
--- /dev/null
+++ b/src/xmlpatterns/data/qcomparisonfactory_p.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_ComparisonFactory_H
+#define Patternist_ComparisonFactory_H
+
+#include "qatomiccomparator_p.h"
+#include "qderivedstring_p.h"
+#include "qitem_p.h"
+#include "qreportcontext_p.h"
+#include "qschematype_p.h"
+
+QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Provides compare(), which is a high-level helper function for
+ * comparing atomic values.
+ *
+ * This class wraps the helper class ComparisonPlatform with a more specific,
+ * high-level API.
+ *
+ * @see ComparisonPlatform
+ * @author Frans Englich <fenglich@trolltech.com>
+ * @ingroup Patternist_schema
+ */
+ class ComparisonFactory
+ {
+ public:
+ /**
+ * @short Returns the result of evaluating operator @p op applied to the atomic
+ * values @p operand1 and @p operand2.
+ *
+ * The caller guarantees that both values are of type @p type.
+ *
+ * ComparisonFactory does not take ownership of @p sourceLocationReflection.
+ */
+ static bool compare(const AtomicValue::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const AtomicValue::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection);
+
+ /**
+ * @short Returns the result of evaluating operator @p op applied to the atomic
+ * values @p operand1 and @p operand2.
+ *
+ * In opposite to compare() it converts the operands from string type
+ * to @p type and compares these constructed types.
+ *
+ * The caller guarantees that both values are of type @p type.
+ *
+ * ComparisonFactory does not take ownership of @p sourceLocationReflection.
+ */
+ static bool constructAndCompare(const DerivedString<TypeString>::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const DerivedString<TypeString>::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection);
+
+ private:
+ Q_DISABLE_COPY(ComparisonFactory)
+ };
+}
+
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/data/qitem_p.h b/src/xmlpatterns/data/qitem_p.h
index 1f50072..60c8510 100644
--- a/src/xmlpatterns/data/qitem_p.h
+++ b/src/xmlpatterns/data/qitem_p.h
@@ -128,6 +128,11 @@ namespace QPatternist
typedef QExplicitlySharedDataPointer<AtomicValue> Ptr;
/**
+ * A list if smart pointers wrapping AtomicValue instances.
+ */
+ typedef QList<AtomicValue::Ptr> List;
+
+ /**
* Determines whether this atomic value has an error. This is used
* for implementing casting.
*
diff --git a/src/xmlpatterns/data/qresourceloader_p.h b/src/xmlpatterns/data/qresourceloader_p.h
index 8cb174d..0ebc885 100644
--- a/src/xmlpatterns/data/qresourceloader_p.h
+++ b/src/xmlpatterns/data/qresourceloader_p.h
@@ -114,7 +114,7 @@ namespace QPatternist
*
* Typically this hint is given when the URI is available at
* compile-time, but it is used inside a conditional statement
- * whose branching can't be determined at compile time.
+ * whose branching cannot be determined at compile time.
*/
MayUse,
diff --git a/src/xmlpatterns/data/qvaluefactory.cpp b/src/xmlpatterns/data/qvaluefactory.cpp
new file mode 100644
index 0000000..63307c2
--- /dev/null
+++ b/src/xmlpatterns/data/qvaluefactory.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomiccaster_p.h"
+#include "qatomicstring_p.h"
+#include "qcastingplatform_p.h"
+#include "qvaluefactory_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+/**
+ * @short Helper class for ValueFactory::fromLexical() which exposes
+ * CastingPlatform appropriately.
+ *
+ * @relates ValueFactory
+ */
+class PerformValueConstruction : public CastingPlatform<PerformValueConstruction, false>
+ , public SourceLocationReflection
+{
+public:
+ PerformValueConstruction(const SourceLocationReflection *const sourceLocationReflection,
+ const SchemaType::Ptr &toType) : m_sourceReflection(sourceLocationReflection)
+ , m_targetType(AtomicType::Ptr(toType))
+ {
+ Q_ASSERT(m_sourceReflection);
+ }
+
+ AtomicValue::Ptr operator()(const AtomicValue::Ptr &lexicalValue,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context)
+ {
+ prepareCasting(context, BuiltinTypes::xsString);
+ return AtomicValue::Ptr(const_cast<AtomicValue *>(cast(lexicalValue, context).asAtomicValue()));
+ }
+
+ const SourceLocationReflection *actualReflection() const
+ {
+ return m_sourceReflection;
+ }
+
+ ItemType::Ptr targetType() const
+ {
+ return m_targetType;
+ }
+
+private:
+ const SourceLocationReflection *const m_sourceReflection;
+ const ItemType::Ptr m_targetType;
+};
+
+AtomicValue::Ptr ValueFactory::fromLexical(const QString &lexicalValue,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection)
+{
+ Q_ASSERT(context);
+ Q_ASSERT(type);
+ Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
+ "We can only construct for atomic values.");
+
+ return PerformValueConstruction(sourceLocationReflection, type)(AtomicString::fromValue(lexicalValue),
+ type,
+ context);
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/data/qvaluefactory_p.h b/src/xmlpatterns/data/qvaluefactory_p.h
new file mode 100644
index 0000000..acc5733
--- /dev/null
+++ b/src/xmlpatterns/data/qvaluefactory_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_ValueFactory_H
+#define Patternist_ValueFactory_H
+
+#include "qitem_p.h"
+#include "qreportcontext_p.h"
+#include "qschematype_p.h"
+
+QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Provides fromLexical(), which allows instantiation of atomic
+ * values from arbitrary types.
+ *
+ * This class wraps the helper class CastingPlatform with a more specific,
+ * high-level API.
+ *
+ * @see CastingPlatform
+ * @author Frans Englich <fenglich@trolltech.com>
+ * @ingroup Patternist_schema
+ */
+ class ValueFactory
+ {
+ public:
+ /**
+ * @short Returns an AtomicValue of type @p type from the lexical space
+ * @p lexicalValue, and raise an error through @p context if that's
+ * impossible.
+ *
+ * ValueFactory does not take ownership of @p sourceLocationReflection.
+ */
+ static AtomicValue::Ptr fromLexical(const QString &lexicalValue,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection);
+
+ private:
+ Q_DISABLE_COPY(ValueFactory)
+ };
+}
+
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/createReportContext.xsl b/src/xmlpatterns/environment/createReportContext.xsl
index 7ca96bf..5b754d2 100644
--- a/src/xmlpatterns/environment/createReportContext.xsl
+++ b/src/xmlpatterns/environment/createReportContext.xsl
@@ -242,6 +242,11 @@ namespace QPatternist
*/]]></xsl:text>
enum ErrorCode
{
+ /**
+ * XML Schema error code.
+ */
+ XSDError,
+
<!-- The order of the calls is significant. The templates takes into account
to avoid the last comma(extractXSLT20 does this). -->
<xsl:call-template name="extractXQuery10"/>
diff --git a/src/xmlpatterns/environment/qreportcontext.cpp b/src/xmlpatterns/environment/qreportcontext.cpp
index 34ef6ce..64afcdb 100644
--- a/src/xmlpatterns/environment/qreportcontext.cpp
+++ b/src/xmlpatterns/environment/qreportcontext.cpp
@@ -448,6 +448,7 @@ QString ReportContext::codeToString(const ReportContext::ErrorCode code)
case XTTE1545: result = "XTTE1545"; break;
case XTTE1550: result = "XTTE1550"; break;
case XTTE1555: result = "XTTE1555"; break;
+ case XSDError: result = "XSDError"; break;
}
Q_ASSERT_X(result, Q_FUNC_INFO, "Unknown enum value.");
diff --git a/src/xmlpatterns/environment/qreportcontext_p.h b/src/xmlpatterns/environment/qreportcontext_p.h
index ee78972..dbdf824 100644
--- a/src/xmlpatterns/environment/qreportcontext_p.h
+++ b/src/xmlpatterns/environment/qreportcontext_p.h
@@ -151,6 +151,10 @@ namespace QPatternist
*/
enum ErrorCode
{
+ /**
+ * XML Schema error code.
+ */
+ XSDError,
/**
* It is a static error if analysis of an expression relies on some
diff --git a/src/xmlpatterns/expr/qcastingplatform.cpp b/src/xmlpatterns/expr/qcastingplatform.cpp
index bc902f9..933d188 100644
--- a/src/xmlpatterns/expr/qcastingplatform.cpp
+++ b/src/xmlpatterns/expr/qcastingplatform.cpp
@@ -83,7 +83,7 @@ Item CastingPlatform<TSubClass, issueError>::cast(const Item &sourceValue,
else
{
bool castImpossible = false;
- const AtomicCaster::Ptr caster(locateCaster(sourceValue.type(), context, castImpossible));
+ const AtomicCaster::Ptr caster(locateCaster(sourceValue.type(), context, castImpossible, static_cast<const TSubClass *>(this), targetType()));
if(!issueError && castImpossible)
{
@@ -112,7 +112,7 @@ bool CastingPlatform<TSubClass, issueError>::prepareCasting(const ReportContext:
or numeric at compile time. We'll do lookup at runtime instead. */
bool castImpossible = false;
- m_caster = locateCaster(sourceType, context, castImpossible);
+ m_caster = locateCaster(sourceType, context, castImpossible, static_cast<const TSubClass *>(this), targetType());
return !castImpossible;
}
@@ -120,20 +120,22 @@ bool CastingPlatform<TSubClass, issueError>::prepareCasting(const ReportContext:
template <typename TSubClass, const bool issueError>
AtomicCaster::Ptr CastingPlatform<TSubClass, issueError>::locateCaster(const ItemType::Ptr &sourceType,
const ReportContext::Ptr &context,
- bool &castImpossible) const
+ bool &castImpossible,
+ const SourceLocationReflection *const location,
+ const ItemType::Ptr &targetType)
{
Q_ASSERT(sourceType);
- Q_ASSERT(targetType());
+ Q_ASSERT(targetType);
const AtomicCasterLocator::Ptr locator(static_cast<AtomicType *>(
- targetType().data())->casterLocator());
+ targetType.data())->casterLocator());
if(!locator)
{
if(issueError)
{
context->error(QtXmlPatterns::tr("No casting is possible with %1 as the target type.")
- .arg(formatType(context->namePool(), targetType())),
- ReportContext::XPTY0004, static_cast<const TSubClass *>(this));
+ .arg(formatType(context->namePool(), targetType)),
+ ReportContext::XPTY0004, location);
}
else
castImpossible = true;
@@ -141,15 +143,15 @@ AtomicCaster::Ptr CastingPlatform<TSubClass, issueError>::locateCaster(const Ite
return AtomicCaster::Ptr();
}
- const AtomicCaster::Ptr caster(static_cast<const AtomicType *>(sourceType.data())->accept(locator, static_cast<const TSubClass *>(this)));
+ const AtomicCaster::Ptr caster(static_cast<const AtomicType *>(sourceType.data())->accept(locator, location));
if(!caster)
{
if(issueError)
{
context->error(QtXmlPatterns::tr("It is not possible to cast from %1 to %2.")
.arg(formatType(context->namePool(), sourceType))
- .arg(formatType(context->namePool(), targetType())),
- ReportContext::XPTY0004, static_cast<const TSubClass *>(this));
+ .arg(formatType(context->namePool(), targetType)),
+ ReportContext::XPTY0004, location);
}
else
castImpossible = true;
diff --git a/src/xmlpatterns/expr/qcastingplatform_p.h b/src/xmlpatterns/expr/qcastingplatform_p.h
index 3aded3d..91f4a8c 100644
--- a/src/xmlpatterns/expr/qcastingplatform_p.h
+++ b/src/xmlpatterns/expr/qcastingplatform_p.h
@@ -52,16 +52,17 @@
#ifndef Patternist_CastingPlatform_H
#define Patternist_CastingPlatform_H
+#include "qatomiccasterlocator_p.h"
#include "qatomiccaster_p.h"
-#include "qqnamevalue_p.h"
#include "qatomicstring_p.h"
-#include "qvalidationerror_p.h"
-#include "qatomiccasterlocator_p.h"
#include "qatomictype_p.h"
#include "qbuiltintypes_p.h"
#include "qcommonsequencetypes_p.h"
-#include "qschematypefactory_p.h"
#include "qpatternistlocale_p.h"
+#include "qqnamevalue_p.h"
+#include "qschematypefactory_p.h"
+#include "qstaticcontext_p.h"
+#include "qvalidationerror_p.h"
QT_BEGIN_HEADER
@@ -101,6 +102,7 @@ namespace QPatternist
* function targetType() must be implemented such that CastingPlatform knows
* what type it shall cast to.
*
+ * @see ValueFactory
* @author Frans Englich <fenglich@trolltech.com>
* @ingroup Patternist_expressions
*/
@@ -167,9 +169,16 @@ namespace QPatternist
*
* @p castImpossible is not initialized. Initialize it to @c false.
*/
- AtomicCaster::Ptr locateCaster(const ItemType::Ptr &sourceType,
- const ReportContext::Ptr &context,
- bool &castImpossible) const;
+ static AtomicCaster::Ptr locateCaster(const ItemType::Ptr &sourceType,
+ const ReportContext::Ptr &context,
+ bool &castImpossible,
+ const SourceLocationReflection *const location,
+ const ItemType::Ptr &targetType);
+ private:
+ inline Item castWithCaster(const Item &sourceValue,
+ const AtomicCaster::Ptr &caster,
+ const DynamicContext::Ptr &context) const;
+
inline ItemType::Ptr targetType() const
{
diff --git a/src/xmlpatterns/expr/qexpressionfactory.cpp b/src/xmlpatterns/expr/qexpressionfactory.cpp
index e243037..0ddf3b1 100644
--- a/src/xmlpatterns/expr/qexpressionfactory.cpp
+++ b/src/xmlpatterns/expr/qexpressionfactory.cpp
@@ -81,9 +81,13 @@ Expression::Ptr ExpressionFactory::createExpression(const QString &expr,
const QUrl &queryURI,
const QXmlName &initialTemplateName)
{
- if(lang == QXmlQuery::XQuery10)
+ if(lang == QXmlQuery::XSLT20)
{
- return createExpression(Tokenizer::Ptr(new XQueryTokenizer(expr, queryURI)),
+ QByteArray query(expr.toUtf8());
+ QBuffer buffer(&query);
+ buffer.open(QIODevice::ReadOnly);
+
+ return createExpression(&buffer,
context,
lang,
requiredType,
@@ -92,12 +96,7 @@ Expression::Ptr ExpressionFactory::createExpression(const QString &expr,
}
else
{
- Q_ASSERT(lang == QXmlQuery::XSLT20);
- QByteArray query(expr.toUtf8());
- QBuffer buffer(&query);
- buffer.open(QIODevice::ReadOnly);
-
- return createExpression(&buffer,
+ return createExpression(Tokenizer::Ptr(new XQueryTokenizer(expr, queryURI)),
context,
lang,
requiredType,
@@ -118,16 +117,10 @@ Expression::Ptr ExpressionFactory::createExpression(QIODevice *const device,
Tokenizer::Ptr tokenizer;
- if(lang == QXmlQuery::XQuery10)
- {
-
- tokenizer = Tokenizer::Ptr(new XQueryTokenizer(QString::fromUtf8(device->readAll()), queryURI));
- }
- else
- {
- Q_ASSERT(lang == QXmlQuery::XSLT20);
+ if(lang == QXmlQuery::XSLT20)
tokenizer = Tokenizer::Ptr(new XSLTTokenizer(device, queryURI, context, context->namePool()));
- }
+ else
+ tokenizer = Tokenizer::Ptr(new XQueryTokenizer(QString::fromUtf8(device->readAll()), queryURI));
return createExpression(tokenizer, context, lang, requiredType, queryURI, initialTemplateName);
}
diff --git a/src/xmlpatterns/functions/qpatternplatform.cpp b/src/xmlpatterns/functions/qpatternplatform.cpp
index 74414f4..5339f28 100644
--- a/src/xmlpatterns/functions/qpatternplatform.cpp
+++ b/src/xmlpatterns/functions/qpatternplatform.cpp
@@ -168,8 +168,15 @@ void PatternPlatform::applyFlags(const Flags flags, QRegExp &patternP)
// TODO Apply the other flags, like 'x'.
}
+QRegExp PatternPlatform::parsePattern(const QString &pattern,
+ const ReportContext::Ptr &context) const
+{
+ return parsePattern(pattern, context, this);
+}
+
QRegExp PatternPlatform::parsePattern(const QString &patternP,
- const DynamicContext::Ptr &context) const
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const location)
{
if(patternP == QLatin1String("(.)\\3") ||
patternP == QLatin1String("\\3") ||
@@ -177,7 +184,7 @@ QRegExp PatternPlatform::parsePattern(const QString &patternP,
{
context->error(QLatin1String("We don't want to hang infinitely on K2-MatchesFunc-9, "
"10 and 11. See Trolltech task 148505."),
- ReportContext::FOER0000, this);
+ ReportContext::FOER0000, location);
return QRegExp();
}
@@ -189,14 +196,8 @@ QRegExp PatternPlatform::parsePattern(const QString &patternP,
* QChar::category(). */
rewrittenPattern.replace(QLatin1String("[\\i-[:]]"), QLatin1String("[a-zA-Z_]"));
rewrittenPattern.replace(QLatin1String("[\\c-[:]]"), QLatin1String("[a-zA-Z0-9_\\-\\.]"));
- rewrittenPattern.replace(QLatin1String("\\i"), QLatin1String("[a-zA-Z:_]"));
- rewrittenPattern.replace(QLatin1String("\\c"), QLatin1String("[a-zA-Z0-9:_\\-\\.]"));
- rewrittenPattern.replace(QLatin1String("\\p{L}"), QLatin1String("[a-zA-Z]"));
- rewrittenPattern.replace(QLatin1String("\\p{Lu}"), QLatin1String("[A-Z]"));
- rewrittenPattern.replace(QLatin1String("\\p{Ll}"), QLatin1String("[a-z]"));
- rewrittenPattern.replace(QLatin1String("\\p{Nd}"), QLatin1String("[0-9]"));
- QRegExp retval(rewrittenPattern);
+ QRegExp retval(rewrittenPattern, Qt::CaseSensitive, QRegExp::W3CXmlSchema11);
if(retval.isValid())
return retval;
@@ -204,7 +205,7 @@ QRegExp PatternPlatform::parsePattern(const QString &patternP,
{
context->error(QtXmlPatterns::tr("%1 is an invalid regular expression pattern: %2")
.arg(formatExpression(patternP), retval.errorString()),
- ReportContext::FORX0002, this);
+ ReportContext::FORX0002, location);
return QRegExp();
}
}
diff --git a/src/xmlpatterns/functions/qpatternplatform_p.h b/src/xmlpatterns/functions/qpatternplatform_p.h
index 3f4b18e..76f5332 100644
--- a/src/xmlpatterns/functions/qpatternplatform_p.h
+++ b/src/xmlpatterns/functions/qpatternplatform_p.h
@@ -122,6 +122,14 @@ namespace QPatternist
*/
inline int captureCount() const;
+ /**
+ * @short Parses pattern
+ */
+ static QRegExp parsePattern(const QString &pattern,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const location);
+
+
protected:
/**
* @short This constructor is protected, because this class is supposed to be sub-classed.
@@ -146,14 +154,18 @@ namespace QPatternist
};
typedef QFlags<PreCompiledPart> PreCompiledParts;
+ /**
+ * @short Calls the public parsePattern() function and passes in @c
+ * this as the location.
+ */
+ inline QRegExp parsePattern(const QString &pattern,
+ const ReportContext::Ptr &context) const;
+
Q_DISABLE_COPY(PatternPlatform)
Flags parseFlags(const QString &flags,
const DynamicContext::Ptr &context) const;
- QRegExp parsePattern(const QString &pattern,
- const DynamicContext::Ptr &context) const;
-
static void applyFlags(const Flags flags, QRegExp &pattern);
/**
diff --git a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
index 81724f8..e3f30c5 100644
--- a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
+++ b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
@@ -69,19 +69,6 @@ Item IdFN::mapToItem(const QString &id,
}
/**
- * @short Helper class for StringSplitter
- *
- * Needed by the QAbstractXmlForwardIterator sub-class.
- *
- * @relates StringSplitter
- */
-template<>
-bool qIsForwardIteratorEnd(const QString &unit)
-{
- return unit.isNull();
-}
-
-/**
* @short Helper class for IdFN.
*
* StringSplitter takes an Iterator which delivers strings of this kind:
diff --git a/src/xmlpatterns/parser/qmaintainingreader.cpp b/src/xmlpatterns/parser/qmaintainingreader.cpp
index 0513555..8569f05 100644
--- a/src/xmlpatterns/parser/qmaintainingreader.cpp
+++ b/src/xmlpatterns/parser/qmaintainingreader.cpp
@@ -172,7 +172,7 @@ void MaintainingReader<TokenLookupClass, LookupKey>::validateElement(const Looku
QStringList allowed;
for(int i = 0; i < totalCount; ++i)
- allowed.append(formatKeyword(toString(all.at(i))));
+ allowed.append(QPatternist::formatKeyword(TokenLookupClass::toString(all.at(i))));
/* Note, we can't run toString() on attrName, because we're in this branch,
* the token lookup doesn't have the string(!).*/
@@ -229,7 +229,7 @@ void MaintainingReader<TokenLookupClass, LookupKey>::validateElement(const Looku
if(!requiredButMissing.isEmpty())
{
error(QtXmlPatterns::tr("The attribute %1 must appear on element %2.")
- .arg(formatKeyword(toString(*requiredButMissing.constBegin())),
+ .arg(QPatternist::formatKeyword(TokenLookupClass::toString(*requiredButMissing.constBegin())),
formatKeyword(name())),
ReportContext::XTSE0010);
}
diff --git a/src/xmlpatterns/parser/qmaintainingreader_p.h b/src/xmlpatterns/parser/qmaintainingreader_p.h
index c2c991e..eb20bdb 100644
--- a/src/xmlpatterns/parser/qmaintainingreader_p.h
+++ b/src/xmlpatterns/parser/qmaintainingreader_p.h
@@ -59,6 +59,7 @@
#include <QXmlStreamReader>
#include "qxpathhelper_p.h"
+#include "qxslttokenlookup_p.h"
class QUrl;
diff --git a/src/xmlpatterns/parser/qquerytransformparser.cpp b/src/xmlpatterns/parser/qquerytransformparser.cpp
index cc6c82e..d80c09f 100644
--- a/src/xmlpatterns/parser/qquerytransformparser.cpp
+++ b/src/xmlpatterns/parser/qquerytransformparser.cpp
@@ -300,11 +300,18 @@ static inline QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator,
}
/**
+ * @internal
+ * @relates QXmlQuery
+ */
+typedef QFlags<QXmlQuery::QueryLanguage> QueryLanguages;
+
+/**
* @short Flags invalid expressions and declarations in the currently
* parsed language.
*
- * Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0 and
- * XPath 2.0 inside XSL-T, it is the union of all the constructs in these
+ * Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0, and
+ * XPath 2.0 inside XSL-T, and field and selector patterns in W3C XML Schema's
+ * identity constraints, it is the union of all the constructs in these
* languages. However, when dealing with each language individually, we
* regularly need to disallow some expressions, such as direct element
* constructors when parsing XSL-T, or the typeswitch when parsing XPath.
@@ -315,19 +322,46 @@ static inline QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator,
* instance the @c let clause, should not be flagged as an error, because it's
* used for internal purposes.
*
- * Hence, this function is called from each expression and declaration which is
- * unavailable in XPath.
+ * Hence, this function is called from each expression and declaration with @p
+ * allowedLanguages stating what languages it is allowed in.
*
* If @p isInternal is @c true, no error is raised. Otherwise, if the current
- * language is not XQuery, an error is raised.
+ * language is not in @p allowedLanguages, an error is raised.
*/
-static void disallowedConstruct(const ParserContext *const parseInfo,
- const YYLTYPE &sourceLocator,
- const bool isInternal = false)
+static void allowedIn(const QueryLanguages allowedLanguages,
+ const ParserContext *const parseInfo,
+ const YYLTYPE &sourceLocator,
+ const bool isInternal = false)
{
- if(!isInternal && parseInfo->languageAccent != QXmlQuery::XQuery10)
+ /* We treat XPath 2.0 as a subset of XSL-T 2.0, so if XPath 2.0 is allowed
+ * and XSL-T is the language, it's ok. */
+ if(!isInternal &&
+ (!allowedLanguages.testFlag(parseInfo->languageAccent) && !(allowedLanguages.testFlag(QXmlQuery::XPath20) && parseInfo->languageAccent == QXmlQuery::XSLT20)))
{
- parseInfo->staticContext->error(QtXmlPatterns::tr("A construct was encountered which only is allowed in XQuery."),
+
+ QString langName;
+
+ switch(parseInfo->languageAccent)
+ {
+ case QXmlQuery::XPath20:
+ langName = QLatin1String("XPath 2.0");
+ break;
+ case QXmlQuery::XSLT20:
+ langName = QLatin1String("XSL-T 2.0");
+ break;
+ case QXmlQuery::XQuery10:
+ langName = QLatin1String("XQuery 1.0");
+ break;
+ case QXmlQuery::XmlSchema11IdentityConstraintSelector:
+ langName = QtXmlPatterns::tr("W3C XML Schema identity constraint selector");
+ break;
+ case QXmlQuery::XmlSchema11IdentityConstraintField:
+ langName = QtXmlPatterns::tr("W3C XML Schema identity constraint field");
+ break;
+ }
+
+ parseInfo->staticContext->error(QtXmlPatterns::tr("A construct was encountered "
+ "which is disallowed in the current language(%1).").arg(langName),
ReportContext::XPST0003,
fromYYLTYPE(sourceLocator, parseInfo));
@@ -1366,7 +1400,7 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
/* Line 221 of yacc.c. */
-#line 1289 "qquerytransformparser.cpp"
+#line 1323 "qquerytransformparser.cpp"
#ifdef short
# undef short
@@ -1850,54 +1884,54 @@ static const yytype_int16 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 1341, 1341, 1342, 1344, 1345, 1376, 1377, 1393, 1491,
- 1493, 1499, 1501, 1508, 1514, 1520, 1527, 1530, 1534, 1538,
- 1558, 1572, 1576, 1570, 1639, 1643, 1660, 1663, 1665, 1670,
- 1671, 1675, 1676, 1680, 1684, 1688, 1690, 1691, 1693, 1695,
- 1741, 1755, 1760, 1765, 1766, 1768, 1783, 1798, 1808, 1823,
- 1827, 1832, 1846, 1850, 1855, 1869, 1874, 1879, 1884, 1889,
- 1905, 1928, 1936, 1937, 1938, 1940, 1957, 1958, 1960, 1961,
- 1963, 1964, 1966, 2021, 2025, 2031, 2034, 2039, 2053, 2057,
- 2063, 2062, 2171, 2174, 2180, 2201, 2207, 2211, 2213, 2218,
- 2228, 2229, 2234, 2235, 2244, 2314, 2325, 2326, 2330, 2335,
- 2404, 2405, 2409, 2414, 2458, 2459, 2464, 2471, 2477, 2478,
- 2479, 2480, 2481, 2482, 2488, 2493, 2499, 2502, 2507, 2513,
- 2519, 2523, 2548, 2549, 2553, 2557, 2551, 2598, 2601, 2596,
- 2617, 2618, 2619, 2622, 2626, 2634, 2633, 2647, 2646, 2655,
- 2656, 2657, 2659, 2667, 2678, 2681, 2683, 2688, 2695, 2702,
- 2708, 2728, 2733, 2739, 2742, 2744, 2745, 2752, 2758, 2762,
- 2767, 2768, 2771, 2775, 2770, 2784, 2788, 2783, 2796, 2799,
- 2803, 2798, 2812, 2816, 2811, 2824, 2826, 2854, 2853, 2865,
- 2873, 2864, 2884, 2885, 2888, 2892, 2897, 2902, 2901, 2917,
- 2922, 2923, 2928, 2929, 2934, 2935, 2936, 2937, 2939, 2940,
- 2945, 2946, 2951, 2952, 2954, 2955, 2960, 2961, 2962, 2963,
- 2965, 2966, 2971, 2972, 2977, 2978, 2980, 2984, 2989, 2990,
- 2996, 2997, 3002, 3003, 3008, 3009, 3014, 3015, 3020, 3024,
- 3029, 3030, 3031, 3033, 3038, 3039, 3040, 3041, 3042, 3043,
- 3045, 3050, 3051, 3052, 3053, 3054, 3055, 3057, 3062, 3063,
- 3064, 3066, 3080, 3081, 3082, 3084, 3100, 3104, 3109, 3110,
- 3112, 3117, 3118, 3120, 3126, 3130, 3136, 3139, 3140, 3144,
- 3153, 3158, 3162, 3163, 3168, 3167, 3182, 3189, 3188, 3203,
- 3211, 3211, 3220, 3222, 3225, 3230, 3232, 3236, 3302, 3305,
- 3311, 3314, 3323, 3327, 3331, 3336, 3337, 3342, 3343, 3346,
- 3345, 3375, 3377, 3378, 3380, 3394, 3395, 3396, 3397, 3398,
- 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3408, 3407, 3417,
- 3428, 3433, 3435, 3440, 3441, 3443, 3447, 3449, 3453, 3462,
- 3468, 3469, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481,
- 3491, 3492, 3497, 3501, 3506, 3511, 3516, 3521, 3525, 3530,
- 3535, 3540, 3569, 3573, 3580, 3582, 3586, 3588, 3589, 3590,
- 3624, 3633, 3622, 3874, 3878, 3898, 3901, 3907, 3912, 3917,
- 3923, 3926, 3936, 3943, 3947, 3953, 3967, 3973, 3990, 3995,
- 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4016, 4024, 4023,
- 4063, 4066, 4071, 4086, 4091, 4098, 4110, 4114, 4110, 4120,
- 4122, 4126, 4128, 4143, 4147, 4156, 4161, 4165, 4171, 4174,
- 4179, 4184, 4189, 4190, 4191, 4192, 4194, 4195, 4196, 4197,
- 4202, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4246, 4251,
- 4256, 4262, 4263, 4265, 4270, 4275, 4280, 4285, 4301, 4302,
- 4304, 4309, 4314, 4318, 4330, 4343, 4353, 4358, 4363, 4368,
- 4382, 4396, 4397, 4399, 4409, 4411, 4416, 4423, 4430, 4432,
- 4434, 4435, 4437, 4441, 4446, 4447, 4449, 4455, 4457, 4459,
- 4460, 4462, 4474
+ 0, 1375, 1375, 1376, 1378, 1379, 1410, 1411, 1427, 1525,
+ 1527, 1533, 1535, 1542, 1548, 1554, 1561, 1564, 1568, 1572,
+ 1592, 1606, 1610, 1604, 1673, 1677, 1694, 1697, 1699, 1704,
+ 1705, 1709, 1710, 1714, 1718, 1722, 1724, 1725, 1727, 1729,
+ 1775, 1789, 1794, 1799, 1800, 1802, 1817, 1832, 1842, 1857,
+ 1861, 1866, 1880, 1884, 1889, 1903, 1908, 1913, 1918, 1923,
+ 1939, 1962, 1970, 1971, 1972, 1974, 1991, 1992, 1994, 1995,
+ 1997, 1998, 2000, 2055, 2059, 2065, 2068, 2073, 2087, 2091,
+ 2097, 2096, 2205, 2208, 2214, 2235, 2241, 2245, 2247, 2252,
+ 2262, 2263, 2268, 2269, 2278, 2348, 2359, 2360, 2364, 2369,
+ 2438, 2439, 2443, 2448, 2492, 2493, 2498, 2505, 2511, 2512,
+ 2513, 2514, 2515, 2516, 2522, 2527, 2533, 2536, 2541, 2547,
+ 2553, 2557, 2582, 2583, 2587, 2591, 2585, 2632, 2635, 2630,
+ 2651, 2652, 2653, 2656, 2660, 2668, 2667, 2681, 2680, 2689,
+ 2690, 2691, 2693, 2701, 2712, 2715, 2717, 2722, 2729, 2736,
+ 2742, 2762, 2767, 2773, 2776, 2778, 2779, 2786, 2792, 2796,
+ 2801, 2802, 2805, 2809, 2804, 2819, 2823, 2818, 2831, 2834,
+ 2838, 2833, 2848, 2852, 2847, 2860, 2862, 2890, 2889, 2901,
+ 2909, 2900, 2920, 2921, 2924, 2928, 2933, 2938, 2937, 2953,
+ 2959, 2960, 2966, 2967, 2973, 2974, 2975, 2976, 2978, 2979,
+ 2985, 2986, 2992, 2993, 2995, 2996, 3002, 3003, 3004, 3005,
+ 3007, 3008, 3018, 3019, 3025, 3026, 3028, 3032, 3037, 3038,
+ 3045, 3046, 3052, 3053, 3059, 3060, 3066, 3067, 3073, 3077,
+ 3082, 3083, 3084, 3086, 3092, 3093, 3094, 3095, 3096, 3097,
+ 3099, 3104, 3105, 3106, 3107, 3108, 3109, 3111, 3116, 3117,
+ 3118, 3120, 3134, 3135, 3136, 3138, 3155, 3159, 3164, 3165,
+ 3167, 3172, 3173, 3175, 3181, 3185, 3191, 3194, 3195, 3199,
+ 3208, 3213, 3217, 3218, 3223, 3222, 3237, 3245, 3244, 3260,
+ 3268, 3268, 3277, 3279, 3282, 3287, 3289, 3293, 3359, 3362,
+ 3368, 3371, 3380, 3384, 3388, 3393, 3394, 3399, 3400, 3403,
+ 3402, 3432, 3434, 3435, 3437, 3481, 3482, 3483, 3484, 3485,
+ 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3495, 3494, 3505,
+ 3516, 3521, 3523, 3528, 3529, 3534, 3538, 3540, 3544, 3553,
+ 3560, 3561, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574,
+ 3584, 3585, 3590, 3595, 3601, 3607, 3612, 3617, 3622, 3628,
+ 3633, 3638, 3668, 3672, 3679, 3681, 3685, 3690, 3691, 3692,
+ 3726, 3735, 3724, 3976, 3980, 4000, 4003, 4009, 4014, 4019,
+ 4025, 4028, 4038, 4045, 4049, 4055, 4069, 4075, 4092, 4097,
+ 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4118, 4126, 4125,
+ 4165, 4168, 4173, 4188, 4193, 4200, 4212, 4216, 4212, 4222,
+ 4224, 4228, 4230, 4245, 4249, 4258, 4263, 4267, 4273, 4276,
+ 4281, 4286, 4291, 4292, 4293, 4294, 4296, 4297, 4298, 4299,
+ 4304, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4348, 4353,
+ 4358, 4364, 4365, 4367, 4372, 4377, 4382, 4387, 4403, 4404,
+ 4406, 4411, 4416, 4420, 4432, 4445, 4455, 4460, 4465, 4470,
+ 4484, 4498, 4499, 4501, 4511, 4513, 4518, 4525, 4532, 4534,
+ 4536, 4537, 4539, 4543, 4548, 4549, 4551, 4557, 4559, 4561,
+ 4565, 4570, 4582
};
#endif
@@ -3726,7 +3760,7 @@ yyreduce:
{
case 5:
/* Line 1269 of yacc.c. */
-#line 1346 "querytransformparser.ypp"
+#line 1380 "querytransformparser.ypp"
{
/* Suppress more compiler warnings about unused defines. */
@@ -3760,7 +3794,7 @@ yyreduce:
case 7:
/* Line 1269 of yacc.c. */
-#line 1378 "querytransformparser.ypp"
+#line 1412 "querytransformparser.ypp"
{
const QRegExp encNameRegExp(QLatin1String("[A-Za-z][A-Za-z0-9._\\-]*"));
@@ -3779,7 +3813,7 @@ yyreduce:
case 8:
/* Line 1269 of yacc.c. */
-#line 1394 "querytransformparser.ypp"
+#line 1428 "querytransformparser.ypp"
{
/* In XSL-T, we can have dangling variable references, so resolve them
* before we proceed with other steps, such as checking circularity. */
@@ -3880,7 +3914,7 @@ yyreduce:
case 10:
/* Line 1269 of yacc.c. */
-#line 1494 "querytransformparser.ypp"
+#line 1528 "querytransformparser.ypp"
{
// TODO add to namespace context
parseInfo->moduleNamespace = parseInfo->staticContext->namePool()->allocateNamespace((yyvsp[(3) - (6)].sval));
@@ -3889,9 +3923,9 @@ yyreduce:
case 12:
/* Line 1269 of yacc.c. */
-#line 1502 "querytransformparser.ypp"
+#line 1536 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
if(parseInfo->hasSecondPrologPart)
parseInfo->staticContext->error(QtXmlPatterns::tr("A default namespace declaration must occur before function, "
"variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo));
@@ -3900,7 +3934,7 @@ yyreduce:
case 13:
/* Line 1269 of yacc.c. */
-#line 1509 "querytransformparser.ypp"
+#line 1543 "querytransformparser.ypp"
{
if(parseInfo->hasSecondPrologPart)
parseInfo->staticContext->error(QtXmlPatterns::tr("A default namespace declaration must occur before function, "
@@ -3910,7 +3944,7 @@ yyreduce:
case 14:
/* Line 1269 of yacc.c. */
-#line 1515 "querytransformparser.ypp"
+#line 1549 "querytransformparser.ypp"
{
if(parseInfo->hasSecondPrologPart)
parseInfo->staticContext->error(QtXmlPatterns::tr("Namespace declarations must occur before function, "
@@ -3920,9 +3954,9 @@ yyreduce:
case 15:
/* Line 1269 of yacc.c. */
-#line 1521 "querytransformparser.ypp"
+#line 1555 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
if(parseInfo->hasSecondPrologPart)
parseInfo->staticContext->error(QtXmlPatterns::tr("Module imports must occur before function, "
"variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo));
@@ -3931,7 +3965,7 @@ yyreduce:
case 17:
/* Line 1269 of yacc.c. */
-#line 1531 "querytransformparser.ypp"
+#line 1565 "querytransformparser.ypp"
{
parseInfo->hasSecondPrologPart = true;
}
@@ -3939,7 +3973,7 @@ yyreduce:
case 18:
/* Line 1269 of yacc.c. */
-#line 1535 "querytransformparser.ypp"
+#line 1569 "querytransformparser.ypp"
{
parseInfo->hasSecondPrologPart = true;
}
@@ -3947,16 +3981,16 @@ yyreduce:
case 19:
/* Line 1269 of yacc.c. */
-#line 1539 "querytransformparser.ypp"
+#line 1573 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
parseInfo->hasSecondPrologPart = true;
}
break;
case 20:
/* Line 1269 of yacc.c. */
-#line 1562 "querytransformparser.ypp"
+#line 1596 "querytransformparser.ypp"
{
Template::Ptr temp(create(new Template(parseInfo->currentImportPrecedence, (yyvsp[(5) - (7)].sequenceType)), (yyloc), parseInfo));
@@ -3969,7 +4003,7 @@ yyreduce:
case 21:
/* Line 1269 of yacc.c. */
-#line 1572 "querytransformparser.ypp"
+#line 1606 "querytransformparser.ypp"
{
parseInfo->isParsingPattern = true;
}
@@ -3977,7 +4011,7 @@ yyreduce:
case 22:
/* Line 1269 of yacc.c. */
-#line 1576 "querytransformparser.ypp"
+#line 1610 "querytransformparser.ypp"
{
parseInfo->isParsingPattern = false;
}
@@ -3985,7 +4019,7 @@ yyreduce:
case 23:
/* Line 1269 of yacc.c. */
-#line 1585 "querytransformparser.ypp"
+#line 1619 "querytransformparser.ypp"
{
/* In this grammar branch, we're guaranteed to be a template rule, but
* may also be a named template. */
@@ -4042,7 +4076,7 @@ yyreduce:
case 24:
/* Line 1269 of yacc.c. */
-#line 1639 "querytransformparser.ypp"
+#line 1673 "querytransformparser.ypp"
{
(yyval.enums.Double) = std::numeric_limits<xsDouble>::quiet_NaN();
}
@@ -4050,7 +4084,7 @@ yyreduce:
case 25:
/* Line 1269 of yacc.c. */
-#line 1644 "querytransformparser.ypp"
+#line 1678 "querytransformparser.ypp"
{
const AtomicValue::Ptr val(Decimal::fromLexical((yyvsp[(2) - (2)].sval)));
if(val->hasError())
@@ -4069,7 +4103,7 @@ yyreduce:
case 26:
/* Line 1269 of yacc.c. */
-#line 1660 "querytransformparser.ypp"
+#line 1694 "querytransformparser.ypp"
{
(yyval.qName) = QXmlName();
}
@@ -4077,7 +4111,7 @@ yyreduce:
case 28:
/* Line 1269 of yacc.c. */
-#line 1666 "querytransformparser.ypp"
+#line 1700 "querytransformparser.ypp"
{
(yyval.qName) = (yyvsp[(2) - (2)].qName);
}
@@ -4085,42 +4119,42 @@ yyreduce:
case 30:
/* Line 1269 of yacc.c. */
-#line 1672 "querytransformparser.ypp"
+#line 1706 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
}
break;
case 32:
/* Line 1269 of yacc.c. */
-#line 1677 "querytransformparser.ypp"
+#line 1711 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
}
break;
case 33:
/* Line 1269 of yacc.c. */
-#line 1681 "querytransformparser.ypp"
+#line 1715 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
}
break;
case 34:
/* Line 1269 of yacc.c. */
-#line 1685 "querytransformparser.ypp"
+#line 1719 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
}
break;
case 39:
/* Line 1269 of yacc.c. */
-#line 1696 "querytransformparser.ypp"
+#line 1730 "querytransformparser.ypp"
{
if(!(yyvsp[(6) - (7)].enums.Bool))
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
if((yyvsp[(3) - (7)].sval) == QLatin1String("xmlns"))
{
@@ -4166,7 +4200,7 @@ yyreduce:
case 40:
/* Line 1269 of yacc.c. */
-#line 1742 "querytransformparser.ypp"
+#line 1776 "querytransformparser.ypp"
{
if(parseInfo->hasDeclaration(ParserContext::BoundarySpaceDecl))
{
@@ -4183,7 +4217,7 @@ yyreduce:
case 41:
/* Line 1269 of yacc.c. */
-#line 1756 "querytransformparser.ypp"
+#line 1790 "querytransformparser.ypp"
{
(yyval.enums.boundarySpacePolicy) = StaticContext::BSPStrip;
}
@@ -4191,7 +4225,7 @@ yyreduce:
case 42:
/* Line 1269 of yacc.c. */
-#line 1761 "querytransformparser.ypp"
+#line 1795 "querytransformparser.ypp"
{
(yyval.enums.boundarySpacePolicy) = StaticContext::BSPPreserve;
}
@@ -4199,7 +4233,7 @@ yyreduce:
case 45:
/* Line 1269 of yacc.c. */
-#line 1770 "querytransformparser.ypp"
+#line 1804 "querytransformparser.ypp"
{
if(parseInfo->hasDeclaration(ParserContext::DeclareDefaultElementNamespace))
{
@@ -4216,7 +4250,7 @@ yyreduce:
case 46:
/* Line 1269 of yacc.c. */
-#line 1785 "querytransformparser.ypp"
+#line 1819 "querytransformparser.ypp"
{
if(parseInfo->hasDeclaration(ParserContext::DeclareDefaultFunctionNamespace))
{
@@ -4233,7 +4267,7 @@ yyreduce:
case 47:
/* Line 1269 of yacc.c. */
-#line 1799 "querytransformparser.ypp"
+#line 1833 "querytransformparser.ypp"
{
if((yyvsp[(3) - (5)].qName).prefix() == StandardPrefixes::empty)
{
@@ -4246,9 +4280,9 @@ yyreduce:
case 48:
/* Line 1269 of yacc.c. */
-#line 1809 "querytransformparser.ypp"
+#line 1843 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
if(parseInfo->hasDeclaration(ParserContext::OrderingModeDecl))
{
parseInfo->staticContext->error(prologMessage("declare ordering"),
@@ -4264,7 +4298,7 @@ yyreduce:
case 49:
/* Line 1269 of yacc.c. */
-#line 1824 "querytransformparser.ypp"
+#line 1858 "querytransformparser.ypp"
{
(yyval.enums.orderingMode) = StaticContext::Ordered;
}
@@ -4272,7 +4306,7 @@ yyreduce:
case 50:
/* Line 1269 of yacc.c. */
-#line 1828 "querytransformparser.ypp"
+#line 1862 "querytransformparser.ypp"
{
(yyval.enums.orderingMode) = StaticContext::Unordered;
}
@@ -4280,7 +4314,7 @@ yyreduce:
case 51:
/* Line 1269 of yacc.c. */
-#line 1833 "querytransformparser.ypp"
+#line 1867 "querytransformparser.ypp"
{
if(parseInfo->hasDeclaration(ParserContext::EmptyOrderDecl))
{
@@ -4297,7 +4331,7 @@ yyreduce:
case 52:
/* Line 1269 of yacc.c. */
-#line 1847 "querytransformparser.ypp"
+#line 1881 "querytransformparser.ypp"
{
(yyval.enums.orderingEmptySequence) = StaticContext::Least;
}
@@ -4305,7 +4339,7 @@ yyreduce:
case 53:
/* Line 1269 of yacc.c. */
-#line 1851 "querytransformparser.ypp"
+#line 1885 "querytransformparser.ypp"
{
(yyval.enums.orderingEmptySequence) = StaticContext::Greatest;
}
@@ -4313,7 +4347,7 @@ yyreduce:
case 54:
/* Line 1269 of yacc.c. */
-#line 1857 "querytransformparser.ypp"
+#line 1891 "querytransformparser.ypp"
{
if(parseInfo->hasDeclaration(ParserContext::CopyNamespacesDecl))
{
@@ -4329,7 +4363,7 @@ yyreduce:
case 55:
/* Line 1269 of yacc.c. */
-#line 1870 "querytransformparser.ypp"
+#line 1904 "querytransformparser.ypp"
{
parseInfo->preserveNamespacesMode = true;
}
@@ -4337,7 +4371,7 @@ yyreduce:
case 56:
/* Line 1269 of yacc.c. */
-#line 1875 "querytransformparser.ypp"
+#line 1909 "querytransformparser.ypp"
{
parseInfo->preserveNamespacesMode = false;
}
@@ -4345,7 +4379,7 @@ yyreduce:
case 57:
/* Line 1269 of yacc.c. */
-#line 1880 "querytransformparser.ypp"
+#line 1914 "querytransformparser.ypp"
{
parseInfo->inheritNamespacesMode = true;
}
@@ -4353,7 +4387,7 @@ yyreduce:
case 58:
/* Line 1269 of yacc.c. */
-#line 1885 "querytransformparser.ypp"
+#line 1919 "querytransformparser.ypp"
{
parseInfo->inheritNamespacesMode = false;
}
@@ -4361,7 +4395,7 @@ yyreduce:
case 59:
/* Line 1269 of yacc.c. */
-#line 1890 "querytransformparser.ypp"
+#line 1924 "querytransformparser.ypp"
{
if(parseInfo->hasDeclaration(ParserContext::DefaultCollationDecl))
{
@@ -4380,9 +4414,9 @@ yyreduce:
case 60:
/* Line 1269 of yacc.c. */
-#line 1906 "querytransformparser.ypp"
+#line 1940 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc), (yyvsp[(3) - (5)].enums.Bool));
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, (yyloc), (yyvsp[(3) - (5)].enums.Bool));
if(parseInfo->hasDeclaration(ParserContext::BaseURIDecl))
{
parseInfo->staticContext->error(prologMessage("declare base-uri"),
@@ -4406,7 +4440,7 @@ yyreduce:
case 61:
/* Line 1269 of yacc.c. */
-#line 1929 "querytransformparser.ypp"
+#line 1963 "querytransformparser.ypp"
{
parseInfo->staticContext->error(QtXmlPatterns::tr("The Schema Import feature is not supported, "
"and therefore %1 declarations cannot occur.")
@@ -4417,7 +4451,7 @@ yyreduce:
case 65:
/* Line 1269 of yacc.c. */
-#line 1941 "querytransformparser.ypp"
+#line 1975 "querytransformparser.ypp"
{
if((yyvsp[(4) - (6)].sval).isEmpty())
{
@@ -4437,9 +4471,9 @@ yyreduce:
case 72:
/* Line 1269 of yacc.c. */
-#line 1968 "querytransformparser.ypp"
+#line 2002 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc), (yyvsp[(3) - (9)].enums.Bool));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(3) - (9)].enums.Bool));
if(variableByName((yyvsp[(5) - (9)].qName), parseInfo))
{
parseInfo->staticContext->error(QtXmlPatterns::tr("A variable by name %1 has already "
@@ -4494,7 +4528,7 @@ yyreduce:
case 73:
/* Line 1269 of yacc.c. */
-#line 2022 "querytransformparser.ypp"
+#line 2056 "querytransformparser.ypp"
{
(yyval.expr).reset();
}
@@ -4502,7 +4536,7 @@ yyreduce:
case 74:
/* Line 1269 of yacc.c. */
-#line 2026 "querytransformparser.ypp"
+#line 2060 "querytransformparser.ypp"
{
(yyval.expr) = (yyvsp[(2) - (2)].expr);
}
@@ -4510,7 +4544,7 @@ yyreduce:
case 75:
/* Line 1269 of yacc.c. */
-#line 2031 "querytransformparser.ypp"
+#line 2065 "querytransformparser.ypp"
{
(yyval.expr).reset();
}
@@ -4518,7 +4552,7 @@ yyreduce:
case 76:
/* Line 1269 of yacc.c. */
-#line 2035 "querytransformparser.ypp"
+#line 2069 "querytransformparser.ypp"
{
(yyval.expr) = (yyvsp[(2) - (2)].expr);
}
@@ -4526,7 +4560,7 @@ yyreduce:
case 77:
/* Line 1269 of yacc.c. */
-#line 2040 "querytransformparser.ypp"
+#line 2074 "querytransformparser.ypp"
{
if(parseInfo->hasDeclaration(ParserContext::ConstructionDecl))
{
@@ -4543,7 +4577,7 @@ yyreduce:
case 78:
/* Line 1269 of yacc.c. */
-#line 2054 "querytransformparser.ypp"
+#line 2088 "querytransformparser.ypp"
{
(yyval.enums.constructionMode) = StaticContext::CMStrip;
}
@@ -4551,7 +4585,7 @@ yyreduce:
case 79:
/* Line 1269 of yacc.c. */
-#line 2058 "querytransformparser.ypp"
+#line 2092 "querytransformparser.ypp"
{
(yyval.enums.constructionMode) = StaticContext::CMPreserve;
}
@@ -4559,7 +4593,7 @@ yyreduce:
case 80:
/* Line 1269 of yacc.c. */
-#line 2063 "querytransformparser.ypp"
+#line 2097 "querytransformparser.ypp"
{
(yyval.enums.slot) = parseInfo->currentExpressionSlot() - (yyvsp[(6) - (7)].functionArguments).count();
}
@@ -4567,10 +4601,10 @@ yyreduce:
case 81:
/* Line 1269 of yacc.c. */
-#line 2067 "querytransformparser.ypp"
+#line 2101 "querytransformparser.ypp"
{
if(!(yyvsp[(3) - (11)].enums.Bool))
- disallowedConstruct(parseInfo, (yyloc), (yyvsp[(3) - (11)].enums.Bool));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(3) - (11)].enums.Bool));
/* If FunctionBody is null, it is 'external', otherwise the value is the body. */
const QXmlName::NamespaceCode ns((yyvsp[(4) - (11)].qName).namespaceURI());
@@ -4674,7 +4708,7 @@ yyreduce:
case 82:
/* Line 1269 of yacc.c. */
-#line 2171 "querytransformparser.ypp"
+#line 2205 "querytransformparser.ypp"
{
(yyval.functionArguments) = FunctionArgument::List();
}
@@ -4682,7 +4716,7 @@ yyreduce:
case 83:
/* Line 1269 of yacc.c. */
-#line 2175 "querytransformparser.ypp"
+#line 2209 "querytransformparser.ypp"
{
FunctionArgument::List l;
l.append((yyvsp[(1) - (1)].functionArgument));
@@ -4692,7 +4726,7 @@ yyreduce:
case 84:
/* Line 1269 of yacc.c. */
-#line 2181 "querytransformparser.ypp"
+#line 2215 "querytransformparser.ypp"
{
FunctionArgument::List::const_iterator it((yyvsp[(1) - (3)].functionArguments).constBegin());
const FunctionArgument::List::const_iterator end((yyvsp[(1) - (3)].functionArguments).constEnd());
@@ -4716,7 +4750,7 @@ yyreduce:
case 85:
/* Line 1269 of yacc.c. */
-#line 2202 "querytransformparser.ypp"
+#line 2236 "querytransformparser.ypp"
{
pushVariable((yyvsp[(2) - (3)].qName), (yyvsp[(3) - (3)].sequenceType), Expression::Ptr(), VariableDeclaration::FunctionArgument, (yyloc), parseInfo);
(yyval.functionArgument) = FunctionArgument::Ptr(new FunctionArgument((yyvsp[(2) - (3)].qName), (yyvsp[(3) - (3)].sequenceType)));
@@ -4725,7 +4759,7 @@ yyreduce:
case 86:
/* Line 1269 of yacc.c. */
-#line 2208 "querytransformparser.ypp"
+#line 2242 "querytransformparser.ypp"
{
(yyval.expr).reset();
}
@@ -4733,7 +4767,7 @@ yyreduce:
case 88:
/* Line 1269 of yacc.c. */
-#line 2214 "querytransformparser.ypp"
+#line 2248 "querytransformparser.ypp"
{
(yyval.expr) = (yyvsp[(2) - (3)].expr);
}
@@ -4741,7 +4775,7 @@ yyreduce:
case 91:
/* Line 1269 of yacc.c. */
-#line 2230 "querytransformparser.ypp"
+#line 2264 "querytransformparser.ypp"
{
(yyval.expr) = create(new CombineNodes((yyvsp[(1) - (3)].expr), CombineNodes::Union, (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
@@ -4749,7 +4783,7 @@ yyreduce:
case 93:
/* Line 1269 of yacc.c. */
-#line 2236 "querytransformparser.ypp"
+#line 2270 "querytransformparser.ypp"
{
/* We write this into a node test. The spec says, 5.5.3 The Meaning of a Pattern:
* "Similarly, / matches a document node, and only a document node,
@@ -4762,7 +4796,7 @@ yyreduce:
case 94:
/* Line 1269 of yacc.c. */
-#line 2245 "querytransformparser.ypp"
+#line 2279 "querytransformparser.ypp"
{
/* /axis::node-test
* =>
@@ -4836,7 +4870,7 @@ yyreduce:
case 95:
/* Line 1269 of yacc.c. */
-#line 2315 "querytransformparser.ypp"
+#line 2349 "querytransformparser.ypp"
{
/* //axis::node-test
* =>
@@ -4851,7 +4885,7 @@ yyreduce:
case 97:
/* Line 1269 of yacc.c. */
-#line 2327 "querytransformparser.ypp"
+#line 2361 "querytransformparser.ypp"
{
createIdPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisParent, (yylsp[(2) - (3)]), parseInfo);
}
@@ -4859,7 +4893,7 @@ yyreduce:
case 98:
/* Line 1269 of yacc.c. */
-#line 2331 "querytransformparser.ypp"
+#line 2365 "querytransformparser.ypp"
{
createIdPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisAncestor, (yylsp[(2) - (3)]), parseInfo);
}
@@ -4867,7 +4901,7 @@ yyreduce:
case 99:
/* Line 1269 of yacc.c. */
-#line 2336 "querytransformparser.ypp"
+#line 2370 "querytransformparser.ypp"
{
const Expression::List ands((yyvsp[(1) - (1)].expr)->operands());
const FunctionSignature::Ptr signature((yyvsp[(1) - (1)].expr)->as<FunctionCall>()->signature());
@@ -4939,7 +4973,7 @@ yyreduce:
case 101:
/* Line 1269 of yacc.c. */
-#line 2406 "querytransformparser.ypp"
+#line 2440 "querytransformparser.ypp"
{
(yyval.expr) = createPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisParent, (yylsp[(2) - (3)]), parseInfo);
}
@@ -4947,7 +4981,7 @@ yyreduce:
case 102:
/* Line 1269 of yacc.c. */
-#line 2410 "querytransformparser.ypp"
+#line 2444 "querytransformparser.ypp"
{
(yyval.expr) = createPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisAncestor, (yylsp[(2) - (3)]), parseInfo);
}
@@ -4955,7 +4989,7 @@ yyreduce:
case 103:
/* Line 1269 of yacc.c. */
-#line 2415 "querytransformparser.ypp"
+#line 2449 "querytransformparser.ypp"
{
const Expression::Ptr expr(findAxisStep((yyvsp[(1) - (1)].expr)));
@@ -5002,7 +5036,7 @@ yyreduce:
case 105:
/* Line 1269 of yacc.c. */
-#line 2460 "querytransformparser.ypp"
+#line 2494 "querytransformparser.ypp"
{
(yyval.expr) = create(new ExpressionSequence((yyvsp[(1) - (1)].expressionList)), (yyloc), parseInfo);
}
@@ -5010,7 +5044,7 @@ yyreduce:
case 106:
/* Line 1269 of yacc.c. */
-#line 2465 "querytransformparser.ypp"
+#line 2499 "querytransformparser.ypp"
{
Expression::List l;
l.append((yyvsp[(1) - (3)].expr));
@@ -5021,7 +5055,7 @@ yyreduce:
case 107:
/* Line 1269 of yacc.c. */
-#line 2472 "querytransformparser.ypp"
+#line 2506 "querytransformparser.ypp"
{
(yyvsp[(1) - (3)].expressionList).append((yyvsp[(3) - (3)].expr));
(yyval.expressionList) = (yyvsp[(1) - (3)].expressionList);
@@ -5030,7 +5064,7 @@ yyreduce:
case 113:
/* Line 1269 of yacc.c. */
-#line 2483 "querytransformparser.ypp"
+#line 2517 "querytransformparser.ypp"
{
(yyval.expr) = createDirAttributeValue((yyvsp[(3) - (4)].expressionList), parseInfo, (yyloc));
}
@@ -5038,7 +5072,7 @@ yyreduce:
case 114:
/* Line 1269 of yacc.c. */
-#line 2488 "querytransformparser.ypp"
+#line 2522 "querytransformparser.ypp"
{
QVector<QXmlName> result;
result.append(QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default));
@@ -5048,7 +5082,7 @@ yyreduce:
case 115:
/* Line 1269 of yacc.c. */
-#line 2494 "querytransformparser.ypp"
+#line 2528 "querytransformparser.ypp"
{
(yyval.qNameVector) = (yyvsp[(2) - (2)].qNameVector);
}
@@ -5056,7 +5090,7 @@ yyreduce:
case 116:
/* Line 1269 of yacc.c. */
-#line 2499 "querytransformparser.ypp"
+#line 2533 "querytransformparser.ypp"
{
(yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default);
}
@@ -5064,7 +5098,7 @@ yyreduce:
case 117:
/* Line 1269 of yacc.c. */
-#line 2503 "querytransformparser.ypp"
+#line 2537 "querytransformparser.ypp"
{
(yyval.qName) = (yyvsp[(2) - (2)].qName);
}
@@ -5072,7 +5106,7 @@ yyreduce:
case 118:
/* Line 1269 of yacc.c. */
-#line 2508 "querytransformparser.ypp"
+#line 2542 "querytransformparser.ypp"
{
QVector<QXmlName> result;
result.append((yyvsp[(1) - (1)].qName));
@@ -5082,7 +5116,7 @@ yyreduce:
case 119:
/* Line 1269 of yacc.c. */
-#line 2514 "querytransformparser.ypp"
+#line 2548 "querytransformparser.ypp"
{
(yyvsp[(1) - (3)].qNameVector).append((yyvsp[(3) - (3)].qName));
(yyval.qNameVector) = (yyvsp[(1) - (3)].qNameVector);
@@ -5091,7 +5125,7 @@ yyreduce:
case 120:
/* Line 1269 of yacc.c. */
-#line 2520 "querytransformparser.ypp"
+#line 2554 "querytransformparser.ypp"
{
(yyval.qName) = (yyvsp[(1) - (1)].qName);
}
@@ -5099,7 +5133,7 @@ yyreduce:
case 121:
/* Line 1269 of yacc.c. */
-#line 2524 "querytransformparser.ypp"
+#line 2558 "querytransformparser.ypp"
{
if((yyvsp[(1) - (1)].sval) == QLatin1String("#current"))
(yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::current);
@@ -5126,7 +5160,7 @@ yyreduce:
case 124:
/* Line 1269 of yacc.c. */
-#line 2553 "querytransformparser.ypp"
+#line 2587 "querytransformparser.ypp"
{
/* We're pushing the range variable here, not the positional. */
(yyval.expr) = pushVariable((yyvsp[(3) - (7)].qName), quantificationType((yyvsp[(4) - (7)].sequenceType)), (yyvsp[(7) - (7)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo);
@@ -5135,7 +5169,7 @@ yyreduce:
case 125:
/* Line 1269 of yacc.c. */
-#line 2557 "querytransformparser.ypp"
+#line 2591 "querytransformparser.ypp"
{
/* It is ok this appears after PositionalVar, because currentRangeSlot()
* uses a different "channel" than currentPositionSlot(), so they can't trash
@@ -5146,7 +5180,7 @@ yyreduce:
case 126:
/* Line 1269 of yacc.c. */
-#line 2564 "querytransformparser.ypp"
+#line 2598 "querytransformparser.ypp"
{
Q_ASSERT((yyvsp[(7) - (10)].expr));
Q_ASSERT((yyvsp[(10) - (10)].expr));
@@ -5182,7 +5216,7 @@ yyreduce:
case 127:
/* Line 1269 of yacc.c. */
-#line 2598 "querytransformparser.ypp"
+#line 2632 "querytransformparser.ypp"
{
pushVariable((yyvsp[(3) - (7)].qName), quantificationType((yyvsp[(4) - (7)].sequenceType)), (yyvsp[(7) - (7)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo);
}
@@ -5190,7 +5224,7 @@ yyreduce:
case 128:
/* Line 1269 of yacc.c. */
-#line 2601 "querytransformparser.ypp"
+#line 2635 "querytransformparser.ypp"
{
/* It is ok this appears after PositionalVar, because currentRangeSlot()
* uses a different "channel" than currentPositionSlot(), so they can't trash
@@ -5201,7 +5235,7 @@ yyreduce:
case 129:
/* Line 1269 of yacc.c. */
-#line 2608 "querytransformparser.ypp"
+#line 2642 "querytransformparser.ypp"
{
(yyval.expr) = create(new ForClause((yyvsp[(9) - (10)].enums.slot), (yyvsp[(7) - (10)].expr), (yyvsp[(10) - (10)].expr), (yyvsp[(5) - (10)].enums.slot)), (yyloc), parseInfo);
@@ -5214,7 +5248,7 @@ yyreduce:
case 133:
/* Line 1269 of yacc.c. */
-#line 2622 "querytransformparser.ypp"
+#line 2656 "querytransformparser.ypp"
{
(yyval.enums.slot) = -1;
}
@@ -5222,7 +5256,7 @@ yyreduce:
case 134:
/* Line 1269 of yacc.c. */
-#line 2627 "querytransformparser.ypp"
+#line 2661 "querytransformparser.ypp"
{
pushVariable((yyvsp[(3) - (3)].qName), CommonSequenceTypes::ExactlyOneInteger, Expression::Ptr(),
VariableDeclaration::PositionalVariable, (yyloc), parseInfo);
@@ -5232,7 +5266,7 @@ yyreduce:
case 135:
/* Line 1269 of yacc.c. */
-#line 2634 "querytransformparser.ypp"
+#line 2668 "querytransformparser.ypp"
{
(yyval.expr) = pushVariable((yyvsp[(4) - (7)].qName), quantificationType((yyvsp[(5) - (7)].sequenceType)), (yyvsp[(7) - (7)].expr), VariableDeclaration::ExpressionVariable, (yyloc), parseInfo);
}
@@ -5240,9 +5274,9 @@ yyreduce:
case 136:
/* Line 1269 of yacc.c. */
-#line 2638 "querytransformparser.ypp"
+#line 2672 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (9)].enums.Bool));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (9)].enums.Bool));
Q_ASSERT(parseInfo->variables.top()->name == (yyvsp[(4) - (9)].qName));
(yyval.expr) = create(new LetClause((yyvsp[(8) - (9)].expr), (yyvsp[(9) - (9)].expr), parseInfo->variables.top()), (yyloc), parseInfo);
@@ -5252,13 +5286,13 @@ yyreduce:
case 137:
/* Line 1269 of yacc.c. */
-#line 2647 "querytransformparser.ypp"
+#line 2681 "querytransformparser.ypp"
{ (yyval.expr) = pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr), VariableDeclaration::ExpressionVariable, (yyloc), parseInfo);}
break;
case 138:
/* Line 1269 of yacc.c. */
-#line 2649 "querytransformparser.ypp"
+#line 2683 "querytransformparser.ypp"
{
Q_ASSERT(parseInfo->variables.top()->name == (yyvsp[(3) - (8)].qName));
(yyval.expr) = create(new LetClause((yyvsp[(7) - (8)].expr), (yyvsp[(8) - (8)].expr), parseInfo->variables.top()), (yyloc), parseInfo);
@@ -5268,7 +5302,7 @@ yyreduce:
case 142:
/* Line 1269 of yacc.c. */
-#line 2660 "querytransformparser.ypp"
+#line 2694 "querytransformparser.ypp"
{
if((yyvsp[(1) - (3)].orderSpecs).isEmpty())
(yyval.expr) = (yyvsp[(3) - (3)].expr);
@@ -5279,7 +5313,7 @@ yyreduce:
case 143:
/* Line 1269 of yacc.c. */
-#line 2668 "querytransformparser.ypp"
+#line 2702 "querytransformparser.ypp"
{
if((yyvsp[(3) - (5)].orderSpecs).isEmpty())
(yyval.expr) = create(new IfThenClause((yyvsp[(2) - (5)].expr), (yyvsp[(5) - (5)].expr), create(new EmptySequence, (yyloc), parseInfo)), (yyloc), parseInfo);
@@ -5292,7 +5326,7 @@ yyreduce:
case 144:
/* Line 1269 of yacc.c. */
-#line 2678 "querytransformparser.ypp"
+#line 2712 "querytransformparser.ypp"
{
(yyval.orderSpecs) = OrderSpecTransfer::List();
}
@@ -5300,7 +5334,7 @@ yyreduce:
case 146:
/* Line 1269 of yacc.c. */
-#line 2684 "querytransformparser.ypp"
+#line 2718 "querytransformparser.ypp"
{
(yyval.orderSpecs) = (yyvsp[(2) - (2)].orderSpecs);
}
@@ -5308,7 +5342,7 @@ yyreduce:
case 147:
/* Line 1269 of yacc.c. */
-#line 2689 "querytransformparser.ypp"
+#line 2723 "querytransformparser.ypp"
{
OrderSpecTransfer::List list;
list += (yyvsp[(1) - (3)].orderSpecs);
@@ -5319,7 +5353,7 @@ yyreduce:
case 148:
/* Line 1269 of yacc.c. */
-#line 2696 "querytransformparser.ypp"
+#line 2730 "querytransformparser.ypp"
{
OrderSpecTransfer::List list;
list.append((yyvsp[(1) - (1)].orderSpec));
@@ -5329,7 +5363,7 @@ yyreduce:
case 149:
/* Line 1269 of yacc.c. */
-#line 2703 "querytransformparser.ypp"
+#line 2737 "querytransformparser.ypp"
{
(yyval.orderSpec) = OrderSpecTransfer((yyvsp[(1) - (4)].expr), OrderBy::OrderSpec((yyvsp[(2) - (4)].enums.sortDirection), (yyvsp[(3) - (4)].enums.orderingEmptySequence)));
}
@@ -5337,7 +5371,7 @@ yyreduce:
case 150:
/* Line 1269 of yacc.c. */
-#line 2708 "querytransformparser.ypp"
+#line 2742 "querytransformparser.ypp"
{
/* Where does the specification state the default value is ascending?
*
@@ -5361,7 +5395,7 @@ yyreduce:
case 151:
/* Line 1269 of yacc.c. */
-#line 2729 "querytransformparser.ypp"
+#line 2763 "querytransformparser.ypp"
{
(yyval.enums.sortDirection) = OrderBy::OrderSpec::Ascending;
}
@@ -5369,7 +5403,7 @@ yyreduce:
case 152:
/* Line 1269 of yacc.c. */
-#line 2734 "querytransformparser.ypp"
+#line 2768 "querytransformparser.ypp"
{
(yyval.enums.sortDirection) = OrderBy::OrderSpec::Descending;
}
@@ -5377,7 +5411,7 @@ yyreduce:
case 153:
/* Line 1269 of yacc.c. */
-#line 2739 "querytransformparser.ypp"
+#line 2773 "querytransformparser.ypp"
{
(yyval.enums.orderingEmptySequence) = parseInfo->staticContext->orderingEmptySequence();
}
@@ -5385,7 +5419,7 @@ yyreduce:
case 156:
/* Line 1269 of yacc.c. */
-#line 2746 "querytransformparser.ypp"
+#line 2780 "querytransformparser.ypp"
{
if(parseInfo->isXSLT())
resolveAndCheckCollation<ReportContext::XTDE1035>((yyvsp[(2) - (2)].sval), parseInfo, (yyloc));
@@ -5396,7 +5430,7 @@ yyreduce:
case 157:
/* Line 1269 of yacc.c. */
-#line 2753 "querytransformparser.ypp"
+#line 2787 "querytransformparser.ypp"
{
/* We do nothing. We don't use collations, and we have this non-terminal
* in order to accept expressions. */
@@ -5405,7 +5439,7 @@ yyreduce:
case 158:
/* Line 1269 of yacc.c. */
-#line 2759 "querytransformparser.ypp"
+#line 2793 "querytransformparser.ypp"
{
parseInfo->orderStability.push(OrderBy::StableOrder);
}
@@ -5413,7 +5447,7 @@ yyreduce:
case 159:
/* Line 1269 of yacc.c. */
-#line 2763 "querytransformparser.ypp"
+#line 2797 "querytransformparser.ypp"
{
parseInfo->orderStability.push(OrderBy::UnstableOrder);
}
@@ -5421,7 +5455,7 @@ yyreduce:
case 162:
/* Line 1269 of yacc.c. */
-#line 2771 "querytransformparser.ypp"
+#line 2805 "querytransformparser.ypp"
{
pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr),
VariableDeclaration::RangeVariable, (yyloc), parseInfo);
@@ -5430,14 +5464,15 @@ yyreduce:
case 163:
/* Line 1269 of yacc.c. */
-#line 2775 "querytransformparser.ypp"
+#line 2809 "querytransformparser.ypp"
{(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
break;
case 164:
/* Line 1269 of yacc.c. */
-#line 2777 "querytransformparser.ypp"
+#line 2811 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot),
QuantifiedExpression::Some, (yyvsp[(6) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo);
parseInfo->finalizePushedVariable();
@@ -5446,7 +5481,7 @@ yyreduce:
case 165:
/* Line 1269 of yacc.c. */
-#line 2784 "querytransformparser.ypp"
+#line 2819 "querytransformparser.ypp"
{
(yyval.expr) = pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr),
VariableDeclaration::RangeVariable, (yyloc), parseInfo);
@@ -5455,13 +5490,13 @@ yyreduce:
case 166:
/* Line 1269 of yacc.c. */
-#line 2788 "querytransformparser.ypp"
+#line 2823 "querytransformparser.ypp"
{(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
break;
case 167:
/* Line 1269 of yacc.c. */
-#line 2790 "querytransformparser.ypp"
+#line 2825 "querytransformparser.ypp"
{
(yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot),
QuantifiedExpression::Some, (yyvsp[(7) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo);
@@ -5471,7 +5506,7 @@ yyreduce:
case 169:
/* Line 1269 of yacc.c. */
-#line 2799 "querytransformparser.ypp"
+#line 2834 "querytransformparser.ypp"
{
pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr),
VariableDeclaration::RangeVariable, (yyloc), parseInfo);
@@ -5480,14 +5515,15 @@ yyreduce:
case 170:
/* Line 1269 of yacc.c. */
-#line 2803 "querytransformparser.ypp"
+#line 2838 "querytransformparser.ypp"
{(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
break;
case 171:
/* Line 1269 of yacc.c. */
-#line 2805 "querytransformparser.ypp"
+#line 2840 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot),
QuantifiedExpression::Every, (yyvsp[(6) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo);
parseInfo->finalizePushedVariable();
@@ -5496,7 +5532,7 @@ yyreduce:
case 172:
/* Line 1269 of yacc.c. */
-#line 2812 "querytransformparser.ypp"
+#line 2848 "querytransformparser.ypp"
{
(yyval.expr) = pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr),
VariableDeclaration::RangeVariable, (yyloc), parseInfo);
@@ -5505,13 +5541,13 @@ yyreduce:
case 173:
/* Line 1269 of yacc.c. */
-#line 2816 "querytransformparser.ypp"
+#line 2852 "querytransformparser.ypp"
{(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
break;
case 174:
/* Line 1269 of yacc.c. */
-#line 2818 "querytransformparser.ypp"
+#line 2854 "querytransformparser.ypp"
{
(yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot),
QuantifiedExpression::Every, (yyvsp[(7) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo);
@@ -5521,7 +5557,7 @@ yyreduce:
case 176:
/* Line 1269 of yacc.c. */
-#line 2827 "querytransformparser.ypp"
+#line 2863 "querytransformparser.ypp"
{
(yyval.expr) = (yyvsp[(2) - (2)].expr);
}
@@ -5529,7 +5565,7 @@ yyreduce:
case 177:
/* Line 1269 of yacc.c. */
-#line 2854 "querytransformparser.ypp"
+#line 2890 "querytransformparser.ypp"
{
parseInfo->typeswitchSource.push((yyvsp[(3) - (4)].expr));
}
@@ -5537,9 +5573,9 @@ yyreduce:
case 178:
/* Line 1269 of yacc.c. */
-#line 2858 "querytransformparser.ypp"
+#line 2894 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
parseInfo->typeswitchSource.pop();
(yyval.expr) = (yyvsp[(6) - (6)].expr);
}
@@ -5547,7 +5583,7 @@ yyreduce:
case 179:
/* Line 1269 of yacc.c. */
-#line 2865 "querytransformparser.ypp"
+#line 2901 "querytransformparser.ypp"
{
if(!(yyvsp[(2) - (3)].qName).isNull())
{
@@ -5559,7 +5595,7 @@ yyreduce:
case 180:
/* Line 1269 of yacc.c. */
-#line 2873 "querytransformparser.ypp"
+#line 2909 "querytransformparser.ypp"
{
/* The variable shouldn't be in-scope for other case branches. */
if(!(yyvsp[(2) - (6)].qName).isNull())
@@ -5569,7 +5605,7 @@ yyreduce:
case 181:
/* Line 1269 of yacc.c. */
-#line 2879 "querytransformparser.ypp"
+#line 2915 "querytransformparser.ypp"
{
const Expression::Ptr instanceOf(create(new InstanceOf(parseInfo->typeswitchSource.top(), (yyvsp[(3) - (8)].sequenceType)), (yyloc), parseInfo));
(yyval.expr) = create(new IfThenClause(instanceOf, (yyvsp[(6) - (8)].expr), (yyvsp[(8) - (8)].expr)), (yyloc), parseInfo);
@@ -5578,7 +5614,7 @@ yyreduce:
case 184:
/* Line 1269 of yacc.c. */
-#line 2888 "querytransformparser.ypp"
+#line 2924 "querytransformparser.ypp"
{
(yyval.qName) = QXmlName();
}
@@ -5586,7 +5622,7 @@ yyreduce:
case 185:
/* Line 1269 of yacc.c. */
-#line 2893 "querytransformparser.ypp"
+#line 2929 "querytransformparser.ypp"
{
(yyval.qName) = (yyvsp[(2) - (3)].qName);
}
@@ -5594,7 +5630,7 @@ yyreduce:
case 186:
/* Line 1269 of yacc.c. */
-#line 2898 "querytransformparser.ypp"
+#line 2934 "querytransformparser.ypp"
{
(yyval.expr) = (yyvsp[(3) - (3)].expr);
}
@@ -5602,7 +5638,7 @@ yyreduce:
case 187:
/* Line 1269 of yacc.c. */
-#line 2902 "querytransformparser.ypp"
+#line 2938 "querytransformparser.ypp"
{
if(!(yyvsp[(3) - (3)].qName).isNull())
{
@@ -5615,7 +5651,7 @@ yyreduce:
case 188:
/* Line 1269 of yacc.c. */
-#line 2911 "querytransformparser.ypp"
+#line 2947 "querytransformparser.ypp"
{
if(!(yyvsp[(3) - (6)].qName).isNull())
parseInfo->finalizePushedVariable();
@@ -5625,107 +5661,119 @@ yyreduce:
case 189:
/* Line 1269 of yacc.c. */
-#line 2918 "querytransformparser.ypp"
+#line 2954 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new IfThenClause((yyvsp[(3) - (8)].expr), (yyvsp[(6) - (8)].expr), (yyvsp[(8) - (8)].expr)), (yyloc), parseInfo);
}
break;
case 191:
/* Line 1269 of yacc.c. */
-#line 2924 "querytransformparser.ypp"
+#line 2961 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new OrExpression((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
break;
case 193:
/* Line 1269 of yacc.c. */
-#line 2930 "querytransformparser.ypp"
+#line 2968 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new AndExpression((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
break;
case 199:
/* Line 1269 of yacc.c. */
-#line 2941 "querytransformparser.ypp"
+#line 2980 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new RangeExpression((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
break;
case 201:
/* Line 1269 of yacc.c. */
-#line 2947 "querytransformparser.ypp"
+#line 2987 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new ArithmeticExpression((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.mathOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
break;
case 202:
/* Line 1269 of yacc.c. */
-#line 2951 "querytransformparser.ypp"
+#line 2992 "querytransformparser.ypp"
{(yyval.enums.mathOperator) = AtomicMathematician::Add;}
break;
case 203:
/* Line 1269 of yacc.c. */
-#line 2952 "querytransformparser.ypp"
+#line 2993 "querytransformparser.ypp"
{(yyval.enums.mathOperator) = AtomicMathematician::Substract;}
break;
case 205:
/* Line 1269 of yacc.c. */
-#line 2956 "querytransformparser.ypp"
+#line 2997 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new ArithmeticExpression((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.mathOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
break;
case 206:
/* Line 1269 of yacc.c. */
-#line 2960 "querytransformparser.ypp"
+#line 3002 "querytransformparser.ypp"
{(yyval.enums.mathOperator) = AtomicMathematician::Multiply;}
break;
case 207:
/* Line 1269 of yacc.c. */
-#line 2961 "querytransformparser.ypp"
+#line 3003 "querytransformparser.ypp"
{(yyval.enums.mathOperator) = AtomicMathematician::Div;}
break;
case 208:
/* Line 1269 of yacc.c. */
-#line 2962 "querytransformparser.ypp"
+#line 3004 "querytransformparser.ypp"
{(yyval.enums.mathOperator) = AtomicMathematician::IDiv;}
break;
case 209:
/* Line 1269 of yacc.c. */
-#line 2963 "querytransformparser.ypp"
+#line 3005 "querytransformparser.ypp"
{(yyval.enums.mathOperator) = AtomicMathematician::Mod;}
break;
case 211:
/* Line 1269 of yacc.c. */
-#line 2967 "querytransformparser.ypp"
+#line 3009 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10
+ | QXmlQuery::XPath20
+ | QXmlQuery::XmlSchema11IdentityConstraintField
+ | QXmlQuery::XmlSchema11IdentityConstraintSelector),
+ parseInfo, (yyloc));
(yyval.expr) = create(new CombineNodes((yyvsp[(1) - (3)].expr), CombineNodes::Union, (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
break;
case 213:
/* Line 1269 of yacc.c. */
-#line 2973 "querytransformparser.ypp"
+#line 3020 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new CombineNodes((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.combinedNodeOp), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
break;
case 216:
/* Line 1269 of yacc.c. */
-#line 2981 "querytransformparser.ypp"
+#line 3029 "querytransformparser.ypp"
{
(yyval.enums.combinedNodeOp) = CombineNodes::Intersect;
}
@@ -5733,7 +5781,7 @@ yyreduce:
case 217:
/* Line 1269 of yacc.c. */
-#line 2985 "querytransformparser.ypp"
+#line 3033 "querytransformparser.ypp"
{
(yyval.enums.combinedNodeOp) = CombineNodes::Except;
}
@@ -5741,48 +5789,53 @@ yyreduce:
case 219:
/* Line 1269 of yacc.c. */
-#line 2991 "querytransformparser.ypp"
+#line 3039 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new InstanceOf((yyvsp[(1) - (4)].expr),
- SequenceType::Ptr((yyvsp[(4) - (4)].sequenceType))), (yyloc), parseInfo);
+ SequenceType::Ptr((yyvsp[(4) - (4)].sequenceType))), (yyloc), parseInfo);
}
break;
case 221:
/* Line 1269 of yacc.c. */
-#line 2998 "querytransformparser.ypp"
+#line 3047 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new TreatAs((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].sequenceType)), (yyloc), parseInfo);
}
break;
case 223:
/* Line 1269 of yacc.c. */
-#line 3004 "querytransformparser.ypp"
+#line 3054 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new CastableAs((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].sequenceType)), (yyloc), parseInfo);
}
break;
case 225:
/* Line 1269 of yacc.c. */
-#line 3010 "querytransformparser.ypp"
+#line 3061 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new CastAs((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].sequenceType)), (yyloc), parseInfo);
}
break;
case 227:
/* Line 1269 of yacc.c. */
-#line 3016 "querytransformparser.ypp"
+#line 3068 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new UnaryExpression((yyvsp[(1) - (2)].enums.mathOperator), (yyvsp[(2) - (2)].expr), parseInfo->staticContext), (yyloc), parseInfo);
}
break;
case 228:
/* Line 1269 of yacc.c. */
-#line 3021 "querytransformparser.ypp"
+#line 3074 "querytransformparser.ypp"
{
(yyval.enums.mathOperator) = AtomicMathematician::Add;
}
@@ -5790,7 +5843,7 @@ yyreduce:
case 229:
/* Line 1269 of yacc.c. */
-#line 3025 "querytransformparser.ypp"
+#line 3078 "querytransformparser.ypp"
{
(yyval.enums.mathOperator) = AtomicMathematician::Substract;
}
@@ -5798,51 +5851,52 @@ yyreduce:
case 233:
/* Line 1269 of yacc.c. */
-#line 3034 "querytransformparser.ypp"
+#line 3087 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new GeneralComparison((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.valueOperator), (yyvsp[(3) - (3)].expr), parseInfo->isBackwardsCompat.top()), (yyloc), parseInfo);
}
break;
case 234:
/* Line 1269 of yacc.c. */
-#line 3038 "querytransformparser.ypp"
+#line 3092 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorEqual;}
break;
case 235:
/* Line 1269 of yacc.c. */
-#line 3039 "querytransformparser.ypp"
+#line 3093 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorNotEqual;}
break;
case 236:
/* Line 1269 of yacc.c. */
-#line 3040 "querytransformparser.ypp"
+#line 3094 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterOrEqual;}
break;
case 237:
/* Line 1269 of yacc.c. */
-#line 3041 "querytransformparser.ypp"
+#line 3095 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterThan;}
break;
case 238:
/* Line 1269 of yacc.c. */
-#line 3042 "querytransformparser.ypp"
+#line 3096 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorLessOrEqual;}
break;
case 239:
/* Line 1269 of yacc.c. */
-#line 3043 "querytransformparser.ypp"
+#line 3097 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorLessThan;}
break;
case 240:
/* Line 1269 of yacc.c. */
-#line 3046 "querytransformparser.ypp"
+#line 3100 "querytransformparser.ypp"
{
(yyval.expr) = create(new ValueComparison((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.valueOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
@@ -5850,43 +5904,43 @@ yyreduce:
case 241:
/* Line 1269 of yacc.c. */
-#line 3050 "querytransformparser.ypp"
+#line 3104 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorEqual;}
break;
case 242:
/* Line 1269 of yacc.c. */
-#line 3051 "querytransformparser.ypp"
+#line 3105 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorNotEqual;}
break;
case 243:
/* Line 1269 of yacc.c. */
-#line 3052 "querytransformparser.ypp"
+#line 3106 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterOrEqual;}
break;
case 244:
/* Line 1269 of yacc.c. */
-#line 3053 "querytransformparser.ypp"
+#line 3107 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterThan;}
break;
case 245:
/* Line 1269 of yacc.c. */
-#line 3054 "querytransformparser.ypp"
+#line 3108 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorLessOrEqual;}
break;
case 246:
/* Line 1269 of yacc.c. */
-#line 3055 "querytransformparser.ypp"
+#line 3109 "querytransformparser.ypp"
{(yyval.enums.valueOperator) = AtomicComparator::OperatorLessThan;}
break;
case 247:
/* Line 1269 of yacc.c. */
-#line 3058 "querytransformparser.ypp"
+#line 3112 "querytransformparser.ypp"
{
(yyval.expr) = create(new NodeComparison((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.nodeOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
@@ -5894,27 +5948,27 @@ yyreduce:
case 248:
/* Line 1269 of yacc.c. */
-#line 3062 "querytransformparser.ypp"
+#line 3116 "querytransformparser.ypp"
{(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Is;}
break;
case 249:
/* Line 1269 of yacc.c. */
-#line 3063 "querytransformparser.ypp"
+#line 3117 "querytransformparser.ypp"
{(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Precedes;}
break;
case 250:
/* Line 1269 of yacc.c. */
-#line 3064 "querytransformparser.ypp"
+#line 3118 "querytransformparser.ypp"
{(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Follows;}
break;
case 251:
/* Line 1269 of yacc.c. */
-#line 3067 "querytransformparser.ypp"
+#line 3121 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
parseInfo->staticContext->error(QtXmlPatterns::tr("The Schema Validation Feature is not supported. "
"Hence, %1-expressions may not be used.")
.arg(formatKeyword("validate")),
@@ -5927,26 +5981,27 @@ yyreduce:
case 252:
/* Line 1269 of yacc.c. */
-#line 3080 "querytransformparser.ypp"
+#line 3134 "querytransformparser.ypp"
{(yyval.enums.validationMode) = Validate::Strict;}
break;
case 253:
/* Line 1269 of yacc.c. */
-#line 3081 "querytransformparser.ypp"
+#line 3135 "querytransformparser.ypp"
{(yyval.enums.validationMode) = Validate::Strict;}
break;
case 254:
/* Line 1269 of yacc.c. */
-#line 3082 "querytransformparser.ypp"
+#line 3136 "querytransformparser.ypp"
{(yyval.enums.validationMode) = Validate::Lax;}
break;
case 255:
/* Line 1269 of yacc.c. */
-#line 3085 "querytransformparser.ypp"
+#line 3139 "querytransformparser.ypp"
{
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
/* We don't support any pragmas, so we only do the
* necessary validation and use the fallback expression. */
@@ -5964,7 +6019,7 @@ yyreduce:
case 256:
/* Line 1269 of yacc.c. */
-#line 3101 "querytransformparser.ypp"
+#line 3156 "querytransformparser.ypp"
{
(yyval.expr).reset();
}
@@ -5972,7 +6027,7 @@ yyreduce:
case 257:
/* Line 1269 of yacc.c. */
-#line 3105 "querytransformparser.ypp"
+#line 3160 "querytransformparser.ypp"
{
(yyval.expr) = (yyvsp[(2) - (3)].expr);
}
@@ -5980,15 +6035,15 @@ yyreduce:
case 260:
/* Line 1269 of yacc.c. */
-#line 3113 "querytransformparser.ypp"
+#line 3168 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
}
break;
case 263:
/* Line 1269 of yacc.c. */
-#line 3121 "querytransformparser.ypp"
+#line 3176 "querytransformparser.ypp"
{
/* This is "/step". That is, fn:root(self::node()) treat as document-node()/RelativePathExpr. */
(yyval.expr) = create(new Path(createRootExpression(parseInfo, (yyloc)), (yyvsp[(2) - (2)].expr)), (yyloc), parseInfo);
@@ -5997,7 +6052,7 @@ yyreduce:
case 264:
/* Line 1269 of yacc.c. */
-#line 3127 "querytransformparser.ypp"
+#line 3182 "querytransformparser.ypp"
{
(yyval.expr) = createSlashSlashPath(createRootExpression(parseInfo, (yyloc)), (yyvsp[(2) - (2)].expr), (yyloc), parseInfo);
}
@@ -6005,7 +6060,7 @@ yyreduce:
case 265:
/* Line 1269 of yacc.c. */
-#line 3131 "querytransformparser.ypp"
+#line 3186 "querytransformparser.ypp"
{
/* This is "/". That is, fn:root(self::node()) treat as document-node(). */
(yyval.expr) = createRootExpression(parseInfo, (yyloc));
@@ -6014,7 +6069,7 @@ yyreduce:
case 268:
/* Line 1269 of yacc.c. */
-#line 3141 "querytransformparser.ypp"
+#line 3196 "querytransformparser.ypp"
{
(yyval.expr) = create(new Path((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].enums.pathKind)), (yyloc), parseInfo);
}
@@ -6022,7 +6077,7 @@ yyreduce:
case 269:
/* Line 1269 of yacc.c. */
-#line 3145 "querytransformparser.ypp"
+#line 3200 "querytransformparser.ypp"
{
const Expression::Ptr orderBy(createReturnOrderBy((yyvsp[(4) - (7)].orderSpecs), (yyvsp[(6) - (7)].expr), parseInfo->orderStability.pop(), (yyloc), parseInfo));
@@ -6035,7 +6090,7 @@ yyreduce:
case 270:
/* Line 1269 of yacc.c. */
-#line 3154 "querytransformparser.ypp"
+#line 3209 "querytransformparser.ypp"
{
(yyval.expr) = createSlashSlashPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyloc), parseInfo);
}
@@ -6043,7 +6098,7 @@ yyreduce:
case 271:
/* Line 1269 of yacc.c. */
-#line 3159 "querytransformparser.ypp"
+#line 3214 "querytransformparser.ypp"
{
(yyval.expr) = NodeSortExpression::wrapAround((yyvsp[(1) - (1)].expr), parseInfo->staticContext);
}
@@ -6051,7 +6106,7 @@ yyreduce:
case 273:
/* Line 1269 of yacc.c. */
-#line 3164 "querytransformparser.ypp"
+#line 3219 "querytransformparser.ypp"
{
(yyval.expr) = create(new CurrentItemStore((yyvsp[(2) - (2)].expr)), (yyloc), parseInfo);
}
@@ -6059,7 +6114,7 @@ yyreduce:
case 274:
/* Line 1269 of yacc.c. */
-#line 3168 "querytransformparser.ypp"
+#line 3223 "querytransformparser.ypp"
{
const xsDouble version = (yyvsp[(1) - (1)].sval).toDouble();
@@ -6071,7 +6126,7 @@ yyreduce:
case 275:
/* Line 1269 of yacc.c. */
-#line 3176 "querytransformparser.ypp"
+#line 3231 "querytransformparser.ypp"
{
if((yyvsp[(2) - (3)].enums.Double) < 2)
(yyval.expr) = createCompatStore((yyvsp[(3) - (3)].expr), (yyloc), parseInfo);
@@ -6082,8 +6137,9 @@ yyreduce:
case 276:
/* Line 1269 of yacc.c. */
-#line 3183 "querytransformparser.ypp"
+#line 3238 "querytransformparser.ypp"
{
+ allowedIn(QXmlQuery::XSLT20, parseInfo, (yyloc));
Q_ASSERT(!(yyvsp[(2) - (5)].sval).isEmpty());
(yyval.expr) = create(new StaticBaseURIStore((yyvsp[(2) - (5)].sval), (yyvsp[(4) - (5)].expr)), (yyloc), parseInfo);
}
@@ -6091,8 +6147,9 @@ yyreduce:
case 277:
/* Line 1269 of yacc.c. */
-#line 3189 "querytransformparser.ypp"
+#line 3245 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, (yyloc));
parseInfo->resolvers.push(parseInfo->staticContext->namespaceBindings());
const NamespaceResolver::Ptr resolver(new DelegatingNamespaceResolver(parseInfo->staticContext->namespaceBindings()));
resolver->addBinding(QXmlName(parseInfo->staticContext->namePool()->allocateNamespace((yyvsp[(5) - (6)].sval)),
@@ -6104,7 +6161,7 @@ yyreduce:
case 278:
/* Line 1269 of yacc.c. */
-#line 3199 "querytransformparser.ypp"
+#line 3256 "querytransformparser.ypp"
{
parseInfo->staticContext->setNamespaceBindings(parseInfo->resolvers.pop());
(yyval.expr) = (yyvsp[(8) - (9)].expr);
@@ -6113,7 +6170,7 @@ yyreduce:
case 279:
/* Line 1269 of yacc.c. */
-#line 3204 "querytransformparser.ypp"
+#line 3261 "querytransformparser.ypp"
{
(yyval.expr) = create(new CallTemplate((yyvsp[(2) - (5)].qName), parseInfo->templateWithParams), (yyloc), parseInfo);
parseInfo->templateWithParametersHandled();
@@ -6123,7 +6180,7 @@ yyreduce:
case 280:
/* Line 1269 of yacc.c. */
-#line 3211 "querytransformparser.ypp"
+#line 3268 "querytransformparser.ypp"
{
parseInfo->startParsingWithParam();
}
@@ -6131,7 +6188,7 @@ yyreduce:
case 281:
/* Line 1269 of yacc.c. */
-#line 3215 "querytransformparser.ypp"
+#line 3272 "querytransformparser.ypp"
{
parseInfo->endParsingWithParam();
}
@@ -6139,42 +6196,42 @@ yyreduce:
case 282:
/* Line 1269 of yacc.c. */
-#line 3220 "querytransformparser.ypp"
+#line 3277 "querytransformparser.ypp"
{
}
break;
case 283:
/* Line 1269 of yacc.c. */
-#line 3223 "querytransformparser.ypp"
+#line 3280 "querytransformparser.ypp"
{
}
break;
case 284:
/* Line 1269 of yacc.c. */
-#line 3226 "querytransformparser.ypp"
+#line 3283 "querytransformparser.ypp"
{
}
break;
case 285:
/* Line 1269 of yacc.c. */
-#line 3230 "querytransformparser.ypp"
+#line 3287 "querytransformparser.ypp"
{
}
break;
case 286:
/* Line 1269 of yacc.c. */
-#line 3233 "querytransformparser.ypp"
+#line 3290 "querytransformparser.ypp"
{
}
break;
case 287:
/* Line 1269 of yacc.c. */
-#line 3237 "querytransformparser.ypp"
+#line 3294 "querytransformparser.ypp"
{
/* Note, this grammar rule is invoked for @c xsl:param @em and @c
* xsl:with-param. */
@@ -6242,7 +6299,7 @@ yyreduce:
case 288:
/* Line 1269 of yacc.c. */
-#line 3302 "querytransformparser.ypp"
+#line 3359 "querytransformparser.ypp"
{
(yyval.enums.Bool) = false;
}
@@ -6250,7 +6307,7 @@ yyreduce:
case 289:
/* Line 1269 of yacc.c. */
-#line 3306 "querytransformparser.ypp"
+#line 3363 "querytransformparser.ypp"
{
(yyval.enums.Bool) = true;
}
@@ -6258,7 +6315,7 @@ yyreduce:
case 290:
/* Line 1269 of yacc.c. */
-#line 3311 "querytransformparser.ypp"
+#line 3368 "querytransformparser.ypp"
{
(yyval.expr) = Expression::Ptr();
}
@@ -6266,7 +6323,7 @@ yyreduce:
case 291:
/* Line 1269 of yacc.c. */
-#line 3315 "querytransformparser.ypp"
+#line 3372 "querytransformparser.ypp"
{
(yyval.expr) = (yyvsp[(2) - (2)].expr);
}
@@ -6274,7 +6331,7 @@ yyreduce:
case 292:
/* Line 1269 of yacc.c. */
-#line 3324 "querytransformparser.ypp"
+#line 3381 "querytransformparser.ypp"
{
(yyval.enums.pathKind) = Path::RegularPath;
}
@@ -6282,7 +6339,7 @@ yyreduce:
case 293:
/* Line 1269 of yacc.c. */
-#line 3328 "querytransformparser.ypp"
+#line 3385 "querytransformparser.ypp"
{
(yyval.enums.pathKind) = Path::XSLTForEach;
}
@@ -6290,7 +6347,7 @@ yyreduce:
case 294:
/* Line 1269 of yacc.c. */
-#line 3332 "querytransformparser.ypp"
+#line 3389 "querytransformparser.ypp"
{
(yyval.enums.pathKind) = Path::ForApplyTemplate;
}
@@ -6298,7 +6355,7 @@ yyreduce:
case 296:
/* Line 1269 of yacc.c. */
-#line 3338 "querytransformparser.ypp"
+#line 3395 "querytransformparser.ypp"
{
(yyval.expr) = create(GenericPredicate::create((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr), parseInfo->staticContext, fromYYLTYPE((yyloc), parseInfo)), (yyloc), parseInfo);
}
@@ -6306,7 +6363,7 @@ yyreduce:
case 299:
/* Line 1269 of yacc.c. */
-#line 3346 "querytransformparser.ypp"
+#line 3403 "querytransformparser.ypp"
{
if((yyvsp[(1) - (1)].enums.axis) == QXmlNodeModelIndex::AxisAttribute)
parseInfo->nodeTestSource = BuiltinTypes::attribute;
@@ -6315,7 +6372,7 @@ yyreduce:
case 300:
/* Line 1269 of yacc.c. */
-#line 3351 "querytransformparser.ypp"
+#line 3408 "querytransformparser.ypp"
{
if((yyvsp[(3) - (3)].itemType))
{
@@ -6344,7 +6401,7 @@ yyreduce:
case 304:
/* Line 1269 of yacc.c. */
-#line 3381 "querytransformparser.ypp"
+#line 3438 "querytransformparser.ypp"
{
if((yyvsp[(1) - (2)].enums.axis) == QXmlNodeModelIndex::AxisNamespace)
{
@@ -6356,84 +6413,114 @@ yyreduce:
}
else
(yyval.enums.axis) = (yyvsp[(1) - (2)].enums.axis);
+
+ switch((yyvsp[(1) - (2)].enums.axis))
+ {
+ case QXmlNodeModelIndex::AxisAttribute:
+ {
+ allowedIn(QueryLanguages( QXmlQuery::XPath20
+ | QXmlQuery::XQuery10
+ | QXmlQuery::XmlSchema11IdentityConstraintField
+ | QXmlQuery::XSLT20),
+ parseInfo, (yyloc));
+ break;
+ }
+ case QXmlNodeModelIndex::AxisChild:
+ {
+ allowedIn(QueryLanguages( QXmlQuery::XPath20
+ | QXmlQuery::XQuery10
+ | QXmlQuery::XmlSchema11IdentityConstraintField
+ | QXmlQuery::XmlSchema11IdentityConstraintSelector
+ | QXmlQuery::XSLT20),
+ parseInfo, (yyloc));
+ break;
+ }
+ default:
+ {
+ allowedIn(QueryLanguages( QXmlQuery::XPath20
+ | QXmlQuery::XQuery10
+ | QXmlQuery::XSLT20),
+ parseInfo, (yyloc));
+ }
+ }
}
break;
case 305:
/* Line 1269 of yacc.c. */
-#line 3394 "querytransformparser.ypp"
+#line 3481 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisAncestorOrSelf ;}
break;
case 306:
/* Line 1269 of yacc.c. */
-#line 3395 "querytransformparser.ypp"
+#line 3482 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisAncestor ;}
break;
case 307:
/* Line 1269 of yacc.c. */
-#line 3396 "querytransformparser.ypp"
+#line 3483 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisAttribute ;}
break;
case 308:
/* Line 1269 of yacc.c. */
-#line 3397 "querytransformparser.ypp"
+#line 3484 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisChild ;}
break;
case 309:
/* Line 1269 of yacc.c. */
-#line 3398 "querytransformparser.ypp"
+#line 3485 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisDescendantOrSelf;}
break;
case 310:
/* Line 1269 of yacc.c. */
-#line 3399 "querytransformparser.ypp"
+#line 3486 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisDescendant ;}
break;
case 311:
/* Line 1269 of yacc.c. */
-#line 3400 "querytransformparser.ypp"
+#line 3487 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisFollowing ;}
break;
case 312:
/* Line 1269 of yacc.c. */
-#line 3401 "querytransformparser.ypp"
+#line 3488 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisPreceding ;}
break;
case 313:
/* Line 1269 of yacc.c. */
-#line 3402 "querytransformparser.ypp"
+#line 3489 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisFollowingSibling;}
break;
case 314:
/* Line 1269 of yacc.c. */
-#line 3403 "querytransformparser.ypp"
+#line 3490 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisPrecedingSibling;}
break;
case 315:
/* Line 1269 of yacc.c. */
-#line 3404 "querytransformparser.ypp"
+#line 3491 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisParent ;}
break;
case 316:
/* Line 1269 of yacc.c. */
-#line 3405 "querytransformparser.ypp"
+#line 3492 "querytransformparser.ypp"
{(yyval.enums.axis) = QXmlNodeModelIndex::AxisSelf ;}
break;
case 317:
/* Line 1269 of yacc.c. */
-#line 3408 "querytransformparser.ypp"
+#line 3495 "querytransformparser.ypp"
{
parseInfo->nodeTestSource = BuiltinTypes::attribute;
}
@@ -6441,8 +6528,9 @@ yyreduce:
case 318:
/* Line 1269 of yacc.c. */
-#line 3412 "querytransformparser.ypp"
+#line 3499 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20 | QXmlQuery::XmlSchema11IdentityConstraintField), parseInfo, (yyloc));
(yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisAttribute, (yyvsp[(3) - (3)].itemType)), (yyloc), parseInfo);
parseInfo->restoreNodeTestSource();
@@ -6451,7 +6539,7 @@ yyreduce:
case 319:
/* Line 1269 of yacc.c. */
-#line 3418 "querytransformparser.ypp"
+#line 3506 "querytransformparser.ypp"
{
ItemType::Ptr nodeTest;
@@ -6466,7 +6554,7 @@ yyreduce:
case 320:
/* Line 1269 of yacc.c. */
-#line 3429 "querytransformparser.ypp"
+#line 3517 "querytransformparser.ypp"
{
(yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisAttribute, (yyvsp[(1) - (1)].itemType)), (yyloc), parseInfo);
}
@@ -6474,15 +6562,23 @@ yyreduce:
case 322:
/* Line 1269 of yacc.c. */
-#line 3436 "querytransformparser.ypp"
+#line 3524 "querytransformparser.ypp"
{
(yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::node), (yyloc), parseInfo);
}
break;
+ case 324:
+/* Line 1269 of yacc.c. */
+#line 3530 "querytransformparser.ypp"
+ {
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
+ }
+ break;
+
case 325:
/* Line 1269 of yacc.c. */
-#line 3444 "querytransformparser.ypp"
+#line 3535 "querytransformparser.ypp"
{
(yyval.itemType) = QNameTest::create(parseInfo->nodeTestSource, (yyvsp[(1) - (1)].qName));
}
@@ -6490,7 +6586,7 @@ yyreduce:
case 327:
/* Line 1269 of yacc.c. */
-#line 3450 "querytransformparser.ypp"
+#line 3541 "querytransformparser.ypp"
{
(yyval.itemType) = parseInfo->nodeTestSource;
}
@@ -6498,7 +6594,7 @@ yyreduce:
case 328:
/* Line 1269 of yacc.c. */
-#line 3454 "querytransformparser.ypp"
+#line 3545 "querytransformparser.ypp"
{
const NamePool::Ptr np(parseInfo->staticContext->namePool());
const ReflectYYLTYPE ryy((yyloc), parseInfo);
@@ -6511,8 +6607,9 @@ yyreduce:
case 329:
/* Line 1269 of yacc.c. */
-#line 3463 "querytransformparser.ypp"
+#line 3554 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
const QXmlName::LocalNameCode c = parseInfo->staticContext->namePool()->allocateLocalName((yyvsp[(1) - (1)].sval));
(yyval.itemType) = LocalNameTest::create(parseInfo->nodeTestSource, c);
}
@@ -6520,15 +6617,16 @@ yyreduce:
case 331:
/* Line 1269 of yacc.c. */
-#line 3470 "querytransformparser.ypp"
+#line 3562 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(GenericPredicate::create((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr), parseInfo->staticContext, fromYYLTYPE((yylsp[(4) - (4)]), parseInfo)), (yyloc), parseInfo);
}
break;
case 339:
/* Line 1269 of yacc.c. */
-#line 3482 "querytransformparser.ypp"
+#line 3575 "querytransformparser.ypp"
{
(yyval.expr) = create(new ApplyTemplate(parseInfo->modeFor((yyvsp[(2) - (5)].qName)),
parseInfo->templateWithParams,
@@ -6541,7 +6639,7 @@ yyreduce:
case 341:
/* Line 1269 of yacc.c. */
-#line 3493 "querytransformparser.ypp"
+#line 3586 "querytransformparser.ypp"
{
(yyval.expr) = create(new Literal(AtomicString::fromValue((yyvsp[(1) - (1)].sval))), (yyloc), parseInfo);
}
@@ -6549,31 +6647,34 @@ yyreduce:
case 342:
/* Line 1269 of yacc.c. */
-#line 3498 "querytransformparser.ypp"
+#line 3591 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = createNumericLiteral<Double>((yyvsp[(1) - (1)].sval), (yyloc), parseInfo);
}
break;
case 343:
/* Line 1269 of yacc.c. */
-#line 3502 "querytransformparser.ypp"
+#line 3596 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = createNumericLiteral<Numeric>((yyvsp[(1) - (1)].sval), (yyloc), parseInfo);
}
break;
case 344:
/* Line 1269 of yacc.c. */
-#line 3507 "querytransformparser.ypp"
+#line 3602 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = resolveVariable((yyvsp[(2) - (2)].qName), (yyloc), parseInfo, false);
}
break;
case 345:
/* Line 1269 of yacc.c. */
-#line 3512 "querytransformparser.ypp"
+#line 3608 "querytransformparser.ypp"
{
/* See: http://www.w3.org/TR/xpath20/#id-variables */
(yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(QString(), (yyvsp[(1) - (1)].sval));
@@ -6582,7 +6683,7 @@ yyreduce:
case 346:
/* Line 1269 of yacc.c. */
-#line 3517 "querytransformparser.ypp"
+#line 3613 "querytransformparser.ypp"
{
(yyval.qName) = (yyvsp[(1) - (1)].qName);
}
@@ -6590,23 +6691,25 @@ yyreduce:
case 347:
/* Line 1269 of yacc.c. */
-#line 3522 "querytransformparser.ypp"
+#line 3618 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = (yyvsp[(2) - (3)].expr);
}
break;
case 348:
/* Line 1269 of yacc.c. */
-#line 3526 "querytransformparser.ypp"
+#line 3623 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
(yyval.expr) = create(new EmptySequence, (yyloc), parseInfo);
}
break;
case 349:
/* Line 1269 of yacc.c. */
-#line 3531 "querytransformparser.ypp"
+#line 3629 "querytransformparser.ypp"
{
(yyval.expr) = create(new ContextItem(), (yyloc), parseInfo);
}
@@ -6614,7 +6717,7 @@ yyreduce:
case 350:
/* Line 1269 of yacc.c. */
-#line 3536 "querytransformparser.ypp"
+#line 3634 "querytransformparser.ypp"
{
(yyval.expr) = (yyvsp[(2) - (2)].expr);
}
@@ -6622,8 +6725,9 @@ yyreduce:
case 351:
/* Line 1269 of yacc.c. */
-#line 3541 "querytransformparser.ypp"
+#line 3639 "querytransformparser.ypp"
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
if(XPathHelper::isReservedNamespace((yyvsp[(1) - (4)].qName).namespaceURI()) || (yyvsp[(1) - (4)].qName).namespaceURI() == StandardNamespaces::InternalXSLT)
{ /* We got a call to a builtin function. */
const ReflectYYLTYPE ryy((yyloc), parseInfo);
@@ -6653,7 +6757,7 @@ yyreduce:
case 352:
/* Line 1269 of yacc.c. */
-#line 3569 "querytransformparser.ypp"
+#line 3668 "querytransformparser.ypp"
{
(yyval.expressionList) = Expression::List();
}
@@ -6661,7 +6765,7 @@ yyreduce:
case 353:
/* Line 1269 of yacc.c. */
-#line 3574 "querytransformparser.ypp"
+#line 3673 "querytransformparser.ypp"
{
Expression::List list;
list.append((yyvsp[(1) - (1)].expr));
@@ -6671,15 +6775,15 @@ yyreduce:
case 355:
/* Line 1269 of yacc.c. */
-#line 3583 "querytransformparser.ypp"
+#line 3682 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
}
break;
case 360:
/* Line 1269 of yacc.c. */
-#line 3624 "querytransformparser.ypp"
+#line 3726 "querytransformparser.ypp"
{
(yyval.enums.tokenizerPosition) = parseInfo->tokenizer->commenceScanOnly();
parseInfo->scanOnlyStack.push(true);
@@ -6688,7 +6792,7 @@ yyreduce:
case 361:
/* Line 1269 of yacc.c. */
-#line 3633 "querytransformparser.ypp"
+#line 3735 "querytransformparser.ypp"
{
++parseInfo->elementConstructorDepth;
Expression::List constructors;
@@ -6836,7 +6940,7 @@ yyreduce:
case 362:
/* Line 1269 of yacc.c. */
-#line 3779 "querytransformparser.ypp"
+#line 3881 "querytransformparser.ypp"
{
/* We add the content constructor after the attribute constructors. This might result
* in nested ExpressionSequences, but it will be optimized away later on. */
@@ -6935,7 +7039,7 @@ yyreduce:
case 363:
/* Line 1269 of yacc.c. */
-#line 3875 "querytransformparser.ypp"
+#line 3977 "querytransformparser.ypp"
{
(yyval.expr) = create(new EmptySequence(), (yyloc), parseInfo);
}
@@ -6943,7 +7047,7 @@ yyreduce:
case 364:
/* Line 1269 of yacc.c. */
-#line 3879 "querytransformparser.ypp"
+#line 3981 "querytransformparser.ypp"
{
if(!(yyvsp[(4) - (5)].qName).isLexicallyEqual(parseInfo->tagStack.top()))
{
@@ -6965,7 +7069,7 @@ yyreduce:
case 365:
/* Line 1269 of yacc.c. */
-#line 3898 "querytransformparser.ypp"
+#line 4000 "querytransformparser.ypp"
{
(yyval.attributeHolders) = AttributeHolderVector();
}
@@ -6973,7 +7077,7 @@ yyreduce:
case 366:
/* Line 1269 of yacc.c. */
-#line 3902 "querytransformparser.ypp"
+#line 4004 "querytransformparser.ypp"
{
(yyvsp[(1) - (2)].attributeHolders).append((yyvsp[(2) - (2)].attributeHolder));
(yyval.attributeHolders) = (yyvsp[(1) - (2)].attributeHolders);
@@ -6982,7 +7086,7 @@ yyreduce:
case 367:
/* Line 1269 of yacc.c. */
-#line 3908 "querytransformparser.ypp"
+#line 4010 "querytransformparser.ypp"
{
(yyval.attributeHolder) = qMakePair((yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].expr));
}
@@ -6990,7 +7094,7 @@ yyreduce:
case 368:
/* Line 1269 of yacc.c. */
-#line 3913 "querytransformparser.ypp"
+#line 4015 "querytransformparser.ypp"
{
(yyval.expr) = createDirAttributeValue((yyvsp[(2) - (3)].expressionList), parseInfo, (yyloc));
}
@@ -6998,7 +7102,7 @@ yyreduce:
case 369:
/* Line 1269 of yacc.c. */
-#line 3918 "querytransformparser.ypp"
+#line 4020 "querytransformparser.ypp"
{
(yyval.expr) = createDirAttributeValue((yyvsp[(2) - (3)].expressionList), parseInfo, (yyloc));
}
@@ -7006,7 +7110,7 @@ yyreduce:
case 370:
/* Line 1269 of yacc.c. */
-#line 3923 "querytransformparser.ypp"
+#line 4025 "querytransformparser.ypp"
{
(yyval.expressionList) = Expression::List();
}
@@ -7014,7 +7118,7 @@ yyreduce:
case 371:
/* Line 1269 of yacc.c. */
-#line 3927 "querytransformparser.ypp"
+#line 4029 "querytransformparser.ypp"
{
Expression::Ptr content((yyvsp[(1) - (2)].expr));
@@ -7028,7 +7132,7 @@ yyreduce:
case 372:
/* Line 1269 of yacc.c. */
-#line 3937 "querytransformparser.ypp"
+#line 4039 "querytransformparser.ypp"
{
(yyvsp[(2) - (2)].expressionList).prepend(create(new Literal(AtomicString::fromValue((yyvsp[(1) - (2)].sval))), (yyloc), parseInfo));
(yyval.expressionList) = (yyvsp[(2) - (2)].expressionList);
@@ -7037,7 +7141,7 @@ yyreduce:
case 373:
/* Line 1269 of yacc.c. */
-#line 3943 "querytransformparser.ypp"
+#line 4045 "querytransformparser.ypp"
{
(yyval.expressionList) = Expression::List();
parseInfo->isPreviousEnclosedExpr = false;
@@ -7046,7 +7150,7 @@ yyreduce:
case 374:
/* Line 1269 of yacc.c. */
-#line 3948 "querytransformparser.ypp"
+#line 4050 "querytransformparser.ypp"
{
(yyvsp[(1) - (2)].expressionList).append((yyvsp[(2) - (2)].expr));
(yyval.expressionList) = (yyvsp[(1) - (2)].expressionList);
@@ -7056,7 +7160,7 @@ yyreduce:
case 375:
/* Line 1269 of yacc.c. */
-#line 3954 "querytransformparser.ypp"
+#line 4056 "querytransformparser.ypp"
{
if(parseInfo->staticContext->boundarySpacePolicy() == StaticContext::BSPStrip &&
XPathHelper::isWhitespaceOnly((yyvsp[(2) - (2)].sval)))
@@ -7074,7 +7178,7 @@ yyreduce:
case 376:
/* Line 1269 of yacc.c. */
-#line 3968 "querytransformparser.ypp"
+#line 4070 "querytransformparser.ypp"
{
(yyvsp[(1) - (2)].expressionList).append(create(new TextNodeConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(2) - (2)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo));
(yyval.expressionList) = (yyvsp[(1) - (2)].expressionList);
@@ -7084,7 +7188,7 @@ yyreduce:
case 377:
/* Line 1269 of yacc.c. */
-#line 3974 "querytransformparser.ypp"
+#line 4076 "querytransformparser.ypp"
{
/* We insert a text node constructor that send an empty text node between
* the two enclosed expressions, in order to ensure that no space is inserted.
@@ -7104,7 +7208,7 @@ yyreduce:
case 378:
/* Line 1269 of yacc.c. */
-#line 3991 "querytransformparser.ypp"
+#line 4093 "querytransformparser.ypp"
{
(yyval.expr) = create(new CommentConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(2) - (2)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo);
}
@@ -7112,7 +7216,7 @@ yyreduce:
case 379:
/* Line 1269 of yacc.c. */
-#line 3996 "querytransformparser.ypp"
+#line 4098 "querytransformparser.ypp"
{
const ReflectYYLTYPE ryy((yyloc), parseInfo);
NCNameConstructor::validateTargetName<StaticContext::Ptr,
@@ -7128,9 +7232,9 @@ yyreduce:
case 387:
/* Line 1269 of yacc.c. */
-#line 4017 "querytransformparser.ypp"
+#line 4119 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (3)].enums.Bool));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (3)].enums.Bool));
(yyval.expr) = create(new DocumentConstructor((yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
@@ -7138,7 +7242,7 @@ yyreduce:
case 388:
/* Line 1269 of yacc.c. */
-#line 4024 "querytransformparser.ypp"
+#line 4126 "querytransformparser.ypp"
{
/* This value is incremented before the action below is executed. */
++parseInfo->elementConstructorDepth;
@@ -7147,10 +7251,10 @@ yyreduce:
case 389:
/* Line 1269 of yacc.c. */
-#line 4029 "querytransformparser.ypp"
+#line 4131 "querytransformparser.ypp"
{
Q_ASSERT(5);
- disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (5)].enums.Bool));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (5)].enums.Bool));
Expression::Ptr effExpr;
@@ -7184,7 +7288,7 @@ yyreduce:
case 390:
/* Line 1269 of yacc.c. */
-#line 4063 "querytransformparser.ypp"
+#line 4165 "querytransformparser.ypp"
{
(yyval.enums.Bool) = false;
}
@@ -7192,7 +7296,7 @@ yyreduce:
case 391:
/* Line 1269 of yacc.c. */
-#line 4067 "querytransformparser.ypp"
+#line 4169 "querytransformparser.ypp"
{
(yyval.enums.Bool) = true;
}
@@ -7200,9 +7304,9 @@ yyreduce:
case 392:
/* Line 1269 of yacc.c. */
-#line 4075 "querytransformparser.ypp"
+#line 4177 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (4)].enums.Bool));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (4)].enums.Bool));
const Expression::Ptr name(create(new AttributeNameValidator((yyvsp[(3) - (4)].expr)), (yyloc), parseInfo));
@@ -7215,7 +7319,7 @@ yyreduce:
case 393:
/* Line 1269 of yacc.c. */
-#line 4087 "querytransformparser.ypp"
+#line 4189 "querytransformparser.ypp"
{
(yyval.expr) = create(new TextNodeConstructor(createSimpleContent((yyvsp[(3) - (3)].expr), (yyloc), parseInfo)), (yyloc), parseInfo);
}
@@ -7223,9 +7327,9 @@ yyreduce:
case 394:
/* Line 1269 of yacc.c. */
-#line 4092 "querytransformparser.ypp"
+#line 4194 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (3)].enums.Bool));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (3)].enums.Bool));
(yyval.expr) = create(new CommentConstructor(createSimpleContent((yyvsp[(3) - (3)].expr), (yyloc), parseInfo)), (yyloc), parseInfo);
}
@@ -7233,9 +7337,9 @@ yyreduce:
case 395:
/* Line 1269 of yacc.c. */
-#line 4099 "querytransformparser.ypp"
+#line 4201 "querytransformparser.ypp"
{
- disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (3)].expr));
+ allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (3)].expr));
if((yyvsp[(3) - (3)].expr))
{
@@ -7248,7 +7352,7 @@ yyreduce:
case 396:
/* Line 1269 of yacc.c. */
-#line 4110 "querytransformparser.ypp"
+#line 4212 "querytransformparser.ypp"
{
parseInfo->nodeTestSource = BuiltinTypes::attribute;
}
@@ -7256,7 +7360,7 @@ yyreduce:
case 397:
/* Line 1269 of yacc.c. */
-#line 4114 "querytransformparser.ypp"
+#line 4216 "querytransformparser.ypp"
{
parseInfo->restoreNodeTestSource();
}
@@ -7264,7 +7368,7 @@ yyreduce:
case 398:
/* Line 1269 of yacc.c. */
-#line 4117 "querytransformparser.ypp"
+#line 4219 "querytransformparser.ypp"
{
(yyval.expr) = create(new Literal(toItem(QNameValue::fromValue(parseInfo->staticContext->namePool(), (yyvsp[(2) - (3)].qName)))), (yyloc), parseInfo);
}
@@ -7272,7 +7376,7 @@ yyreduce:
case 400:
/* Line 1269 of yacc.c. */
-#line 4123 "querytransformparser.ypp"
+#line 4225 "querytransformparser.ypp"
{
(yyval.expr) = create(new Literal(toItem(QNameValue::fromValue(parseInfo->staticContext->namePool(), (yyvsp[(1) - (1)].qName)))), (yyloc), parseInfo);
}
@@ -7280,7 +7384,7 @@ yyreduce:
case 402:
/* Line 1269 of yacc.c. */
-#line 4129 "querytransformparser.ypp"
+#line 4231 "querytransformparser.ypp"
{
if(BuiltinTypes::xsQName->xdtTypeMatches((yyvsp[(1) - (1)].expr)->staticType()->itemType()))
(yyval.expr) = (yyvsp[(1) - (1)].expr);
@@ -7295,7 +7399,7 @@ yyreduce:
case 403:
/* Line 1269 of yacc.c. */
-#line 4144 "querytransformparser.ypp"
+#line 4246 "querytransformparser.ypp"
{
(yyval.expr) = create(new NCNameConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(1) - (1)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo);
}
@@ -7303,7 +7407,7 @@ yyreduce:
case 404:
/* Line 1269 of yacc.c. */
-#line 4148 "querytransformparser.ypp"
+#line 4250 "querytransformparser.ypp"
{
(yyval.expr) = create(new NCNameConstructor((yyvsp[(1) - (1)].expr)), (yyloc), parseInfo);
}
@@ -7311,7 +7415,7 @@ yyreduce:
case 405:
/* Line 1269 of yacc.c. */
-#line 4157 "querytransformparser.ypp"
+#line 4259 "querytransformparser.ypp"
{
(yyval.expr) = create(new ComputedNamespaceConstructor((yyvsp[(2) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
}
@@ -7319,7 +7423,7 @@ yyreduce:
case 406:
/* Line 1269 of yacc.c. */
-#line 4162 "querytransformparser.ypp"
+#line 4264 "querytransformparser.ypp"
{
(yyval.sequenceType) = makeGenericSequenceType((yyvsp[(1) - (1)].itemType), Cardinality::exactlyOne());
}
@@ -7327,7 +7431,7 @@ yyreduce:
case 407:
/* Line 1269 of yacc.c. */
-#line 4166 "querytransformparser.ypp"
+#line 4268 "querytransformparser.ypp"
{
(yyval.sequenceType) = makeGenericSequenceType((yyvsp[(1) - (2)].itemType), Cardinality::zeroOrOne());
}
@@ -7335,7 +7439,7 @@ yyreduce:
case 408:
/* Line 1269 of yacc.c. */
-#line 4171 "querytransformparser.ypp"
+#line 4273 "querytransformparser.ypp"
{
(yyval.sequenceType) = CommonSequenceTypes::ZeroOrMoreItems;
}
@@ -7343,7 +7447,7 @@ yyreduce:
case 409:
/* Line 1269 of yacc.c. */
-#line 4175 "querytransformparser.ypp"
+#line 4277 "querytransformparser.ypp"
{
(yyval.sequenceType) = (yyvsp[(2) - (2)].sequenceType);
}
@@ -7351,7 +7455,7 @@ yyreduce:
case 410:
/* Line 1269 of yacc.c. */
-#line 4180 "querytransformparser.ypp"
+#line 4282 "querytransformparser.ypp"
{
(yyval.sequenceType) = makeGenericSequenceType((yyvsp[(1) - (2)].itemType), (yyvsp[(2) - (2)].cardinality));
}
@@ -7359,7 +7463,7 @@ yyreduce:
case 411:
/* Line 1269 of yacc.c. */
-#line 4185 "querytransformparser.ypp"
+#line 4287 "querytransformparser.ypp"
{
(yyval.sequenceType) = CommonSequenceTypes::Empty;
}
@@ -7367,31 +7471,31 @@ yyreduce:
case 412:
/* Line 1269 of yacc.c. */
-#line 4189 "querytransformparser.ypp"
+#line 4291 "querytransformparser.ypp"
{(yyval.cardinality) = Cardinality::exactlyOne();}
break;
case 413:
/* Line 1269 of yacc.c. */
-#line 4190 "querytransformparser.ypp"
+#line 4292 "querytransformparser.ypp"
{(yyval.cardinality) = Cardinality::oneOrMore();}
break;
case 414:
/* Line 1269 of yacc.c. */
-#line 4191 "querytransformparser.ypp"
+#line 4293 "querytransformparser.ypp"
{(yyval.cardinality) = Cardinality::zeroOrMore();}
break;
case 415:
/* Line 1269 of yacc.c. */
-#line 4192 "querytransformparser.ypp"
+#line 4294 "querytransformparser.ypp"
{(yyval.cardinality) = Cardinality::zeroOrOne();}
break;
case 419:
/* Line 1269 of yacc.c. */
-#line 4198 "querytransformparser.ypp"
+#line 4300 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::item;
}
@@ -7399,7 +7503,7 @@ yyreduce:
case 420:
/* Line 1269 of yacc.c. */
-#line 4203 "querytransformparser.ypp"
+#line 4305 "querytransformparser.ypp"
{
const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(1) - (1)].qName)));
@@ -7435,7 +7539,7 @@ yyreduce:
case 428:
/* Line 1269 of yacc.c. */
-#line 4247 "querytransformparser.ypp"
+#line 4349 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::node;
}
@@ -7443,7 +7547,7 @@ yyreduce:
case 429:
/* Line 1269 of yacc.c. */
-#line 4252 "querytransformparser.ypp"
+#line 4354 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::document;
}
@@ -7451,7 +7555,7 @@ yyreduce:
case 430:
/* Line 1269 of yacc.c. */
-#line 4257 "querytransformparser.ypp"
+#line 4359 "querytransformparser.ypp"
{
// TODO support for document element testing
(yyval.itemType) = BuiltinTypes::document;
@@ -7460,7 +7564,7 @@ yyreduce:
case 433:
/* Line 1269 of yacc.c. */
-#line 4266 "querytransformparser.ypp"
+#line 4368 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::text;
}
@@ -7468,7 +7572,7 @@ yyreduce:
case 434:
/* Line 1269 of yacc.c. */
-#line 4271 "querytransformparser.ypp"
+#line 4373 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::comment;
}
@@ -7476,7 +7580,7 @@ yyreduce:
case 435:
/* Line 1269 of yacc.c. */
-#line 4276 "querytransformparser.ypp"
+#line 4378 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::pi;
}
@@ -7484,7 +7588,7 @@ yyreduce:
case 436:
/* Line 1269 of yacc.c. */
-#line 4281 "querytransformparser.ypp"
+#line 4383 "querytransformparser.ypp"
{
(yyval.itemType) = LocalNameTest::create(BuiltinTypes::pi, parseInfo->staticContext->namePool()->allocateLocalName((yyvsp[(3) - (4)].sval)));
}
@@ -7492,7 +7596,7 @@ yyreduce:
case 437:
/* Line 1269 of yacc.c. */
-#line 4286 "querytransformparser.ypp"
+#line 4388 "querytransformparser.ypp"
{
if(QXmlUtils::isNCName((yyvsp[(3) - (4)].sval)))
{
@@ -7511,7 +7615,7 @@ yyreduce:
case 440:
/* Line 1269 of yacc.c. */
-#line 4305 "querytransformparser.ypp"
+#line 4407 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::attribute;
}
@@ -7519,7 +7623,7 @@ yyreduce:
case 441:
/* Line 1269 of yacc.c. */
-#line 4310 "querytransformparser.ypp"
+#line 4412 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::attribute;
}
@@ -7527,7 +7631,7 @@ yyreduce:
case 442:
/* Line 1269 of yacc.c. */
-#line 4315 "querytransformparser.ypp"
+#line 4417 "querytransformparser.ypp"
{
(yyval.itemType) = QNameTest::create(BuiltinTypes::attribute, (yyvsp[(3) - (4)].qName));
}
@@ -7535,7 +7639,7 @@ yyreduce:
case 443:
/* Line 1269 of yacc.c. */
-#line 4319 "querytransformparser.ypp"
+#line 4421 "querytransformparser.ypp"
{
const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (6)].qName)));
@@ -7551,7 +7655,7 @@ yyreduce:
case 444:
/* Line 1269 of yacc.c. */
-#line 4331 "querytransformparser.ypp"
+#line 4433 "querytransformparser.ypp"
{
const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (6)].qName)));
@@ -7567,7 +7671,7 @@ yyreduce:
case 445:
/* Line 1269 of yacc.c. */
-#line 4344 "querytransformparser.ypp"
+#line 4446 "querytransformparser.ypp"
{
parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is not in the in-scope attribute "
"declarations. Note that the schema import "
@@ -7580,7 +7684,7 @@ yyreduce:
case 446:
/* Line 1269 of yacc.c. */
-#line 4354 "querytransformparser.ypp"
+#line 4456 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::element;
}
@@ -7588,7 +7692,7 @@ yyreduce:
case 447:
/* Line 1269 of yacc.c. */
-#line 4359 "querytransformparser.ypp"
+#line 4461 "querytransformparser.ypp"
{
(yyval.itemType) = BuiltinTypes::element;
}
@@ -7596,7 +7700,7 @@ yyreduce:
case 448:
/* Line 1269 of yacc.c. */
-#line 4364 "querytransformparser.ypp"
+#line 4466 "querytransformparser.ypp"
{
(yyval.itemType) = QNameTest::create(BuiltinTypes::element, (yyvsp[(3) - (4)].qName));
}
@@ -7604,7 +7708,7 @@ yyreduce:
case 449:
/* Line 1269 of yacc.c. */
-#line 4369 "querytransformparser.ypp"
+#line 4471 "querytransformparser.ypp"
{
const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (7)].qName)));
@@ -7621,7 +7725,7 @@ yyreduce:
case 450:
/* Line 1269 of yacc.c. */
-#line 4383 "querytransformparser.ypp"
+#line 4485 "querytransformparser.ypp"
{
const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (7)].qName)));
@@ -7638,7 +7742,7 @@ yyreduce:
case 453:
/* Line 1269 of yacc.c. */
-#line 4400 "querytransformparser.ypp"
+#line 4502 "querytransformparser.ypp"
{
parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is not in the in-scope attribute "
"declarations. Note that the schema import "
@@ -7651,7 +7755,7 @@ yyreduce:
case 455:
/* Line 1269 of yacc.c. */
-#line 4412 "querytransformparser.ypp"
+#line 4514 "querytransformparser.ypp"
{
(yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(StandardNamespaces::empty, (yyvsp[(1) - (1)].sval));
}
@@ -7659,7 +7763,7 @@ yyreduce:
case 457:
/* Line 1269 of yacc.c. */
-#line 4424 "querytransformparser.ypp"
+#line 4526 "querytransformparser.ypp"
{
if(parseInfo->nodeTestSource == BuiltinTypes::element)
(yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(parseInfo->staticContext->namespaceBindings()->lookupNamespaceURI(StandardPrefixes::empty), (yyvsp[(1) - (1)].sval));
@@ -7670,7 +7774,7 @@ yyreduce:
case 462:
/* Line 1269 of yacc.c. */
-#line 4438 "querytransformparser.ypp"
+#line 4540 "querytransformparser.ypp"
{
(yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(parseInfo->staticContext->defaultFunctionNamespace(), (yyvsp[(1) - (1)].sval));
}
@@ -7678,7 +7782,7 @@ yyreduce:
case 463:
/* Line 1269 of yacc.c. */
-#line 4442 "querytransformparser.ypp"
+#line 4544 "querytransformparser.ypp"
{
(yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(StandardNamespaces::InternalXSLT, (yyvsp[(2) - (2)].sval));
}
@@ -7686,7 +7790,7 @@ yyreduce:
case 466:
/* Line 1269 of yacc.c. */
-#line 4450 "querytransformparser.ypp"
+#line 4552 "querytransformparser.ypp"
{
parseInfo->staticContext->error(QtXmlPatterns::tr("The name of an extension expression must be in "
"a namespace."),
@@ -7694,9 +7798,25 @@ yyreduce:
}
break;
+ case 469:
+/* Line 1269 of yacc.c. */
+#line 4562 "querytransformparser.ypp"
+ {
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
+ }
+ break;
+
+ case 470:
+/* Line 1269 of yacc.c. */
+#line 4566 "querytransformparser.ypp"
+ {
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc));
+ }
+ break;
+
case 471:
/* Line 1269 of yacc.c. */
-#line 4463 "querytransformparser.ypp"
+#line 4571 "querytransformparser.ypp"
{
const ReflectYYLTYPE ryy((yyloc), parseInfo);
@@ -7712,7 +7832,7 @@ yyreduce:
case 472:
/* Line 1269 of yacc.c. */
-#line 4475 "querytransformparser.ypp"
+#line 4583 "querytransformparser.ypp"
{
(yyval.qName) = parseInfo->staticContext->namePool()->fromClarkName((yyvsp[(1) - (1)].sval));
}
@@ -7720,7 +7840,7 @@ yyreduce:
/* Line 1269 of yacc.c. */
-#line 7643 "qquerytransformparser.cpp"
+#line 7763 "qquerytransformparser.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -7938,7 +8058,7 @@ yyreturn:
/* Line 1486 of yacc.c. */
-#line 4479 "querytransformparser.ypp"
+#line 4587 "querytransformparser.ypp"
QString Tokenizer::tokenToString(const Token &token)
diff --git a/src/xmlpatterns/parser/qquerytransformparser_p.h b/src/xmlpatterns/parser/qquerytransformparser_p.h
index b33ca55..bb01788 100644
--- a/src/xmlpatterns/parser/qquerytransformparser_p.h
+++ b/src/xmlpatterns/parser/qquerytransformparser_p.h
@@ -49,6 +49,57 @@
//
// We mean it.
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
/* A Bison parser, made by GNU Bison 2.3a. */
/* Skeleton interface for Bison's Yacc-like parsers in C
@@ -104,6 +155,25 @@
# undef SELF
#endif
+/* These tokens are defined to nothing on Windows because they're
+ * used in their documentation parser, for use in things like:
+ *
+ * int foo(IN char* name, OUT char* path);
+ *
+ * Hence this un-break fix. Note that this file was auto generated. */
+#ifdef IN
+# undef IN
+#endif
+#ifdef INSTANCE
+# undef INSTANCE
+#endif
+#ifdef STRICT
+# undef STRICT
+#endif
+#ifdef SELF
+# undef SELF
+#endif
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
diff --git a/src/xmlpatterns/parser/querytransformparser.ypp b/src/xmlpatterns/parser/querytransformparser.ypp
index f67eb5d..74cee11 100644
--- a/src/xmlpatterns/parser/querytransformparser.ypp
+++ b/src/xmlpatterns/parser/querytransformparser.ypp
@@ -227,11 +227,18 @@ static inline QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator,
}
/**
+ * @internal
+ * @relates QXmlQuery
+ */
+typedef QFlags<QXmlQuery::QueryLanguage> QueryLanguages;
+
+/**
* @short Flags invalid expressions and declarations in the currently
* parsed language.
*
- * Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0 and
- * XPath 2.0 inside XSL-T, it is the union of all the constructs in these
+ * Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0, and
+ * XPath 2.0 inside XSL-T, and field and selector patterns in W3C XML Schema's
+ * identity constraints, it is the union of all the constructs in these
* languages. However, when dealing with each language individually, we
* regularly need to disallow some expressions, such as direct element
* constructors when parsing XSL-T, or the typeswitch when parsing XPath.
@@ -242,19 +249,46 @@ static inline QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator,
* instance the @c let clause, should not be flagged as an error, because it's
* used for internal purposes.
*
- * Hence, this function is called from each expression and declaration which is
- * unavailable in XPath.
+ * Hence, this function is called from each expression and declaration with @p
+ * allowedLanguages stating what languages it is allowed in.
*
* If @p isInternal is @c true, no error is raised. Otherwise, if the current
- * language is not XQuery, an error is raised.
+ * language is not in @p allowedLanguages, an error is raised.
*/
-static void disallowedConstruct(const ParserContext *const parseInfo,
- const YYLTYPE &sourceLocator,
- const bool isInternal = false)
+static void allowedIn(const QueryLanguages allowedLanguages,
+ const ParserContext *const parseInfo,
+ const YYLTYPE &sourceLocator,
+ const bool isInternal = false)
{
- if(!isInternal && parseInfo->languageAccent != QXmlQuery::XQuery10)
+ /* We treat XPath 2.0 as a subset of XSL-T 2.0, so if XPath 2.0 is allowed
+ * and XSL-T is the language, it's ok. */
+ if(!isInternal &&
+ (!allowedLanguages.testFlag(parseInfo->languageAccent) && !(allowedLanguages.testFlag(QXmlQuery::XPath20) && parseInfo->languageAccent == QXmlQuery::XSLT20)))
{
- parseInfo->staticContext->error(QtXmlPatterns::tr("A construct was encountered which only is allowed in XQuery."),
+
+ QString langName;
+
+ switch(parseInfo->languageAccent)
+ {
+ case QXmlQuery::XPath20:
+ langName = QLatin1String("XPath 2.0");
+ break;
+ case QXmlQuery::XSLT20:
+ langName = QLatin1String("XSL-T 2.0");
+ break;
+ case QXmlQuery::XQuery10:
+ langName = QLatin1String("XQuery 1.0");
+ break;
+ case QXmlQuery::XmlSchema11IdentityConstraintSelector:
+ langName = QtXmlPatterns::tr("W3C XML Schema identity constraint selector");
+ break;
+ case QXmlQuery::XmlSchema11IdentityConstraintField:
+ langName = QtXmlPatterns::tr("W3C XML Schema identity constraint field");
+ break;
+ }
+
+ parseInfo->staticContext->error(QtXmlPatterns::tr("A construct was encountered "
+ "which is disallowed in the current language(%1).").arg(langName),
ReportContext::XPST0003,
fromYYLTYPE(sourceLocator, parseInfo));
@@ -1560,7 +1594,7 @@ Prolog: /* Empty. */
/* First part. */
| Prolog DefaultNamespaceDecl
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
if(parseInfo->hasSecondPrologPart)
parseInfo->staticContext->error(QtXmlPatterns::tr("A default namespace declaration must occur before function, "
"variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE(@$, parseInfo));
@@ -1579,7 +1613,7 @@ Prolog: /* Empty. */
}
| Prolog Import
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
if(parseInfo->hasSecondPrologPart)
parseInfo->staticContext->error(QtXmlPatterns::tr("Module imports must occur before function, "
"variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE(@$, parseInfo));
@@ -1597,7 +1631,7 @@ Prolog: /* Empty. */
}
| Prolog OptionDecl
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
parseInfo->hasSecondPrologPart = true;
}
@@ -1705,7 +1739,7 @@ OptionalPriority: /* Empty. */
const AtomicValue::Ptr val(Decimal::fromLexical($2));
if(val->hasError())
{
- parseInfo->staticContext->error(QtXmlPatterns::tr("The value of attribute %1 must of type %2, which %3 isn't.")
+ parseInfo->staticContext->error(QtXmlPatterns::tr("The value of attribute %1 must be of type %2, which %3 isn't.")
.arg(formatKeyword(QLatin1String("priority")),
formatType(parseInfo->staticContext->namePool(), BuiltinTypes::xsDecimal),
formatData($2)),
@@ -1730,20 +1764,20 @@ TemplateName: NAME ElementName
Setter: BoundarySpaceDecl /* [7] */
| DefaultCollationDecl
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
}
| BaseURIDecl
| ConstructionDecl
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
}
| OrderingModeDecl
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
}
| EmptyOrderDecl
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
}
| CopyNamespacesDecl
@@ -1755,7 +1789,7 @@ Separator: SEMI_COLON
NamespaceDecl: DECLARE NAMESPACE NCNAME G_EQ URILiteral IsInternal Separator /* [10] */
{
if(!$6)
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
if($3 == QLatin1String("xmlns"))
{
@@ -1867,7 +1901,7 @@ OptionDecl: DECLARE OPTION ElementName StringLiteral Separator
OrderingModeDecl: DECLARE ORDERING OrderingMode Separator /* [14] */
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
if(parseInfo->hasDeclaration(ParserContext::OrderingModeDecl))
{
parseInfo->staticContext->error(prologMessage("declare ordering"),
@@ -1964,7 +1998,7 @@ DefaultCollationDecl: DECLARE DEFAULT COLLATION StringLiteral Separator
BaseURIDecl: DECLARE BASEURI IsInternal URILiteral Separator /* [20] */
{
- disallowedConstruct(parseInfo, @$, $3);
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, @$, $3);
if(parseInfo->hasDeclaration(ParserContext::BaseURIDecl))
{
parseInfo->staticContext->error(prologMessage("declare base-uri"),
@@ -2026,7 +2060,7 @@ FileLocation: URILiteral
VarDecl: DECLARE VARIABLE IsInternal DOLLAR VarName TypeDeclaration
VariableValue OptionalDefaultValue Separator /* [24] */
{
- disallowedConstruct(parseInfo, @$, $3);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $3);
if(variableByName($5, parseInfo))
{
parseInfo->staticContext->error(QtXmlPatterns::tr("A variable by name %1 has already "
@@ -2126,7 +2160,7 @@ FunctionDecl: DECLARE FUNCTION IsInternal FunctionName LPAREN ParamList RPAREN
TypeDeclaration FunctionBody Separator /* [26] */
{
if(!$3)
- disallowedConstruct(parseInfo, @$, $3);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $3);
/* If FunctionBody is null, it is 'external', otherwise the value is the body. */
const QXmlName::NamespaceCode ns($4.namespaceURI());
@@ -2696,7 +2730,7 @@ LetClause: LET IsInternal DOLLAR VarName TypeDeclaration ASSIGN ExprSingle
}
LetTail /* [36] */
{
- disallowedConstruct(parseInfo, @$, $2);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2);
Q_ASSERT(parseInfo->variables.top()->name == $4);
$$ = create(new LetClause($<expr>8, $9, parseInfo->variables.top()), @$, parseInfo);
@@ -2835,6 +2869,7 @@ SomeQuantificationExpr: SOME DOLLAR VarName TypeDeclaration IN ExprSingle
{$<enums.slot>$ = parseInfo->staticContext->currentRangeSlot();}
SomeQuantificationTail /* [X] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new QuantifiedExpression($<enums.slot>8,
QuantifiedExpression::Some, $<expr>6, $9), @$, parseInfo);
parseInfo->finalizePushedVariable();
@@ -2863,6 +2898,7 @@ EveryQuantificationExpr: EVERY DOLLAR VarName TypeDeclaration IN ExprSingle
{$<enums.slot>$ = parseInfo->staticContext->currentRangeSlot();}
EveryQuantificationTail /* [X] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new QuantifiedExpression($<enums.slot>8,
QuantifiedExpression::Every, $<expr>6, $9), @$, parseInfo);
parseInfo->finalizePushedVariable();
@@ -2916,7 +2952,7 @@ TypeswitchExpr: TYPESWITCH LPAREN Expr RPAREN
}
CaseClause /* [43] */
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
parseInfo->typeswitchSource.pop();
$$ = $6;
}
@@ -2976,18 +3012,21 @@ CaseDefault: DEFAULT RETURN ExprSingle
IfExpr: IF LPAREN Expr RPAREN THEN ExprSingle ELSE ExprSingle /* [45] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new IfThenClause($3, $6, $8), @$, parseInfo);
}
OrExpr: AndExpr /* [46] */
| OrExpr OR AndExpr
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new OrExpression($1, $3), @$, parseInfo);
}
AndExpr: ComparisonExpr /* [47] */
| AndExpr AND ComparisonExpr
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new AndExpression($1, $3), @$, parseInfo);
}
@@ -2999,12 +3038,14 @@ ComparisonExpr: RangeExpr
RangeExpr: AdditiveExpr /* [49] */
| AdditiveExpr TO AdditiveExpr
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new RangeExpression($1, $3), @$, parseInfo);
}
AdditiveExpr: MultiplicativeExpr /* [50] */
| AdditiveExpr AdditiveOperator MultiplicativeExpr
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new ArithmeticExpression($1, $2, $3), @$, parseInfo);
}
@@ -3014,6 +3055,7 @@ AdditiveOperator: PLUS {$$ = AtomicMathematician::Add;}
MultiplicativeExpr: UnionExpr /* [51] */
| MultiplicativeExpr MultiplyOperator UnionExpr
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new ArithmeticExpression($1, $2, $3), @$, parseInfo);
}
@@ -3025,12 +3067,18 @@ MultiplyOperator: STAR {$$ = AtomicMathematician::Multiply;}
UnionExpr: IntersectExceptExpr /* [52] */
| UnionExpr UnionOperator IntersectExceptExpr
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10
+ | QXmlQuery::XPath20
+ | QXmlQuery::XmlSchema11IdentityConstraintField
+ | QXmlQuery::XmlSchema11IdentityConstraintSelector),
+ parseInfo, @$);
$$ = create(new CombineNodes($1, CombineNodes::Union, $3), @$, parseInfo);
}
IntersectExceptExpr: InstanceOfExpr /* [53] */
| IntersectExceptExpr IntersectOperator InstanceOfExpr
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new CombineNodes($1, $2, $3), @$, parseInfo);
}
@@ -3049,31 +3097,36 @@ IntersectOperator: INTERSECT
InstanceOfExpr: TreatExpr /* [54] */
| TreatExpr INSTANCE OF SequenceType
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new InstanceOf($1,
- SequenceType::Ptr($4)), @$, parseInfo);
+ SequenceType::Ptr($4)), @$, parseInfo);
}
TreatExpr: CastableExpr /* [55] */
| CastableExpr TREAT AS SequenceType
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new TreatAs($1, $4), @$, parseInfo);
}
CastableExpr: CastExpr /* [56] */
| CastExpr CASTABLE AS SingleType
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new CastableAs($1, $4), @$, parseInfo);
}
CastExpr: UnaryExpr /* [57] */
| UnaryExpr CAST AS SingleType
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new CastAs($1, $4), @$, parseInfo);
}
UnaryExpr: ValueExpr /* [58] */
| UnaryOperator UnaryExpr
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new UnaryExpression($1, $2, parseInfo->staticContext), @$, parseInfo);
}
@@ -3092,6 +3145,7 @@ ValueExpr: ValidateExpr
GeneralComp: RangeExpr GeneralComparisonOperator RangeExpr /* [60] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new GeneralComparison($1, $2, $3, parseInfo->isBackwardsCompat.top()), @$, parseInfo);
}
@@ -3125,7 +3179,7 @@ NodeOperator: IS {$$ = QXmlNodeModelIndex::Is;}
ValidateExpr: ValidationMode EnclosedExpr /* [63] */
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
parseInfo->staticContext->error(QtXmlPatterns::tr("The Schema Validation Feature is not supported. "
"Hence, %1-expressions may not be used.")
.arg(formatKeyword("validate")),
@@ -3143,6 +3197,7 @@ ValidationMode: VALIDATE {$$ = Validate::Strict;}
ExtensionExpr: Pragmas EnclosedOptionalExpr /* [65] */
{
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
/* We don't support any pragmas, so we only do the
* necessary validation and use the fallback expression. */
@@ -3171,7 +3226,7 @@ Pragmas: Pragmas Pragma
Pragma: PRAGMA_START PragmaName PragmaContents PRAGMA_END /* [66] */
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
}
PragmaContents: /* empty */ /* [67] */
@@ -3241,12 +3296,14 @@ StepExpr: FilteredAxisStep
}
| BASEURI StringLiteral CURLY_LBRACE Expr CURLY_RBRACE /* [X] */
{
+ allowedIn(QXmlQuery::XSLT20, parseInfo, @$);
Q_ASSERT(!$2.isEmpty());
$$ = create(new StaticBaseURIStore($2, $4), @$, parseInfo);
}
| DECLARE NAMESPACE NCNAME G_EQ STRING_LITERAL CURLY_LBRACE /* [X] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, @$);
parseInfo->resolvers.push(parseInfo->staticContext->namespaceBindings());
const NamespaceResolver::Ptr resolver(new DelegatingNamespaceResolver(parseInfo->staticContext->namespaceBindings()));
resolver->addBinding(QXmlName(parseInfo->staticContext->namePool()->allocateNamespace($5),
@@ -3449,6 +3506,36 @@ Axis: AxisToken COLONCOLON
}
else
$$ = $1;
+
+ switch($1)
+ {
+ case QXmlNodeModelIndex::AxisAttribute:
+ {
+ allowedIn(QueryLanguages( QXmlQuery::XPath20
+ | QXmlQuery::XQuery10
+ | QXmlQuery::XmlSchema11IdentityConstraintField
+ | QXmlQuery::XSLT20),
+ parseInfo, @$);
+ break;
+ }
+ case QXmlNodeModelIndex::AxisChild:
+ {
+ allowedIn(QueryLanguages( QXmlQuery::XPath20
+ | QXmlQuery::XQuery10
+ | QXmlQuery::XmlSchema11IdentityConstraintField
+ | QXmlQuery::XmlSchema11IdentityConstraintSelector
+ | QXmlQuery::XSLT20),
+ parseInfo, @$);
+ break;
+ }
+ default:
+ {
+ allowedIn(QueryLanguages( QXmlQuery::XPath20
+ | QXmlQuery::XQuery10
+ | QXmlQuery::XSLT20),
+ parseInfo, @$);
+ }
+ }
}
AxisToken: ANCESTOR_OR_SELF {$$ = QXmlNodeModelIndex::AxisAncestorOrSelf ;}
@@ -3470,6 +3557,7 @@ AbbrevForwardStep: AT_SIGN
}
NodeTest /* [72] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20 | QXmlQuery::XmlSchema11IdentityConstraintField), parseInfo, @$);
$$ = create(new AxisStep(QXmlNodeModelIndex::AxisAttribute, $3), @$, parseInfo);
parseInfo->restoreNodeTestSource();
@@ -3499,6 +3587,9 @@ AbbrevReverseStep: DOTDOT
NodeTest: NameTest /* [78] */
| KindTest
+ {
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
+ }
NameTest: ElementName /* [79] */
{
@@ -3521,6 +3612,7 @@ WildCard: STAR
}
| ANY_PREFIX
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
const QXmlName::LocalNameCode c = parseInfo->staticContext->namePool()->allocateLocalName($1);
$$ = LocalNameTest::create(parseInfo->nodeTestSource, c);
}
@@ -3528,6 +3620,7 @@ WildCard: STAR
FilterExpr: PrimaryExpr /* [81] */
| FilterExpr LBRACKET Expr RBRACKET
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(GenericPredicate::create($1, $3, parseInfo->staticContext, fromYYLTYPE(@4, parseInfo)), @$, parseInfo);
}
@@ -3556,15 +3649,18 @@ Literal: NumericLiteral
NumericLiteral: XPATH2_NUMBER /* [86] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = createNumericLiteral<Double>($1, @$, parseInfo);
}
| NUMBER
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = createNumericLiteral<Numeric>($1, @$, parseInfo);
}
VarRef: DOLLAR VarName /* [87] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = resolveVariable($2, @$, parseInfo, false);
}
@@ -3580,10 +3676,12 @@ VarName: NCNAME
ParenthesizedExpr: LPAREN Expr RPAREN /* [89] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = $2;
}
| LPAREN RPAREN
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
$$ = create(new EmptySequence, @$, parseInfo);
}
@@ -3599,6 +3697,7 @@ OrderingExpr: OrderingMode EnclosedExpr
FunctionCallExpr: FunctionName LPAREN FunctionArguments RPAREN /* [93] */
{
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
if(XPathHelper::isReservedNamespace($1.namespaceURI()) || $1.namespaceURI() == StandardNamespaces::InternalXSLT)
{ /* We got a call to a builtin function. */
const ReflectYYLTYPE ryy(@$, parseInfo);
@@ -3641,9 +3740,12 @@ FunctionArguments: /* empty */
Constructor: DirectConstructor /* [94] */
{
- disallowedConstruct(parseInfo, @$);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$);
}
| ComputedConstructor
+/* The reason we cannot call alloweIn() as the action for ComputedConstructor,
+ * is that we use the computed constructors for XSL-T, and therefore generate
+ * INTERNAL tokens. */
DirectConstructor: DirElemConstructor /* [95] */
| DirCommentConstructor
@@ -4075,7 +4177,7 @@ ComputedConstructor: CompDocConstructor
CompDocConstructor: DOCUMENT IsInternal EnclosedExpr /* [110] */
{
- disallowedConstruct(parseInfo, @$, $2);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2);
$$ = create(new DocumentConstructor($3), @$, parseInfo);
}
@@ -4088,7 +4190,7 @@ CompElemConstructor: ELEMENT IsInternal CompElementName
EnclosedOptionalExpr /* [111] */
{
Q_ASSERT(5);
- disallowedConstruct(parseInfo, @$, $2);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2);
Expression::Ptr effExpr;
@@ -4133,7 +4235,7 @@ CompAttrConstructor: ATTRIBUTE
CompAttributeName
EnclosedOptionalExpr /* [113] */
{
- disallowedConstruct(parseInfo, @$, $2);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2);
const Expression::Ptr name(create(new AttributeNameValidator($3), @$, parseInfo));
@@ -4150,14 +4252,14 @@ CompTextConstructor: TEXT IsInternal EnclosedExpr
CompCommentConstructor: COMMENT IsInternal EnclosedExpr /* [115] */
{
- disallowedConstruct(parseInfo, @$, $2);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2);
$$ = create(new CommentConstructor(createSimpleContent($3, @$, parseInfo)), @$, parseInfo);
}
CompPIConstructor: PROCESSING_INSTRUCTION CompPIName EnclosedOptionalExpr /* [116] */
{
- disallowedConstruct(parseInfo, @$, $2);
+ allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2);
if($3)
{
@@ -4517,7 +4619,13 @@ PragmaName: NCNAME
URILiteral: StringLiteral /* [140] */
StringLiteral: STRING_LITERAL /* [144] */
+ {
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
+ }
| XPATH2_STRING_LITERAL
+ {
+ allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$);
+ }
QName: QNAME /* [154] */
{
diff --git a/src/xmlpatterns/schema/.gitignore b/src/xmlpatterns/schema/.gitignore
new file mode 100644
index 0000000..2b29f27
--- /dev/null
+++ b/src/xmlpatterns/schema/.gitignore
@@ -0,0 +1 @@
+tests
diff --git a/src/xmlpatterns/schema/builtinschemas.qrc b/src/xmlpatterns/schema/builtinschemas.qrc
new file mode 100644
index 0000000..fb43d78
--- /dev/null
+++ b/src/xmlpatterns/schema/builtinschemas.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file alias="http://www.w3.org/XML/1998/namespace">schemas/xml.xsd</file>
+</qresource>
+</RCC>
diff --git a/src/xmlpatterns/schema/doc/All_diagram.dot b/src/xmlpatterns/schema/doc/All_diagram.dot
new file mode 100644
index 0000000..3352b723
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/All_diagram.dot
@@ -0,0 +1,13 @@
+digraph All {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="any"]
+ 1 -> 3 [label="element"]
+ 2 -> 3 [label="any"]
+ 2 -> 3 [label="element"]
+ 3 -> 3 [label="any"]
+ 3 -> 3 [label="element"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Alternative_diagram.dot b/src/xmlpatterns/schema/doc/Alternative_diagram.dot
new file mode 100644
index 0000000..2119c49
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Alternative_diagram.dot
@@ -0,0 +1,11 @@
+digraph Alternative {
+ mindist = 2.0
+ 1 -> 3 [label="complexType"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="simpleType"]
+ 2 -> 3 [label="complexType"]
+ 2 -> 3 [label="simpleType"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Annotation_diagram.dot b/src/xmlpatterns/schema/doc/Annotation_diagram.dot
new file mode 100644
index 0000000..260b6f7
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Annotation_diagram.dot
@@ -0,0 +1,9 @@
+digraph Annotation {
+ mindist = 2.0
+ 1 -> 2 [label="appinfo"]
+ 1 -> 2 [label="documentation"]
+ 2 -> 2 [label="appinfo"]
+ 2 -> 2 [label="documentation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/AnyAttribute_diagram.dot b/src/xmlpatterns/schema/doc/AnyAttribute_diagram.dot
new file mode 100644
index 0000000..d252ebd
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/AnyAttribute_diagram.dot
@@ -0,0 +1,6 @@
+digraph AnyAttribute {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Any_diagram.dot b/src/xmlpatterns/schema/doc/Any_diagram.dot
new file mode 100644
index 0000000..f54063f
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Any_diagram.dot
@@ -0,0 +1,6 @@
+digraph Any {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Assert_diagram.dot b/src/xmlpatterns/schema/doc/Assert_diagram.dot
new file mode 100644
index 0000000..7093bef
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Assert_diagram.dot
@@ -0,0 +1,6 @@
+digraph Assert {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Choice_diagram.dot b/src/xmlpatterns/schema/doc/Choice_diagram.dot
new file mode 100644
index 0000000..7b32016
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Choice_diagram.dot
@@ -0,0 +1,22 @@
+digraph Choice {
+ mindist = 2.0
+ 1 -> 3 [label="choice"]
+ 1 -> 3 [label="group"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="sequence"]
+ 1 -> 3 [label="any"]
+ 1 -> 3 [label="element"]
+ 2 -> 3 [label="choice"]
+ 2 -> 3 [label="group"]
+ 2 -> 3 [label="sequence"]
+ 2 -> 3 [label="any"]
+ 2 -> 3 [label="element"]
+ 3 -> 3 [label="choice"]
+ 3 -> 3 [label="group"]
+ 3 -> 3 [label="sequence"]
+ 3 -> 3 [label="any"]
+ 3 -> 3 [label="element"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/ComplexContentExtension_diagram.dot b/src/xmlpatterns/schema/doc/ComplexContentExtension_diagram.dot
new file mode 100644
index 0000000..6131612
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/ComplexContentExtension_diagram.dot
@@ -0,0 +1,47 @@
+digraph ComplexContentExtension {
+ mindist = 2.0
+ 1 -> 4 [label="choice"]
+ 1 -> 4 [label="group"]
+ 1 -> 4 [label="all"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 4 [label="sequence"]
+ 1 -> 6 [label="anyAttribute"]
+ 1 -> 7 [label="assert"]
+ 1 -> 3 [label="openContent"]
+ 1 -> 5 [label="attribute"]
+ 1 -> 5 [label="attributeGroup"]
+ 2 -> 4 [label="choice"]
+ 2 -> 4 [label="group"]
+ 2 -> 4 [label="all"]
+ 2 -> 4 [label="sequence"]
+ 2 -> 6 [label="anyAttribute"]
+ 2 -> 7 [label="assert"]
+ 2 -> 3 [label="openContent"]
+ 2 -> 5 [label="attribute"]
+ 2 -> 5 [label="attributeGroup"]
+ 3 -> 4 [label="choice"]
+ 3 -> 4 [label="group"]
+ 3 -> 4 [label="all"]
+ 3 -> 4 [label="sequence"]
+ 3 -> 6 [label="anyAttribute"]
+ 3 -> 7 [label="assert"]
+ 3 -> 5 [label="attribute"]
+ 3 -> 5 [label="attributeGroup"]
+ 4 -> 6 [label="anyAttribute"]
+ 4 -> 7 [label="assert"]
+ 4 -> 5 [label="attribute"]
+ 4 -> 5 [label="attributeGroup"]
+ 5 -> 6 [label="anyAttribute"]
+ 5 -> 7 [label="assert"]
+ 5 -> 5 [label="attribute"]
+ 5 -> 5 [label="attributeGroup"]
+ 6 -> 7 [label="assert"]
+ 7 -> 7 [label="assert"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+ 5 [shape=doublecircle, style=filled, color=green]
+ 6 [shape=doublecircle, style=filled, color=green]
+ 7 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/ComplexContentRestriction_diagram.dot b/src/xmlpatterns/schema/doc/ComplexContentRestriction_diagram.dot
new file mode 100644
index 0000000..bfda892
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/ComplexContentRestriction_diagram.dot
@@ -0,0 +1,47 @@
+digraph ComplexContentRestriction {
+ mindist = 2.0
+ 1 -> 4 [label="choice"]
+ 1 -> 4 [label="group"]
+ 1 -> 4 [label="all"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 4 [label="sequence"]
+ 1 -> 6 [label="anyAttribute"]
+ 1 -> 7 [label="assert"]
+ 1 -> 3 [label="openContent"]
+ 1 -> 5 [label="attribute"]
+ 1 -> 5 [label="attributeGroup"]
+ 2 -> 4 [label="choice"]
+ 2 -> 4 [label="group"]
+ 2 -> 4 [label="all"]
+ 2 -> 4 [label="sequence"]
+ 2 -> 6 [label="anyAttribute"]
+ 2 -> 7 [label="assert"]
+ 2 -> 3 [label="openContent"]
+ 2 -> 5 [label="attribute"]
+ 2 -> 5 [label="attributeGroup"]
+ 3 -> 4 [label="choice"]
+ 3 -> 4 [label="group"]
+ 3 -> 4 [label="all"]
+ 3 -> 4 [label="sequence"]
+ 3 -> 6 [label="anyAttribute"]
+ 3 -> 7 [label="assert"]
+ 3 -> 5 [label="attribute"]
+ 3 -> 5 [label="attributeGroup"]
+ 4 -> 6 [label="anyAttribute"]
+ 4 -> 7 [label="assert"]
+ 4 -> 5 [label="attribute"]
+ 4 -> 5 [label="attributeGroup"]
+ 5 -> 6 [label="anyAttribute"]
+ 5 -> 7 [label="assert"]
+ 5 -> 5 [label="attribute"]
+ 5 -> 5 [label="attributeGroup"]
+ 6 -> 7 [label="assert"]
+ 7 -> 7 [label="assert"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+ 5 [shape=doublecircle, style=filled, color=green]
+ 6 [shape=doublecircle, style=filled, color=green]
+ 7 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/ComplexContent_diagram.dot b/src/xmlpatterns/schema/doc/ComplexContent_diagram.dot
new file mode 100644
index 0000000..949c27e
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/ComplexContent_diagram.dot
@@ -0,0 +1,11 @@
+digraph ComplexContent {
+ mindist = 2.0
+ 1 -> 3 [label="restriction"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="extension"]
+ 2 -> 3 [label="restriction"]
+ 2 -> 3 [label="extension"]
+ 1 [shape=circle, style=filled, color=blue]
+ 2 [shape=circle, style=filled, color=red]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/DefaultOpenContent_diagram.dot b/src/xmlpatterns/schema/doc/DefaultOpenContent_diagram.dot
new file mode 100644
index 0000000..61e7d14
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/DefaultOpenContent_diagram.dot
@@ -0,0 +1,9 @@
+digraph DefaultOpenContent {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="any"]
+ 2 -> 3 [label="any"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=circle, style=filled, color=red]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/EnumerationFacet_diagram.dot b/src/xmlpatterns/schema/doc/EnumerationFacet_diagram.dot
new file mode 100644
index 0000000..91be76b
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/EnumerationFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph EnumerationFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Field_diagram.dot b/src/xmlpatterns/schema/doc/Field_diagram.dot
new file mode 100644
index 0000000..1c597b3
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Field_diagram.dot
@@ -0,0 +1,6 @@
+digraph Field {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/FractionDigitsFacet_diagram.dot b/src/xmlpatterns/schema/doc/FractionDigitsFacet_diagram.dot
new file mode 100644
index 0000000..5e098b3
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/FractionDigitsFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph FractionDigitsFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/GlobalAttribute_diagram.dot b/src/xmlpatterns/schema/doc/GlobalAttribute_diagram.dot
new file mode 100644
index 0000000..25a1a43
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/GlobalAttribute_diagram.dot
@@ -0,0 +1,9 @@
+digraph GlobalAttribute {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="simpleType"]
+ 2 -> 3 [label="simpleType"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/GlobalComplexType_diagram.dot b/src/xmlpatterns/schema/doc/GlobalComplexType_diagram.dot
new file mode 100644
index 0000000..05e40b7
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/GlobalComplexType_diagram.dot
@@ -0,0 +1,52 @@
+digraph GlobalComplexType {
+ mindist = 2.0
+ 1 -> 5 [label="choice"]
+ 1 -> 3 [label="complexContent"]
+ 1 -> 5 [label="group"]
+ 1 -> 5 [label="all"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 5 [label="sequence"]
+ 1 -> 3 [label="simpleContent"]
+ 1 -> 7 [label="anyAttribute"]
+ 1 -> 8 [label="assert"]
+ 1 -> 4 [label="openContent"]
+ 1 -> 6 [label="attribute"]
+ 1 -> 6 [label="attributeGroup"]
+ 2 -> 5 [label="choice"]
+ 2 -> 3 [label="complexContent"]
+ 2 -> 5 [label="group"]
+ 2 -> 5 [label="all"]
+ 2 -> 5 [label="sequence"]
+ 2 -> 3 [label="simpleContent"]
+ 2 -> 7 [label="anyAttribute"]
+ 2 -> 8 [label="assert"]
+ 2 -> 4 [label="openContent"]
+ 2 -> 6 [label="attribute"]
+ 2 -> 6 [label="attributeGroup"]
+ 4 -> 5 [label="choice"]
+ 4 -> 5 [label="group"]
+ 4 -> 5 [label="all"]
+ 4 -> 5 [label="sequence"]
+ 4 -> 7 [label="anyAttribute"]
+ 4 -> 8 [label="assert"]
+ 4 -> 6 [label="attribute"]
+ 4 -> 6 [label="attributeGroup"]
+ 5 -> 7 [label="anyAttribute"]
+ 5 -> 8 [label="assert"]
+ 5 -> 6 [label="attribute"]
+ 5 -> 6 [label="attributeGroup"]
+ 6 -> 7 [label="anyAttribute"]
+ 6 -> 8 [label="assert"]
+ 6 -> 6 [label="attribute"]
+ 6 -> 6 [label="attributeGroup"]
+ 7 -> 8 [label="assert"]
+ 8 -> 8 [label="assert"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+ 5 [shape=doublecircle, style=filled, color=green]
+ 6 [shape=doublecircle, style=filled, color=green]
+ 7 [shape=doublecircle, style=filled, color=green]
+ 8 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/GlobalElement_diagram.dot b/src/xmlpatterns/schema/doc/GlobalElement_diagram.dot
new file mode 100644
index 0000000..20447a7
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/GlobalElement_diagram.dot
@@ -0,0 +1,32 @@
+digraph GlobalElement {
+ mindist = 2.0
+ 1 -> 3 [label="complexType"]
+ 1 -> 4 [label="alternative"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 5 [label="key"]
+ 1 -> 3 [label="simpleType"]
+ 1 -> 5 [label="keyref"]
+ 1 -> 5 [label="unique"]
+ 2 -> 3 [label="complexType"]
+ 2 -> 4 [label="alternative"]
+ 2 -> 5 [label="key"]
+ 2 -> 3 [label="simpleType"]
+ 2 -> 5 [label="keyref"]
+ 2 -> 5 [label="unique"]
+ 3 -> 4 [label="alternative"]
+ 3 -> 5 [label="key"]
+ 3 -> 5 [label="keyref"]
+ 3 -> 5 [label="unique"]
+ 4 -> 4 [label="alternative"]
+ 4 -> 5 [label="key"]
+ 4 -> 5 [label="keyref"]
+ 4 -> 5 [label="unique"]
+ 5 -> 5 [label="key"]
+ 5 -> 5 [label="keyref"]
+ 5 -> 5 [label="unique"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+ 5 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/GlobalSimpleType_diagram.dot b/src/xmlpatterns/schema/doc/GlobalSimpleType_diagram.dot
new file mode 100644
index 0000000..ccb7f54
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/GlobalSimpleType_diagram.dot
@@ -0,0 +1,13 @@
+digraph GlobalSimpleType {
+ mindist = 2.0
+ 1 -> 3 [label="restriction"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="list"]
+ 1 -> 3 [label="union"]
+ 2 -> 3 [label="restriction"]
+ 2 -> 3 [label="list"]
+ 2 -> 3 [label="union"]
+ 1 [shape=circle, style=filled, color=blue]
+ 2 [shape=circle, style=filled, color=red]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Import_diagram.dot b/src/xmlpatterns/schema/doc/Import_diagram.dot
new file mode 100644
index 0000000..3484bc3
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Import_diagram.dot
@@ -0,0 +1,6 @@
+digraph Import {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Include_diagram.dot b/src/xmlpatterns/schema/doc/Include_diagram.dot
new file mode 100644
index 0000000..357e4c9
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Include_diagram.dot
@@ -0,0 +1,6 @@
+digraph Include {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/KeyRef_diagram.dot b/src/xmlpatterns/schema/doc/KeyRef_diagram.dot
new file mode 100644
index 0000000..ff425b9
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/KeyRef_diagram.dot
@@ -0,0 +1,12 @@
+digraph KeyRef {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="selector"]
+ 2 -> 3 [label="selector"]
+ 3 -> 4 [label="field"]
+ 4 -> 4 [label="field"]
+ 1 [shape=circle, style=filled, color=blue]
+ 2 [shape=circle, style=filled, color=red]
+ 3 [shape=circle, style=filled, color=red]
+ 4 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Key_diagram.dot b/src/xmlpatterns/schema/doc/Key_diagram.dot
new file mode 100644
index 0000000..bbc09cd
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Key_diagram.dot
@@ -0,0 +1,12 @@
+digraph Key {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="selector"]
+ 2 -> 3 [label="selector"]
+ 3 -> 4 [label="field"]
+ 4 -> 4 [label="field"]
+ 1 [shape=circle, style=filled, color=blue]
+ 2 [shape=circle, style=filled, color=red]
+ 3 [shape=circle, style=filled, color=red]
+ 4 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/LengthFacet_diagram.dot b/src/xmlpatterns/schema/doc/LengthFacet_diagram.dot
new file mode 100644
index 0000000..1f9205b
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/LengthFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph LengthFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/List_diagram.dot b/src/xmlpatterns/schema/doc/List_diagram.dot
new file mode 100644
index 0000000..44cc698
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/List_diagram.dot
@@ -0,0 +1,9 @@
+digraph List {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="simpleType"]
+ 2 -> 3 [label="simpleType"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/LocalAll_diagram.dot b/src/xmlpatterns/schema/doc/LocalAll_diagram.dot
new file mode 100644
index 0000000..88f1b61
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/LocalAll_diagram.dot
@@ -0,0 +1,13 @@
+digraph LocalAll {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="any"]
+ 1 -> 3 [label="element"]
+ 2 -> 3 [label="any"]
+ 2 -> 3 [label="element"]
+ 3 -> 3 [label="any"]
+ 3 -> 3 [label="element"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/LocalAttribute_diagram.dot b/src/xmlpatterns/schema/doc/LocalAttribute_diagram.dot
new file mode 100644
index 0000000..b01f0cf
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/LocalAttribute_diagram.dot
@@ -0,0 +1,9 @@
+digraph LocalAttribute {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="simpleType"]
+ 2 -> 3 [label="simpleType"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/LocalChoice_diagram.dot b/src/xmlpatterns/schema/doc/LocalChoice_diagram.dot
new file mode 100644
index 0000000..b16c47f
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/LocalChoice_diagram.dot
@@ -0,0 +1,22 @@
+digraph LocalChoice {
+ mindist = 2.0
+ 1 -> 3 [label="choice"]
+ 1 -> 3 [label="group"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="sequence"]
+ 1 -> 3 [label="any"]
+ 1 -> 3 [label="element"]
+ 2 -> 3 [label="choice"]
+ 2 -> 3 [label="group"]
+ 2 -> 3 [label="sequence"]
+ 2 -> 3 [label="any"]
+ 2 -> 3 [label="element"]
+ 3 -> 3 [label="choice"]
+ 3 -> 3 [label="group"]
+ 3 -> 3 [label="sequence"]
+ 3 -> 3 [label="any"]
+ 3 -> 3 [label="element"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/LocalComplexType_diagram.dot b/src/xmlpatterns/schema/doc/LocalComplexType_diagram.dot
new file mode 100644
index 0000000..92c54b7
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/LocalComplexType_diagram.dot
@@ -0,0 +1,52 @@
+digraph LocalComplexType {
+ mindist = 2.0
+ 1 -> 5 [label="choice"]
+ 1 -> 3 [label="complexContent"]
+ 1 -> 5 [label="group"]
+ 1 -> 5 [label="all"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 5 [label="sequence"]
+ 1 -> 3 [label="simpleContent"]
+ 1 -> 7 [label="anyAttribute"]
+ 1 -> 8 [label="assert"]
+ 1 -> 4 [label="openContent"]
+ 1 -> 6 [label="attribute"]
+ 1 -> 6 [label="attributeGroup"]
+ 2 -> 5 [label="choice"]
+ 2 -> 3 [label="complexContent"]
+ 2 -> 5 [label="group"]
+ 2 -> 5 [label="all"]
+ 2 -> 5 [label="sequence"]
+ 2 -> 3 [label="simpleContent"]
+ 2 -> 7 [label="anyAttribute"]
+ 2 -> 8 [label="assert"]
+ 2 -> 4 [label="openContent"]
+ 2 -> 6 [label="attribute"]
+ 2 -> 6 [label="attributeGroup"]
+ 4 -> 5 [label="choice"]
+ 4 -> 5 [label="group"]
+ 4 -> 5 [label="all"]
+ 4 -> 5 [label="sequence"]
+ 4 -> 7 [label="anyAttribute"]
+ 4 -> 8 [label="assert"]
+ 4 -> 6 [label="attribute"]
+ 4 -> 6 [label="attributeGroup"]
+ 5 -> 7 [label="anyAttribute"]
+ 5 -> 8 [label="assert"]
+ 5 -> 6 [label="attribute"]
+ 5 -> 6 [label="attributeGroup"]
+ 6 -> 7 [label="anyAttribute"]
+ 6 -> 8 [label="assert"]
+ 6 -> 6 [label="attribute"]
+ 6 -> 6 [label="attributeGroup"]
+ 7 -> 8 [label="assert"]
+ 8 -> 8 [label="assert"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+ 5 [shape=doublecircle, style=filled, color=green]
+ 6 [shape=doublecircle, style=filled, color=green]
+ 7 [shape=doublecircle, style=filled, color=green]
+ 8 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/LocalElement_diagram.dot b/src/xmlpatterns/schema/doc/LocalElement_diagram.dot
new file mode 100644
index 0000000..397397a
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/LocalElement_diagram.dot
@@ -0,0 +1,32 @@
+digraph LocalElement {
+ mindist = 2.0
+ 1 -> 3 [label="complexType"]
+ 1 -> 4 [label="alternative"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 5 [label="key"]
+ 1 -> 3 [label="simpleType"]
+ 1 -> 5 [label="keyref"]
+ 1 -> 5 [label="unique"]
+ 2 -> 3 [label="complexType"]
+ 2 -> 4 [label="alternative"]
+ 2 -> 5 [label="key"]
+ 2 -> 3 [label="simpleType"]
+ 2 -> 5 [label="keyref"]
+ 2 -> 5 [label="unique"]
+ 3 -> 4 [label="alternative"]
+ 3 -> 5 [label="key"]
+ 3 -> 5 [label="keyref"]
+ 3 -> 5 [label="unique"]
+ 4 -> 4 [label="alternative"]
+ 4 -> 5 [label="key"]
+ 4 -> 5 [label="keyref"]
+ 4 -> 5 [label="unique"]
+ 5 -> 5 [label="key"]
+ 5 -> 5 [label="keyref"]
+ 5 -> 5 [label="unique"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+ 5 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/LocalSequence_diagram.dot b/src/xmlpatterns/schema/doc/LocalSequence_diagram.dot
new file mode 100644
index 0000000..0dc7f39
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/LocalSequence_diagram.dot
@@ -0,0 +1,22 @@
+digraph LocalSequence {
+ mindist = 2.0
+ 1 -> 3 [label="choice"]
+ 1 -> 3 [label="group"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="sequence"]
+ 1 -> 3 [label="any"]
+ 1 -> 3 [label="element"]
+ 2 -> 3 [label="choice"]
+ 2 -> 3 [label="group"]
+ 2 -> 3 [label="sequence"]
+ 2 -> 3 [label="any"]
+ 2 -> 3 [label="element"]
+ 3 -> 3 [label="choice"]
+ 3 -> 3 [label="group"]
+ 3 -> 3 [label="sequence"]
+ 3 -> 3 [label="any"]
+ 3 -> 3 [label="element"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/LocalSimpleType_diagram.dot b/src/xmlpatterns/schema/doc/LocalSimpleType_diagram.dot
new file mode 100644
index 0000000..ac13305
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/LocalSimpleType_diagram.dot
@@ -0,0 +1,13 @@
+digraph LocalSimpleType {
+ mindist = 2.0
+ 1 -> 3 [label="restriction"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="list"]
+ 1 -> 3 [label="union"]
+ 2 -> 3 [label="restriction"]
+ 2 -> 3 [label="list"]
+ 2 -> 3 [label="union"]
+ 1 [shape=circle, style=filled, color=blue]
+ 2 [shape=circle, style=filled, color=red]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/MaxExclusiveFacet_diagram.dot b/src/xmlpatterns/schema/doc/MaxExclusiveFacet_diagram.dot
new file mode 100644
index 0000000..28364f7
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/MaxExclusiveFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph MaxExclusiveFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/MaxInclusiveFacet_diagram.dot b/src/xmlpatterns/schema/doc/MaxInclusiveFacet_diagram.dot
new file mode 100644
index 0000000..9e2c265
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/MaxInclusiveFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph MaxInclusiveFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/MaxLengthFacet_diagram.dot b/src/xmlpatterns/schema/doc/MaxLengthFacet_diagram.dot
new file mode 100644
index 0000000..d565217
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/MaxLengthFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph MaxLengthFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/MinExclusiveFacet_diagram.dot b/src/xmlpatterns/schema/doc/MinExclusiveFacet_diagram.dot
new file mode 100644
index 0000000..d3b3f1f
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/MinExclusiveFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph MinExclusiveFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/MinInclusiveFacet_diagram.dot b/src/xmlpatterns/schema/doc/MinInclusiveFacet_diagram.dot
new file mode 100644
index 0000000..e5ca65d
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/MinInclusiveFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph MinInclusiveFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/MinLengthFacet_diagram.dot b/src/xmlpatterns/schema/doc/MinLengthFacet_diagram.dot
new file mode 100644
index 0000000..1dcced4
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/MinLengthFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph MinLengthFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/NamedAttributeGroup_diagram.dot b/src/xmlpatterns/schema/doc/NamedAttributeGroup_diagram.dot
new file mode 100644
index 0000000..1754f67
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/NamedAttributeGroup_diagram.dot
@@ -0,0 +1,17 @@
+digraph NamedAttributeGroup {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 4 [label="anyAttribute"]
+ 1 -> 3 [label="attribute"]
+ 1 -> 3 [label="attributeGroup"]
+ 2 -> 4 [label="anyAttribute"]
+ 2 -> 3 [label="attribute"]
+ 2 -> 3 [label="attributeGroup"]
+ 3 -> 4 [label="anyAttribute"]
+ 3 -> 3 [label="attribute"]
+ 3 -> 3 [label="attributeGroup"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/NamedGroup_diagram.dot b/src/xmlpatterns/schema/doc/NamedGroup_diagram.dot
new file mode 100644
index 0000000..6d9a289
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/NamedGroup_diagram.dot
@@ -0,0 +1,13 @@
+digraph NamedGroup {
+ mindist = 2.0
+ 1 -> 3 [label="choice"]
+ 1 -> 3 [label="all"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="sequence"]
+ 2 -> 3 [label="choice"]
+ 2 -> 3 [label="all"]
+ 2 -> 3 [label="sequence"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Notation_diagram.dot b/src/xmlpatterns/schema/doc/Notation_diagram.dot
new file mode 100644
index 0000000..951f26a
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Notation_diagram.dot
@@ -0,0 +1,6 @@
+digraph Notation {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Override_diagram.dot b/src/xmlpatterns/schema/doc/Override_diagram.dot
new file mode 100644
index 0000000..448451a
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Override_diagram.dot
@@ -0,0 +1,21 @@
+digraph Override {
+ mindist = 2.0
+ 1 -> 2 [label="group"]
+ 1 -> 2 [label="complexType"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 2 [label="simpleType"]
+ 1 -> 2 [label="element"]
+ 1 -> 2 [label="notation"]
+ 1 -> 2 [label="attribute"]
+ 1 -> 2 [label="attributeGroup"]
+ 2 -> 2 [label="group"]
+ 2 -> 2 [label="complexType"]
+ 2 -> 2 [label="annotation"]
+ 2 -> 2 [label="simpleType"]
+ 2 -> 2 [label="element"]
+ 2 -> 2 [label="notation"]
+ 2 -> 2 [label="attribute"]
+ 2 -> 2 [label="attributeGroup"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/PatternFacet_diagram.dot b/src/xmlpatterns/schema/doc/PatternFacet_diagram.dot
new file mode 100644
index 0000000..794d74c
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/PatternFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph PatternFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Redefine_diagram.dot b/src/xmlpatterns/schema/doc/Redefine_diagram.dot
new file mode 100644
index 0000000..ba4871d
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Redefine_diagram.dot
@@ -0,0 +1,15 @@
+digraph Redefine {
+ mindist = 2.0
+ 1 -> 2 [label="group"]
+ 1 -> 2 [label="complexType"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 2 [label="simpleType"]
+ 1 -> 2 [label="attributeGroup"]
+ 2 -> 2 [label="group"]
+ 2 -> 2 [label="complexType"]
+ 2 -> 2 [label="annotation"]
+ 2 -> 2 [label="simpleType"]
+ 2 -> 2 [label="attributeGroup"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/ReferredAttributeGroup_diagram.dot b/src/xmlpatterns/schema/doc/ReferredAttributeGroup_diagram.dot
new file mode 100644
index 0000000..fd08872
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/ReferredAttributeGroup_diagram.dot
@@ -0,0 +1,6 @@
+digraph ReferredAttributeGroup {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/ReferredGroup_diagram.dot b/src/xmlpatterns/schema/doc/ReferredGroup_diagram.dot
new file mode 100644
index 0000000..c32f69f
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/ReferredGroup_diagram.dot
@@ -0,0 +1,13 @@
+digraph ReferredGroup {
+ mindist = 2.0
+ 1 -> 3 [label="choice"]
+ 1 -> 3 [label="all"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="sequence"]
+ 2 -> 3 [label="choice"]
+ 2 -> 3 [label="all"]
+ 2 -> 3 [label="sequence"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Schema_diagram.dot b/src/xmlpatterns/schema/doc/Schema_diagram.dot
new file mode 100644
index 0000000..7d39337
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Schema_diagram.dot
@@ -0,0 +1,66 @@
+digraph Schema {
+ mindist = 2.0
+ 1 -> 5 [label="group"]
+ 1 -> 5 [label="complexType"]
+ 1 -> 2 [label="import"]
+ 1 -> 2 [label="include"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="defaultOpenContent"]
+ 1 -> 5 [label="simpleType"]
+ 1 -> 5 [label="element"]
+ 1 -> 5 [label="notation"]
+ 1 -> 2 [label="override"]
+ 1 -> 5 [label="attribute"]
+ 1 -> 5 [label="attributeGroup"]
+ 1 -> 2 [label="redefine"]
+ 2 -> 5 [label="group"]
+ 2 -> 5 [label="complexType"]
+ 2 -> 2 [label="import"]
+ 2 -> 2 [label="include"]
+ 2 -> 2 [label="annotation"]
+ 2 -> 3 [label="defaultOpenContent"]
+ 2 -> 5 [label="simpleType"]
+ 2 -> 5 [label="element"]
+ 2 -> 5 [label="notation"]
+ 2 -> 2 [label="override"]
+ 2 -> 5 [label="attribute"]
+ 2 -> 5 [label="attributeGroup"]
+ 2 -> 2 [label="redefine"]
+ 3 -> 5 [label="group"]
+ 3 -> 5 [label="complexType"]
+ 3 -> 4 [label="annotation"]
+ 3 -> 5 [label="simpleType"]
+ 3 -> 5 [label="element"]
+ 3 -> 5 [label="notation"]
+ 3 -> 5 [label="attribute"]
+ 3 -> 5 [label="attributeGroup"]
+ 4 -> 5 [label="group"]
+ 4 -> 5 [label="complexType"]
+ 4 -> 5 [label="simpleType"]
+ 4 -> 5 [label="element"]
+ 4 -> 5 [label="notation"]
+ 4 -> 5 [label="attribute"]
+ 4 -> 5 [label="attributeGroup"]
+ 5 -> 5 [label="group"]
+ 5 -> 5 [label="complexType"]
+ 5 -> 6 [label="annotation"]
+ 5 -> 5 [label="simpleType"]
+ 5 -> 5 [label="element"]
+ 5 -> 5 [label="notation"]
+ 5 -> 5 [label="attribute"]
+ 5 -> 5 [label="attributeGroup"]
+ 6 -> 5 [label="group"]
+ 6 -> 5 [label="complexType"]
+ 6 -> 6 [label="annotation"]
+ 6 -> 5 [label="simpleType"]
+ 6 -> 5 [label="element"]
+ 6 -> 5 [label="notation"]
+ 6 -> 5 [label="attribute"]
+ 6 -> 5 [label="attributeGroup"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+ 5 [shape=doublecircle, style=filled, color=green]
+ 6 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Selector_diagram.dot b/src/xmlpatterns/schema/doc/Selector_diagram.dot
new file mode 100644
index 0000000..f3e93dc
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Selector_diagram.dot
@@ -0,0 +1,6 @@
+digraph Selector {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Sequence_diagram.dot b/src/xmlpatterns/schema/doc/Sequence_diagram.dot
new file mode 100644
index 0000000..9172744
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Sequence_diagram.dot
@@ -0,0 +1,22 @@
+digraph Sequence {
+ mindist = 2.0
+ 1 -> 3 [label="choice"]
+ 1 -> 3 [label="group"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="sequence"]
+ 1 -> 3 [label="any"]
+ 1 -> 3 [label="element"]
+ 2 -> 3 [label="choice"]
+ 2 -> 3 [label="group"]
+ 2 -> 3 [label="sequence"]
+ 2 -> 3 [label="any"]
+ 2 -> 3 [label="element"]
+ 3 -> 3 [label="choice"]
+ 3 -> 3 [label="group"]
+ 3 -> 3 [label="sequence"]
+ 3 -> 3 [label="any"]
+ 3 -> 3 [label="element"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/SimpleContentExtension_diagram.dot b/src/xmlpatterns/schema/doc/SimpleContentExtension_diagram.dot
new file mode 100644
index 0000000..3ceebfd
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/SimpleContentExtension_diagram.dot
@@ -0,0 +1,23 @@
+digraph SimpleContentExtension {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 4 [label="anyAttribute"]
+ 1 -> 5 [label="assert"]
+ 1 -> 3 [label="attribute"]
+ 1 -> 3 [label="attributeGroup"]
+ 2 -> 4 [label="anyAttribute"]
+ 2 -> 5 [label="assert"]
+ 2 -> 3 [label="attribute"]
+ 2 -> 3 [label="attributeGroup"]
+ 3 -> 4 [label="anyAttribute"]
+ 3 -> 5 [label="assert"]
+ 3 -> 3 [label="attribute"]
+ 3 -> 3 [label="attributeGroup"]
+ 4 -> 5 [label="assert"]
+ 5 -> 5 [label="assert"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+ 5 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/SimpleContentRestriction_diagram.dot b/src/xmlpatterns/schema/doc/SimpleContentRestriction_diagram.dot
new file mode 100644
index 0000000..75b0b71
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/SimpleContentRestriction_diagram.dot
@@ -0,0 +1,87 @@
+digraph SimpleContentRestriction {
+ mindist = 2.0
+ 1 -> 3 [label="simpleType"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 4 [label="length"]
+ 1 -> 6 [label="anyAttribute"]
+ 1 -> 4 [label="maxExclusive"]
+ 1 -> 4 [label="totalDigits"]
+ 1 -> 4 [label="maxInclusive"]
+ 1 -> 4 [label="maxLength"]
+ 1 -> 7 [label="assert"]
+ 1 -> 4 [label="assertion"]
+ 1 -> 5 [label="attribute"]
+ 1 -> 4 [label="minExclusive"]
+ 1 -> 5 [label="attributeGroup"]
+ 1 -> 4 [label="minInclusive"]
+ 1 -> 4 [label="minLength"]
+ 1 -> 4 [label="whiteSpace"]
+ 1 -> 4 [label="pattern"]
+ 1 -> 4 [label="enumeration"]
+ 1 -> 4 [label="fractionDigits"]
+ 2 -> 3 [label="simpleType"]
+ 2 -> 4 [label="length"]
+ 2 -> 6 [label="anyAttribute"]
+ 2 -> 4 [label="maxExclusive"]
+ 2 -> 4 [label="totalDigits"]
+ 2 -> 4 [label="maxInclusive"]
+ 2 -> 4 [label="maxLength"]
+ 2 -> 7 [label="assert"]
+ 2 -> 4 [label="assertion"]
+ 2 -> 5 [label="attribute"]
+ 2 -> 4 [label="minExclusive"]
+ 2 -> 5 [label="attributeGroup"]
+ 2 -> 4 [label="minInclusive"]
+ 2 -> 4 [label="minLength"]
+ 2 -> 4 [label="whiteSpace"]
+ 2 -> 4 [label="pattern"]
+ 2 -> 4 [label="enumeration"]
+ 2 -> 4 [label="fractionDigits"]
+ 3 -> 4 [label="fractionDigits"]
+ 3 -> 4 [label="minLength"]
+ 3 -> 4 [label="whiteSpace"]
+ 3 -> 6 [label="anyAttribute"]
+ 3 -> 4 [label="length"]
+ 3 -> 7 [label="assert"]
+ 3 -> 4 [label="maxExclusive"]
+ 3 -> 4 [label="enumeration"]
+ 3 -> 4 [label="assertion"]
+ 3 -> 4 [label="maxInclusive"]
+ 3 -> 5 [label="attribute"]
+ 3 -> 4 [label="maxLength"]
+ 3 -> 4 [label="pattern"]
+ 3 -> 4 [label="totalDigits"]
+ 3 -> 5 [label="attributeGroup"]
+ 3 -> 4 [label="minExclusive"]
+ 3 -> 4 [label="minInclusive"]
+ 4 -> 4 [label="fractionDigits"]
+ 4 -> 4 [label="minLength"]
+ 4 -> 4 [label="whiteSpace"]
+ 4 -> 6 [label="anyAttribute"]
+ 4 -> 4 [label="length"]
+ 4 -> 7 [label="assert"]
+ 4 -> 4 [label="maxExclusive"]
+ 4 -> 4 [label="enumeration"]
+ 4 -> 4 [label="assertion"]
+ 4 -> 4 [label="maxInclusive"]
+ 4 -> 5 [label="attribute"]
+ 4 -> 4 [label="maxLength"]
+ 4 -> 4 [label="pattern"]
+ 4 -> 4 [label="totalDigits"]
+ 4 -> 5 [label="attributeGroup"]
+ 4 -> 4 [label="minExclusive"]
+ 4 -> 4 [label="minInclusive"]
+ 5 -> 6 [label="anyAttribute"]
+ 5 -> 7 [label="assert"]
+ 5 -> 5 [label="attribute"]
+ 5 -> 5 [label="attributeGroup"]
+ 6 -> 7 [label="assert"]
+ 7 -> 7 [label="assert"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+ 5 [shape=doublecircle, style=filled, color=green]
+ 6 [shape=doublecircle, style=filled, color=green]
+ 7 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/SimpleContent_diagram.dot b/src/xmlpatterns/schema/doc/SimpleContent_diagram.dot
new file mode 100644
index 0000000..c996329
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/SimpleContent_diagram.dot
@@ -0,0 +1,11 @@
+digraph SimpleContent {
+ mindist = 2.0
+ 1 -> 3 [label="restriction"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="extension"]
+ 2 -> 3 [label="restriction"]
+ 2 -> 3 [label="extension"]
+ 1 [shape=circle, style=filled, color=blue]
+ 2 [shape=circle, style=filled, color=red]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/SimpleRestriction_diagram.dot b/src/xmlpatterns/schema/doc/SimpleRestriction_diagram.dot
new file mode 100644
index 0000000..09cb041
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/SimpleRestriction_diagram.dot
@@ -0,0 +1,62 @@
+digraph SimpleRestriction {
+ mindist = 2.0
+ 1 -> 4 [label="fractionDigits"]
+ 1 -> 4 [label="minLength"]
+ 1 -> 4 [label="whiteSpace"]
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="simpleType"]
+ 1 -> 4 [label="length"]
+ 1 -> 4 [label="maxExclusive"]
+ 1 -> 4 [label="enumeration"]
+ 1 -> 4 [label="assertion"]
+ 1 -> 4 [label="maxInclusive"]
+ 1 -> 4 [label="maxLength"]
+ 1 -> 4 [label="pattern"]
+ 1 -> 4 [label="totalDigits"]
+ 1 -> 4 [label="minExclusive"]
+ 1 -> 4 [label="minInclusive"]
+ 2 -> 4 [label="fractionDigits"]
+ 2 -> 4 [label="minLength"]
+ 2 -> 4 [label="whiteSpace"]
+ 2 -> 3 [label="simpleType"]
+ 2 -> 4 [label="length"]
+ 2 -> 4 [label="maxExclusive"]
+ 2 -> 4 [label="enumeration"]
+ 2 -> 4 [label="assertion"]
+ 2 -> 4 [label="maxInclusive"]
+ 2 -> 4 [label="maxLength"]
+ 2 -> 4 [label="pattern"]
+ 2 -> 4 [label="totalDigits"]
+ 2 -> 4 [label="minExclusive"]
+ 2 -> 4 [label="minInclusive"]
+ 3 -> 4 [label="fractionDigits"]
+ 3 -> 4 [label="minLength"]
+ 3 -> 4 [label="whiteSpace"]
+ 3 -> 4 [label="length"]
+ 3 -> 4 [label="maxExclusive"]
+ 3 -> 4 [label="enumeration"]
+ 3 -> 4 [label="assertion"]
+ 3 -> 4 [label="maxInclusive"]
+ 3 -> 4 [label="maxLength"]
+ 3 -> 4 [label="pattern"]
+ 3 -> 4 [label="totalDigits"]
+ 3 -> 4 [label="minExclusive"]
+ 3 -> 4 [label="minInclusive"]
+ 4 -> 4 [label="fractionDigits"]
+ 4 -> 4 [label="minLength"]
+ 4 -> 4 [label="whiteSpace"]
+ 4 -> 4 [label="length"]
+ 4 -> 4 [label="maxExclusive"]
+ 4 -> 4 [label="enumeration"]
+ 4 -> 4 [label="assertion"]
+ 4 -> 4 [label="maxInclusive"]
+ 4 -> 4 [label="maxLength"]
+ 4 -> 4 [label="pattern"]
+ 4 -> 4 [label="totalDigits"]
+ 4 -> 4 [label="minExclusive"]
+ 4 -> 4 [label="minInclusive"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+ 4 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/TotalDigitsFacet_diagram.dot b/src/xmlpatterns/schema/doc/TotalDigitsFacet_diagram.dot
new file mode 100644
index 0000000..0ef4cd6
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/TotalDigitsFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph TotalDigitsFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Union_diagram.dot b/src/xmlpatterns/schema/doc/Union_diagram.dot
new file mode 100644
index 0000000..d6c1865
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Union_diagram.dot
@@ -0,0 +1,10 @@
+digraph Union {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="simpleType"]
+ 2 -> 3 [label="simpleType"]
+ 3 -> 3 [label="simpleType"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+ 3 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/Unique_diagram.dot b/src/xmlpatterns/schema/doc/Unique_diagram.dot
new file mode 100644
index 0000000..5b1d098
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/Unique_diagram.dot
@@ -0,0 +1,12 @@
+digraph Unique {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 -> 3 [label="selector"]
+ 2 -> 3 [label="selector"]
+ 3 -> 4 [label="field"]
+ 4 -> 4 [label="field"]
+ 1 [shape=circle, style=filled, color=blue]
+ 2 [shape=circle, style=filled, color=red]
+ 3 [shape=circle, style=filled, color=red]
+ 4 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/WhiteSpaceFacet_diagram.dot b/src/xmlpatterns/schema/doc/WhiteSpaceFacet_diagram.dot
new file mode 100644
index 0000000..596403c
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/WhiteSpaceFacet_diagram.dot
@@ -0,0 +1,6 @@
+digraph WhiteSpaceFacet {
+ mindist = 2.0
+ 1 -> 2 [label="annotation"]
+ 1 [shape=doublecircle, style=filled, color=blue]
+ 2 [shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/doc/legend.dot b/src/xmlpatterns/schema/doc/legend.dot
new file mode 100644
index 0000000..4f5792e
--- /dev/null
+++ b/src/xmlpatterns/schema/doc/legend.dot
@@ -0,0 +1,7 @@
+digraph {
+ size="5,4"
+ 1 [label=" start state ", shape=circle, style=filled, color=blue]
+ 2 [label="start/end state", shape=doublecircle, style=filled, color=blue]
+ 3 [label=" internal state", shape=circle, style=filled, color=red]
+ 4 [label=" end state ", shape=doublecircle, style=filled, color=green]
+}
diff --git a/src/xmlpatterns/schema/qnamespacesupport.cpp b/src/xmlpatterns/schema/qnamespacesupport.cpp
new file mode 100644
index 0000000..0ae5309
--- /dev/null
+++ b/src/xmlpatterns/schema/qnamespacesupport.cpp
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "qnamespacesupport_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+NamespaceSupport::NamespaceSupport()
+{
+}
+
+NamespaceSupport::NamespaceSupport(const NamePool::Ptr &namePool)
+ : m_namePool(namePool)
+{
+ // the XML namespace
+ m_ns.insert(StandardPrefixes::xml, StandardNamespaces::xml);
+}
+
+void NamespaceSupport::setPrefix(const QXmlName::PrefixCode prefixCode, const QXmlName::NamespaceCode namespaceCode)
+{
+ m_ns.insert(prefixCode, namespaceCode);
+}
+
+void NamespaceSupport::setPrefixes(const QXmlStreamNamespaceDeclarations &declarations)
+{
+ for (int i = 0; i < declarations.count(); i++) {
+ const QXmlStreamNamespaceDeclaration declaration = declarations.at(i);
+
+ const QXmlName::PrefixCode prefixCode = m_namePool->allocatePrefix(declaration.prefix().toString());
+ const QXmlName::NamespaceCode namespaceCode = m_namePool->allocateNamespace(declaration.namespaceUri().toString());
+ m_ns.insert(prefixCode, namespaceCode);
+ }
+}
+
+void NamespaceSupport::setTargetNamespace(const QXmlName::NamespaceCode namespaceCode)
+{
+ m_ns.insert(0, namespaceCode);
+}
+
+QXmlName::PrefixCode NamespaceSupport::prefix(const QXmlName::NamespaceCode namespaceCode) const
+{
+ NamespaceHash::const_iterator itc, it = m_ns.constBegin();
+ while ((itc=it) != m_ns.constEnd()) {
+ ++it;
+ if (*itc == namespaceCode)
+ return itc.key();
+ }
+ return 0;
+}
+
+QXmlName::NamespaceCode NamespaceSupport::uri(const QXmlName::PrefixCode prefixCode) const
+{
+ return m_ns.value(prefixCode);
+}
+
+bool NamespaceSupport::processName(const QString& qname, NameType type, QXmlName &name) const
+{
+ int len = qname.size();
+ const QChar *data = qname.constData();
+ for (int pos = 0; pos < len; ++pos) {
+ if (data[pos] == QLatin1Char(':')) {
+ const QXmlName::PrefixCode prefixCode = m_namePool->allocatePrefix(qname.left(pos));
+ if (!m_ns.contains(prefixCode))
+ return false;
+ const QXmlName::NamespaceCode namespaceCode = uri(prefixCode);
+ const QXmlName::LocalNameCode localNameCode = m_namePool->allocateLocalName(qname.mid(pos + 1));
+ name = QXmlName(namespaceCode, localNameCode, prefixCode);
+ return true;
+ }
+ }
+
+ // there was no ':'
+ QXmlName::NamespaceCode namespaceCode = 0;
+ // attributes don't take default namespace
+ if (type == ElementName && !m_ns.isEmpty()) {
+ namespaceCode = m_ns.value(0); // get default namespace
+ }
+
+ const QXmlName::LocalNameCode localNameCode = m_namePool->allocateLocalName(qname);
+ name = QXmlName(namespaceCode, localNameCode, 0);
+
+ return true;
+}
+
+void NamespaceSupport::pushContext()
+{
+ m_nsStack.push(m_ns);
+}
+
+void NamespaceSupport::popContext()
+{
+ m_ns.clear();
+ if(!m_nsStack.isEmpty())
+ m_ns = m_nsStack.pop();
+}
+
+QList<QXmlName> NamespaceSupport::namespaceBindings() const
+{
+ QList<QXmlName> bindings;
+
+ QHashIterator<QXmlName::PrefixCode, QXmlName::NamespaceCode> it(m_ns);
+ while (it.hasNext()) {
+ it.next();
+ bindings.append(QXmlName(it.value(), StandardLocalNames::empty, it.key()));
+ }
+
+ return bindings;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qnamespacesupport_p.h b/src/xmlpatterns/schema/qnamespacesupport_p.h
new file mode 100644
index 0000000..47c21a5
--- /dev/null
+++ b/src/xmlpatterns/schema/qnamespacesupport_p.h
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_NamespaceSupport_H
+#define Patternist_NamespaceSupport_H
+
+#include "qnamepool_p.h"
+
+#include <QtCore/QExplicitlySharedDataPointer>
+#include <QtCore/QHash>
+#include <QtCore/QSet>
+#include <QtCore/QStack>
+#include <QtCore/QXmlStreamNamespaceDeclarations>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A helper class for handling nested namespace declarations.
+ *
+ * This class is mostly an adaption of QXmlNamespaceSupport to the NamePool
+ * mechanism used in XmlPatterns.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class NamespaceSupport
+ {
+ public:
+ /**
+ * Describes whether the name to process is an attribute or element.
+ */
+ enum NameType
+ {
+ AttributeName, ///< An attribute name to process.
+ ElementName ///< An element name to process.
+ };
+
+ /**
+ * Creates an empty namespace support object.
+ */
+ NamespaceSupport();
+
+ /**
+ * Creates a new namespace support object.
+ *
+ * @param namePool The name pool where all processed names are stored in.
+ */
+ NamespaceSupport(const NamePool::Ptr &namePool);
+
+ /**
+ * Adds a new prefix-to-namespace binding.
+ *
+ * @param prefixCode The name pool code for the prefix.
+ * @param namespaceCode The name pool code for the namespace.
+ */
+ void setPrefix(const QXmlName::PrefixCode prefixCode, const QXmlName::NamespaceCode namespaceCode);
+
+ /**
+ * Adds the prefix-to-namespace bindings from @p declarations to
+ * the namespace support.
+ */
+ void setPrefixes(const QXmlStreamNamespaceDeclarations &declarations);
+
+ /**
+ * Sets the name pool code of the target namespace of the schema the
+ * namespace support works on.
+ */
+ void setTargetNamespace(const QXmlName::NamespaceCode code);
+
+ /**
+ * Returns the prefix code for the given namespace @p code.
+ */
+ QXmlName::PrefixCode prefix(const QXmlName::NamespaceCode code) const;
+
+ /**
+ * Returns the namespace code for the given prefix @p code.
+ */
+ QXmlName::NamespaceCode uri(const QXmlName::PrefixCode code) const;
+
+ /**
+ * Converts the given @p qualifiedName to a resolved QXmlName @p name according
+ * to the current namespace mapping.
+ *
+ * @param qualifiedName The full qualified name.
+ * @param type The type of name processing.
+ * @param name The resolved QXmlName.
+ *
+ * @returns @c true if the name could be processed correctly or @c false if the
+ * namespace prefix is unknown.
+ */
+ bool processName(const QString &qualifiedName, NameType type, QXmlName &name) const;
+
+ /**
+ * Pushes the current namespace mapping onto the stack.
+ */
+ void pushContext();
+
+ /**
+ * Pops the current namespace mapping from the stack.
+ */
+ void popContext();
+
+ /**
+ * Returns the list of namespace bindings.
+ */
+ QList<QXmlName> namespaceBindings() const;
+
+ private:
+ typedef QHash<QXmlName::PrefixCode, QXmlName::NamespaceCode> NamespaceHash;
+
+ NamePool::Ptr m_namePool;
+ QStack<NamespaceHash> m_nsStack;
+ NamespaceHash m_ns;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdalternative.cpp b/src/xmlpatterns/schema/qxsdalternative.cpp
new file mode 100644
index 0000000..ceaa34b
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdalternative.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdalternative_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdAlternative::setTest(const XsdXPathExpression::Ptr &test)
+{
+ m_test = test;
+}
+
+XsdXPathExpression::Ptr XsdAlternative::test() const
+{
+ return m_test;
+}
+
+void XsdAlternative::setType(const SchemaType::Ptr &type)
+{
+ m_type = type;
+}
+
+SchemaType::Ptr XsdAlternative::type() const
+{
+ return m_type;
+}
+
+QT_END_NAMESPACE
diff --git a/examples/gestures/browser/browserapplication.h b/src/xmlpatterns/schema/qxsdalternative_p.h
index db83a85..8dcfb12 100644
--- a/examples/gestures/browser/browserapplication.h
+++ b/src/xmlpatterns/schema/qxsdalternative_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,81 +39,76 @@
**
****************************************************************************/
-#ifndef BROWSERAPPLICATION_H
-#define BROWSERAPPLICATION_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
-#include <QtGui/QApplication>
+#ifndef Patternist_XsdAlternative_H
+#define Patternist_XsdAlternative_H
-#include <QtCore/QUrl>
-#include <QtCore/QPointer>
+#include "qnamedschemacomponent_p.h"
+#include "qschematype_p.h"
+#include "qxsdannotated_p.h"
+#include "qxsdxpathexpression_p.h"
-#include <QtGui/QIcon>
+#include <QtCore/QList>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QLocalServer;
-QT_END_NAMESPACE
-class BookmarksManager;
-class BrowserMainWindow;
-class CookieJar;
-class DownloadManager;
-class HistoryManager;
-class NetworkAccessManager;
-class BrowserApplication : public QApplication
+namespace QPatternist
{
- Q_OBJECT
-
-public:
- BrowserApplication(int &argc, char **argv);
- ~BrowserApplication();
- static BrowserApplication *instance();
- void loadSettings();
-
- bool isTheOnlyBrowser() const;
- BrowserMainWindow *mainWindow();
- QList<BrowserMainWindow*> mainWindows();
- QIcon icon(const QUrl &url) const;
+ /**
+ * @short Represents a XSD alternative object.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdAlternative : public NamedSchemaComponent, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdAlternative> Ptr;
+ typedef QList<XsdAlternative::Ptr> List;
+
+ /**
+ * Sets the xpath @p test of the alternative.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#tac-test">Test Definition</a>
+ */
+ void setTest(const XsdXPathExpression::Ptr &test);
+
+ /**
+ * Returns the xpath test of the alternative.
+ */
+ XsdXPathExpression::Ptr test() const;
+
+ /**
+ * Sets the @p type of the alternative.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#tac-type_definition">Type Definition</a>
+ */
+ void setType(const SchemaType::Ptr &type);
+
+ /**
+ * Returns the type of the alternative.
+ */
+ SchemaType::Ptr type() const;
+
+ private:
+ XsdXPathExpression::Ptr m_test;
+ SchemaType::Ptr m_type;
+ };
+}
- void saveSession();
- bool canRestoreSession() const;
-
- static HistoryManager *historyManager();
- static CookieJar *cookieJar();
- static DownloadManager *downloadManager();
- static NetworkAccessManager *networkAccessManager();
- static BookmarksManager *bookmarksManager();
+QT_END_NAMESPACE
-#if defined(Q_WS_MAC)
- bool event(QEvent *event);
-#endif
+QT_END_HEADER
-public slots:
- BrowserMainWindow *newMainWindow();
- void restoreLastSession();
-#if defined(Q_WS_MAC)
- void lastWindowClosed();
- void quitBrowser();
#endif
-
-private slots:
- void postLaunch();
- void openUrl(const QUrl &url);
- void newLocalSocketConnection();
-
-private:
- void clean();
- void installTranslator(const QString &name);
-
- static HistoryManager *s_historyManager;
- static DownloadManager *s_downloadManager;
- static NetworkAccessManager *s_networkAccessManager;
- static BookmarksManager *s_bookmarksManager;
-
- QList<QPointer<BrowserMainWindow> > m_mainWindows;
- QLocalServer *m_localServer;
- QByteArray m_lastSession;
- mutable QIcon m_defaultIcon;
-};
-
-#endif // BROWSERAPPLICATION_H
-
diff --git a/src/xmlpatterns/schema/qxsdannotated.cpp b/src/xmlpatterns/schema/qxsdannotated.cpp
new file mode 100644
index 0000000..d9d89f6
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdannotated.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdannotated_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdAnnotated::addAnnotation(const XsdAnnotation::Ptr &annotation)
+{
+ m_annotations.append(annotation);
+}
+
+void XsdAnnotated::addAnnotations(const XsdAnnotation::List &annotations)
+{
+ m_annotations << annotations;
+}
+
+XsdAnnotation::List XsdAnnotated::annotations() const
+{
+ return m_annotations;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdannotated_p.h b/src/xmlpatterns/schema/qxsdannotated_p.h
new file mode 100644
index 0000000..05010d9
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdannotated_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdAnnotated_H
+#define Patternist_XsdAnnotated_H
+
+#include "qxsdannotation_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Base class for all XSD components with annotation content.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdAnnotated
+ {
+ public:
+ /**
+ * Adds a new @p annotation to the component.
+ */
+ void addAnnotation(const XsdAnnotation::Ptr &annotation);
+
+ /**
+ * Adds a list of new @p annotations to the component.
+ */
+ void addAnnotations(const XsdAnnotation::List &annotations);
+
+ /**
+ * Returns the list of all annotations of the component.
+ */
+ XsdAnnotation::List annotations() const;
+
+ private:
+ XsdAnnotation::List m_annotations;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/plugins/mousedrivers/bus/main.cpp b/src/xmlpatterns/schema/qxsdannotation.cpp
index f56c890..d53e3b6 100644
--- a/src/plugins/mousedrivers/bus/main.cpp
+++ b/src/xmlpatterns/schema/qxsdannotation.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,38 +39,40 @@
**
****************************************************************************/
-#include <qmousedriverplugin_qws.h>
-#include <qmousebus_qws.h>
+#include "qxsdannotation_p.h"
QT_BEGIN_NAMESPACE
-class QBusMouseDriver : public QMouseDriverPlugin
+using namespace QPatternist;
+
+void XsdAnnotation::setId(const DerivedString<TypeID>::Ptr &id)
{
-public:
- QBusMouseDriver();
+ m_id = id;
+}
- QStringList keys() const;
- QWSMouseHandler* create(const QString &driver, const QString &device);
-};
+DerivedString<TypeID>::Ptr XsdAnnotation::id() const
+{
+ return m_id;
+}
-QBusMouseDriver::QBusMouseDriver()
- : QMouseDriverPlugin()
+void XsdAnnotation::addApplicationInformation(const XsdApplicationInformation::Ptr &information)
{
+ m_applicationInformation.append(information);
}
-QStringList QBusMouseDriver::keys() const
+XsdApplicationInformation::List XsdAnnotation::applicationInformation() const
{
- return (QStringList() << "Bus");
+ return m_applicationInformation;
}
-QWSMouseHandler* QBusMouseDriver::create(const QString &driver,
- const QString &device)
+void XsdAnnotation::addDocumentation(const XsdDocumentation::Ptr &documentation)
{
- if (driver.compare(QLatin1String("Bus"), Qt::CaseInsensitive))
- return 0;
- return new QWSBusMouseHandler(driver, device);
+ m_documentations.append(documentation);
}
-Q_EXPORT_PLUGIN2(qwsbusmousehandler, QBusMouseDriver)
+XsdDocumentation::List XsdAnnotation::documentation() const
+{
+ return m_documentations;
+}
QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdannotation_p.h b/src/xmlpatterns/schema/qxsdannotation_p.h
new file mode 100644
index 0000000..27fb555
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdannotation_p.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdAnnotation_H
+#define Patternist_XsdAnnotation_H
+
+#include "qderivedstring_p.h"
+#include "qxsdapplicationinformation_p.h"
+#include "qxsddocumentation_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD annotation object.
+ *
+ * This class represents the <em>annotation</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#cAnnotations">here</a>.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdAnnotation : public NamedSchemaComponent
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdAnnotation> Ptr;
+ typedef QList<XsdAnnotation::Ptr> List;
+
+ /**
+ * Sets the @p id of the annotation.
+ */
+ void setId(const DerivedString<TypeID>::Ptr &id);
+
+ /**
+ * Returns the @p id of the annotation.
+ */
+ DerivedString<TypeID>::Ptr id() const;
+
+ /**
+ * Adds an application @p information to the annotation.
+ *
+ * The application information is meant to be interpreted by
+ * a software system, e.g. other parts of the XML processor pipeline.
+ */
+ void addApplicationInformation(const XsdApplicationInformation::Ptr &information);
+
+ /**
+ * Returns the list of all application information of the annotation.
+ */
+ XsdApplicationInformation::List applicationInformation() const;
+
+ /**
+ * Adds a @p documentation to the annotation.
+ *
+ * The documentation is meant to be read by human being, e.g. additional
+ * constraints or information about schema components.
+ */
+ void addDocumentation(const XsdDocumentation::Ptr &documentation);
+
+ /**
+ * Returns the list of all documentations of the annotation.
+ */
+ XsdDocumentation::List documentation() const;
+
+ private:
+ DerivedString<TypeID>::Ptr m_id;
+ XsdApplicationInformation::List m_applicationInformation;
+ XsdDocumentation::List m_documentations;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdapplicationinformation.cpp b/src/xmlpatterns/schema/qxsdapplicationinformation.cpp
new file mode 100644
index 0000000..46d6d56
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdapplicationinformation.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdapplicationinformation_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdApplicationInformation::setSource(const AnyURI::Ptr &source)
+{
+ m_source = source;
+}
+
+AnyURI::Ptr XsdApplicationInformation::source() const
+{
+ return m_source;
+}
+
+void XsdApplicationInformation::setContent(const QString &content)
+{
+ m_content = content;
+}
+
+QString XsdApplicationInformation::content() const
+{
+ return m_content;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdapplicationinformation_p.h b/src/xmlpatterns/schema/qxsdapplicationinformation_p.h
new file mode 100644
index 0000000..2eec83a
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdapplicationinformation_p.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdApplicationInformation_H
+#define Patternist_XsdApplicationInformation_H
+
+#include "qanytype_p.h"
+#include "qanyuri_p.h"
+#include "qnamedschemacomponent_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD appinfo object.
+ *
+ * This class represents the <em>appinfo</em> component of an <em>annotation</em> object
+ * of a XML schema as described <a href="http://www.w3.org/TR/xmlschema11-1/#cAnnotations">here</a>.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdApplicationInformation : public NamedSchemaComponent
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdApplicationInformation> Ptr;
+ typedef QList<XsdApplicationInformation::Ptr> List;
+
+ /**
+ * Sets the @p source of the application information.
+ *
+ * The source points to an URL that contains more
+ * information.
+ */
+ void setSource(const AnyURI::Ptr &source);
+
+ /**
+ * Returns the source of the application information.
+ */
+ AnyURI::Ptr source() const;
+
+ /**
+ * Sets the @p content of the application information.
+ *
+ * The content can be of abritrary type.
+ */
+ void setContent(const QString &content);
+
+ /**
+ * Returns the content of the application information.
+ */
+ QString content() const;
+
+ private:
+ AnyURI::Ptr m_source;
+ QString m_content;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdassertion.cpp b/src/xmlpatterns/schema/qxsdassertion.cpp
new file mode 100644
index 0000000..8898bd2
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdassertion.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdassertion_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdAssertion::setTest(const XsdXPathExpression::Ptr &test)
+{
+ m_test = test;
+}
+
+XsdXPathExpression::Ptr XsdAssertion::test() const
+{
+ return m_test;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdassertion_p.h b/src/xmlpatterns/schema/qxsdassertion_p.h
new file mode 100644
index 0000000..56674e5
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdassertion_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdAssertion_H
+#define Patternist_XsdAssertion_H
+
+#include "qnamedschemacomponent_p.h"
+#include "qxsdannotated_p.h"
+#include "qxsdxpathexpression_p.h"
+
+#include <QtCore/QList>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD assertion object.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#cAssertions">Assertion Definition</a>
+ */
+ class XsdAssertion : public NamedSchemaComponent, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdAssertion> Ptr;
+ typedef QList<XsdAssertion::Ptr> List;
+
+ /**
+ * Sets the @p test of the assertion.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#as-test">Test Definition</a>
+ */
+ void setTest(const XsdXPathExpression::Ptr &test);
+
+ /**
+ * Returns the test of the assertion.
+ */
+ XsdXPathExpression::Ptr test() const;
+
+ private:
+ XsdXPathExpression::Ptr m_test;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdattribute.cpp b/src/xmlpatterns/schema/qxsdattribute.cpp
new file mode 100644
index 0000000..7fd883e
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdattribute.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdattribute_p.h"
+#include "qxsdcomplextype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+
+void XsdAttribute::Scope::setVariety(Variety variety)
+{
+ m_variety = variety;
+}
+
+XsdAttribute::Scope::Variety XsdAttribute::Scope::variety() const
+{
+ return m_variety;
+}
+
+void XsdAttribute::Scope::setParent(const NamedSchemaComponent::Ptr &parent)
+{
+ m_parent = parent;
+}
+
+NamedSchemaComponent::Ptr XsdAttribute::Scope::parent() const
+{
+ return m_parent;
+}
+
+void XsdAttribute::ValueConstraint::setVariety(Variety variety)
+{
+ m_variety = variety;
+}
+
+XsdAttribute::ValueConstraint::Variety XsdAttribute::ValueConstraint::variety() const
+{
+ return m_variety;
+}
+
+void XsdAttribute::ValueConstraint::setValue(const QString &value)
+{
+ m_value = value;
+}
+
+QString XsdAttribute::ValueConstraint::value() const
+{
+ return m_value;
+}
+
+void XsdAttribute::ValueConstraint::setLexicalForm(const QString &form)
+{
+ m_lexicalForm = form;
+}
+
+QString XsdAttribute::ValueConstraint::lexicalForm() const
+{
+ return m_lexicalForm;
+}
+
+void XsdAttribute::setType(const AnySimpleType::Ptr &type)
+{
+ m_type = type;
+}
+
+AnySimpleType::Ptr XsdAttribute::type() const
+{
+ return m_type;
+}
+
+void XsdAttribute::setScope(const Scope::Ptr &scope)
+{
+ m_scope = scope;
+}
+
+XsdAttribute::Scope::Ptr XsdAttribute::scope() const
+{
+ return m_scope;
+}
+
+void XsdAttribute::setValueConstraint(const ValueConstraint::Ptr &constraint)
+{
+ m_valueConstraint = constraint;
+}
+
+XsdAttribute::ValueConstraint::Ptr XsdAttribute::valueConstraint() const
+{
+ return m_valueConstraint;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdattribute_p.h b/src/xmlpatterns/schema/qxsdattribute_p.h
new file mode 100644
index 0000000..220dd28
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdattribute_p.h
@@ -0,0 +1,246 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdAttribute_H
+#define Patternist_XsdAttribute_H
+
+#include "qanysimpletype_p.h"
+#include "qnamedschemacomponent_p.h"
+#include "qxsdannotated_p.h"
+
+#include <QtCore/QList>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD attribute object.
+ *
+ * This class represents the <em>attribute</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#cAttribute_Declarations">here</a>.
+ *
+ * It contains information from either a top-level attribute declaration (as child of
+ * a <em>schema</em> object) or of a local attribute declaration (as child of <em>complexType</em>
+ * or <em>attributeGroup</em> object without a 'ref' attribute).
+ *
+ * All other occurrences of the <em>attribute</em> object are represented by the XsdAttributeUse class.
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSAttributeDeclaration">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdAttribute : public NamedSchemaComponent, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdAttribute> Ptr;
+ typedef QList<XsdAttribute::Ptr> List;
+
+ /**
+ * @short Describes the scope of an attribute.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#sc_a">Scope Definition</a>
+ */
+ class Scope : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<Scope> Ptr;
+
+ /**
+ * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#ad-scope">scope</a> of an attribute.
+ */
+ enum Variety
+ {
+ Global, ///< The attribute is defined globally as child of the <em>schema</em> object.
+ Local ///< The attribute is defined locally as child of a complex type or attribute group definition.
+ };
+
+ /**
+ * Sets the @p variety of the attribute scope.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#sc_a-variety">Variety Definition</a>
+ */
+ void setVariety(Variety variety);
+
+ /**
+ * Returns the variety of the attribute scope.
+ */
+ Variety variety() const;
+
+ /**
+ * Sets the @p parent complex type or attribute group definition of the attribute scope.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#sc_a-parent">Parent Definition</a>
+ */
+ void setParent(const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * Returns the parent complex type or attribute group definition of the attribute scope.
+ */
+ NamedSchemaComponent::Ptr parent() const;
+
+ private:
+ Variety m_variety;
+ NamedSchemaComponent::Ptr m_parent;
+ };
+
+
+ /**
+ * @short Describes the value constraint of an attribute.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_a">Value Constraint Definition</a>
+ */
+ class ValueConstraint : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<ValueConstraint> Ptr;
+
+ /**
+ * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#ad-value_constraint">value constraint</a> of an attribute.
+ */
+ enum Variety
+ {
+ Default, ///< The attribute has a default value set.
+ Fixed ///< The attribute has a fixed value set.
+ };
+
+ /**
+ * Sets the @p variety of the attribute value constraint.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_a-variety">Variety Definition</a>
+ */
+ void setVariety(Variety variety);
+
+ /**
+ * Returns the variety of the attribute value constraint.
+ */
+ Variety variety() const;
+
+ /**
+ * Sets the @p value of the constraint.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_a-value">Value Definition</a>
+ */
+ void setValue(const QString &value);
+
+ /**
+ * Returns the value of the constraint.
+ */
+ QString value() const;
+
+ /**
+ * Sets the lexical @p form of the constraint.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_a-lexical_form">Lexical Form Definition</a>
+ */
+ void setLexicalForm(const QString &form);
+
+ /**
+ * Returns the lexical form of the constraint.
+ */
+ QString lexicalForm() const;
+
+ private:
+ Variety m_variety;
+ QString m_value;
+ QString m_lexicalForm;
+ };
+
+ /**
+ * Sets the simple @p type definition of the attribute.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ad-type_definition">Simple Type Definition</a>
+ */
+ void setType(const AnySimpleType::Ptr &type);
+
+ /**
+ * Returns the simple type definition of the attribute.
+ */
+ AnySimpleType::Ptr type() const;
+
+ /**
+ * Sets the @p scope of the attribute.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ad-scope">Scope Definition</a>
+ */
+ void setScope(const Scope::Ptr &scope);
+
+ /**
+ * Returns the scope of the attribute.
+ */
+ Scope::Ptr scope() const;
+
+ /**
+ * Sets the value @p constraint of the attribute.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ad-value_constraint">Value Constraint Definition</a>
+ */
+ void setValueConstraint(const ValueConstraint::Ptr &constraint);
+
+ /**
+ * Returns the value constraint of the attribute.
+ */
+ ValueConstraint::Ptr valueConstraint() const;
+
+ private:
+ AnySimpleType::Ptr m_type;
+ Scope::Ptr m_scope;
+ ValueConstraint::Ptr m_valueConstraint;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdattributegroup.cpp b/src/xmlpatterns/schema/qxsdattributegroup.cpp
new file mode 100644
index 0000000..ff62ef5
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdattributegroup.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdattributegroup_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdAttributeGroup::setAttributeUses(const XsdAttributeUse::List &attributeUses)
+{
+ m_attributeUses = attributeUses;
+}
+
+void XsdAttributeGroup::addAttributeUse(const XsdAttributeUse::Ptr &attributeUse)
+{
+ m_attributeUses.append(attributeUse);
+}
+
+XsdAttributeUse::List XsdAttributeGroup::attributeUses() const
+{
+ return m_attributeUses;
+}
+
+void XsdAttributeGroup::setWildcard(const XsdWildcard::Ptr &wildcard)
+{
+ m_wildcard = wildcard;
+}
+
+XsdWildcard::Ptr XsdAttributeGroup::wildcard() const
+{
+ return m_wildcard;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdattributegroup_p.h b/src/xmlpatterns/schema/qxsdattributegroup_p.h
new file mode 100644
index 0000000..3684df2
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdattributegroup_p.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdAttributeGroup_H
+#define Patternist_XsdAttributeGroup_H
+
+#include "qxsdannotated_p.h"
+#include "qxsdattributeuse_p.h"
+#include "qxsdwildcard_p.h"
+
+#include <QtCore/QList>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents the XSD attributeGroup object.
+ *
+ * This class represents the <em>attributeGroup</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#cAttribute_Group_Definitions">here</a>.
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSAttributeGroup">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdAttributeGroup : public NamedSchemaComponent, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdAttributeGroup> Ptr;
+ typedef QList<XsdAttributeGroup::Ptr> List;
+
+ /**
+ * Sets the list of attribute @p uses that are defined in the attribute group.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#agd-attribute_uses">Attribute Uses</a>
+ */
+ void setAttributeUses(const XsdAttributeUse::List &uses);
+
+ /**
+ * Adds a new attribute @p use to the attribute group.
+ */
+ void addAttributeUse(const XsdAttributeUse::Ptr &use);
+
+ /**
+ * Returns the list of all attribute uses of the attribute group.
+ */
+ XsdAttributeUse::List attributeUses() const;
+
+ /**
+ * Sets the attribute @p wildcard of the attribute group.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#agd-attribute_wildcard">Attribute Wildcard</a>
+ */
+ void setWildcard(const XsdWildcard::Ptr &wildcard);
+
+ /**
+ * Returns the attribute wildcard of the attribute group.
+ */
+ XsdWildcard::Ptr wildcard() const;
+
+ private:
+ XsdAttributeUse::List m_attributeUses;
+ XsdWildcard::Ptr m_wildcard;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/plugins/kbddrivers/vr41xx/main.cpp b/src/xmlpatterns/schema/qxsdattributereference.cpp
index 2cba1f7..0b3ce03 100644
--- a/src/plugins/kbddrivers/vr41xx/main.cpp
+++ b/src/xmlpatterns/schema/qxsdattributereference.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,39 +39,50 @@
**
****************************************************************************/
-#include <qkbddriverplugin_qws.h>
-#include <qkbdvr41xx_qws.h>
+#include "qxsdattributereference_p.h"
QT_BEGIN_NAMESPACE
-class QVr41xxKbdDriver : public QKbdDriverPlugin
+using namespace QPatternist;
+
+bool XsdAttributeReference::isAttributeUse() const
+{
+ return false;
+}
+
+bool XsdAttributeReference::isReference() const
+{
+ return true;
+}
+
+void XsdAttributeReference::setType(Type type)
{
-public:
- QVr41xxKbdDriver();
+ m_type = type;
+}
- QStringList keys() const;
- QWSKeyboardHandler* create(const QString &driver, const QString &device);
-};
+XsdAttributeReference::Type XsdAttributeReference::type() const
+{
+ return m_type;
+}
-QVr41xxKbdDriver::QVr41xxKbdDriver()
- : QKbdDriverPlugin()
+void XsdAttributeReference::setReferenceName(const QXmlName &referenceName)
{
+ m_referenceName = referenceName;
}
-QStringList QVr41xxKbdDriver::keys() const
+QXmlName XsdAttributeReference::referenceName() const
{
- return (QStringList() << QLatin1String("VR41xx"));
+ return m_referenceName;
}
-QWSKeyboardHandler* QVr41xxKbdDriver::create(const QString &driver,
- const QString &device)
+void XsdAttributeReference::setSourceLocation(const QSourceLocation &location)
{
- Q_UNUSED(device);
- if (driver.compare(QLatin1String("VR41xx"), Qt::CaseInsensitive))
- return 0;
- return new QWSVr41xxKeyboardHandler(driver);
+ m_sourceLocation = location;
}
-Q_EXPORT_PLUGIN2(qwsvr41xxkbddriver, QVr41xxKbdDriver)
+QSourceLocation XsdAttributeReference::sourceLocation() const
+{
+ return m_sourceLocation;
+}
QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdattributereference_p.h b/src/xmlpatterns/schema/qxsdattributereference_p.h
new file mode 100644
index 0000000..0d2bdc1
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdattributereference_p.h
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdAttributeReference_H
+#define Patternist_XsdAttributeReference_H
+
+#include "qxsdattributeuse_p.h"
+
+#include <QtXmlPatterns/QSourceLocation>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A helper class for attribute reference resolving.
+ *
+ * For easy resolving of attribute references, we have this class
+ * that can be used as a place holder for the real attribute use
+ * object it is referring to.
+ * So whenever the parser detects an attribute reference, it creates
+ * a XsdAttributeReference and returns it instead of the XsdAttributeUse.
+ * During a later phase, the resolver will look for all XsdAttributeReferences
+ * in the schema and will replace them with their referring XsdAttributeUse
+ * objects.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdAttributeReference : public XsdAttributeUse
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdAttributeReference> Ptr;
+
+ /**
+ * Describes the type of the attribute reference.
+ */
+ enum Type
+ {
+ AttributeUse, ///< The reference points to an attribute use.
+ AttributeGroup ///< The reference points to an attribute group.
+ };
+
+ /**
+ * Always returns false, used to avoid dynamic casts.
+ */
+ virtual bool isAttributeUse() const;
+
+ /**
+ * Always returns true, used to avoid dynamic casts.
+ */
+ virtual bool isReference() const;
+
+ /**
+ * Sets the @p type of the attribute reference.
+ */
+ void setType(Type type);
+
+ /**
+ * Returns the type of the attribute reference.
+ */
+ Type type() const;
+
+ /**
+ * Sets the @p name of the attribute or attribute group the
+ * attribute reference refers to.
+ */
+ void setReferenceName(const QXmlName &name);
+
+ /**
+ * Returns the name of the attribute or attribute group the
+ * attribute reference refers to.
+ */
+ QXmlName referenceName() const;
+
+ /**
+ * Sets the source @p location where the reference is located.
+ */
+ void setSourceLocation(const QSourceLocation &location);
+
+ /**
+ * Returns the source location where the reference is located.
+ */
+ QSourceLocation sourceLocation() const;
+
+ private:
+ Type m_type;
+ QXmlName m_referenceName;
+ QSourceLocation m_sourceLocation;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdattributeterm.cpp b/src/xmlpatterns/schema/qxsdattributeterm.cpp
new file mode 100644
index 0000000..78ddd2f
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdattributeterm.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdattributeterm_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+bool XsdAttributeTerm::isAttributeUse() const
+{
+ return false;
+}
+
+bool XsdAttributeTerm::isReference() const
+{
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdattributeterm_p.h b/src/xmlpatterns/schema/qxsdattributeterm_p.h
new file mode 100644
index 0000000..4852d46
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdattributeterm_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdAttributeTerm_H
+#define Patternist_XsdAttributeTerm_H
+
+#include "qnamedschemacomponent_p.h"
+#include "qxsdannotated_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A base class for all attribute types.
+ *
+ * For easy resolving of attribute references, we use this as
+ * common base class for XsdAttribute and XsdAttributeReference.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdAttributeTerm : public NamedSchemaComponent, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdAttributeTerm> Ptr;
+
+ /**
+ * Returns @c true if the term is an attribute use, @c false otherwise.
+ */
+ virtual bool isAttributeUse() const;
+
+ /**
+ * Returns @c true if the term is an attribute use reference, @c false otherwise.
+ *
+ * @note The reference term is only used internally as helper during type resolving.
+ */
+ virtual bool isReference() const;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdattributeuse.cpp b/src/xmlpatterns/schema/qxsdattributeuse.cpp
new file mode 100644
index 0000000..d241167
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdattributeuse.cpp
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdattributeuse_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdAttributeUse::ValueConstraint::setVariety(Variety variety)
+{
+ m_variety = variety;
+}
+
+XsdAttributeUse::ValueConstraint::Variety XsdAttributeUse::ValueConstraint::variety() const
+{
+ return m_variety;
+}
+
+void XsdAttributeUse::ValueConstraint::setValue(const QString &value)
+{
+ m_value = value;
+}
+
+QString XsdAttributeUse::ValueConstraint::value() const
+{
+ return m_value;
+}
+
+void XsdAttributeUse::ValueConstraint::setLexicalForm(const QString &form)
+{
+ m_lexicalForm = form;
+}
+
+QString XsdAttributeUse::ValueConstraint::lexicalForm() const
+{
+ return m_lexicalForm;
+}
+
+XsdAttributeUse::ValueConstraint::Ptr XsdAttributeUse::ValueConstraint::fromAttributeValueConstraint(const XsdAttribute::ValueConstraint::Ptr &constraint)
+{
+ XsdAttributeUse::ValueConstraint::Ptr newConstraint(new XsdAttributeUse::ValueConstraint());
+ switch (constraint->variety()) {
+ case XsdAttribute::ValueConstraint::Fixed: newConstraint->setVariety(Fixed); break;
+ case XsdAttribute::ValueConstraint::Default: newConstraint->setVariety(Default); break;
+ }
+ newConstraint->setValue(constraint->value());
+ newConstraint->setLexicalForm(constraint->lexicalForm());
+
+ return newConstraint;
+}
+
+XsdAttributeUse::XsdAttributeUse()
+ : m_useType(OptionalUse)
+{
+}
+
+bool XsdAttributeUse::isAttributeUse() const
+{
+ return true;
+}
+
+void XsdAttributeUse::setUseType(UseType type)
+{
+ m_useType = type;
+}
+
+XsdAttributeUse::UseType XsdAttributeUse::useType() const
+{
+ return m_useType;
+}
+
+bool XsdAttributeUse::isRequired() const
+{
+ return (m_useType == RequiredUse);
+}
+
+void XsdAttributeUse::setAttribute(const XsdAttribute::Ptr &attribute)
+{
+ m_attribute = attribute;
+}
+
+XsdAttribute::Ptr XsdAttributeUse::attribute() const
+{
+ return m_attribute;
+}
+
+void XsdAttributeUse::setValueConstraint(const ValueConstraint::Ptr &constraint)
+{
+ m_valueConstraint = constraint;
+}
+
+XsdAttributeUse::ValueConstraint::Ptr XsdAttributeUse::valueConstraint() const
+{
+ return m_valueConstraint;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdattributeuse_p.h b/src/xmlpatterns/schema/qxsdattributeuse_p.h
new file mode 100644
index 0000000..eb1dc40
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdattributeuse_p.h
@@ -0,0 +1,224 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdAttributeUse_H
+#define Patternist_XsdAttributeUse_H
+
+#include "qxsdattribute_p.h"
+#include "qxsdattributeterm_p.h"
+
+#include <QtCore/QList>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD attribute use object.
+ *
+ * This class represents the <em>attribute use</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#cAttributeUse">here</a>.
+ *
+ * It contains information from a local attribute declaration (as child of <em>complexType</em>
+ * or <em>attributeGroup</em> object).
+ *
+ * All other occurrences of the <em>attribute</em> object are represented by the XsdAttribute class.
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSAttributeUse">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdAttributeUse : public XsdAttributeTerm
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdAttributeUse> Ptr;
+ typedef QList<XsdAttributeUse::Ptr> List;
+
+ /**
+ * Describes the value constraint of an attribute use.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_au">Value Constraint Definition</a>
+ */
+ class ValueConstraint : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<ValueConstraint> Ptr;
+
+ /**
+ * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#au-value_constraint">value constraint</a> of an attribute use.
+ */
+ enum Variety
+ {
+ Default, ///< The attribute use has a default value set.
+ Fixed ///< The attribute use has a fixed value set.
+ };
+
+ /**
+ * Sets the @p variety of the attribute use value constraint.
+ */
+ void setVariety(Variety variety);
+
+ /**
+ * Returns the variety of the attribute use value constraint.
+ */
+ Variety variety() const;
+
+ /**
+ * Sets the @p value of the constraint.
+ */
+ void setValue(const QString &value);
+
+ /**
+ * Returns the value of the constraint.
+ */
+ QString value() const;
+
+ /**
+ * Sets the lexical @p form of the constraint.
+ */
+ void setLexicalForm(const QString &form);
+
+ /**
+ * Returns the lexical form of the constraint.
+ */
+ QString lexicalForm() const;
+
+ /**
+ * Creates a new value constraint from a XsdAttribute::ValueConstraint.
+ */
+ static ValueConstraint::Ptr fromAttributeValueConstraint(const XsdAttribute::ValueConstraint::Ptr &constraint);
+
+ private:
+ Variety m_variety;
+ QString m_value;
+ QString m_lexicalForm;
+ };
+
+ /**
+ * Describes the use type of the attribute use.
+ */
+ enum UseType
+ {
+ OptionalUse, ///< The attribute can be there but doesn't need to.
+ RequiredUse, ///< The attribute must be there.
+ ProhibitedUse ///< The attribute is not allowed to be there.
+ };
+
+ /**
+ * Creates a new attribute use object.
+ */
+ XsdAttributeUse();
+
+ /**
+ * Always returns true, used to avoid dynamic casts.
+ */
+ virtual bool isAttributeUse() const;
+
+ /**
+ * Sets the use @p type of the attribute use.
+ *
+ * @see UseType
+ */
+ void setUseType(UseType type);
+
+ /**
+ * Returns the use type of the attribute use.
+ */
+ UseType useType() const;
+
+ /**
+ * Returns whether the attribute use is required.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#au-required">Required Definition</a>
+ */
+ bool isRequired() const;
+
+ /**
+ * Sets the @p attribute the attribute use is referring to.
+ * That is either a local definition as child of a complexType
+ * or attributeGroup object, or a reference defined by the
+ * 'ref' attribute.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#au-attribute_declaration">Attribute Declaration</a>
+ */
+ void setAttribute(const XsdAttribute::Ptr &attribute);
+
+ /**
+ * Returns the attribute the attribute use is referring to.
+ */
+ XsdAttribute::Ptr attribute() const;
+
+ /**
+ * Sets the value @p constraint of the attribute use.
+ *
+ * @see http://www.w3.org/TR/xmlschema11-1/#vc_au
+ */
+ void setValueConstraint(const ValueConstraint::Ptr &constraint);
+
+ /**
+ * Returns the value constraint of the attribute use.
+ */
+ ValueConstraint::Ptr valueConstraint() const;
+
+ private:
+ UseType m_useType;
+ XsdAttribute::Ptr m_attribute;
+ ValueConstraint::Ptr m_valueConstraint;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdcomplextype.cpp b/src/xmlpatterns/schema/qxsdcomplextype.cpp
new file mode 100644
index 0000000..0ecca9e
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdcomplextype.cpp
@@ -0,0 +1,231 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdcomplextype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdComplexType::OpenContent::setMode(Mode mode)
+{
+ m_mode = mode;
+}
+
+XsdComplexType::OpenContent::Mode XsdComplexType::OpenContent::mode() const
+{
+ return m_mode;
+}
+
+void XsdComplexType::OpenContent::setWildcard(const XsdWildcard::Ptr &wildcard)
+{
+ m_wildcard = wildcard;
+}
+
+XsdWildcard::Ptr XsdComplexType::OpenContent::wildcard() const
+{
+ return m_wildcard;
+}
+
+void XsdComplexType::ContentType::setVariety(Variety variety)
+{
+ m_variety = variety;
+}
+
+XsdComplexType::ContentType::Variety XsdComplexType::ContentType::variety() const
+{
+ return m_variety;
+}
+
+void XsdComplexType::ContentType::setParticle(const XsdParticle::Ptr &particle)
+{
+ m_particle = particle;
+}
+
+XsdParticle::Ptr XsdComplexType::ContentType::particle() const
+{
+ return m_particle;
+}
+
+void XsdComplexType::ContentType::setOpenContent(const OpenContent::Ptr &content)
+{
+ m_openContent = content;
+}
+
+XsdComplexType::OpenContent::Ptr XsdComplexType::ContentType::openContent() const
+{
+ return m_openContent;
+}
+
+void XsdComplexType::ContentType::setSimpleType(const AnySimpleType::Ptr &type)
+{
+ m_simpleType = type;
+}
+
+AnySimpleType::Ptr XsdComplexType::ContentType::simpleType() const
+{
+ return m_simpleType;
+}
+
+
+XsdComplexType::XsdComplexType()
+ : m_isAbstract(false)
+ , m_contentType(new ContentType())
+{
+ m_contentType->setVariety(ContentType::Empty);
+}
+
+void XsdComplexType::setIsAbstract(bool abstract)
+{
+ m_isAbstract = abstract;
+}
+
+bool XsdComplexType::isAbstract() const
+{
+ return m_isAbstract;
+}
+
+QString XsdComplexType::displayName(const NamePool::Ptr &np) const
+{
+ return np->displayName(name(np));
+}
+
+void XsdComplexType::setWxsSuperType(const SchemaType::Ptr &type)
+{
+ m_superType = type;
+}
+
+SchemaType::Ptr XsdComplexType::wxsSuperType() const
+{
+ return m_superType;
+}
+
+void XsdComplexType::setContext(const NamedSchemaComponent::Ptr &component)
+{
+ m_context = component;
+}
+
+NamedSchemaComponent::Ptr XsdComplexType::context() const
+{
+ return m_context;
+}
+
+void XsdComplexType::setContentType(const ContentType::Ptr &type)
+{
+ m_contentType = type;
+}
+
+XsdComplexType::ContentType::Ptr XsdComplexType::contentType() const
+{
+ return m_contentType;
+}
+
+void XsdComplexType::setAttributeUses(const XsdAttributeUse::List &attributeUses)
+{
+ m_attributeUses = attributeUses;
+}
+
+void XsdComplexType::addAttributeUse(const XsdAttributeUse::Ptr &attributeUse)
+{
+ m_attributeUses.append(attributeUse);
+}
+
+XsdAttributeUse::List XsdComplexType::attributeUses() const
+{
+ return m_attributeUses;
+}
+
+void XsdComplexType::setAttributeWildcard(const XsdWildcard::Ptr &wildcard)
+{
+ m_attributeWildcard = wildcard;
+}
+
+XsdWildcard::Ptr XsdComplexType::attributeWildcard() const
+{
+ return m_attributeWildcard;
+}
+
+XsdComplexType::TypeCategory XsdComplexType::category() const
+{
+ return ComplexType;
+}
+
+void XsdComplexType::setDerivationMethod(DerivationMethod method)
+{
+ m_derivationMethod = method;
+}
+
+XsdComplexType::DerivationMethod XsdComplexType::derivationMethod() const
+{
+ return m_derivationMethod;
+}
+
+void XsdComplexType::setProhibitedSubstitutions(const BlockingConstraints &substitutions)
+{
+ m_prohibitedSubstitutions = substitutions;
+}
+
+XsdComplexType::BlockingConstraints XsdComplexType::prohibitedSubstitutions() const
+{
+ return m_prohibitedSubstitutions;
+}
+
+void XsdComplexType::setAssertions(const XsdAssertion::List &assertions)
+{
+ m_assertions = assertions;
+}
+
+void XsdComplexType::addAssertion(const XsdAssertion::Ptr &assertion)
+{
+ m_assertions.append(assertion);
+}
+
+XsdAssertion::List XsdComplexType::assertions() const
+{
+ return m_assertions;
+}
+
+bool XsdComplexType::isDefinedBySchema() const
+{
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdcomplextype_p.h b/src/xmlpatterns/schema/qxsdcomplextype_p.h
new file mode 100644
index 0000000..ad04f99
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdcomplextype_p.h
@@ -0,0 +1,404 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdComplexType_H
+#define Patternist_XsdComplexType_H
+
+#include "qanytype_p.h"
+#include "qxsdassertion_p.h"
+#include "qxsdattributeuse_p.h"
+#include "qxsdparticle_p.h"
+#include "qxsdsimpletype_p.h"
+#include "qxsduserschematype_p.h"
+#include "qxsdwildcard_p.h"
+
+#include <QtCore/QSet>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD complexType object.
+ *
+ * This class represents the <em>complexType</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#Complex_Type_Definitions">here</a>.
+ *
+ * It contains information from either a top-level complex type declaration (as child of a <em>schema</em> object)
+ * or a local complex type declaration (as descendant of an <em>element</em> object).
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSComplexType">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdComplexType : public XsdUserSchemaType<AnyType>
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdComplexType> Ptr;
+
+ /**
+ * @short Describes the open content object of a complex type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ct-open_content">Open Content Definition</a>
+ */
+ class OpenContent : public QSharedData, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<OpenContent> Ptr;
+
+ /**
+ * Describes the mode of the open content.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#oc-mode">Mode Definition</a>
+ */
+ enum Mode
+ {
+ None,
+ Interleave,
+ Suffix
+ };
+
+ /**
+ * Sets the @p mode of the open content.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#oc-mode">Mode Definition</a>
+ */
+ void setMode(Mode mode);
+
+ /**
+ * Returns the mode of the open content.
+ */
+ Mode mode() const;
+
+ /**
+ * Sets the @p wildcard of the open content.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#oc-wildcard">Wildcard Definition</a>
+ */
+ void setWildcard(const XsdWildcard::Ptr &wildcard);
+
+ /**
+ * Returns the wildcard of the open content.
+ */
+ XsdWildcard::Ptr wildcard() const;
+
+ private:
+ Mode m_mode;
+ XsdWildcard::Ptr m_wildcard;
+ };
+
+ /**
+ * @short Describes the content type of a complex type.
+ */
+ class ContentType : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<ContentType> Ptr;
+
+ /**
+ * Describes the variety of the content type.
+ */
+ enum Variety
+ {
+ Empty = 0, ///< The complex type has no further content.
+ Simple, ///< The complex type has only simple type content (e.g. text, number etc.)
+ ElementOnly, ///< The complex type has further elements or attributes but no text as content.
+ Mixed ///< The complex type has further elements or attributes and text as content.
+ };
+
+ /**
+ * Sets the @p variety of the content type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ct-variety">Variety Definition</a>
+ */
+ void setVariety(Variety variety);
+
+ /**
+ * Returns the variety of the content type.
+ */
+ Variety variety() const;
+
+ /**
+ * Sets the @p particle object of the content type.
+ *
+ * The content type has only a particle object if
+ * its variety is ElementOnly or Mixed.
+ *
+ * @see XsdParticle
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ct-particle">Particle Declaration</a>
+ */
+ void setParticle(const XsdParticle::Ptr &particle);
+
+ /**
+ * Returns the particle object of the content type,
+ * or an empty pointer if its variety is neither
+ * ElementOnly nor Mixed.
+ */
+ XsdParticle::Ptr particle() const;
+
+ /**
+ * Sets the open @p content object of the content type.
+ *
+ * The content type has only an open content object if
+ * its variety is ElementOnly or Mixed.
+ *
+ * @see OpenContent
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ct-open_content">Open Content Declaration</a>
+ */
+ void setOpenContent(const OpenContent::Ptr &content);
+
+ /**
+ * Returns the open content object of the content type,
+ * or an empty pointer if its variety is neither
+ * ElementOnly nor Mixed.
+ */
+ OpenContent::Ptr openContent() const;
+
+ /**
+ * Sets the simple @p type object of the content type.
+ *
+ * The content type has only a simple type object if
+ * its variety is Simple.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ct-simple_type_definition">Simple Type Definition</a>
+ */
+ void setSimpleType(const AnySimpleType::Ptr &type);
+
+ /**
+ * Returns the simple type object of the content type,
+ * or an empty pointer if its variety is not Simple.
+ */
+ AnySimpleType::Ptr simpleType() const;
+
+ private:
+ Variety m_variety;
+ XsdParticle::Ptr m_particle;
+ OpenContent::Ptr m_openContent;
+ XsdSimpleType::Ptr m_simpleType;
+ };
+
+
+ /**
+ * Creates a complex type object with empty content.
+ */
+ XsdComplexType();
+
+ /**
+ * Destroys the complex type object.
+ */
+ ~XsdComplexType() {};
+
+ /**
+ * Returns the display name of the complex type.
+ *
+ * The display name can be used to show the type name
+ * to the user.
+ *
+ * @param namePool The name pool where the type name is stored in.
+ */
+ virtual QString displayName(const NamePool::Ptr &namePool) const;
+
+ /**
+ * Sets the base type of the complex type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ctd-base_type_definition">Base Type Definition</a>
+ */
+ void setWxsSuperType(const SchemaType::Ptr &type);
+
+ /**
+ * Returns the base type of the complex type.
+ */
+ virtual SchemaType::Ptr wxsSuperType() const;
+
+ /**
+ * Sets the context @p component of the complex type.
+ *
+ * The component is either an element declaration or a complex type definition.
+ */
+ void setContext(const NamedSchemaComponent::Ptr &component);
+
+ /**
+ * Returns the context component of the complex type.
+ */
+ NamedSchemaComponent::Ptr context() const;
+
+ /**
+ * Sets the derivation @p method of the complex type.
+ *
+ * The derivation method depends on whether the complex
+ * type object has an extension or restriction object as child.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ctd-derivation_method">Derivation Method Definition</a>
+ * @see DerivationMethod
+ */
+ void setDerivationMethod(DerivationMethod method);
+
+ /**
+ * Returns the derivation method of the complex type.
+ */
+ virtual DerivationMethod derivationMethod() const;
+
+ /**
+ * Sets whether the complex type is @p abstract.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ctd-abstract">Abstract Definition</a>
+ */
+ void setIsAbstract(bool abstract);
+
+ /**
+ * Returns whether the complex type is abstract.
+ */
+ virtual bool isAbstract() const;
+
+ /**
+ * Sets the list of all attribute @p uses of the complex type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ctd-attribute_uses">Attribute Uses Declaration</a>
+ */
+ void setAttributeUses(const XsdAttributeUse::List &uses);
+
+ /**
+ * Adds a new attribute @p use to the complex type.
+ */
+ void addAttributeUse(const XsdAttributeUse::Ptr &use);
+
+ /**
+ * Returns the list of all attribute uses of the complex type.
+ */
+ XsdAttributeUse::List attributeUses() const;
+
+ /**
+ * Sets the attribute @p wildcard of the complex type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ctd-attribute_wildcard">Attribute Wildcard Declaration</a>
+ */
+ void setAttributeWildcard(const XsdWildcard::Ptr &wildcard);
+
+ /**
+ * Returns the attribute wildcard of the complex type.
+ */
+ XsdWildcard::Ptr attributeWildcard() const;
+
+ /**
+ * Always returns SchemaType::ComplexType
+ */
+ virtual TypeCategory category() const;
+
+ /**
+ * Sets the content @p type of the complex type.
+ *
+ * @see ContentType
+ */
+ void setContentType(const ContentType::Ptr &type);
+
+ /**
+ * Returns the content type of the complex type.
+ */
+ ContentType::Ptr contentType() const;
+
+ /**
+ * Sets the prohibited @p substitutions of the complex type.
+ *
+ * Only ExtensionConstraint and RestrictionConstraint are allowed.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ctd-prohibited_substitutions">Prohibited Substitutions Definition</a>
+ */
+ void setProhibitedSubstitutions(const BlockingConstraints &substitutions);
+
+ /**
+ * Returns the prohibited substitutions of the complex type.
+ */
+ BlockingConstraints prohibitedSubstitutions() const;
+
+ /**
+ * Sets the @p assertions of the complex type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ctd-assertions">Assertions Definition</a>
+ */
+ void setAssertions(const XsdAssertion::List &assertions);
+
+ /**
+ * Adds an @p assertion to the complex type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ctd-assertions">Assertions Definition</a>
+ */
+ void addAssertion(const XsdAssertion::Ptr &assertion);
+
+ /**
+ * Returns the assertions of the complex type.
+ */
+ XsdAssertion::List assertions() const;
+
+ /**
+ * Always returns @c true.
+ */
+ virtual bool isDefinedBySchema() const;
+
+ private:
+ SchemaType::Ptr m_superType;
+ NamedSchemaComponent::Ptr m_context;
+ DerivationMethod m_derivationMethod;
+ bool m_isAbstract;
+ XsdAttributeUse::List m_attributeUses;
+ XsdWildcard::Ptr m_attributeWildcard;
+ ContentType::Ptr m_contentType;
+ BlockingConstraints m_prohibitedSubstitutions;
+ XsdAssertion::List m_assertions;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsddocumentation.cpp b/src/xmlpatterns/schema/qxsddocumentation.cpp
new file mode 100644
index 0000000..b3e1682
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsddocumentation.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsddocumentation_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdDocumentation::XsdDocumentation()
+{
+}
+
+XsdDocumentation::~XsdDocumentation()
+{
+}
+
+void XsdDocumentation::setSource(const AnyURI::Ptr &source)
+{
+ m_source = source;
+}
+
+AnyURI::Ptr XsdDocumentation::source() const
+{
+ return m_source;
+}
+
+void XsdDocumentation::setLanguage(const DerivedString<TypeLanguage>::Ptr &language)
+{
+ m_language = language;
+}
+
+DerivedString<TypeLanguage>::Ptr XsdDocumentation::language() const
+{
+ return m_language;
+}
+
+void XsdDocumentation::setContent(const QString &content)
+{
+ m_content = content;
+}
+
+QString XsdDocumentation::content() const
+{
+ return m_content;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsddocumentation_p.h b/src/xmlpatterns/schema/qxsddocumentation_p.h
new file mode 100644
index 0000000..049ba80
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsddocumentation_p.h
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdDocumentation_H
+#define Patternist_XsdDocumentation_H
+
+#include "qanytype_p.h"
+#include "qanyuri_p.h"
+#include "qderivedstring_p.h"
+#include "qnamedschemacomponent_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD documentation object.
+ *
+ * This class represents the <em>documentation</em> component of an <em>annotation</em> object
+ * of a XML schema as described <a href="http://www.w3.org/TR/xmlschema11-1/#cAnnotations">here</a>.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdDocumentation : public NamedSchemaComponent
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdDocumentation> Ptr;
+ typedef QList<XsdDocumentation::Ptr> List;
+
+ /**
+ * Creates a new documentation object.
+ */
+ XsdDocumentation();
+
+ /**
+ * Destroys the documentation object.
+ */
+ ~XsdDocumentation();
+
+ /**
+ * Sets the @p source of the documentation.
+ *
+ * The source points to an URL that contains more
+ * information.
+ */
+ void setSource(const AnyURI::Ptr &source);
+
+ /**
+ * Returns the source of the documentation.
+ */
+ AnyURI::Ptr source() const;
+
+ /**
+ * Sets the @p language of the documentation.
+ */
+ void setLanguage(const DerivedString<TypeLanguage>::Ptr &language);
+
+ /**
+ * Returns the language of the documentation.
+ */
+ DerivedString<TypeLanguage>::Ptr language() const;
+
+ /**
+ * Sets the @p content of the documentation.
+ *
+ * The content can be of abritrary type.
+ */
+ void setContent(const QString &content);
+
+ /**
+ * Returns the content of the documentation.
+ */
+ QString content() const;
+
+ private:
+ AnyURI::Ptr m_source;
+ DerivedString<TypeLanguage>::Ptr m_language;
+ QString m_content;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdelement.cpp b/src/xmlpatterns/schema/qxsdelement.cpp
new file mode 100644
index 0000000..c907144
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdelement.cpp
@@ -0,0 +1,244 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdelement_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdElement::Scope::setVariety(Variety variety)
+{
+ m_variety = variety;
+}
+
+XsdElement::Scope::Variety XsdElement::Scope::variety() const
+{
+ return m_variety;
+}
+
+void XsdElement::Scope::setParent(const NamedSchemaComponent::Ptr &parent)
+{
+ m_parent = parent;
+}
+
+NamedSchemaComponent::Ptr XsdElement::Scope::parent() const
+{
+ return m_parent;
+}
+
+void XsdElement::ValueConstraint::setVariety(Variety variety)
+{
+ m_variety = variety;
+}
+
+XsdElement::ValueConstraint::Variety XsdElement::ValueConstraint::variety() const
+{
+ return m_variety;
+}
+
+void XsdElement::ValueConstraint::setValue(const QString &value)
+{
+ m_value = value;
+}
+
+QString XsdElement::ValueConstraint::value() const
+{
+ return m_value;
+}
+
+void XsdElement::ValueConstraint::setLexicalForm(const QString &form)
+{
+ m_lexicalForm = form;
+}
+
+QString XsdElement::ValueConstraint::lexicalForm() const
+{
+ return m_lexicalForm;
+}
+
+void XsdElement::TypeTable::addAlternative(const XsdAlternative::Ptr &alternative)
+{
+ m_alternatives.append(alternative);
+}
+
+XsdAlternative::List XsdElement::TypeTable::alternatives() const
+{
+ return m_alternatives;
+}
+
+void XsdElement::TypeTable::setDefaultTypeDefinition(const XsdAlternative::Ptr &type)
+{
+ m_defaultTypeDefinition = type;
+}
+
+XsdAlternative::Ptr XsdElement::TypeTable::defaultTypeDefinition() const
+{
+ return m_defaultTypeDefinition;
+}
+
+
+XsdElement::XsdElement()
+ : m_isAbstract(false)
+{
+}
+
+bool XsdElement::isElement() const
+{
+ return true;
+}
+
+void XsdElement::setType(const SchemaType::Ptr &type)
+{
+ m_type = type;
+}
+
+SchemaType::Ptr XsdElement::type() const
+{
+ return m_type;
+}
+
+void XsdElement::setScope(const Scope::Ptr &scope)
+{
+ m_scope = scope;
+}
+
+XsdElement::Scope::Ptr XsdElement::scope() const
+{
+ return m_scope;
+}
+
+void XsdElement::setValueConstraint(const ValueConstraint::Ptr &constraint)
+{
+ m_valueConstraint = constraint;
+}
+
+XsdElement::ValueConstraint::Ptr XsdElement::valueConstraint() const
+{
+ return m_valueConstraint;
+}
+
+void XsdElement::setTypeTable(const TypeTable::Ptr &table)
+{
+ m_typeTable = table;
+}
+
+XsdElement::TypeTable::Ptr XsdElement::typeTable() const
+{
+ return m_typeTable;
+}
+
+void XsdElement::setIsAbstract(bool abstract)
+{
+ m_isAbstract = abstract;
+}
+
+bool XsdElement::isAbstract() const
+{
+ return m_isAbstract;
+}
+
+void XsdElement::setIsNillable(bool nillable)
+{
+ m_isNillable = nillable;
+}
+
+bool XsdElement::isNillable() const
+{
+ return m_isNillable;
+}
+
+void XsdElement::setDisallowedSubstitutions(const BlockingConstraints &substitutions)
+{
+ m_disallowedSubstitutions = substitutions;
+}
+
+XsdElement::BlockingConstraints XsdElement::disallowedSubstitutions() const
+{
+ return m_disallowedSubstitutions;
+}
+
+void XsdElement::setSubstitutionGroupExclusions(const SchemaType::DerivationConstraints &exclusions)
+{
+ m_substitutionGroupExclusions = exclusions;
+}
+
+SchemaType::DerivationConstraints XsdElement::substitutionGroupExclusions() const
+{
+ return m_substitutionGroupExclusions;
+}
+
+void XsdElement::setIdentityConstraints(const XsdIdentityConstraint::List &constraints)
+{
+ m_identityConstraints = constraints;
+}
+
+void XsdElement::addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint)
+{
+ m_identityConstraints.append(constraint);
+}
+
+XsdIdentityConstraint::List XsdElement::identityConstraints() const
+{
+ return m_identityConstraints;
+}
+
+void XsdElement::setSubstitutionGroupAffiliations(const XsdElement::List &affiliations)
+{
+ m_substitutionGroupAffiliations = affiliations;
+}
+
+XsdElement::List XsdElement::substitutionGroupAffiliations() const
+{
+ return m_substitutionGroupAffiliations;
+}
+
+void XsdElement::addSubstitutionGroup(const XsdElement::Ptr &element)
+{
+ m_substitutionGroups.insert(element);
+}
+
+XsdElement::List XsdElement::substitutionGroups() const
+{
+ return m_substitutionGroups.toList();
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdelement_p.h b/src/xmlpatterns/schema/qxsdelement_p.h
new file mode 100644
index 0000000..304e888
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdelement_p.h
@@ -0,0 +1,403 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdElement_H
+#define Patternist_XsdElement_H
+
+#include "qschemacomponent_p.h"
+#include "qschematype_p.h"
+#include "qxsdalternative_p.h"
+#include "qxsdidentityconstraint_p.h"
+#include "qxsdcomplextype_p.h"
+
+#include <QtCore/QList>
+#include <QtCore/QSet>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD element object.
+ *
+ * This class represents the <em>element</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#cElement_Declarations">here</a>.
+ *
+ * It contains information from either a top-level element declaration (as child of a <em>schema</em> object)
+ * or a local element declaration (as descendant of an <em>complexType</em> object).
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSElementDecl">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdElement : public XsdTerm
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdElement> Ptr;
+ typedef QList<XsdElement::Ptr> List;
+
+
+ /**
+ * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#ed-value_constraint">constraint type</a> of the element.
+ */
+ enum ConstraintType
+ {
+ NoneConstraint, ///< The value of the element has no constraints.
+ DefaultConstraint, ///< The element has a default value set.
+ FixedConstraint ///< The element has a fixed value set.
+ };
+
+ /**
+ * Describes the scope of an element.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#sc_e">Scope Definition</a>
+ */
+ class Scope : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<Scope> Ptr;
+
+ /**
+ * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#ad-scope">scope</a> of an attribute.
+ */
+ enum Variety
+ {
+ Global, ///< The element is defined globally as child of the <em>schema</em> object.
+ Local ///< The element is defined locally as child of a complex type or model group definition.
+ };
+
+ /**
+ * Sets the @p variety of the element scope.
+ */
+ void setVariety(Variety variety);
+
+ /**
+ * Returns the variety of the element scope.
+ */
+ Variety variety() const;
+
+ /**
+ * Sets the @p parent complex type or model group definition of the element scope.
+ */
+ void setParent(const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * Returns the parent complex type or model group definition of the element scope.
+ */
+ NamedSchemaComponent::Ptr parent() const;
+
+ private:
+ Variety m_variety;
+ NamedSchemaComponent::Ptr m_parent;
+ };
+
+ /**
+ * Describes a type table of an element.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#tt">Type Table Definition</a>
+ */
+ class TypeTable : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<TypeTable> Ptr;
+
+ /**
+ * Adds an @p alternative to the type table.
+ */
+ void addAlternative(const XsdAlternative::Ptr &alternative);
+
+ /**
+ * Returns the alternatives of the type table.
+ */
+ XsdAlternative::List alternatives() const;
+
+ /**
+ * Sets the default @p type definition.
+ */
+ void setDefaultTypeDefinition(const XsdAlternative::Ptr &type);
+
+ /**
+ * Returns the default type definition.
+ */
+ XsdAlternative::Ptr defaultTypeDefinition() const;
+
+ private:
+ XsdAlternative::List m_alternatives;
+ XsdAlternative::Ptr m_defaultTypeDefinition;
+ };
+
+
+ /**
+ * Describes the value constraint of an element.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_e">Value Constraint Definition</a>
+ */
+ class ValueConstraint : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<ValueConstraint> Ptr;
+
+ /**
+ * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#ed-value_constraint">value constraint</a> of an element.
+ */
+ enum Variety
+ {
+ Default, ///< The element has a default value set.
+ Fixed ///< The element has a fixed value set.
+ };
+
+ /**
+ * Sets the @p variety of the element value constraint.
+ */
+ void setVariety(Variety variety);
+
+ /**
+ * Returns the variety of the element value constraint.
+ */
+ Variety variety() const;
+
+ /**
+ * Sets the @p value of the constraint.
+ */
+ void setValue(const QString &value);
+
+ /**
+ * Returns the value of the constraint.
+ */
+ QString value() const;
+
+ /**
+ * Sets the lexical @p form of the constraint.
+ */
+ void setLexicalForm(const QString &form);
+
+ /**
+ * Returns the lexical form of the constraint.
+ */
+ QString lexicalForm() const;
+
+ private:
+ Variety m_variety;
+ QString m_value;
+ QString m_lexicalForm;
+ };
+
+ /**
+ * Creates a new element object.
+ */
+ XsdElement();
+
+ /**
+ * Always returns @c true, used to avoid dynamic casts.
+ */
+ virtual bool isElement() const;
+
+ /**
+ * Sets the @p type of the element.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-type_definition">Type Definition</a>
+ */
+ void setType(const SchemaType::Ptr &type);
+
+ /**
+ * Returns the type of the element.
+ */
+ SchemaType::Ptr type() const;
+
+ /**
+ * Sets the @p scope of the element.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-scope">Scope Definition</a>
+ */
+ void setScope(const Scope::Ptr &scope);
+
+ /**
+ * Returns the scope of the element.
+ */
+ Scope::Ptr scope() const;
+
+ /**
+ * Sets the value @p constraint of the element.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-value_constraint">Value Constraint Definition</a>
+ */
+ void setValueConstraint(const ValueConstraint::Ptr &constraint);
+
+ /**
+ * Returns the value constraint of the element.
+ */
+ ValueConstraint::Ptr valueConstraint() const;
+
+ /**
+ * Sets the type table of the element.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-type_table">Type Table Definition</a>
+ */
+ void setTypeTable(const TypeTable::Ptr &table);
+
+ /**
+ * Returns the type table of the element.
+ */
+ TypeTable::Ptr typeTable() const;
+
+ /**
+ * Sets whether the element is @p abstract.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-abstract">Abstract Definition</a>
+ */
+ void setIsAbstract(bool abstract);
+
+ /**
+ * Returns whether the element is abstract.
+ */
+ bool isAbstract() const;
+
+ /**
+ * Sets whether the element is @p nillable.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-nillable">Nillable Definition</a>
+ */
+ void setIsNillable(bool nillable);
+
+ /**
+ * Returns whether the element is nillable.
+ */
+ bool isNillable() const;
+
+ /**
+ * Sets the disallowed @p substitutions of the element.
+ *
+ * Only ExtensionConstraint, RestrictionConstraint and SubstitutionConstraint are allowed.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-disallowed_substitutions">Disallowed Substitutions Definition</a>
+ */
+ void setDisallowedSubstitutions(const BlockingConstraints &substitutions);
+
+ /**
+ * Returns the disallowed substitutions of the element.
+ */
+ BlockingConstraints disallowedSubstitutions() const;
+
+ /**
+ * Sets the substitution group @p exclusions of the element.
+ *
+ * Only SchemaType::ExtensionConstraint and SchemaType::RestrictionConstraint are allowed.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-substitution_group_exclusions">Substitution Group Exclusions Definition</a>
+ */
+ void setSubstitutionGroupExclusions(const SchemaType::DerivationConstraints &exclusions);
+
+ /**
+ * Returns the substitution group exclusions of the element.
+ */
+ SchemaType::DerivationConstraints substitutionGroupExclusions() const;
+
+ /**
+ * Sets the identity @p constraints of the element.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-identity-constraint_definitions">Identity Constraint Definition</a>
+ */
+ void setIdentityConstraints(const XsdIdentityConstraint::List &constraints);
+
+ /**
+ * Adds a new identity @p constraint to the element.
+ */
+ void addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint);
+
+ /**
+ * Returns a list of all identity constraints of the element.
+ */
+ XsdIdentityConstraint::List identityConstraints() const;
+
+ /**
+ * Sets the substitution group @p affiliations of the element.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ed-substituion_group_affiliations">Substitution Group Affiliations</a>
+ */
+ void setSubstitutionGroupAffiliations(const XsdElement::List &affiliations);
+
+ /**
+ * Returns the substitution group affiliations of the element.
+ */
+ XsdElement::List substitutionGroupAffiliations() const;
+
+ /**
+ * Adds a substitution group to the element.
+ */
+ void addSubstitutionGroup(const XsdElement::Ptr &elements);
+
+ /**
+ * Returns the substitution groups of the element.
+ */
+ XsdElement::List substitutionGroups() const;
+
+ private:
+ SchemaType::Ptr m_type;
+ Scope::Ptr m_scope;
+ ValueConstraint::Ptr m_valueConstraint;
+ TypeTable::Ptr m_typeTable;
+ bool m_isAbstract;
+ bool m_isNillable;
+ BlockingConstraints m_disallowedSubstitutions;
+ SchemaType::DerivationConstraints m_substitutionGroupExclusions;
+ XsdIdentityConstraint::List m_identityConstraints;
+ XsdElement::List m_substitutionGroupAffiliations;
+ QSet<XsdElement::Ptr> m_substitutionGroups;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdfacet.cpp b/src/xmlpatterns/schema/qxsdfacet.cpp
new file mode 100644
index 0000000..7bbbc9d
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdfacet.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdfacet_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdFacet::XsdFacet()
+ : m_type(None)
+{
+}
+
+void XsdFacet::setType(Type type)
+{
+ m_type = type;
+}
+
+XsdFacet::Type XsdFacet::type() const
+{
+ return m_type;
+}
+
+void XsdFacet::setValue(const AtomicValue::Ptr &value)
+{
+ m_value = value;
+}
+
+AtomicValue::Ptr XsdFacet::value() const
+{
+ return m_value;
+}
+
+void XsdFacet::setMultiValue(const AtomicValue::List &value)
+{
+ m_multiValue = value;
+}
+
+AtomicValue::List XsdFacet::multiValue() const
+{
+ return m_multiValue;
+}
+
+void XsdFacet::setAssertions(const XsdAssertion::List &assertions)
+{
+ m_assertions = assertions;
+}
+
+XsdAssertion::List XsdFacet::assertions() const
+{
+ return m_assertions;
+}
+
+void XsdFacet::setFixed(bool fixed)
+{
+ m_fixed = fixed;
+}
+
+bool XsdFacet::fixed() const
+{
+ return m_fixed;
+}
+
+QString XsdFacet::typeName(Type type)
+{
+ switch (type) {
+ case Length: return QLatin1String("length"); break;
+ case MinimumLength: return QLatin1String("minLength"); break;
+ case MaximumLength: return QLatin1String("maxLength"); break;
+ case Pattern: return QLatin1String("pattern"); break;
+ case WhiteSpace: return QLatin1String("whiteSpace"); break;
+ case MaximumInclusive: return QLatin1String("maxInclusive"); break;
+ case MaximumExclusive: return QLatin1String("maxExclusive"); break;
+ case MinimumInclusive: return QLatin1String("minInclusive"); break;
+ case MinimumExclusive: return QLatin1String("minExclusive"); break;
+ case TotalDigits: return QLatin1String("totalDigits"); break;
+ case FractionDigits: return QLatin1String("fractionDigits"); break;
+ case Enumeration: return QLatin1String("enumeration"); break;
+ case Assertion: return QLatin1String("assertion"); break;
+ case None: // fall through
+ default: return QLatin1String("none"); break;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdfacet_p.h b/src/xmlpatterns/schema/qxsdfacet_p.h
new file mode 100644
index 0000000..5d16b4e
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdfacet_p.h
@@ -0,0 +1,213 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdFacet_H
+#define Patternist_XsdFacet_H
+
+#include "qitem_p.h"
+#include "qnamedschemacomponent_p.h"
+#include "qxsdannotated_p.h"
+#include "qxsdassertion_p.h"
+
+#include <QtCore/QList>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD facet object.
+ *
+ * This class represents one of the following XML schema objects:
+ *
+ * <ul>
+ * <li><em>length</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-length">Definition</a></li>
+ * <li><em>minLength</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-minLength">Definition</a></li>
+ * <li><em>maxLength</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-maxLength">Definition</a></li>
+ * <li><em>pattern</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-pattern">Definition</a></li>
+ * <li><em>whiteSpace</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-whiteSpace">Definition</a></li>
+ * <li><em>maxInclusive</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-maxInclusive">Definition</a></li>
+ * <li><em>maxExclusive</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-maxExclusive">Definition</a></li>
+ * <li><em>minInclusive</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-minInclusive">Definition</a></li>
+ * <li><em>minExclusive</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-minExclusive">Definition</a></li>
+ * <li><em>totalDigits</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-totalDigits">Definition</a></li>
+ * <li><em>fractionDigits</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-fractionDigits">Definition</a></li>
+ * <li><em>enumeration</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-enumeration">Definition</a></li>
+ * <li><em>assertion</em> <a href="http://www.w3.org/TR/xmlschema-2/#rf-assertion">Definition</a></li>
+ * </ul>
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSFacet">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdFacet : public NamedSchemaComponent, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdFacet> Ptr;
+
+ /**
+ * Describes the type of the facet.
+ */
+ enum Type
+ {
+ None = 0, ///< An invalid facet.
+ Length = 1 << 0, ///< Match the exact length (<a href="http://www.w3.org/TR/xmlschema-2/#rf-length">Length Definition</a>)
+ MinimumLength = 1 << 1, ///< Match the minimum length (<a href="http://www.w3.org/TR/xmlschema-2/#rf-minLength">Minimum Length Definition</a>)
+ MaximumLength = 1 << 2, ///< Match the maximum length (<a href="http://www.w3.org/TR/xmlschema-2/#rf-maxLength">Maximum Length Definition</a>)
+ Pattern = 1 << 3, ///< Match a regular expression (<a href="http://www.w3.org/TR/xmlschema-2/#rf-pattern">Pattern Definition</a>)
+ WhiteSpace = 1 << 4, ///< Match a whitespace rule (<a href="http://www.w3.org/TR/xmlschema-2/#rf-whiteSpace">White Space Definition</a>)
+ MaximumInclusive = 1 << 5, ///< Match a maximum inclusive (<a href="http://www.w3.org/TR/xmlschema-2/#rf-maxInclusive">Maximum Inclusive Definition</a>)
+ MaximumExclusive = 1 << 6, ///< Match a maximum exclusive (<a href="http://www.w3.org/TR/xmlschema-2/#rf-maxExclusive">Maximum Exclusive Definition</a>)
+ MinimumInclusive = 1 << 7, ///< Match a minimum inclusive (<a href="http://www.w3.org/TR/xmlschema-2/#rf-minInclusive">Minimum Inclusive Definition</a>)
+ MinimumExclusive = 1 << 8, ///< Match a minimum exclusive (<a href="http://www.w3.org/TR/xmlschema-2/#rf-minExclusive">Minimum Exclusive Definition</a>)
+ TotalDigits = 1 << 9, ///< Match some integer digits (<a href="http://www.w3.org/TR/xmlschema-2/#rf-totalDigits">Total Digits Definition</a>)
+ FractionDigits = 1 << 10, ///< Match some double digits (<a href="http://www.w3.org/TR/xmlschema-2/#rf-fractionDigits">Fraction Digits Definition</a>)
+ Enumeration = 1 << 11, ///< Match an enumeration (<a href="http://www.w3.org/TR/xmlschema-2/#rf-enumeration">Enumeration Definition</a>)
+ Assertion = 1 << 12, ///< Match an assertion (<a href="http://www.w3.org/TR/xmlschema-2/#rf-assertion">Assertion Definition</a>)
+ };
+ typedef QHash<XsdFacet::Type, XsdFacet::Ptr> Hash;
+ typedef QHashIterator<XsdFacet::Type, XsdFacet::Ptr> HashIterator;
+
+ /**
+ * Creates a new facet object of type None.
+ */
+ XsdFacet();
+
+ /**
+ * Sets the @p type of the facet.
+ *
+ * @see Type
+ */
+ void setType(Type type);
+
+ /**
+ * Returns the type of the facet.
+ */
+ Type type() const;
+
+ /**
+ * Sets the @p value of the facet.
+ *
+ * Depending on the type of the facet the
+ * value can be a string, interger, double etc.
+ *
+ * @note This method should be used for all types of facets
+ * except Pattern, Enumeration and Assertion.
+ */
+ void setValue(const AtomicValue::Ptr &value);
+
+ /**
+ * Returns the value of the facet or an empty pointer if facet
+ * type is Pattern, Enumeration or Assertion.
+ */
+ AtomicValue::Ptr value() const;
+
+ /**
+ * Sets the @p value of the facet.
+ *
+ * @note This method should be used for if the type of the
+ * facet is Pattern or Enumeration.
+ */
+ void setMultiValue(const AtomicValue::List &value);
+
+ /**
+ * Returns the value of the facet or an empty pointer if facet
+ * type is not of type Pattern or Enumeration.
+ */
+ AtomicValue::List multiValue() const;
+
+ /**
+ * Sets the @p assertions of the facet.
+ *
+ * @note This method should be used if the type of the
+ * facet is Assertion.
+ */
+ void setAssertions(const XsdAssertion::List &assertions);
+
+ /**
+ * Returns the assertions of the facet or an empty pointer if facet
+ * type is not of type Assertion.
+ */
+ XsdAssertion::List assertions() const;
+
+ /**
+ * Sets whether the facet is @p fixed.
+ *
+ * All facets except pattern, enumeration and assertion can be fixed.
+ */
+ void setFixed(bool fixed);
+
+ /**
+ * Returns whether the facet is fixed.
+ */
+ bool fixed() const;
+
+ /**
+ * Returns the textual description of the facet @p type.
+ */
+ static QString typeName(Type type);
+
+ private:
+ Type m_type;
+ AtomicValue::Ptr m_value;
+ AtomicValue::List m_multiValue;
+ XsdAssertion::List m_assertions;
+ bool m_fixed;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdidcache.cpp b/src/xmlpatterns/schema/qxsdidcache.cpp
new file mode 100644
index 0000000..25788c8
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdidcache.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdidcache_p.h"
+
+#include <QtCore/QReadLocker>
+#include <QtCore/QWriteLocker>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdIdCache::addId(const QString &id)
+{
+ const QWriteLocker locker(&m_lock);
+ Q_ASSERT(!m_ids.contains(id));
+
+ m_ids.insert(id);
+}
+
+bool XsdIdCache::hasId(const QString &id) const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_ids.contains(id);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdirectionrecognizer_p.h b/src/xmlpatterns/schema/qxsdidcache_p.h
index 12307c6..dae967e 100644
--- a/src/gui/kernel/qdirectionrecognizer_p.h
+++ b/src/xmlpatterns/schema/qxsdidcache_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,9 +39,6 @@
**
****************************************************************************/
-#ifndef QDIRECTIONRECOGNIZER_P_H
-#define QDIRECTIONRECOGNIZER_P_H
-
//
// W A R N I N G
// -------------
@@ -51,55 +48,52 @@
// version without notice, or even be removed.
//
// We mean it.
-//
-#include "qpoint.h"
-#include "qlist.h"
-
-QT_BEGIN_NAMESPACE
+#ifndef Patternist_XsdIdCache_H
+#define Patternist_XsdIdCache_H
-struct Direction
-{
- Qt::DirectionType direction;
- QPoint point;
+#include "qschemacomponent_p.h"
- Direction(Qt::DirectionType dir, const QPoint &pt)
- : direction(dir), point(pt) { }
- Direction()
- : direction(Qt::NoDirection) { }
+#include <QtCore/QExplicitlySharedDataPointer>
+#include <QtCore/QReadWriteLock>
+#include <QtCore/QSet>
+#include <QtCore/QString>
- inline bool isEmpty() const { return direction == Qt::NoDirection; }
- inline bool isNull() const { return direction == Qt::NoDirection; }
-};
+QT_BEGIN_HEADER
-typedef QList<Direction> DirectionList;
+QT_BEGIN_NAMESPACE
-class QDirectionSimpleRecognizer
+namespace QPatternist
{
-public:
- QDirectionSimpleRecognizer();
- Direction addPosition(const QPoint &pos);
- DirectionList getDirections() const;
- void reset();
+ /**
+ * @short Helper class for keeping track of all existing IDs in a schema.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdIdCache : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdIdCache> Ptr;
-private:
- QPoint lastPoint;
- DirectionList directions;
-};
+ /**
+ * Adds an @p id to the id cache.
+ */
+ void addId(const QString &id);
-class QDirectionDiagonalRecognizer
-{
-public:
- QDirectionDiagonalRecognizer();
- Direction addPosition(const QPoint &pos);
- DirectionList getDirections() const;
- void reset();
+ /**
+ * Returns whether the id cache contains the given @p id already.
+ */
+ bool hasId(const QString &id) const;
-private:
- QPoint lastPoint;
- DirectionList directions;
-};
+ private:
+ QSet<QString> m_ids;
+ mutable QReadWriteLock m_lock;
+ };
+}
QT_END_NAMESPACE
-#endif // QDIRECTIONRECOGNIZER_P_H
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdidchelper.cpp b/src/xmlpatterns/schema/qxsdidchelper.cpp
new file mode 100644
index 0000000..a7fa00d
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdidchelper.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdidchelper_p.h"
+
+#include "qderivedstring_p.h"
+#include "qxsdschemahelper_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+FieldNode::FieldNode()
+{
+}
+
+FieldNode::FieldNode(const QXmlItem &item, const QString &data, const SchemaType::Ptr &type)
+ : m_item(item)
+ , m_data(data)
+ , m_type(type)
+{
+}
+
+bool FieldNode::isEmpty() const
+{
+ return m_item.isNull();
+}
+
+bool FieldNode::isEqualTo(const FieldNode &other, const NamePool::Ptr &namePool, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const
+{
+ if (m_type != other.m_type)
+ return false;
+
+ const DerivedString<TypeString>::Ptr string = DerivedString<TypeString>::fromLexical(namePool, m_data);
+ const DerivedString<TypeString>::Ptr otherString = DerivedString<TypeString>::fromLexical(namePool, other.m_data);
+
+ return XsdSchemaHelper::constructAndCompare(string, AtomicComparator::OperatorEqual, otherString, m_type, context, reflection);
+}
+
+QXmlItem FieldNode::item() const
+{
+ return m_item;
+}
+
+TargetNode::TargetNode(const QXmlItem &item)
+ : m_item(item)
+{
+}
+
+QXmlItem TargetNode::item() const
+{
+ return m_item;
+}
+
+QVector<QXmlItem> TargetNode::fieldItems() const
+{
+ QVector<QXmlItem> items;
+
+ for (int i = 0; i < m_fields.count(); ++i)
+ items.append(m_fields.at(i).item());
+
+ return items;
+}
+
+int TargetNode::emptyFieldsCount() const
+{
+ int counter = 0;
+ for (int i = 0; i < m_fields.count(); ++i) {
+ if (m_fields.at(i).isEmpty())
+ ++counter;
+ }
+
+ return counter;
+}
+
+bool TargetNode::fieldsAreEqual(const TargetNode &other, const NamePool::Ptr &namePool, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const
+{
+ if (m_fields.count() != other.m_fields.count())
+ return false;
+
+ for (int i = 0; i < m_fields.count(); ++i) {
+ if (!m_fields.at(i).isEqualTo(other.m_fields.at(i), namePool, context, reflection))
+ return false;
+ }
+
+ return true;
+}
+
+void TargetNode::addField(const QXmlItem &item, const QString &data, const SchemaType::Ptr &type)
+{
+ m_fields.append(FieldNode(item, data, type));
+}
+
+bool TargetNode::operator==(const TargetNode &other) const
+{
+ return (m_item.toNodeModelIndex() == other.m_item.toNodeModelIndex());
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdidchelper_p.h b/src/xmlpatterns/schema/qxsdidchelper_p.h
new file mode 100644
index 0000000..ee593b8
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdidchelper_p.h
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdIdcHelper_H
+#define Patternist_XsdIdcHelper_H
+
+#include "qreportcontext_p.h"
+#include "qschematype_p.h"
+
+#include <QtXmlPatterns/QXmlItem>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short A helper class for validating identity constraints.
+ *
+ * This class represents a field node from the key-sequence as defined in
+ * the validation rules at http://www.w3.org/TR/xmlschema11-1/#d0e32243.
+ */
+ class FieldNode
+ {
+ public:
+ /**
+ * Creates an empty field node.
+ */
+ FieldNode();
+
+ /**
+ * Creates a field node that is bound to a xml node.
+ *
+ * @param item The xml node the field is bound to.
+ * @param data The string content of that field.
+ * @param type The type that is bound to that field.
+ */
+ FieldNode(const QXmlItem &item, const QString &data, const SchemaType::Ptr &type);
+
+ /**
+ * Returns whether this field is empty.
+ *
+ * A field can be empty, if the xpath expression selects an absent attribute
+ * or element.
+ */
+ bool isEmpty() const;
+
+ /**
+ * Returns whether this field is equal to the @p other field.
+ *
+ * Equal means that both have the same type and there content is equal in the
+ * types value space.
+ */
+ bool isEqualTo(const FieldNode &other, const NamePool::Ptr &namePool, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const;
+
+ /**
+ * Returns the xml node item the field is bound to.
+ */
+ QXmlItem item() const;
+
+ private:
+ QXmlItem m_item;
+ QString m_data;
+ SchemaType::Ptr m_type;
+ };
+
+ /**
+ * @short A helper class for validating identity constraints.
+ *
+ * This class represents a target or qualified node from the target or qualified
+ * node set as defined in the validation rules at http://www.w3.org/TR/xmlschema11-1/#d0e32243.
+ *
+ * A target node is part of the qualified node set, if all of its fields are not empty.
+ */
+ class TargetNode
+ {
+ public:
+ /**
+ * Defines a set of target nodes.
+ */
+ typedef QSet<TargetNode> Set;
+
+ /**
+ * Creates a new target node that is bound to the xml node @p item.
+ */
+ explicit TargetNode(const QXmlItem &item);
+
+ /**
+ * Returns the xml node item the target node is bound to.
+ */
+ QXmlItem item() const;
+
+ /**
+ * Returns all xml node items, the fields of that target node are bound to.
+ */
+ QVector<QXmlItem> fieldItems() const;
+
+ /**
+ * Returns the number of fields that are empty.
+ */
+ int emptyFieldsCount() const;
+
+ /**
+ * Returns whether the target node has the same fields as the @p other target node.
+ */
+ bool fieldsAreEqual(const TargetNode &other, const NamePool::Ptr &namePool, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const;
+
+ /**
+ * Adds a new field to the target node with the given values.
+ */
+ void addField(const QXmlItem &item, const QString &data, const SchemaType::Ptr &type);
+
+ /**
+ * Returns whether the target node is equal to the @p other target node.
+ */
+ bool operator==(const TargetNode &other) const;
+
+ private:
+ QXmlItem m_item;
+ QVector<FieldNode> m_fields;
+ };
+
+ /**
+ * Creates a hash value for the given target @p node.
+ */
+ inline uint qHash(const QPatternist::TargetNode &node)
+ {
+ return qHash(node.item().toNodeModelIndex());
+ }
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdidentityconstraint.cpp b/src/xmlpatterns/schema/qxsdidentityconstraint.cpp
new file mode 100644
index 0000000..9d0207c
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdidentityconstraint.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdidentityconstraint_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdIdentityConstraint::setCategory(Category category)
+{
+ m_category = category;
+}
+
+XsdIdentityConstraint::Category XsdIdentityConstraint::category() const
+{
+ return m_category;
+}
+
+void XsdIdentityConstraint::setSelector(const XsdXPathExpression::Ptr &selector)
+{
+ m_selector = selector;
+}
+
+XsdXPathExpression::Ptr XsdIdentityConstraint::selector() const
+{
+ return m_selector;
+}
+
+void XsdIdentityConstraint::setFields(const XsdXPathExpression::List &fields)
+{
+ m_fields = fields;
+}
+
+void XsdIdentityConstraint::addField(const XsdXPathExpression::Ptr &field)
+{
+ m_fields.append(field);
+}
+
+XsdXPathExpression::List XsdIdentityConstraint::fields() const
+{
+ return m_fields;
+}
+
+void XsdIdentityConstraint::setReferencedKey(const XsdIdentityConstraint::Ptr &referencedKey)
+{
+ m_referencedKey = referencedKey;
+}
+
+XsdIdentityConstraint::Ptr XsdIdentityConstraint::referencedKey() const
+{
+ return m_referencedKey;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdidentityconstraint_p.h b/src/xmlpatterns/schema/qxsdidentityconstraint_p.h
new file mode 100644
index 0000000..b6bb3d0
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdidentityconstraint_p.h
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdIdentityConstraint_H
+#define Patternist_XsdIdentityConstraint_H
+
+#include "qnamedschemacomponent_p.h"
+#include "qxsdannotated_p.h"
+#include "qxsdxpathexpression_p.h"
+
+#include <QtCore/QStringList>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD identity constraint object.
+ *
+ * This class represents the <em>identity constraint</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#cIdentity-constraint_Definitions">here</a>.
+ *
+ * It contains information from either a <em>key</em> object, a <em>keyref</em> object or an
+ * <em>unique</em> object.
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSIdentityConstraint">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdIdentityConstraint : public NamedSchemaComponent, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdIdentityConstraint> Ptr;
+ typedef QList<XsdIdentityConstraint::Ptr> List;
+
+ /**
+ * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#icd-identity-constraint_category">category</a> of the identity constraint.
+ */
+ enum Category
+ {
+ Key = 1, ///< The constraint is a key constraint
+ KeyReference, ///< The constraint is a keyref constraint
+ Unique ///< The constraint is an unique constraint
+ };
+
+ /**
+ * Sets the @p category of the identity constraint.
+ *
+ * @see Category
+ */
+ void setCategory(Category category);
+
+ /**
+ * Returns the category of the identity constraint.
+ */
+ Category category() const;
+
+ /**
+ * Sets the @p selector of the identity constraint.
+ *
+ * The selector is a restricted XPath 1.0 expression,
+ * that selects a set of nodes.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#icd-selector"></a>
+ */
+ void setSelector(const XsdXPathExpression::Ptr &selector);
+
+ /**
+ * Returns the selector of the identity constraint.
+ */
+ XsdXPathExpression::Ptr selector() const;
+
+ /**
+ * Sets the @p fields of the identity constraint.
+ *
+ * Each field is a restricted XPath 1.0 expression,
+ * that selects a set of nodes.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#icd-fields"></a>
+ */
+ void setFields(const XsdXPathExpression::List &fields);
+
+ /**
+ * Adds a new @p field to the identity constraint.
+ */
+ void addField(const XsdXPathExpression::Ptr &field);
+
+ /**
+ * Returns all fields of the identity constraint.
+ */
+ XsdXPathExpression::List fields() const;
+
+ /**
+ * Sets the referenced @p key of the identity constraint.
+ *
+ * The key points to a identity constraint of type Key or Unique.
+ *
+ * The identity constraint has only a referenced key if its
+ * type is KeyReference.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#icd-referenced_key"></a>
+ */
+ void setReferencedKey(const XsdIdentityConstraint::Ptr &key);
+
+ /**
+ * Returns the referenced key of the identity constraint or an empty
+ * pointer if its type is not KeyReference.
+ */
+ XsdIdentityConstraint::Ptr referencedKey() const;
+
+ private:
+ Category m_category;
+ XsdXPathExpression::Ptr m_selector;
+ XsdXPathExpression::List m_fields;
+ XsdIdentityConstraint::Ptr m_referencedKey;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdinstancereader.cpp b/src/xmlpatterns/schema/qxsdinstancereader.cpp
new file mode 100644
index 0000000..9ff8d61
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdinstancereader.cpp
@@ -0,0 +1,196 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdinstancereader_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdInstanceReader::XsdInstanceReader(const QAbstractXmlNodeModel *model, const XsdSchemaContext::Ptr &context)
+ : m_context(context)
+ , m_model(model->iterate(model->root(QXmlNodeModelIndex()), QXmlNodeModelIndex::AxisChild))
+{
+}
+
+bool XsdInstanceReader::atEnd() const
+{
+ return (m_model.current() == AbstractXmlPullProvider::EndOfInput);
+}
+
+void XsdInstanceReader::readNext()
+{
+ m_model.next();
+
+ if (m_model.current() == AbstractXmlPullProvider::StartElement) {
+ m_cachedAttributes = m_model.attributes();
+ m_cachedAttributeItems = m_model.attributeItems();
+ m_cachedSourceLocation = m_model.sourceLocation();
+ m_cachedItem = QXmlItem(m_model.index());
+ }
+}
+
+bool XsdInstanceReader::isStartElement() const
+{
+ return (m_model.current() == AbstractXmlPullProvider::StartElement);
+}
+
+bool XsdInstanceReader::isEndElement() const
+{
+ return (m_model.current() == AbstractXmlPullProvider::EndElement);
+}
+
+bool XsdInstanceReader::hasChildText() const
+{
+ const QXmlNodeModelIndex index = m_model.index();
+ QXmlNodeModelIndex::Iterator::Ptr it = index.model()->iterate(index, QXmlNodeModelIndex::AxisChild);
+
+ QXmlNodeModelIndex currentIndex = it->next();
+ while (!currentIndex.isNull()) {
+ if (currentIndex.kind() == QXmlNodeModelIndex::Text)
+ return true;
+
+ currentIndex = it->next();
+ }
+
+ return false;
+}
+
+bool XsdInstanceReader::hasChildElement() const
+{
+ const QXmlNodeModelIndex index = m_model.index();
+ QXmlNodeModelIndex::Iterator::Ptr it = index.model()->iterate(index, QXmlNodeModelIndex::AxisChild);
+
+ QXmlNodeModelIndex currentIndex = it->next();
+ while (!currentIndex.isNull()) {
+ if (currentIndex.kind() == QXmlNodeModelIndex::Element)
+ return true;
+
+ currentIndex = it->next();
+ }
+
+ return false;
+}
+
+QXmlName XsdInstanceReader::name() const
+{
+ return m_model.name();
+}
+
+QXmlName XsdInstanceReader::convertToQName(const QString &name) const
+{
+ const int pos = name.indexOf(QLatin1Char(':'));
+
+ QXmlName::PrefixCode prefixCode = 0;
+ QXmlName::NamespaceCode namespaceCode;
+ QXmlName::LocalNameCode localNameCode;
+ if (pos != -1) {
+ prefixCode = m_context->namePool()->allocatePrefix(name.left(pos));
+ namespaceCode = m_cachedItem.toNodeModelIndex().namespaceForPrefix(prefixCode);
+ localNameCode = m_context->namePool()->allocateLocalName(name.mid(pos + 1));
+ } else {
+ prefixCode = StandardPrefixes::empty;
+ namespaceCode = m_cachedItem.toNodeModelIndex().namespaceForPrefix(prefixCode);
+ if (namespaceCode == -1)
+ namespaceCode = StandardNamespaces::empty;
+ localNameCode = m_context->namePool()->allocateLocalName(name);
+ }
+
+ return QXmlName(namespaceCode, localNameCode, prefixCode);
+}
+
+bool XsdInstanceReader::hasAttribute(const QXmlName &name) const
+{
+ return m_cachedAttributes.contains(name);
+}
+
+QString XsdInstanceReader::attribute(const QXmlName &name) const
+{
+ Q_ASSERT(m_cachedAttributes.contains(name));
+
+ return m_cachedAttributes.value(name);
+}
+
+QSet<QXmlName> XsdInstanceReader::attributeNames() const
+{
+ return m_cachedAttributes.keys().toSet();
+}
+
+QString XsdInstanceReader::text() const
+{
+ const QXmlNodeModelIndex index = m_model.index();
+ QXmlNodeModelIndex::Iterator::Ptr it = index.model()->iterate(index, QXmlNodeModelIndex::AxisChild);
+
+ QString result;
+
+ QXmlNodeModelIndex currentIndex = it->next();
+ while (!currentIndex.isNull()) {
+ if (currentIndex.kind() == QXmlNodeModelIndex::Text) {
+ result.append(Item(currentIndex).stringValue());
+ }
+
+ currentIndex = it->next();
+ }
+
+ return result;
+}
+
+QXmlItem XsdInstanceReader::item() const
+{
+ return m_cachedItem;
+}
+
+QXmlItem XsdInstanceReader::attributeItem(const QXmlName &name) const
+{
+ return m_cachedAttributeItems.value(name);
+}
+
+QSourceLocation XsdInstanceReader::sourceLocation() const
+{
+ return m_cachedSourceLocation;
+}
+
+QVector<QXmlName> XsdInstanceReader::namespaceBindings(const QXmlNodeModelIndex &index) const
+{
+ return index.namespaceBindings();
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdinstancereader_p.h b/src/xmlpatterns/schema/qxsdinstancereader_p.h
new file mode 100644
index 0000000..af189e3
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdinstancereader_p.h
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdInstanceReader_H
+#define Patternist_XsdInstanceReader_H
+
+#include "qabstractxmlnodemodel.h"
+#include "qpullbridge_p.h"
+#include "qxsdschemacontext_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short The schema instance reader.
+ *
+ * This class reads in a xml instance document from a QAbstractXmlNodeModel
+ * and provides a QXmlStreamReader like interface with some additional context
+ * information.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdInstanceReader
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdInstanceReader> Ptr;
+
+ /**
+ * Creates a new instance reader that will read the data from
+ * the given @p model.
+ *
+ * @param model The model the data are read from.
+ * @param context The context that is used for error reporting etc.
+ */
+ XsdInstanceReader(const QAbstractXmlNodeModel *model, const XsdSchemaContext::Ptr &context);
+
+ protected:
+ /**
+ * Returns @c true if the end of the document is reached, @c false otherwise.
+ */
+ bool atEnd() const;
+
+ /**
+ * Reads the next node from the document.
+ */
+ void readNext();
+
+ /**
+ * Returns whether the current node is a start element.
+ */
+ bool isStartElement() const;
+
+ /**
+ * Returns whether the current node is an end element.
+ */
+ bool isEndElement() const;
+
+ /**
+ * Returns whether the current node has a text node among its children.
+ */
+ bool hasChildText() const;
+
+ /**
+ * Returns whether the current node has an element node among its children.
+ */
+ bool hasChildElement() const;
+
+ /**
+ * Returns the name of the current node.
+ */
+ QXmlName name() const;
+
+ /**
+ * Returns whether the current node has an attribute with the given @p name.
+ */
+ bool hasAttribute(const QXmlName &name) const;
+
+ /**
+ * Returns the attribute with the given @p name of the current node.
+ */
+ QString attribute(const QXmlName &name) const;
+
+ /**
+ * Returns the list of attribute names of the current node.
+ */
+ QSet<QXmlName> attributeNames() const;
+
+ /**
+ * Returns the concatenated text of all direct child text nodes.
+ */
+ QString text() const;
+
+ /**
+ * Converts a qualified name into a QXmlName according to the namespace
+ * mappings of the current node.
+ */
+ QXmlName convertToQName(const QString &name) const;
+
+ /**
+ * Returns a source location object for the current position.
+ */
+ QSourceLocation sourceLocation() const;
+
+ /**
+ * Returns the QXmlItem for the current position.
+ */
+ QXmlItem item() const;
+
+ /**
+ * Returns the QXmlItem for the attribute with the given @p name at the current position.
+ */
+ QXmlItem attributeItem(const QXmlName &name) const;
+
+ /**
+ * Returns the namespace bindings for the given node model @p index.
+ */
+ QVector<QXmlName> namespaceBindings(const QXmlNodeModelIndex &index) const;
+
+ /**
+ * The shared schema context.
+ */
+ XsdSchemaContext::Ptr m_context;
+
+ private:
+ PullBridge m_model;
+ QHash<QXmlName, QString> m_cachedAttributes;
+ QHash<QXmlName, QXmlItem> m_cachedAttributeItems;
+ QSourceLocation m_cachedSourceLocation;
+ QXmlItem m_cachedItem;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdmodelgroup.cpp b/src/xmlpatterns/schema/qxsdmodelgroup.cpp
new file mode 100644
index 0000000..ca7eb42
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdmodelgroup.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdmodelgroup_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdModelGroup::XsdModelGroup()
+ : m_compositor(SequenceCompositor)
+{
+}
+
+bool XsdModelGroup::isModelGroup() const
+{
+ return true;
+}
+
+void XsdModelGroup::setCompositor(ModelCompositor compositor)
+{
+ m_compositor = compositor;
+}
+
+XsdModelGroup::ModelCompositor XsdModelGroup::compositor() const
+{
+ return m_compositor;
+}
+
+void XsdModelGroup::setParticles(const XsdParticle::List &particles)
+{
+ m_particles = particles;
+}
+
+XsdParticle::List XsdModelGroup::particles() const
+{
+ return m_particles;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdmodelgroup_p.h b/src/xmlpatterns/schema/qxsdmodelgroup_p.h
new file mode 100644
index 0000000..f01d5bf
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdmodelgroup_p.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdModelGroup_H
+#define Patternist_XsdModelGroup_H
+
+#include "qxsdparticle_p.h"
+#include "qxsdterm_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+template<typename N> class QList;
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD model group object.
+ *
+ * This class represents the <em>model group</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#cModel_Group_Definitions">here</a>.
+ *
+ * It contains information from either a <em>sequence</em> object, a <em>choice</em> object or an
+ * <em>all</em> object.
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSModelGroup">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdModelGroup : public XsdTerm
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdModelGroup> Ptr;
+ typedef QList<XsdModelGroup::Ptr> List;
+
+ /**
+ * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#mg-compositor">compositor</a> of the model group.
+ */
+ enum ModelCompositor
+ {
+ SequenceCompositor, ///< The model group is a sequence.
+ ChoiceCompositor, ///< The model group is a choice.
+ AllCompositor ///< The model group contains elements only.
+ };
+
+ /**
+ * Creates a new model group object.
+ */
+ XsdModelGroup();
+
+ /**
+ * Returns always @c true, used to avoid dynamic casts.
+ */
+ virtual bool isModelGroup() const;
+
+ /**
+ * Sets the @p compositor of the model group.
+ *
+ * @see ModelCompositor
+ */
+ void setCompositor(ModelCompositor compositor);
+
+ /**
+ * Returns the compositor of the model group.
+ */
+ ModelCompositor compositor() const;
+
+ /**
+ * Sets the list of @p particles of the model group.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#mg-particles">Particles Definition</a>
+ */
+ void setParticles(const XsdParticle::List &particles);
+
+ /**
+ * Returns the list of particles of the model group.
+ */
+ XsdParticle::List particles() const;
+
+ private:
+ ModelCompositor m_compositor;
+ XsdParticle::List m_particles;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdnotation.cpp b/src/xmlpatterns/schema/qxsdnotation.cpp
new file mode 100644
index 0000000..59697d7
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdnotation.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdnotation_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdNotation::setPublicId(const DerivedString<TypeToken>::Ptr &id)
+{
+ m_publicId = id;
+}
+
+DerivedString<TypeToken>::Ptr XsdNotation::publicId() const
+{
+ return m_publicId;
+}
+
+void XsdNotation::setSystemId(const AnyURI::Ptr &id)
+{
+ m_systemId = id;
+}
+
+AnyURI::Ptr XsdNotation::systemId() const
+{
+ return m_systemId;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdnotation_p.h b/src/xmlpatterns/schema/qxsdnotation_p.h
new file mode 100644
index 0000000..1ad2c47
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdnotation_p.h
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdNotation_H
+#define Patternist_XsdNotation_H
+
+#include "qanyuri_p.h"
+#include "qderivedstring_p.h"
+#include "qnamedschemacomponent_p.h"
+#include "qxsdannotated_p.h"
+
+#include <QtCore/QList>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD notation object, which should not
+ * be confused with the atomic type @c xs:NOTATION.
+ *
+ * This class represents the <em>notation</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#cNotation_Declarations">here</a>.
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#XS-NotationDecl">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdNotation : public NamedSchemaComponent, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdNotation> Ptr;
+ typedef QList<XsdNotation::Ptr> List;
+
+ /**
+ * Sets the public @p identifier of the notation.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#nd-public_identifier">Public Identifier Definition</a>
+ */
+ void setPublicId(const DerivedString<TypeToken>::Ptr &identifier);
+
+ /**
+ * Returns the public identifier of the notation.
+ */
+ DerivedString<TypeToken>::Ptr publicId() const;
+
+ /**
+ * Sets the system @p identifier of the notation.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#nd-system_identifier">System Identifier Definition</a>
+ */
+ void setSystemId(const AnyURI::Ptr &identifier);
+
+ /**
+ * Returns the system identifier of the notation.
+ */
+ AnyURI::Ptr systemId() const;
+
+ private:
+ DerivedString<TypeToken>::Ptr m_publicId;
+ AnyURI::Ptr m_systemId;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdparticle.cpp b/src/xmlpatterns/schema/qxsdparticle.cpp
new file mode 100644
index 0000000..0e58bf6
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdparticle.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdparticle_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdParticle::XsdParticle()
+ : m_minimumOccurs(1)
+ , m_maximumOccurs(1)
+ , m_maximumOccursUnbounded(false)
+{
+}
+
+void XsdParticle::setMinimumOccurs(unsigned int occurs)
+{
+ m_minimumOccurs = occurs;
+}
+
+unsigned int XsdParticle::minimumOccurs() const
+{
+ return m_minimumOccurs;
+}
+
+void XsdParticle::setMaximumOccurs(unsigned int occurs)
+{
+ m_maximumOccurs = occurs;
+}
+
+unsigned int XsdParticle::maximumOccurs() const
+{
+ return m_maximumOccurs;
+}
+
+void XsdParticle::setMaximumOccursUnbounded(bool unbounded)
+{
+ m_maximumOccursUnbounded = unbounded;
+}
+
+bool XsdParticle::maximumOccursUnbounded() const
+{
+ return m_maximumOccursUnbounded;
+}
+
+void XsdParticle::setTerm(const XsdTerm::Ptr &term)
+{
+ m_term = term;
+}
+
+XsdTerm::Ptr XsdParticle::term() const
+{
+ return m_term;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdparticle_p.h b/src/xmlpatterns/schema/qxsdparticle_p.h
new file mode 100644
index 0000000..a183192
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdparticle_p.h
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdParticle_H
+#define Patternist_XsdParticle_H
+
+#include "qnamedschemacomponent_p.h"
+#include "qxsdterm_p.h"
+
+#include <QtCore/QList>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD particle object.
+ *
+ * This class represents the <em>particle</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema11-1/#cParticles">here</a>.
+ *
+ * It contains information about the number of occurrence and a reference to
+ * either an <em>element</em> object, a <em>group</em> object or an <em>any</em> object.
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSParticle">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdParticle : public NamedSchemaComponent
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdParticle> Ptr;
+ typedef QList<XsdParticle::Ptr> List;
+
+ /**
+ * Creates a new particle object.
+ */
+ XsdParticle();
+
+ /**
+ * Sets the minimum @p occurrence of the particle.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#p-min_occurs">Minimum Occurrence Definition</a>
+ */
+ void setMinimumOccurs(unsigned int occurrence);
+
+ /**
+ * Returns the minimum occurrence of the particle.
+ */
+ unsigned int minimumOccurs() const;
+
+ /**
+ * Sets the maximum @p occurrence of the particle.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#p-max_occurs">Maximum Occurrence Definition</a>
+ */
+ void setMaximumOccurs(unsigned int occurrence);
+
+ /**
+ * Returns the maximum occurrence of the particle.
+ *
+ * @note This value has only a meaning if maximumOccursUnbounded is @c false.
+ */
+ unsigned int maximumOccurs() const;
+
+ /**
+ * Sets whether the maximum occurrence of the particle is unbounded.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#p-max_occurs">Maximum Occurrence Definition</a>
+ */
+ void setMaximumOccursUnbounded(bool unbounded);
+
+ /**
+ * Returns whether the maximum occurrence of the particle is unbounded.
+ */
+ bool maximumOccursUnbounded() const;
+
+ /**
+ * Sets the @p term of the particle.
+ *
+ * The term can be an element, a model group or an element wildcard.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#p-term">Term Definition</a>
+ */
+ void setTerm(const XsdTerm::Ptr &term);
+
+ /**
+ * Returns the term of the particle.
+ */
+ XsdTerm::Ptr term() const;
+
+ private:
+ unsigned int m_minimumOccurs;
+ unsigned int m_maximumOccurs;
+ bool m_maximumOccursUnbounded;
+ XsdTerm::Ptr m_term;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdparticlechecker.cpp b/src/xmlpatterns/schema/qxsdparticlechecker.cpp
new file mode 100644
index 0000000..f7fa442
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdparticlechecker.cpp
@@ -0,0 +1,540 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdparticlechecker_p.h"
+
+#include "qxsdelement_p.h"
+#include "qxsdmodelgroup_p.h"
+#include "qxsdschemahelper_p.h"
+#include "qxsdstatemachine_p.h"
+#include "qxsdstatemachinebuilder_p.h"
+#include "qxsdtypechecker_p.h"
+
+#include <QtCore/QFile>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+namespace QPatternist
+{
+ /**
+ * This template specialization is picked up by XsdStateMachine and allows us
+ * to print nice edge labels.
+ */
+ template <>
+ QString XsdStateMachine<XsdTerm::Ptr>::transitionTypeToString(XsdTerm::Ptr term) const
+ {
+ if (!term)
+ return QLatin1String("(empty)");
+
+ if (term->isElement()) {
+ return XsdElement::Ptr(term)->displayName(m_namePool);
+ } else if (term->isWildcard()) {
+ const XsdWildcard::Ptr wildcard(term);
+ return QLatin1String("(wildcard)");
+ } else {
+ return QString();
+ }
+ }
+}
+
+/**
+ * This method is used by the isUPAConform method to check whether @p term and @p otherTerm
+ * are the same resp. match each other.
+ */
+static bool termMatches(const XsdTerm::Ptr &term, const XsdTerm::Ptr &otherTerm, const NamePool::Ptr &namePool)
+{
+ if (term->isElement()) {
+ const XsdElement::Ptr element(term);
+
+ if (otherTerm->isElement()) {
+ // both, the term and the other term are elements
+
+ const XsdElement::Ptr otherElement(otherTerm);
+
+ // if they have the same name they match
+ if (element->name(namePool) == otherElement->name(namePool))
+ return true;
+
+ } else if (otherTerm->isWildcard()) {
+ // the term is an element and the other term a wildcard
+
+ const XsdWildcard::Ptr wildcard(otherTerm);
+
+ // wildcards using XsdWildcard::absentNamespace, so we have to fix that here
+ QXmlName name = element->name(namePool);
+ if (name.namespaceURI() == StandardNamespaces::empty)
+ name.setNamespaceURI(namePool->allocateNamespace(XsdWildcard::absentNamespace()));
+
+ // if the wildcards namespace constraint allows the elements name, they match
+ if (XsdSchemaHelper::wildcardAllowsExpandedName(name, wildcard, namePool))
+ return true;
+ }
+ } else if (term->isWildcard()) {
+ const XsdWildcard::Ptr wildcard(term);
+
+ if (otherTerm->isElement()) {
+ // the term is a wildcard and the other term an element
+
+ const XsdElement::Ptr otherElement(otherTerm);
+
+ // wildcards using XsdWildcard::absentNamespace, so we have to fix that here
+ QXmlName name = otherElement->name(namePool);
+ if (name.namespaceURI() == StandardNamespaces::empty)
+ name.setNamespaceURI(namePool->allocateNamespace(XsdWildcard::absentNamespace()));
+
+ // if the wildcards namespace constraint allows the elements name, they match
+ if (XsdSchemaHelper::wildcardAllowsExpandedName(name, wildcard, namePool))
+ return true;
+
+ } else if (otherTerm->isWildcard()) {
+ // both, the term and the other term are wildcards
+
+ const XsdWildcard::Ptr otherWildcard(otherTerm);
+
+ // check if the range of the wildcard overlaps.
+ const XsdWildcard::Ptr intersectionWildcard = XsdSchemaHelper::wildcardIntersection(wildcard, otherWildcard);
+ if (!intersectionWildcard ||
+ (intersectionWildcard && !(intersectionWildcard->namespaceConstraint()->variety() != XsdWildcard::NamespaceConstraint::Not && intersectionWildcard->namespaceConstraint()->namespaces().isEmpty())))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * This method is used by the subsumes algorithm to check whether the @p derivedTerm is validly derived from the @p baseTerm.
+ *
+ * @param baseTerm The term of the base component (type or group).
+ * @param derivedTerm The term of the derived component (type or group).
+ * @param particles A hash to map the passed base and derived term to the particles they belong to.
+ * @param context The schema context.
+ * @param errorMsg The error message in the case that an error occurs.
+ */
+static bool derivedTermValid(const XsdTerm::Ptr &baseTerm, const XsdTerm::Ptr &derivedTerm, const QHash<XsdTerm::Ptr, XsdParticle::Ptr> &particles, const XsdSchemaContext::Ptr &context, QString &errorMsg)
+{
+ const NamePool::Ptr namePool(context->namePool());
+
+ // find the particles where the base and derived term belongs to
+ const XsdParticle::Ptr baseParticle = particles.value(baseTerm);
+ const XsdParticle::Ptr derivedParticle = particles.value(derivedTerm);
+
+ // check that an empty particle can not be derived from a non-empty particle
+ if (derivedParticle && baseParticle) {
+ if (XsdSchemaHelper::isParticleEmptiable(derivedParticle) && !XsdSchemaHelper::isParticleEmptiable(baseParticle)) {
+ errorMsg = QtXmlPatterns::tr("empty particle cannot be derived from non-empty particle");
+ return false;
+ }
+ }
+
+ if (baseTerm->isElement()) {
+ const XsdElement::Ptr element(baseTerm);
+
+ if (derivedTerm->isElement()) {
+ // if both terms are elements
+
+ const XsdElement::Ptr derivedElement(derivedTerm);
+
+ // check names are equal
+ if (element->name(namePool) != derivedElement->name(namePool)) {
+ errorMsg = QtXmlPatterns::tr("derived particle is missing element %1").arg(formatKeyword(element->displayName(namePool)));
+ return false;
+ }
+
+ // check value constraints are equal (if available)
+ if (element->valueConstraint() && element->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) {
+ if (!derivedElement->valueConstraint()) {
+ errorMsg = QtXmlPatterns::tr("derived element %1 is missing value constraint as defined in base particle").arg(formatKeyword(derivedElement->displayName(namePool)));
+ return false;
+ }
+
+ if (derivedElement->valueConstraint()->variety() != XsdElement::ValueConstraint::Fixed) {
+ errorMsg = QtXmlPatterns::tr("derived element %1 has weaker value constraint than base particle").arg(formatKeyword(derivedElement->displayName(namePool)));
+ return false;
+ }
+
+ const QSourceLocation dummyLocation(QUrl(QLatin1String("http://dummy.org")), 1, 1);
+ const XsdTypeChecker checker(context, QVector<QXmlName>(), dummyLocation);
+ if (!checker.valuesAreEqual(element->valueConstraint()->value(), derivedElement->valueConstraint()->value(), derivedElement->type())) {
+ errorMsg = QtXmlPatterns::tr("fixed value constraint of element %1 differs from value constraint in base particle").arg(formatKeyword(derivedElement->displayName(namePool)));
+ return false;
+ }
+ }
+
+ // check that a derived element can not be nillable if the base element is not nillable
+ if (!element->isNillable() && derivedElement->isNillable()) {
+ errorMsg = QtXmlPatterns::tr("derived element %1 cannot be nillable as base element is not nillable").arg(formatKeyword(derivedElement->displayName(namePool)));
+ return false;
+ }
+
+ // check that the constraints of the derived element are more strict then the constraints of the base element
+ const XsdElement::BlockingConstraints baseConstraints = element->disallowedSubstitutions();
+ const XsdElement::BlockingConstraints derivedConstraints = derivedElement->disallowedSubstitutions();
+ if (((baseConstraints & XsdElement::RestrictionConstraint) && !(derivedConstraints & XsdElement::RestrictionConstraint)) ||
+ ((baseConstraints & XsdElement::ExtensionConstraint) && !(derivedConstraints & XsdElement::ExtensionConstraint)) ||
+ ((baseConstraints & XsdElement::SubstitutionConstraint) && !(derivedConstraints & XsdElement::SubstitutionConstraint))) {
+ errorMsg = QtXmlPatterns::tr("block constraints of derived element %1 must not be more weaker than in the base element").arg(formatKeyword(derivedElement->displayName(namePool)));
+ return false;
+ }
+
+ // if the type of both elements is the same we can stop testing here
+ if (element->type()->name(namePool) == derivedElement->type()->name(namePool))
+ return true;
+
+ // check that the type of the derived element can validly derived from the type of the base element
+ if (derivedElement->type()->isSimpleType()) {
+ if (!XsdSchemaHelper::isSimpleDerivationOk(derivedElement->type(), element->type(), SchemaType::DerivationConstraints())) {
+ errorMsg = QtXmlPatterns::tr("simple type of derived element %1 cannot be validly derived from base element").arg(formatKeyword(derivedElement->displayName(namePool)));
+ return false;
+ }
+ } else if (derivedElement->type()->isComplexType()) {
+ if (!XsdSchemaHelper::isComplexDerivationOk(derivedElement->type(), element->type(), SchemaType::DerivationConstraints())) {
+ errorMsg = QtXmlPatterns::tr("complex type of derived element %1 cannot be validly derived from base element").arg(formatKeyword(derivedElement->displayName(namePool)));
+ return false;
+ }
+ }
+
+ // if both, derived and base element, have a complex type that contains a particle itself, apply the subsumes algorithm
+ // recursive on their particles
+ if (element->type()->isComplexType() && derivedElement->type()->isComplexType()) {
+ if (element->type()->isDefinedBySchema() && derivedElement->type()->isDefinedBySchema()) {
+ const XsdComplexType::Ptr baseType(element->type());
+ const XsdComplexType::Ptr derivedType(derivedElement->type());
+ if ((baseType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly ||
+ baseType->contentType()->variety() == XsdComplexType::ContentType::Mixed) &&
+ (derivedType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly ||
+ derivedType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) {
+
+ return XsdParticleChecker::subsumes(baseType->contentType()->particle(), derivedType->contentType()->particle(), context, errorMsg);
+ }
+ }
+ }
+
+ return true;
+ } else if (derivedTerm->isWildcard()) {
+ // derive a wildcard from an element is not allowed
+ errorMsg = QtXmlPatterns::tr("element %1 is missing in derived particle").arg(formatKeyword(element->displayName(namePool)));
+ return false;
+ }
+ } else if (baseTerm->isWildcard()) {
+ const XsdWildcard::Ptr wildcard(baseTerm);
+
+ if (derivedTerm->isElement()) {
+ // the base term is a wildcard and derived term an element
+
+ const XsdElement::Ptr derivedElement(derivedTerm);
+
+ // wildcards using XsdWildcard::absentNamespace, so we have to fix that here
+ QXmlName name = derivedElement->name(namePool);
+ if (name.namespaceURI() == StandardNamespaces::empty)
+ name.setNamespaceURI(namePool->allocateNamespace(XsdWildcard::absentNamespace()));
+
+ // check that name of the element is allowed by the wildcards namespace constraint
+ if (!XsdSchemaHelper::wildcardAllowsExpandedName(name, wildcard, namePool)) {
+ errorMsg = QtXmlPatterns::tr("element %1 does not match namespace constraint of wildcard in base particle").arg(formatKeyword(derivedElement->displayName(namePool)));
+ return false;
+ }
+
+ } else if (derivedTerm->isWildcard()) {
+ // both, derived and base term are wildcards
+
+ const XsdWildcard::Ptr derivedWildcard(derivedTerm);
+
+ // check that the derived wildcard is a valid subset of the base wildcard
+ if (!XsdSchemaHelper::isWildcardSubset(derivedWildcard, wildcard)) {
+ errorMsg = QtXmlPatterns::tr("wildcard in derived particle is not a valid subset of wildcard in base particle");
+ return false;
+ }
+
+ if (!XsdSchemaHelper::checkWildcardProcessContents(wildcard, derivedWildcard)) {
+ errorMsg = QtXmlPatterns::tr("processContent of wildcard in derived particle is weaker than wildcard in base particle");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+typedef QHash<QXmlName, XsdElement::Ptr> ElementHash;
+
+/**
+ * Internal helper method that checks if the given @p particle contains an element with the
+ * same name and type twice.
+ */
+static bool hasDuplicatedElementsInternal(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool, ElementHash &hash, XsdElement::Ptr &conflictingElement)
+{
+ const XsdTerm::Ptr term = particle->term();
+ if (term->isElement()) {
+ const XsdElement::Ptr mainElement(term);
+ XsdElement::List substGroups = mainElement->substitutionGroups();
+ if (substGroups.isEmpty())
+ substGroups << mainElement;
+
+ for (int i = 0; i < substGroups.count(); ++i) {
+ const XsdElement::Ptr element = substGroups.at(i);
+ if (hash.contains(element->name(namePool))) {
+ if (element->type()->name(namePool) != hash.value(element->name(namePool))->type()->name(namePool)) {
+ conflictingElement = element;
+ return true;
+ }
+ } else {
+ hash.insert(element->name(namePool), element);
+ }
+ }
+ } else if (term->isModelGroup()) {
+ const XsdModelGroup::Ptr group(term);
+ const XsdParticle::List particles = group->particles();
+ for (int i = 0; i < particles.count(); ++i) {
+ if (hasDuplicatedElementsInternal(particles.at(i), namePool, hash, conflictingElement))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool XsdParticleChecker::hasDuplicatedElements(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool, XsdElement::Ptr &conflictingElement)
+{
+ ElementHash hash;
+ return hasDuplicatedElementsInternal(particle, namePool, hash, conflictingElement);
+}
+
+bool XsdParticleChecker::isUPAConform(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool)
+{
+ /**
+ * The algorithm is implemented like described in http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html#S2.2
+ */
+
+ // create a state machine for the given particle
+ XsdStateMachine<XsdTerm::Ptr> stateMachine(namePool);
+
+ XsdStateMachineBuilder builder(&stateMachine, namePool);
+ const XsdStateMachine<XsdTerm::Ptr>::StateId endState = builder.reset();
+ const XsdStateMachine<XsdTerm::Ptr>::StateId startState = builder.buildParticle(particle, endState);
+ builder.addStartState(startState);
+
+/*
+ static int counter = 0;
+ {
+ QFile file(QString("/tmp/file_upa%1.dot").arg(counter));
+ file.open(QIODevice::WriteOnly);
+ stateMachine.outputGraph(&file, "Base");
+ file.close();
+ }
+ ::system(QString("dot -Tpng /tmp/file_upa%1.dot -o/tmp/file_upa%1.png").arg(counter).toLatin1().data());
+*/
+ const XsdStateMachine<XsdTerm::Ptr> dfa = stateMachine.toDFA();
+/*
+ {
+ QFile file(QString("/tmp/file_upa%1dfa.dot").arg(counter));
+ file.open(QIODevice::WriteOnly);
+ dfa.outputGraph(&file, "Base");
+ file.close();
+ }
+ ::system(QString("dot -Tpng /tmp/file_upa%1dfa.dot -o/tmp/file_upa%1dfa.png").arg(counter).toLatin1().data());
+*/
+ const QHash<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateType> states = dfa.states();
+ const QHash<XsdStateMachine<XsdTerm::Ptr>::StateId, QHash<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > > transitions = dfa.transitions();
+
+ // the basic idea of that algorithm is to iterate over all states of that machine and check that no two edges
+ // that match on the same term leave a state, so for a given term it should always be obvious which edge to take
+ QHashIterator<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateType> stateIt(states);
+ while (stateIt.hasNext()) { // iterate over all states
+ stateIt.next();
+
+ // fetch all transitions the current state allows
+ const QHash<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > currentTransitions = transitions.value(stateIt.key());
+ QHashIterator<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > transitionIt(currentTransitions);
+ while (transitionIt.hasNext()) { // iterate over all transitions
+ transitionIt.next();
+
+ if (transitionIt.value().size() > 1) {
+ // we have one state with two edges leaving it, that means
+ // the XsdTerm::Ptr exists twice, that is an error
+ return false;
+ }
+
+ QHashIterator<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > innerTransitionIt(currentTransitions);
+ while (innerTransitionIt.hasNext()) { // iterate over all transitions again, as we have to compare all transitions with all
+ innerTransitionIt.next();
+
+ if (transitionIt.key() == innerTransitionIt.key()) // do no compare with ourself
+ continue;
+
+ // use the helper method termMatches to check if both term matches
+ if (termMatches(transitionIt.key(), innerTransitionIt.key(), namePool))
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool XsdParticleChecker::subsumes(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &derivedParticle, const XsdSchemaContext::Ptr &context, QString &errorMsg)
+{
+ /**
+ * The algorithm is implemented like described in http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html#S2.3
+ */
+
+ const NamePool::Ptr namePool(context->namePool());
+
+ XsdStateMachine<XsdTerm::Ptr> baseStateMachine(namePool);
+ XsdStateMachine<XsdTerm::Ptr> derivedStateMachine(namePool);
+
+ // build up state machines for both particles
+ {
+ XsdStateMachineBuilder builder(&baseStateMachine, namePool);
+ const XsdStateMachine<XsdTerm::Ptr>::StateId endState = builder.reset();
+ const XsdStateMachine<XsdTerm::Ptr>::StateId startState = builder.buildParticle(particle, endState);
+ builder.addStartState(startState);
+
+ baseStateMachine = baseStateMachine.toDFA();
+ }
+ {
+ XsdStateMachineBuilder builder(&derivedStateMachine, namePool);
+ const XsdStateMachine<XsdTerm::Ptr>::StateId endState = builder.reset();
+ const XsdStateMachine<XsdTerm::Ptr>::StateId startState = builder.buildParticle(derivedParticle, endState);
+ builder.addStartState(startState);
+
+ derivedStateMachine = derivedStateMachine.toDFA();
+ }
+
+ QHash<XsdTerm::Ptr, XsdParticle::Ptr> particlesHash = XsdStateMachineBuilder::particleLookupMap(particle);
+ particlesHash.unite(XsdStateMachineBuilder::particleLookupMap(derivedParticle));
+
+/*
+ static int counter = 0;
+ {
+ QFile file(QString("/tmp/file_base%1.dot").arg(counter));
+ file.open(QIODevice::WriteOnly);
+ baseStateMachine.outputGraph(&file, QLatin1String("Base"));
+ file.close();
+ }
+ {
+ QFile file(QString("/tmp/file_derived%1.dot").arg(counter));
+ file.open(QIODevice::WriteOnly);
+ derivedStateMachine.outputGraph(&file, QLatin1String("Base"));
+ file.close();
+ }
+ ::system(QString("dot -Tpng /tmp/file_base%1.dot -o/tmp/file_base%1.png").arg(counter).toLatin1().data());
+ ::system(QString("dot -Tpng /tmp/file_derived%1.dot -o/tmp/file_derived%1.png").arg(counter).toLatin1().data());
+*/
+
+ const XsdStateMachine<XsdTerm::Ptr>::StateId baseStartState = baseStateMachine.startState();
+ const QHash<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateType> baseStates = baseStateMachine.states();
+ const QHash<XsdStateMachine<XsdTerm::Ptr>::StateId, QHash<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > > baseTransitions = baseStateMachine.transitions();
+
+ const XsdStateMachine<XsdTerm::Ptr>::StateId derivedStartState = derivedStateMachine.startState();
+ const QHash<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateType> derivedStates = derivedStateMachine.states();
+ const QHash<XsdStateMachine<XsdTerm::Ptr>::StateId, QHash<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > > derivedTransitions = derivedStateMachine.transitions();
+
+ // @see http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html#S2.3.1
+
+ // define working set
+ QList<QPair<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateId> > workSet;
+ QList<QPair<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateId> > processedSet;
+
+ // 1) fill working set initially with start states
+ workSet.append(qMakePair<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateId>(baseStartState, derivedStartState));
+ processedSet.append(qMakePair<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateId>(baseStartState, derivedStartState));
+
+ while (!workSet.isEmpty()) { // while there are state sets to process
+
+ // 3) dequeue on state set
+ const QPair<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateId> set = workSet.takeFirst();
+
+ const QHash<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > derivedTrans = derivedTransitions.value(set.second);
+ QHashIterator<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > derivedIt(derivedTrans);
+
+ const QHash<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > baseTrans = baseTransitions.value(set.first);
+
+ while (derivedIt.hasNext()) {
+ derivedIt.next();
+
+ bool found = false;
+ QHashIterator<XsdTerm::Ptr, QVector<XsdStateMachine<XsdTerm::Ptr>::StateId> > baseIt(baseTrans);
+ while (baseIt.hasNext()) {
+ baseIt.next();
+ if (derivedTermValid(baseIt.key(), derivedIt.key(), particlesHash, context, errorMsg)) {
+ const QPair<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateId> endSet =
+ qMakePair<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateId>(baseIt.value().first(), derivedIt.value().first());
+ if (!processedSet.contains(endSet) && !workSet.contains(endSet)) {
+ workSet.append(endSet);
+ processedSet.append(endSet);
+ }
+
+ found = true;
+ }
+ }
+
+ if (!found) {
+ return false;
+ }
+ }
+ }
+
+ // 5)
+ QHashIterator<XsdStateMachine<XsdTerm::Ptr>::StateId, XsdStateMachine<XsdTerm::Ptr>::StateType> it(derivedStates);
+ while (it.hasNext()) {
+ it.next();
+
+ if (it.value() == XsdStateMachine<XsdTerm::Ptr>::EndState || it.value() == XsdStateMachine<XsdTerm::Ptr>::StartEndState) {
+ for (int i = 0; i < processedSet.count(); ++i) {
+ if (processedSet.at(i).second == it.key() &&
+ (baseStates.value(processedSet.at(i).first) != XsdStateMachine<XsdTerm::Ptr>::EndState &&
+ baseStates.value(processedSet.at(i).first) != XsdStateMachine<XsdTerm::Ptr>::StartEndState)) {
+ errorMsg = QtXmlPatterns::tr("derived particle allows content that is not allowed in the base particle");
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdparticlechecker_p.h b/src/xmlpatterns/schema/qxsdparticlechecker_p.h
new file mode 100644
index 0000000..feed108
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdparticlechecker_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdParticleChecker_H
+#define Patternist_XsdParticleChecker_H
+
+#include "qxsdelement_p.h"
+#include "qxsdparticle_p.h"
+#include "qxsdschemacontext_p.h"
+#include "qxsdwildcard_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A helper class to check validity of particles.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdParticleChecker
+ {
+ public:
+ /**
+ * Checks whether the given @p particle has two or more element
+ * declarations with the same name but different type definitions.
+ */
+ static bool hasDuplicatedElements(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool, XsdElement::Ptr &conflictingElement);
+
+ /**
+ * Checks whether the given @p particle is valid according the
+ * UPA (http://www.w3.org/TR/xmlschema-1/#cos-nonambig) constraint.
+ */
+ static bool isUPAConform(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool);
+
+ /**
+ * Checks whether the given @p particle subsumes the given @p derivedParticle.
+ * (http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict)
+ */
+ static bool subsumes(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &derivedParticle, const XsdSchemaContext::Ptr &context, QString &errorMsg);
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/examples/gestures/browser/toolbarsearch.h b/src/xmlpatterns/schema/qxsdreference.cpp
index 02c1871..176dc31 100644
--- a/examples/gestures/browser/toolbarsearch.h
+++ b/src/xmlpatterns/schema/qxsdreference.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,46 +39,45 @@
**
****************************************************************************/
-#ifndef TOOLBARSEARCH_H
-#define TOOLBARSEARCH_H
-
-#include "searchlineedit.h"
+#include "qxsdreference_p.h"
QT_BEGIN_NAMESPACE
-class QUrl;
-class QAction;
-class QStringListModel;
-QT_END_NAMESPACE
-class AutoSaver;
+using namespace QPatternist;
-class ToolbarSearch : public SearchLineEdit
+bool XsdReference::isReference() const
{
- Q_OBJECT
-
-signals:
- void search(const QUrl &url);
+ return true;
+}
-public:
- ToolbarSearch(QWidget *parent = 0);
- ~ToolbarSearch();
+void XsdReference::setType(Type type)
+{
+ m_type = type;
+}
-public slots:
- void clear();
- void searchNow();
+XsdReference::Type XsdReference::type() const
+{
+ return m_type;
+}
-private slots:
- void save();
- void aboutToShowMenu();
- void triggeredMenuAction(QAction *action);
+void XsdReference::setReferenceName(const QXmlName &referenceName)
+{
+ m_referenceName = referenceName;
+}
-private:
- void load();
+QXmlName XsdReference::referenceName() const
+{
+ return m_referenceName;
+}
- AutoSaver *m_autosaver;
- int m_maxSavedSearches;
- QStringListModel *m_stringListModel;
-};
+void XsdReference::setSourceLocation(const QSourceLocation &location)
+{
+ m_sourceLocation = location;
+}
-#endif // TOOLBARSEARCH_H
+QSourceLocation XsdReference::sourceLocation() const
+{
+ return m_sourceLocation;
+}
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdreference_p.h b/src/xmlpatterns/schema/qxsdreference_p.h
new file mode 100644
index 0000000..1354d77
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdreference_p.h
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdReference_H
+#define Patternist_XsdReference_H
+
+#include "qxsdterm_p.h"
+
+#include <QtXmlPatterns/QSourceLocation>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A helper class for element and group reference resolving.
+ *
+ * For easy resolving of element and group references, we have this class
+ * that can be used as a place holder for the real element or group
+ * object it is referring to.
+ * So whenever the parser detects an element or group reference, it creates
+ * a XsdReference and returns it instead of the XsdElement or XsdModelGroup.
+ * During a later phase, the resolver will look for all XsdReferences
+ * in the schema and will replace them with their referring XsdElement or
+ * XsdModelGroup objects.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdReference : public XsdTerm
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdReference> Ptr;
+
+ /**
+ * Describes the type of the reference.
+ */
+ enum Type
+ {
+ Element, ///< The reference points to an element.
+ ModelGroup ///< The reference points to a model group.
+ };
+
+ /**
+ * Returns always @c true, used to avoid dynamic casts.
+ */
+ virtual bool isReference() const;
+
+ /**
+ * Sets the @p type of the reference.
+ *
+ * @see Type
+ */
+ void setType(Type type);
+
+ /**
+ * Returns the type of the reference.
+ */
+ Type type() const;
+
+ /**
+ * Sets the @p name of the referenced object.
+ *
+ * The name can either be a top-level element declaration
+ * or a top-level group declaration.
+ */
+ void setReferenceName(const QXmlName &ame);
+
+ /**
+ * Returns the name of the referenced object.
+ */
+ QXmlName referenceName() const;
+
+ /**
+ * Sets the source @p location where the reference is located.
+ */
+ void setSourceLocation(const QSourceLocation &location);
+
+ /**
+ * Returns the source location where the reference is located.
+ */
+ QSourceLocation sourceLocation() const;
+
+ private:
+ Type m_type;
+ QXmlName m_referenceName;
+ QSourceLocation m_sourceLocation;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschema.cpp b/src/xmlpatterns/schema/qxsdschema.cpp
new file mode 100644
index 0000000..aac5773
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschema.cpp
@@ -0,0 +1,272 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschema_p.h"
+
+#include <QtCore/QReadLocker>
+#include <QtCore/QWriteLocker>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdSchema::XsdSchema(const NamePool::Ptr &namePool)
+ : m_namePool(namePool)
+{
+}
+
+XsdSchema::~XsdSchema()
+{
+}
+
+NamePool::Ptr XsdSchema::namePool() const
+{
+ return m_namePool;
+}
+
+void XsdSchema::setTargetNamespace(const QString &targetNamespace)
+{
+ m_targetNamespace = targetNamespace;
+}
+
+QString XsdSchema::targetNamespace() const
+{
+ return m_targetNamespace;
+}
+
+void XsdSchema::addElement(const XsdElement::Ptr &element)
+{
+ const QWriteLocker locker(&m_lock);
+
+ m_elements.insert(element->name(m_namePool), element);
+}
+
+XsdElement::Ptr XsdSchema::element(const QXmlName &name) const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_elements.value(name);
+}
+
+XsdElement::List XsdSchema::elements() const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_elements.values();
+}
+
+void XsdSchema::addAttribute(const XsdAttribute::Ptr &attribute)
+{
+ const QWriteLocker locker(&m_lock);
+
+ m_attributes.insert(attribute->name(m_namePool), attribute);
+}
+
+XsdAttribute::Ptr XsdSchema::attribute(const QXmlName &name) const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_attributes.value(name);
+}
+
+XsdAttribute::List XsdSchema::attributes() const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_attributes.values();
+}
+
+void XsdSchema::addType(const SchemaType::Ptr &type)
+{
+ const QWriteLocker locker(&m_lock);
+
+ m_types.insert(type->name(m_namePool), type);
+}
+
+SchemaType::Ptr XsdSchema::type(const QXmlName &name) const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_types.value(name);
+}
+
+SchemaType::List XsdSchema::types() const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_types.values();
+}
+
+XsdSimpleType::List XsdSchema::simpleTypes() const
+{
+ QReadLocker locker(&m_lock);
+
+ XsdSimpleType::List retval;
+
+ const SchemaType::List types = m_types.values();
+ for (int i = 0; i < types.count(); ++i) {
+ if (types.at(i)->isSimpleType() && types.at(i)->isDefinedBySchema())
+ retval.append(types.at(i));
+ }
+
+ return retval;
+}
+
+XsdComplexType::List XsdSchema::complexTypes() const
+{
+ QReadLocker locker(&m_lock);
+
+ XsdComplexType::List retval;
+
+ const SchemaType::List types = m_types.values();
+ for (int i = 0; i < types.count(); ++i) {
+ if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema())
+ retval.append(types.at(i));
+ }
+
+ return retval;
+}
+
+void XsdSchema::addAnonymousType(const SchemaType::Ptr &type)
+{
+ const QWriteLocker locker(&m_lock);
+
+ // search for not used anonymous type name
+ QXmlName typeName = type->name(m_namePool);
+ while (m_anonymousTypes.contains(typeName)) {
+ typeName = m_namePool->allocateQName(QString(), QLatin1String("merged_") + m_namePool->stringForLocalName(typeName.localName()), QString());
+ }
+
+ m_anonymousTypes.insert(typeName, type);
+}
+
+SchemaType::List XsdSchema::anonymousTypes() const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_anonymousTypes.values();
+}
+
+void XsdSchema::addAttributeGroup(const XsdAttributeGroup::Ptr &group)
+{
+ const QWriteLocker locker(&m_lock);
+
+ m_attributeGroups.insert(group->name(m_namePool), group);
+}
+
+XsdAttributeGroup::Ptr XsdSchema::attributeGroup(const QXmlName name) const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_attributeGroups.value(name);
+}
+
+XsdAttributeGroup::List XsdSchema::attributeGroups() const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_attributeGroups.values();
+}
+
+void XsdSchema::addElementGroup(const XsdModelGroup::Ptr &group)
+{
+ const QWriteLocker locker(&m_lock);
+
+ m_elementGroups.insert(group->name(m_namePool), group);
+}
+
+XsdModelGroup::Ptr XsdSchema::elementGroup(const QXmlName &name) const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_elementGroups.value(name);
+}
+
+XsdModelGroup::List XsdSchema::elementGroups() const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_elementGroups.values();
+}
+
+void XsdSchema::addNotation(const XsdNotation::Ptr &notation)
+{
+ const QWriteLocker locker(&m_lock);
+
+ m_notations.insert(notation->name(m_namePool), notation);
+}
+
+XsdNotation::Ptr XsdSchema::notation(const QXmlName &name) const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_notations.value(name);
+}
+
+XsdNotation::List XsdSchema::notations() const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_notations.values();
+}
+
+void XsdSchema::addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint)
+{
+ const QWriteLocker locker(&m_lock);
+
+ m_identityConstraints.insert(constraint->name(m_namePool), constraint);
+}
+
+XsdIdentityConstraint::Ptr XsdSchema::identityConstraint(const QXmlName &name) const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_identityConstraints.value(name);
+}
+
+XsdIdentityConstraint::List XsdSchema::identityConstraints() const
+{
+ const QReadLocker locker(&m_lock);
+
+ return m_identityConstraints.values();
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschema_p.h b/src/xmlpatterns/schema/qxsdschema_p.h
new file mode 100644
index 0000000..d697673
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschema_p.h
@@ -0,0 +1,301 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchema_H
+#define Patternist_XsdSchema_H
+
+#include "qschematype_p.h"
+#include "qxsdannotated_p.h"
+#include "qxsdattribute_p.h"
+#include "qxsdattributegroup_p.h"
+#include "qxsdcomplextype_p.h"
+#include "qxsdelement_p.h"
+#include "qxsdidentityconstraint_p.h"
+#include "qxsdmodelgroup_p.h"
+#include "qxsdnotation_p.h"
+#include "qxsdsimpletype_p.h"
+
+#include <QtCore/QHash>
+#include <QtCore/QReadWriteLock>
+
+/**
+ * @defgroup Patternist_schema XML Schema Processing
+ */
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD schema object.
+ *
+ * The class provides access to all components of a parsed XSD.
+ *
+ * @note In the documentation of this class objects, which are direct
+ * children of the <em>schema</em> object, are called top-level objects.
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSModel">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSchema : public QSharedData, public XsdAnnotated
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdSchema> Ptr;
+ typedef QList<XsdSchema::Ptr> List;
+
+ /**
+ * Creates a new schema object.
+ *
+ * @param namePool The namepool that should be used for names of
+ * all schema components.
+ */
+ XsdSchema(const NamePool::Ptr &namePool);
+
+ /**
+ * Destroys the schema object.
+ */
+ ~XsdSchema();
+
+ /**
+ * Returns the namepool that is used for names of
+ * all schema components.
+ */
+ NamePool::Ptr namePool() const;
+
+ /**
+ * Sets the @p targetNamespace of the schema.
+ */
+ void setTargetNamespace(const QString &targetNamespace);
+
+ /**
+ * Returns the target namespace of the schema.
+ */
+ QString targetNamespace() const;
+
+ /**
+ * Adds a new top-level @p element to the schema.
+ *
+ * @param element The new element.
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#declare-element">Element Declaration</a>
+ */
+ void addElement(const XsdElement::Ptr &element);
+
+ /**
+ * Returns the top-level element of the schema with
+ * the given @p name or an empty pointer if none exist.
+ */
+ XsdElement::Ptr element(const QXmlName &name) const;
+
+ /**
+ * Returns the list of all top-level elements.
+ */
+ XsdElement::List elements() const;
+
+ /**
+ * Adds a new top-level @p attribute to the schema.
+ *
+ * @param attribute The new attribute.
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#declare-attribute">Attribute Declaration</a>
+ */
+ void addAttribute(const XsdAttribute::Ptr &attribute);
+
+ /**
+ * Returns the top-level attribute of the schema with
+ * the given @p name or an empty pointer if none exist.
+ */
+ XsdAttribute::Ptr attribute(const QXmlName &name) const;
+
+ /**
+ * Returns the list of all top-level attributes.
+ */
+ XsdAttribute::List attributes() const;
+
+ /**
+ * Adds a new top-level @p type to the schema.
+ * That can be a simple or a complex type.
+ *
+ * @param type The new type.
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#declare-datatype">Simple Type Declaration</a>
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#declare-type">Complex Type Declaration</a>
+ */
+ void addType(const SchemaType::Ptr &type);
+
+ /**
+ * Returns the top-level type of the schema with
+ * the given @p name or an empty pointer if none exist.
+ */
+ SchemaType::Ptr type(const QXmlName &name) const;
+
+ /**
+ * Returns the list of all top-level types.
+ */
+ SchemaType::List types() const;
+
+ /**
+ * Returns the list of all top-level simple types.
+ */
+ XsdSimpleType::List simpleTypes() const;
+
+ /**
+ * Returns the list of all top-level complex types.
+ */
+ XsdComplexType::List complexTypes() const;
+
+ /**
+ * Adds an anonymous @p type to the schema.
+ * Anonymous types have no name and are declared
+ * locally inside an element object.
+ *
+ * @param type The new anonymous type.
+ */
+ void addAnonymousType(const SchemaType::Ptr &type);
+
+ /**
+ * Returns the list of all anonymous types.
+ */
+ SchemaType::List anonymousTypes() const;
+
+ /**
+ * Adds a new top-level attribute @p group to the schema.
+ *
+ * @param group The new attribute group.
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#declare-attributeGroup">Attribute Group Declaration</a>
+ */
+ void addAttributeGroup(const XsdAttributeGroup::Ptr &group);
+
+ /**
+ * Returns the top-level attribute group of the schema with
+ * the given @p name or an empty pointer if none exist.
+ */
+ XsdAttributeGroup::Ptr attributeGroup(const QXmlName name) const;
+
+ /**
+ * Returns the list of all top-level attribute groups.
+ */
+ XsdAttributeGroup::List attributeGroups() const;
+
+ /**
+ * Adds a new top-level element @p group to the schema.
+ *
+ * @param group The new element group.
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#declare-namedModelGroup">Element Group Declaration</a>
+ */
+ void addElementGroup(const XsdModelGroup::Ptr &group);
+
+ /**
+ * Returns the top-level element group of the schema with
+ * the given @p name or an empty pointer if none exist.
+ */
+ XsdModelGroup::Ptr elementGroup(const QXmlName &name) const;
+
+ /**
+ * Returns the list of all top-level element groups.
+ */
+ XsdModelGroup::List elementGroups() const;
+
+ /**
+ * Adds a new top-level @p notation to the schema.
+ *
+ * @param notation The new notation.
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#declare-notation">Notation Declaration</a>
+ */
+ void addNotation(const XsdNotation::Ptr &notation);
+
+ /**
+ * Returns the top-level notation of the schema with
+ * the given @p name or an empty pointer if none exist.
+ */
+ XsdNotation::Ptr notation(const QXmlName &name) const;
+
+ /**
+ * Returns the list of all top-level notations.
+ */
+ XsdNotation::List notations() const;
+
+ /**
+ * Adds a new identity @p constraint to the schema.
+ */
+ void addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint);
+
+ /**
+ * Returns the identity constraint with the given @p name
+ * or an empty pointer if none exist.
+ */
+ XsdIdentityConstraint::Ptr identityConstraint(const QXmlName &name) const;
+
+ /**
+ * Returns the list of all identity constraints in this schema.
+ */
+ XsdIdentityConstraint::List identityConstraints() const;
+
+ private:
+ NamePool::Ptr m_namePool;
+ QString m_targetNamespace;
+ QHash<QXmlName, XsdElement::Ptr> m_elements;
+ QHash<QXmlName, XsdAttribute::Ptr> m_attributes;
+ QHash<QXmlName, SchemaType::Ptr> m_types;
+ QHash<QXmlName, SchemaType::Ptr> m_anonymousTypes;
+ QHash<QXmlName, XsdAttributeGroup::Ptr> m_attributeGroups;
+ QHash<QXmlName, XsdModelGroup::Ptr> m_elementGroups;
+ QHash<QXmlName, XsdNotation::Ptr> m_notations;
+ QHash<QXmlName, XsdIdentityConstraint::Ptr> m_identityConstraints;
+ mutable QReadWriteLock m_lock;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschemachecker.cpp b/src/xmlpatterns/schema/qxsdschemachecker.cpp
new file mode 100644
index 0000000..d2001eb
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemachecker.cpp
@@ -0,0 +1,2061 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemachecker_p.h"
+
+#include "qderivedinteger_p.h"
+#include "qderivedstring_p.h"
+#include "qpatternplatform_p.h"
+#include "qqnamevalue_p.h"
+#include "qsourcelocationreflection_p.h"
+#include "qvaluefactory_p.h"
+#include "qxsdattributereference_p.h"
+#include "qxsdparticlechecker_p.h"
+#include "qxsdreference_p.h"
+#include "qxsdschemacontext_p.h"
+#include "qxsdschemahelper_p.h"
+#include "qxsdschemaparsercontext_p.h"
+#include "qxsdschematypesfactory_p.h"
+#include "qxsdtypechecker_p.h"
+
+#include "qxsdschemachecker_helper.cpp"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdSchemaChecker::XsdSchemaChecker(const QExplicitlySharedDataPointer<XsdSchemaContext> &context, const XsdSchemaParserContext *parserContext)
+ : m_context(context)
+ , m_namePool(parserContext->namePool())
+ , m_schema(parserContext->schema())
+{
+ setupAllowedAtomicFacets();
+}
+
+XsdSchemaChecker::~XsdSchemaChecker()
+{
+}
+
+/*
+ * This method is called after the resolver has set the base type for every
+ * type and information about deriavtion and 'is simple type vs. is complex type'
+ * are available.
+ */
+void XsdSchemaChecker::basicCheck()
+{
+ // first check that there is no circular inheritance, only the
+ // wxsSuperType is used here
+ checkBasicCircularInheritances();
+
+ // check the basic constraints like simple type can not inherit from complex type etc.
+ checkBasicSimpleTypeConstraints();
+ checkBasicComplexTypeConstraints();
+}
+
+void XsdSchemaChecker::check()
+{
+ checkCircularInheritances();
+ checkInheritanceRestrictions();
+ checkSimpleDerivationRestrictions();
+ checkSimpleTypeConstraints();
+ checkComplexTypeConstraints();
+ checkDuplicatedAttributeUses();
+
+ checkElementConstraints();
+ checkAttributeConstraints();
+ checkAttributeUseConstraints();
+// checkElementDuplicates();
+}
+
+void XsdSchemaChecker::addComponentLocationHash(const ComponentLocationHash &hash)
+{
+ m_componentLocationHash.unite(hash);
+}
+
+/**
+ * Checks whether the @p otherType is the same as @p myType or if one of its
+ * ancestors is the same as @p myType.
+ */
+static bool matchesType(const SchemaType::Ptr &myType, const SchemaType::Ptr &otherType, QSet<SchemaType::Ptr> visitedTypes)
+{
+ bool retval = false;
+
+ if (otherType) {
+ if (visitedTypes.contains(otherType)) {
+ return true;
+ } else {
+ visitedTypes.insert(otherType);
+ }
+ // simple types can have different varieties, so we have to check each of them
+ if (otherType->isSimpleType()) {
+ const XsdSimpleType::Ptr simpleType = otherType;
+ if (simpleType->category() == XsdSimpleType::SimpleTypeAtomic) {
+ // for atomic type we use the same test as in SchemaType::wxsTypeMatches
+ retval = (myType == simpleType ? true : matchesType(myType, simpleType->wxsSuperType(), visitedTypes));
+ } else if (simpleType->category() == XsdSimpleType::SimpleTypeList) {
+ // for list type we test against the itemType property
+ retval = (myType == simpleType->itemType() ? true : matchesType(myType, simpleType->itemType()->wxsSuperType(), visitedTypes));
+ } else if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) {
+ // for union type we test against each member type
+ const XsdSimpleType::List members = simpleType->memberTypes();
+ for (int i = 0; i < members.count(); ++i) {
+ if (myType == members.at(i) ? true : matchesType(myType, members.at(i)->wxsSuperType(), visitedTypes)) {
+ retval = true;
+ break;
+ }
+ }
+ } else {
+ // reached xsAnySimple type whichs category is None
+ retval = false;
+ }
+ } else {
+ // if no simple type we handle it like in SchemaType::wxsTypeMatches
+ retval = (myType == otherType ? true : matchesType(myType, otherType->wxsSuperType(), visitedTypes));
+ }
+ } else // if otherType is null it doesn't match
+ retval = false;
+
+ return retval;
+}
+
+/**
+ * Checks whether there is a circular inheritance for the union inheritance.
+ */
+static bool hasCircularUnionInheritance(const XsdSimpleType::Ptr &type, const SchemaType::Ptr &otherType, NamePool::Ptr &namePool)
+{
+ if (type == otherType) {
+ return true;
+ }
+
+ if (!otherType->isSimpleType() || !otherType->isDefinedBySchema()) {
+ return false;
+ }
+
+ const XsdSimpleType::Ptr simpleOtherType = otherType;
+
+ if (simpleOtherType->category() == XsdSimpleType::SimpleTypeUnion) {
+ const XsdSimpleType::List memberTypes = simpleOtherType->memberTypes();
+ for (int i = 0; i < memberTypes.count(); ++i) {
+ if (otherType->wxsSuperType() == type) {
+ return true;
+ }
+ if (hasCircularUnionInheritance(type, memberTypes.at(i), namePool)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+static inline bool wxsTypeMatches(const SchemaType::Ptr &type, const SchemaType::Ptr &otherType, QSet<SchemaType::Ptr> &visitedTypes, SchemaType::Ptr &conflictingType)
+{
+ if (!otherType)
+ return false;
+
+ if (visitedTypes.contains(otherType)) { // inheritance loop detected
+ conflictingType = otherType;
+ return true;
+ } else {
+ visitedTypes.insert(otherType);
+ }
+
+ if (type == otherType)
+ return true;
+
+ return wxsTypeMatches(type, otherType->wxsSuperType(), visitedTypes, conflictingType);
+}
+
+void XsdSchemaChecker::checkBasicCircularInheritances()
+{
+ // check all global types...
+ SchemaType::List types = m_schema->types();
+
+ // .. and anonymous types
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+ const QSourceLocation location = sourceLocationForType(type);
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 3)
+
+ // check normal base type inheritance
+ QSet<SchemaType::Ptr> visitedTypes;
+ SchemaType::Ptr conflictingType;
+
+ if (wxsTypeMatches(type, type->wxsSuperType(), visitedTypes, conflictingType)) {
+ if (conflictingType)
+ m_context->error(QtXmlPatterns::tr("%1 has inheritance loop in its base type %2")
+ .arg(formatType(m_namePool, type))
+ .arg(formatType(m_namePool, conflictingType)),
+ XsdSchemaContext::XSDError, location);
+ else
+ m_context->error(QtXmlPatterns::tr("circular inheritance of base type %1").arg(formatType(m_namePool, type)), XsdSchemaContext::XSDError, location);
+
+ return;
+ }
+ }
+}
+
+void XsdSchemaChecker::checkCircularInheritances()
+{
+ // check all global types...
+ SchemaType::List types = m_schema->types();
+
+ // .. and anonymous types
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+ const QSourceLocation location = sourceLocationForType(type);
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 3)
+
+ // check normal base type inheritance
+ QSet<SchemaType::Ptr> visitedTypes;
+ if (matchesType(type, type->wxsSuperType(), visitedTypes)) {
+ m_context->error(QtXmlPatterns::tr("circular inheritance of base type %1").arg(formatType(m_namePool, type)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // check union member inheritance
+ if (type->isSimpleType() && type->isDefinedBySchema()) {
+ const XsdSimpleType::Ptr simpleType = type;
+ if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) {
+ const XsdSimpleType::List memberTypes = simpleType->memberTypes();
+ for (int j = 0; j < memberTypes.count(); ++j) {
+ if (hasCircularUnionInheritance(simpleType, memberTypes.at(j), m_namePool)) {
+ m_context->error(QtXmlPatterns::tr("circular inheritance of union %1").arg(formatType(m_namePool, type)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+
+void XsdSchemaChecker::checkInheritanceRestrictions()
+{
+ // check all global types...
+ SchemaType::List types = m_schema->types();
+
+ // .. and anonymous types
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+ const QSourceLocation location = sourceLocationForType(type);
+
+ // check inheritance restrictions given by final property of base class
+ const SchemaType::Ptr baseType = type->wxsSuperType();
+ if (baseType->isDefinedBySchema()) {
+ if ((type->derivationMethod() == SchemaType::DerivationRestriction) && (baseType->derivationConstraints() & SchemaType::RestrictionConstraint)) {
+ m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by restriction as the latter defines it as final")
+ .arg(formatType(m_namePool, type))
+ .arg(formatType(m_namePool, baseType)), XsdSchemaContext::XSDError, location);
+ return;
+ } else if ((type->derivationMethod() == SchemaType::DerivationExtension) && (baseType->derivationConstraints() & SchemaType::ExtensionConstraint)) {
+ m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by extension as the latter defines it as final")
+ .arg(formatType(m_namePool, type))
+ .arg(formatType(m_namePool, baseType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ }
+}
+
+void XsdSchemaChecker::checkBasicSimpleTypeConstraints()
+{
+ // check all global types...
+ SchemaType::List types = m_schema->types();
+
+ // .. and anonymous types
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+
+ if (!type->isSimpleType())
+ continue;
+
+ const XsdSimpleType::Ptr simpleType = type;
+
+ const QSourceLocation location = sourceLocation(simpleType);
+
+ // check inheritance restrictions of simple type defined by schema constraints
+ const SchemaType::Ptr baseType = simpleType->wxsSuperType();
+
+ if (baseType->isComplexType() && (simpleType->name(m_namePool) != BuiltinTypes::xsAnySimpleType->name(m_namePool))) {
+ m_context->error(QtXmlPatterns::tr("base type of simple type %1 cannot be complex type %2")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatType(m_namePool, baseType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ if (baseType == BuiltinTypes::xsAnyType) {
+ if (type->name(m_namePool) != BuiltinTypes::xsAnySimpleType->name(m_namePool)) {
+ m_context->error(QtXmlPatterns::tr("simple type %1 cannot have direct base type %2")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatType(m_namePool, BuiltinTypes::xsAnyType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ }
+}
+
+void XsdSchemaChecker::checkSimpleTypeConstraints()
+{
+ // check all global types...
+ SchemaType::List types = m_schema->types();
+
+ // .. and anonymous types
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+
+ if (!type->isSimpleType())
+ continue;
+
+ const XsdSimpleType::Ptr simpleType = type;
+
+ const QSourceLocation location = sourceLocation(simpleType);
+
+ if (simpleType->category() == XsdSimpleType::None) {
+ // additional checks
+ // check that no user defined type has xs:AnySimpleType as base type (except xs:AnyAtomicType)
+ if (simpleType->wxsSuperType()->name(m_namePool) == BuiltinTypes::xsAnySimpleType->name(m_namePool)) {
+ if (simpleType->name(m_namePool) != BuiltinTypes::xsAnyAtomicType->name(m_namePool)) {
+ m_context->error(QtXmlPatterns::tr("simple type %1 is not allowed to have base type %2")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatType(m_namePool, simpleType->wxsSuperType())),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ // check that no user defined type has xs:AnyAtomicType as base type
+ if (simpleType->wxsSuperType()->name(m_namePool) == BuiltinTypes::xsAnyAtomicType->name(m_namePool)) {
+ m_context->error(QtXmlPatterns::tr("simple type %1 is not allowed to have base type %2")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatType(m_namePool, simpleType->wxsSuperType())),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#d0e37310
+ if (simpleType->category() == XsdSimpleType::SimpleTypeAtomic) {
+ // 1.1
+ if ((simpleType->wxsSuperType()->category() != XsdSimpleType::SimpleTypeAtomic) && (simpleType->name(m_namePool) != BuiltinTypes::xsAnyAtomicType->name(m_namePool))) {
+ m_context->error(QtXmlPatterns::tr("simple type %1 can only have simple atomic type as base type")
+ .arg(formatType(m_namePool, simpleType)),
+ XsdSchemaContext::XSDError, location);
+ }
+ // 1.2
+ if (simpleType->wxsSuperType()->derivationConstraints() & SchemaType::RestrictionConstraint) {
+ m_context->error(QtXmlPatterns::tr("simple type %1 cannot derive from %2 as the latter defines restriction as final")
+ .arg(formatType(m_namePool, simpleType->wxsSuperType()))
+ .arg(formatType(m_namePool, simpleType)),
+ XsdSchemaContext::XSDError, location);
+ }
+
+ // 1.3
+ // checked by checkConstrainingFacets already
+ } else if (simpleType->category() == XsdSimpleType::SimpleTypeList) {
+ const AnySimpleType::Ptr itemType = simpleType->itemType();
+
+ // 2.1 or @see http://www.w3.org/TR/xmlschema-2/#cos-list-of-atomic
+ if (itemType->category() != SchemaType::SimpleTypeAtomic && itemType->category() != SchemaType::SimpleTypeUnion) {
+ m_context->error(QtXmlPatterns::tr("variety of item type of %1 must be either atomic or union").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 2.1 second part
+ if (itemType->category() == SchemaType::SimpleTypeUnion && itemType->isDefinedBySchema()) {
+ const XsdSimpleType::Ptr simpleItemType = itemType;
+ const AnySimpleType::List memberTypes = simpleItemType->memberTypes();
+ for (int j = 0; j < memberTypes.count(); ++j) {
+ if (memberTypes.at(j)->category() != SchemaType::SimpleTypeAtomic) {
+ m_context->error(QtXmlPatterns::tr("variety of member types of %1 must be atomic").arg(formatType(m_namePool, simpleItemType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ }
+
+ // 2.2.1
+ if (simpleType->wxsSuperType()->name(m_namePool) == BuiltinTypes::xsAnySimpleType->name(m_namePool)) {
+ if (itemType->isSimpleType() && itemType->isDefinedBySchema()) {
+ const XsdSimpleType::Ptr simpleItemType = itemType;
+
+ // 2.2.1.1
+ if (simpleItemType->derivationConstraints() & XsdSimpleType::ListConstraint) {
+ m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by list as the latter defines it as final")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatType(m_namePool, simpleItemType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 2.2.1.2
+ const XsdFacet::Hash facets = simpleType->facets();
+ XsdFacet::HashIterator it(facets);
+
+ bool invalidFacetFound = false;
+ while (it.hasNext()) {
+ it.next();
+ if (it.key() != XsdFacet::WhiteSpace) {
+ invalidFacetFound = true;
+ break;
+ }
+ }
+
+ if (invalidFacetFound) {
+ m_context->error(QtXmlPatterns::tr("simple type %1 is only allowed to have %2 facet")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatKeyword("whiteSpace")),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ } else { // 2.2.2
+ // 2.2.2.1
+ if (simpleType->wxsSuperType()->category() != XsdSimpleType::SimpleTypeList) {
+ m_context->error(QtXmlPatterns::tr("base type of simple type %1 must have variety of type list").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 2.2.2.2
+ if (simpleType->wxsSuperType()->derivationConstraints() & SchemaType::RestrictionConstraint) {
+ m_context->error(QtXmlPatterns::tr("base type of simple type %1 has defined derivation by restriction as final").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 2.2.2.3
+ if (!XsdSchemaHelper::isSimpleDerivationOk(itemType, XsdSimpleType::Ptr(simpleType->wxsSuperType())->itemType(), SchemaType::DerivationConstraints())) {
+ m_context->error(QtXmlPatterns::tr("item type of base type does not match item type of %1").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 2.2.2.4
+ const XsdFacet::Hash facets = simpleType->facets();
+ XsdFacet::HashIterator it(facets);
+
+ bool invalidFacetFound = false;
+ XsdFacet::Type invalidFacetType = XsdFacet::None;
+ while (it.hasNext()) {
+ it.next();
+ const XsdFacet::Type facetType = it.key();
+ if (facetType != XsdFacet::Length &&
+ facetType != XsdFacet::MinimumLength &&
+ facetType != XsdFacet::MaximumLength &&
+ facetType != XsdFacet::WhiteSpace &&
+ facetType != XsdFacet::Pattern &&
+ facetType != XsdFacet::Enumeration) {
+ invalidFacetType = facetType;
+ invalidFacetFound = true;
+ break;
+ }
+ }
+
+ if (invalidFacetFound) {
+ m_context->error(QtXmlPatterns::tr("simple type %1 contains not allowed facet type %2")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatKeyword(XsdFacet::typeName(invalidFacetType))),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 2.2.2.5
+ // TODO: check value constraints
+ }
+
+
+ } else if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) {
+ const AnySimpleType::List memberTypes = simpleType->memberTypes();
+
+ if (simpleType->wxsSuperType()->name(m_namePool) == BuiltinTypes::xsAnySimpleType->name(m_namePool)) { // 3.1.1
+ // 3.3.1.1
+ for (int i = 0; i < memberTypes.count(); ++i) {
+ const AnySimpleType::Ptr memberType = memberTypes.at(i);
+
+ if (memberType->derivationConstraints() & XsdSimpleType::UnionConstraint) {
+ m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by union as the latter defines it as final")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatType(m_namePool, memberType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+
+ // 3.3.1.2
+ if (!simpleType->facets().isEmpty()) {
+ m_context->error(QtXmlPatterns::tr("%1 is not allowed to have any facets")
+ .arg(formatType(m_namePool, simpleType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ } else {
+ // 3.1.2.1
+ if (simpleType->wxsSuperType()->category() != SchemaType::SimpleTypeUnion) {
+ m_context->error(QtXmlPatterns::tr("base type %1 of simple type %2 must have variety of union")
+ .arg(formatType(m_namePool, simpleType->wxsSuperType()))
+ .arg(formatType(m_namePool, simpleType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 3.1.2.2
+ if (simpleType->wxsSuperType()->derivationConstraints() & SchemaType::DerivationRestriction) {
+ m_context->error(QtXmlPatterns::tr("base type %1 of simple type %2 is not allowed to have restriction in %3 attribute")
+ .arg(formatType(m_namePool, simpleType->wxsSuperType()))
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatAttribute("final")),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ //3.1.2.3
+ if (simpleType->wxsSuperType()->isDefinedBySchema()) {
+ const XsdSimpleType::Ptr simpleBaseType(simpleType->wxsSuperType());
+
+ AnySimpleType::List baseMemberTypes = simpleBaseType->memberTypes();
+ for (int i = 0; i < memberTypes.count(); ++i) {
+ const AnySimpleType::Ptr memberType = memberTypes.at(i);
+ const AnySimpleType::Ptr baseMemberType = baseMemberTypes.at(i);
+
+ if (!XsdSchemaHelper::isSimpleDerivationOk(memberType, baseMemberType, SchemaType::DerivationConstraints())) {
+ m_context->error(QtXmlPatterns::tr("member type %1 cannot be derived from member type %2 of %3's base type %4")
+ .arg(formatType(m_namePool, memberType))
+ .arg(formatType(m_namePool, baseMemberType))
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatType(m_namePool, simpleBaseType)),
+ XsdSchemaContext::XSDError, location);
+ }
+ }
+ }
+
+ // 3.1.2.4
+ const XsdFacet::Hash facets = simpleType->facets();
+ XsdFacet::HashIterator it(facets);
+
+ bool invalidFacetFound = false;
+ XsdFacet::Type invalidFacetType = XsdFacet::None;
+ while (it.hasNext()) {
+ it.next();
+ const XsdFacet::Type facetType = it.key();
+ if (facetType != XsdFacet::Pattern &&
+ facetType != XsdFacet::Enumeration) {
+ invalidFacetType = facetType;
+ invalidFacetFound = true;
+ break;
+ }
+ }
+
+ if (invalidFacetFound) {
+ m_context->error(QtXmlPatterns::tr("simple type %1 contains not allowed facet type %2")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatKeyword(XsdFacet::typeName(invalidFacetType))),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 3.1.2.5
+ // TODO: check value constraints
+ }
+ }
+ }
+}
+
+void XsdSchemaChecker::checkBasicComplexTypeConstraints()
+{
+ // check all global types...
+ SchemaType::List types = m_schema->types();
+
+ // .. and anonymous types
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+
+ if (!type->isComplexType() || !type->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType = type;
+
+ const QSourceLocation location = sourceLocation(complexType);
+
+ // check inheritance restrictions of complex type defined by schema constraints
+ const SchemaType::Ptr baseType = complexType->wxsSuperType();
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 2)
+ if (baseType->isSimpleType() && (complexType->derivationMethod() != XsdComplexType::DerivationExtension)) {
+ m_context->error(QtXmlPatterns::tr("derivation method of %1 must be extension because the base type %2 is a simple type")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, baseType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+}
+
+void XsdSchemaChecker::checkComplexTypeConstraints()
+{
+ // check all global types...
+ SchemaType::List types = m_schema->types();
+
+ // .. and anonymous types
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+
+ if (!type->isComplexType() || !type->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType = type;
+
+ const QSourceLocation location = sourceLocation(complexType);
+
+ if (complexType->contentType()->particle()) {
+ XsdElement::Ptr duplicatedElement;
+ if (XsdParticleChecker::hasDuplicatedElements(complexType->contentType()->particle(), m_namePool, duplicatedElement)) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 has duplicated element %2 in its content model")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatKeyword(duplicatedElement->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ if (!XsdParticleChecker::isUPAConform(complexType->contentType()->particle(), m_namePool)) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 has non-deterministic content")
+ .arg(formatType(m_namePool, complexType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+
+ // check inheritance restrictions of complex type defined by schema constraints
+ const SchemaType::Ptr baseType = complexType->wxsSuperType();
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-ct-extends
+ if (complexType->derivationMethod() == XsdComplexType::DerivationExtension) {
+ if (baseType->isComplexType() && baseType->isDefinedBySchema()) {
+ const XsdComplexType::Ptr complexBaseType = baseType;
+
+ // we can skip 1.1 here, as it is tested in checkInheritanceRestrictions() already
+
+ // 1.2 and 1.3
+ QString errorMsg;
+ if (!XsdSchemaHelper::isValidAttributeUsesExtension(complexType->attributeUses(), complexBaseType->attributeUses(),
+ complexType->attributeWildcard(), complexBaseType->attributeWildcard(), m_context, errorMsg)) {
+ m_context->error(QtXmlPatterns::tr("attributes of complex type %1 are not a valid extension of the attributes of base type %2: %3")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, baseType))
+ .arg(errorMsg),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 1.4
+ bool validContentType = false;
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
+ if (complexType->contentType()->simpleType() == complexBaseType->contentType()->simpleType()) {
+ validContentType = true; // 1.4.1
+ }
+ } else if (complexType->contentType()->variety() == XsdComplexType::ContentType::Empty && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Empty) {
+ validContentType = true; // 1.4.2
+ } else { // 1.4.3
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed) { // 1.4.3.1
+ if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Empty) {
+ validContentType = true; // 1.4.3.2.1
+ } else { // 1.4.3.2.2
+ if (complexType->contentType()->particle()) { // our own check
+ if ((complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly) ||
+ (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) { // 1.4.3.2.2.1
+ if (isValidParticleExtension(complexType->contentType()->particle(), complexBaseType->contentType()->particle())) {
+ validContentType = true; // 1.4.3.2.2.2
+ }
+ }
+ }
+ // 1.4.3.2.2.3 and 1.4.3.2.2.4 handle 'open content' that we do not support yet
+ }
+ }
+ }
+
+ // 1.5 WTF?!?
+
+ if (!validContentType) {
+ m_context->error(QtXmlPatterns::tr("content model of complex type %1 is not a valid extension of content model of %2")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, complexBaseType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ } else if (baseType->isSimpleType()) {
+ // 2.1
+ if (complexType->contentType()->variety() != XsdComplexType::ContentType::Simple) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 must have simple content")
+ .arg(formatType(m_namePool, complexType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ if (complexType->contentType()->simpleType() != baseType) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 must have the same simple type as its base class %2")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, baseType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // 2.2 tested in checkInheritanceRestrictions() already
+ }
+ } else if (complexType->derivationMethod() == XsdComplexType::DerivationRestriction) {
+ // @see http://www.w3.org/TR/xmlschema11-1/#d0e21402
+ const SchemaType::Ptr baseType(complexType->wxsSuperType());
+
+ bool derivationOk = false;
+ QString errorMsg;
+
+ // we can partly skip 1 here, as it is tested in checkInheritanceRestrictions() already
+ if (baseType->isComplexType()) {
+
+ // 2.1
+ if (baseType->name(m_namePool) == BuiltinTypes::xsAnyType->name(m_namePool)) {
+ derivationOk = true;
+ }
+
+ if (baseType->isDefinedBySchema()) {
+ const XsdComplexType::Ptr complexBaseType(baseType);
+
+ // 2.2.1
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
+ // 2.2.2.1
+ if (XsdSchemaHelper::isSimpleDerivationOk(complexType->contentType()->simpleType(), complexBaseType->contentType()->simpleType(), SchemaType::DerivationConstraints()))
+ derivationOk = true;
+
+ // 2.2.2.2
+ if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed) {
+ if (XsdSchemaHelper::isParticleEmptiable(complexBaseType->contentType()->particle()))
+ derivationOk = true;
+ }
+ }
+
+ // 2.3.1
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Empty) {
+ // 2.3.2.1
+ if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Empty)
+ derivationOk = true;
+
+ // 2.3.2.2
+ if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed) {
+ if (XsdSchemaHelper::isParticleEmptiable(complexBaseType->contentType()->particle()))
+ derivationOk = true;
+ }
+ }
+
+ // 2.4.1.1
+ if (((complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly) &&
+ (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) ||
+ // 2.4.1.2
+ (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) {
+
+ // 2.4.2
+ if (XsdParticleChecker::subsumes(complexBaseType->contentType()->particle(), complexType->contentType()->particle(), m_context, errorMsg))
+ derivationOk = true;
+ }
+ }
+ }
+
+ if (!derivationOk) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 cannot be derived from base type %2%3")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, baseType))
+ .arg(errorMsg.isEmpty() ? QString() : QLatin1String(": ") + errorMsg),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ if (baseType->isDefinedBySchema()) {
+ const XsdComplexType::Ptr complexBaseType(baseType);
+
+ QString errorMsg;
+ if (!XsdSchemaHelper::isValidAttributeUsesRestriction(complexType->attributeUses(), complexBaseType->attributeUses(),
+ complexType->attributeWildcard(), complexBaseType->attributeWildcard(), m_context, errorMsg)) {
+ m_context->error(QtXmlPatterns::tr("attributes of complex type %1 are not a valid restriction from the attributes of base type %2: %3")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, baseType))
+ .arg(errorMsg),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ }
+
+ // check that complex type with simple content is not allowed to inherit from
+ // built in complex type xs:AnyType
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
+ if (baseType->name(m_namePool) == BuiltinTypes::xsAnyType->name(m_namePool)) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 with simple content cannot be derived from complex base type %2")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, baseType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ }
+}
+
+void XsdSchemaChecker::checkSimpleDerivationRestrictions()
+{
+ // check all global types...
+ SchemaType::List types = m_schema->types();
+
+ // .. and anonymous types
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+
+ if (type->isComplexType())
+ continue;
+
+ if (type->category() != SchemaType::SimpleTypeList && type->category() != SchemaType::SimpleTypeUnion)
+ continue;
+
+ const XsdSimpleType::Ptr simpleType = type;
+ const QSourceLocation location = sourceLocation(simpleType);
+
+ // check all simple types derived by list
+ if (simpleType->category() == XsdSimpleType::SimpleTypeList) {
+ const AnySimpleType::Ptr itemType = simpleType->itemType();
+
+ if (itemType->isComplexType()) {
+ m_context->error(QtXmlPatterns::tr("item type of simple type %1 cannot be a complex type")
+ .arg(formatType(m_namePool, simpleType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+
+ if (itemType->isSimpleType() && itemType->isDefinedBySchema()) {
+ const XsdSimpleType::Ptr simpleItemType = itemType;
+ if (simpleItemType->derivationConstraints() & XsdSimpleType::ListConstraint) {
+ m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by list as the latter defines it as final")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatType(m_namePool, simpleItemType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#cos-list-of-atomic
+ if (itemType->category() != SchemaType::SimpleTypeAtomic && itemType->category() != SchemaType::SimpleTypeUnion) {
+ m_context->error(QtXmlPatterns::tr("variety of item type of %1 must be either atomic or union").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ if (itemType->category() == SchemaType::SimpleTypeUnion && itemType->isDefinedBySchema()) {
+ const XsdSimpleType::Ptr simpleItemType = itemType;
+ const AnySimpleType::List memberTypes = simpleItemType->memberTypes();
+ for (int j = 0; j < memberTypes.count(); ++j) {
+ if (memberTypes.at(j)->category() != SchemaType::SimpleTypeAtomic) {
+ m_context->error(QtXmlPatterns::tr("variety of member types of %1 must be atomic").arg(formatType(m_namePool, simpleItemType)), XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ }
+ }
+
+ // check all simple types derived by union
+ if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) {
+ const AnySimpleType::List memberTypes = simpleType->memberTypes();
+
+ for (int i = 0; i < memberTypes.count(); ++i) {
+ const AnySimpleType::Ptr memberType = memberTypes.at(i);
+
+ if (memberType->isComplexType()) {
+ m_context->error(QtXmlPatterns::tr("member type of simple type %1 cannot be a complex type")
+ .arg(formatType(m_namePool, simpleType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#cos-no-circular-unions
+ if (simpleType->name(m_namePool) == memberType->name(m_namePool)) {
+ m_context->error(QtXmlPatterns::tr("%1 is not allowed to have a member type with the same name as itself")
+ .arg(formatType(m_namePool, simpleType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+
+ if (memberType->isSimpleType() && memberType->isDefinedBySchema()) {
+ const XsdSimpleType::Ptr simpleMemberType = memberType;
+ if (simpleMemberType->derivationConstraints() & XsdSimpleType::UnionConstraint) {
+ m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by union as the latter defines it as final")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatType(m_namePool, simpleMemberType)),
+ XsdSchemaContext::XSDError, location);
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+
+void XsdSchemaChecker::checkConstrainingFacets()
+{
+ // first the global simple types
+ const SchemaType::List types = m_schema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ if (!(types.at(i)->isSimpleType()) || !(types.at(i)->isDefinedBySchema()))
+ continue;
+
+ const XsdSimpleType::Ptr simpleType = types.at(i);
+ checkConstrainingFacets(simpleType->facets(), simpleType);
+ }
+
+ // and afterwards all anonymous simple types
+ const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
+ for (int i = 0; i < anonymousTypes.count(); ++i) {
+ if (!(anonymousTypes.at(i)->isSimpleType()) || !(anonymousTypes.at(i)->isDefinedBySchema()))
+ continue;
+
+ const XsdSimpleType::Ptr simpleType = anonymousTypes.at(i);
+ checkConstrainingFacets(simpleType->facets(), simpleType);
+ }
+}
+
+void XsdSchemaChecker::checkConstrainingFacets(const XsdFacet::Hash &facets, const XsdSimpleType::Ptr &simpleType)
+{
+ if (facets.isEmpty())
+ return;
+
+ SchemaType::Ptr comparableBaseType;
+ if (!simpleType->wxsSuperType()->isDefinedBySchema())
+ comparableBaseType = simpleType->wxsSuperType();
+ else
+ comparableBaseType = simpleType->primitiveType();
+
+ const XsdSchemaSourceLocationReflection reflection(sourceLocation(simpleType));
+
+ // start checks
+ if (facets.contains(XsdFacet::Length)) {
+ const XsdFacet::Ptr lengthFacet = facets.value(XsdFacet::Length);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr lengthValue = lengthFacet->value();
+
+ // @see http://www.w3.org/TR/xmlschema-2/#length-minLength-maxLength
+ if (facets.contains(XsdFacet::MinimumLength)) {
+ const XsdFacet::Ptr minLengthFacet = facets.value(XsdFacet::MinimumLength);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr minLengthValue = minLengthFacet->value();
+
+ bool foundSuperMinimumLength = false;
+ SchemaType::Ptr baseType = simpleType->wxsSuperType();
+ while (baseType) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(baseType);
+ if (baseFacets.contains(XsdFacet::MinimumLength) && !baseFacets.contains(XsdFacet::Length)) {
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr superValue(baseFacets.value(XsdFacet::MinimumLength)->value());
+ if (minLengthValue->toInteger() == superValue->toInteger()) {
+ foundSuperMinimumLength = true;
+ break;
+ }
+ }
+
+ baseType = baseType->wxsSuperType();
+ }
+
+ if ((minLengthValue->toInteger() > lengthValue->toInteger()) || !foundSuperMinimumLength) {
+ m_context->error(QtXmlPatterns::tr("%1 facet collides with %2 facet")
+ .arg(formatKeyword("length"))
+ .arg(formatKeyword("minLength")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#length-minLength-maxLength
+ if (facets.contains(XsdFacet::MaximumLength)) {
+ const XsdFacet::Ptr maxLengthFacet = facets.value(XsdFacet::MaximumLength);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr maxLengthValue = maxLengthFacet->value();
+
+ bool foundSuperMaximumLength = false;
+ SchemaType::Ptr baseType = simpleType->wxsSuperType();
+ while (baseType) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(baseType);
+ if (baseFacets.contains(XsdFacet::MaximumLength) && !baseFacets.contains(XsdFacet::Length)) {
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr superValue(baseFacets.value(XsdFacet::MaximumLength)->value());
+ if (maxLengthValue->toInteger() == superValue->toInteger()) {
+ foundSuperMaximumLength = true;
+ break;
+ }
+ }
+
+ baseType = baseType->wxsSuperType();
+ }
+
+ if ((maxLengthValue->toInteger() < lengthValue->toInteger()) || !foundSuperMaximumLength) {
+ m_context->error(QtXmlPatterns::tr("%1 facet collides with %2 facet")
+ .arg(formatKeyword("length"))
+ .arg(formatKeyword("maxLength")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#length-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::Length)) {
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr baseValue = baseFacets.value(XsdFacet::Length)->value();
+ if (lengthValue->toInteger() != baseValue->toInteger()) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must have the same value as %2 facet of base type")
+ .arg(formatKeyword("length"))
+ .arg(formatKeyword("length")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+
+ if (facets.contains(XsdFacet::MinimumLength)) {
+ const XsdFacet::Ptr minLengthFacet = facets.value(XsdFacet::MinimumLength);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr minLengthValue = minLengthFacet->value();
+
+ if (facets.contains(XsdFacet::MaximumLength)) {
+ const XsdFacet::Ptr maxLengthFacet = facets.value(XsdFacet::MaximumLength);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr maxLengthValue = maxLengthFacet->value();
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minLength-less-than-equal-to-maxLength
+ if (maxLengthValue->toInteger() < minLengthValue->toInteger()) {
+ m_context->error(QtXmlPatterns::tr("%1 facet collides with %2 facet")
+ .arg(formatKeyword("minLength"))
+ .arg(formatKeyword("maxLength")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minLength-valid-restriction
+ //TODO: check parent facets
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minLength-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::MinimumLength)) {
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr baseValue = baseFacets.value(XsdFacet::MinimumLength)->value();
+ if (minLengthValue->toInteger() < baseValue->toInteger()) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be equal or greater than %2 facet of base type")
+ .arg(formatKeyword("minLength"))
+ .arg(formatKeyword("minLength")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::MaximumLength)) {
+ const XsdFacet::Ptr maxLengthFacet = facets.value(XsdFacet::MaximumLength);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr maxLengthValue = maxLengthFacet->value();
+
+ // @see http://www.w3.org/TR/xmlschema-2/#maxLength-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::MaximumLength)) {
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr baseValue(baseFacets.value(XsdFacet::MaximumLength)->value());
+ if (maxLengthValue->toInteger() > baseValue->toInteger()) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type")
+ .arg(formatKeyword("maxLength"))
+ .arg(formatKeyword("maxLength")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::Pattern)) {
+ // we keep the patterns in separated facets
+ // @see http://www.w3.org/TR/xmlschema-2/#src-multiple-patterns
+
+ // @see http://www.w3.org/TR/xmlschema-2/#cvc-pattern-valid
+ const XsdFacet::Ptr patternFacet = facets.value(XsdFacet::Pattern);
+ const AtomicValue::List multiValue = patternFacet->multiValue();
+
+ for (int i = 0; i < multiValue.count(); ++i) {
+ const DerivedString<TypeString>::Ptr value = multiValue.at(i);
+ const QRegExp exp = PatternPlatform::parsePattern(value->stringValue(), m_context, &reflection);
+ if (!exp.isValid()) {
+ m_context->error(QtXmlPatterns::tr("%1 facet contains invalid regular expression").arg(formatKeyword("pattern")), XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::Enumeration)) {
+ // @see http://www.w3.org/TR/xmlschema-2/#src-multiple-enumerations
+
+ const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration);
+
+ if (BuiltinTypes::xsNOTATION->wxsTypeMatches(simpleType)) {
+ const AtomicValue::List notationNames = facet->multiValue();
+ for (int k = 0; k < notationNames.count(); ++k) {
+ const QNameValue::Ptr notationName = notationNames.at(k);
+ if (!m_schema->notation(notationName->qName())) {
+ m_context->error(QtXmlPatterns::tr("unknown notation %1 used in %2 facet")
+ .arg(formatKeyword(m_namePool, notationName->qName()))
+ .arg(formatKeyword("enumeration")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ }
+ }
+ } else if (BuiltinTypes::xsQName->wxsTypeMatches(simpleType)) {
+ } else {
+ const XsdTypeChecker checker(m_context, QVector<QXmlName>(), sourceLocation(simpleType));
+
+ const AnySimpleType::Ptr baseType = simpleType->wxsSuperType();
+ const XsdFacet::Hash baseFacets = XsdTypeChecker::mergedFacetsForType(baseType, m_context);
+
+ const AtomicValue::List multiValue = facet->multiValue();
+ for (int k = 0; k < multiValue.count(); ++k) {
+ const QString stringValue = multiValue.at(k)->as<DerivedString<TypeString> >()->stringValue();
+ const QString actualValue = XsdTypeChecker::normalizedValue(stringValue, baseFacets);
+
+ QString errorMsg;
+ if (!checker.isValidString(actualValue, baseType, errorMsg)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet contains invalid value %2: %3")
+ .arg(formatKeyword("enumeration"))
+ .arg(formatData(stringValue))
+ .arg(errorMsg),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::WhiteSpace)) {
+ const XsdFacet::Ptr whiteSpaceFacet = facets.value(XsdFacet::WhiteSpace);
+ const DerivedString<TypeString>::Ptr whiteSpaceValue = whiteSpaceFacet->value();
+
+ // @see http://www.w3.org/TR/xmlschema-2/#whiteSpace-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::WhiteSpace)) {
+ const QString value = whiteSpaceValue->stringValue();
+ const QString baseValue = DerivedString<TypeString>::Ptr(baseFacets.value(XsdFacet::WhiteSpace)->value())->stringValue();
+ if (value == XsdSchemaToken::toString(XsdSchemaToken::Replace) || value == XsdSchemaToken::toString(XsdSchemaToken::Preserve)) {
+ if (baseValue == XsdSchemaToken::toString(XsdSchemaToken::Collapse)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet cannot be %2 or %3 if %4 facet of base type is %5")
+ .arg(formatKeyword("whiteSpace"))
+ .arg(formatData("replace"))
+ .arg(formatData("preserve"))
+ .arg(formatKeyword("whiteSpace"))
+ .arg(formatData("collapse")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ if (value == XsdSchemaToken::toString(XsdSchemaToken::Preserve) && baseValue == XsdSchemaToken::toString(XsdSchemaToken::Replace)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet cannot be %2 if %3 facet of base type is %4")
+ .arg(formatKeyword("whiteSpace"))
+ .arg(formatData("preserve"))
+ .arg(formatKeyword("whiteSpace"))
+ .arg(formatData("replace")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::MaximumInclusive)) {
+ const XsdFacet::Ptr maxFacet = facets.value(XsdFacet::MaximumInclusive);
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minInclusive-less-than-equal-to-maxInclusive
+ if (facets.contains(XsdFacet::MinimumInclusive)) {
+ const XsdFacet::Ptr minFacet = facets.value(XsdFacet::MinimumInclusive);
+
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterThan, maxFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet")
+ .arg(formatKeyword("minInclusive"))
+ .arg(formatKeyword("maxInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#maxInclusive-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::MaximumInclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumInclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type")
+ .arg(formatKeyword("maxInclusive"))
+ .arg(formatKeyword("maxInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (baseFacets.contains(XsdFacet::MaximumExclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumExclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorGreaterOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet of base type")
+ .arg(formatKeyword("maxInclusive"))
+ .arg(formatKeyword("maxExclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::MaximumExclusive)) {
+ const XsdFacet::Ptr maxFacet = facets.value(XsdFacet::MaximumExclusive);
+
+ // @see http://www.w3.org/TR/xmlschema-2/#maxInclusive-maxExclusive
+ if (facets.contains(XsdFacet::MaximumInclusive)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet and %2 facet cannot appear together")
+ .arg(formatKeyword("maxExclusive"))
+ .arg(formatKeyword("maxInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minExclusive-less-than-equal-to-maxExclusive
+ if (facets.contains(XsdFacet::MinimumExclusive)) {
+ const XsdFacet::Ptr minFacet = facets.value(XsdFacet::MinimumExclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterThan, maxFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet")
+ .arg(formatKeyword("minExclusive"))
+ .arg(formatKeyword("maxExclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#maxExclusive-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::MaximumExclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumExclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type")
+ .arg(formatKeyword("maxExclusive"))
+ .arg(formatKeyword("maxExclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (baseFacets.contains(XsdFacet::MaximumInclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumInclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type")
+ .arg(formatKeyword("maxExclusive"))
+ .arg(formatKeyword("maxInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (baseFacets.contains(XsdFacet::MinimumInclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumInclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorLessOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be greater than %2 facet of base type")
+ .arg(formatKeyword("maxExclusive"))
+ .arg(formatKeyword("minInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (baseFacets.contains(XsdFacet::MinimumExclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumExclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorLessOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be greater than %2 facet of base type")
+ .arg(formatKeyword("maxExclusive"))
+ .arg(formatKeyword("minExclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::MinimumExclusive)) {
+ const XsdFacet::Ptr minFacet = facets.value(XsdFacet::MinimumExclusive);
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minInclusive-minExclusive
+ if (facets.contains(XsdFacet::MinimumInclusive)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet and %2 facet cannot appear together")
+ .arg(formatKeyword("minExclusive"))
+ .arg(formatKeyword("minInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minExclusive-less-than-maxInclusive
+ if (facets.contains(XsdFacet::MaximumInclusive)) {
+ const XsdFacet::Ptr maxFacet = facets.value(XsdFacet::MaximumInclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterOrEqual, maxFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet")
+ .arg(formatKeyword("minExclusive"))
+ .arg(formatKeyword("maxInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minExclusive-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::MinimumExclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumExclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorLessThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be greater than or equal to %2 facet of base type")
+ .arg(formatKeyword("minExclusive"))
+ .arg(formatKeyword("minExclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (baseFacets.contains(XsdFacet::MaximumExclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumExclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet of base type")
+ .arg(formatKeyword("minExclusive"))
+ .arg(formatKeyword("maxExclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (baseFacets.contains(XsdFacet::MaximumInclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumInclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type")
+ .arg(formatKeyword("minExclusive"))
+ .arg(formatKeyword("maxInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::MinimumInclusive)) {
+ const XsdFacet::Ptr minFacet = facets.value(XsdFacet::MinimumInclusive);
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minInclusive-less-than-maxExclusive
+ if (facets.contains(XsdFacet::MaximumExclusive)) {
+ const XsdFacet::Ptr maxFacet = facets.value(XsdFacet::MaximumExclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterOrEqual, maxFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet")
+ .arg(formatKeyword("minInclusive"))
+ .arg(formatKeyword("maxExclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#minInclusive-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::MinimumInclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumInclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorLessThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be greater than or equal to %2 facet of base type")
+ .arg(formatKeyword("minInclusive"))
+ .arg(formatKeyword("minInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (baseFacets.contains(XsdFacet::MinimumExclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumExclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorLessOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be greater than %2 facet of base type")
+ .arg(formatKeyword("minInclusive"))
+ .arg(formatKeyword("minExclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (baseFacets.contains(XsdFacet::MaximumInclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumInclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type")
+ .arg(formatKeyword("minInclusive"))
+ .arg(formatKeyword("maxInclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ if (baseFacets.contains(XsdFacet::MaximumExclusive)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumExclusive);
+ if (comparableBaseType) {
+ if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet of base type")
+ .arg(formatKeyword("minInclusive"))
+ .arg(formatKeyword("maxExclusive")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::TotalDigits)) {
+ const XsdFacet::Ptr totalDigitsFacet = facets.value(XsdFacet::TotalDigits);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr totalDigitsValue = totalDigitsFacet->value();
+
+ // @see http://www.w3.org/TR/xmlschema-2/#totalDigits-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::TotalDigits)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::TotalDigits);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr baseValue = baseFacet->value();
+
+ if (totalDigitsValue->toInteger() > baseValue->toInteger()) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type")
+ .arg(formatKeyword("totalDigits"))
+ .arg(formatKeyword("totalDigits")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ if (facets.contains(XsdFacet::FractionDigits)) {
+ const XsdFacet::Ptr fractionDigitsFacet = facets.value(XsdFacet::FractionDigits);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr fractionDigitsValue = fractionDigitsFacet->value();
+
+ // http://www.w3.org/TR/xmlschema-2/#fractionDigits-totalDigits
+ if (facets.contains(XsdFacet::TotalDigits)) {
+ const XsdFacet::Ptr totalDigitsFacet = facets.value(XsdFacet::TotalDigits);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr totalDigitsValue = totalDigitsFacet->value();
+
+ if (fractionDigitsValue->toInteger() > totalDigitsValue->toInteger()) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet")
+ .arg(formatKeyword("fractionDigits"))
+ .arg(formatKeyword("totalDigits")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#fractionDigits-valid-restriction
+ if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) {
+ const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType());
+ if (baseFacets.contains(XsdFacet::FractionDigits)) {
+ const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::FractionDigits);
+ const DerivedInteger<TypeNonNegativeInteger>::Ptr baseValue = baseFacet->value();
+
+ if (fractionDigitsValue->toInteger() > baseValue->toInteger()) {
+ m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type")
+ .arg(formatKeyword("fractionDigits"))
+ .arg(formatKeyword("fractionDigits")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+
+
+ // check whether facets are allowed for simple types variety
+ if (simpleType->wxsSuperType()->category() == SchemaType::SimpleTypeAtomic) {
+ if (simpleType->primitiveType()) {
+ const QXmlName primitiveTypeName = simpleType->primitiveType()->name(m_namePool);
+ if (m_allowedAtomicFacets.contains(primitiveTypeName)) {
+ const QSet<XsdFacet::Type> allowedFacets = m_allowedAtomicFacets.value(primitiveTypeName);
+ QSet<XsdFacet::Type> availableFacets = facets.keys().toSet();
+
+ if (!availableFacets.subtract(allowedFacets).isEmpty()) {
+ m_context->error(QtXmlPatterns::tr("simple type contains not allowed facet %1")
+ .arg(formatKeyword(XsdFacet::typeName(availableFacets.toList().first()))),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ } else if (simpleType->wxsSuperType()->category() == SchemaType::SimpleTypeList) {
+ if (facets.contains(XsdFacet::MaximumInclusive) || facets.contains(XsdFacet::MinimumInclusive) ||
+ facets.contains(XsdFacet::MaximumExclusive) || facets.contains(XsdFacet::MinimumExclusive) ||
+ facets.contains(XsdFacet::TotalDigits) || facets.contains(XsdFacet::FractionDigits))
+ {
+ m_context->error(QtXmlPatterns::tr("%1, %2, %3, %4, %5 and %6 facets are not allowed when derived by list")
+ .arg(formatKeyword("maxInclusive"))
+ .arg(formatKeyword("maxExclusive"))
+ .arg(formatKeyword("minInclusive"))
+ .arg(formatKeyword("minExclusive"))
+ .arg(formatKeyword("totalDigits"))
+ .arg(formatKeyword("fractionDigits")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ }
+ } else if (simpleType->wxsSuperType()->category() == SchemaType::SimpleTypeUnion) {
+ if (facets.contains(XsdFacet::MaximumInclusive) || facets.contains(XsdFacet::MinimumInclusive) ||
+ facets.contains(XsdFacet::MaximumExclusive) || facets.contains(XsdFacet::MinimumExclusive) ||
+ facets.contains(XsdFacet::TotalDigits) || facets.contains(XsdFacet::FractionDigits) ||
+ facets.contains(XsdFacet::MinimumLength) || facets.contains(XsdFacet::MaximumLength) ||
+ facets.contains(XsdFacet::Length) || facets.contains(XsdFacet::WhiteSpace))
+ {
+ m_context->error(QtXmlPatterns::tr("only %1 and %2 facets are allowed when derived by union")
+ .arg(formatKeyword("pattern"))
+ .arg(formatKeyword("enumeration")),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ }
+ }
+
+ // check whether value of facet matches the value space of the simple types base type
+ const SchemaType::Ptr baseType = simpleType->wxsSuperType();
+ if (!baseType->isDefinedBySchema()) {
+ const XsdSchemaSourceLocationReflection reflection(sourceLocation(simpleType));
+
+ XsdFacet::HashIterator it(facets);
+ while (it.hasNext()) {
+ it.next();
+ const XsdFacet::Ptr facet = it.value();
+ if (facet->type() == XsdFacet::MaximumInclusive ||
+ facet->type() == XsdFacet::MaximumExclusive ||
+ facet->type() == XsdFacet::MinimumInclusive ||
+ facet->type() == XsdFacet::MinimumExclusive) {
+ const DerivedString<TypeString>::Ptr stringValue = facet->value();
+ const AtomicValue::Ptr value = ValueFactory::fromLexical(stringValue->stringValue(), baseType, m_context, &reflection);
+ if (value->hasError()) {
+ m_context->error(QtXmlPatterns::tr("%1 contains %2 facet with invalid data: %3")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatKeyword(XsdFacet::typeName(facet->type())))
+ .arg(formatData(stringValue->stringValue())),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+
+ // @see http://www.w3.org/TR/xmlschema-2/#enumeration-valid-restriction
+ if (facet->type() == XsdFacet::Enumeration && baseType != BuiltinTypes::xsNOTATION) {
+ const AtomicValue::List multiValue = facet->multiValue();
+ for (int j = 0; j < multiValue.count(); ++j) {
+ const QString stringValue = DerivedString<TypeString>::Ptr(multiValue.at(j))->stringValue();
+ const AtomicValue::Ptr value = ValueFactory::fromLexical(stringValue, baseType, m_context, &reflection);
+ if (value->hasError()) {
+ m_context->error(QtXmlPatterns::tr("%1 contains %2 facet with invalid data: %3")
+ .arg(formatType(m_namePool, simpleType))
+ .arg(formatKeyword(XsdFacet::typeName(XsdFacet::Enumeration)))
+ .arg(formatData(stringValue)),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+
+void XsdSchemaChecker::checkDuplicatedAttributeUses()
+{
+ // first all global attribute groups
+ const XsdAttributeGroup::List attributeGroups = m_schema->attributeGroups();
+ for (int i = 0; i < attributeGroups.count(); ++i) {
+ const XsdAttributeGroup::Ptr attributeGroup = attributeGroups.at(i);
+ const XsdAttributeUse::List uses = attributeGroup->attributeUses();
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 4)
+ XsdAttribute::Ptr conflictingAttribute;
+ if (hasDuplicatedAttributeUses(uses, conflictingAttribute)) {
+ m_context->error(QtXmlPatterns::tr("attribute group %1 contains attribute %2 twice")
+ .arg(formatKeyword(attributeGroup->displayName(m_namePool)))
+ .arg(formatKeyword(conflictingAttribute->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, sourceLocation(attributeGroup));
+ return;
+ }
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 5)
+ if (hasMultipleIDAttributeUses(uses)) {
+ m_context->error(QtXmlPatterns::tr("attribute group %1 contains two different attributes that both have types derived from %2")
+ .arg(formatKeyword(attributeGroup->displayName(m_namePool)))
+ .arg(formatType(m_namePool, BuiltinTypes::xsID)),
+ XsdSchemaContext::XSDError, sourceLocation(attributeGroup));
+ return;
+ }
+
+ if (hasConstraintIDAttributeUse(uses, conflictingAttribute)) {
+ m_context->error(QtXmlPatterns::tr("attribute group %1 contains attribute %2 that has value constraint but type that inherits from %3")
+ .arg(formatKeyword(attributeGroup->displayName(m_namePool)))
+ .arg(formatKeyword(conflictingAttribute->displayName(m_namePool)))
+ .arg(formatType(m_namePool, BuiltinTypes::xsID)),
+ XsdSchemaContext::XSDError, sourceLocation(attributeGroup));
+ return;
+ }
+ }
+
+ // then the global and anonymous complex types
+ SchemaType::List types = m_schema->types();
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType = types.at(i);
+ const XsdAttributeUse::List attributeUses = complexType->attributeUses();
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 4)
+ XsdAttribute::Ptr conflictingAttribute;
+ if (hasDuplicatedAttributeUses(attributeUses, conflictingAttribute)) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 contains attribute %2 twice")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatKeyword(conflictingAttribute->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 5)
+ if (hasMultipleIDAttributeUses(attributeUses)) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 contains two different attributes that both have types derived from %2")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, BuiltinTypes::xsID)),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+
+ if (hasConstraintIDAttributeUse(attributeUses, conflictingAttribute)) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 contains attribute %2 that has value constraint but type that inherits from %3")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatKeyword(conflictingAttribute->displayName(m_namePool)))
+ .arg(formatType(m_namePool, BuiltinTypes::xsID)),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+ }
+}
+
+void XsdSchemaChecker::checkElementConstraints()
+{
+ const QSet<XsdElement::Ptr> elements = collectAllElements(m_schema);
+ QSetIterator<XsdElement::Ptr> it(elements);
+ while (it.hasNext()) {
+ const XsdElement::Ptr element = it.next();
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#e-props-correct
+
+ // 2 and xs:ID check
+ if (element->valueConstraint()) {
+ const SchemaType::Ptr type = element->type();
+
+ AnySimpleType::Ptr targetType;
+ if (type->isSimpleType() && type->category() == SchemaType::SimpleTypeAtomic) {
+ targetType = type;
+
+ // if it is a XsdSimpleType, use its primitive type as target type
+ if (type->isDefinedBySchema())
+ targetType = XsdSimpleType::Ptr(type)->primitiveType();
+
+ } else if (type->isComplexType() && type->isDefinedBySchema()) {
+ const XsdComplexType::Ptr complexType(type);
+
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
+ const AnySimpleType::Ptr simpleType = complexType->contentType()->simpleType();
+ if (simpleType->category() == AnySimpleType::SimpleTypeAtomic) {
+ targetType = simpleType;
+
+ if (simpleType->isDefinedBySchema())
+ targetType = XsdSimpleType::Ptr(simpleType)->primitiveType();
+ }
+ } else if (complexType->contentType()->variety() != XsdComplexType::ContentType::Mixed) {
+ m_context->error(QtXmlPatterns::tr("element %1 is not allowed to have a value constraint if its base type is complex")
+ .arg(formatKeyword(element->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, sourceLocation(element));
+ return;
+ }
+ }
+ if ((targetType == BuiltinTypes::xsID) || BuiltinTypes::xsID->wxsTypeMatches(type)) {
+ m_context->error(QtXmlPatterns::tr("element %1 is not allowed to have a value constraint if its type is derived from %2")
+ .arg(formatKeyword(element->displayName(m_namePool)))
+ .arg(formatType(m_namePool, BuiltinTypes::xsID)),
+ XsdSchemaContext::XSDError, sourceLocation(element));
+ return;
+ }
+
+ if (type->isSimpleType()) {
+ QString errorMsg;
+ if (!isValidValue(element->valueConstraint()->value(), type, errorMsg)) {
+ m_context->error(QtXmlPatterns::tr("value constraint of element %1 is not of elements type: %2")
+ .arg(formatKeyword(element->displayName(m_namePool)))
+ .arg(errorMsg),
+ XsdSchemaContext::XSDError, sourceLocation(element));
+ return;
+ }
+ } else if (type->isComplexType() && type->isDefinedBySchema()) {
+ const XsdComplexType::Ptr complexType(type);
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
+ QString errorMsg;
+ if (!isValidValue(element->valueConstraint()->value(), complexType->contentType()->simpleType(), errorMsg)) {
+ m_context->error(QtXmlPatterns::tr("value constraint of element %1 is not of elements type: %2")
+ .arg(formatKeyword(element->displayName(m_namePool)))
+ .arg(errorMsg),
+ XsdSchemaContext::XSDError, sourceLocation(element));
+ return;
+ }
+ }
+ }
+ }
+
+ if (!element->substitutionGroupAffiliations().isEmpty()) {
+ // 3
+ if (!element->scope() || element->scope()->variety() != XsdElement::Scope::Global) {
+ m_context->error(QtXmlPatterns::tr("element %1 is not allowed to have substitution group affiliation as it is no global element").arg(formatKeyword(element->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, sourceLocation(element));
+ return;
+ }
+
+ // 4
+ const XsdElement::List affiliations = element->substitutionGroupAffiliations();
+ for (int i = 0; i < affiliations.count(); ++i) {
+ const XsdElement::Ptr affiliation = affiliations.at(i);
+
+ bool derivationOk = false;
+ if (element->type()->isComplexType() && affiliation->type()->isComplexType()) {
+ if (XsdSchemaHelper::isComplexDerivationOk(element->type(), affiliation->type(), affiliation->substitutionGroupExclusions())) {
+ derivationOk = true;
+ }
+ }
+ if (element->type()->isComplexType() && affiliation->type()->isSimpleType()) {
+ if (XsdSchemaHelper::isComplexDerivationOk(element->type(), affiliation->type(), affiliation->substitutionGroupExclusions())) {
+ derivationOk = true;
+ }
+ }
+ if (element->type()->isSimpleType()) {
+ if (XsdSchemaHelper::isSimpleDerivationOk(element->type(), affiliation->type(), affiliation->substitutionGroupExclusions())) {
+ derivationOk = true;
+ }
+ }
+
+ if (!derivationOk) {
+ m_context->error(QtXmlPatterns::tr("type of element %1 cannot be derived from type of substitution group affiliation").arg(formatKeyword(element->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, sourceLocation(element));
+ return;
+ }
+ }
+
+ // 5 was checked in XsdSchemaResolver::resolveSubstitutionGroupAffiliations() already
+ }
+ }
+}
+
+void XsdSchemaChecker::checkAttributeConstraints()
+{
+ // all global attributes
+ XsdAttribute::List attributes = m_schema->attributes();
+
+ // and all local attributes
+ SchemaType::List types = m_schema->types();
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ if (!types.at(i)->isComplexType() || !types.at(i)->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType(types.at(i));
+ const XsdAttributeUse::List uses = complexType->attributeUses();
+ for (int j = 0; j < uses.count(); ++j)
+ attributes.append(uses.at(j)->attribute());
+ }
+
+ for (int i = 0; i < attributes.count(); ++i) {
+ const XsdAttribute::Ptr attribute = attributes.at(i);
+
+ if (!attribute->valueConstraint())
+ continue;
+
+ if (attribute->valueConstraint()->variety() == XsdAttribute::ValueConstraint::Default || attribute->valueConstraint()->variety() == XsdAttribute::ValueConstraint::Fixed) {
+ const SchemaType::Ptr type = attribute->type();
+
+ QString errorMsg;
+ if (!isValidValue(attribute->valueConstraint()->value(), attribute->type(), errorMsg)) {
+ m_context->error(QtXmlPatterns::tr("value constraint of attribute %1 is not of attributes type: %2")
+ .arg(formatKeyword(attribute->displayName(m_namePool)))
+ .arg(errorMsg),
+ XsdSchemaContext::XSDError, sourceLocation(attribute));
+ return;
+ }
+ }
+
+ if (BuiltinTypes::xsID->wxsTypeMatches(attribute->type())) {
+ m_context->error(QtXmlPatterns::tr("attribute %1 has value constraint but has type derived from %2")
+ .arg(formatKeyword(attribute->displayName(m_namePool)))
+ .arg(formatType(m_namePool, BuiltinTypes::xsID)),
+ XsdSchemaContext::XSDError, sourceLocation(attribute));
+ return;
+ }
+ }
+}
+
+bool XsdSchemaChecker::isValidValue(const QString &stringValue, const AnySimpleType::Ptr &type, QString &errorMsg) const
+{
+ if (BuiltinTypes::xsAnySimpleType->name(m_namePool) == type->name(m_namePool))
+ return true; // no need to check xs:anyType content
+
+ const XsdFacet::Hash facets = XsdTypeChecker::mergedFacetsForType(type, m_context);
+ const QString actualValue = XsdTypeChecker::normalizedValue(stringValue, facets);
+
+ const XsdTypeChecker checker(m_context, QVector<QXmlName>(), QSourceLocation(QUrl(QLatin1String("http://dummy.org")), 1, 1));
+ return checker.isValidString(actualValue, type, errorMsg);
+}
+
+void XsdSchemaChecker::checkAttributeUseConstraints()
+{
+ XsdComplexType::List complexTypes;
+
+ SchemaType::List types = m_schema->types();
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+ if (type->isComplexType() && type->isDefinedBySchema())
+ complexTypes.append(XsdComplexType::Ptr(type));
+ }
+
+ for (int i = 0; i < complexTypes.count(); ++i) {
+ const XsdComplexType::Ptr complexType(complexTypes.at(i));
+ const SchemaType::Ptr baseType = complexType->wxsSuperType();
+ if (!baseType || !baseType->isComplexType() || !baseType->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexBaseType(baseType);
+
+ const XsdAttributeUse::List attributeUses = complexType->attributeUses();
+ QHash<QXmlName, XsdAttributeUse::Ptr> lookupHash;
+ for (int j = 0; j < attributeUses.count(); ++j)
+ lookupHash.insert(attributeUses.at(j)->attribute()->name(m_namePool), attributeUses.at(j));
+
+ const XsdAttributeUse::List baseAttributeUses = complexBaseType->attributeUses();
+ for (int j = 0; j < baseAttributeUses.count(); ++j) {
+ const XsdAttributeUse::Ptr baseAttributeUse = baseAttributeUses.at(j);
+
+ if (lookupHash.contains(baseAttributeUse->attribute()->name(m_namePool))) {
+ const XsdAttributeUse::Ptr attributeUse = lookupHash.value(baseAttributeUse->attribute()->name(m_namePool));
+
+ if (baseAttributeUse->useType() == XsdAttributeUse::RequiredUse) {
+ if (attributeUse->useType() == XsdAttributeUse::OptionalUse || attributeUse->useType() == XsdAttributeUse::ProhibitedUse) {
+ m_context->error(QtXmlPatterns::tr("%1 attribute in derived complex type must be %2 like in base type")
+ .arg(formatAttribute("use"))
+ .arg(formatData("required")),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+ }
+
+ if (baseAttributeUse->valueConstraint()) {
+ if (baseAttributeUse->valueConstraint()->variety() == XsdAttributeUse::ValueConstraint::Fixed) {
+ if (!attributeUse->valueConstraint()) {
+ m_context->error(QtXmlPatterns::tr("attribute %1 in derived complex type must have %2 value constraint like in base type")
+ .arg(formatKeyword(attributeUse->attribute()->displayName(m_namePool)))
+ .arg(formatData("fixed")),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ } else {
+ if (attributeUse->valueConstraint()->variety() == XsdAttributeUse::ValueConstraint::Fixed) {
+ const XsdTypeChecker checker(m_context, QVector<QXmlName>(), sourceLocation(complexType));
+ if (!checker.valuesAreEqual(attributeUse->valueConstraint()->value(), baseAttributeUse->valueConstraint()->value(), attributeUse->attribute()->type())) {
+ m_context->error(QtXmlPatterns::tr("attribute %1 in derived complex type must have the same %2 value constraint like in base type")
+ .arg(formatKeyword(attributeUse->attribute()->displayName(m_namePool)))
+ .arg(formatData("fixed")),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+ } else {
+ m_context->error(QtXmlPatterns::tr("attribute %1 in derived complex type must have %2 value constraint")
+ .arg(formatKeyword(attributeUse->attribute()->displayName(m_namePool)))
+ .arg(formatData("fixed")),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // additional check that process content property of attribute wildcard in derived type is
+ // not weaker than the wildcard in base type
+ const XsdWildcard::Ptr baseWildcard(complexBaseType->attributeWildcard());
+ const XsdWildcard::Ptr derivedWildcard(complexType->attributeWildcard());
+ if (baseWildcard && derivedWildcard) {
+ if (!XsdSchemaHelper::checkWildcardProcessContents(baseWildcard, derivedWildcard)) {
+ m_context->error(QtXmlPatterns::tr("processContent of base wildcard must be weaker than derived wildcard"), XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+ }
+ }
+}
+
+void XsdSchemaChecker::checkElementDuplicates()
+{
+ // check all global types...
+ SchemaType::List types = m_schema->types();
+
+ // .. and anonymous types
+ types << m_schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ const SchemaType::Ptr type = types.at(i);
+
+ if (!type->isComplexType() || !type->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType(type);
+
+ if ((complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly) || (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) {
+ DuplicatedElementMap elementMap;
+ DuplicatedWildcardMap wildcardMap;
+
+ checkElementDuplicates(complexType->contentType()->particle(), elementMap, wildcardMap);
+ }
+ }
+}
+
+void XsdSchemaChecker::checkElementDuplicates(const XsdParticle::Ptr &particle, DuplicatedElementMap &elementMap, DuplicatedWildcardMap &wildcardMap)
+{
+ if (particle->term()->isElement()) {
+ const XsdElement::Ptr element(particle->term());
+
+ if (elementMap.contains(element->name(m_namePool))) {
+ if (element->type() != elementMap.value(element->name(m_namePool))) {
+ m_context->error(QtXmlPatterns::tr("element %1 exists twice with different types")
+ .arg(formatKeyword(element->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, sourceLocation(element));
+ return;
+ }
+ } else {
+ elementMap.insert(element->name(m_namePool), element->type());
+ }
+
+ // check substitution group affiliation
+ const XsdElement::List substElements = element->substitutionGroupAffiliations();
+ for (int i = 0; i < substElements.count(); ++i) {
+ const XsdElement::Ptr substElement = substElements.at(i);
+ if (elementMap.contains(substElement->name(m_namePool))) {
+ if (substElement->type() != elementMap.value(substElement->name(m_namePool))) {
+ m_context->error(QtXmlPatterns::tr("element %1 exists twice with different types")
+ .arg(formatKeyword(substElement->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, sourceLocation(element));
+ return;
+ }
+ } else {
+ elementMap.insert(substElement->name(m_namePool), substElement->type());
+ }
+ }
+ } else if (particle->term()->isModelGroup()) {
+ const XsdModelGroup::Ptr group(particle->term());
+ const XsdParticle::List particles = group->particles();
+ for (int i = 0; i < particles.count(); ++i)
+ checkElementDuplicates(particles.at(i), elementMap, wildcardMap);
+ } else if (particle->term()->isWildcard()) {
+ const XsdWildcard::Ptr wildcard(particle->term());
+
+ bool error = false;
+ if (!wildcardMap.contains(wildcard->namespaceConstraint()->variety())) {
+ if (!wildcardMap.isEmpty())
+ error = true;
+ } else {
+ const XsdWildcard::Ptr otherWildcard = wildcardMap.value(wildcard->namespaceConstraint()->variety());
+ if ((wildcard->processContents() != otherWildcard->processContents()) || (wildcard->namespaceConstraint()->namespaces() != otherWildcard->namespaceConstraint()->namespaces()))
+ error = true;
+ }
+
+ if (error) {
+ m_context->error(QtXmlPatterns::tr("particle contains non-deterministic wildcards"), XsdSchemaContext::XSDError, sourceLocation(wildcard));
+ return;
+ } else {
+ wildcardMap.insert(wildcard->namespaceConstraint()->variety(), wildcard);
+ }
+ }
+}
+
+QSourceLocation XsdSchemaChecker::sourceLocation(const NamedSchemaComponent::Ptr &component) const
+{
+ if (m_componentLocationHash.contains(component)) {
+ return m_componentLocationHash.value(component);
+ } else {
+ QSourceLocation location;
+ location.setLine(1);
+ location.setColumn(1);
+ location.setUri(QString::fromLatin1("dummyUri"));
+
+ return location;
+ }
+}
+
+QSourceLocation XsdSchemaChecker::sourceLocationForType(const SchemaType::Ptr &type) const
+{
+ if (type->isSimpleType())
+ return sourceLocation(XsdSimpleType::Ptr(type));
+ else
+ return sourceLocation(XsdComplexType::Ptr(type));
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp b/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp
new file mode 100644
index 0000000..28957b7
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp
@@ -0,0 +1,306 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+bool XsdSchemaChecker::hasDuplicatedAttributeUses(const XsdAttributeUse::List &list, XsdAttribute::Ptr &conflictingAttribute) const
+{
+ const int length = list.count();
+
+ for (int i = 0; i < length; ++i) {
+ for (int j = 0; j < length; ++j) {
+ if (i == j)
+ continue;
+
+ if (list.at(i)->attribute()->name(m_namePool) == list.at(j)->attribute()->name(m_namePool)) {
+ conflictingAttribute = list.at(i)->attribute();
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool XsdSchemaChecker::hasMultipleIDAttributeUses(const XsdAttributeUse::List &list) const
+{
+ const int length = list.count();
+
+ bool hasIdDerivedAttribute = false;
+ for (int i = 0; i < length; ++i) {
+ if (BuiltinTypes::xsID->wxsTypeMatches(list.at(i)->attribute()->type())) {
+ if (hasIdDerivedAttribute)
+ return true;
+ else
+ hasIdDerivedAttribute = true;
+ }
+ }
+
+ return false;
+}
+
+bool XsdSchemaChecker::hasConstraintIDAttributeUse(const XsdAttributeUse::List &list, XsdAttribute::Ptr &conflictingAttribute) const
+{
+ const int length = list.count();
+
+ for (int i = 0; i < length; ++i) {
+ const XsdAttributeUse::Ptr attributeUse(list.at(i));
+ if (BuiltinTypes::xsID->wxsTypeMatches(attributeUse->attribute()->type())) {
+ if (attributeUse->valueConstraint()) {
+ conflictingAttribute = attributeUse->attribute();
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool XsdSchemaChecker::particleEqualsRecursively(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &otherParticle) const
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-particle-extend
+ //TODO: find out what 'properties' of a particle should be checked here...
+
+ if (particle->minimumOccurs() != otherParticle->minimumOccurs())
+ return false;
+
+ if (particle->maximumOccursUnbounded() != otherParticle->maximumOccursUnbounded())
+ return false;
+
+ if (particle->maximumOccurs() != otherParticle->maximumOccurs())
+ return false;
+
+ const XsdTerm::Ptr term = particle->term();
+ const XsdTerm::Ptr otherTerm = otherParticle->term();
+
+ if (term->isElement() && !(otherTerm->isElement()))
+ return false;
+
+ if (term->isModelGroup() && !(otherTerm->isModelGroup()))
+ return false;
+
+ if (term->isWildcard() && !(otherTerm->isWildcard()))
+ return false;
+
+ if (term->isElement()) {
+ const XsdElement::Ptr element = term;
+ const XsdElement::Ptr otherElement = otherTerm;
+
+ if (element->name(m_namePool) != otherElement->name(m_namePool))
+ return false;
+
+ if (element->type()->name(m_namePool) != otherElement->type()->name(m_namePool))
+ return false;
+ }
+
+ if (term->isModelGroup()) {
+ const XsdModelGroup::Ptr group = term;
+ const XsdModelGroup::Ptr otherGroup = otherTerm;
+
+ if (group->particles().count() != otherGroup->particles().count())
+ return false;
+
+ for (int i = 0; i < group->particles().count(); ++i) {
+ if (!particleEqualsRecursively(group->particles().at(i), otherGroup->particles().at(i)))
+ return false;
+ }
+ }
+
+ if (term->isWildcard()) {
+ }
+
+ return true;
+}
+
+bool XsdSchemaChecker::isValidParticleExtension(const XsdParticle::Ptr &extension, const XsdParticle::Ptr &base) const
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-particle-extend
+
+ // 1
+ if (extension == base)
+ return true;
+
+ // 2
+ if (extension->minimumOccurs() == 1 && extension->maximumOccurs() == 1 && extension->maximumOccursUnbounded() == false) {
+ if (extension->term()->isModelGroup()) {
+ const XsdModelGroup::Ptr modelGroup = extension->term();
+ if (modelGroup->compositor() == XsdModelGroup::SequenceCompositor) {
+ if (particleEqualsRecursively(modelGroup->particles().first(), base))
+ return true;
+ }
+ }
+ }
+
+ // 3
+ if (extension->minimumOccurs() == base->minimumOccurs()) { // 3.1
+ if (extension->term()->isModelGroup() && base->term()->isModelGroup()) {
+ const XsdModelGroup::Ptr extensionGroup(extension->term());
+ const XsdModelGroup::Ptr baseGroup(base->term());
+
+ if (extensionGroup->compositor() == XsdModelGroup::AllCompositor && baseGroup->compositor() == XsdModelGroup::AllCompositor) {
+ const XsdParticle::List extensionParticles = extensionGroup->particles();
+ const XsdParticle::List baseParticles = baseGroup->particles();
+ for (int i = 0; i < baseParticles.count() && i < extensionParticles.count(); ++i) {
+ if (baseParticles.at(i) != extensionParticles.at(i))
+ return false;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+QSet<XsdElement::Ptr> collectAllElements(const XsdParticle::Ptr &particle)
+{
+ QSet<XsdElement::Ptr> elements;
+
+ const XsdTerm::Ptr term(particle->term());
+ if (term->isElement()) {
+ elements.insert(XsdElement::Ptr(term));
+ } else if (term->isModelGroup()) {
+ const XsdModelGroup::Ptr group(term);
+
+ for (int i = 0; i < group->particles().count(); ++i)
+ elements.unite(collectAllElements(group->particles().at(i)));
+ }
+
+ return elements;
+}
+
+QSet<XsdElement::Ptr> collectAllElements(const XsdSchema::Ptr &schema)
+{
+ QSet<XsdElement::Ptr> elements;
+
+ // collect global elements
+ const XsdElement::List elementList = schema->elements();
+ for (int i = 0; i < elementList.count(); ++i)
+ elements.insert(elementList.at(i));
+
+ // collect all elements from global groups
+ const XsdModelGroup::List groupList = schema->elementGroups();
+ for (int i = 0; i < groupList.count(); ++i) {
+ const XsdModelGroup::Ptr group(groupList.at(i));
+
+ for (int j = 0; j < group->particles().count(); ++j)
+ elements.unite(collectAllElements(group->particles().at(j)));
+ }
+
+ // collect all elements from complex type definitions
+ SchemaType::List types;
+ types << schema->types() << schema->anonymousTypes();
+
+ for (int i = 0; i < types.count(); ++i) {
+ if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema()) {
+ const XsdComplexType::Ptr complexType(types.at(i));
+ if (complexType->contentType()->particle())
+ elements.unite(collectAllElements(complexType->contentType()->particle()));
+ }
+ }
+
+ return elements;
+}
+
+bool XsdSchemaChecker::elementSequenceAccepted(const XsdModelGroup::Ptr &sequence, const XsdParticle::Ptr &particle) const
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cvc-accept
+
+ if (particle->term()->isWildcard()) { // 1
+ const XsdWildcard::Ptr wildcard(particle->term());
+
+ // 1.1
+ if ((unsigned int)sequence->particles().count() < particle->minimumOccurs())
+ return false;
+
+ // 1.2
+ if (!particle->maximumOccursUnbounded()) {
+ if ((unsigned int)sequence->particles().count() > particle->maximumOccurs())
+ return false;
+ }
+
+ // 1.3
+ const XsdParticle::List particles(sequence->particles());
+ for (int i = 0; i < particles.count(); ++i) {
+ if (particles.at(i)->term()->isElement()) {
+ if (!XsdSchemaHelper::wildcardAllowsExpandedName(XsdElement::Ptr(particles.at(i)->term())->name(m_namePool), wildcard, m_namePool))
+ return false;
+ }
+ }
+ } else if (particle->term()->isElement()) { // 2
+ const XsdElement::Ptr element(particle->term());
+
+ // 2.1
+ if ((unsigned int)sequence->particles().count() < particle->minimumOccurs())
+ return false;
+
+ // 2.2
+ if (!particle->maximumOccursUnbounded()) {
+ if ((unsigned int)sequence->particles().count() > particle->maximumOccurs())
+ return false;
+ }
+
+ // 2.3
+ const XsdParticle::List particles(sequence->particles());
+ for (int i = 0; i < particles.count(); ++i) {
+ bool isValid = false;
+ if (particles.at(i)->term()->isElement()) {
+ const XsdElement::Ptr seqElement(particles.at(i)->term());
+
+ // 2.3.1
+ if (element->name(m_namePool) == seqElement->name(m_namePool))
+ isValid = true;
+
+ // 2.3.2
+ if (element->scope() && element->scope()->variety() == XsdElement::Scope::Global) {
+ if (!(element->disallowedSubstitutions() & NamedSchemaComponent::SubstitutionConstraint)) {
+ //TODO: continue
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemachecker_p.h b/src/xmlpatterns/schema/qxsdschemachecker_p.h
new file mode 100644
index 0000000..843f909
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemachecker_p.h
@@ -0,0 +1,284 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchemaChecker_H
+#define Patternist_XsdSchemaChecker_H
+
+#include "qschematype_p.h"
+#include "qxsdattribute_p.h"
+#include "qxsdattributegroup_p.h"
+#include "qxsdelement_p.h"
+#include "qxsdmodelgroup_p.h"
+#include "qxsdnotation_p.h"
+#include "qxsdschema_p.h"
+#include "qxsdsimpletype_p.h"
+
+#include <QtCore/QExplicitlySharedDataPointer>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class XsdSchemaContext;
+ class XsdSchemaParserContext;
+
+ /**
+ * @short Encapsulates the checking of schema valitity after reference resolving has finished.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSchemaChecker : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdSchemaChecker> Ptr;
+
+ /**
+ * Creates a new schema checker.
+ *
+ * @param context The context that is used for customization.
+ * @param parserContext The context that contains all the data structures.
+ */
+ XsdSchemaChecker(const QExplicitlySharedDataPointer<XsdSchemaContext> &context, const XsdSchemaParserContext *parserContext);
+
+ /**
+ * Destroys the schema checker.
+ */
+ ~XsdSchemaChecker();
+
+ /**
+ * Starts a basic check process.
+ *
+ * This check only validates the basic super type inheritance
+ * of simple and complex types.
+ */
+ void basicCheck();
+
+ /**
+ * Starts the real check process.
+ */
+ void check();
+
+ /**
+ * Checks the constraining facets of all global and anonymous simple types for validity.
+ */
+ void checkConstrainingFacets();
+
+ /**
+ * Adds the component location hash, so the checker is able to report meaning full
+ * error messages.
+ */
+ void addComponentLocationHash(const QHash<NamedSchemaComponent::Ptr, QSourceLocation> &hash);
+
+ private:
+ void checkSimpleRestrictionBaseType();
+
+ /**
+ * Checks that no simple or complex type inherits itself.
+ */
+ void checkBasicCircularInheritances();
+
+ /**
+ * Checks the advanced circular inheritance.
+ */
+ void checkCircularInheritances();
+
+ /**
+ * Checks for inheritance restrictions given by final or finalDefault
+ * attributes.
+ */
+ void checkInheritanceRestrictions();
+
+ /**
+ * Checks for various constraints for simple types defined by schema.
+ */
+ void checkBasicSimpleTypeConstraints();
+ void checkSimpleTypeConstraints();
+
+ /**
+ * Checks for various constraints for complex types defined by schema.
+ */
+ void checkBasicComplexTypeConstraints();
+ void checkComplexTypeConstraints();
+
+ /**
+ * Checks for list and union derivation restrictions given by final or finalDefault
+ * attributes.
+ */
+ void checkSimpleDerivationRestrictions();
+
+ /**
+ * Checks the set of constraining @p facets that belongs to @p simpleType for validity.
+ */
+ void checkConstrainingFacets(const XsdFacet::Hash &facets, const XsdSimpleType::Ptr &simpleType);
+
+ /**
+ * Checks for duplicated attribute uses (attributes with the same name) inside a complex type.
+ */
+ void checkDuplicatedAttributeUses();
+
+ /**
+ * Check the element constraints.
+ */
+ void checkElementConstraints();
+
+ /**
+ * Check the attribute constraints.
+ */
+ void checkAttributeConstraints();
+
+ /**
+ * Check the attribute use constraints.
+ */
+ void checkAttributeUseConstraints();
+
+ /**
+ * A map used to find duplicated elements inside a model group.
+ */
+ typedef QHash<QXmlName, SchemaType::Ptr> DuplicatedElementMap;
+
+ /**
+ * A map used to find duplicated wildcards inside a model group.
+ */
+ typedef QHash<XsdWildcard::NamespaceConstraint::Variety, XsdWildcard::Ptr> DuplicatedWildcardMap;
+
+ /**
+ * Check for duplicated elements and element wildcards in all complex type particles.
+ */
+ void checkElementDuplicates();
+
+ /**
+ * Check for duplicated elements and element wildcards in the given @p particle.
+ *
+ * @param particle The particle to check.
+ * @param elementMap A map to find the duplicated elements.
+ * @param wildcardMap A map to find the duplicated element wildcards.
+ */
+ void checkElementDuplicates(const XsdParticle::Ptr &particle, DuplicatedElementMap &elementMap, DuplicatedWildcardMap &wildcardMap);
+
+ /**
+ * Setup fast lookup list for allowed facets of atomic simple types.
+ */
+ void setupAllowedAtomicFacets();
+
+ /**
+ * Returns the source location of the given schema @p component or a dummy
+ * source location if the component is not found in the component location hash.
+ */
+ QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr &component) const;
+
+ /**
+ * Returns the source location of the given schema @p type or a dummy
+ * source location if the type is not found in the component location hash.
+ */
+ QSourceLocation sourceLocationForType(const SchemaType::Ptr &type) const;
+
+ /**
+ * Checks that the string @p value is valid according the value space of @p type
+ * for the given @p component.
+ */
+ bool isValidValue(const QString &value, const AnySimpleType::Ptr &type, QString &errorMsg) const;
+
+ /**
+ * Returns the list of facets for the given @p type.
+ */
+ XsdFacet::Hash facetsForType(const SchemaType::Ptr &type) const;
+
+ /**
+ * Returns whether the given @p list of attribute uses contains two (or more) attribute
+ * uses that point to attributes with the same name. @p conflictingAttribute
+ * will contain the conflicting attribute in that case.
+ */
+ bool hasDuplicatedAttributeUses(const XsdAttributeUse::List &list, XsdAttribute::Ptr &conflictingAttribute) const;
+
+ /**
+ * Returns whether the given @p list of attribute uses contains two (or more) attribute
+ * uses that have a type inherited by xs:ID.
+ */
+ bool hasMultipleIDAttributeUses(const XsdAttributeUse::List &list) const;
+
+ /**
+ * Returns whether the given @p list of attribute uses contains an attribute
+ * uses that has a type inherited by xs:ID with a value constraint. @p conflictingAttribute
+ * will contain the conflicting attribute in that case.
+ */
+ bool hasConstraintIDAttributeUse(const XsdAttributeUse::List &list, XsdAttribute::Ptr &conflictingAttribute) const;
+
+ /**
+ * Checks whether the @p particle equals the @p otherParticle recursively.
+ */
+ bool particleEqualsRecursively(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &otherParticle) const;
+
+ /**
+ * Checks whether the @p extension particle is a valid extension of the @p base particle.
+ */
+ bool isValidParticleExtension(const XsdParticle::Ptr &extension, const XsdParticle::Ptr &base) const;
+
+ /**
+ * Checks whether the @p sequence of elements is accepted by the given @p particle.
+ */
+ bool elementSequenceAccepted(const XsdModelGroup::Ptr &sequence, const XsdParticle::Ptr &particle) const;
+
+ QExplicitlySharedDataPointer<XsdSchemaContext> m_context;
+ NamePool::Ptr m_namePool;
+ XsdSchema::Ptr m_schema;
+ QHash<QXmlName, QSet<XsdFacet::Type> > m_allowedAtomicFacets;
+ QHash<NamedSchemaComponent::Ptr, QSourceLocation> m_componentLocationHash;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschemachecker_setup.cpp b/src/xmlpatterns/schema/qxsdschemachecker_setup.cpp
new file mode 100644
index 0000000..a36ecc2
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemachecker_setup.cpp
@@ -0,0 +1,327 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemachecker_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+void XsdSchemaChecker::setupAllowedAtomicFacets()
+{
+ // string
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Length
+ << XsdFacet::MinimumLength
+ << XsdFacet::MaximumLength
+ << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsString->name(m_namePool), facets);
+ }
+
+ // boolean
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::WhiteSpace
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsBoolean->name(m_namePool), facets);
+ }
+
+ // float
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsFloat->name(m_namePool), facets);
+ }
+
+ // double
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsDouble->name(m_namePool), facets);
+ }
+
+ // decimal
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::TotalDigits
+ << XsdFacet::FractionDigits
+ << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsDecimal->name(m_namePool), facets);
+ }
+
+ // duration
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsDuration->name(m_namePool), facets);
+ }
+
+ // dateTime
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsDateTime->name(m_namePool), facets);
+ }
+
+ // time
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsTime->name(m_namePool), facets);
+ }
+
+ // date
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsDate->name(m_namePool), facets);
+ }
+
+ // gYearMonth
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsGYearMonth->name(m_namePool), facets);
+ }
+
+ // gYear
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsGYear->name(m_namePool), facets);
+ }
+
+ // gMonthDay
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsGMonthDay->name(m_namePool), facets);
+ }
+
+ // gDay
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsGDay->name(m_namePool), facets);
+ }
+
+ // gMonth
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::MaximumInclusive
+ << XsdFacet::MaximumExclusive
+ << XsdFacet::MinimumInclusive
+ << XsdFacet::MinimumExclusive
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsGMonth->name(m_namePool), facets);
+ }
+
+ // hexBinary
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Length
+ << XsdFacet::MinimumLength
+ << XsdFacet::MaximumLength
+ << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsHexBinary->name(m_namePool), facets);
+ }
+
+ // base64Binary
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Length
+ << XsdFacet::MinimumLength
+ << XsdFacet::MaximumLength
+ << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsBase64Binary->name(m_namePool), facets);
+ }
+
+ // anyURI
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Length
+ << XsdFacet::MinimumLength
+ << XsdFacet::MaximumLength
+ << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsAnyURI->name(m_namePool), facets);
+ }
+
+ // QName
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Length
+ << XsdFacet::MinimumLength
+ << XsdFacet::MaximumLength
+ << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsQName->name(m_namePool), facets);
+ }
+
+ // NOTATION
+ {
+ QSet<XsdFacet::Type> facets;
+ facets << XsdFacet::Length
+ << XsdFacet::MinimumLength
+ << XsdFacet::MaximumLength
+ << XsdFacet::Pattern
+ << XsdFacet::Enumeration
+ << XsdFacet::WhiteSpace
+ << XsdFacet::Assertion;
+
+ m_allowedAtomicFacets.insert(BuiltinTypes::xsNOTATION->name(m_namePool), facets);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemacontext.cpp b/src/xmlpatterns/schema/qxsdschemacontext.cpp
new file mode 100644
index 0000000..6d646bc
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemacontext.cpp
@@ -0,0 +1,528 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemacontext_p.h"
+
+#include "qderivedinteger_p.h"
+#include "qderivedstring_p.h"
+#include "qxsdschematypesfactory_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdSchemaContext::XsdSchemaContext(const NamePool::Ptr &namePool)
+ : m_namePool(namePool)
+ , m_networkAccessManager(0)
+ , m_uriResolver(0)
+ , m_messageHandler(0)
+{
+}
+
+NamePool::Ptr XsdSchemaContext::namePool() const
+{
+ return m_namePool;
+}
+
+QUrl XsdSchemaContext::baseURI() const
+{
+ return m_baseURI;
+}
+
+void XsdSchemaContext::setBaseURI(const QUrl &uri)
+{
+ m_baseURI = uri;
+}
+
+void XsdSchemaContext::setNetworkAccessManager(QNetworkAccessManager *accessManager)
+{
+ m_networkAccessManager = accessManager;
+}
+
+QNetworkAccessManager* XsdSchemaContext::networkAccessManager() const
+{
+ return m_networkAccessManager;
+}
+
+void XsdSchemaContext::setMessageHandler(QAbstractMessageHandler *handler)
+{
+ m_messageHandler = handler;
+}
+
+QAbstractMessageHandler* XsdSchemaContext::messageHandler() const
+{
+ return m_messageHandler;
+}
+
+QSourceLocation XsdSchemaContext::locationFor(const SourceLocationReflection *const) const
+{
+ return QSourceLocation();
+}
+
+void XsdSchemaContext::setUriResolver(const QAbstractUriResolver *uriResolver)
+{
+ m_uriResolver = uriResolver;
+}
+
+const QAbstractUriResolver* XsdSchemaContext::uriResolver() const
+{
+ return m_uriResolver;
+}
+
+XsdFacet::Hash XsdSchemaContext::facetsForType(const AnySimpleType::Ptr &type) const
+{
+ if (type->isDefinedBySchema())
+ return XsdSimpleType::Ptr(type)->facets();
+ else {
+ if (m_builtinTypesFacetList.isEmpty())
+ m_builtinTypesFacetList = setupBuiltinTypesFacetList();
+
+ return m_builtinTypesFacetList.value(type);
+ }
+}
+
+SchemaTypeFactory::Ptr XsdSchemaContext::schemaTypeFactory() const
+{
+ if (!m_schemaTypeFactory)
+ m_schemaTypeFactory = SchemaTypeFactory::Ptr(new XsdSchemaTypesFactory(m_namePool));
+
+ return m_schemaTypeFactory;
+}
+
+QHash<SchemaType::Ptr, XsdFacet::Hash> XsdSchemaContext::setupBuiltinTypesFacetList() const
+{
+ QHash<SchemaType::Ptr, XsdFacet::Hash> hash;
+
+ const XsdFacet::Ptr fixedCollapseWhiteSpace(new XsdFacet());
+ fixedCollapseWhiteSpace->setType(XsdFacet::WhiteSpace);
+ fixedCollapseWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse)));
+ fixedCollapseWhiteSpace->setFixed(true);
+
+ const XsdFacet::Ptr collapseWhiteSpace(new XsdFacet());
+ collapseWhiteSpace->setType(XsdFacet::WhiteSpace);
+ collapseWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse)));
+ collapseWhiteSpace->setFixed(false);
+
+ const XsdFacet::Ptr preserveWhiteSpace(new XsdFacet());
+ preserveWhiteSpace->setType(XsdFacet::WhiteSpace);
+ preserveWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Preserve)));
+ preserveWhiteSpace->setFixed(false);
+
+ const XsdFacet::Ptr replaceWhiteSpace(new XsdFacet());
+ replaceWhiteSpace->setType(XsdFacet::WhiteSpace);
+ replaceWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Replace)));
+ replaceWhiteSpace->setFixed(false);
+
+ const XsdFacet::Ptr fixedZeroFractionDigits(new XsdFacet());
+ fixedZeroFractionDigits->setType(XsdFacet::FractionDigits);
+ fixedZeroFractionDigits->setValue(DerivedInteger<TypeNonNegativeInteger>::fromValue(m_namePool, 0));
+ fixedZeroFractionDigits->setFixed(true);
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsString];
+ facets.insert(preserveWhiteSpace->type(), preserveWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsBoolean];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsDecimal];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsFloat];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsDouble];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsDuration];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsDateTime];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsTime];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsDate];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsGYearMonth];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsGYear];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsGMonthDay];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsGDay];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsGMonth];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsHexBinary];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsBase64Binary];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsAnyURI];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsQName];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsNOTATION];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsNormalizedString];
+ facets.insert(replaceWhiteSpace->type(), replaceWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsToken];
+ facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsLanguage];
+ facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
+
+ const XsdFacet::Ptr pattern(new XsdFacet());
+ pattern->setType(XsdFacet::Pattern);
+ pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")));
+ facets.insert(pattern->type(), pattern);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsNMTOKEN];
+ facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
+
+ const XsdFacet::Ptr pattern(new XsdFacet());
+ pattern->setType(XsdFacet::Pattern);
+ pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("\\c+")));
+ facets.insert(pattern->type(), pattern);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsName];
+ facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
+
+ const XsdFacet::Ptr pattern(new XsdFacet());
+ pattern->setType(XsdFacet::Pattern);
+ pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("\\i\\c*")));
+ facets.insert(pattern->type(), pattern);
+ }
+
+ const XsdFacet::Ptr ncNamePattern(new XsdFacet());
+ {
+ ncNamePattern->setType(XsdFacet::Pattern);
+ AtomicValue::List patterns;
+ patterns << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("\\i\\c*"));
+ patterns << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[\\i-[:]][\\c-[:]]*"));
+ ncNamePattern->setMultiValue(patterns);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsNCName];
+ facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
+ facets.insert(ncNamePattern->type(), ncNamePattern);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsID];
+ facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
+ facets.insert(ncNamePattern->type(), ncNamePattern);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsIDREF];
+ facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
+ facets.insert(ncNamePattern->type(), ncNamePattern);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsENTITY];
+ facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
+ facets.insert(ncNamePattern->type(), ncNamePattern);
+ }
+
+ const XsdFacet::Ptr integerPattern(new XsdFacet());
+ integerPattern->setType(XsdFacet::Pattern);
+ integerPattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[\\-+]?[0-9]+")));
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsInteger];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsNonPositiveInteger];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("0")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsNegativeInteger];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-1")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsLong];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("9223372036854775807")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+
+ const XsdFacet::Ptr minInclusive(new XsdFacet());
+ minInclusive->setType(XsdFacet::MinimumInclusive);
+ minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-9223372036854775808")));
+ facets.insert(minInclusive->type(), minInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsInt];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("2147483647")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+
+ const XsdFacet::Ptr minInclusive(new XsdFacet());
+ minInclusive->setType(XsdFacet::MinimumInclusive);
+ minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-2147483648")));
+ facets.insert(minInclusive->type(), minInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsShort];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("32767")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+
+ const XsdFacet::Ptr minInclusive(new XsdFacet());
+ minInclusive->setType(XsdFacet::MinimumInclusive);
+ minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-32768")));
+ facets.insert(minInclusive->type(), minInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsByte];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("127")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+
+ const XsdFacet::Ptr minInclusive(new XsdFacet());
+ minInclusive->setType(XsdFacet::MinimumInclusive);
+ minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-128")));
+ facets.insert(minInclusive->type(), minInclusive);
+ }
+
+ const XsdFacet::Ptr unsignedMinInclusive(new XsdFacet());
+ unsignedMinInclusive->setType(XsdFacet::MinimumInclusive);
+ unsignedMinInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("0")));
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsNonNegativeInteger];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+ facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedLong];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+ facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("18446744073709551615")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedInt];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+ facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("4294967295")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedShort];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+ facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("65535")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedByte];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+ facets.insert(integerPattern->type(), integerPattern);
+ facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
+
+ const XsdFacet::Ptr maxInclusive(new XsdFacet());
+ maxInclusive->setType(XsdFacet::MaximumInclusive);
+ maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("255")));
+ facets.insert(maxInclusive->type(), maxInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsPositiveInteger];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+ facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
+
+ const XsdFacet::Ptr minInclusive(new XsdFacet());
+ minInclusive->setType(XsdFacet::MinimumInclusive);
+ minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("1")));
+ facets.insert(minInclusive->type(), minInclusive);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsYearMonthDuration];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+
+ const XsdFacet::Ptr pattern(new XsdFacet());
+ pattern->setType(XsdFacet::Pattern);
+ pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[^DT]*")));
+ facets.insert(pattern->type(), pattern);
+ }
+
+ {
+ XsdFacet::Hash &facets = hash[BuiltinTypes::xsDayTimeDuration];
+ facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
+
+ const XsdFacet::Ptr pattern(new XsdFacet());
+ pattern->setType(XsdFacet::Pattern);
+ pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[^YM]*(T.*)?")));
+ facets.insert(pattern->type(), pattern);
+ }
+
+ return hash;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemacontext_p.h b/src/xmlpatterns/schema/qxsdschemacontext_p.h
new file mode 100644
index 0000000..9c00964
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemacontext_p.h
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchemaContext_H
+#define Patternist_XsdSchemaContext_H
+
+#include "qnamedschemacomponent_p.h"
+#include "qreportcontext_p.h"
+#include "qschematypefactory_p.h"
+#include "qxsdschematoken_p.h"
+#include "qxsdschema_p.h"
+#include "qxsdschemachecker_p.h"
+#include "qxsdschemaresolver_p.h"
+
+#include <QtCore/QUrl>
+#include <QtNetwork/QNetworkAccessManager>
+#include <QtXmlPatterns/QAbstractMessageHandler>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A context for schema parsing and validation.
+ *
+ * This class provides the infrastructure for error reporting and
+ * network access. Additionally it stores objects that are used by
+ * both, the parser and the validator.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSchemaContext : public ReportContext
+ {
+ public:
+ /**
+ * A smart pointer wrapping XsdSchemaContext instances.
+ */
+ typedef QExplicitlySharedDataPointer<XsdSchemaContext> Ptr;
+
+ /**
+ * Creates a new schema context object.
+ *
+ * @param namePool The name pool all names belong to.
+ */
+ XsdSchemaContext(const NamePool::Ptr &namePool);
+
+ /**
+ * Returns the name pool of the schema context.
+ */
+ virtual NamePool::Ptr namePool() const;
+
+ /**
+ * Sets the base URI for the main schema.
+ *
+ * The main schema is the one that includes resp. imports
+ * all the other schema files.
+ */
+ virtual void setBaseURI(const QUrl &uri);
+
+ /**
+ * Returns the base URI of the main schema.
+ */
+ virtual QUrl baseURI() const;
+
+ /**
+ * Sets the network access manager that should be used
+ * to access referenced schema definitions.
+ */
+ void setNetworkAccessManager(QNetworkAccessManager *accessManager);
+
+ /**
+ * Returns the network access manager that is used to
+ * access referenced schema definitions.
+ */
+ virtual QNetworkAccessManager* networkAccessManager() const;
+
+ /**
+ * Sets the message @p handler used by the context for error reporting.
+ */
+ void setMessageHandler(QAbstractMessageHandler *handler);
+
+ /**
+ * Returns the message handler used by the context for
+ * error reporting.
+ */
+ virtual QAbstractMessageHandler* messageHandler() const;
+
+ /**
+ * Always returns an empty source location.
+ */
+ virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const;
+
+ /**
+ * Sets the uri @p resolver that is used for resolving URIs in the
+ * schema parser.
+ */
+ void setUriResolver(const QAbstractUriResolver *resolver);
+
+ /**
+ * Returns the uri resolver that is used for resolving URIs in the
+ * schema parser.
+ */
+ virtual const QAbstractUriResolver* uriResolver() const;
+
+ /**
+ * Returns the list of facets for the given simple @p type.
+ */
+ XsdFacet::Hash facetsForType(const AnySimpleType::Ptr &type) const;
+
+ /**
+ * Returns a schema type factory that contains some predefined schema types.
+ */
+ SchemaTypeFactory::Ptr schemaTypeFactory() const;
+
+ /**
+ * The following variables should not be accessed directly.
+ */
+ mutable SchemaTypeFactory::Ptr m_schemaTypeFactory;
+ mutable QHash<SchemaType::Ptr, XsdFacet::Hash> m_builtinTypesFacetList;
+
+ private:
+ QHash<SchemaType::Ptr, XsdFacet::Hash> setupBuiltinTypesFacetList() const;
+
+ NamePool::Ptr m_namePool;
+ QNetworkAccessManager* m_networkAccessManager;
+ QUrl m_baseURI;
+ const QAbstractUriResolver* m_uriResolver;
+ QAbstractMessageHandler* m_messageHandler;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschemadebugger.cpp b/src/xmlpatterns/schema/qxsdschemadebugger.cpp
new file mode 100644
index 0000000..5d2d6f0
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemadebugger.cpp
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemadebugger_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdSchemaDebugger::XsdSchemaDebugger(const NamePool::Ptr &namePool)
+ : m_namePool(namePool)
+{
+}
+
+void XsdSchemaDebugger::dumpParticle(const XsdParticle::Ptr &particle, int level)
+{
+ QString prefix; prefix.fill(QLatin1Char(' '), level);
+
+ qDebug("%s min=%s max=%s", qPrintable(prefix), qPrintable(QString::number(particle->minimumOccurs())),
+ qPrintable(particle->maximumOccursUnbounded() ? QLatin1String("unbounded") : QString::number(particle->maximumOccurs())));
+
+ if (particle->term()->isElement()) {
+ qDebug("%selement (%s)", qPrintable(prefix), qPrintable(XsdElement::Ptr(particle->term())->displayName(m_namePool)));
+ } else if (particle->term()->isModelGroup()) {
+ const XsdModelGroup::Ptr group(particle->term());
+ if (group->compositor() == XsdModelGroup::SequenceCompositor) {
+ qDebug("%ssequence", qPrintable(prefix));
+ } else if (group->compositor() == XsdModelGroup::AllCompositor) {
+ qDebug("%sall", qPrintable(prefix));
+ } else if (group->compositor() == XsdModelGroup::ChoiceCompositor) {
+ qDebug("%schoice", qPrintable(prefix));
+ }
+
+ for (int i = 0; i < group->particles().count(); ++i)
+ dumpParticle(group->particles().at(i), level + 5);
+ } else if (particle->term()->isWildcard()) {
+ XsdWildcard::Ptr wildcard(particle->term());
+ qDebug("%swildcard (process=%d)", qPrintable(prefix), wildcard->processContents());
+ }
+}
+
+void XsdSchemaDebugger::dumpInheritance(const SchemaType::Ptr &type, int level)
+{
+ QString prefix; prefix.fill(QLatin1Char(' '), level);
+ qDebug("%s-->%s", qPrintable(prefix), qPrintable(type->displayName(m_namePool)));
+ if (type->wxsSuperType())
+ dumpInheritance(type->wxsSuperType(), ++level);
+}
+
+void XsdSchemaDebugger::dumpWildcard(const XsdWildcard::Ptr &wildcard)
+{
+ QVector<QString> varietyNames;
+ varietyNames.append(QLatin1String("Any"));
+ varietyNames.append(QLatin1String("Enumeration"));
+ varietyNames.append(QLatin1String("Not"));
+
+ QVector<QString> processContentsNames;
+ processContentsNames.append(QLatin1String("Strict"));
+ processContentsNames.append(QLatin1String("Lax"));
+ processContentsNames.append(QLatin1String("Skip"));
+
+ qDebug(" processContents: %s", qPrintable(processContentsNames.at((int)wildcard->processContents())));
+ const XsdWildcard::NamespaceConstraint::Ptr constraint = wildcard->namespaceConstraint();
+ qDebug(" variety: %s", qPrintable(varietyNames.at((int)constraint->variety())));
+ if (constraint->variety() != XsdWildcard::NamespaceConstraint::Any)
+ qDebug() << " namespaces:" << constraint->namespaces();
+}
+
+void XsdSchemaDebugger::dumpType(const SchemaType::Ptr &type)
+{
+ if (type->isComplexType()) {
+ const XsdComplexType::Ptr complexType(type);
+ qDebug("\n+++ Complex Type +++");
+ qDebug("Name: %s (abstract: %s)", qPrintable(complexType->displayName(m_namePool)), complexType->isAbstract() ? "yes" : "no");
+ if (complexType->wxsSuperType())
+ qDebug(" base type: %s", qPrintable(complexType->wxsSuperType()->displayName(m_namePool)));
+ else
+ qDebug(" base type: (none)");
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Empty)
+ qDebug(" content type: empty");
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple)
+ qDebug(" content type: simple");
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly)
+ qDebug(" content type: element-only");
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed)
+ qDebug(" content type: mixed");
+ if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
+ if (complexType->contentType()->simpleType())
+ qDebug(" simple type: %s", qPrintable(complexType->contentType()->simpleType()->displayName(m_namePool)));
+ else
+ qDebug(" simple type: (none)");
+ }
+
+ const XsdAttributeUse::List uses = complexType->attributeUses();
+ qDebug(" %d attributes", uses.count());
+ for (int i = 0; i < uses.count(); ++i) {
+ qDebug(" attr: %s", qPrintable(uses.at(i)->attribute()->displayName(m_namePool)));
+ }
+ qDebug(" has attribute wildcard: %s", complexType->attributeWildcard() ? "yes" : "no");
+ if (complexType->attributeWildcard()) {
+ dumpWildcard(complexType->attributeWildcard());
+ }
+
+ if (complexType->contentType()->particle()) {
+ dumpParticle(complexType->contentType()->particle(), 5);
+ }
+ } else {
+ qDebug("\n+++ Simple Type +++");
+ qDebug("Name: %s", qPrintable(type->displayName(m_namePool)));
+ if (type->isDefinedBySchema()) {
+ const XsdSimpleType::Ptr simpleType(type);
+ if (simpleType->primitiveType())
+ qDebug(" primitive type: %s", qPrintable(simpleType->primitiveType()->displayName(m_namePool)));
+ else
+ qDebug(" primitive type: (none)");
+ }
+ dumpInheritance(type, 0);
+ }
+}
+
+
+void XsdSchemaDebugger::dumpElement(const XsdElement::Ptr &element)
+{
+ QStringList disallowedSubstGroup;
+ if (element->disallowedSubstitutions() & XsdElement::RestrictionConstraint)
+ disallowedSubstGroup << QLatin1String("restriction");
+ if (element->disallowedSubstitutions() & XsdElement::ExtensionConstraint)
+ disallowedSubstGroup << QLatin1String("extension");
+ if (element->disallowedSubstitutions() & XsdElement::SubstitutionConstraint)
+ disallowedSubstGroup << QLatin1String("substitution");
+
+
+ qDebug() << "Name:" << element->displayName(m_namePool);
+ qDebug() << "IsAbstract:" << (element->isAbstract() ? "yes" : "no");
+ qDebug() << "Type:" << element->type()->displayName(m_namePool);
+ qDebug() << "DisallowedSubstitutionGroups:" << disallowedSubstGroup.join(QLatin1String("' "));
+}
+
+void XsdSchemaDebugger::dumpAttribute(const XsdAttribute::Ptr &attribute)
+{
+ qDebug() << "Name:" << attribute->displayName(m_namePool);
+ qDebug() << "Type:" << attribute->type()->displayName(m_namePool);
+}
+
+void XsdSchemaDebugger::dumpSchema(const XsdSchema::Ptr &schema)
+{
+ qDebug() << "------------------------------ Schema -------------------------------";
+
+ // elements
+ {
+ qDebug() << "Global Elements:";
+ const XsdElement::List elements = schema->elements();
+ for (int i = 0; i < elements.count(); ++i) {
+ dumpElement(elements.at(i));
+ }
+ }
+
+ // attributes
+ {
+ qDebug() << "Global Attributes:";
+ const XsdAttribute::List attributes = schema->attributes();
+ for (int i = 0; i < attributes.count(); ++i) {
+ dumpAttribute(attributes.at(i));
+ }
+ }
+
+ // types
+ {
+ qDebug() << "Global Types:";
+ const SchemaType::List types = schema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ dumpType(types.at(i));
+ }
+ }
+
+ // anonymous types
+ {
+ qDebug() << "Anonymous Types:";
+ const SchemaType::List types = schema->anonymousTypes();
+ for (int i = 0; i < types.count(); ++i) {
+ dumpType(types.at(i));
+ }
+ }
+
+ qDebug() << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemadebugger_p.h b/src/xmlpatterns/schema/qxsdschemadebugger_p.h
new file mode 100644
index 0000000..cc3f7de
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemadebugger_p.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchemaDebugger_H
+#define Patternist_XsdSchemaDebugger_H
+
+#include "qxsdschema_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * A helper class to print out the structure of a compiled schema.
+ */
+ class XsdSchemaDebugger
+ {
+ public:
+ /**
+ * Creates a new schema debugger.
+ *
+ * @param namePool The name pool that the schema uses.
+ */
+ XsdSchemaDebugger(const NamePool::Ptr &namePool);
+
+ /**
+ * Dumps the structure of the given @p particle.
+ *
+ * @param particle The particle to dump.
+ * @param level The level of indention.
+ */
+ void dumpParticle(const XsdParticle::Ptr &particle, int level = 0);
+
+ /**
+ * Dumps the inheritance path of the given @p type.
+ *
+ * @param type The type to dump.
+ * @param level The level of indention.
+ */
+ void dumpInheritance(const SchemaType::Ptr &type, int level = 0);
+
+ /**
+ * Dumps the structure of the given @p wildcard.
+ */
+ void dumpWildcard(const XsdWildcard::Ptr &wildcard);
+
+ /**
+ * Dumps the structure of the given @p type.
+ */
+ void dumpType(const SchemaType::Ptr &type);
+
+ /**
+ * Dumps the structure of the given @p element.
+ */
+ void dumpElement(const XsdElement::Ptr &element);
+
+ /**
+ * Dumps the structure of the given @p attribute.
+ */
+ void dumpAttribute(const XsdAttribute::Ptr &attribute);
+
+ /**
+ * Dumps the structure of the complete @p schema.
+ */
+ void dumpSchema(const XsdSchema::Ptr &schema);
+
+ private:
+ const NamePool::Ptr m_namePool;
+ };
+
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschemahelper.cpp b/src/xmlpatterns/schema/qxsdschemahelper.cpp
new file mode 100644
index 0000000..70812b2
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemahelper.cpp
@@ -0,0 +1,821 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemahelper_p.h"
+
+#include "qbuiltintypes_p.h"
+#include "qvaluefactory_p.h"
+#include "qxsdcomplextype_p.h"
+#include "qxsdmodelgroup_p.h"
+#include "qxsdsimpletype_p.h"
+#include "qxsdtypechecker_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+/*
+ * Calculates the effective total range minimum of the given @p particle as
+ * described by the algorithm in the schema spec.
+ */
+static inline unsigned int effectiveTotalRangeMinimum(const XsdParticle::Ptr &particle)
+{
+ const XsdModelGroup::Ptr group = particle->term();
+
+ if (group->compositor() == XsdModelGroup::ChoiceCompositor) {
+ // @see http://www.w3.org/TR/xmlschema11-1/# cos-choice-range
+
+ int minValue = -1;
+
+ const XsdParticle::List particles = group->particles();
+ if (particles.isEmpty())
+ minValue = 0;
+
+ for (int i = 0; i < particles.count(); ++i) {
+ const XsdParticle::Ptr particle = particles.at(i);
+
+ if (particle->term()->isElement() || particle->term()->isWildcard()) {
+ if (minValue == -1) {
+ minValue = particle->minimumOccurs();
+ } else {
+ minValue = qMin((unsigned int)minValue, particle->minimumOccurs());
+ }
+ } else if (particle->term()->isModelGroup()) {
+ if (minValue == -1) {
+ minValue = effectiveTotalRangeMinimum(particle);
+ } else {
+ minValue = qMin((unsigned int)minValue, effectiveTotalRangeMinimum(particle));
+ }
+ }
+ }
+
+ return (particle->minimumOccurs() * minValue);
+
+ } else {
+ // @see http://www.w3.org/TR/xmlschema11-1/# cos-seq-range
+
+ unsigned int sum = 0;
+ const XsdParticle::List particles = group->particles();
+ for (int i = 0; i < particles.count(); ++i) {
+ const XsdParticle::Ptr particle = particles.at(i);
+
+ if (particle->term()->isElement() || particle->term()->isWildcard())
+ sum += particle->minimumOccurs();
+ else if (particle->term()->isModelGroup())
+ sum += effectiveTotalRangeMinimum(particle);
+ }
+
+ return (particle->minimumOccurs() * sum);
+ }
+}
+
+bool XsdSchemaHelper::isParticleEmptiable(const XsdParticle::Ptr &particle)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-group-emptiable
+
+ if (particle->minimumOccurs() == 0)
+ return true;
+
+ if (!(particle->term()->isModelGroup()))
+ return false;
+
+ return (effectiveTotalRangeMinimum(particle) == 0);
+}
+
+bool XsdSchemaHelper::wildcardAllowsNamespaceName(const QString &nameSpace, const XsdWildcard::NamespaceConstraint::Ptr &constraint)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cvc-wildcard-namespace
+
+ // 1
+ if (constraint->variety() == XsdWildcard::NamespaceConstraint::Any)
+ return true;
+
+ // 2
+ if (constraint->variety() == XsdWildcard::NamespaceConstraint::Not) { // 2.1
+ if (!constraint->namespaces().contains(nameSpace)) // 2.2
+ if (nameSpace != XsdWildcard::absentNamespace()) // 2.3
+ return true;
+ }
+
+ // 3
+ if (constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) {
+ if (constraint->namespaces().contains(nameSpace))
+ return true;
+ }
+
+ return false;
+}
+
+bool XsdSchemaHelper::wildcardAllowsExpandedName(const QXmlName &name, const XsdWildcard::Ptr &wildcard, const NamePool::Ptr &namePool)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cvc-wildcard-name
+
+ // 1
+ if (!wildcardAllowsNamespaceName(namePool->stringForNamespace(name.namespaceURI()), wildcard->namespaceConstraint()))
+ return false;
+
+ // 2, 3, 4
+ //TODO: we have no disallowed namespace yet
+
+ return true;
+}
+
+// small helper function that should be available in Qt 4.6
+template<class T>
+static inline bool containsSet(const QSet<T> &super, const QSet<T> &sub)
+{
+ QSetIterator<T> it(sub);
+ while (it.hasNext()) {
+ if (!super.contains(it.next()))
+ return false;
+ }
+
+ return true;
+}
+
+bool XsdSchemaHelper::isWildcardSubset(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-ns-subset
+ // wildcard =^ sub
+ // otherWildcard =^ super
+
+ const XsdWildcard::NamespaceConstraint::Ptr constraint(wildcard->namespaceConstraint());
+ const XsdWildcard::NamespaceConstraint::Ptr otherConstraint(otherWildcard->namespaceConstraint());
+
+ // 1
+ if (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Any)
+ return true;
+
+ // 2
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) {
+ if (containsSet<QString>(otherConstraint->namespaces(), constraint->namespaces()))
+ return true;
+ }
+
+ // 3
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) {
+ if (constraint->namespaces().intersect(otherConstraint->namespaces()).isEmpty())
+ return true;
+ }
+
+ // 4
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) {
+ if (containsSet<QString>(constraint->namespaces(), otherConstraint->namespaces()))
+ return true;
+ }
+
+ return false;
+}
+
+XsdWildcard::Ptr XsdSchemaHelper::wildcardUnion(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-aw-union
+
+ XsdWildcard::Ptr unionWildcard(new XsdWildcard());
+
+ const XsdWildcard::NamespaceConstraint::Ptr constraint(wildcard->namespaceConstraint());
+ const XsdWildcard::NamespaceConstraint::Ptr otherConstraint(otherWildcard->namespaceConstraint());
+
+ // 1
+ if ((constraint->variety() == otherConstraint->variety()) &&
+ (constraint->namespaces() == otherConstraint->namespaces())) {
+ unionWildcard->namespaceConstraint()->setVariety(constraint->variety());
+ unionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces());
+ return unionWildcard;
+ }
+
+ // 2
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Any) || (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Any)) {
+ unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any);
+ return unionWildcard;
+ }
+
+ // 3
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) {
+ unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration);
+ unionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces() + otherConstraint->namespaces());
+ return unionWildcard;
+ }
+
+ // 4
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) {
+ if (constraint->namespaces() != otherConstraint->namespaces()) {
+ unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not);
+ unionWildcard->namespaceConstraint()->setNamespaces(QSet<QString>() << XsdWildcard::absentNamespace());
+ return unionWildcard;
+ }
+ }
+
+ // 5
+ QSet<QString> sSet, negatedSet;
+ bool matches5 = false;
+ if (((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && !constraint->namespaces().contains(XsdWildcard::absentNamespace()))
+ && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) {
+
+ negatedSet = constraint->namespaces();
+ sSet = otherConstraint->namespaces();
+ matches5 = true;
+ } else if (((otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not) && !otherConstraint->namespaces().contains(XsdWildcard::absentNamespace()))
+ && (constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) {
+
+ negatedSet = otherConstraint->namespaces();
+ sSet = constraint->namespaces();
+ matches5 = true;
+ }
+
+ if (matches5) {
+ if (sSet.contains(negatedSet.values().first()) && sSet.contains(XsdWildcard::absentNamespace())) { // 5.1
+ unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any);
+ return unionWildcard;
+ }
+ if (sSet.contains(negatedSet.values().first()) && !sSet.contains(XsdWildcard::absentNamespace())) { // 5.2
+ unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not);
+ unionWildcard->namespaceConstraint()->setNamespaces(QSet<QString>() << XsdWildcard::absentNamespace());
+ return unionWildcard;
+ }
+ if (!sSet.contains(negatedSet.values().first()) && sSet.contains(XsdWildcard::absentNamespace())) { // 5.3
+ return XsdWildcard::Ptr(); // not expressible
+ }
+ if (!sSet.contains(negatedSet.values().first()) && !sSet.contains(XsdWildcard::absentNamespace())) { // 5.4
+ unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not);
+ unionWildcard->namespaceConstraint()->setNamespaces(negatedSet);
+ return unionWildcard;
+ }
+ }
+
+ // 6
+ bool matches6 = false;
+ if (((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && constraint->namespaces().contains(XsdWildcard::absentNamespace()))
+ && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) {
+
+ negatedSet = constraint->namespaces();
+ sSet = otherConstraint->namespaces();
+ matches6 = true;
+ } else if (((otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not) && otherConstraint->namespaces().contains(XsdWildcard::absentNamespace()))
+ && (constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) {
+
+ negatedSet = otherConstraint->namespaces();
+ sSet = constraint->namespaces();
+ matches6 = true;
+ }
+
+ if (matches6) {
+ if (sSet.contains(XsdWildcard::absentNamespace())) { // 6.1
+ unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any);
+ return unionWildcard;
+ }
+ if (!sSet.contains(XsdWildcard::absentNamespace())) { // 6.2
+ unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not);
+ unionWildcard->namespaceConstraint()->setNamespaces(QSet<QString>() += XsdWildcard::absentNamespace());
+ return unionWildcard;
+ }
+ }
+
+ return XsdWildcard::Ptr();
+}
+
+XsdWildcard::Ptr XsdSchemaHelper::wildcardIntersection(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-aw-intersect
+
+ const XsdWildcard::NamespaceConstraint::Ptr constraint(wildcard->namespaceConstraint());
+ const XsdWildcard::NamespaceConstraint::Ptr otherConstraint(otherWildcard->namespaceConstraint());
+
+ const XsdWildcard::Ptr intersectionWildcard(new XsdWildcard());
+
+ // 1
+ if ((constraint->variety() == otherConstraint->variety()) &&
+ (constraint->namespaces() == otherConstraint->namespaces())) {
+ intersectionWildcard->namespaceConstraint()->setVariety(constraint->variety());
+ intersectionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces());
+ return intersectionWildcard;
+ }
+
+ // 2
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Any) &&
+ (otherConstraint->variety() != XsdWildcard::NamespaceConstraint::Any)) {
+ intersectionWildcard->namespaceConstraint()->setVariety(otherConstraint->variety());
+ intersectionWildcard->namespaceConstraint()->setNamespaces(otherConstraint->namespaces());
+ return intersectionWildcard;
+ }
+
+ // 2
+ if ((constraint->variety() != XsdWildcard::NamespaceConstraint::Any) &&
+ (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Any)) {
+ intersectionWildcard->namespaceConstraint()->setVariety(constraint->variety());
+ intersectionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces());
+ return intersectionWildcard;
+ }
+
+ // 3
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) &&
+ (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) {
+
+ QSet<QString> set = otherConstraint->namespaces();
+ set.subtract(constraint->namespaces());
+ set.remove(XsdWildcard::absentNamespace());
+
+ intersectionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration);
+ intersectionWildcard->namespaceConstraint()->setNamespaces(set);
+
+ return intersectionWildcard;
+ }
+
+ // 3
+ if ((otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not) &&
+ (constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) {
+
+ QSet<QString> set = constraint->namespaces();
+ set.subtract(otherConstraint->namespaces());
+ set.remove(XsdWildcard::absentNamespace());
+
+ intersectionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration);
+ intersectionWildcard->namespaceConstraint()->setNamespaces(set);
+
+ return intersectionWildcard;
+ }
+
+ // 4
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) &&
+ (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) {
+
+ QSet<QString> set = constraint->namespaces();
+ set.intersect(otherConstraint->namespaces());
+
+ intersectionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration);
+ intersectionWildcard->namespaceConstraint()->setNamespaces(set);
+
+ return intersectionWildcard;
+ }
+
+ // 6
+ if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) &&
+ (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) {
+ if (!(constraint->namespaces().contains(XsdWildcard::absentNamespace())) && otherConstraint->namespaces().contains(XsdWildcard::absentNamespace())) {
+ return wildcard;
+ }
+ if (constraint->namespaces().contains(XsdWildcard::absentNamespace()) && !(otherConstraint->namespaces().contains(XsdWildcard::absentNamespace()))) {
+ return otherWildcard;
+ }
+ }
+
+ // 5 as not expressible return empty wildcard
+ return XsdWildcard::Ptr();
+}
+
+static SchemaType::DerivationConstraints convertBlockingConstraints(const NamedSchemaComponent::BlockingConstraints &constraints)
+{
+ SchemaType::DerivationConstraints result = 0;
+
+ if (constraints & NamedSchemaComponent::RestrictionConstraint)
+ result |= SchemaType::RestrictionConstraint;
+ if (constraints & NamedSchemaComponent::ExtensionConstraint)
+ result |= SchemaType::ExtensionConstraint;
+
+ return result;
+}
+
+bool XsdSchemaHelper::isValidlySubstitutable(const SchemaType::Ptr &type, const SchemaType::Ptr &otherType, const SchemaType::DerivationConstraints &constraints)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#key-val-sub-type
+
+ // 1
+ if (type->isComplexType() && otherType->isComplexType()) {
+ SchemaType::DerivationConstraints keywords = constraints;
+ if (otherType->isDefinedBySchema())
+ keywords |= convertBlockingConstraints(XsdComplexType::Ptr(otherType)->prohibitedSubstitutions());
+
+ return isComplexDerivationOk(type, otherType, keywords);
+ }
+
+ // 2
+ if (type->isComplexType() && otherType->isSimpleType()) {
+ return isComplexDerivationOk(type, otherType, constraints);
+ }
+
+ // 3
+ if (type->isSimpleType() && otherType->isSimpleType()) {
+ return isSimpleDerivationOk(type, otherType, constraints);
+ }
+
+ return false;
+}
+
+bool XsdSchemaHelper::isSimpleDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr &baseType, const SchemaType::DerivationConstraints &constraints)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-st-derived-ok
+
+ // 1
+ if (derivedType == baseType)
+ return true;
+
+ // 2.1
+ if ((constraints & SchemaType::RestrictionConstraint) || derivedType->wxsSuperType()->derivationConstraints() & SchemaType::RestrictionConstraint) {
+ return false;
+ }
+
+ // 2.2.1
+ if (derivedType->wxsSuperType() == baseType)
+ return true;
+
+ // 2.2.2
+ if (derivedType->wxsSuperType() != BuiltinTypes::xsAnyType) {
+ if (isSimpleDerivationOk(derivedType->wxsSuperType(), baseType, constraints))
+ return true;
+ }
+
+ // 2.2.3
+ if (derivedType->category() == SchemaType::SimpleTypeList || derivedType->category() == SchemaType::SimpleTypeUnion) {
+ if (baseType == BuiltinTypes::xsAnySimpleType)
+ return true;
+ }
+
+ // 2.2.4
+ if (baseType->category() == SchemaType::SimpleTypeUnion && baseType->isDefinedBySchema()) { // 2.2.4.1
+ const AnySimpleType::List memberTypes = XsdSimpleType::Ptr(baseType)->memberTypes();
+ for (int i = 0; i < memberTypes.count(); ++i) {
+ if (isSimpleDerivationOk(derivedType, memberTypes.at(i), constraints)) { // 2.2.4.2
+ if (XsdSimpleType::Ptr(baseType)->facets().isEmpty()) { // 2.2.4.3
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+bool XsdSchemaHelper::isComplexDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr &baseType, const SchemaType::DerivationConstraints &constraints)
+{
+ if (!derivedType)
+ return false;
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-ct-derived-ok
+
+ // 1
+ if (derivedType != baseType) {
+ if ((derivedType->derivationMethod() == SchemaType::DerivationRestriction) && (constraints & SchemaType::RestrictionConstraint))
+ return false;
+ if ((derivedType->derivationMethod() == SchemaType::DerivationExtension) && (constraints & SchemaType::ExtensionConstraint))
+ return false;
+ }
+
+ // 2.1
+ if (derivedType == baseType)
+ return true;
+
+ // 2.2
+ if (derivedType->wxsSuperType() == baseType)
+ return true;
+
+ // 2.3
+ bool isOk = true;
+ if (derivedType->wxsSuperType() == BuiltinTypes::xsAnyType) { // 2.3.1
+ isOk = false;
+ } else { // 2.3.2
+ if (!derivedType->wxsSuperType())
+ return false;
+
+ if (derivedType->wxsSuperType()->isComplexType()) { // 2.3.2.1
+ isOk = isComplexDerivationOk(derivedType->wxsSuperType(), baseType, constraints);
+ } else { // 2.3.2.2
+ isOk = isSimpleDerivationOk(derivedType->wxsSuperType(), baseType, constraints);
+ }
+ }
+ if (isOk)
+ return true;
+
+ return false;
+}
+
+bool XsdSchemaHelper::constructAndCompare(const DerivedString<TypeString>::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const DerivedString<TypeString>::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection)
+{
+ Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
+ "We can only compare atomic values.");
+
+ // we can not cast a xs:String to a xs:QName, so lets go the safe way
+ if (type->name(context->namePool()) == BuiltinTypes::xsQName->name(context->namePool()))
+ return false;
+
+ const AtomicValue::Ptr value1 = ValueFactory::fromLexical(operand1->stringValue(), type, context, sourceLocationReflection);
+ if (value1->hasError())
+ return false;
+
+ const AtomicValue::Ptr value2 = ValueFactory::fromLexical(operand2->stringValue(), type, context, sourceLocationReflection);
+ if (value2->hasError())
+ return false;
+
+ return ComparisonFactory::compare(value1, op, value2, type, context, sourceLocationReflection);
+}
+
+bool XsdSchemaHelper::checkWildcardProcessContents(const XsdWildcard::Ptr &baseWildcard, const XsdWildcard::Ptr &derivedWildcard)
+{
+ if (baseWildcard->processContents() == XsdWildcard::Strict) {
+ if (derivedWildcard->processContents() == XsdWildcard::Lax || derivedWildcard->processContents() == XsdWildcard::Skip) {
+ return false;
+ }
+ } else if (baseWildcard->processContents() == XsdWildcard::Lax) {
+ if (derivedWildcard->processContents() == XsdWildcard::Skip)
+ return false;
+ }
+
+ return true;
+}
+
+bool XsdSchemaHelper::foundSubstitutionGroupTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, QSet<XsdElement::Ptr> &visitedElements)
+{
+ if (visitedElements.contains(member))
+ return false;
+ else
+ visitedElements.insert(member);
+
+ if (member->substitutionGroupAffiliations().isEmpty())
+ return false;
+
+ if (member->substitutionGroupAffiliations().contains(head)) {
+ return true;
+ } else {
+ const XsdElement::List affiliations = member->substitutionGroupAffiliations();
+ for (int i = 0; i < affiliations.count(); ++i) {
+ if (foundSubstitutionGroupTransitive(head, affiliations.at(i), visitedElements))
+ return true;
+ }
+
+ return false;
+ }
+}
+
+void XsdSchemaHelper::foundSubstitutionGroupTypeInheritance(const SchemaType::Ptr &headType, const SchemaType::Ptr &memberType,
+ QSet<SchemaType::DerivationMethod> &derivationSet, NamedSchemaComponent::BlockingConstraints &blockSet)
+{
+ if (!memberType)
+ return;
+
+ if (memberType == headType)
+ return;
+
+ derivationSet.insert(memberType->derivationMethod());
+
+ if (memberType->isComplexType()) {
+ const XsdComplexType::Ptr complexType(memberType);
+ blockSet |= complexType->prohibitedSubstitutions();
+ }
+
+ foundSubstitutionGroupTypeInheritance(headType, memberType->wxsSuperType(), derivationSet, blockSet);
+}
+
+bool XsdSchemaHelper::substitutionGroupOkTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, const NamePool::Ptr &namePool)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-equiv-derived-ok-rec
+
+ // 1
+ if ((member->name(namePool) == head->name(namePool)) && (member->type() == head->type()))
+ return true;
+
+ // 2.1
+ if (head->disallowedSubstitutions() & NamedSchemaComponent::SubstitutionConstraint)
+ return false;
+
+ // 2.2
+ {
+ QSet<XsdElement::Ptr> visitedElements;
+ if (!foundSubstitutionGroupTransitive(head, member, visitedElements))
+ return false;
+ }
+
+ // 2.3
+ {
+ QSet<SchemaType::DerivationMethod> derivationSet;
+ NamedSchemaComponent::BlockingConstraints blockSet;
+
+ foundSubstitutionGroupTypeInheritance(head->type(), member->type(), derivationSet, blockSet);
+
+ NamedSchemaComponent::BlockingConstraints checkSet(blockSet);
+ checkSet |= head->disallowedSubstitutions();
+ if (head->type()->isComplexType()) {
+ const XsdComplexType::Ptr complexType(head->type());
+ checkSet |= complexType->prohibitedSubstitutions();
+ }
+
+ if ((checkSet & NamedSchemaComponent::RestrictionConstraint) && derivationSet.contains(SchemaType::DerivationRestriction))
+ return false;
+ if ((checkSet & NamedSchemaComponent::ExtensionConstraint) && derivationSet.contains(SchemaType::DerivationExtension))
+ return false;
+ if (checkSet & NamedSchemaComponent::SubstitutionConstraint)
+ return false;
+ }
+
+ return true;
+}
+
+bool XsdSchemaHelper::isValidAttributeGroupRestriction(const XsdAttributeGroup::Ptr &derivedAttributeGroup, const XsdAttributeGroup::Ptr &attributeGroup, const XsdSchemaContext::Ptr &context, QString &errorMsg)
+{
+ // @see http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction
+
+ const XsdAttributeUse::List derivedAttributeUses = derivedAttributeGroup->attributeUses();
+ const XsdAttributeUse::List baseAttributeUses = attributeGroup->attributeUses();
+
+ return isValidAttributeUsesRestriction(derivedAttributeUses, baseAttributeUses,
+ derivedAttributeGroup->wildcard(), attributeGroup->wildcard(), context, errorMsg);
+}
+
+bool XsdSchemaHelper::isValidAttributeUsesRestriction(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &baseAttributeUses,
+ const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg)
+{
+ const NamePool::Ptr namePool(context->namePool());
+
+ QHash<QXmlName, XsdAttributeUse::Ptr> baseAttributeUsesLookup;
+ for (int i = 0; i < baseAttributeUses.count(); ++i)
+ baseAttributeUsesLookup.insert(baseAttributeUses.at(i)->attribute()->name(namePool), baseAttributeUses.at(i));
+
+ QHash<QXmlName, XsdAttributeUse::Ptr> derivedAttributeUsesLookup;
+ for (int i = 0; i < derivedAttributeUses.count(); ++i)
+ derivedAttributeUsesLookup.insert(derivedAttributeUses.at(i)->attribute()->name(namePool), derivedAttributeUses.at(i));
+
+ // 2
+ for (int i = 0; i < derivedAttributeUses.count(); ++i) {
+ const XsdAttributeUse::Ptr derivedAttributeUse = derivedAttributeUses.at(i);
+
+ // prohibited attributes are no real attributes, so skip them in that test here
+ if (derivedAttributeUse->useType() == XsdAttributeUse::ProhibitedUse)
+ continue;
+
+ if (baseAttributeUsesLookup.contains(derivedAttributeUse->attribute()->name(namePool))) {
+ const XsdAttributeUse::Ptr baseAttributeUse(baseAttributeUsesLookup.value(derivedAttributeUse->attribute()->name(namePool)));
+
+ // 2.1.1
+ if (baseAttributeUse->isRequired() == true && derivedAttributeUse->isRequired() == false) {
+ errorMsg = QtXmlPatterns::tr("base attribute %1 is required but derived attribute is not").arg(formatAttribute(baseAttributeUse->attribute()->displayName(namePool)));
+ return false;
+ }
+
+ // 2.1.2
+ if (!isSimpleDerivationOk(derivedAttributeUse->attribute()->type(), baseAttributeUse->attribute()->type(), SchemaType::DerivationConstraints())) {
+ errorMsg = QtXmlPatterns::tr("type of derived attribute %1 cannot be validly derived from type of base attribute").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool)));
+ return false;
+ }
+
+ // 2.1.3
+ XsdAttributeUse::ValueConstraint::Ptr derivedConstraint;
+ if (derivedAttributeUse->valueConstraint())
+ derivedConstraint = derivedAttributeUse->valueConstraint();
+ else if (derivedAttributeUse->attribute()->valueConstraint())
+ derivedConstraint = XsdAttributeUse::ValueConstraint::fromAttributeValueConstraint(derivedAttributeUse->attribute()->valueConstraint());
+
+ XsdAttributeUse::ValueConstraint::Ptr baseConstraint;
+ if (baseAttributeUse->valueConstraint())
+ baseConstraint = baseAttributeUse->valueConstraint();
+ else if (baseAttributeUse->attribute()->valueConstraint())
+ baseConstraint = XsdAttributeUse::ValueConstraint::fromAttributeValueConstraint(baseAttributeUse->attribute()->valueConstraint());
+
+ bool ok = false;
+ if (!baseConstraint || baseConstraint->variety() == XsdAttributeUse::ValueConstraint::Default)
+ ok = true;
+
+ if (derivedConstraint && baseConstraint) {
+ const XsdTypeChecker checker(context, QVector<QXmlName>(), QSourceLocation(QUrl(QLatin1String("http://dummy.org")), 1, 1));
+ if (derivedConstraint->variety() == XsdAttributeUse::ValueConstraint::Fixed && checker.valuesAreEqual(derivedConstraint->value(), baseConstraint->value(), baseAttributeUse->attribute()->type()))
+ ok = true;
+ }
+
+ if (!ok) {
+ errorMsg = QtXmlPatterns::tr("value constraint of derived attribute %1 does not match value constraint of base attribute").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool)));
+ return false;
+ }
+ } else {
+ if (!wildcard) {
+ errorMsg = QtXmlPatterns::tr("derived attribute %1 does not exists in the base definition").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool)));
+ return false;
+ }
+
+ QXmlName name = derivedAttributeUse->attribute()->name(namePool);
+
+ // wildcards using XsdWildcard::absentNamespace, so we have to fix that here
+ if (name.namespaceURI() == StandardNamespaces::empty)
+ name.setNamespaceURI(namePool->allocateNamespace(XsdWildcard::absentNamespace()));
+
+ if (!wildcardAllowsExpandedName(name, wildcard, namePool)) {
+ errorMsg = QtXmlPatterns::tr("derived attribute %1 does not match the wildcard in the base definition").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool)));
+ return false;
+ }
+ }
+ }
+
+ // 3
+ for (int i = 0; i < baseAttributeUses.count(); ++i) {
+ const XsdAttributeUse::Ptr baseAttributeUse = baseAttributeUses.at(i);
+
+ if (baseAttributeUse->isRequired()) {
+ if (derivedAttributeUsesLookup.contains(baseAttributeUse->attribute()->name(namePool))) {
+ if (!derivedAttributeUsesLookup.value(baseAttributeUse->attribute()->name(namePool))->isRequired()) {
+ errorMsg = QtXmlPatterns::tr("base attribute %1 is required but derived attribute is not").arg(formatAttribute(baseAttributeUse->attribute()->displayName(namePool)));
+ return false;
+ }
+ } else {
+ errorMsg = QtXmlPatterns::tr("base attribute %1 is required but missing in derived definition").arg(formatAttribute(baseAttributeUse->attribute()->displayName(namePool)));
+ return false;
+ }
+ }
+ }
+
+ // 4
+ if (derivedWildcard) {
+ if (!wildcard) {
+ errorMsg = QtXmlPatterns::tr("derived definition contains an %1 element that does not exists in the base definition").arg(formatElement("anyAttribute"));
+ return false;
+ }
+
+ if (!isWildcardSubset(derivedWildcard, wildcard)) {
+ errorMsg = QtXmlPatterns::tr("derived wildcard is not a subset of the base wildcard");
+ return false;
+ }
+
+ if (!checkWildcardProcessContents(wildcard, derivedWildcard)) {
+ errorMsg = QtXmlPatterns::tr("%1 of derived wildcard is not a valid restriction of %2 of base wildcard").arg(formatKeyword("processContents")).arg(formatKeyword("processContents"));
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool XsdSchemaHelper::isValidAttributeUsesExtension(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &attributeUses,
+ const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#cos-ct-extends
+
+ const NamePool::Ptr namePool(context->namePool());
+
+ // 1.2
+ QHash<QXmlName, XsdAttribute::Ptr> lookupHash;
+ for (int i = 0; i < derivedAttributeUses.count(); ++i)
+ lookupHash.insert(derivedAttributeUses.at(i)->attribute()->name(namePool), derivedAttributeUses.at(i)->attribute());
+
+ for (int i = 0; i < attributeUses.count(); ++i) {
+ const QXmlName attributeName = attributeUses.at(i)->attribute()->name(namePool);
+ if (!lookupHash.contains(attributeName)) {
+ errorMsg = QtXmlPatterns::tr("attribute %1 from base type is missing in derived type").arg(formatKeyword(namePool->displayName(attributeName)));
+ return false;
+ }
+
+ if (lookupHash.value(attributeName)->type() != attributeUses.at(i)->attribute()->type()) {
+ errorMsg = QtXmlPatterns::tr("type of derived attribute %1 differs from type of base attribute").arg(formatKeyword(namePool->displayName(attributeName)));
+ return false;
+ }
+ }
+
+ // 1.3
+ if (wildcard) {
+ if (!derivedWildcard) {
+ errorMsg = QtXmlPatterns::tr("base definition contains an %1 element that is missing in the derived definition").arg(formatElement("anyAttribute"));
+ return false;
+ }
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemahelper_p.h b/src/xmlpatterns/schema/qxsdschemahelper_p.h
new file mode 100644
index 0000000..71fdfe7
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemahelper_p.h
@@ -0,0 +1,217 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchemaHelper_H
+#define Patternist_XsdSchemaHelper_H
+
+#include "qcomparisonfactory_p.h"
+#include "qschematype_p.h"
+#include "qxsdattributegroup_p.h"
+#include "qxsdelement_p.h"
+#include "qxsdparticle_p.h"
+#include "qxsdschemacontext_p.h"
+#include "qxsdwildcard_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Contains helper methods that are used by XsdSchemaParser, XsdSchemaResolver and XsdSchemaChecker.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSchemaHelper
+ {
+ public:
+ /**
+ * Checks whether the given @p particle is emptiable as defined by the
+ * algorithm in the schema spec.
+ */
+ static bool isParticleEmptiable(const XsdParticle::Ptr &particle);
+
+ /**
+ * Checks whether the given @p nameSpace is allowed by the given namespace @p constraint.
+ */
+ static bool wildcardAllowsNamespaceName(const QString &nameSpace,
+ const XsdWildcard::NamespaceConstraint::Ptr &constraint);
+
+ /**
+ * Checks whether the given @p name is allowed by the namespace constraint of the given @p wildcard.
+ */
+ static bool wildcardAllowsExpandedName(const QXmlName &name,
+ const XsdWildcard::Ptr &wildcard,
+ const NamePool::Ptr &namePool);
+
+ /**
+ * Checks whether the @p wildcard is a subset of @p otherWildcard.
+ */
+ static bool isWildcardSubset(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard);
+
+ /**
+ * Returns the union of the given @p wildcard and @p otherWildcard.
+ */
+ static XsdWildcard::Ptr wildcardUnion(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard);
+
+ /**
+ * Returns the intersection of the given @p wildcard and @p otherWildcard.
+ */
+ static XsdWildcard::Ptr wildcardIntersection(const XsdWildcard::Ptr &wildcard,
+ const XsdWildcard::Ptr &otherWildcard);
+
+ /**
+ * Returns whether the given @p type is validly substitutable for an @p otherType
+ * under the given @p constraints.
+ */
+ static bool isValidlySubstitutable(const SchemaType::Ptr &type,
+ const SchemaType::Ptr &otherType,
+ const SchemaType::DerivationConstraints &constraints);
+
+ /**
+ * Returns whether the simple @p derivedType can be derived from the simple @p baseType
+ * under the given @p constraints.
+ */
+ static bool isSimpleDerivationOk(const SchemaType::Ptr &derivedType,
+ const SchemaType::Ptr &baseType,
+ const SchemaType::DerivationConstraints &constraints);
+
+ /**
+ * Returns whether the complex @p derivedType can be derived from the complex @p baseType
+ * under the given @p constraints.
+ */
+ static bool isComplexDerivationOk(const SchemaType::Ptr &derivedType,
+ const SchemaType::Ptr &baseType,
+ const SchemaType::DerivationConstraints &constraints);
+
+ /**
+ * This method takes the two string based operands @p operand1 and @p operand2 and converts them to instances of type @p type.
+ * If the conversion fails, @c false is returned, otherwise the instances are compared by the given operator @p op and the
+ * result of the comparison is returned.
+ */
+ static bool constructAndCompare(const DerivedString<TypeString>::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const DerivedString<TypeString>::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection);
+
+ /**
+ * Returns whether the process content property of the @p derivedWildcard is valid
+ * according to the process content property of its @p baseWildcard.
+ */
+ static bool checkWildcardProcessContents(const XsdWildcard::Ptr &baseWildcard,
+ const XsdWildcard::Ptr &derivedWildcard);
+
+ /**
+ * Checks whether @[ member is a member of the substitution group with the given @p head.
+ */
+ static bool foundSubstitutionGroupTransitive(const XsdElement::Ptr &head,
+ const XsdElement::Ptr &member,
+ QSet<XsdElement::Ptr> &visitedElements);
+
+ /**
+ * A helper method that iterates over the type hierarchy from @p memberType up to @p headType and collects all
+ * @p derivationSet and @p blockSet constraints that exists on the way there.
+ */
+ static void foundSubstitutionGroupTypeInheritance(const SchemaType::Ptr &headType,
+ const SchemaType::Ptr &memberType,
+ QSet<SchemaType::DerivationMethod> &derivationSet,
+ NamedSchemaComponent::BlockingConstraints &blockSet);
+
+ /**
+ * Checks if the @p member is transitive to @p head.
+ */
+ static bool substitutionGroupOkTransitive(const XsdElement::Ptr &head,
+ const XsdElement::Ptr &member,
+ const NamePool::Ptr &namePool);
+
+ /**
+ * Checks if @p derivedAttributeGroup is a valid restriction for @p attributeGroup.
+ */
+ static bool isValidAttributeGroupRestriction(const XsdAttributeGroup::Ptr &derivedAttributeGroup,
+ const XsdAttributeGroup::Ptr &attributeGroup,
+ const XsdSchemaContext::Ptr &context,
+ QString &errorMsg);
+
+ /**
+ * Checks if @p derivedAttributeUses are a valid restriction for @p attributeUses.
+ */
+ static bool isValidAttributeUsesRestriction(const XsdAttributeUse::List &derivedAttributeUses,
+ const XsdAttributeUse::List &attributeUses,
+ const XsdWildcard::Ptr &derivedWildcard,
+ const XsdWildcard::Ptr &wildcard,
+ const XsdSchemaContext::Ptr &context,
+ QString &errorMsg);
+
+ /**
+ * Checks if @p derivedAttributeUses are a valid extension for @p attributeUses.
+ */
+ static bool isValidAttributeUsesExtension(const XsdAttributeUse::List &derivedAttributeUses,
+ const XsdAttributeUse::List &attributeUses,
+ const XsdWildcard::Ptr &derivedWildcard,
+ const XsdWildcard::Ptr &wildcard,
+ const XsdSchemaContext::Ptr &context,
+ QString &errorMsg);
+
+ private:
+ Q_DISABLE_COPY(XsdSchemaHelper)
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschemamerger.cpp b/src/xmlpatterns/schema/qxsdschemamerger.cpp
new file mode 100644
index 0000000..1714068
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemamerger.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemamerger_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdSchemaMerger::XsdSchemaMerger(const XsdSchema::Ptr &schema, const XsdSchema::Ptr &otherSchema)
+{
+ merge(schema, otherSchema);
+}
+
+XsdSchema::Ptr XsdSchemaMerger::mergedSchema() const
+{
+ return m_mergedSchema;
+}
+
+void XsdSchemaMerger::merge(const XsdSchema::Ptr &schema, const XsdSchema::Ptr &otherSchema)
+{
+ m_mergedSchema = XsdSchema::Ptr(new XsdSchema(otherSchema->namePool()));
+
+ // first fill the merged schema with the values from schema
+ if (schema) {
+ const XsdElement::List elements = schema->elements();
+ for (int i = 0; i < elements.count(); ++i) {
+ m_mergedSchema->addElement(elements.at(i));
+ }
+
+ const XsdAttribute::List attributes = schema->attributes();
+ for (int i = 0; i < attributes.count(); ++i) {
+ m_mergedSchema->addAttribute(attributes.at(i));
+ }
+
+ const SchemaType::List types = schema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ m_mergedSchema->addType(types.at(i));
+ }
+
+ const SchemaType::List anonymousTypes = schema->anonymousTypes();
+ for (int i = 0; i < anonymousTypes.count(); ++i) {
+ m_mergedSchema->addAnonymousType(anonymousTypes.at(i));
+ }
+
+ const XsdModelGroup::List elementGroups = schema->elementGroups();
+ for (int i = 0; i < elementGroups.count(); ++i) {
+ m_mergedSchema->addElementGroup(elementGroups.at(i));
+ }
+
+ const XsdAttributeGroup::List attributeGroups = schema->attributeGroups();
+ for (int i = 0; i < attributeGroups.count(); ++i) {
+ m_mergedSchema->addAttributeGroup(attributeGroups.at(i));
+ }
+
+ const XsdNotation::List notations = schema->notations();
+ for (int i = 0; i < notations.count(); ++i) {
+ m_mergedSchema->addNotation(notations.at(i));
+ }
+
+ const XsdIdentityConstraint::List identityConstraints = schema->identityConstraints();
+ for (int i = 0; i < identityConstraints.count(); ++i) {
+ m_mergedSchema->addIdentityConstraint(identityConstraints.at(i));
+ }
+ }
+
+ // then merge in the values from the otherSchema
+ {
+ const XsdElement::List elements = otherSchema->elements();
+ for (int i = 0; i < elements.count(); ++i) {
+ if (!m_mergedSchema->element(elements.at(i)->name(otherSchema->namePool())))
+ m_mergedSchema->addElement(elements.at(i));
+ }
+
+ const XsdAttribute::List attributes = otherSchema->attributes();
+ for (int i = 0; i < attributes.count(); ++i) {
+ if (!m_mergedSchema->attribute(attributes.at(i)->name(otherSchema->namePool())))
+ m_mergedSchema->addAttribute(attributes.at(i));
+ }
+
+ const SchemaType::List types = otherSchema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ if (!m_mergedSchema->type(types.at(i)->name(otherSchema->namePool())))
+ m_mergedSchema->addType(types.at(i));
+ }
+
+ const SchemaType::List anonymousTypes = otherSchema->anonymousTypes();
+ for (int i = 0; i < anonymousTypes.count(); ++i) {
+ // add anonymous type as they are
+ m_mergedSchema->addAnonymousType(anonymousTypes.at(i));
+ }
+
+ const XsdModelGroup::List elementGroups = otherSchema->elementGroups();
+ for (int i = 0; i < elementGroups.count(); ++i) {
+ if (!m_mergedSchema->elementGroup(elementGroups.at(i)->name(otherSchema->namePool())))
+ m_mergedSchema->addElementGroup(elementGroups.at(i));
+ }
+
+ const XsdAttributeGroup::List attributeGroups = otherSchema->attributeGroups();
+ for (int i = 0; i < attributeGroups.count(); ++i) {
+ if (!m_mergedSchema->attributeGroup(attributeGroups.at(i)->name(otherSchema->namePool())))
+ m_mergedSchema->addAttributeGroup(attributeGroups.at(i));
+ }
+
+ const XsdNotation::List notations = otherSchema->notations();
+ for (int i = 0; i < notations.count(); ++i) {
+ if (!m_mergedSchema->notation(notations.at(i)->name(otherSchema->namePool())))
+ m_mergedSchema->addNotation(notations.at(i));
+ }
+
+ const XsdIdentityConstraint::List identityConstraints = otherSchema->identityConstraints();
+ for (int i = 0; i < identityConstraints.count(); ++i) {
+ if (!m_mergedSchema->identityConstraint(identityConstraints.at(i)->name(otherSchema->namePool())))
+ m_mergedSchema->addIdentityConstraint(identityConstraints.at(i));
+ }
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemamerger_p.h b/src/xmlpatterns/schema/qxsdschemamerger_p.h
new file mode 100644
index 0000000..8b522c5
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemamerger_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchemaMerger_H
+#define Patternist_XsdSchemaMerger_H
+
+#include "qxsdschema_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A helper class that merges two schemas into one.
+ *
+ * This class is used in XsdValidatingInstanceReader to merge the schema
+ * given in the constructor with a schema defined in the instance document
+ * via xsi:schemaLocation or xsi:noNamespaceSchema location.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSchemaMerger : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdSchemaMerger> Ptr;
+
+ /**
+ * Creates a new schema merger object that merges @p schema with @p otherSchema.
+ */
+ XsdSchemaMerger(const XsdSchema::Ptr &schema, const XsdSchema::Ptr &otherSchema);
+
+ /**
+ * Returns the merged schema.
+ */
+ XsdSchema::Ptr mergedSchema() const;
+
+ private:
+ void merge(const XsdSchema::Ptr &schema, const XsdSchema::Ptr &otherSchema);
+
+ XsdSchema::Ptr m_mergedSchema;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp
new file mode 100644
index 0000000..4e6a643
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp
@@ -0,0 +1,6078 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemaparser_p.h"
+
+#include "private/qxmlutils_p.h"
+#include "qacceltreeresourceloader_p.h"
+#include "qautoptr_p.h"
+#include "qboolean_p.h"
+#include "qcommonnamespaces_p.h"
+#include "qderivedinteger_p.h"
+#include "qderivedstring_p.h"
+#include "qqnamevalue_p.h"
+#include "qxmlquery_p.h"
+#include "qxpathhelper_p.h"
+#include "qxsdattributereference_p.h"
+#include "qxsdreference_p.h"
+#include "qxsdschematoken_p.h"
+
+#include <QtCore/QFile>
+#include <QtXmlPatterns/QXmlQuery>
+
+QT_BEGIN_NAMESPACE
+
+/**
+ * @page schema_overview Overview
+ * @section structure_and_components Structure and Components
+ *
+ * The schema validator code consists of 4 major components
+ *
+ * <dl>
+ * <dt>The schema parser (QPatternist::XsdSchemaParser)</dt>
+ * <dd>This component parses a XML document that is supplied via a QIODevice. It creates
+ * a so called (incomplete) 'compiled schema', which is a representation of the XML Schema
+ * structure as C++ objects.
+ * As the parser is a streaming parser, it can't resolve references to types or elements/attributes
+ * in place, therefor it creates resolver tasks which are passed to the schema resolver component
+ * for resolving at a later point in time.
+ * The parser does furthermore the basic XML structure constraint checking, e.g. if all required
+ * attributes are available or the order of the elements is correct.</dd>
+ *
+ * <dt>The schema resolver (QPatternist::XsdSchemaResolver)</dt>
+ * <dd>This component is activated after the schema parser component has been finished the parsing
+ * of all schemas. The resolver has been supplied with resolve tasks by the schema parser that
+ * it will resolve in this step now. Between working on the single resolver tasks, the resolver
+ * calls check methods from the schema checker component to make sure that some assertions are
+ * valid (e.g. no circular inheritance of types), so that the resolver can work without hassle.
+ * During resoving references to attribute or element groups it also checks for circular references
+ * of these groups.
+ * At the end of that phase we have a compiled schema that is fully resolved (not necessarily valid though).</dd>
+ *
+ * <dt>The schema checker (QPatternist::XsdSchemaChecker)</dt>
+ * <dd>This component does all the schema constraint checking as given by the Schema specification.
+ * At the end of that phase we have fully resolved and valid compiled schema that can be used for validation
+ * of instance documents.</dd>
+ *
+ * <dt>The validator (QPatternist::XsdValidatingInstanceReader)</dt>
+ * <dd>This component is responsible for validating a XML instance document, provided via a QIODevice, against
+ * a valid compiled schema.</dd>
+ * </dl>
+ *
+ * @ingroup Patternist_schema
+ */
+
+using namespace QPatternist;
+
+namespace QPatternist
+{
+
+/**
+ * @short A helper class for automatically handling namespace scopes of elements.
+ *
+ * This class should be instantiated at the beginning of each parse XYZ method.
+ */
+class ElementNamespaceHandler
+{
+ public:
+ /**
+ * Creates a new element namespace handler object.
+ *
+ * It checks whether the @p parser is on the right @p tag and it creates a new namespace
+ * context that contains the inherited and local namespace declarations.
+ */
+ ElementNamespaceHandler(const XsdSchemaToken::NodeName &tag, XsdSchemaParser *parser)
+ : m_parser(parser)
+ {
+ Q_ASSERT(m_parser->isStartElement() && (XsdSchemaToken::toToken(m_parser->name()) == tag) && (XsdSchemaToken::toToken(m_parser->namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI));
+ m_parser->m_namespaceSupport.pushContext();
+ m_parser->m_namespaceSupport.setPrefixes(m_parser->namespaceDeclarations());
+ }
+
+ /**
+ * Destroys the element namespace handler object.
+ *
+ * It destroys the local namespace context.
+ */
+ ~ElementNamespaceHandler()
+ {
+ m_parser->m_namespaceSupport.popContext();
+ }
+
+ private:
+ XsdSchemaParser *m_parser;
+};
+
+/**
+ * A helper class that checks for the right occurrence of
+ * xml tags with the help of a DFA.
+ */
+class TagValidationHandler
+{
+ public:
+ TagValidationHandler(XsdTagScope::Type tag, XsdSchemaParser *parser, const NamePool::Ptr &namePool)
+ : m_parser(parser), m_machine(namePool)
+ {
+ Q_ASSERT(m_parser->m_stateMachines.contains(tag));
+
+ m_machine = m_parser->m_stateMachines.value(tag);
+ m_machine.reset();
+ }
+
+ void validate(XsdSchemaToken::NodeName token)
+ {
+ if (token == XsdSchemaToken::NoKeyword) {
+ const QList<XsdSchemaToken::NodeName> tokens = m_machine.possibleTransitions();
+
+ QStringList elementNames;
+ for (int i = 0; i < tokens.count(); ++i)
+ elementNames.append(formatElement(XsdSchemaToken::toString(tokens.at(i))));
+
+ m_parser->error(QtXmlPatterns::tr("can not process unknown element %1, expected elements are: %2")
+ .arg(formatElement(m_parser->name().toString()))
+ .arg(elementNames.join(QLatin1String(", "))));
+ return;
+ }
+
+ if (!m_machine.proceed(token)) {
+ const QList<XsdSchemaToken::NodeName> tokens = m_machine.possibleTransitions();
+
+ QStringList elementNames;
+ for (int i = 0; i < tokens.count(); ++i)
+ elementNames.append(formatElement(XsdSchemaToken::toString(tokens.at(i))));
+
+ m_parser->error(QtXmlPatterns::tr("element %1 is not allowed in this scope, possible elements are: %2")
+ .arg(formatElement(XsdSchemaToken::toString(token)))
+ .arg(elementNames.join(QLatin1String(", "))));
+ return;
+ }
+ }
+
+ void finalize() const
+ {
+ if (!m_machine.inEndState()) {
+ const QList<XsdSchemaToken::NodeName> tokens = m_machine.possibleTransitions();
+
+ QStringList elementNames;
+ for (int i = 0; i < tokens.count(); ++i)
+ elementNames.append(formatElement(XsdSchemaToken::toString(tokens.at(i))));
+
+ m_parser->error(QtXmlPatterns::tr("child element is missing in that scope, possible child elements are: %1")
+ .arg(elementNames.join(QLatin1String(", "))));
+ }
+ }
+
+ private:
+ XsdSchemaParser *m_parser;
+ XsdStateMachine<XsdSchemaToken::NodeName> m_machine;
+};
+
+}
+
+/**
+ * Returns a list of all particles with group references that appear at any level of
+ * the given unresolved @p group.
+ */
+static XsdParticle::List collectGroupRef(const XsdModelGroup::Ptr &group)
+{
+ XsdParticle::List refParticles;
+
+ XsdParticle::List particles = group->particles();
+ for (int i = 0; i < particles.count(); ++i) {
+ if (particles.at(i)->term()->isReference()) {
+ const XsdReference::Ptr reference(particles.at(i)->term());
+ if (reference->type() == XsdReference::ModelGroup)
+ refParticles.append(particles.at(i));
+ }
+ if (particles.at(i)->term()->isModelGroup()) {
+ refParticles << collectGroupRef(XsdModelGroup::Ptr(particles.at(i)->term()));
+ }
+ }
+
+ return refParticles;
+}
+
+/**
+ * Helper function that works around the limited facilities of
+ * QUrl/AnyURI::fromLexical to detect invalid URIs
+ */
+inline static bool isValidUri(const QString &string)
+{
+ // an empty URI points to the current document as defined in RFC 2396 (4.2)
+ if (string.isEmpty())
+ return true;
+
+ // explicit check as that is not checked by the code below
+ if (string.startsWith(QLatin1String("##")))
+ return false;
+
+ const AnyURI::Ptr uri = AnyURI::fromLexical(string);
+ return (!(uri->hasError()));
+}
+
+XsdSchemaParser::XsdSchemaParser(const XsdSchemaContext::Ptr &context, const XsdSchemaParserContext::Ptr &parserContext, QIODevice *device)
+ : MaintainingReader<XsdSchemaToken, XsdTagScope::Type>(parserContext->elementDescriptions(), QSet<XsdSchemaToken::NodeName>(), context, device)
+ , m_context(context)
+ , m_parserContext(parserContext)
+ , m_namePool(m_parserContext->namePool())
+ , m_namespaceSupport(m_namePool)
+{
+ m_schema = m_parserContext->schema();
+ m_schemaResolver = m_parserContext->resolver();
+ m_idCache = XsdIdCache::Ptr(new XsdIdCache());
+
+ setupStateMachines();
+ setupBuiltinTypeNames();
+}
+
+void XsdSchemaParser::setIncludedSchemas(const NamespaceSet &schemas)
+{
+ m_includedSchemas = schemas;
+}
+
+void XsdSchemaParser::setImportedSchemas(const NamespaceSet &schemas)
+{
+ m_importedSchemas = schemas;
+}
+
+void XsdSchemaParser::setRedefinedSchemas(const NamespaceSet &schemas)
+{
+ m_redefinedSchemas = schemas;
+}
+
+void XsdSchemaParser::setTargetNamespace(const QString &targetNamespace)
+{
+ m_targetNamespace = targetNamespace;
+}
+
+void XsdSchemaParser::setTargetNamespaceExtended(const QString &targetNamespace)
+{
+ m_targetNamespace = targetNamespace;
+ m_namespaceSupport.setTargetNamespace(m_namePool->allocateNamespace(m_targetNamespace));
+}
+
+void XsdSchemaParser::setDocumentURI(const QUrl &uri)
+{
+ m_documentURI = uri;
+
+ // prevent to get included/imported/redefined twice
+ m_includedSchemas.insert(uri);
+ m_importedSchemas.insert(uri);
+}
+
+QUrl XsdSchemaParser::documentURI() const
+{
+ return m_documentURI;
+}
+
+bool XsdSchemaParser::isAnyAttributeAllowed() const
+{
+ return false;
+}
+
+bool XsdSchemaParser::parse(ParserType parserType)
+{
+ m_componentLocationHash.clear();
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ if (isSchemaTag(XsdSchemaToken::Schema, token, namespaceToken)) {
+ parseSchema(parserType);
+ } else {
+ error(QtXmlPatterns::tr("document is not a XML schema"));
+ }
+ }
+ }
+
+ m_schemaResolver->addComponentLocationHash(m_componentLocationHash);
+ m_schemaResolver->setDefaultOpenContent(m_defaultOpenContent, m_defaultOpenContentAppliesToEmpty);
+
+ if (QXmlStreamReader::error() != QXmlStreamReader::NoError)
+ error(errorString());
+
+ return true;
+}
+
+void XsdSchemaParser::error(const QString &msg)
+{
+ MaintainingReader<XsdSchemaToken, XsdTagScope::Type>::error(msg, XsdSchemaContext::XSDError);
+}
+
+void XsdSchemaParser::attributeContentError(const char *attributeName, const char *elementName, const QString &value, const SchemaType::Ptr &type)
+{
+ if (type) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element contains invalid content: {%3} is not a value of type %4")
+ .arg(formatAttribute(attributeName))
+ .arg(formatElement(elementName))
+ .arg(formatData(value))
+ .arg(formatType(m_namePool, type)));
+ } else {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element contains invalid content: {%3}")
+ .arg(formatAttribute(attributeName))
+ .arg(formatElement(elementName))
+ .arg(formatData(value)));
+ }
+}
+
+void XsdSchemaParser::parseSchema(ParserType parserType)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Schema, this);
+
+ validateElement(XsdTagScope::Schema);
+
+ // parse attributes
+
+ if (parserType == TopLevelParser) {
+ if (hasAttribute(QString::fromLatin1("targetNamespace"))) {
+ m_targetNamespace = readNamespaceAttribute(QString::fromLatin1("targetNamespace"), "schema");
+ }
+ } else if (parserType == IncludeParser) {
+ // m_targetNamespace is set to the target namespace of the including schema at this point
+
+ if (hasAttribute(QString::fromLatin1("targetNamespace"))) {
+ const QString targetNamespace = readNamespaceAttribute(QString::fromLatin1("targetNamespace"), "schema");
+
+ if (m_targetNamespace != targetNamespace) {
+ error(QtXmlPatterns::tr("target namespace %1 of included schema is different from the target namespace %2 as defined by the including schema")
+ .arg(formatURI(targetNamespace)).arg(formatURI(m_targetNamespace)));
+ return;
+ }
+ }
+ } else if (parserType == ImportParser) {
+ // m_targetNamespace is set to the target namespace from the namespace attribute of the <import> tag at this point
+
+ QString targetNamespace;
+ if (hasAttribute(QString::fromLatin1("targetNamespace"))) {
+ targetNamespace = readNamespaceAttribute(QString::fromLatin1("targetNamespace"), "schema");
+ }
+
+ if (m_targetNamespace != targetNamespace) {
+ error(QtXmlPatterns::tr("target namespace %1 of imported schema is different from the target namespace %2 as defined by the importing schema")
+ .arg(formatURI(targetNamespace)).arg(formatURI(m_targetNamespace)));
+ return;
+ }
+ } else if (parserType == RedefineParser) {
+ // m_targetNamespace is set to the target namespace of the redefining schema at this point
+
+ if (hasAttribute(QString::fromLatin1("targetNamespace"))) {
+ const QString targetNamespace = readNamespaceAttribute(QString::fromLatin1("targetNamespace"), "schema");
+
+ if (m_targetNamespace != targetNamespace) {
+ error(QtXmlPatterns::tr("target namespace %1 of imported schema is different from the target namespace %2 as defined by the importing schema")
+ .arg(formatURI(targetNamespace)).arg(formatURI(m_targetNamespace)));
+ return;
+ }
+ }
+ }
+
+ if (hasAttribute(QString::fromLatin1("attributeFormDefault"))) {
+ const QString value = readAttribute(QString::fromLatin1("attributeFormDefault"));
+ if (value != QString::fromLatin1("qualified") && value != QString::fromLatin1("unqualified")) {
+ attributeContentError("attributeFormDefault", "schema", value);
+ return;
+ }
+
+ m_attributeFormDefault = value;
+ } else {
+ m_attributeFormDefault = QString::fromLatin1("unqualified");
+ }
+
+ if (hasAttribute(QString::fromLatin1("elementFormDefault"))) {
+ const QString value = readAttribute(QString::fromLatin1("elementFormDefault"));
+ if (value != QString::fromLatin1("qualified") && value != QString::fromLatin1("unqualified")) {
+ attributeContentError("elementFormDefault", "schema", value);
+ return;
+ }
+
+ m_elementFormDefault = value;
+ } else {
+ m_elementFormDefault = QString::fromLatin1("unqualified");
+ }
+
+ if (hasAttribute(QString::fromLatin1("blockDefault"))) {
+ const QString blockDefault = readAttribute(QString::fromLatin1("blockDefault"));
+ const QStringList blockDefaultList = blockDefault.split(QLatin1Char(' '), QString::SkipEmptyParts);
+ for (int i = 0; i < blockDefaultList.count(); ++i) {
+ const QString value = blockDefaultList.at(i);
+ if (value != QString::fromLatin1("#all") &&
+ value != QString::fromLatin1("extension") &&
+ value != QString::fromLatin1("restriction") &&
+ value != QString::fromLatin1("substitution")) {
+ attributeContentError("blockDefault", "schema", value);
+ return;
+ }
+ }
+
+ m_blockDefault = blockDefault;
+ }
+
+ if (hasAttribute(QString::fromLatin1("finalDefault"))) {
+ const QString finalDefault = readAttribute(QString::fromLatin1("finalDefault"));
+ const QStringList finalDefaultList = finalDefault.split(QLatin1Char(' '), QString::SkipEmptyParts);
+ for (int i = 0; i < finalDefaultList.count(); ++i) {
+ const QString value = finalDefaultList.at(i);
+ if (value != QString::fromLatin1("#all") &&
+ value != QString::fromLatin1("extension") &&
+ value != QString::fromLatin1("restriction") &&
+ value != QString::fromLatin1("list") &&
+ value != QString::fromLatin1("union")) {
+ attributeContentError("finalDefault", "schema", value);
+ return;
+ }
+ }
+
+ m_finalDefault = finalDefault;
+ }
+
+ if (hasAttribute(QString::fromLatin1("xpathDefaultNamespace"))) {
+ const QString xpathDefaultNamespace = readAttribute(QString::fromLatin1("xpathDefaultNamespace"));
+ if (xpathDefaultNamespace != QString::fromLatin1("##defaultNamespace") &&
+ xpathDefaultNamespace != QString::fromLatin1("##targetNamespace") &&
+ xpathDefaultNamespace != QString::fromLatin1("##local")) {
+ if (!isValidUri(xpathDefaultNamespace)) {
+ attributeContentError("xpathDefaultNamespace", "schema", xpathDefaultNamespace);
+ return;
+ }
+ }
+ m_xpathDefaultNamespace = xpathDefaultNamespace;
+ } else {
+ m_xpathDefaultNamespace = QString::fromLatin1("##local");
+ }
+
+ if (hasAttribute(QString::fromLatin1("defaultAttributes"))) {
+ const QString attrGroupName = readQNameAttribute(QString::fromLatin1("defaultAttributes"), "schema");
+ convertName(attrGroupName, NamespaceSupport::ElementName, m_defaultAttributes); // translate qualified name into QXmlName
+ }
+
+ if (hasAttribute(QString::fromLatin1("version"))) {
+ const QString version = readAttribute(QString::fromLatin1("version"));
+ }
+
+ if (hasAttribute(CommonNamespaces::XML, QString::fromLatin1("lang"))) {
+ const QString value = readAttribute(QString::fromLatin1("lang"), CommonNamespaces::XML);
+
+ const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"));
+ if (!exp.exactMatch(value)) {
+ attributeContentError("xml:lang", "schema", value);
+ return;
+ }
+ }
+
+ validateIdAttribute("schema");
+
+ TagValidationHandler tagValidator(XsdTagScope::Schema, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Include, token, namespaceToken)) {
+ parseInclude();
+ } else if (isSchemaTag(XsdSchemaToken::Import, token, namespaceToken)) {
+ parseImport();
+ } else if (isSchemaTag(XsdSchemaToken::Redefine, token, namespaceToken)) {
+ parseRedefine();
+ } else if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ m_schema->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::DefaultOpenContent, token, namespaceToken)) {
+ parseDefaultOpenContent();
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ const XsdSimpleType::Ptr type = parseGlobalSimpleType();
+ addType(type);
+ } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) {
+ const XsdComplexType::Ptr type = parseGlobalComplexType();
+ addType(type);
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdModelGroup::Ptr group = parseNamedGroup();
+ addElementGroup(group);
+ } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) {
+ XsdAttributeGroup::Ptr attributeGroup = parseNamedAttributeGroup();
+ addAttributeGroup(attributeGroup);
+ } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) {
+ const XsdElement::Ptr element = parseGlobalElement();
+ addElement(element);
+ } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) {
+ const XsdAttribute::Ptr attribute = parseGlobalAttribute();
+ addAttribute(attribute);
+ } else if (isSchemaTag(XsdSchemaToken::Notation, token, namespaceToken)) {
+ const XsdNotation::Ptr notation = parseNotation();
+ addNotation(notation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ m_schema->setTargetNamespace(m_targetNamespace);
+}
+
+void XsdSchemaParser::parseInclude()
+{
+ Q_ASSERT(isStartElement() && XsdSchemaToken::toToken(name()) == XsdSchemaToken::Include &&
+ XsdSchemaToken::toToken(namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI);
+
+ validateElement(XsdTagScope::Include);
+
+ // parse attributes
+ const QString schemaLocation = readAttribute(QString::fromLatin1("schemaLocation"));
+
+ QUrl url(schemaLocation);
+ if (url.isRelative()) {
+ Q_ASSERT(m_documentURI.isValid());
+
+ url = m_documentURI.resolved(url);
+ }
+
+ if (m_includedSchemas.contains(url)) {
+ // we have included that file already, according to the schema spec we are
+ // allowed to silently skip it.
+ } else {
+ m_includedSchemas.insert(url);
+
+ const AutoPtr<QNetworkReply> reply(AccelTreeResourceLoader::load(url, m_context->networkAccessManager(),
+ m_context, AccelTreeResourceLoader::ContinueOnError));
+ if (reply) {
+ // parse the included schema by a different parser but with the same context
+ XsdSchemaParser parser(m_context, m_parserContext, reply.data());
+ parser.setDocumentURI(url);
+ parser.setTargetNamespaceExtended(m_targetNamespace);
+ parser.setIncludedSchemas(m_includedSchemas);
+ parser.setImportedSchemas(m_importedSchemas);
+ parser.setRedefinedSchemas(m_redefinedSchemas);
+ if (!parser.parse(XsdSchemaParser::IncludeParser))
+ return;
+ }
+ }
+
+ validateIdAttribute("include");
+
+ TagValidationHandler tagValidator(XsdTagScope::Include, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ m_schema->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+}
+
+void XsdSchemaParser::parseImport()
+{
+ Q_ASSERT(isStartElement() && XsdSchemaToken::toToken(name()) == XsdSchemaToken::Import &&
+ XsdSchemaToken::toToken(namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI);
+
+ validateElement(XsdTagScope::Import);
+
+ // parse attributes
+ QString importNamespace;
+ if (hasAttribute(QString::fromLatin1("namespace"))) {
+ importNamespace = readAttribute(QString::fromLatin1("namespace"));
+ if (importNamespace == m_targetNamespace) {
+ error(QtXmlPatterns::tr("%1 element is not allowed to have the same %2 attribute value as the target namespace %3")
+ .arg(formatElement("import"))
+ .arg(formatAttribute("namespace"))
+ .arg(formatURI(m_targetNamespace)));
+ return;
+ }
+ } else {
+ if (m_targetNamespace.isEmpty()) {
+ error(QtXmlPatterns::tr("%1 element without %2 attribute is not allowed inside schema without target namespace")
+ .arg(formatElement("import"))
+ .arg(formatAttribute("namespace")));
+ return;
+ }
+ }
+
+ if (hasAttribute(QString::fromLatin1("schemaLocation"))) {
+ const QString schemaLocation = readAttribute(QString::fromLatin1("schemaLocation"));
+
+ QUrl url(schemaLocation);
+ if (url.isRelative()) {
+ Q_ASSERT(m_documentURI.isValid());
+
+ url = m_documentURI.resolved(url);
+ }
+
+ if (m_importedSchemas.contains(url)) {
+ // we have imported that file already, according to the schema spec we are
+ // allowed to silently skip it.
+ } else {
+ m_importedSchemas.insert(url);
+
+ // as it is possible that well known schemas (e.g. XSD for XML) are only referenced by
+ // namespace we should add it as well
+ m_importedSchemas.insert(importNamespace);
+
+ AutoPtr<QNetworkReply> reply(AccelTreeResourceLoader::load(url, m_context->networkAccessManager(),
+ m_context, AccelTreeResourceLoader::ContinueOnError));
+ if (reply) {
+ // parse the included schema by a different parser but with the same context
+ XsdSchemaParser parser(m_context, m_parserContext, reply.data());
+ parser.setDocumentURI(url);
+ parser.setTargetNamespace(importNamespace);
+ parser.setIncludedSchemas(m_includedSchemas);
+ parser.setImportedSchemas(m_importedSchemas);
+ parser.setRedefinedSchemas(m_redefinedSchemas);
+ if (!parser.parse(XsdSchemaParser::ImportParser))
+ return;
+ }
+ }
+ } else {
+ // check whether it is a known namespace we have a builtin schema for
+ if (!importNamespace.isEmpty()) {
+ if (!m_importedSchemas.contains(importNamespace)) {
+ m_importedSchemas.insert(importNamespace);
+
+ QFile file(QString::fromLatin1(":") + importNamespace);
+ if (file.open(QIODevice::ReadOnly)) {
+ XsdSchemaParser parser(m_context, m_parserContext, &file);
+ parser.setDocumentURI(importNamespace);
+ parser.setTargetNamespace(importNamespace);
+ parser.setIncludedSchemas(m_includedSchemas);
+ parser.setImportedSchemas(m_importedSchemas);
+ parser.setRedefinedSchemas(m_redefinedSchemas);
+ if (!parser.parse(XsdSchemaParser::ImportParser))
+ return;
+ }
+ }
+ } else {
+ // we don't import anything... that is valid according to the schema
+ }
+ }
+
+ validateIdAttribute("import");
+
+ TagValidationHandler tagValidator(XsdTagScope::Import, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ m_schema->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+}
+
+void XsdSchemaParser::parseRedefine()
+{
+ Q_ASSERT(isStartElement() && XsdSchemaToken::toToken(name()) == XsdSchemaToken::Redefine &&
+ XsdSchemaToken::toToken(namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI);
+
+ validateElement(XsdTagScope::Redefine);
+
+ // parse attributes
+ validateIdAttribute("redefine");
+
+ const QString schemaLocation = readAttribute(QString::fromLatin1("schemaLocation"));
+
+ TagValidationHandler tagValidator(XsdTagScope::Redefine, this, m_namePool);
+
+ XsdSimpleType::List redefinedSimpleTypes;
+ XsdComplexType::List redefinedComplexTypes;
+ XsdModelGroup::List redefinedGroups;
+ XsdAttributeGroup::List redefinedAttributeGroups;
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ m_schema->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ const XsdSimpleType::Ptr type = parseGlobalSimpleType();
+ redefinedSimpleTypes.append(type);
+
+ const QXmlName baseTypeName = m_parserContext->resolver()->baseTypeNameOfType(type);
+ if (baseTypeName != type->name(m_namePool)) {
+ error(QString::fromLatin1("redefined simple type %1 must have itself as base type").arg(formatType(m_namePool, type)));
+ return;
+ }
+ } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) {
+ const XsdComplexType::Ptr type = parseGlobalComplexType();
+ redefinedComplexTypes.append(type);
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#src-redefine
+
+ // 5
+ const QXmlName baseTypeName = m_parserContext->resolver()->baseTypeNameOfType(type);
+ if (baseTypeName != type->name(m_namePool)) {
+ error(QString::fromLatin1("redefined complex type %1 must have itself as base type").arg(formatType(m_namePool, type)));
+ return;
+ }
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdModelGroup::Ptr group = parseNamedGroup();
+ redefinedGroups.append(group);
+ } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) {
+ const XsdAttributeGroup::Ptr group = parseNamedAttributeGroup();
+ redefinedAttributeGroups.append(group);
+
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ bool locationMustResolve = false;
+ if (!redefinedSimpleTypes.isEmpty() || !redefinedComplexTypes.isEmpty() ||
+ !redefinedGroups.isEmpty() || !redefinedAttributeGroups.isEmpty()) {
+ locationMustResolve = true;
+ }
+
+ QUrl url(schemaLocation);
+ if (url.isRelative()) {
+ Q_ASSERT(m_documentURI.isValid());
+
+ url = m_documentURI.resolved(url);
+ }
+
+ // we parse the schema given in the redefine tag into its own context
+ const XsdSchemaParserContext::Ptr redefinedContext(new XsdSchemaParserContext(m_namePool, m_context));
+
+ if (m_redefinedSchemas.contains(url)) {
+ // we have redefined that file already, according to the schema spec we are
+ // allowed to silently skip it.
+ } else {
+ m_redefinedSchemas.insert(url);
+ QNetworkReply *reply = AccelTreeResourceLoader::load(url, m_context->networkAccessManager(),
+ m_context,
+ (locationMustResolve ? AccelTreeResourceLoader::FailOnError : AccelTreeResourceLoader::ContinueOnError));
+ if (reply) {
+ // parse the included schema by a different parser but with the same context
+ XsdSchemaParser parser(m_context, redefinedContext, reply);
+ parser.setDocumentURI(url);
+ parser.setTargetNamespaceExtended(m_targetNamespace);
+ parser.setIncludedSchemas(m_includedSchemas);
+ parser.setImportedSchemas(m_importedSchemas);
+ parser.setRedefinedSchemas(m_redefinedSchemas);
+ if (!parser.parse(XsdSchemaParser::RedefineParser))
+ return;
+
+ delete reply;
+ }
+ }
+
+ XsdSimpleType::List contextSimpleTypes = redefinedContext->schema()->simpleTypes();
+ XsdComplexType::List contextComplexTypes = redefinedContext->schema()->complexTypes();
+ XsdModelGroup::List contextGroups = redefinedContext->schema()->elementGroups();
+ XsdAttributeGroup::List contextAttributeGroups = redefinedContext->schema()->attributeGroups();
+
+ // now we do the actual redefinition:
+
+ // iterate over all redefined simple types
+ for (int i = 0; i < redefinedSimpleTypes.count(); ++i) {
+ XsdSimpleType::Ptr redefinedType = redefinedSimpleTypes.at(i);
+
+ //TODONEXT: validation
+
+ // search the definition they override in the context types
+ bool found = false;
+ for (int j = 0; j < contextSimpleTypes.count(); ++j) {
+ XsdSimpleType::Ptr contextType = contextSimpleTypes.at(j);
+
+ if (redefinedType->name(m_namePool) == contextType->name(m_namePool)) { // we found the right type
+ found = true;
+
+ // 1) set name of context type to empty name
+ contextType->setName(m_parserContext->createAnonymousName(QString()));
+
+ // 2) set the context type as base type for the redefined type
+ redefinedType->setWxsSuperType(contextType);
+
+ // 3) remove the base type resolving job from the resolver as
+ // we have set the base type here explicitely
+ m_parserContext->resolver()->removeSimpleRestrictionBase(redefinedType);
+
+ // 4) add the redefined type to the schema
+ addType(redefinedType);
+
+ // 5) add the context type as anonymous type, so the resolver
+ // can resolve it further.
+ addAnonymousType(contextType);
+
+ // 6) remove the context type from the list
+ contextSimpleTypes.removeAt(j);
+
+ break;
+ }
+ }
+
+ if (!found) {
+ error(QString::fromLatin1("no matching type found to redefine simple type %1").arg(formatType(m_namePool, redefinedType)));
+ return;
+ }
+ }
+
+ // add all remaining context simple types to the schema
+ for (int i = 0; i < contextSimpleTypes.count(); ++i) {
+ addType(contextSimpleTypes.at(i));
+ }
+
+ // iterate over all redefined complex types
+ for (int i = 0; i < redefinedComplexTypes.count(); ++i) {
+ XsdComplexType::Ptr redefinedType = redefinedComplexTypes.at(i);
+
+ //TODONEXT: validation
+
+ // search the definition they override in the context types
+ bool found = false;
+ for (int j = 0; j < contextComplexTypes.count(); ++j) {
+ XsdComplexType::Ptr contextType = contextComplexTypes.at(j);
+
+ if (redefinedType->name(m_namePool) == contextType->name(m_namePool)) { // we found the right type
+ found = true;
+
+ // 1) set name of context type to empty name
+ contextType->setName(m_parserContext->createAnonymousName(QString()));
+
+ // 2) set the context type as base type for the redefined type
+ redefinedType->setWxsSuperType(contextType);
+
+ // 3) remove the base type resolving job from the resolver as
+ // we have set the base type here explicitely
+ m_parserContext->resolver()->removeComplexBaseType(redefinedType);
+
+ // 4) add the redefined type to the schema
+ addType(redefinedType);
+
+ // 5) add the context type as anonymous type, so the resolver
+ // can resolve its attribute uses etc.
+ addAnonymousType(contextType);
+
+ // 6) remove the context type from the list
+ contextComplexTypes.removeAt(j);
+
+ break;
+ }
+ }
+
+ if (!found) {
+ error(QString::fromLatin1("no matching type found to redefine complex type %1").arg(formatType(m_namePool, redefinedType)));
+ return;
+ }
+ }
+
+ // iterate over all redefined element groups
+ for (int i = 0; i < redefinedGroups.count(); ++i) {
+ const XsdModelGroup::Ptr group(redefinedGroups.at(i));
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#src-redefine
+
+ // 6
+ const XsdParticle::List particles = collectGroupRef(group);
+ XsdParticle::Ptr referencedParticle;
+ int sameNameCounter = 0;
+ for (int i = 0; i < particles.count(); ++i) {
+ const XsdReference::Ptr ref(particles.at(i)->term());
+ if (ref->referenceName() == group->name(m_namePool)) {
+ referencedParticle = particles.at(i);
+
+ if (referencedParticle->minimumOccurs() != 1 || referencedParticle->maximumOccurs() != 1 || referencedParticle->maximumOccursUnbounded()) { // 6.1.2
+ error(QString::fromLatin1("redefined group %1 can not contain reference to itself with minOccurs or maxOccurs != 1").arg(formatKeyword(group->displayName(m_namePool))));
+ return;
+ }
+ sameNameCounter++;
+ }
+ }
+
+ // 6.1.1
+ if (sameNameCounter > 1) {
+ error(QString::fromLatin1("redefined group %1 can not contain multiple references to itself").arg(formatKeyword(group->displayName(m_namePool))));
+ return;
+ }
+
+ // search the group definition in the included schema (S2)
+ XsdModelGroup::Ptr contextGroup;
+ for (int j = 0; j < contextGroups.count(); ++j) {
+ if (group->name(m_namePool) == contextGroups.at(j)->name(m_namePool)) {
+ contextGroup = contextGroups.at(j);
+ break;
+ }
+ }
+
+ if (!contextGroup) { // 6.2.1
+ error(QString::fromLatin1("redefined group %1 has no occurrence in included schema").arg(formatKeyword(group->displayName(m_namePool))));
+ return;
+ }
+
+ if (sameNameCounter == 1) {
+ // there was a self reference in the redefined group, so use the
+ // group from the included schema
+
+ // set a anonymous name to the group of the included schema
+ contextGroup->setName(m_parserContext->createAnonymousName(m_namePool->stringForNamespace(contextGroup->name(m_namePool).namespaceURI())));
+
+ // replace the self-reference with the group from the included schema
+ referencedParticle->setTerm(contextGroup);
+
+ addElementGroup(group);
+
+ addElementGroup(contextGroup);
+ contextGroups.removeAll(contextGroup);
+ } else {
+ // there was no self reference in the redefined group
+
+ // just add the redefined group...
+ addElementGroup(group);
+
+ // we have to add them, otherwise it is not resolved and we can't validate it later
+ contextGroup->setName(m_parserContext->createAnonymousName(m_namePool->stringForNamespace(contextGroup->name(m_namePool).namespaceURI())));
+ addElementGroup(contextGroup);
+
+ m_schemaResolver->addRedefinedGroups(group, contextGroup);
+
+ // ...and forget about the group from the included schema
+ contextGroups.removeAll(contextGroup);
+ }
+ }
+
+ // iterate over all redefined attribute groups
+ for (int i = 0; i < redefinedAttributeGroups.count(); ++i) {
+ const XsdAttributeGroup::Ptr group(redefinedAttributeGroups.at(i));
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#src-redefine
+
+ // 7
+
+ // 7.1
+ int sameNameCounter = 0;
+ for (int j = 0; j < group->attributeUses().count(); ++j) {
+ const XsdAttributeUse::Ptr attributeUse(group->attributeUses().at(j));
+ if (attributeUse->isReference()) {
+ const XsdAttributeReference::Ptr reference(attributeUse);
+ if (reference->type() == XsdAttributeReference::AttributeGroup) {
+ if (group->name(m_namePool) == reference->referenceName())
+ sameNameCounter++;
+ }
+ }
+ }
+ if (sameNameCounter > 1) {
+ error(QString::fromLatin1("redefined attribute group %1 can not contain multiple references to itself").arg(formatKeyword(group->displayName(m_namePool))));
+ return;
+ }
+
+ // search the attribute group definition in the included schema (S2)
+ XsdAttributeGroup::Ptr baseGroup;
+ for (int j = 0; j < contextAttributeGroups.count(); ++j) {
+ const XsdAttributeGroup::Ptr contextGroup(contextAttributeGroups.at(j));
+ if (group->name(m_namePool) == contextGroup->name(m_namePool)) {
+ baseGroup = contextGroup;
+ break;
+ }
+ }
+
+ if (!baseGroup) { // 7.2.1
+ error(QString::fromLatin1("redefined attribute group %1 has no occurrence in included schema").arg(formatKeyword(group->displayName(m_namePool))));
+ return;
+ }
+
+ if (sameNameCounter == 1) {
+
+ // first set an anonymous name to the attribute group from the included
+ // schema
+ baseGroup->setName(m_parserContext->createAnonymousName(m_namePool->stringForNamespace(baseGroup->name(m_namePool).namespaceURI())));
+
+ // iterate over the attribute uses of the redefined attribute group
+ // and replace the self-reference with the attribute group from the
+ // included schema
+ for (int j = 0; j < group->attributeUses().count(); ++j) {
+ const XsdAttributeUse::Ptr attributeUse(group->attributeUses().at(j));
+ if (attributeUse->isReference()) {
+ const XsdAttributeReference::Ptr reference(attributeUse);
+ if (reference->type() == XsdAttributeReference::AttributeGroup) {
+ if (group->name(m_namePool) == reference->referenceName()) {
+ reference->setReferenceName(baseGroup->name(m_namePool));
+ break;
+ }
+ }
+ }
+ }
+
+ // add both groups to the target schema
+ addAttributeGroup(baseGroup);
+ addAttributeGroup(group);
+
+ contextAttributeGroups.removeAll(baseGroup);
+ }
+
+ if (sameNameCounter == 0) { // 7.2
+
+ // we have to add them, otherwise it is not resolved and we can't validate it later
+ baseGroup->setName(m_parserContext->createAnonymousName(m_namePool->stringForNamespace(baseGroup->name(m_namePool).namespaceURI())));
+ addAttributeGroup(baseGroup);
+
+ m_schemaResolver->addRedefinedAttributeGroups(group, baseGroup);
+
+ // just add the redefined attribute group to the target schema...
+ addAttributeGroup(group);
+
+ // ... and forget about the one from the included schema
+ contextAttributeGroups.removeAll(baseGroup);
+ }
+ }
+
+ // add all remaining context complex types to the schema
+ for (int i = 0; i < contextComplexTypes.count(); ++i) {
+ addType(contextComplexTypes.at(i));
+ }
+
+ // add all remaining context element groups to the schema
+ for (int i = 0; i < contextGroups.count(); ++i) {
+ addElementGroup(contextGroups.at(i));
+ }
+
+ // add all remaining context attribute groups to the schema
+ for (int i = 0; i < contextAttributeGroups.count(); ++i) {
+ addAttributeGroup(contextAttributeGroups.at(i));
+ }
+
+ // copy all elements, attributes and notations
+ const XsdElement::List contextElements = redefinedContext->schema()->elements();
+ for (int i = 0; i < contextElements.count(); ++i) {
+ addElement(contextElements.at(i));
+ }
+
+ const XsdAttribute::List contextAttributes = redefinedContext->schema()->attributes();
+ for (int i = 0; i < contextAttributes.count(); ++i) {
+ addAttribute(contextAttributes.at(i));
+ }
+
+ const XsdNotation::List contextNotations = redefinedContext->schema()->notations();
+ for (int i = 0; i < contextNotations.count(); ++i) {
+ addNotation(contextNotations.at(i));
+ }
+
+ // push all data to resolve from the context resolver to our resolver
+ redefinedContext->resolver()->copyDataTo(m_parserContext->resolver());
+
+ tagValidator.finalize();
+}
+
+XsdAnnotation::Ptr XsdSchemaParser::parseAnnotation()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Annotation, this);
+
+ validateElement(XsdTagScope::Annotation);
+
+ // parse attributes
+ validateIdAttribute("annotation");
+
+ TagValidationHandler tagValidator(XsdTagScope::Annotation, this, m_namePool);
+
+ const XsdAnnotation::Ptr annotation(new XsdAnnotation());
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Appinfo, token, namespaceToken)) {
+ const XsdApplicationInformation::Ptr info = parseAppInfo();
+ annotation->addApplicationInformation(info);
+ } else if (isSchemaTag(XsdSchemaToken::Documentation, token, namespaceToken)) {
+ const XsdDocumentation::Ptr documentation = parseDocumentation();
+ annotation->addDocumentation(documentation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return annotation;
+}
+
+XsdApplicationInformation::Ptr XsdSchemaParser::parseAppInfo()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Appinfo, this);
+
+ validateElement(XsdTagScope::AppInfo);
+
+ const XsdApplicationInformation::Ptr info(new XsdApplicationInformation());
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("source"))) {
+ const QString value = readAttribute(QString::fromLatin1("source"));
+
+ if (!isValidUri(value)) {
+ attributeContentError("source", "appinfo", value, BuiltinTypes::xsAnyURI);
+ return info;
+ }
+
+ if (!value.isEmpty()) {
+ const AnyURI::Ptr source = AnyURI::fromLexical(value);
+ info->setSource(source);
+ }
+ }
+
+ while (!atEnd()) { //EVAL: can be anything... what to do?
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement())
+ parseUnknownDocumentation();
+ }
+
+ return info;
+}
+
+XsdDocumentation::Ptr XsdSchemaParser::parseDocumentation()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Documentation, this);
+
+ validateElement(XsdTagScope::Documentation);
+
+ const XsdDocumentation::Ptr documentation(new XsdDocumentation());
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("source"))) {
+ const QString value = readAttribute(QString::fromLatin1("source"));
+
+ if (!isValidUri(value)) {
+ attributeContentError("source", "documentation", value, BuiltinTypes::xsAnyURI);
+ return documentation;
+ }
+
+ if (!value.isEmpty()) {
+ const AnyURI::Ptr source = AnyURI::fromLexical(value);
+ documentation->setSource(source);
+ }
+ }
+
+ if (hasAttribute(CommonNamespaces::XML, QString::fromLatin1("lang"))) {
+ const QString value = readAttribute(QString::fromLatin1("lang"), CommonNamespaces::XML);
+
+ const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"));
+ if (!exp.exactMatch(value)) {
+ attributeContentError("xml:lang", "documentation", value);
+ return documentation;
+ }
+ }
+
+ while (!atEnd()) { //EVAL: can by any... what to do?
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement())
+ parseUnknownDocumentation();
+ }
+
+ return documentation;
+}
+
+void XsdSchemaParser::parseDefaultOpenContent()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::DefaultOpenContent, this);
+
+ validateElement(XsdTagScope::DefaultOpenContent);
+
+ m_defaultOpenContent = XsdComplexType::OpenContent::Ptr(new XsdComplexType::OpenContent());
+
+ if (hasAttribute(QString::fromLatin1("appliesToEmpty"))) {
+ const QString value = readAttribute(QString::fromLatin1("appliesToEmpty"));
+ const Boolean::Ptr appliesToEmpty = Boolean::fromLexical(value);
+ if (appliesToEmpty->hasError()) {
+ attributeContentError("appliesToEmpty", "defaultOpenContent", value, BuiltinTypes::xsBoolean);
+ return;
+ }
+
+ m_defaultOpenContentAppliesToEmpty = appliesToEmpty->as<Boolean>()->value();
+ } else {
+ m_defaultOpenContentAppliesToEmpty = false;
+ }
+
+ if (hasAttribute(QString::fromLatin1("mode"))) {
+ const QString mode = readAttribute(QString::fromLatin1("mode"));
+
+ if (mode == QString::fromLatin1("interleave")) {
+ m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Interleave);
+ } else if (mode == QString::fromLatin1("suffix")) {
+ m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Suffix);
+ } else {
+ attributeContentError("mode", "defaultOpenContent", mode);
+ return;
+ }
+ } else {
+ m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Interleave);
+ }
+
+ validateIdAttribute("defaultOpenContent");
+
+ TagValidationHandler tagValidator(XsdTagScope::DefaultOpenContent, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ m_defaultOpenContent->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) {
+ const XsdParticle::Ptr particle;
+ const XsdWildcard::Ptr wildcard = parseAny(particle);
+ m_defaultOpenContent->setWildcard(wildcard);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+}
+
+XsdSimpleType::Ptr XsdSchemaParser::parseGlobalSimpleType()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::SimpleType, this);
+
+ validateElement(XsdTagScope::GlobalSimpleType);
+
+ const XsdSimpleType::Ptr simpleType(new XsdSimpleType());
+ simpleType->setCategory(XsdSimpleType::SimpleTypeAtomic); // just to make sure it's not invalid
+
+ // parse attributes
+ const SchemaType::DerivationConstraints allowedConstraints(SchemaType::ExtensionConstraint | SchemaType::RestrictionConstraint | SchemaType::ListConstraint | SchemaType::UnionConstraint);
+ simpleType->setDerivationConstraints(readDerivationConstraintAttribute(allowedConstraints, "simpleType"));
+
+ const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("simpleType"));
+ simpleType->setName(objectName);
+
+ validateIdAttribute("simpleType");
+
+ TagValidationHandler tagValidator(XsdTagScope::GlobalSimpleType, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ simpleType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Restriction, token, namespaceToken)) {
+ parseSimpleRestriction(simpleType);
+ } else if (isSchemaTag(XsdSchemaToken::List, token, namespaceToken)) {
+ parseList(simpleType);
+ } else if (isSchemaTag(XsdSchemaToken::Union, token, namespaceToken)) {
+ parseUnion(simpleType);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return simpleType;
+}
+
+XsdSimpleType::Ptr XsdSchemaParser::parseLocalSimpleType()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::SimpleType, this);
+
+ validateElement(XsdTagScope::LocalSimpleType);
+
+ const XsdSimpleType::Ptr simpleType(new XsdSimpleType());
+ simpleType->setCategory(XsdSimpleType::SimpleTypeAtomic); // just to make sure it's not invalid
+ simpleType->setName(m_parserContext->createAnonymousName(m_targetNamespace));
+
+ validateIdAttribute("simpleType");
+
+ TagValidationHandler tagValidator(XsdTagScope::LocalSimpleType, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ simpleType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Restriction, token, namespaceToken)) {
+ parseSimpleRestriction(simpleType);
+ } else if (isSchemaTag(XsdSchemaToken::List, token, namespaceToken)) {
+ parseList(simpleType);
+ } else if (isSchemaTag(XsdSchemaToken::Union, token, namespaceToken)) {
+ parseUnion(simpleType);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return simpleType;
+}
+
+void XsdSchemaParser::parseSimpleRestriction(const XsdSimpleType::Ptr &ptr)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Restriction, this);
+
+ validateElement(XsdTagScope::SimpleRestriction);
+
+ ptr->setDerivationMethod(XsdSimpleType::DerivationRestriction);
+
+ // The base attribute and simpleType member are mutually exclusive,
+ // so we keep track of that
+ bool hasBaseAttribute = false;
+ bool hasBaseTypeSpecified = false;
+
+ QXmlName baseName;
+ if (hasAttribute(QString::fromLatin1("base"))) {
+ const QString base = readQNameAttribute(QString::fromLatin1("base"), "restriction");
+ convertName(base, NamespaceSupport::ElementName, baseName); // translate qualified name into QXmlName
+ m_schemaResolver->addSimpleRestrictionBase(ptr, baseName, currentSourceLocation()); // add to resolver
+
+ hasBaseAttribute = true;
+ hasBaseTypeSpecified = true;
+ }
+ validateIdAttribute("restriction");
+
+ XsdFacet::Hash facets;
+ QList<XsdFacet::Ptr> patternFacets;
+ QList<XsdFacet::Ptr> enumerationFacets;
+ QList<XsdFacet::Ptr> assertionFacets;
+
+ TagValidationHandler tagValidator(XsdTagScope::SimpleRestriction, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ ptr->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ if (hasBaseAttribute) {
+ error(QtXmlPatterns::tr("%1 element is not allowed inside %2 element if %3 attribute is present")
+ .arg(formatElement("simpleType"))
+ .arg(formatElement("restriction"))
+ .arg(formatAttribute("base")));
+ return;
+ }
+
+ const XsdSimpleType::Ptr type = parseLocalSimpleType();
+ type->setContext(ptr);
+ ptr->setWxsSuperType(type);
+ ptr->setCategory(type->category());
+ hasBaseTypeSpecified = true;
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+ } else if (isSchemaTag(XsdSchemaToken::MinExclusive, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMinExclusiveFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::MinInclusive, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMinInclusiveFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::MaxExclusive, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMaxExclusiveFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::MaxInclusive, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMaxInclusiveFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::TotalDigits, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseTotalDigitsFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::FractionDigits, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseFractionDigitsFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::Length, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseLengthFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::MinLength, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMinLengthFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::MaxLength, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMaxLengthFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::Enumeration, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseEnumerationFacet();
+ enumerationFacets.append(facet);
+ } else if (isSchemaTag(XsdSchemaToken::WhiteSpace, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseWhiteSpaceFacet();
+ addFacet(facet, facets, ptr);
+ } else if (isSchemaTag(XsdSchemaToken::Pattern, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parsePatternFacet();
+ patternFacets.append(facet);
+ } else if (isSchemaTag(XsdSchemaToken::Assertion, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseAssertionFacet();
+ assertionFacets.append(facet);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ if (!hasBaseTypeSpecified) {
+ error(QtXmlPatterns::tr("%1 element has neither %2 attribute nor %3 child element")
+ .arg(formatElement("restriction"))
+ .arg(formatAttribute("base"))
+ .arg(formatElement("simpleType")));
+ return;
+ }
+
+ // merge all pattern facets into one multi value facet
+ if (!patternFacets.isEmpty()) {
+ const XsdFacet::Ptr patternFacet(new XsdFacet());
+ patternFacet->setType(XsdFacet::Pattern);
+
+ AtomicValue::List multiValue;
+ for (int i = 0; i < patternFacets.count(); ++i)
+ multiValue << patternFacets.at(i)->multiValue();
+
+ patternFacet->setMultiValue(multiValue);
+ addFacet(patternFacet, facets, ptr);
+ }
+
+ // merge all enumeration facets into one multi value facet
+ if (!enumerationFacets.isEmpty()) {
+ const XsdFacet::Ptr enumerationFacet(new XsdFacet());
+ enumerationFacet->setType(XsdFacet::Enumeration);
+
+ AtomicValue::List multiValue;
+ for (int i = 0; i < enumerationFacets.count(); ++i)
+ multiValue << enumerationFacets.at(i)->multiValue();
+
+ enumerationFacet->setMultiValue(multiValue);
+ addFacet(enumerationFacet, facets, ptr);
+ }
+
+ // merge all assertion facets into one facet
+ if (!assertionFacets.isEmpty()) {
+ const XsdFacet::Ptr assertionFacet(new XsdFacet());
+ assertionFacet->setType(XsdFacet::Assertion);
+
+ XsdAssertion::List assertions;
+ for (int i = 0; i < assertionFacets.count(); ++i)
+ assertions << assertionFacets.at(i)->assertions();
+
+ assertionFacet->setAssertions(assertions);
+ addFacet(assertionFacet, facets, ptr);
+ }
+
+ ptr->setFacets(facets);
+
+ tagValidator.finalize();
+}
+
+void XsdSchemaParser::parseList(const XsdSimpleType::Ptr &ptr)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::List, this);
+
+ validateElement(XsdTagScope::List);
+
+ ptr->setCategory(XsdSimpleType::SimpleTypeList);
+ ptr->setDerivationMethod(XsdSimpleType::DerivationList);
+ ptr->setWxsSuperType(BuiltinTypes::xsAnySimpleType);
+
+ // The itemType attribute and simpleType member are mutually exclusive,
+ // so we keep track of that
+ bool hasItemTypeAttribute = false;
+ bool hasItemTypeSpecified = false;
+
+ if (hasAttribute(QString::fromLatin1("itemType"))) {
+ const QString itemType = readQNameAttribute(QString::fromLatin1("itemType"), "list");
+ QXmlName typeName;
+ convertName(itemType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ m_schemaResolver->addSimpleListType(ptr, typeName, currentSourceLocation()); // add to resolver
+
+ hasItemTypeAttribute = true;
+ hasItemTypeSpecified = true;
+ }
+
+ validateIdAttribute("list");
+
+ TagValidationHandler tagValidator(XsdTagScope::List, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ ptr->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ if (hasItemTypeAttribute) {
+ error(QtXmlPatterns::tr("%1 element is not allowed inside %2 element if %3 attribute is present")
+ .arg(formatElement("simpleType"))
+ .arg(formatElement("list"))
+ .arg(formatAttribute("itemType")));
+ return;
+ }
+
+ const XsdSimpleType::Ptr type = parseLocalSimpleType();
+ type->setContext(ptr);
+ ptr->setItemType(type);
+
+ hasItemTypeSpecified = true;
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ if (!hasItemTypeSpecified) {
+ error(QtXmlPatterns::tr("%1 element has neither %2 attribute nor %3 child element")
+ .arg(formatElement("list"))
+ .arg(formatAttribute("itemType"))
+ .arg(formatElement("simpleType")));
+ return;
+ }
+
+ tagValidator.finalize();
+
+ // add the default white space facet that every simple type with list derivation has
+ const XsdFacet::Ptr defaultFacet(new XsdFacet());
+ defaultFacet->setType(XsdFacet::WhiteSpace);
+ defaultFacet->setFixed(true);
+ defaultFacet->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse)));
+ XsdFacet::Hash facets;
+ facets.insert(defaultFacet->type(), defaultFacet);
+ ptr->setFacets(facets);
+}
+
+void XsdSchemaParser::parseUnion(const XsdSimpleType::Ptr &ptr)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Union, this);
+
+ validateElement(XsdTagScope::Union);
+
+ ptr->setCategory(XsdSimpleType::SimpleTypeUnion);
+ ptr->setDerivationMethod(XsdSimpleType::DerivationUnion);
+ ptr->setWxsSuperType(BuiltinTypes::xsAnySimpleType);
+
+ // The memberTypes attribute is not allowed to be empty,
+ // so we keep track of that
+ bool hasMemberTypesAttribute = false;
+ bool hasMemberTypesSpecified = false;
+
+ if (hasAttribute(QString::fromLatin1("memberTypes"))) {
+ hasMemberTypesAttribute = true;
+
+ const QStringList memberTypes = readAttribute(QString::fromLatin1("memberTypes")).split(QLatin1Char(' '), QString::SkipEmptyParts);
+ QList<QXmlName> typeNames;
+
+ for (int i = 0; i < memberTypes.count(); ++i) {
+ QXmlName typeName;
+ convertName(memberTypes.at(i), NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ typeNames.append(typeName);
+ }
+
+ if (!typeNames.isEmpty()) {
+ m_schemaResolver->addSimpleUnionTypes(ptr, typeNames, currentSourceLocation()); // add to resolver
+ hasMemberTypesSpecified = true;
+ }
+ }
+
+ validateIdAttribute("union");
+
+ AnySimpleType::List memberTypes;
+
+ TagValidationHandler tagValidator(XsdTagScope::Union, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ ptr->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ const XsdSimpleType::Ptr type = parseLocalSimpleType();
+ type->setContext(ptr);
+ memberTypes.append(type);
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ if (!memberTypes.isEmpty()) {
+ ptr->setMemberTypes(memberTypes);
+ hasMemberTypesSpecified = true;
+ }
+
+ if (!hasMemberTypesSpecified) {
+ error(QtXmlPatterns::tr("%1 element has neither %2 attribute nor %3 child element")
+ .arg(formatElement("union"))
+ .arg(formatAttribute("memberTypes"))
+ .arg(formatElement("simpleType")));
+ return;
+ }
+
+ tagValidator.finalize();
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseMinExclusiveFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MinExclusive, this);
+
+ validateElement(XsdTagScope::MinExclusiveFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::MinimumExclusive);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "minExclusive", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ // as minExclusive can have a value of type anySimpleType, we just read
+ // the string here and store it for later intepretation
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedString<TypeString>::Ptr string = DerivedString<TypeString>::fromLexical(m_namePool, value);
+ if (string->hasError()) {
+ attributeContentError("value", "minExclusive", value, BuiltinTypes::xsAnySimpleType);
+ return facet;
+ } else {
+ facet->setValue(string);
+ }
+
+ validateIdAttribute("minExclusive");
+
+ TagValidationHandler tagValidator(XsdTagScope::MinExclusiveFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseMinInclusiveFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MinInclusive, this);
+
+ validateElement(XsdTagScope::MinInclusiveFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::MinimumInclusive);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "minInclusive", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ // as minInclusive can have a value of type anySimpleType, we just read
+ // the string here and store it for later intepretation
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedString<TypeString>::Ptr string = DerivedString<TypeString>::fromLexical(m_namePool, value);
+ if (string->hasError()) {
+ attributeContentError("value", "minInclusive", value, BuiltinTypes::xsAnySimpleType);
+ return facet;
+ } else {
+ facet->setValue(string);
+ }
+
+ validateIdAttribute("minInclusive");
+
+ TagValidationHandler tagValidator(XsdTagScope::MinInclusiveFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseMaxExclusiveFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MaxExclusive, this);
+
+ validateElement(XsdTagScope::MaxExclusiveFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::MaximumExclusive);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "maxExclusive", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ // as maxExclusive can have a value of type anySimpleType, we just read
+ // the string here and store it for later intepretation
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedString<TypeString>::Ptr string = DerivedString<TypeString>::fromLexical(m_namePool, value);
+ if (string->hasError()) {
+ attributeContentError("value", "maxExclusive", value, BuiltinTypes::xsAnySimpleType);
+ return facet;
+ } else {
+ facet->setValue(string);
+ }
+
+ validateIdAttribute("maxExclusive");
+
+ TagValidationHandler tagValidator(XsdTagScope::MaxExclusiveFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseMaxInclusiveFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MaxInclusive, this);
+
+ validateElement(XsdTagScope::MaxInclusiveFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::MaximumInclusive);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "maxInclusive", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ // as maxInclusive can have a value of type anySimpleType, we just read
+ // the string here and store it for later intepretation
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedString<TypeString>::Ptr string = DerivedString<TypeString>::fromLexical(m_namePool, value);
+ if (string->hasError()) {
+ attributeContentError("value", "maxInclusive", value, BuiltinTypes::xsAnySimpleType);
+ return facet;
+ } else {
+ facet->setValue(string);
+ }
+
+ validateIdAttribute("maxInclusive");
+
+ TagValidationHandler tagValidator(XsdTagScope::MaxInclusiveFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseTotalDigitsFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::TotalDigits, this);
+
+ validateElement(XsdTagScope::TotalDigitsFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::TotalDigits);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "totalDigits", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedInteger<TypePositiveInteger>::Ptr integer = DerivedInteger<TypePositiveInteger>::fromLexical(m_namePool, value);
+ if (integer->hasError()) {
+ attributeContentError("value", "totalDigits", value, BuiltinTypes::xsPositiveInteger);
+ return facet;
+ } else {
+ facet->setValue(integer);
+ }
+
+ validateIdAttribute("totalDigits");
+
+ TagValidationHandler tagValidator(XsdTagScope::TotalDigitsFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseFractionDigitsFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::FractionDigits, this);
+
+ validateElement(XsdTagScope::FractionDigitsFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::FractionDigits);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "fractionDigits", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedInteger<TypeNonNegativeInteger>::Ptr integer = DerivedInteger<TypeNonNegativeInteger>::fromLexical(m_namePool, value);
+ if (integer->hasError()) {
+ attributeContentError("value", "fractionDigits", value, BuiltinTypes::xsNonNegativeInteger);
+ return facet;
+ } else {
+ facet->setValue(integer);
+ }
+
+ validateIdAttribute("fractionDigits");
+
+ TagValidationHandler tagValidator(XsdTagScope::FractionDigitsFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseLengthFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Length, this);
+
+ validateElement(XsdTagScope::LengthFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::Length);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "length", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedInteger<TypeNonNegativeInteger>::Ptr integer = DerivedInteger<TypeNonNegativeInteger>::fromLexical(m_namePool, value);
+ if (integer->hasError()) {
+ attributeContentError("value", "length", value, BuiltinTypes::xsNonNegativeInteger);
+ return facet;
+ } else {
+ facet->setValue(integer);
+ }
+
+ validateIdAttribute("length");
+
+ TagValidationHandler tagValidator(XsdTagScope::LengthFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseMinLengthFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MinLength, this);
+
+ validateElement(XsdTagScope::MinLengthFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::MinimumLength);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "minLength", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedInteger<TypeNonNegativeInteger>::Ptr integer = DerivedInteger<TypeNonNegativeInteger>::fromLexical(m_namePool, value);
+ if (integer->hasError()) {
+ attributeContentError("value", "minLength", value, BuiltinTypes::xsNonNegativeInteger);
+ return facet;
+ } else {
+ facet->setValue(integer);
+ }
+
+ validateIdAttribute("minLength");
+
+ TagValidationHandler tagValidator(XsdTagScope::MinLengthFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseMaxLengthFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MaxLength, this);
+
+ validateElement(XsdTagScope::MaxLengthFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::MaximumLength);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "maxLength", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedInteger<TypeNonNegativeInteger>::Ptr integer = DerivedInteger<TypeNonNegativeInteger>::fromLexical(m_namePool, value);
+ if (integer->hasError()) {
+ attributeContentError("value", "maxLength", value, BuiltinTypes::xsNonNegativeInteger);
+ return facet;
+ } else {
+ facet->setValue(integer);
+ }
+
+ validateIdAttribute("maxLength");
+
+ TagValidationHandler tagValidator(XsdTagScope::MaxLengthFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseEnumerationFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Enumeration, this);
+
+ validateElement(XsdTagScope::EnumerationFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::Enumeration);
+
+ // parse attributes
+ facet->setFixed(false); // not defined in schema, but can't hurt
+
+ const QString value = readAttribute(QString::fromLatin1("value"));
+
+ // as enumeration can have a value of type anySimpleType, we just read
+ // the string here and store it for later intepretation
+ DerivedString<TypeString>::Ptr string = DerivedString<TypeString>::fromLexical(m_namePool, value);
+ if (string->hasError()) {
+ attributeContentError("value", "enumeration", value);
+ return facet;
+ } else {
+ AtomicValue::List multiValue;
+ multiValue << string;
+ facet->setMultiValue(multiValue);
+ }
+ m_schemaResolver->addEnumerationFacetValue(string, m_namespaceSupport);
+
+ validateIdAttribute("enumeration");
+
+ TagValidationHandler tagValidator(XsdTagScope::EnumerationFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseWhiteSpaceFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::WhiteSpace, this);
+
+ validateElement(XsdTagScope::WhiteSpaceFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::WhiteSpace);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ const Boolean::Ptr fixed = Boolean::fromLexical(value);
+ if (fixed->hasError()) {
+ attributeContentError("fixed", "whiteSpace", value, BuiltinTypes::xsBoolean);
+ return facet;
+ }
+
+ facet->setFixed(fixed->as<Boolean>()->value());
+ } else {
+ facet->setFixed(false); // the default value
+ }
+
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ if (value != XsdSchemaToken::toString(XsdSchemaToken::Collapse) &&
+ value != XsdSchemaToken::toString(XsdSchemaToken::Preserve) &&
+ value != XsdSchemaToken::toString(XsdSchemaToken::Replace)) {
+ attributeContentError("value", "whiteSpace", value);
+ return facet;
+ } else {
+ DerivedString<TypeString>::Ptr string = DerivedString<TypeString>::fromLexical(m_namePool, value);
+ if (string->hasError()) {
+ attributeContentError("value", "whiteSpace", value);
+ return facet;
+ } else {
+ facet->setValue(string);
+ }
+ }
+
+ validateIdAttribute("whiteSpace");
+
+ TagValidationHandler tagValidator(XsdTagScope::WhiteSpaceFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parsePatternFacet()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Pattern, this);
+
+ validateElement(XsdTagScope::PatternFacet);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::Pattern);
+
+ // parse attributes
+
+ // as pattern can have a value of type anySimpleType, we just read
+ // the string here and store it for later intepretation
+ const QString value = readAttribute(QString::fromLatin1("value"));
+ DerivedString<TypeString>::Ptr string = DerivedString<TypeString>::fromLexical(m_namePool, value);
+ if (string->hasError()) {
+ attributeContentError("value", "pattern", value);
+ return facet;
+ } else {
+ AtomicValue::List multiValue;
+ multiValue << string;
+ facet->setMultiValue(multiValue);
+ }
+
+ validateIdAttribute("pattern");
+
+ TagValidationHandler tagValidator(XsdTagScope::PatternFacet, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ facet->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return facet;
+}
+
+XsdFacet::Ptr XsdSchemaParser::parseAssertionFacet()
+{
+ // this is just a wrapper function around the parseAssertion() method
+
+ const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assertion, XsdTagScope::Assertion);
+
+ const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet());
+ facet->setType(XsdFacet::Assertion);
+ facet->setAssertions(XsdAssertion::List() << assertion);
+
+ return facet;
+}
+
+XsdComplexType::Ptr XsdSchemaParser::parseGlobalComplexType()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::ComplexType, this);
+
+ validateElement(XsdTagScope::GlobalComplexType);
+
+ bool hasTypeSpecified = false;
+ bool hasComplexContent = false;
+
+ const XsdComplexType::Ptr complexType(new XsdComplexType());
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("abstract"))) {
+ const QString abstract = readAttribute(QString::fromLatin1("abstract"));
+
+ const Boolean::Ptr value = Boolean::fromLexical(abstract);
+ if (value->hasError()) {
+ attributeContentError("abstract", "complexType", abstract, BuiltinTypes::xsBoolean);
+ return complexType;
+ }
+
+ complexType->setIsAbstract(value->as<Boolean>()->value());
+ } else {
+ complexType->setIsAbstract(false); // default value
+ }
+
+ complexType->setProhibitedSubstitutions(readBlockingConstraintAttribute(NamedSchemaComponent::ExtensionConstraint | NamedSchemaComponent::RestrictionConstraint, "complexType"));
+ complexType->setDerivationConstraints(readDerivationConstraintAttribute(SchemaType::ExtensionConstraint | SchemaType::RestrictionConstraint, "complexType"));
+
+ const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("complexType"));
+ complexType->setName(objectName);
+
+ bool effectiveMixed = false;
+ if (hasAttribute(QString::fromLatin1("mixed"))) {
+ const QString mixed = readAttribute(QString::fromLatin1("mixed"));
+
+ const Boolean::Ptr value = Boolean::fromLexical(mixed);
+ if (value->hasError()) {
+ attributeContentError("mixed", "complexType", mixed, BuiltinTypes::xsBoolean);
+ return complexType;
+ }
+
+ effectiveMixed = value->as<Boolean>()->value();
+ }
+
+ validateIdAttribute("complexType");
+
+ TagValidationHandler tagValidator(XsdTagScope::GlobalComplexType, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ complexType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleContent, token, namespaceToken)) {
+ if (effectiveMixed) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("complexType"))
+ .arg(formatElement("simpleContent"))
+ .arg(formatAttribute("mixed")));
+ return complexType;
+ }
+
+ parseSimpleContent(complexType);
+ hasTypeSpecified = true;
+ } else if (isSchemaTag(XsdSchemaToken::ComplexContent, token, namespaceToken)) {
+ bool mixed;
+ parseComplexContent(complexType, &mixed);
+ hasTypeSpecified = true;
+
+ effectiveMixed = (effectiveMixed || mixed);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::OpenContent, token, namespaceToken)) {
+ const XsdComplexType::OpenContent::Ptr openContent = parseOpenContent();
+ complexType->contentType()->setOpenContent(openContent);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseReferredGroup(particle);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalAll(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalChoice(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalSequence(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType);
+ complexType->addAttributeUse(attributeUse);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup();
+ complexType->addAttributeUse(attributeUse);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) {
+ const XsdWildcard::Ptr wildcard = parseAnyAttribute();
+ complexType->setAttributeWildcard(wildcard);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) {
+ const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert);
+ complexType->addAssertion(assertion);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ if (!hasTypeSpecified) {
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ }
+
+ if (hasComplexContent == true) {
+ resolveComplexContentType(complexType, effectiveMixed);
+ }
+
+ return complexType;
+}
+
+XsdComplexType::Ptr XsdSchemaParser::parseLocalComplexType()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::ComplexType, this);
+
+ validateElement(XsdTagScope::LocalComplexType);
+
+ bool hasTypeSpecified = false;
+ bool hasComplexContent = true;
+
+ const XsdComplexType::Ptr complexType(new XsdComplexType());
+ complexType->setName(m_parserContext->createAnonymousName(m_targetNamespace));
+
+ // parse attributes
+ bool effectiveMixed = false;
+ if (hasAttribute(QString::fromLatin1("mixed"))) {
+ const QString mixed = readAttribute(QString::fromLatin1("mixed"));
+
+ const Boolean::Ptr value = Boolean::fromLexical(mixed);
+ if (value->hasError()) {
+ attributeContentError("mixed", "complexType", mixed, BuiltinTypes::xsBoolean);
+ return complexType;
+ }
+
+ effectiveMixed = value->as<Boolean>()->value();
+ }
+
+ validateIdAttribute("complexType");
+
+ TagValidationHandler tagValidator(XsdTagScope::LocalComplexType, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ complexType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleContent, token, namespaceToken)) {
+ parseSimpleContent(complexType);
+ hasTypeSpecified = true;
+ } else if (isSchemaTag(XsdSchemaToken::ComplexContent, token, namespaceToken)) {
+ bool mixed;
+ parseComplexContent(complexType, &mixed);
+ hasTypeSpecified = true;
+
+ effectiveMixed = (effectiveMixed || mixed);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::OpenContent, token, namespaceToken)) {
+ const XsdComplexType::OpenContent::Ptr openContent = parseOpenContent();
+ complexType->contentType()->setOpenContent(openContent);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseReferredGroup(particle);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalAll(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalChoice(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalSequence(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType);
+ complexType->addAttributeUse(attributeUse);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup();
+ complexType->addAttributeUse(attributeUse);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) {
+ const XsdWildcard::Ptr wildcard = parseAnyAttribute();
+ complexType->setAttributeWildcard(wildcard);
+
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) {
+ const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert);
+ complexType->addAssertion(assertion);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ if (!hasTypeSpecified) {
+ complexType->setWxsSuperType(BuiltinTypes::xsAnyType);
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+ hasComplexContent = true;
+ }
+
+ if (hasComplexContent == true) {
+ resolveComplexContentType(complexType, effectiveMixed);
+ }
+
+ return complexType;
+}
+
+void XsdSchemaParser::resolveComplexContentType(const XsdComplexType::Ptr &complexType, bool effectiveMixed)
+{
+ // @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.ctcc.common
+
+ // 1
+ // the effectiveMixed contains the effective mixed value
+
+ // 2
+ bool hasEmptyContent = false;
+ if (!complexType->contentType()->particle()) {
+ hasEmptyContent = true; // 2.1.1
+ } else {
+ if (complexType->contentType()->particle()->term()->isModelGroup()) {
+ const XsdModelGroup::Ptr group = complexType->contentType()->particle()->term();
+ if (group->compositor() == XsdModelGroup::SequenceCompositor || group->compositor() == XsdModelGroup::AllCompositor) {
+ if (group->particles().isEmpty())
+ hasEmptyContent = true; // 2.1.2
+ } else if (group->compositor() == XsdModelGroup::ChoiceCompositor) {
+ if ((complexType->contentType()->particle()->minimumOccurs() == 0) && group->particles().isEmpty())
+ hasEmptyContent = true; // 2.1.3
+ }
+
+ if ((complexType->contentType()->particle()->maximumOccursUnbounded() == false) && (complexType->contentType()->particle()->maximumOccurs() == 0))
+ hasEmptyContent = true; // 2.1.4
+ }
+ }
+
+ const XsdParticle::Ptr explicitContent = (hasEmptyContent ? XsdParticle::Ptr() : complexType->contentType()->particle());
+
+ // do all the other work (3, 4, 5 and 6) in the resolver, as they need access to the base type object
+ m_schemaResolver->addComplexContentType(complexType, explicitContent, effectiveMixed);
+}
+
+void XsdSchemaParser::parseSimpleContent(const XsdComplexType::Ptr &complexType)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::SimpleContent, this);
+
+ validateElement(XsdTagScope::SimpleContent);
+
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::Simple);
+
+ // parse attributes
+ validateIdAttribute("simpleContent");
+
+ TagValidationHandler tagValidator(XsdTagScope::SimpleContent, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ complexType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Restriction, token, namespaceToken)) {
+ parseSimpleContentRestriction(complexType);
+ } else if (isSchemaTag(XsdSchemaToken::Extension, token, namespaceToken)) {
+ parseSimpleContentExtension(complexType);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+}
+
+void XsdSchemaParser::parseSimpleContentRestriction(const XsdComplexType::Ptr &complexType)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Restriction, this);
+
+ validateElement(XsdTagScope::SimpleContentRestriction);
+
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+
+ // parse attributes
+ const QString baseType = readQNameAttribute(QString::fromLatin1("base"), "restriction");
+ QXmlName typeName;
+ convertName(baseType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+
+ validateIdAttribute("restriction");
+
+ XsdFacet::Hash facets;
+ QList<XsdFacet::Ptr> patternFacets;
+ QList<XsdFacet::Ptr> enumerationFacets;
+ QList<XsdFacet::Ptr> assertionFacets;
+
+ TagValidationHandler tagValidator(XsdTagScope::SimpleContentRestriction, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ complexType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ const XsdSimpleType::Ptr type = parseLocalSimpleType();
+ type->setContext(complexType); //TODO: investigate what the schema spec really wants here?!?
+ complexType->contentType()->setSimpleType(type);
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+ } else if (isSchemaTag(XsdSchemaToken::MinExclusive, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMinExclusiveFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::MinInclusive, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMinInclusiveFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::MaxExclusive, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMaxExclusiveFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::MaxInclusive, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMaxInclusiveFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::TotalDigits, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseTotalDigitsFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::FractionDigits, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseFractionDigitsFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::Length, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseLengthFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::MinLength, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMinLengthFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::MaxLength, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseMaxLengthFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::Enumeration, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseEnumerationFacet();
+ enumerationFacets.append(facet);
+ } else if (isSchemaTag(XsdSchemaToken::WhiteSpace, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseWhiteSpaceFacet();
+ addFacet(facet, facets, complexType);
+ } else if (isSchemaTag(XsdSchemaToken::Pattern, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parsePatternFacet();
+ patternFacets.append(facet);
+ } else if (isSchemaTag(XsdSchemaToken::Assertion, token, namespaceToken)) {
+ const XsdFacet::Ptr facet = parseAssertionFacet();
+ assertionFacets.append(facet);
+ } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType);
+ complexType->addAttributeUse(attributeUse);
+ } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup();
+ complexType->addAttributeUse(attributeUse);
+ } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) {
+ const XsdWildcard::Ptr wildcard = parseAnyAttribute();
+ complexType->setAttributeWildcard(wildcard);
+ } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) {
+ const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert);
+ complexType->addAssertion(assertion);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ // merge all pattern facets into one multi value facet
+ if (!patternFacets.isEmpty()) {
+ const XsdFacet::Ptr patternFacet(new XsdFacet());
+ patternFacet->setType(XsdFacet::Pattern);
+
+ AtomicValue::List multiValue;
+ for (int i = 0; i < patternFacets.count(); ++i)
+ multiValue << patternFacets.at(i)->multiValue();
+
+ patternFacet->setMultiValue(multiValue);
+ addFacet(patternFacet, facets, complexType);
+ }
+
+ // merge all enumeration facets into one multi value facet
+ if (!enumerationFacets.isEmpty()) {
+ const XsdFacet::Ptr enumerationFacet(new XsdFacet());
+ enumerationFacet->setType(XsdFacet::Enumeration);
+
+ AtomicValue::List multiValue;
+ for (int i = 0; i < enumerationFacets.count(); ++i)
+ multiValue << enumerationFacets.at(i)->multiValue();
+
+ enumerationFacet->setMultiValue(multiValue);
+ addFacet(enumerationFacet, facets, complexType);
+ }
+
+ // merge all assertion facets into one facet
+ if (!assertionFacets.isEmpty()) {
+ const XsdFacet::Ptr assertionFacet(new XsdFacet());
+ assertionFacet->setType(XsdFacet::Assertion);
+
+ XsdAssertion::List assertions;
+ for (int i = 0; i < assertionFacets.count(); ++i)
+ assertions << assertionFacets.at(i)->assertions();
+
+ assertionFacet->setAssertions(assertions);
+ addFacet(assertionFacet, facets, complexType);
+ }
+
+ m_schemaResolver->addComplexBaseType(complexType, typeName, currentSourceLocation(), facets); // add to resolver
+}
+
+void XsdSchemaParser::parseSimpleContentExtension(const XsdComplexType::Ptr &complexType)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Extension, this);
+
+ validateElement(XsdTagScope::SimpleContentExtension);
+
+ complexType->setDerivationMethod(XsdComplexType::DerivationExtension);
+
+ // parse attributes
+ const QString baseType = readQNameAttribute(QString::fromLatin1("base"), "extension");
+ QXmlName typeName;
+ convertName(baseType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ m_schemaResolver->addComplexBaseType(complexType, typeName, currentSourceLocation()); // add to resolver
+
+ validateIdAttribute("extension");
+
+ TagValidationHandler tagValidator(XsdTagScope::SimpleContentExtension, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ complexType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType);
+ complexType->addAttributeUse(attributeUse);
+ } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup();
+ complexType->addAttributeUse(attributeUse);
+ } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) {
+ const XsdWildcard::Ptr wildcard = parseAnyAttribute();
+ complexType->setAttributeWildcard(wildcard);
+ } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) {
+ const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert);
+ complexType->addAssertion(assertion);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+}
+
+void XsdSchemaParser::parseComplexContent(const XsdComplexType::Ptr &complexType, bool *mixed)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::ComplexContent, this);
+
+ validateElement(XsdTagScope::ComplexContent);
+
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly);
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("mixed"))) {
+ const QString mixedStr = readAttribute(QString::fromLatin1("mixed"));
+
+ const Boolean::Ptr value = Boolean::fromLexical(mixedStr);
+ if (value->hasError()) {
+ attributeContentError("mixed", "complexType", mixedStr, BuiltinTypes::xsBoolean);
+ return;
+ }
+
+ *mixed = value->as<Boolean>()->value();
+ } else {
+ *mixed = false;
+ }
+
+ validateIdAttribute("complexContent");
+
+ TagValidationHandler tagValidator(XsdTagScope::ComplexContent, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ complexType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Restriction, token, namespaceToken)) {
+ parseComplexContentRestriction(complexType);
+ } else if (isSchemaTag(XsdSchemaToken::Extension, token, namespaceToken)) {
+ parseComplexContentExtension(complexType);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+}
+
+void XsdSchemaParser::parseComplexContentRestriction(const XsdComplexType::Ptr &complexType)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Restriction, this);
+
+ validateElement(XsdTagScope::ComplexContentRestriction);
+
+ complexType->setDerivationMethod(XsdComplexType::DerivationRestriction);
+
+ // parse attributes
+ const QString baseType = readQNameAttribute(QString::fromLatin1("base"), "restriction");
+ QXmlName typeName;
+ convertName(baseType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ m_schemaResolver->addComplexBaseType(complexType, typeName, currentSourceLocation()); // add to resolver
+
+ validateIdAttribute("restriction");
+
+ TagValidationHandler tagValidator(XsdTagScope::ComplexContentRestriction, this, m_namePool);
+
+ bool hasContent = false;
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ complexType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::OpenContent, token, namespaceToken)) {
+ const XsdComplexType::OpenContent::Ptr openContent = parseOpenContent();
+ complexType->contentType()->setOpenContent(openContent);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseReferredGroup(particle);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalAll(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalChoice(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalSequence(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType);
+ complexType->addAttributeUse(attributeUse);
+ } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup();
+ complexType->addAttributeUse(attributeUse);
+ } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) {
+ const XsdWildcard::Ptr wildcard = parseAnyAttribute();
+ complexType->setAttributeWildcard(wildcard);
+ } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) {
+ const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert);
+ complexType->addAssertion(assertion);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ if (!hasContent)
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::Empty);
+
+ tagValidator.finalize();
+}
+
+void XsdSchemaParser::parseComplexContentExtension(const XsdComplexType::Ptr &complexType)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Extension, this);
+
+ validateElement(XsdTagScope::ComplexContentExtension);
+
+ complexType->setDerivationMethod(XsdComplexType::DerivationExtension);
+
+ // parse attributes
+ const QString baseType = readQNameAttribute(QString::fromLatin1("base"), "extension");
+ QXmlName typeName;
+ convertName(baseType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ m_schemaResolver->addComplexBaseType(complexType, typeName, currentSourceLocation()); // add to resolver
+
+ validateIdAttribute("extension");
+
+ TagValidationHandler tagValidator(XsdTagScope::ComplexContentExtension, this, m_namePool);
+
+ bool hasContent = false;
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ complexType->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::OpenContent, token, namespaceToken)) {
+ const XsdComplexType::OpenContent::Ptr openContent = parseOpenContent();
+ complexType->contentType()->setOpenContent(openContent);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseReferredGroup(particle);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalAll(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalChoice(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalSequence(particle, complexType);
+ particle->setTerm(term);
+ complexType->contentType()->setParticle(particle);
+ hasContent = true;
+ } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType);
+ complexType->addAttributeUse(attributeUse);
+ } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup();
+ complexType->addAttributeUse(attributeUse);
+ } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) {
+ const XsdWildcard::Ptr wildcard = parseAnyAttribute();
+ complexType->setAttributeWildcard(wildcard);
+ } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) {
+ const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert);
+ complexType->addAssertion(assertion);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ if (!hasContent)
+ complexType->contentType()->setVariety(XsdComplexType::ContentType::Empty);
+
+ tagValidator.finalize();
+}
+
+
+XsdAssertion::Ptr XsdSchemaParser::parseAssertion(const XsdSchemaToken::NodeName &nodeName, const XsdTagScope::Type &tag)
+{
+ const ElementNamespaceHandler namespaceHandler(nodeName, this);
+
+ validateElement(tag);
+
+ const XsdAssertion::Ptr assertion(new XsdAssertion());
+
+ // parse attributes
+
+ const XsdXPathExpression::Ptr expression = readXPathExpression("assertion");
+ assertion->setTest(expression);
+
+ const QString test = readXPathAttribute(QString::fromLatin1("test"), XPath20, "assertion");
+ expression->setExpression(test);
+
+ validateIdAttribute("assertion");
+
+ TagValidationHandler tagValidator(tag, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ assertion->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return assertion;
+}
+
+XsdComplexType::OpenContent::Ptr XsdSchemaParser::parseOpenContent()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::OpenContent, this);
+
+ validateElement(XsdTagScope::OpenContent);
+
+ const XsdComplexType::OpenContent::Ptr openContent(new XsdComplexType::OpenContent());
+
+ if (hasAttribute(QString::fromLatin1("mode"))) {
+ const QString mode = readAttribute(QString::fromLatin1("mode"));
+
+ if (mode == QString::fromLatin1("none")) {
+ m_defaultOpenContent->setMode(XsdComplexType::OpenContent::None);
+ } else if (mode == QString::fromLatin1("interleave")) {
+ m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Interleave);
+ } else if (mode == QString::fromLatin1("suffix")) {
+ m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Suffix);
+ } else {
+ attributeContentError("mode", "openContent", mode);
+ return openContent;
+ }
+ } else {
+ openContent->setMode(XsdComplexType::OpenContent::Interleave);
+ }
+
+ validateIdAttribute("openContent");
+
+ TagValidationHandler tagValidator(XsdTagScope::OpenContent, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ openContent->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) {
+ const XsdParticle::Ptr particle;
+ const XsdWildcard::Ptr wildcard = parseAny(particle);
+ openContent->setWildcard(wildcard);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return openContent;
+}
+
+XsdModelGroup::Ptr XsdSchemaParser::parseNamedGroup()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Group, this);
+
+ validateElement(XsdTagScope::NamedGroup);
+
+ const XsdModelGroup::Ptr modelGroup(new XsdModelGroup());
+ XsdModelGroup::Ptr group;
+
+ QXmlName objectName;
+ if (hasAttribute(QString::fromLatin1("name"))) {
+ objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("group"));
+ }
+
+ validateIdAttribute("group");
+
+ TagValidationHandler tagValidator(XsdTagScope::NamedGroup, this, m_namePool);
+
+ XsdAnnotation::Ptr annotation;
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ annotation = parseAnnotation();
+ } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) {
+ group = parseAll(modelGroup);
+ } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) {
+ group = parseChoice(modelGroup);
+ } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) {
+ group = parseSequence(modelGroup);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ group->setName(objectName);
+
+ if (annotation)
+ group->addAnnotation(annotation);
+
+ return group;
+}
+
+XsdTerm::Ptr XsdSchemaParser::parseReferredGroup(const XsdParticle::Ptr &particle)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Group, this);
+
+ validateElement(XsdTagScope::ReferredGroup);
+
+ const XsdReference::Ptr reference(new XsdReference());
+ reference->setType(XsdReference::ModelGroup);
+ reference->setSourceLocation(currentSourceLocation());
+
+ // parse attributes
+ if (!parseMinMaxConstraint(particle, "group")) {
+ return reference;
+ }
+
+ const QString value = readQNameAttribute(QString::fromLatin1("ref"), "group");
+ QXmlName referenceName;
+ convertName(value, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName
+ reference->setReferenceName(referenceName);
+
+ validateIdAttribute("group");
+
+ TagValidationHandler tagValidator(XsdTagScope::ReferredGroup, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ reference->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return reference;
+}
+
+XsdModelGroup::Ptr XsdSchemaParser::parseAll(const NamedSchemaComponent::Ptr &parent)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::All, this);
+
+ validateElement(XsdTagScope::All);
+
+ const XsdModelGroup::Ptr modelGroup(new XsdModelGroup());
+ modelGroup->setCompositor(XsdModelGroup::AllCompositor);
+
+ validateIdAttribute("all");
+
+ TagValidationHandler tagValidator(XsdTagScope::All, this, m_namePool);
+
+ XsdParticle::List particles;
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ modelGroup->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalElement(particle, parent);
+ particle->setTerm(term);
+
+ if (particle->maximumOccursUnbounded() || particle->maximumOccurs() > 1) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must be %3 or %4")
+ .arg(formatAttribute("maxOccurs"))
+ .arg(formatElement("all"))
+ .arg(formatData("0"))
+ .arg(formatData("1")));
+ return modelGroup;
+ }
+
+ particles.append(particle);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ modelGroup->setParticles(particles);
+
+ tagValidator.finalize();
+
+ return modelGroup;
+}
+
+XsdModelGroup::Ptr XsdSchemaParser::parseLocalAll(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::All, this);
+
+ validateElement(XsdTagScope::LocalAll);
+
+ const XsdModelGroup::Ptr modelGroup(new XsdModelGroup());
+ modelGroup->setCompositor(XsdModelGroup::AllCompositor);
+
+ // parse attributes
+ if (!parseMinMaxConstraint(particle, "all")) {
+ return modelGroup;
+ }
+ if (particle->maximumOccursUnbounded() || particle->maximumOccurs() != 1) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must have a value of %3")
+ .arg(formatAttribute("maxOccurs"))
+ .arg(formatElement("all"))
+ .arg(formatData("1")));
+ return modelGroup;
+ }
+ if (particle->minimumOccurs() != 0 && particle->minimumOccurs() != 1) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must have a value of %3 or %4")
+ .arg(formatAttribute("minOccurs"))
+ .arg(formatElement("all"))
+ .arg(formatData("0"))
+ .arg(formatData("1")));
+ return modelGroup;
+ }
+
+ validateIdAttribute("all");
+
+ TagValidationHandler tagValidator(XsdTagScope::LocalAll, this, m_namePool);
+
+ XsdParticle::List particles;
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ modelGroup->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalElement(particle, parent);
+ particle->setTerm(term);
+
+ if (particle->maximumOccursUnbounded() || particle->maximumOccurs() > 1) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must have a value of %3 or %4")
+ .arg(formatAttribute("maxOccurs"))
+ .arg(formatElement("all"))
+ .arg(formatData("0"))
+ .arg(formatData("1")));
+ return modelGroup;
+ }
+
+ particles.append(particle);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ modelGroup->setParticles(particles);
+
+ tagValidator.finalize();
+
+ return modelGroup;
+}
+
+XsdModelGroup::Ptr XsdSchemaParser::parseChoice(const NamedSchemaComponent::Ptr &parent)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Choice, this);
+
+ validateElement(XsdTagScope::Choice);
+
+ const XsdModelGroup::Ptr modelGroup(new XsdModelGroup());
+ modelGroup->setCompositor(XsdModelGroup::ChoiceCompositor);
+
+ validateIdAttribute("choice");
+
+ XsdParticle::List particles;
+
+ TagValidationHandler tagValidator(XsdTagScope::Choice, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ modelGroup->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalElement(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseReferredGroup(particle);
+ m_schemaResolver->addAllGroupCheck(term);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalChoice(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalSequence(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseAny(particle);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ modelGroup->setParticles(particles);
+
+ tagValidator.finalize();
+
+ return modelGroup;
+}
+
+XsdModelGroup::Ptr XsdSchemaParser::parseLocalChoice(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Choice, this);
+
+ validateElement(XsdTagScope::LocalChoice);
+
+ const XsdModelGroup::Ptr modelGroup(new XsdModelGroup());
+ modelGroup->setCompositor(XsdModelGroup::ChoiceCompositor);
+
+ // parse attributes
+ if (!parseMinMaxConstraint(particle, "choice")) {
+ return modelGroup;
+ }
+
+ validateIdAttribute("choice");
+
+ XsdParticle::List particles;
+
+ TagValidationHandler tagValidator(XsdTagScope::LocalChoice, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ modelGroup->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalElement(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseReferredGroup(particle);
+ m_schemaResolver->addAllGroupCheck(term);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalChoice(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalSequence(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseAny(particle);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ modelGroup->setParticles(particles);
+
+ tagValidator.finalize();
+
+ return modelGroup;
+}
+
+XsdModelGroup::Ptr XsdSchemaParser::parseSequence(const NamedSchemaComponent::Ptr &parent)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Sequence, this);
+
+ validateElement(XsdTagScope::Sequence);
+
+ const XsdModelGroup::Ptr modelGroup(new XsdModelGroup());
+ modelGroup->setCompositor(XsdModelGroup::SequenceCompositor);
+
+ validateIdAttribute("sequence");
+
+ XsdParticle::List particles;
+
+ TagValidationHandler tagValidator(XsdTagScope::Sequence, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ modelGroup->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalElement(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseReferredGroup(particle);
+ m_schemaResolver->addAllGroupCheck(term);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalChoice(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalSequence(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseAny(particle);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ modelGroup->setParticles(particles);
+
+ tagValidator.finalize();
+
+ return modelGroup;
+}
+
+XsdModelGroup::Ptr XsdSchemaParser::parseLocalSequence(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Sequence, this);
+
+ validateElement(XsdTagScope::LocalSequence);
+
+ const XsdModelGroup::Ptr modelGroup(new XsdModelGroup());
+ modelGroup->setCompositor(XsdModelGroup::SequenceCompositor);
+
+ // parse attributes
+ if (!parseMinMaxConstraint(particle, "sequence")) {
+ return modelGroup;
+ }
+
+ validateIdAttribute("sequence");
+
+ XsdParticle::List particles;
+
+ TagValidationHandler tagValidator(XsdTagScope::LocalSequence, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ modelGroup->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalElement(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseReferredGroup(particle);
+ m_schemaResolver->addAllGroupCheck(term);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalChoice(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseLocalSequence(particle, parent);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ const XsdTerm::Ptr term = parseAny(particle);
+ particle->setTerm(term);
+ particles.append(particle);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ modelGroup->setParticles(particles);
+
+ tagValidator.finalize();
+
+ return modelGroup;
+}
+
+XsdAttribute::Ptr XsdSchemaParser::parseGlobalAttribute()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Attribute, this);
+
+ validateElement(XsdTagScope::GlobalAttribute);
+
+ const XsdAttribute::Ptr attribute(new XsdAttribute());
+ attribute->setScope(XsdAttribute::Scope::Ptr(new XsdAttribute::Scope()));
+ attribute->scope()->setVariety(XsdAttribute::Scope::Global);
+
+ if (hasAttribute(QString::fromLatin1("default")) && hasAttribute(QString::fromLatin1("fixed"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("attribute"))
+ .arg(formatAttribute("default"))
+ .arg(formatAttribute("fixed")));
+ return attribute;
+ }
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("default"))) {
+ const QString value = readAttribute(QString::fromLatin1("default"));
+ attribute->setValueConstraint(XsdAttribute::ValueConstraint::Ptr(new XsdAttribute::ValueConstraint()));
+ attribute->valueConstraint()->setVariety(XsdAttribute::ValueConstraint::Default);
+ attribute->valueConstraint()->setValue(value);
+ } else if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ attribute->setValueConstraint(XsdAttribute::ValueConstraint::Ptr(new XsdAttribute::ValueConstraint()));
+ attribute->valueConstraint()->setVariety(XsdAttribute::ValueConstraint::Fixed);
+ attribute->valueConstraint()->setValue(value);
+ }
+
+ const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("attribute"));
+ if ((objectName.namespaceURI() == StandardNamespaces::xsi) &&
+ (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("type")) &&
+ (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("nil")) &&
+ (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("schemaLocation")) &&
+ (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("noNamespaceSchemaLocation"))) {
+
+ error(QtXmlPatterns::tr("content of %1 attribute of %2 element must not be from namespace %3")
+ .arg(formatAttribute("name"))
+ .arg(formatElement("attribute"))
+ .arg(formatURI(CommonNamespaces::XSI)));
+ return attribute;
+ }
+ if (m_namePool->stringForLocalName(objectName.localName()) == QString::fromLatin1("xmlns")) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must not be %3")
+ .arg(formatAttribute("name"))
+ .arg(formatElement("attribute"))
+ .arg(formatData("xmlns")));
+ return attribute;
+ }
+ attribute->setName(objectName);
+
+ bool hasTypeAttribute = false;
+ bool hasTypeSpecified = false;
+
+ if (hasAttribute(QString::fromLatin1("type"))) {
+ hasTypeAttribute = true;
+
+ const QString type = readQNameAttribute(QString::fromLatin1("type"), "attribute");
+ QXmlName typeName;
+ convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ m_schemaResolver->addAttributeType(attribute, typeName, currentSourceLocation()); // add to resolver
+ hasTypeSpecified = true;
+ }
+
+ validateIdAttribute("attribute");
+
+ TagValidationHandler tagValidator(XsdTagScope::GlobalAttribute, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ attribute->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ if (hasTypeAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("attribute"))
+ .arg(formatElement("simpleType"))
+ .arg(formatAttribute("type")));
+ break;
+ }
+
+ const XsdSimpleType::Ptr type = parseLocalSimpleType();
+ type->setContext(attribute);
+ attribute->setType(type);
+ hasTypeSpecified = true;
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ if (!hasTypeSpecified) {
+ attribute->setType(BuiltinTypes::xsAnySimpleType); // default value
+ return attribute;
+ }
+
+ tagValidator.finalize();
+
+ return attribute;
+}
+
+XsdAttributeUse::Ptr XsdSchemaParser::parseLocalAttribute(const NamedSchemaComponent::Ptr &parent)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Attribute, this);
+
+ validateElement(XsdTagScope::LocalAttribute);
+
+ bool hasRefAttribute = false;
+ bool hasTypeAttribute = false;
+ bool hasTypeSpecified = false;
+
+ XsdAttributeUse::Ptr attributeUse;
+ if (hasAttribute(QString::fromLatin1("ref"))) {
+ const XsdAttributeReference::Ptr reference = XsdAttributeReference::Ptr(new XsdAttributeReference());
+ reference->setType(XsdAttributeReference::AttributeUse);
+ reference->setSourceLocation(currentSourceLocation());
+
+ attributeUse = reference;
+ hasRefAttribute = true;
+ } else {
+ attributeUse = XsdAttributeUse::Ptr(new XsdAttributeUse());
+ }
+
+ if (hasAttribute(QString::fromLatin1("default")) && hasAttribute(QString::fromLatin1("fixed"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("attribute"))
+ .arg(formatAttribute("default"))
+ .arg(formatAttribute("fixed")));
+ return attributeUse;
+ }
+
+ if (hasRefAttribute) {
+ if (hasAttribute(QString::fromLatin1("form"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("attribute"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("form")));
+ return attributeUse;
+ }
+ if (hasAttribute(QString::fromLatin1("name"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("attribute"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("name")));
+ return attributeUse;
+ }
+ if (hasAttribute(QString::fromLatin1("type"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("attribute"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("type")));
+ return attributeUse;
+ }
+ }
+
+ // parse attributes
+
+ // default, fixed and use are handled by both, attribute use and attribute reference
+ if (hasAttribute(QString::fromLatin1("default"))) {
+ const QString value = readAttribute(QString::fromLatin1("default"));
+ attributeUse->setValueConstraint(XsdAttributeUse::ValueConstraint::Ptr(new XsdAttributeUse::ValueConstraint()));
+ attributeUse->valueConstraint()->setVariety(XsdAttributeUse::ValueConstraint::Default);
+ attributeUse->valueConstraint()->setValue(value);
+ } else if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ attributeUse->setValueConstraint(XsdAttributeUse::ValueConstraint::Ptr(new XsdAttributeUse::ValueConstraint()));
+ attributeUse->valueConstraint()->setVariety(XsdAttributeUse::ValueConstraint::Fixed);
+ attributeUse->valueConstraint()->setValue(value);
+ }
+
+ if (hasAttribute(QString::fromLatin1("use"))) {
+ const QString value = readAttribute(QString::fromLatin1("use"));
+ if (value != QString::fromLatin1("optional") &&
+ value != QString::fromLatin1("prohibited") &&
+ value != QString::fromLatin1("required")) {
+ attributeContentError("use", "attribute", value);
+ return attributeUse;
+ }
+
+ if (value == QString::fromLatin1("optional"))
+ attributeUse->setUseType(XsdAttributeUse::OptionalUse);
+ else if (value == QString::fromLatin1("prohibited"))
+ attributeUse->setUseType(XsdAttributeUse::ProhibitedUse);
+ else if (value == QString::fromLatin1("required"))
+ attributeUse->setUseType(XsdAttributeUse::RequiredUse);
+
+ if (attributeUse->valueConstraint() && attributeUse->valueConstraint()->variety() == XsdAttributeUse::ValueConstraint::Default && value != QString::fromLatin1("optional")) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must have the value %3 because the %4 attribute is set")
+ .arg(formatAttribute("use"))
+ .arg(formatElement("attribute"))
+ .arg(formatData("optional"))
+ .arg(formatElement("default")));
+ return attributeUse;
+ }
+ }
+
+ const XsdAttribute::Ptr attribute(new XsdAttribute());
+
+ attributeUse->setAttribute(attribute);
+ m_componentLocationHash.insert(attribute, currentSourceLocation());
+
+ attribute->setScope(XsdAttribute::Scope::Ptr(new XsdAttribute::Scope()));
+ attribute->scope()->setVariety(XsdAttribute::Scope::Local);
+ attribute->scope()->setParent(parent);
+
+ // now make a difference between attribute reference and attribute use
+ if (hasRefAttribute) {
+ const QString reference = readQNameAttribute(QString::fromLatin1("ref"), "attribute");
+ QXmlName referenceName;
+ convertName(reference, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName
+
+ const XsdAttributeReference::Ptr attributeReference = attributeUse;
+ attributeReference->setReferenceName(referenceName);
+ } else {
+ if (hasAttribute(QString::fromLatin1("name"))) {
+ const QString attributeName = readNameAttribute("attribute");
+
+ QXmlName objectName;
+ if (hasAttribute(QString::fromLatin1("form"))) {
+ const QString value = readAttribute(QString::fromLatin1("form"));
+ if (value != QString::fromLatin1("qualified") && value != QString::fromLatin1("unqualified")) {
+ attributeContentError("form", "attribute", value);
+ return attributeUse;
+ }
+
+ if (value == QString::fromLatin1("qualified")) {
+ objectName = m_namePool->allocateQName(m_targetNamespace, attributeName);
+ } else {
+ objectName = m_namePool->allocateQName(QString(), attributeName);
+ }
+ } else {
+ if (m_attributeFormDefault == QString::fromLatin1("qualified")) {
+ objectName = m_namePool->allocateQName(m_targetNamespace, attributeName);
+ } else {
+ objectName = m_namePool->allocateQName(QString(), attributeName);
+ }
+ }
+
+ if ((objectName.namespaceURI() == StandardNamespaces::xsi) &&
+ (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("type")) &&
+ (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("nil")) &&
+ (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("schemaLocation")) &&
+ (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("noNamespaceSchemaLocation"))) {
+
+ error(QtXmlPatterns::tr("content of %1 attribute of %2 element must not be from namespace %3")
+ .arg(formatAttribute("name"))
+ .arg(formatElement("attribute"))
+ .arg(formatURI(CommonNamespaces::XSI)));
+ return attributeUse;
+ }
+ if (m_namePool->stringForLocalName(objectName.localName()) == QString::fromLatin1("xmlns")) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must not be %3")
+ .arg(formatAttribute("name"))
+ .arg(formatElement("attribute"))
+ .arg(formatData("xmlns")));
+ return attributeUse;
+ }
+
+ attribute->setName(objectName);
+ }
+
+ if (hasAttribute(QString::fromLatin1("type"))) {
+ hasTypeAttribute = true;
+
+ const QString type = readQNameAttribute(QString::fromLatin1("type"), "attribute");
+ QXmlName typeName;
+ convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ m_schemaResolver->addAttributeType(attribute, typeName, currentSourceLocation()); // add to resolver
+ hasTypeSpecified = true;
+ }
+
+ if (attributeUse->valueConstraint()) {
+ //TODO: check whether assigning the value constraint of the attribute use to the attribute is correct
+ if (!attribute->valueConstraint())
+ attribute->setValueConstraint(XsdAttribute::ValueConstraint::Ptr(new XsdAttribute::ValueConstraint()));
+
+ attribute->valueConstraint()->setVariety((XsdAttribute::ValueConstraint::Variety)attributeUse->valueConstraint()->variety());
+ attribute->valueConstraint()->setValue(attributeUse->valueConstraint()->value());
+ attribute->valueConstraint()->setLexicalForm(attributeUse->valueConstraint()->lexicalForm());
+ }
+ }
+
+ validateIdAttribute("attribute");
+
+ TagValidationHandler tagValidator(XsdTagScope::LocalAttribute, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ attribute->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ if (hasTypeAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("attribute"))
+ .arg(formatElement("simpleType"))
+ .arg(formatAttribute("type")));
+ break;
+ }
+ if (hasRefAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("attribute"))
+ .arg(formatElement("simpleType"))
+ .arg(formatAttribute("ref")));
+ break;
+ }
+
+ const XsdSimpleType::Ptr type = parseLocalSimpleType();
+ type->setContext(attribute);
+ attribute->setType(type);
+ hasTypeSpecified = true;
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ if (!hasTypeSpecified) {
+ attribute->setType(BuiltinTypes::xsAnySimpleType); // default value
+ }
+
+ tagValidator.finalize();
+
+ return attributeUse;
+}
+
+XsdAttributeGroup::Ptr XsdSchemaParser::parseNamedAttributeGroup()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::AttributeGroup, this);
+
+ validateElement(XsdTagScope::NamedAttributeGroup);
+
+ const XsdAttributeGroup::Ptr attributeGroup(new XsdAttributeGroup());
+
+ // parse attributes
+ const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("attributeGroup"));
+ attributeGroup->setName(objectName);
+
+ validateIdAttribute("attributeGroup");
+
+ TagValidationHandler tagValidator(XsdTagScope::NamedAttributeGroup, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ attributeGroup->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(attributeGroup);
+
+ if (attributeUse->useType() == XsdAttributeUse::ProhibitedUse) {
+ warning(QtXmlPatterns::tr("specifying use='prohibited' inside an attribute group has no effect"));
+ } else {
+ attributeGroup->addAttributeUse(attributeUse);
+ }
+ } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) {
+ const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup();
+ attributeGroup->addAttributeUse(attributeUse);
+ } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) {
+ const XsdWildcard::Ptr wildcard = parseAnyAttribute();
+ attributeGroup->setWildcard(wildcard);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return attributeGroup;
+}
+
+XsdAttributeUse::Ptr XsdSchemaParser::parseReferredAttributeGroup()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::AttributeGroup, this);
+
+ validateElement(XsdTagScope::ReferredAttributeGroup);
+
+ const XsdAttributeReference::Ptr attributeReference(new XsdAttributeReference());
+ attributeReference->setType(XsdAttributeReference::AttributeGroup);
+ attributeReference->setSourceLocation(currentSourceLocation());
+
+ // parse attributes
+ const QString reference = readQNameAttribute(QString::fromLatin1("ref"), "attributeGroup");
+ QXmlName referenceName;
+ convertName(reference, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName
+ attributeReference->setReferenceName(referenceName);
+
+ validateIdAttribute("attributeGroup");
+
+ TagValidationHandler tagValidator(XsdTagScope::ReferredAttributeGroup, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ attributeReference->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return attributeReference;
+}
+
+XsdElement::Ptr XsdSchemaParser::parseGlobalElement()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Element, this);
+
+ validateElement(XsdTagScope::GlobalElement);
+
+ const XsdElement::Ptr element(new XsdElement());
+ element->setScope(XsdElement::Scope::Ptr(new XsdElement::Scope()));
+ element->scope()->setVariety(XsdElement::Scope::Global);
+
+ bool hasTypeAttribute = false;
+ bool hasTypeSpecified = false;
+ bool hasSubstitutionGroup = false;
+
+ // parse attributes
+ const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("element"));
+ element->setName(objectName);
+
+ if (hasAttribute(QString::fromLatin1("abstract"))) {
+ const QString abstract = readAttribute(QString::fromLatin1("abstract"));
+
+ const Boolean::Ptr value = Boolean::fromLexical(abstract);
+ if (value->hasError()) {
+ attributeContentError("abstract", "element", abstract, BuiltinTypes::xsBoolean);
+ return element;
+ }
+
+ element->setIsAbstract(value->as<Boolean>()->value());
+ } else {
+ element->setIsAbstract(false); // the default value
+ }
+
+ if (hasAttribute(QString::fromLatin1("default")) && hasAttribute(QString::fromLatin1("fixed"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("default"))
+ .arg(formatAttribute("fixed")));
+ return element;
+ }
+
+ if (hasAttribute(QString::fromLatin1("default"))) {
+ const QString value = readAttribute(QString::fromLatin1("default"));
+ element->setValueConstraint(XsdElement::ValueConstraint::Ptr(new XsdElement::ValueConstraint()));
+ element->valueConstraint()->setVariety(XsdElement::ValueConstraint::Default);
+ element->valueConstraint()->setValue(value);
+ } else if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ element->setValueConstraint(XsdElement::ValueConstraint::Ptr(new XsdElement::ValueConstraint()));
+ element->valueConstraint()->setVariety(XsdElement::ValueConstraint::Fixed);
+ element->valueConstraint()->setValue(value);
+ }
+
+ element->setDisallowedSubstitutions(readBlockingConstraintAttribute(NamedSchemaComponent::ExtensionConstraint | NamedSchemaComponent::RestrictionConstraint | NamedSchemaComponent::SubstitutionConstraint, "element"));
+ element->setSubstitutionGroupExclusions(readDerivationConstraintAttribute(SchemaType::ExtensionConstraint | SchemaType::RestrictionConstraint, "element"));
+
+ if (hasAttribute(QString::fromLatin1("nillable"))) {
+ const QString nillable = readAttribute(QString::fromLatin1("nillable"));
+
+ const Boolean::Ptr value = Boolean::fromLexical(nillable);
+ if (value->hasError()) {
+ attributeContentError("nillable", "element", nillable, BuiltinTypes::xsBoolean);
+ return element;
+ }
+
+ element->setIsNillable(value->as<Boolean>()->value());
+ } else {
+ element->setIsNillable(false); // the default value
+ }
+
+ if (hasAttribute(QString::fromLatin1("type"))) {
+ const QString type = readQNameAttribute(QString::fromLatin1("type"), "element");
+ QXmlName typeName;
+ convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ m_schemaResolver->addElementType(element, typeName, currentSourceLocation()); // add to resolver
+
+ hasTypeAttribute = true;
+ hasTypeSpecified = true;
+ }
+
+ if (hasAttribute(QString::fromLatin1("substitutionGroup"))) {
+ QList<QXmlName> elementNames;
+
+ const QString value = readAttribute(QString::fromLatin1("substitutionGroup"));
+ const QStringList substitutionGroups = value.split(QLatin1Char(' '), QString::SkipEmptyParts);
+ if (substitutionGroups.isEmpty()) {
+ attributeContentError("substitutionGroup", "element", value, BuiltinTypes::xsQName);
+ return element;
+ }
+
+ for (int i = 0; i < substitutionGroups.count(); ++i) {
+ const QString value = substitutionGroups.at(i).simplified();
+ if (!XPathHelper::isQName(value)) {
+ attributeContentError("substitutionGroup", "element", value, BuiltinTypes::xsQName);
+ return element;
+ }
+
+ QXmlName elementName;
+ convertName(value, NamespaceSupport::ElementName, elementName); // translate qualified name into QXmlName
+ elementNames.append(elementName);
+ }
+
+ m_schemaResolver->addSubstitutionGroupAffiliation(element, elementNames, currentSourceLocation()); // add to resolver
+
+ hasSubstitutionGroup = true;
+ }
+
+ validateIdAttribute("element");
+
+ XsdAlternative::List alternatives;
+
+ TagValidationHandler tagValidator(XsdTagScope::GlobalElement, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ element->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ if (hasTypeAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("simpleType"))
+ .arg(formatAttribute("type")));
+ return element;
+ }
+
+ const XsdSimpleType::Ptr type = parseLocalSimpleType();
+ type->setContext(element);
+ element->setType(type);
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+
+ hasTypeSpecified = true;
+ } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) {
+ if (hasTypeAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("complexType"))
+ .arg(formatAttribute("type")));
+ return element;
+ }
+
+ const XsdComplexType::Ptr type = parseLocalComplexType();
+ type->setContext(element);
+ element->setType(type);
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+
+ hasTypeSpecified = true;
+ } else if (isSchemaTag(XsdSchemaToken::Alternative, token, namespaceToken)) {
+ const XsdAlternative::Ptr alternative = parseAlternative();
+ alternatives.append(alternative);
+ } else if (isSchemaTag(XsdSchemaToken::Unique, token, namespaceToken)) {
+ const XsdIdentityConstraint::Ptr constraint = parseUnique();
+ element->addIdentityConstraint(constraint);
+ } else if (isSchemaTag(XsdSchemaToken::Key, token, namespaceToken)) {
+ const XsdIdentityConstraint::Ptr constraint = parseKey();
+ element->addIdentityConstraint(constraint);
+ } else if (isSchemaTag(XsdSchemaToken::Keyref, token, namespaceToken)) {
+ const XsdIdentityConstraint::Ptr constraint = parseKeyRef(element);
+ element->addIdentityConstraint(constraint);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ if (!hasTypeSpecified) {
+ if (hasSubstitutionGroup)
+ m_schemaResolver->addSubstitutionGroupType(element);
+ else
+ element->setType(BuiltinTypes::xsAnyType);
+ }
+
+ if (!alternatives.isEmpty()) {
+ element->setTypeTable(XsdElement::TypeTable::Ptr(new XsdElement::TypeTable()));
+
+ for (int i = 0; i < alternatives.count(); ++i) {
+ if (alternatives.at(i)->test())
+ element->typeTable()->addAlternative(alternatives.at(i));
+
+ if (i == (alternatives.count() - 1)) { // the final one
+ if (!alternatives.at(i)->test()) {
+ element->typeTable()->setDefaultTypeDefinition(alternatives.at(i));
+ } else {
+ const XsdAlternative::Ptr alternative(new XsdAlternative());
+ if (element->type())
+ alternative->setType(element->type());
+ else
+ m_schemaResolver->addAlternativeType(alternative, element); // add to resolver
+
+ element->typeTable()->setDefaultTypeDefinition(alternative);
+ }
+ }
+ }
+ }
+
+ return element;
+}
+
+XsdTerm::Ptr XsdSchemaParser::parseLocalElement(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Element, this);
+
+ validateElement(XsdTagScope::LocalElement);
+
+ bool hasRefAttribute = false;
+ bool hasTypeAttribute = false;
+ bool hasTypeSpecified = false;
+
+ XsdTerm::Ptr term;
+ XsdElement::Ptr element;
+ if (hasAttribute(QString::fromLatin1("ref"))) {
+ term = XsdReference::Ptr(new XsdReference());
+ hasRefAttribute = true;
+ } else {
+ term = XsdElement::Ptr(new XsdElement());
+ element = term;
+ }
+
+ if (hasRefAttribute) {
+ if (hasAttribute(QString::fromLatin1("name"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("name")));
+ return term;
+ } else if (hasAttribute(QString::fromLatin1("block"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("block")));
+ return term;
+ } else if (hasAttribute(QString::fromLatin1("nillable"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("nillable")));
+ return term;
+ } else if (hasAttribute(QString::fromLatin1("default"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("default")));
+ return term;
+ } else if (hasAttribute(QString::fromLatin1("fixed"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("fixed")));
+ return term;
+ } else if (hasAttribute(QString::fromLatin1("form"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("form")));
+ return term;
+ } else if (hasAttribute(QString::fromLatin1("type"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("ref"))
+ .arg(formatAttribute("type")));
+ return term;
+ }
+ }
+
+ // parse attributes
+ if (!parseMinMaxConstraint(particle, "element")) {
+ return element;
+ }
+
+ if (!hasAttribute(QString::fromLatin1("name")) && !hasAttribute(QString::fromLatin1("ref"))) {
+ error(QtXmlPatterns::tr("%1 element must have either %2 or %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("name"))
+ .arg(formatAttribute("ref")));
+ return element;
+ }
+
+ if (hasRefAttribute) {
+ const QString ref = readQNameAttribute(QString::fromLatin1("ref"), "element");
+ QXmlName referenceName;
+ convertName(ref, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName
+
+ const XsdReference::Ptr reference = term;
+ reference->setReferenceName(referenceName);
+ reference->setType(XsdReference::Element);
+ reference->setSourceLocation(currentSourceLocation());
+ } else {
+ element->setScope(XsdElement::Scope::Ptr(new XsdElement::Scope()));
+ element->scope()->setVariety(XsdElement::Scope::Local);
+ element->scope()->setParent(parent);
+
+ if (hasAttribute(QString::fromLatin1("name"))) {
+ const QString elementName = readNameAttribute("element");
+
+ QXmlName objectName;
+ if (hasAttribute(QString::fromLatin1("form"))) {
+ const QString value = readAttribute(QString::fromLatin1("form"));
+ if (value != QString::fromLatin1("qualified") && value != QString::fromLatin1("unqualified")) {
+ attributeContentError("form", "element", value);
+ return element;
+ }
+
+ if (value == QString::fromLatin1("qualified")) {
+ objectName = m_namePool->allocateQName(m_targetNamespace, elementName);
+ } else {
+ objectName = m_namePool->allocateQName(QString(), elementName);
+ }
+ } else {
+ if (m_elementFormDefault == QString::fromLatin1("qualified")) {
+ objectName = m_namePool->allocateQName(m_targetNamespace, elementName);
+ } else {
+ objectName = m_namePool->allocateQName(QString(), elementName);
+ }
+ }
+
+ element->setName(objectName);
+ }
+
+ if (hasAttribute(QString::fromLatin1("nillable"))) {
+ const QString nillable = readAttribute(QString::fromLatin1("nillable"));
+
+ const Boolean::Ptr value = Boolean::fromLexical(nillable);
+ if (value->hasError()) {
+ attributeContentError("nillable", "element", nillable, BuiltinTypes::xsBoolean);
+ return term;
+ }
+
+ element->setIsNillable(value->as<Boolean>()->value());
+ } else {
+ element->setIsNillable(false); // the default value
+ }
+
+ if (hasAttribute(QString::fromLatin1("default")) && hasAttribute(QString::fromLatin1("fixed"))) {
+ error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together")
+ .arg(formatElement("element"))
+ .arg(formatAttribute("default"))
+ .arg(formatAttribute("fixed")));
+ return element;
+ }
+
+ if (hasAttribute(QString::fromLatin1("default"))) {
+ const QString value = readAttribute(QString::fromLatin1("default"));
+ element->setValueConstraint(XsdElement::ValueConstraint::Ptr(new XsdElement::ValueConstraint()));
+ element->valueConstraint()->setVariety(XsdElement::ValueConstraint::Default);
+ element->valueConstraint()->setValue(value);
+ } else if (hasAttribute(QString::fromLatin1("fixed"))) {
+ const QString value = readAttribute(QString::fromLatin1("fixed"));
+ element->setValueConstraint(XsdElement::ValueConstraint::Ptr(new XsdElement::ValueConstraint()));
+ element->valueConstraint()->setVariety(XsdElement::ValueConstraint::Fixed);
+ element->valueConstraint()->setValue(value);
+ }
+
+ if (hasAttribute(QString::fromLatin1("type"))) {
+ const QString type = readQNameAttribute(QString::fromLatin1("type"), "element");
+ QXmlName typeName;
+ convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ m_schemaResolver->addElementType(element, typeName, currentSourceLocation()); // add to resolver
+
+ hasTypeAttribute = true;
+ hasTypeSpecified = true;
+ }
+
+ element->setDisallowedSubstitutions(readBlockingConstraintAttribute(NamedSchemaComponent::ExtensionConstraint | NamedSchemaComponent::RestrictionConstraint | NamedSchemaComponent::SubstitutionConstraint, "element"));
+ }
+
+ validateIdAttribute("element");
+
+ XsdAlternative::List alternatives;
+
+ TagValidationHandler tagValidator(XsdTagScope::LocalElement, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ element->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ if (hasRefAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("simpleType"))
+ .arg(formatAttribute("ref")));
+ return term;
+ } else if (hasTypeAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("simpleType"))
+ .arg(formatAttribute("type")));
+ return term;
+ }
+
+ const XsdSimpleType::Ptr type = parseLocalSimpleType();
+ type->setContext(element);
+ element->setType(type);
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+
+ hasTypeSpecified = true;
+ } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) {
+ if (hasRefAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("complexType"))
+ .arg(formatAttribute("ref")));
+ return term;
+ } else if (hasTypeAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("complexType"))
+ .arg(formatAttribute("type")));
+ return term;
+ }
+
+ const XsdComplexType::Ptr type = parseLocalComplexType();
+ type->setContext(element);
+ element->setType(type);
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+
+ hasTypeSpecified = true;
+ } else if (isSchemaTag(XsdSchemaToken::Alternative, token, namespaceToken)) {
+ if (hasRefAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("alternative"))
+ .arg(formatAttribute("ref")));
+ return term;
+ }
+
+ const XsdAlternative::Ptr alternative = parseAlternative();
+ alternatives.append(alternative);
+ } else if (isSchemaTag(XsdSchemaToken::Unique, token, namespaceToken)) {
+ if (hasRefAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("unique"))
+ .arg(formatAttribute("ref")));
+ return term;
+ }
+
+ const XsdIdentityConstraint::Ptr constraint = parseUnique();
+ element->addIdentityConstraint(constraint);
+ } else if (isSchemaTag(XsdSchemaToken::Key, token, namespaceToken)) {
+ if (hasRefAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("key"))
+ .arg(formatAttribute("ref")));
+ return term;
+ }
+
+ const XsdIdentityConstraint::Ptr constraint = parseKey();
+ element->addIdentityConstraint(constraint);
+ } else if (isSchemaTag(XsdSchemaToken::Keyref, token, namespaceToken)) {
+ if (hasRefAttribute) {
+ error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute")
+ .arg(formatElement("element"))
+ .arg(formatElement("keyref"))
+ .arg(formatAttribute("ref")));
+ return term;
+ }
+
+ const XsdIdentityConstraint::Ptr constraint = parseKeyRef(element);
+ element->addIdentityConstraint(constraint);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ if (!hasTypeSpecified && !hasRefAttribute)
+ element->setType(BuiltinTypes::xsAnyType);
+
+ if (!hasRefAttribute && !alternatives.isEmpty()) {
+ element->setTypeTable(XsdElement::TypeTable::Ptr(new XsdElement::TypeTable()));
+
+ for (int i = 0; i < alternatives.count(); ++i) {
+ if (alternatives.at(i)->test())
+ element->typeTable()->addAlternative(alternatives.at(i));
+
+ if (i == (alternatives.count() - 1)) { // the final one
+ if (!alternatives.at(i)->test()) {
+ element->typeTable()->setDefaultTypeDefinition(alternatives.at(i));
+ } else {
+ const XsdAlternative::Ptr alternative(new XsdAlternative());
+ if (element->type())
+ alternative->setType(element->type());
+ else
+ m_schemaResolver->addAlternativeType(alternative, element); // add to resolver
+
+ element->typeTable()->setDefaultTypeDefinition(alternative);
+ }
+ }
+ }
+ }
+
+ return term;
+}
+
+XsdIdentityConstraint::Ptr XsdSchemaParser::parseUnique()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Unique, this);
+
+ validateElement(XsdTagScope::Unique);
+
+ const XsdIdentityConstraint::Ptr constraint(new XsdIdentityConstraint());
+ constraint->setCategory(XsdIdentityConstraint::Unique);
+
+ // parse attributes
+ const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("unique"));
+ constraint->setName(objectName);
+
+ validateIdAttribute("unique");
+
+ TagValidationHandler tagValidator(XsdTagScope::Unique, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ constraint->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Selector, token, namespaceToken)) {
+ parseSelector(constraint);
+ } else if (isSchemaTag(XsdSchemaToken::Field, token, namespaceToken)) {
+ parseField(constraint);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ // add constraint to schema for further checking
+ addIdentityConstraint(constraint);
+
+ tagValidator.finalize();
+
+ return constraint;
+}
+
+XsdIdentityConstraint::Ptr XsdSchemaParser::parseKey()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Key, this);
+
+ validateElement(XsdTagScope::Key);
+
+ const XsdIdentityConstraint::Ptr constraint(new XsdIdentityConstraint());
+ constraint->setCategory(XsdIdentityConstraint::Key);
+
+ // parse attributes
+ const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("key"));
+ constraint->setName(objectName);
+
+ validateIdAttribute("key");
+
+ TagValidationHandler tagValidator(XsdTagScope::Key, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ constraint->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Selector, token, namespaceToken)) {
+ parseSelector(constraint);
+ } else if (isSchemaTag(XsdSchemaToken::Field, token, namespaceToken)) {
+ parseField(constraint);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ // add constraint to schema for further checking
+ addIdentityConstraint(constraint);
+
+ tagValidator.finalize();
+
+ return constraint;
+}
+
+XsdIdentityConstraint::Ptr XsdSchemaParser::parseKeyRef(const XsdElement::Ptr &element)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Keyref, this);
+
+ validateElement(XsdTagScope::KeyRef);
+
+ const XsdIdentityConstraint::Ptr constraint(new XsdIdentityConstraint());
+ constraint->setCategory(XsdIdentityConstraint::KeyReference);
+
+ // parse attributes
+ const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("keyref"));
+ constraint->setName(objectName);
+
+ const QString refer = readQNameAttribute(QString::fromLatin1("refer"), "keyref");
+ QXmlName referenceName;
+ convertName(refer, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName
+ m_schemaResolver->addKeyReference(element, constraint, referenceName, currentSourceLocation()); // add to resolver
+
+ validateIdAttribute("keyref");
+
+ TagValidationHandler tagValidator(XsdTagScope::KeyRef, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ constraint->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::Selector, token, namespaceToken)) {
+ parseSelector(constraint);
+ } else if (isSchemaTag(XsdSchemaToken::Field, token, namespaceToken)) {
+ parseField(constraint);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ // add constraint to schema for further checking
+ addIdentityConstraint(constraint);
+
+ tagValidator.finalize();
+
+ return constraint;
+}
+
+void XsdSchemaParser::parseSelector(const XsdIdentityConstraint::Ptr &ptr)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Selector, this);
+
+ validateElement(XsdTagScope::Selector);
+
+ // parse attributes
+ const XsdXPathExpression::Ptr expression = readXPathExpression("selector");
+
+ const QString xpath = readXPathAttribute(QString::fromLatin1("xpath"), XPathSelector, "selector");
+ expression->setExpression(xpath);
+
+ ptr->setSelector(expression);
+
+ validateIdAttribute("selector");
+
+ TagValidationHandler tagValidator(XsdTagScope::Selector, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ expression->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+}
+
+void XsdSchemaParser::parseField(const XsdIdentityConstraint::Ptr &ptr)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Field, this);
+
+ validateElement(XsdTagScope::Field);
+
+ // parse attributes
+ const XsdXPathExpression::Ptr expression = readXPathExpression("field");
+
+ const QString xpath = readXPathAttribute(QString::fromLatin1("xpath"), XPathField, "field");
+ expression->setExpression(xpath);
+
+ ptr->addField(expression);
+
+ validateIdAttribute("field");
+
+ TagValidationHandler tagValidator(XsdTagScope::Field, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ expression->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+}
+
+XsdAlternative::Ptr XsdSchemaParser::parseAlternative()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Alternative, this);
+
+ validateElement(XsdTagScope::Alternative);
+
+ const XsdAlternative::Ptr alternative(new XsdAlternative());
+
+ bool hasTypeSpecified = false;
+
+ if (hasAttribute(QString::fromLatin1("test"))) {
+ const XsdXPathExpression::Ptr expression = readXPathExpression("alternative");
+
+ const QString test = readXPathAttribute(QString::fromLatin1("test"), XPath20, "alternative");
+ expression->setExpression(test);
+
+ alternative->setTest(expression);
+ }
+
+ if (hasAttribute(QString::fromLatin1("type"))) {
+ const QString type = readQNameAttribute(QString::fromLatin1("type"), "alternative");
+ QXmlName typeName;
+ convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName
+ m_schemaResolver->addAlternativeType(alternative, typeName, currentSourceLocation()); // add to resolver
+
+ hasTypeSpecified = true;
+ }
+
+ validateIdAttribute("alternative");
+
+ TagValidationHandler tagValidator(XsdTagScope::Alternative, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ alternative->addAnnotation(annotation);
+ } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) {
+ const XsdSimpleType::Ptr type = parseLocalSimpleType();
+ alternative->setType(type);
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+
+ hasTypeSpecified = true;
+ } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) {
+ const XsdComplexType::Ptr type = parseLocalComplexType();
+ alternative->setType(type);
+
+ // add it to list of anonymous types as well
+ addAnonymousType(type);
+
+ hasTypeSpecified = true;
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ if (!hasTypeSpecified) {
+ error(QtXmlPatterns::tr("%1 element must have either %2 attribute or %3 or %4 as child element")
+ .arg(formatElement("alternative"))
+ .arg(formatAttribute("type"))
+ .arg(formatElement("simpleType"))
+ .arg(formatElement("complexType")));
+ return alternative;
+ }
+
+ return alternative;
+}
+
+XsdNotation::Ptr XsdSchemaParser::parseNotation()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Notation, this);
+
+ validateElement(XsdTagScope::Notation);
+
+ const XsdNotation::Ptr notation(new XsdNotation());
+
+ // parse attributes
+ const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("notation"));
+ notation->setName(objectName);
+
+ bool hasOptionalAttribute = false;
+
+ if (hasAttribute(QString::fromLatin1("public"))) {
+ const QString value = readAttribute(QString::fromLatin1("public"));
+ if (!value.isEmpty()) {
+ const DerivedString<TypeToken>::Ptr publicId = DerivedString<TypeToken>::fromLexical(m_namePool, value);
+ if (publicId->hasError()) {
+ attributeContentError("public", "notation", value, BuiltinTypes::xsToken);
+ return notation;
+ }
+ notation->setPublicId(publicId);
+ }
+
+ hasOptionalAttribute = true;
+ }
+
+ if (hasAttribute(QString::fromLatin1("system"))) {
+ const QString value = readAttribute(QString::fromLatin1("system"));
+ if (!isValidUri(value)) {
+ attributeContentError("system", "notation", value, BuiltinTypes::xsAnyURI);
+ return notation;
+ }
+
+ if (!value.isEmpty()) {
+ const AnyURI::Ptr systemId = AnyURI::fromLexical(value);
+ notation->setSystemId(systemId);
+ }
+
+ hasOptionalAttribute = true;
+ }
+
+ if (!hasOptionalAttribute) {
+ error(QtXmlPatterns::tr("%1 element requires either %2 or %3 attribute")
+ .arg(formatElement("notation"))
+ .arg(formatAttribute("public"))
+ .arg(formatAttribute("system")));
+ return notation;
+ }
+
+ validateIdAttribute("notation");
+
+ TagValidationHandler tagValidator(XsdTagScope::Notation, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isCharacters() || isEntityReference()) {
+ if (!text().toString().trimmed().isEmpty()) {
+ error(QtXmlPatterns::tr("text or entity references not allowed inside %1 element").arg(formatElement("notation")));
+ return notation;
+ }
+ }
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ notation->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return notation;
+}
+
+XsdWildcard::Ptr XsdSchemaParser::parseAny(const XsdParticle::Ptr &particle)
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Any, this);
+
+ validateElement(XsdTagScope::Any);
+
+ const XsdWildcard::Ptr wildcard(new XsdWildcard());
+
+ // parse attributes
+ if (!parseMinMaxConstraint(particle, "any")) {
+ return wildcard;
+ }
+
+ if (hasAttribute(QString::fromLatin1("namespace"))) {
+ const QSet<QString> values = readAttribute(QString::fromLatin1("namespace")).split(QLatin1Char(' '), QString::SkipEmptyParts).toSet();
+ if ((values.contains(QString::fromLatin1("##any")) || values.contains(QString::fromLatin1("##other"))) && values.count() != 1) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must contain %3, %4 or a list of URIs")
+ .arg(formatAttribute("namespace"))
+ .arg(formatElement("any"))
+ .arg(formatData("##any"))
+ .arg(formatData("##other")));
+ return wildcard;
+ }
+
+ if (values.contains(QString::fromLatin1("##any"))) {
+ wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any);
+ } else if (values.contains(QString::fromLatin1("##other"))) {
+ wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not);
+ if (!m_targetNamespace.isEmpty())
+ wildcard->namespaceConstraint()->setNamespaces(QSet<QString>() << m_targetNamespace);
+ else
+ wildcard->namespaceConstraint()->setNamespaces(QSet<QString>() << XsdWildcard::absentNamespace());
+ } else {
+ wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration);
+ QStringList newValues = values.toList();
+
+ // replace the ##targetNamespace entry
+ for (int i = 0; i < newValues.count(); ++i) {
+ if (newValues.at(i) == QString::fromLatin1("##targetNamespace")) {
+ if (!m_targetNamespace.isEmpty())
+ newValues[i] = m_targetNamespace;
+ else
+ newValues[i] = XsdWildcard::absentNamespace();
+ } else if (newValues.at(i) == QString::fromLatin1("##local")) {
+ newValues[i] = XsdWildcard::absentNamespace();
+ }
+ }
+
+ // check for invalid URIs
+ for (int i = 0; i < newValues.count(); ++i) {
+ const QString stringValue = newValues.at(i);
+ if (stringValue == XsdWildcard::absentNamespace())
+ continue;
+
+ if (!isValidUri(stringValue)) {
+ attributeContentError("namespace", "any", stringValue, BuiltinTypes::xsAnyURI);
+ return wildcard;
+ }
+ }
+
+ wildcard->namespaceConstraint()->setNamespaces(newValues.toSet());
+ }
+ } else {
+ wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any);
+ }
+
+ if (hasAttribute(QString::fromLatin1("processContents"))) {
+ const QString value = readAttribute(QString::fromLatin1("processContents"));
+ if (value != QString::fromLatin1("lax") &&
+ value != QString::fromLatin1("skip") &&
+ value != QString::fromLatin1("strict")) {
+ attributeContentError("processContents", "any", value);
+ return wildcard;
+ }
+
+ if (value == QString::fromLatin1("lax")) {
+ wildcard->setProcessContents(XsdWildcard::Lax);
+ } else if (value == QString::fromLatin1("skip")) {
+ wildcard->setProcessContents(XsdWildcard::Skip);
+ } else if (value == QString::fromLatin1("strict")) {
+ wildcard->setProcessContents(XsdWildcard::Strict);
+ }
+ } else {
+ wildcard->setProcessContents(XsdWildcard::Strict);
+ }
+
+ validateIdAttribute("any");
+
+ TagValidationHandler tagValidator(XsdTagScope::Any, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ wildcard->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return wildcard;
+}
+
+XsdWildcard::Ptr XsdSchemaParser::parseAnyAttribute()
+{
+ const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::AnyAttribute, this);
+
+ validateElement(XsdTagScope::AnyAttribute);
+
+ const XsdWildcard::Ptr wildcard(new XsdWildcard());
+
+ // parse attributes
+ if (hasAttribute(QString::fromLatin1("namespace"))) {
+ const QSet<QString> values = readAttribute(QString::fromLatin1("namespace")).split(QLatin1Char(' '), QString::SkipEmptyParts).toSet();
+ if ((values.contains(QString::fromLatin1("##any")) || values.contains(QString::fromLatin1("##other"))) && values.count() != 1) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must contain %3, %4 or a list of URIs")
+ .arg(formatAttribute("namespace"))
+ .arg(formatElement("anyAttribute"))
+ .arg(formatData("##any"))
+ .arg(formatData("##other")));
+ return wildcard;
+ }
+
+ if (values.contains(QString::fromLatin1("##any"))) {
+ wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any);
+ } else if (values.contains(QString::fromLatin1("##other"))) {
+ wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not);
+ if (!m_targetNamespace.isEmpty())
+ wildcard->namespaceConstraint()->setNamespaces(QSet<QString>() << m_targetNamespace);
+ else
+ wildcard->namespaceConstraint()->setNamespaces(QSet<QString>() << XsdWildcard::absentNamespace());
+ } else {
+ wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration);
+ QStringList newValues = values.toList();
+
+ // replace the ##targetNamespace entry
+ for (int i = 0; i < newValues.count(); ++i) {
+ if (newValues.at(i) == QString::fromLatin1("##targetNamespace")) {
+ if (!m_targetNamespace.isEmpty())
+ newValues[i] = m_targetNamespace;
+ else
+ newValues[i] = XsdWildcard::absentNamespace();
+ } else if (newValues.at(i) == QString::fromLatin1("##local")) {
+ newValues[i] = XsdWildcard::absentNamespace();
+ }
+ }
+
+ // check for invalid URIs
+ for (int i = 0; i < newValues.count(); ++i) {
+ const QString stringValue = newValues.at(i);
+ if (stringValue == XsdWildcard::absentNamespace())
+ continue;
+
+ if (!isValidUri(stringValue)) {
+ attributeContentError("namespace", "anyAttribute", stringValue, BuiltinTypes::xsAnyURI);
+ return wildcard;
+ }
+ }
+
+ wildcard->namespaceConstraint()->setNamespaces(newValues.toSet());
+ }
+ } else {
+ wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any);
+ }
+
+ if (hasAttribute(QString::fromLatin1("processContents"))) {
+ const QString value = readAttribute(QString::fromLatin1("processContents"));
+ if (value != QString::fromLatin1("lax") &&
+ value != QString::fromLatin1("skip") &&
+ value != QString::fromLatin1("strict")) {
+ attributeContentError("processContents", "anyAttribute", value);
+ return wildcard;
+ }
+
+ if (value == QString::fromLatin1("lax")) {
+ wildcard->setProcessContents(XsdWildcard::Lax);
+ } else if (value == QString::fromLatin1("skip")) {
+ wildcard->setProcessContents(XsdWildcard::Skip);
+ } else if (value == QString::fromLatin1("strict")) {
+ wildcard->setProcessContents(XsdWildcard::Strict);
+ }
+ } else {
+ wildcard->setProcessContents(XsdWildcard::Strict);
+ }
+
+ validateIdAttribute("anyAttribute");
+
+ TagValidationHandler tagValidator(XsdTagScope::AnyAttribute, this, m_namePool);
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement()) {
+ const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name());
+ const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri());
+
+ tagValidator.validate(token);
+
+ if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) {
+ const XsdAnnotation::Ptr annotation = parseAnnotation();
+ wildcard->addAnnotation(annotation);
+ } else {
+ parseUnknown();
+ }
+ }
+ }
+
+ tagValidator.finalize();
+
+ return wildcard;
+}
+
+
+void XsdSchemaParser::parseUnknownDocumentation()
+{
+ Q_ASSERT(isStartElement());
+ m_namespaceSupport.pushContext();
+ m_namespaceSupport.setPrefixes(namespaceDeclarations());
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement())
+ parseUnknownDocumentation();
+ }
+
+ m_namespaceSupport.popContext();
+}
+
+void XsdSchemaParser::parseUnknown()
+{
+ Q_ASSERT(isStartElement());
+ m_namespaceSupport.pushContext();
+ m_namespaceSupport.setPrefixes(namespaceDeclarations());
+
+ error(QtXmlPatterns::tr("%1 element is not allowed in this context").arg(formatElement(name().toString())));
+
+ while (!atEnd()) {
+ readNext();
+
+ if (isEndElement())
+ break;
+
+ if (isStartElement())
+ parseUnknown();
+ }
+
+ m_namespaceSupport.popContext();
+}
+
+bool XsdSchemaParser::parseMinMaxConstraint(const XsdParticle::Ptr &particle, const char *elementName)
+{
+ if (hasAttribute(QString::fromLatin1("minOccurs"))) {
+ const QString value = readAttribute(QString::fromLatin1("minOccurs"));
+
+ DerivedInteger<TypeNonNegativeInteger>::Ptr integer = DerivedInteger<TypeNonNegativeInteger>::fromLexical(m_namePool, value);
+ if (integer->hasError()) {
+ attributeContentError("minOccurs", elementName, value, BuiltinTypes::xsNonNegativeInteger);
+ return false;
+ } else {
+ particle->setMinimumOccurs(integer->as< DerivedInteger<TypeNonNegativeInteger> >()->storedValue());
+ }
+ } else {
+ particle->setMinimumOccurs(1);
+ }
+
+ if (hasAttribute(QString::fromLatin1("maxOccurs"))) {
+ const QString value = readAttribute(QString::fromLatin1("maxOccurs"));
+
+ if (value == QString::fromLatin1("unbounded")) {
+ particle->setMaximumOccursUnbounded(true);
+ } else {
+ particle->setMaximumOccursUnbounded(false);
+ DerivedInteger<TypeNonNegativeInteger>::Ptr integer = DerivedInteger<TypeNonNegativeInteger>::fromLexical(m_namePool, value);
+ if (integer->hasError()) {
+ attributeContentError("maxOccurs", elementName, value, BuiltinTypes::xsNonNegativeInteger);
+ return false;
+ } else {
+ particle->setMaximumOccurs(integer->as< DerivedInteger<TypeNonNegativeInteger> >()->storedValue());
+ }
+ }
+ } else {
+ particle->setMaximumOccursUnbounded(false);
+ particle->setMaximumOccurs(1);
+ }
+
+ if (!particle->maximumOccursUnbounded()) {
+ if (particle->maximumOccurs() < particle->minimumOccurs()) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element has larger value than %3 attribute")
+ .arg(formatAttribute("minOccurs"))
+ .arg(formatElement(elementName))
+ .arg(formatAttribute("maxOccurs")));
+ return false;
+ }
+ }
+
+ return true;
+}
+
+QSourceLocation XsdSchemaParser::currentSourceLocation() const
+{
+ QSourceLocation location;
+ location.setLine(lineNumber());
+ location.setColumn(columnNumber());
+ location.setUri(m_documentURI);
+
+ return location;
+}
+
+void XsdSchemaParser::convertName(const QString &qualifiedName, NamespaceSupport::NameType type, QXmlName &name)
+{
+ bool result = m_namespaceSupport.processName(qualifiedName, type, name);
+ if (!result) {
+ error(QtXmlPatterns::tr("prefix of qualified name %1 is not defined").arg(formatKeyword(qualifiedName)));
+ }
+}
+
+QString XsdSchemaParser::readNameAttribute(const char *elementName)
+{
+ const QString value = readAttribute(QString::fromLatin1("name")).simplified();
+ if (!QXmlUtils::isNCName(value)) {
+ attributeContentError("name", elementName, value, BuiltinTypes::xsNCName);
+ return QString();
+ } else {
+ return value;
+ }
+}
+
+QString XsdSchemaParser::readQNameAttribute(const QString &typeAttribute, const char *elementName)
+{
+ const QString value = readAttribute(typeAttribute).simplified();
+ if (!XPathHelper::isQName(value)) {
+ attributeContentError(typeAttribute.toLatin1(), elementName, value, BuiltinTypes::xsQName);
+ return QString();
+ } else {
+ return value;
+ }
+}
+
+QString XsdSchemaParser::readNamespaceAttribute(const QString &attributeName, const char *elementName)
+{
+ const QString value = readAttribute(attributeName);
+ if (value.isEmpty()) {
+ attributeContentError(attributeName.toLatin1(), elementName, value, BuiltinTypes::xsAnyURI);
+ return QString();
+ }
+
+ return value;
+}
+
+SchemaType::DerivationConstraints XsdSchemaParser::readDerivationConstraintAttribute(const SchemaType::DerivationConstraints &allowedConstraints, const char *elementName)
+{
+ // first convert the flags into strings for easier comparision
+ QSet<QString> allowedContent;
+ if (allowedConstraints & SchemaType::RestrictionConstraint)
+ allowedContent.insert(QString::fromLatin1("restriction"));
+ if (allowedConstraints & SchemaType::ExtensionConstraint)
+ allowedContent.insert(QString::fromLatin1("extension"));
+ if (allowedConstraints & SchemaType::ListConstraint)
+ allowedContent.insert(QString::fromLatin1("list"));
+ if (allowedConstraints & SchemaType::UnionConstraint)
+ allowedContent.insert(QString::fromLatin1("union"));
+
+ // read content from the attribute if available, otherwise use the default definitions from the schema tag
+ QString content;
+ if (hasAttribute(QString::fromLatin1("final"))) {
+ content = readAttribute(QString::fromLatin1("final"));
+
+ // split string into list to validate the content of the attribute
+ const QStringList values = content.split(QLatin1Char(' '), QString::SkipEmptyParts);
+ for (int i = 0; i < values.count(); i++) {
+ const QString value = values.at(i);
+ if (!allowedContent.contains(value) && (value != QString::fromLatin1("#all"))) {
+ attributeContentError("final", elementName, value);
+ return SchemaType::DerivationConstraints();
+ }
+
+ if ((value == QString::fromLatin1("#all")) && values.count() != 1) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must either contain %3 or the other values")
+ .arg(formatAttribute("final"))
+ .arg(formatElement(elementName))
+ .arg(formatData("#all")));
+ return SchemaType::DerivationConstraints();
+ }
+ }
+ } else {
+ // content of the default value has been validated in parseSchema already
+ content = m_finalDefault;
+ }
+
+ QSet<QString> contentSet = content.split(QLatin1Char(' '), QString::SkipEmptyParts).toSet();
+
+ // if the '#all' tag is defined, we return all allowed values
+ if (contentSet.contains(QString::fromLatin1("#all"))) {
+ return allowedConstraints;
+ } else { // return the values from content set that intersects with the allowed values
+ contentSet.intersect(allowedContent);
+
+ SchemaType::DerivationConstraints constraints;
+
+ if (contentSet.contains(QString::fromLatin1("restriction")))
+ constraints |= SchemaType::RestrictionConstraint;
+ if (contentSet.contains(QString::fromLatin1("extension")))
+ constraints |= SchemaType::ExtensionConstraint;
+ if (contentSet.contains(QString::fromLatin1("list")))
+ constraints |= SchemaType::ListConstraint;
+ if (contentSet.contains(QString::fromLatin1("union")))
+ constraints |= SchemaType::UnionConstraint;
+
+ return constraints;
+ }
+}
+
+NamedSchemaComponent::BlockingConstraints XsdSchemaParser::readBlockingConstraintAttribute(const NamedSchemaComponent::BlockingConstraints &allowedConstraints, const char *elementName)
+{
+ // first convert the flags into strings for easier comparision
+ QSet<QString> allowedContent;
+ if (allowedConstraints & NamedSchemaComponent::RestrictionConstraint)
+ allowedContent.insert(QString::fromLatin1("restriction"));
+ if (allowedConstraints & NamedSchemaComponent::ExtensionConstraint)
+ allowedContent.insert(QString::fromLatin1("extension"));
+ if (allowedConstraints & NamedSchemaComponent::SubstitutionConstraint)
+ allowedContent.insert(QString::fromLatin1("substitution"));
+
+ // read content from the attribute if available, otherwise use the default definitions from the schema tag
+ QString content;
+ if (hasAttribute(QString::fromLatin1("block"))) {
+ content = readAttribute(QString::fromLatin1("block"));
+
+ // split string into list to validate the content of the attribute
+ const QStringList values = content.split(QLatin1Char(' '), QString::SkipEmptyParts);
+ for (int i = 0; i < values.count(); i++) {
+ const QString value = values.at(i);
+ if (!allowedContent.contains(value) && (value != QString::fromLatin1("#all"))) {
+ attributeContentError("block", elementName, value);
+ return NamedSchemaComponent::BlockingConstraints();
+ }
+
+ if ((value == QString::fromLatin1("#all")) && values.count() != 1) {
+ error(QtXmlPatterns::tr("%1 attribute of %2 element must either contain %3 or the other values")
+ .arg(formatAttribute("block"))
+ .arg(formatElement(elementName))
+ .arg(formatData("#all")));
+ return NamedSchemaComponent::BlockingConstraints();
+ }
+ }
+ } else {
+ // content of the default value has been validated in parseSchema already
+ content = m_blockDefault;
+ }
+
+ QSet<QString> contentSet = content.split(QLatin1Char(' '), QString::SkipEmptyParts).toSet();
+
+ // if the '#all' tag is defined, we return all allowed values
+ if (contentSet.contains(QString::fromLatin1("#all"))) {
+ return allowedConstraints;
+ } else { // return the values from content set that intersects with the allowed values
+ contentSet.intersect(allowedContent);
+
+ NamedSchemaComponent::BlockingConstraints constraints;
+
+ if (contentSet.contains(QString::fromLatin1("restriction")))
+ constraints |= NamedSchemaComponent::RestrictionConstraint;
+ if (contentSet.contains(QString::fromLatin1("extension")))
+ constraints |= NamedSchemaComponent::ExtensionConstraint;
+ if (contentSet.contains(QString::fromLatin1("substitution")))
+ constraints |= NamedSchemaComponent::SubstitutionConstraint;
+
+ return constraints;
+ }
+}
+
+XsdXPathExpression::Ptr XsdSchemaParser::readXPathExpression(const char *elementName)
+{
+ const XsdXPathExpression::Ptr expression(new XsdXPathExpression());
+
+ const QList<QXmlName> namespaceBindings = m_namespaceSupport.namespaceBindings();
+ QXmlName emptyName;
+ for (int i = 0; i < namespaceBindings.count(); ++i) {
+ if (namespaceBindings.at(i).prefix() == StandardPrefixes::empty)
+ emptyName = namespaceBindings.at(i);
+ }
+
+ expression->setNamespaceBindings(namespaceBindings);
+
+ QString xpathDefaultNamespace;
+ if (hasAttribute(QString::fromLatin1("xpathDefaultNamespace"))) {
+ xpathDefaultNamespace = readAttribute(QString::fromLatin1("xpathDefaultNamespace"));
+ if (xpathDefaultNamespace != QString::fromLatin1("##defaultNamespace") &&
+ xpathDefaultNamespace != QString::fromLatin1("##targetNamespace") &&
+ xpathDefaultNamespace != QString::fromLatin1("##local")) {
+ if (!isValidUri(xpathDefaultNamespace)) {
+ attributeContentError("xpathDefaultNamespace", elementName, xpathDefaultNamespace, BuiltinTypes::xsAnyURI);
+ return expression;
+ }
+ }
+ } else {
+ xpathDefaultNamespace = m_xpathDefaultNamespace;
+ }
+
+ AnyURI::Ptr namespaceURI;
+ if (xpathDefaultNamespace == QString::fromLatin1("##defaultNamespace")) {
+ if (!emptyName.isNull())
+ namespaceURI = AnyURI::fromLexical(m_namePool->stringForNamespace(emptyName.namespaceURI()));
+ } else if (xpathDefaultNamespace == QString::fromLatin1("##targetNamespace")) {
+ if (!m_targetNamespace.isEmpty())
+ namespaceURI = AnyURI::fromLexical(m_targetNamespace);
+ } else if (xpathDefaultNamespace == QString::fromLatin1("##local")) {
+ // it is absent
+ } else {
+ namespaceURI = AnyURI::fromLexical(xpathDefaultNamespace);
+ }
+ if (namespaceURI) {
+ if (namespaceURI->hasError()) {
+ attributeContentError("xpathDefaultNamespace", elementName, xpathDefaultNamespace, BuiltinTypes::xsAnyURI);
+ return expression;
+ }
+
+ expression->setDefaultNamespace(namespaceURI);
+ }
+
+ //TODO: read the base uri if qmaintaining reader support it
+
+ return expression;
+}
+
+QString XsdSchemaParser::readXPathAttribute(const QString &attributeName, XPathType type, const char *elementName)
+{
+ const QString value = readAttribute(attributeName);
+ if (value.isEmpty() || value.startsWith(QLatin1Char('/'))) {
+ attributeContentError(attributeName.toLatin1(), elementName, value);
+ return QString();
+ }
+
+ QXmlNamePool namePool(m_namePool.data());
+
+ QXmlQuery::QueryLanguage language = QXmlQuery::XPath20;
+ switch (type) {
+ case XPath20: language = QXmlQuery::XPath20; break;
+ case XPathSelector: language = QXmlQuery::XmlSchema11IdentityConstraintSelector; break;
+ case XPathField: language = QXmlQuery::XmlSchema11IdentityConstraintField; break;
+ };
+
+ QXmlQuery query(language, namePool);
+ QXmlQueryPrivate *queryPrivate = query.d;
+
+ const QList<QXmlName> namespaceBindings = m_namespaceSupport.namespaceBindings();
+ for (int i = 0; i < namespaceBindings.count(); ++i) {
+ if (!namespaceBindings.at(i).prefix() == StandardPrefixes::empty)
+ queryPrivate->addAdditionalNamespaceBinding(namespaceBindings.at(i));
+ }
+
+ query.setQuery(value, m_documentURI);
+ if (!query.isValid()) {
+ attributeContentError(attributeName.toLatin1(), elementName, value);
+ return QString();
+ }
+
+ return value;
+}
+
+void XsdSchemaParser::validateIdAttribute(const char *elementName)
+{
+ if (hasAttribute(QString::fromLatin1("id"))) {
+ const QString value = readAttribute(QString::fromLatin1("id"));
+ DerivedString<TypeID>::Ptr id = DerivedString<TypeID>::fromLexical(m_namePool, value);
+ if (id->hasError()) {
+ attributeContentError("id", elementName, value, BuiltinTypes::xsID);
+ } else {
+ if (m_idCache->hasId(value)) {
+ error(QtXmlPatterns::tr("component with id %1 has been defined previously").arg(formatData(value)));
+ } else {
+ m_idCache->addId(value);
+ }
+ }
+ }
+}
+
+bool XsdSchemaParser::isSchemaTag(XsdSchemaToken::NodeName tag, XsdSchemaToken::NodeName token, XsdSchemaToken::NodeName namespaceToken) const
+{
+ return ((tag == token) && (namespaceToken == XsdSchemaToken::XML_NS_SCHEMA_URI));
+}
+
+void XsdSchemaParser::addElement(const XsdElement::Ptr &element)
+{
+ const QXmlName objectName = element->name(m_namePool);
+ if (m_schema->element(objectName)) {
+ error(QtXmlPatterns::tr("element %1 already defined").arg(formatElement(m_namePool->displayName(objectName))));
+ } else {
+ m_schema->addElement(element);
+ m_componentLocationHash.insert(element, currentSourceLocation());
+ }
+}
+
+void XsdSchemaParser::addAttribute(const XsdAttribute::Ptr &attribute)
+{
+ const QXmlName objectName = attribute->name(m_namePool);
+ if (m_schema->attribute(objectName)) {
+ error(QtXmlPatterns::tr("attribute %1 already defined").arg(formatAttribute(m_namePool->displayName(objectName))));
+ } else {
+ m_schema->addAttribute(attribute);
+ m_componentLocationHash.insert(attribute, currentSourceLocation());
+ }
+}
+
+void XsdSchemaParser::addType(const SchemaType::Ptr &type)
+{
+ // we don't import redefinitions of builtin types, that just causes problems
+ if (m_builtinTypeNames.contains(type->name(m_namePool)))
+ return;
+
+ const QXmlName objectName = type->name(m_namePool);
+ if (m_schema->type(objectName)) {
+ error(QtXmlPatterns::tr("type %1 already defined").arg(formatType(m_namePool, objectName)));
+ } else {
+ m_schema->addType(type);
+ if (type->isSimpleType())
+ m_componentLocationHash.insert(XsdSimpleType::Ptr(type), currentSourceLocation());
+ else
+ m_componentLocationHash.insert(XsdComplexType::Ptr(type), currentSourceLocation());
+ }
+}
+
+void XsdSchemaParser::addAnonymousType(const SchemaType::Ptr &type)
+{
+ m_schema->addAnonymousType(type);
+ if (type->isSimpleType())
+ m_componentLocationHash.insert(XsdSimpleType::Ptr(type), currentSourceLocation());
+ else
+ m_componentLocationHash.insert(XsdComplexType::Ptr(type), currentSourceLocation());
+}
+
+void XsdSchemaParser::addAttributeGroup(const XsdAttributeGroup::Ptr &group)
+{
+ const QXmlName objectName = group->name(m_namePool);
+ if (m_schema->attributeGroup(objectName)) {
+ error(QtXmlPatterns::tr("attribute group %1 already defined").arg(formatKeyword(m_namePool, objectName)));
+ } else {
+ m_schema->addAttributeGroup(group);
+ m_componentLocationHash.insert(group, currentSourceLocation());
+ }
+}
+
+void XsdSchemaParser::addElementGroup(const XsdModelGroup::Ptr &group)
+{
+ const QXmlName objectName = group->name(m_namePool);
+ if (m_schema->elementGroup(objectName)) {
+ error(QtXmlPatterns::tr("element group %1 already defined").arg(formatKeyword(m_namePool, objectName)));
+ } else {
+ m_schema->addElementGroup(group);
+ m_componentLocationHash.insert(group, currentSourceLocation());
+ }
+}
+
+void XsdSchemaParser::addNotation(const XsdNotation::Ptr &notation)
+{
+ const QXmlName objectName = notation->name(m_namePool);
+ if (m_schema->notation(objectName)) {
+ error(QtXmlPatterns::tr("notation %1 already defined").arg(formatKeyword(m_namePool, objectName)));
+ } else {
+ m_schema->addNotation(notation);
+ m_componentLocationHash.insert(notation, currentSourceLocation());
+ }
+}
+
+void XsdSchemaParser::addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint)
+{
+ const QXmlName objectName = constraint->name(m_namePool);
+ if (m_schema->identityConstraint(objectName)) {
+ error(QtXmlPatterns::tr("identity constraint %1 already defined").arg(formatKeyword(m_namePool, objectName)));
+ } else {
+ m_schema->addIdentityConstraint(constraint);
+ m_componentLocationHash.insert(constraint, currentSourceLocation());
+ }
+}
+
+void XsdSchemaParser::addFacet(const XsdFacet::Ptr &facet, XsdFacet::Hash &facets, const SchemaType::Ptr &type)
+{
+ // @see http://www.w3.org/TR/xmlschema-2/#src-single-facet-value
+ if (facets.contains(facet->type())) {
+ error(QtXmlPatterns::tr("duplicated facets in simple type %1").arg(formatType(m_namePool, type)));
+ return;
+ }
+
+ facets.insert(facet->type(), facet);
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemaparser_p.h b/src/xmlpatterns/schema/qxsdschemaparser_p.h
new file mode 100644
index 0000000..51a8e3d
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemaparser_p.h
@@ -0,0 +1,721 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchemaParser_H
+#define Patternist_XsdSchemaParser_H
+
+#include "qnamespacesupport_p.h"
+#include "qxsdalternative_p.h"
+#include "qxsdattribute_p.h"
+#include "qxsdattributegroup_p.h"
+#include "qxsdattributeterm_p.h"
+#include "qxsdcomplextype_p.h"
+#include "qxsdelement_p.h"
+#include "qxsdidcache_p.h"
+#include "qxsdmodelgroup_p.h"
+#include "qxsdnotation_p.h"
+#include "qxsdsimpletype_p.h"
+#include "qxsdschemacontext_p.h"
+#include "qxsdschemaparsercontext_p.h"
+#include "qxsdstatemachine_p.h"
+
+#include <QtCore/QHash>
+#include <QtCore/QSet>
+#include <QtCore/QUrl>
+#include <QtXml/QXmlStreamReader>
+#include <QtXmlPatterns/QXmlNamePool>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Implements the parsing of XML schema file.
+ *
+ * This class parses a XML schema in XML presentation from an QIODevice
+ * and returns object representation as XsdSchema.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSchemaParser : public MaintainingReader<XsdSchemaToken, XsdTagScope::Type>
+ {
+ friend class ElementNamespaceHandler;
+ friend class TagValidationHandler;
+
+ public:
+ enum ParserType
+ {
+ TopLevelParser,
+ IncludeParser,
+ ImportParser,
+ RedefineParser
+ };
+
+ /**
+ * Creates a new schema parser object.
+ */
+ XsdSchemaParser(const XsdSchemaContext::Ptr &context, const XsdSchemaParserContext::Ptr &parserContext, QIODevice *device);
+
+ /**
+ * Parses the XML schema file.
+ *
+ * @return @c true on success, @c false if the schema is somehow invalid.
+ */
+ bool parse(ParserType parserType = TopLevelParser);
+
+ /**
+ * Describes a set of namespace URIs
+ */
+ typedef QSet<QUrl> NamespaceSet;
+
+ /**
+ * Sets which @p schemas have been included already, so the parser
+ * can detect circular includes.
+ */
+ void setIncludedSchemas(const NamespaceSet &schemas);
+
+ /**
+ * Sets which @p schemas have been imported already, so the parser
+ * can detect circular imports.
+ */
+ void setImportedSchemas(const NamespaceSet &schemas);
+
+ /**
+ * Sets which @p schemas have been redefined already, so the parser
+ * can detect circular redefines.
+ */
+ void setRedefinedSchemas(const NamespaceSet &schemas);
+
+ /**
+ * Sets the target namespace of the schema to parse.
+ */
+ void setTargetNamespace(const QString &targetNamespace);
+
+ /**
+ * Sets the document URI of the schema to parse.
+ */
+ void setDocumentURI(const QUrl &uri);
+
+ /**
+ * Returns the document URI of the schema to parse.
+ */
+ QUrl documentURI() const;
+
+ /**
+ * Reimplemented from MaintainingReader, always returns @c false.
+ */
+ bool isAnyAttributeAllowed() const;
+
+ private:
+ /**
+ * Used internally to report any kind of parsing error or
+ * schema inconsistency.
+ */
+ virtual void error(const QString &msg);
+
+ void attributeContentError(const char *attributeName, const char *elementName, const QString &value, const SchemaType::Ptr &type = SchemaType::Ptr());
+
+ /**
+ * Sets the target namespace of the schema to parse.
+ */
+ void setTargetNamespaceExtended(const QString &targetNamespace);
+
+ /**
+ * This method is called for parsing the top-level <em>schema</em> object.
+ */
+ void parseSchema(ParserType parserType);
+
+ /**
+ * This method is called for parsing any top-level <em>include</em> object.
+ */
+ void parseInclude();
+
+ /**
+ * This method is called for parsing any top-level <em>import</em> object.
+ */
+ void parseImport();
+
+ /**
+ * This method is called for parsing any top-level <em>redefine</em> object.
+ */
+ void parseRedefine();
+
+ /**
+ * This method is called for parsing any <em>annotation</em> object everywhere
+ * in the schema.
+ */
+ XsdAnnotation::Ptr parseAnnotation();
+
+ /**
+ * This method is called for parsing an <em>appinfo</em> object as child of
+ * an <em>annotation</em> object.
+ */
+ XsdApplicationInformation::Ptr parseAppInfo();
+
+ /**
+ * This method is called for parsing a <em>documentation</em> object as child of
+ * an <em>annotation</em> object.
+ */
+ XsdDocumentation::Ptr parseDocumentation();
+
+ /**
+ * This method is called for parsing a <em>defaultOpenContent</em> object.
+ */
+ void parseDefaultOpenContent();
+
+ /**
+ * This method is called for parsing any top-level <em>simpleType</em> object.
+ */
+ XsdSimpleType::Ptr parseGlobalSimpleType();
+
+ /**
+ * This method is called for parsing any <em>simpleType</em> object as descendant
+ * of an <em>element</em> or <em>complexType</em> object.
+ */
+ XsdSimpleType::Ptr parseLocalSimpleType();
+
+ /**
+ * This method is called for parsing a <em>restriction</em> object as child
+ * of a <em>simpleType</em> object.
+ */
+ void parseSimpleRestriction(const XsdSimpleType::Ptr &ptr);
+
+ /**
+ * This method is called for parsing a <em>list</em> object as child
+ * of a <em>simpleType</em> object.
+ */
+ void parseList(const XsdSimpleType::Ptr &ptr);
+
+ /**
+ * This method is called for parsing a <em>union</em> object as child
+ * of a <em>simpleType</em> object.
+ */
+ void parseUnion(const XsdSimpleType::Ptr &ptr);
+
+ /**
+ * This method is called for parsing a <em>minExclusive</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseMinExclusiveFacet();
+
+ /**
+ * This method is called for parsing a <em>minInclusive</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseMinInclusiveFacet();
+
+ /**
+ * This method is called for parsing a <em>maxExclusive</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseMaxExclusiveFacet();
+
+ /**
+ * This method is called for parsing a <em>maxInclusive</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseMaxInclusiveFacet();
+
+ /**
+ * This method is called for parsing a <em>totalDigits</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseTotalDigitsFacet();
+
+ /**
+ * This method is called for parsing a <em>fractionDigits</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseFractionDigitsFacet();
+
+ /**
+ * This method is called for parsing a <em>length</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseLengthFacet();
+
+ /**
+ * This method is called for parsing a <em>minLength</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseMinLengthFacet();
+
+ /**
+ * This method is called for parsing a <em>maxLength</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseMaxLengthFacet();
+
+ /**
+ * This method is called for parsing an <em>enumeration</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseEnumerationFacet();
+
+ /**
+ * This method is called for parsing a <em>whiteSpace</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseWhiteSpaceFacet();
+
+ /**
+ * This method is called for parsing a <em>pattern</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parsePatternFacet();
+
+ /**
+ * This method is called for parsing an <em>assertion</em> object as child
+ * of a <em>restriction</em> object.
+ */
+ XsdFacet::Ptr parseAssertionFacet();
+
+ /**
+ * This method is called for parsing any top-level <em>complexType</em> object.
+ */
+ XsdComplexType::Ptr parseGlobalComplexType();
+
+ /**
+ * This method is called for parsing any <em>complexType</em> object as descendant
+ * of an <em>element</em> object.
+ */
+ XsdComplexType::Ptr parseLocalComplexType();
+
+ /**
+ * This method resolves the content type of the @p complexType for the given
+ * @p effectiveMixed value.
+ */
+ void resolveComplexContentType(const XsdComplexType::Ptr &complexType, bool effectiveMixed);
+
+ /**
+ * This method is called for parsing a <em>simpleContent</em> object as child
+ * of a <em>complexType</em> object.
+ */
+ void parseSimpleContent(const XsdComplexType::Ptr &complexType);
+
+ /**
+ * This method is called for parsing a <em>restriction</em> object as child
+ * of a <em>simpleContent</em> object.
+ */
+ void parseSimpleContentRestriction(const XsdComplexType::Ptr &complexType);
+
+ /**
+ * This method is called for parsing an <em>extension</em> object as child
+ * of a <em>simpleContent</em> object.
+ */
+ void parseSimpleContentExtension(const XsdComplexType::Ptr &complexType);
+
+ /**
+ * This method is called for parsing a <em>complexContent</em> object as child
+ * of a <em>complexType</em> object.
+ *
+ * @param complexType The complex type the complex content belongs to.
+ * @param mixed The output parameter for the mixed value.
+ */
+ void parseComplexContent(const XsdComplexType::Ptr &complexType, bool *mixed);
+
+ /**
+ * This method is called for parsing a <em>restriction</em> object as child
+ * of a <em>complexContent</em> object.
+ */
+ void parseComplexContentRestriction(const XsdComplexType::Ptr &complexType);
+
+ /**
+ * This method is called for parsing an <em>extension</em> object as child
+ * of a <em>complexContent</em> object.
+ */
+ void parseComplexContentExtension(const XsdComplexType::Ptr &complexType);
+
+ /**
+ * This method is called for parsing an <em>assert</em> object as child
+ * of a <em>complexType</em> or parsing a <em>assertion</em> facet object as
+ * child of a <em>simpleType</em>.
+ *
+ * @param nodeName Either XsdSchemaToken::Assert or XsdSchemaToken::Assertion.
+ * @param tag Either XsdTagScope::Assert or XsdTagScope::Assertion.
+ */
+ XsdAssertion::Ptr parseAssertion(const XsdSchemaToken::NodeName &nodeName, const XsdTagScope::Type &tag);
+
+ /**
+ * This method is called for parsing an <em>openContent</em> object.
+ */
+ XsdComplexType::OpenContent::Ptr parseOpenContent();
+
+ /**
+ * This method is called for parsing a top-level <em>group</em> object.
+ */
+ XsdModelGroup::Ptr parseNamedGroup();
+
+ /**
+ * This method is called for parsing a non-top-level <em>group</em> object
+ * that contains a <em>ref</em> attribute.
+ */
+ XsdTerm::Ptr parseReferredGroup(const XsdParticle::Ptr &particle);
+
+ /**
+ * This method is called for parsing an <em>all</em> object as child
+ * of a top-level <em>group</em> object.
+ *
+ * @param parent The schema component the <em>all</em> object is part of.
+ */
+ XsdModelGroup::Ptr parseAll(const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * This method is called for parsing an <em>all</em> object as descendant
+ * of a <em>complexType</em> object.
+ *
+ * @param particle The particle the <em>all</em> object belongs to.
+ * @param parent The schema component the <em>all</em> object is part of.
+ */
+ XsdModelGroup::Ptr parseLocalAll(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * This method is called for parsing a <em>choice</em> object as child
+ * of a top-level <em>group</em> object.
+ *
+ * @param parent The schema component the <em>choice</em> object is part of.
+ */
+ XsdModelGroup::Ptr parseChoice(const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * This method is called for parsing a <em>choice</em> object as descendant
+ * of a <em>complexType</em> object or a <em>choice</em> object.
+ *
+ * @param particle The particle the <em>choice</em> object belongs to.
+ * @param parent The schema component the <em>choice</em> object is part of.
+ */
+ XsdModelGroup::Ptr parseLocalChoice(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * This method is called for parsing a <em>sequence</em> object as child
+ * of a top-level <em>group</em> object.
+ *
+ * @param parent The schema component the <em>sequence</em> object is part of.
+ */
+ XsdModelGroup::Ptr parseSequence(const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * This method is called for parsing a <em>sequence</em> object as descendant
+ * of a <em>complexType</em> object or a <em>sequence</em> object.
+ *
+ * @param particle The particle the <em>sequence</em> object belongs to.
+ * @param parent The schema component the <em>sequence</em> object is part of.
+ */
+ XsdModelGroup::Ptr parseLocalSequence(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * A helper method that parses the minOccurs and maxOccurs constraints for
+ * the given @p particle that has the given @p tagName.
+ */
+ bool parseMinMaxConstraint(const XsdParticle::Ptr &particle, const char* tagName);
+
+ /**
+ * This method is called for parsing any top-level <em>attribute</em> object.
+ */
+ XsdAttribute::Ptr parseGlobalAttribute();
+
+ /**
+ * This method is called for parsing any non-top-level <em>attribute</em> object as a
+ * descendant of a <em>complexType</em> object or an <em>attributeGroup</em> object.
+ *
+ * @param parent The parent component the <em>attribute</em> object is part of.
+ */
+ XsdAttributeUse::Ptr parseLocalAttribute(const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * This method is called for parsing a top-level <em>attributeGroup</em> object.
+ */
+ XsdAttributeGroup::Ptr parseNamedAttributeGroup();
+
+ /**
+ * This method is called for parsing a non-top-level <em>attributeGroup</em> object
+ * that contains a <em>ref</em> attribute.
+ */
+ XsdAttributeUse::Ptr parseReferredAttributeGroup();
+
+ /**
+ * This method is called for parsing any top-level <em>element</em> object.
+ */
+ XsdElement::Ptr parseGlobalElement();
+
+ /**
+ * This method is called for parsing any non-top-level <em>element</em> object as a
+ * descendant of a <em>complexType</em> object or a <em>group</em> object.
+ *
+ * @param particle The particle the <em>element</em> object belongs to.
+ * @param parent The parent component the <em>element</em> object is part of.
+ */
+ XsdTerm::Ptr parseLocalElement(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent);
+
+ /**
+ * This method is called for parsing a <em>unique</em> object as child of an <em>element</em> object.
+ */
+ XsdIdentityConstraint::Ptr parseUnique();
+
+ /**
+ * This method is called for parsing a <em>key</em> object as child of an <em>element</em> object.
+ */
+ XsdIdentityConstraint::Ptr parseKey();
+
+ /**
+ * This method is called for parsing a <em>keyref</em> object as child of an <em>element</em> object.
+ */
+ XsdIdentityConstraint::Ptr parseKeyRef(const XsdElement::Ptr &element);
+
+ /**
+ * This method is called for parsing a <em>selector</em> object as child of an <em>unique</em> object,
+ * <em>key</em> object or <em>keyref</em> object,
+ *
+ * @param ptr The identity constraint it belongs to.
+ */
+ void parseSelector(const XsdIdentityConstraint::Ptr &ptr);
+
+ /**
+ * This method is called for parsing a <em>field</em> object as child of an <em>unique</em> object,
+ * <em>key</em> object or <em>keyref</em> object,
+ *
+ * @param ptr The identity constraint it belongs to.
+ */
+ void parseField(const XsdIdentityConstraint::Ptr &ptr);
+
+ /**
+ * This method is called for parsing an <em>alternative</em> object inside an <em>element</em> object.
+ */
+ XsdAlternative::Ptr parseAlternative();
+
+ /**
+ * This method is called for parsing a top-level <em>notation</em> object.
+ */
+ XsdNotation::Ptr parseNotation();
+
+ /**
+ * This method is called for parsing an <em>any</em> object somewhere in
+ * the schema.
+ *
+ * @param particle The particle the <em>any</em> object belongs to.
+ */
+ XsdWildcard::Ptr parseAny(const XsdParticle::Ptr &particle);
+
+ /**
+ * This method is called for parsing an <em>anyAttribute</em> object somewhere in
+ * the schema.
+ */
+ XsdWildcard::Ptr parseAnyAttribute();
+
+ /**
+ * This method is called for parsing unknown object as descendant of the <em>annotation</em> object.
+ */
+ void parseUnknownDocumentation();
+
+ /**
+ * This method is called for parsing unknown object in the schema.
+ */
+ void parseUnknown();
+
+ /**
+ * Returnes an source location for the current position.
+ */
+ QSourceLocation currentSourceLocation() const;
+
+ /**
+ * Converts a @p qualified name into a QXmlName @p name and does some error handling.
+ */
+ void convertName(const QString &qualified, NamespaceSupport::NameType type, QXmlName &name);
+
+ /**
+ * A helper method that reads in a 'name' attribute and checks it for syntactic errors.
+ */
+ inline QString readNameAttribute(const char *elementName);
+
+ /**
+ * A helper method that reads in an attribute that contains an QName and
+ * checks it for syntactic errors.
+ */
+ inline QString readQNameAttribute(const QString &typeAttribute, const char *elementName);
+
+ /**
+ * A helper method that reads in a namespace attribute and checks for syntactic errors.
+ */
+ inline QString readNamespaceAttribute(const QString &attributeName, const char *elementName);
+
+ /**
+ * A helper method that reads the final attribute and does correct handling of schema default definitions.
+ */
+ inline SchemaType::DerivationConstraints readDerivationConstraintAttribute(const SchemaType::DerivationConstraints &allowedConstraints, const char *elementName);
+
+ /**
+ * A helper method that reads the block attribute and does correct handling of schema default definitions.
+ */
+ inline NamedSchemaComponent::BlockingConstraints readBlockingConstraintAttribute(const NamedSchemaComponent::BlockingConstraints &allowedConstraints, const char *elementName);
+
+ /**
+ * A helper method that reads all components for a xpath expression for the current scope.
+ */
+ XsdXPathExpression::Ptr readXPathExpression(const char *elementName);
+
+ /**
+ * Describes the type of XPath that is allowed by the readXPathAttribute method.
+ */
+ enum XPathType {
+ XPath20,
+ XPathSelector,
+ XPathField
+ };
+
+ /**
+ * A helper method that reads an attribute that represents a xpath query and does basic
+ * validation.
+ */
+ QString readXPathAttribute(const QString &attributeName, XPathType type, const char *elementName);
+
+ /**
+ * A helper method that reads in an "id" attribute, checks it for syntactic errors
+ * and tests whether a component with the same id has already been parsed.
+ */
+ inline void validateIdAttribute(const char *elementName);
+
+ /**
+ * Adds an @p element to the schema and checks for duplicated entries.
+ */
+ void addElement(const XsdElement::Ptr &element);
+
+ /**
+ * Adds an @p attribute to the schema and checks for duplicated entries.
+ */
+ void addAttribute(const XsdAttribute::Ptr &attribute);
+
+ /**
+ * Adds a @p type to the schema and checks for duplicated entries.
+ */
+ void addType(const SchemaType::Ptr &type);
+
+ /**
+ * Adds an anonymous @p type to the schema and checks for duplicated entries.
+ */
+ void addAnonymousType(const SchemaType::Ptr &type);
+
+ /**
+ * Adds an attribute @p group to the schema and checks for duplicated entries.
+ */
+ void addAttributeGroup(const XsdAttributeGroup::Ptr &group);
+
+ /**
+ * Adds an element @p group to the schema and checks for duplicated entries.
+ */
+ void addElementGroup(const XsdModelGroup::Ptr &group);
+
+ /**
+ * Adds a @p notation to the schema and checks for duplicated entries.
+ */
+ void addNotation(const XsdNotation::Ptr &notation);
+
+ /**
+ * Adds an identity @p constraint to the schema and checks for duplicated entries.
+ */
+ void addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint);
+
+ /**
+ * Adds the @p facet to the list of @p facets for @p type and checks for duplicates.
+ */
+ void addFacet(const XsdFacet::Ptr &facet, XsdFacet::Hash &facets, const SchemaType::Ptr &type);
+
+ /**
+ * Sets up the state machines for validating the right occurrence of xml elements.
+ */
+ void setupStateMachines();
+
+ /**
+ * Sets up a list of names of known builtin types.
+ */
+ void setupBuiltinTypeNames();
+
+ /**
+ * Checks whether the given @p tag is equal to the given @p token and
+ * the given @p namespaceToken is the XML Schema namespace.
+ */
+ inline bool isSchemaTag(XsdSchemaToken::NodeName tag, XsdSchemaToken::NodeName token, XsdSchemaToken::NodeName namespaceToken) const;
+
+ XsdSchemaContext::Ptr m_context;
+ XsdSchemaParserContext::Ptr m_parserContext;
+ NamePool::Ptr m_namePool;
+ NamespaceSupport m_namespaceSupport;
+ XsdSchemaResolver::Ptr m_schemaResolver;
+ XsdSchema::Ptr m_schema;
+
+ QString m_targetNamespace;
+ QString m_attributeFormDefault;
+ QString m_elementFormDefault;
+ QString m_blockDefault;
+ QString m_finalDefault;
+ QString m_xpathDefaultNamespace;
+ QXmlName m_defaultAttributes;
+ XsdComplexType::OpenContent::Ptr m_defaultOpenContent;
+ bool m_defaultOpenContentAppliesToEmpty;
+
+ NamespaceSet m_includedSchemas;
+ NamespaceSet m_importedSchemas;
+ NamespaceSet m_redefinedSchemas;
+ QUrl m_documentURI;
+ XsdIdCache::Ptr m_idCache;
+ QHash<XsdTagScope::Type, XsdStateMachine<XsdSchemaToken::NodeName> > m_stateMachines;
+ ComponentLocationHash m_componentLocationHash;
+ QSet<QXmlName> m_builtinTypeNames;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp b/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp
new file mode 100644
index 0000000..abd6262
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp
@@ -0,0 +1,1110 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemaparser_p.h"
+
+#include "qbuiltintypes_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+/**
+ * @page using_dfa_for_schema Using DFA for validation of correct XML tag occurrence
+ *
+ * This page describes how to use DFAs for validating that the XML child tags of an
+ * XML parent tag occur in the right order.
+ *
+ * To validate the occurence of XML tags one need a regular expression that describes
+ * which tags can appear how often in what context. For example the regular expression
+ * of the global <em>attribute</em> tag in XML Schema is (annotation?, simpleType?).
+ * That means the <em>attribute</em> tag can contain an <em>annotation</em> tag followed
+ * by a <em>simpleType</em> tag, or just one <em>simpleType</em> tag and even no child
+ * tag at all.
+ * So the regular expression describes some kind of language and all the various occurrences
+ * of the child tags can be seen as words of that language.
+ * We can create a DFA now, that accepts all words (and only these words) of that language
+ * and whenever we want to check if a sequence of child tags belongs to the language,
+ * we test if the sequence passes the DFA successfully.
+ *
+ * The following example shows how to create the DFA for the regular expression method
+ * above.
+ *
+ * \dotfile GlobalAttribute_diagram.dot
+ *
+ * At first we need a start state (1), that's the state the DFA is before it
+ * starts running. As our regular expression allows that there are no child tags, the
+ * start state is an end state as well (marked by the double circle).
+ * Now we fetch the first token from the XML file (let's assume it is an <em>annotation</em> tag)
+ * and check if there is an edge labled with the tag name leaving the current state of the DFA.
+ * If there is no such edge, the input doesn't fullfill the rules of the regular expression,
+ * so we throw an error. Otherwise we follow that edge and the DFA is set to the new state (2) the
+ * edge points to. Now we fetch the next token from the XML file and do the previous steps again.
+ * If there is no further input from the XML file, we check whether the DFA is in an end state and
+ * throw an error if not.
+ *
+ * So the algorithm for checking is quite simple, the whole logic is encoded in the DFA and creating
+ * one for a regular expression is sometimes not easy, however the ones for XML Schema are straight
+ * forward.
+ *
+ * <h2>Legend:</h2>
+ * \dotfile legend.dot
+ * <br>
+ *
+ * <h2>DFA for <em>all</em> tag</h2>
+ * \dotfile All_diagram.dot
+ * <br>
+ * <h2>DFA for <em>alternative</em> tag</h2>
+ * \dotfile Alternative_diagram.dot
+ * <br>
+ * <h2>DFA for <em>annotation</em> tag</h2>
+ * \dotfile Annotation_diagram.dot
+ * <br>
+ * <h2>DFA for <em>anyAttribute</em> tag</h2>
+ * \dotfile AnyAttribute_diagram.dot
+ * <br>
+ * <h2>DFA for <em>any</em> tag</h2>
+ * \dotfile Any_diagram.dot
+ * <br>
+ * <h2>DFA for <em>assert</em> tag</h2>
+ * \dotfile Assert_diagram.dot
+ * <br>
+ * <h2>DFA for <em>choice</em> tag</h2>
+ * \dotfile Choice_diagram.dot
+ * <br>
+ * <h2>DFA for <em>complexContent</em> tag</h2>
+ * \dotfile ComplexContent_diagram.dot
+ * <br>
+ * <h2>DFA for <em>extension</em> tag inside a <em>complexContent</em> tag</h2>
+ * \dotfile ComplexContentExtension_diagram.dot
+ * <br>
+ * <h2>DFA for <em>restriction</em> tag inside a <em>complexContent</em> tag</h2>
+ * \dotfile ComplexContentRestriction_diagram.dot
+ * <br>
+ * <h2>DFA for <em>defaultOpenContent</em> tag</h2>
+ * \dotfile DefaultOpenContent_diagram.dot
+ * <br>
+ * <h2>DFA for <em>enumeration</em> tag</h2>
+ * \dotfile EnumerationFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>field</em> tag</h2>
+ * \dotfile Field_diagram.dot
+ * <br>
+ * <h2>DFA for <em>fractionDigits</em> tag</h2>
+ * \dotfile FractionDigitsFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>attribute</em> tag</h2>
+ * \dotfile GlobalAttribute_diagram.dot
+ * <br>
+ * <h2>DFA for <em>complexType</em> tag</h2>
+ * \dotfile GlobalComplexType_diagram.dot
+ * <br>
+ * <h2>DFA for <em>element</em> tag</h2>
+ * \dotfile GlobalElement_diagram.dot
+ * <br>
+ * <h2>DFA for <em>simpleType</em> tag</h2>
+ * \dotfile GlobalSimpleType_diagram.dot
+ * <br>
+ * <h2>DFA for <em>import</em> tag</h2>
+ * \dotfile Import_diagram.dot
+ * <br>
+ * <h2>DFA for <em>include</em> tag</h2>
+ * \dotfile Include_diagram.dot
+ * <br>
+ * <h2>DFA for <em>key</em> tag</h2>
+ * \dotfile Key_diagram.dot
+ * <br>
+ * <h2>DFA for <em>keyref</em> tag</h2>
+ * \dotfile KeyRef_diagram.dot
+ * <br>
+ * <h2>DFA for <em>length</em> tag</h2>
+ * \dotfile LengthFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>list</em> tag</h2>
+ * \dotfile List_diagram.dot
+ * <br>
+ * <h2>DFA for <em>all</em> tag</h2>
+ * \dotfile LocalAll_diagram.dot
+ * <br>
+ * <h2>DFA for <em>attribute</em> tag</h2>
+ * \dotfile LocalAttribute_diagram.dot
+ * <br>
+ * <h2>DFA for <em>choice</em> tag</h2>
+ * \dotfile LocalChoice_diagram.dot
+ * <br>
+ * <h2>DFA for <em>complexType</em> tag</h2>
+ * \dotfile LocalComplexType_diagram.dot
+ * <br>
+ * <h2>DFA for <em>element</em> tag</h2>
+ * \dotfile LocalElement_diagram.dot
+ * <br>
+ * <h2>DFA for <em>sequence</em> tag</h2>
+ * \dotfile LocalSequence_diagram.dot
+ * <br>
+ * <h2>DFA for <em>simpleType</em> tag that </h2>
+ * \dotfile LocalSimpleType_diagram.dot
+ * <br>
+ * <h2>DFA for <em>maxExclusive</em> tag</h2>
+ * \dotfile MaxExclusiveFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>maxInclusive</em> tag</h2>
+ * \dotfile MaxInclusiveFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>maxLength</em> tag</h2>
+ * \dotfile MaxLengthFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>minExclusive</em> tag</h2>
+ * \dotfile MinExclusiveFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>minInclusive</em> tag</h2>
+ * \dotfile MinInclusiveFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>minLength</em> tag</h2>
+ * \dotfile MinLengthFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>attributeGroup</em> tag without <em>ref</em> attribute</h2>
+ * \dotfile NamedAttributeGroup_diagram.dot
+ * <br>
+ * <h2>DFA for <em>group</em> tag without <em>ref</em> attribute</h2>
+ * \dotfile NamedGroup_diagram.dot
+ * <br>
+ * <h2>DFA for <em>notation</em> tag</h2>
+ * \dotfile Notation_diagram.dot
+ * <br>
+ * <h2>DFA for <em>override</em> tag</h2>
+ * \dotfile Override_diagram.dot
+ * <br>
+ * <h2>DFA for <em>pattern</em> tag</h2>
+ * \dotfile PatternFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>redefine</em> tag</h2>
+ * \dotfile Redefine_diagram.dot
+ * <br>
+ * <h2>DFA for <em>attributeGroup</em> tag with <em>ref</em> attribute</h2>
+ * \dotfile ReferredAttributeGroup_diagram.dot
+ * <br>
+ * <h2>DFA for <em>group</em> tag with <em>ref</em> attribute</h2>
+ * \dotfile ReferredGroup_diagram.dot
+ * <br>
+ * <h2>DFA for <em>schema</em> tag</h2>
+ * \dotfile Schema_diagram.dot
+ * <br>
+ * <h2>DFA for <em>selector</em> tag</h2>
+ * \dotfile Selector_diagram.dot
+ * <br>
+ * <h2>DFA for <em>sequence</em> tag</h2>
+ * \dotfile Sequence_diagram.dot
+ * <br>
+ * <h2>DFA for <em>simpleContent</em> tag</h2>
+ * \dotfile SimpleContent_diagram.dot
+ * <br>
+ * <h2>DFA for <em>extension</em> tag inside a <em>simpleContent</em> tag</h2>
+ * \dotfile SimpleContentExtension_diagram.dot
+ * <br>
+ * <h2>DFA for <em>restriction</em> tag inside a <em>simpleContent</em> tag</h2>
+ * \dotfile SimpleContentRestriction_diagram.dot
+ * <br>
+ * <h2>DFA for <em>restriction</em> tag inside a <em>simpleType</em> tag</h2>
+ * \dotfile SimpleRestriction_diagram.dot
+ * <br>
+ * <h2>DFA for <em>totalDigits</em> tag</h2>
+ * \dotfile TotalDigitsFacet_diagram.dot
+ * <br>
+ * <h2>DFA for <em>union</em> tag</h2>
+ * \dotfile Union_diagram.dot
+ * <br>
+ * <h2>DFA for <em>unique</em> tag</h2>
+ * \dotfile Unique_diagram.dot
+ * <br>
+ * <h2>DFA for <em>whiteSpace</em> tag</h2>
+ * \dotfile WhiteSpaceFacet_diagram.dot
+ */
+
+void XsdSchemaParser::setupStateMachines()
+{
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, simpleType?) : attribute
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s2);
+
+ m_stateMachines.insert(XsdTagScope::GlobalAttribute, machine);
+ m_stateMachines.insert(XsdTagScope::LocalAttribute, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, ((simpleType | complexType)?, alternative*, (unique | key | keyref)*)) : element
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s3 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s4 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(startState, XsdSchemaToken::ComplexType, s2);
+ machine.addTransition(startState, XsdSchemaToken::Alternative, s3);
+ machine.addTransition(startState, XsdSchemaToken::Unique, s4);
+ machine.addTransition(startState, XsdSchemaToken::Key, s4);
+ machine.addTransition(startState, XsdSchemaToken::Keyref, s4);
+
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(s1, XsdSchemaToken::ComplexType, s2);
+ machine.addTransition(s1, XsdSchemaToken::Alternative, s3);
+ machine.addTransition(s1, XsdSchemaToken::Unique, s4);
+ machine.addTransition(s1, XsdSchemaToken::Key, s4);
+ machine.addTransition(s1, XsdSchemaToken::Keyref, s4);
+
+ machine.addTransition(s2, XsdSchemaToken::Alternative, s3);
+ machine.addTransition(s2, XsdSchemaToken::Unique, s4);
+ machine.addTransition(s2, XsdSchemaToken::Key, s4);
+ machine.addTransition(s2, XsdSchemaToken::Keyref, s4);
+
+ machine.addTransition(s3, XsdSchemaToken::Alternative, s3);
+ machine.addTransition(s3, XsdSchemaToken::Unique, s4);
+ machine.addTransition(s3, XsdSchemaToken::Key, s4);
+ machine.addTransition(s3, XsdSchemaToken::Keyref, s4);
+
+ machine.addTransition(s4, XsdSchemaToken::Unique, s4);
+ machine.addTransition(s4, XsdSchemaToken::Key, s4);
+ machine.addTransition(s4, XsdSchemaToken::Keyref, s4);
+
+ m_stateMachines.insert(XsdTagScope::GlobalElement, machine);
+ m_stateMachines.insert(XsdTagScope::LocalElement, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (simpleContent | complexContent | (openContent?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?), assert*))) : complexType
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s3 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s4 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s5 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s6 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s7 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleContent, s2);
+ machine.addTransition(startState, XsdSchemaToken::ComplexContent, s2);
+ machine.addTransition(startState, XsdSchemaToken::OpenContent, s3);
+ machine.addTransition(startState, XsdSchemaToken::Group, s4);
+ machine.addTransition(startState, XsdSchemaToken::All, s4);
+ machine.addTransition(startState, XsdSchemaToken::Choice, s4);
+ machine.addTransition(startState, XsdSchemaToken::Sequence, s4);
+ machine.addTransition(startState, XsdSchemaToken::Attribute, s5);
+ machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s5);
+ machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s6);
+ machine.addTransition(startState, XsdSchemaToken::Assert, s7);
+
+ machine.addTransition(s1, XsdSchemaToken::SimpleContent, s2);
+ machine.addTransition(s1, XsdSchemaToken::ComplexContent, s2);
+ machine.addTransition(s1, XsdSchemaToken::OpenContent, s3);
+ machine.addTransition(s1, XsdSchemaToken::Group, s4);
+ machine.addTransition(s1, XsdSchemaToken::All, s4);
+ machine.addTransition(s1, XsdSchemaToken::Choice, s4);
+ machine.addTransition(s1, XsdSchemaToken::Sequence, s4);
+ machine.addTransition(s1, XsdSchemaToken::Attribute, s5);
+ machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s5);
+ machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s6);
+ machine.addTransition(s1, XsdSchemaToken::Assert, s7);
+
+ machine.addTransition(s3, XsdSchemaToken::Group, s4);
+ machine.addTransition(s3, XsdSchemaToken::All, s4);
+ machine.addTransition(s3, XsdSchemaToken::Choice, s4);
+ machine.addTransition(s3, XsdSchemaToken::Sequence, s4);
+ machine.addTransition(s3, XsdSchemaToken::Attribute, s5);
+ machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s5);
+ machine.addTransition(s3, XsdSchemaToken::AnyAttribute, s6);
+ machine.addTransition(s3, XsdSchemaToken::Assert, s7);
+
+ machine.addTransition(s4, XsdSchemaToken::Attribute, s5);
+ machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s5);
+ machine.addTransition(s4, XsdSchemaToken::AnyAttribute, s6);
+ machine.addTransition(s4, XsdSchemaToken::Assert, s7);
+
+ machine.addTransition(s5, XsdSchemaToken::Attribute, s5);
+ machine.addTransition(s5, XsdSchemaToken::AttributeGroup, s5);
+ machine.addTransition(s5, XsdSchemaToken::AnyAttribute, s6);
+ machine.addTransition(s5, XsdSchemaToken::Assert, s7);
+
+ machine.addTransition(s6, XsdSchemaToken::Assert, s7);
+
+ machine.addTransition(s7, XsdSchemaToken::Assert, s7);
+
+ m_stateMachines.insert(XsdTagScope::GlobalComplexType, machine);
+ m_stateMachines.insert(XsdTagScope::LocalComplexType, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (restriction | extension)) : simpleContent/complexContent
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::InternalState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::Restriction, s2);
+ machine.addTransition(startState, XsdSchemaToken::Extension, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::Restriction, s2);
+ machine.addTransition(s1, XsdSchemaToken::Extension, s2);
+
+ m_stateMachines.insert(XsdTagScope::SimpleContent, machine);
+ m_stateMachines.insert(XsdTagScope::ComplexContent, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern | assertion)*)?, ((attribute | attributeGroup)*, anyAttribute?), assert*) : simpleContent restriction
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s3 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s4 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s5 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s6 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(startState, XsdSchemaToken::MinExclusive, s3);
+ machine.addTransition(startState, XsdSchemaToken::MinInclusive, s3);
+ machine.addTransition(startState, XsdSchemaToken::MaxExclusive, s3);
+ machine.addTransition(startState, XsdSchemaToken::MaxInclusive, s3);
+ machine.addTransition(startState, XsdSchemaToken::TotalDigits, s3);
+ machine.addTransition(startState, XsdSchemaToken::FractionDigits, s3);
+ machine.addTransition(startState, XsdSchemaToken::Length, s3);
+ machine.addTransition(startState, XsdSchemaToken::MinLength, s3);
+ machine.addTransition(startState, XsdSchemaToken::MaxLength, s3);
+ machine.addTransition(startState, XsdSchemaToken::Enumeration, s3);
+ machine.addTransition(startState, XsdSchemaToken::WhiteSpace, s3);
+ machine.addTransition(startState, XsdSchemaToken::Pattern, s3);
+ machine.addTransition(startState, XsdSchemaToken::Assertion, s3);
+ machine.addTransition(startState, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(startState, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(s1, XsdSchemaToken::MinExclusive, s3);
+ machine.addTransition(s1, XsdSchemaToken::MinInclusive, s3);
+ machine.addTransition(s1, XsdSchemaToken::MaxExclusive, s3);
+ machine.addTransition(s1, XsdSchemaToken::MaxInclusive, s3);
+ machine.addTransition(s1, XsdSchemaToken::TotalDigits, s3);
+ machine.addTransition(s1, XsdSchemaToken::FractionDigits, s3);
+ machine.addTransition(s1, XsdSchemaToken::Length, s3);
+ machine.addTransition(s1, XsdSchemaToken::MinLength, s3);
+ machine.addTransition(s1, XsdSchemaToken::MaxLength, s3);
+ machine.addTransition(s1, XsdSchemaToken::Enumeration, s3);
+ machine.addTransition(s1, XsdSchemaToken::WhiteSpace, s3);
+ machine.addTransition(s1, XsdSchemaToken::Pattern, s3);
+ machine.addTransition(s1, XsdSchemaToken::Assertion, s3);
+ machine.addTransition(s1, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(s1, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s2, XsdSchemaToken::MinExclusive, s3);
+ machine.addTransition(s2, XsdSchemaToken::MinInclusive, s3);
+ machine.addTransition(s2, XsdSchemaToken::MaxExclusive, s3);
+ machine.addTransition(s2, XsdSchemaToken::MaxInclusive, s3);
+ machine.addTransition(s2, XsdSchemaToken::TotalDigits, s3);
+ machine.addTransition(s2, XsdSchemaToken::FractionDigits, s3);
+ machine.addTransition(s2, XsdSchemaToken::Length, s3);
+ machine.addTransition(s2, XsdSchemaToken::MinLength, s3);
+ machine.addTransition(s2, XsdSchemaToken::MaxLength, s3);
+ machine.addTransition(s2, XsdSchemaToken::Enumeration, s3);
+ machine.addTransition(s2, XsdSchemaToken::WhiteSpace, s3);
+ machine.addTransition(s2, XsdSchemaToken::Pattern, s3);
+ machine.addTransition(s2, XsdSchemaToken::Assertion, s3);
+ machine.addTransition(s2, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(s2, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s3, XsdSchemaToken::MinExclusive, s3);
+ machine.addTransition(s3, XsdSchemaToken::MinInclusive, s3);
+ machine.addTransition(s3, XsdSchemaToken::MaxExclusive, s3);
+ machine.addTransition(s3, XsdSchemaToken::MaxInclusive, s3);
+ machine.addTransition(s3, XsdSchemaToken::TotalDigits, s3);
+ machine.addTransition(s3, XsdSchemaToken::FractionDigits, s3);
+ machine.addTransition(s3, XsdSchemaToken::Length, s3);
+ machine.addTransition(s3, XsdSchemaToken::MinLength, s3);
+ machine.addTransition(s3, XsdSchemaToken::MaxLength, s3);
+ machine.addTransition(s3, XsdSchemaToken::Enumeration, s3);
+ machine.addTransition(s3, XsdSchemaToken::WhiteSpace, s3);
+ machine.addTransition(s3, XsdSchemaToken::Pattern, s3);
+ machine.addTransition(s3, XsdSchemaToken::Assertion, s3);
+ machine.addTransition(s3, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s3, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(s3, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s4, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s4, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(s4, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s5, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s6, XsdSchemaToken::Assert, s6);
+
+ m_stateMachines.insert(XsdTagScope::SimpleContentRestriction, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, ((attribute | attributeGroup)*, anyAttribute?), assert*) : simple content extension
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s3 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s4 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::Attribute, s2);
+ machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s2);
+ machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s3);
+ machine.addTransition(startState, XsdSchemaToken::Assert, s4);
+
+ machine.addTransition(s1, XsdSchemaToken::Attribute, s2);
+ machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s2);
+ machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s3);
+ machine.addTransition(s1, XsdSchemaToken::Assert, s4);
+
+ machine.addTransition(s2, XsdSchemaToken::Attribute, s2);
+ machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s2);
+ machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s3);
+ machine.addTransition(s2, XsdSchemaToken::Assert, s4);
+
+ machine.addTransition(s3, XsdSchemaToken::Assert, s4);
+
+ machine.addTransition(s4, XsdSchemaToken::Assert, s4);
+
+ m_stateMachines.insert(XsdTagScope::SimpleContentExtension, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, openContent?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?), assert*)) : complex content restriction/complex content extension
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s3 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s4 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s5 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s6 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::OpenContent, s2);
+ machine.addTransition(startState, XsdSchemaToken::Group, s3);
+ machine.addTransition(startState, XsdSchemaToken::All, s3);
+ machine.addTransition(startState, XsdSchemaToken::Choice, s3);
+ machine.addTransition(startState, XsdSchemaToken::Sequence, s3);
+ machine.addTransition(startState, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(startState, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s1, XsdSchemaToken::OpenContent, s2);
+ machine.addTransition(s1, XsdSchemaToken::Group, s3);
+ machine.addTransition(s1, XsdSchemaToken::All, s3);
+ machine.addTransition(s1, XsdSchemaToken::Choice, s3);
+ machine.addTransition(s1, XsdSchemaToken::Sequence, s3);
+ machine.addTransition(s1, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(s1, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s2, XsdSchemaToken::Group, s3);
+ machine.addTransition(s2, XsdSchemaToken::All, s3);
+ machine.addTransition(s2, XsdSchemaToken::Choice, s3);
+ machine.addTransition(s2, XsdSchemaToken::Sequence, s3);
+ machine.addTransition(s2, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(s2, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s3, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s3, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(s3, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s4, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s4, XsdSchemaToken::AnyAttribute, s5);
+ machine.addTransition(s4, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s5, XsdSchemaToken::Assert, s6);
+
+ machine.addTransition(s6, XsdSchemaToken::Assert, s6);
+
+ m_stateMachines.insert(XsdTagScope::ComplexContentRestriction, machine);
+ m_stateMachines.insert(XsdTagScope::ComplexContentExtension, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, ((attribute | attributeGroup)*, anyAttribute?)) : named attribute group
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s3 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::Attribute, s2);
+ machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s2);
+ machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s3);
+
+ machine.addTransition(s1, XsdSchemaToken::Attribute, s2);
+ machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s2);
+ machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s3);
+
+ machine.addTransition(s2, XsdSchemaToken::Attribute, s2);
+ machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s2);
+ machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s3);
+
+ m_stateMachines.insert(XsdTagScope::NamedAttributeGroup, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (all | choice | sequence)?) : group
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::All, s2);
+ machine.addTransition(startState, XsdSchemaToken::Choice, s2);
+ machine.addTransition(startState, XsdSchemaToken::Sequence, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::All, s2);
+ machine.addTransition(s1, XsdSchemaToken::Choice, s2);
+ machine.addTransition(s1, XsdSchemaToken::Sequence, s2);
+
+ m_stateMachines.insert(XsdTagScope::NamedGroup, machine);
+ m_stateMachines.insert(XsdTagScope::ReferredGroup, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (element | any)*) : all
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::Element, s2);
+ machine.addTransition(startState, XsdSchemaToken::Any, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::Element, s2);
+ machine.addTransition(s1, XsdSchemaToken::Any, s2);
+
+ machine.addTransition(s2, XsdSchemaToken::Element, s2);
+ machine.addTransition(s2, XsdSchemaToken::Any, s2);
+
+ m_stateMachines.insert(XsdTagScope::All, machine);
+ m_stateMachines.insert(XsdTagScope::LocalAll, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (element | group | choice | sequence | any)*) : choice sequence
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::Element, s2);
+ machine.addTransition(startState, XsdSchemaToken::Group, s2);
+ machine.addTransition(startState, XsdSchemaToken::Choice, s2);
+ machine.addTransition(startState, XsdSchemaToken::Sequence, s2);
+ machine.addTransition(startState, XsdSchemaToken::Any, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::Element, s2);
+ machine.addTransition(s1, XsdSchemaToken::Group, s2);
+ machine.addTransition(s1, XsdSchemaToken::Choice, s2);
+ machine.addTransition(s1, XsdSchemaToken::Sequence, s2);
+ machine.addTransition(s1, XsdSchemaToken::Any, s2);
+
+ machine.addTransition(s2, XsdSchemaToken::Element, s2);
+ machine.addTransition(s2, XsdSchemaToken::Group, s2);
+ machine.addTransition(s2, XsdSchemaToken::Choice, s2);
+ machine.addTransition(s2, XsdSchemaToken::Sequence, s2);
+ machine.addTransition(s2, XsdSchemaToken::Any, s2);
+
+ m_stateMachines.insert(XsdTagScope::Choice, machine);
+ m_stateMachines.insert(XsdTagScope::LocalChoice, machine);
+ m_stateMachines.insert(XsdTagScope::Sequence, machine);
+ m_stateMachines.insert(XsdTagScope::LocalSequence, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?) : any/selector/field/notation/include/import/referred attribute group/anyAttribute/all facets/assert
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+
+ m_stateMachines.insert(XsdTagScope::Any, machine);
+ m_stateMachines.insert(XsdTagScope::Selector, machine);
+ m_stateMachines.insert(XsdTagScope::Field, machine);
+ m_stateMachines.insert(XsdTagScope::Notation, machine);
+ m_stateMachines.insert(XsdTagScope::Include, machine);
+ m_stateMachines.insert(XsdTagScope::Import, machine);
+ m_stateMachines.insert(XsdTagScope::ReferredAttributeGroup, machine);
+ m_stateMachines.insert(XsdTagScope::AnyAttribute, machine);
+ m_stateMachines.insert(XsdTagScope::MinExclusiveFacet, machine);
+ m_stateMachines.insert(XsdTagScope::MinInclusiveFacet, machine);
+ m_stateMachines.insert(XsdTagScope::MaxExclusiveFacet, machine);
+ m_stateMachines.insert(XsdTagScope::MaxInclusiveFacet, machine);
+ m_stateMachines.insert(XsdTagScope::TotalDigitsFacet, machine);
+ m_stateMachines.insert(XsdTagScope::FractionDigitsFacet, machine);
+ m_stateMachines.insert(XsdTagScope::LengthFacet, machine);
+ m_stateMachines.insert(XsdTagScope::MinLengthFacet, machine);
+ m_stateMachines.insert(XsdTagScope::MaxLengthFacet, machine);
+ m_stateMachines.insert(XsdTagScope::EnumerationFacet, machine);
+ m_stateMachines.insert(XsdTagScope::WhiteSpaceFacet, machine);
+ m_stateMachines.insert(XsdTagScope::PatternFacet, machine);
+ m_stateMachines.insert(XsdTagScope::Assert, machine);
+ m_stateMachines.insert(XsdTagScope::Assertion, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (selector, field+)) : unique/key/keyref
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::InternalState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::InternalState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s3 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::Selector, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::Selector, s2);
+ machine.addTransition(s2, XsdSchemaToken::Field, s3);
+ machine.addTransition(s3, XsdSchemaToken::Field, s3);
+
+ m_stateMachines.insert(XsdTagScope::Unique, machine);
+ m_stateMachines.insert(XsdTagScope::Key, machine);
+ m_stateMachines.insert(XsdTagScope::KeyRef, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (simpleType | complexType)?) : alternative
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(startState, XsdSchemaToken::ComplexType, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(s1, XsdSchemaToken::ComplexType, s2);
+
+ m_stateMachines.insert(XsdTagScope::Alternative, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (appinfo | documentation)* : annotation
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Appinfo, s1);
+ machine.addTransition(startState, XsdSchemaToken::Documentation, s1);
+
+ machine.addTransition(s1, XsdSchemaToken::Appinfo, s1);
+ machine.addTransition(s1, XsdSchemaToken::Documentation, s1);
+
+ m_stateMachines.insert(XsdTagScope::Annotation, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (restriction | list | union)) : simpleType
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::InternalState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::Restriction, s2);
+ machine.addTransition(startState, XsdSchemaToken::List, s2);
+ machine.addTransition(startState, XsdSchemaToken::Union, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::Restriction, s2);
+ machine.addTransition(s1, XsdSchemaToken::List, s2);
+ machine.addTransition(s1, XsdSchemaToken::Union, s2);
+
+ m_stateMachines.insert(XsdTagScope::GlobalSimpleType, machine);
+ m_stateMachines.insert(XsdTagScope::LocalSimpleType, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern | assertion)*)) : simple type restriction
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s3 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(startState, XsdSchemaToken::MinExclusive, s3);
+ machine.addTransition(startState, XsdSchemaToken::MinInclusive, s3);
+ machine.addTransition(startState, XsdSchemaToken::MaxExclusive, s3);
+ machine.addTransition(startState, XsdSchemaToken::MaxInclusive, s3);
+ machine.addTransition(startState, XsdSchemaToken::TotalDigits, s3);
+ machine.addTransition(startState, XsdSchemaToken::FractionDigits, s3);
+ machine.addTransition(startState, XsdSchemaToken::Length, s3);
+ machine.addTransition(startState, XsdSchemaToken::MinLength, s3);
+ machine.addTransition(startState, XsdSchemaToken::MaxLength, s3);
+ machine.addTransition(startState, XsdSchemaToken::Enumeration, s3);
+ machine.addTransition(startState, XsdSchemaToken::WhiteSpace, s3);
+ machine.addTransition(startState, XsdSchemaToken::Pattern, s3);
+ machine.addTransition(startState, XsdSchemaToken::Assertion, s3);
+
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(s1, XsdSchemaToken::MinExclusive, s3);
+ machine.addTransition(s1, XsdSchemaToken::MinInclusive, s3);
+ machine.addTransition(s1, XsdSchemaToken::MaxExclusive, s3);
+ machine.addTransition(s1, XsdSchemaToken::MaxInclusive, s3);
+ machine.addTransition(s1, XsdSchemaToken::TotalDigits, s3);
+ machine.addTransition(s1, XsdSchemaToken::FractionDigits, s3);
+ machine.addTransition(s1, XsdSchemaToken::Length, s3);
+ machine.addTransition(s1, XsdSchemaToken::MinLength, s3);
+ machine.addTransition(s1, XsdSchemaToken::MaxLength, s3);
+ machine.addTransition(s1, XsdSchemaToken::Enumeration, s3);
+ machine.addTransition(s1, XsdSchemaToken::WhiteSpace, s3);
+ machine.addTransition(s1, XsdSchemaToken::Pattern, s3);
+ machine.addTransition(s1, XsdSchemaToken::Assertion, s3);
+
+ machine.addTransition(s2, XsdSchemaToken::MinExclusive, s3);
+ machine.addTransition(s2, XsdSchemaToken::MinInclusive, s3);
+ machine.addTransition(s2, XsdSchemaToken::MaxExclusive, s3);
+ machine.addTransition(s2, XsdSchemaToken::MaxInclusive, s3);
+ machine.addTransition(s2, XsdSchemaToken::TotalDigits, s3);
+ machine.addTransition(s2, XsdSchemaToken::FractionDigits, s3);
+ machine.addTransition(s2, XsdSchemaToken::Length, s3);
+ machine.addTransition(s2, XsdSchemaToken::MinLength, s3);
+ machine.addTransition(s2, XsdSchemaToken::MaxLength, s3);
+ machine.addTransition(s2, XsdSchemaToken::Enumeration, s3);
+ machine.addTransition(s2, XsdSchemaToken::WhiteSpace, s3);
+ machine.addTransition(s2, XsdSchemaToken::Pattern, s3);
+ machine.addTransition(s2, XsdSchemaToken::Assertion, s3);
+
+ machine.addTransition(s3, XsdSchemaToken::MinExclusive, s3);
+ machine.addTransition(s3, XsdSchemaToken::MinInclusive, s3);
+ machine.addTransition(s3, XsdSchemaToken::MaxExclusive, s3);
+ machine.addTransition(s3, XsdSchemaToken::MaxInclusive, s3);
+ machine.addTransition(s3, XsdSchemaToken::TotalDigits, s3);
+ machine.addTransition(s3, XsdSchemaToken::FractionDigits, s3);
+ machine.addTransition(s3, XsdSchemaToken::Length, s3);
+ machine.addTransition(s3, XsdSchemaToken::MinLength, s3);
+ machine.addTransition(s3, XsdSchemaToken::MaxLength, s3);
+ machine.addTransition(s3, XsdSchemaToken::Enumeration, s3);
+ machine.addTransition(s3, XsdSchemaToken::WhiteSpace, s3);
+ machine.addTransition(s3, XsdSchemaToken::Pattern, s3);
+ machine.addTransition(s3, XsdSchemaToken::Assertion, s3);
+
+ m_stateMachines.insert(XsdTagScope::SimpleRestriction, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, simpleType?) : list
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s2);
+
+ m_stateMachines.insert(XsdTagScope::List, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, simpleType*) : union
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s2);
+ machine.addTransition(s2, XsdSchemaToken::SimpleType, s2);
+
+ m_stateMachines.insert(XsdTagScope::Union, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for ((include | import | redefine |i override | annotation)*, (defaultOpenContent, annotation*)?, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*) : schema
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s3 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s4 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s5 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Include, s1);
+ machine.addTransition(startState, XsdSchemaToken::Import, s1);
+ machine.addTransition(startState, XsdSchemaToken::Redefine, s1);
+ machine.addTransition(startState, XsdSchemaToken::Override, s1);
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::DefaultOpenContent, s2);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s4);
+ machine.addTransition(startState, XsdSchemaToken::ComplexType, s4);
+ machine.addTransition(startState, XsdSchemaToken::Group, s4);
+ machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(startState, XsdSchemaToken::Element, s4);
+ machine.addTransition(startState, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(startState, XsdSchemaToken::Notation, s4);
+
+ machine.addTransition(s1, XsdSchemaToken::Include, s1);
+ machine.addTransition(s1, XsdSchemaToken::Import, s1);
+ machine.addTransition(s1, XsdSchemaToken::Redefine, s1);
+ machine.addTransition(s1, XsdSchemaToken::Override, s1);
+ machine.addTransition(s1, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(s1, XsdSchemaToken::DefaultOpenContent, s2);
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s4);
+ machine.addTransition(s1, XsdSchemaToken::ComplexType, s4);
+ machine.addTransition(s1, XsdSchemaToken::Group, s4);
+ machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s1, XsdSchemaToken::Element, s4);
+ machine.addTransition(s1, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s1, XsdSchemaToken::Notation, s4);
+
+ machine.addTransition(s2, XsdSchemaToken::Annotation, s3);
+ machine.addTransition(s2, XsdSchemaToken::SimpleType, s4);
+ machine.addTransition(s2, XsdSchemaToken::ComplexType, s4);
+ machine.addTransition(s2, XsdSchemaToken::Group, s4);
+ machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s2, XsdSchemaToken::Element, s4);
+ machine.addTransition(s2, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s2, XsdSchemaToken::Notation, s4);
+
+ machine.addTransition(s3, XsdSchemaToken::SimpleType, s4);
+ machine.addTransition(s3, XsdSchemaToken::ComplexType, s4);
+ machine.addTransition(s3, XsdSchemaToken::Group, s4);
+ machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s3, XsdSchemaToken::Element, s4);
+ machine.addTransition(s3, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s3, XsdSchemaToken::Notation, s4);
+
+ machine.addTransition(s4, XsdSchemaToken::SimpleType, s4);
+ machine.addTransition(s4, XsdSchemaToken::ComplexType, s4);
+ machine.addTransition(s4, XsdSchemaToken::Group, s4);
+ machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s4, XsdSchemaToken::Element, s4);
+ machine.addTransition(s4, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s4, XsdSchemaToken::Notation, s4);
+ machine.addTransition(s4, XsdSchemaToken::Annotation, s5);
+
+ machine.addTransition(s5, XsdSchemaToken::SimpleType, s4);
+ machine.addTransition(s5, XsdSchemaToken::ComplexType, s4);
+ machine.addTransition(s5, XsdSchemaToken::Group, s4);
+ machine.addTransition(s5, XsdSchemaToken::AttributeGroup, s4);
+ machine.addTransition(s5, XsdSchemaToken::Element, s4);
+ machine.addTransition(s5, XsdSchemaToken::Attribute, s4);
+ machine.addTransition(s5, XsdSchemaToken::Notation, s4);
+ machine.addTransition(s5, XsdSchemaToken::Annotation, s5);
+
+ m_stateMachines.insert(XsdTagScope::Schema, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation?, any) : defaultOpenContent
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::InternalState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s2 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::Any, s2);
+
+ machine.addTransition(s1, XsdSchemaToken::Any, s2);
+
+ m_stateMachines.insert(XsdTagScope::DefaultOpenContent, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation | (simpleType | complexType | group | attributeGroup))* : redefine
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s1);
+ machine.addTransition(startState, XsdSchemaToken::ComplexType, s1);
+ machine.addTransition(startState, XsdSchemaToken::Group, s1);
+ machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s1);
+
+ machine.addTransition(s1, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s1);
+ machine.addTransition(s1, XsdSchemaToken::ComplexType, s1);
+ machine.addTransition(s1, XsdSchemaToken::Group, s1);
+ machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s1);
+
+ m_stateMachines.insert(XsdTagScope::Redefine, machine);
+ }
+
+ {
+ XsdStateMachine<XsdSchemaToken::NodeName> machine(m_namePool);
+
+ // setup state machine for (annotation | (simpleType | complexType | group | attributeGroup | element | attribute | notation))* : override
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId startState = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::StartEndState);
+ const XsdStateMachine<XsdSchemaToken::NodeName>::StateId s1 = machine.addState(XsdStateMachine<XsdSchemaToken::NodeName>::EndState);
+
+ machine.addTransition(startState, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(startState, XsdSchemaToken::SimpleType, s1);
+ machine.addTransition(startState, XsdSchemaToken::ComplexType, s1);
+ machine.addTransition(startState, XsdSchemaToken::Group, s1);
+ machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s1);
+ machine.addTransition(startState, XsdSchemaToken::Element, s1);
+ machine.addTransition(startState, XsdSchemaToken::Attribute, s1);
+ machine.addTransition(startState, XsdSchemaToken::Notation, s1);
+
+ machine.addTransition(s1, XsdSchemaToken::Annotation, s1);
+ machine.addTransition(s1, XsdSchemaToken::SimpleType, s1);
+ machine.addTransition(s1, XsdSchemaToken::ComplexType, s1);
+ machine.addTransition(s1, XsdSchemaToken::Group, s1);
+ machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s1);
+ machine.addTransition(s1, XsdSchemaToken::Element, s1);
+ machine.addTransition(s1, XsdSchemaToken::Attribute, s1);
+ machine.addTransition(s1, XsdSchemaToken::Notation, s1);
+
+ m_stateMachines.insert(XsdTagScope::Override, machine);
+ }
+}
+
+void XsdSchemaParser::setupBuiltinTypeNames()
+{
+ m_builtinTypeNames.reserve(48);
+
+ m_builtinTypeNames.insert(BuiltinTypes::xsAnyType->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsAnySimpleType->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsUntyped->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsAnyAtomicType->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsUntypedAtomic->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsDateTime->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsDate->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsTime->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsDuration->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsYearMonthDuration->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsDayTimeDuration->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsFloat->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsDouble->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsInteger->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsDecimal->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsNonPositiveInteger->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsNegativeInteger->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsLong->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsInt->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsShort->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsByte->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsNonNegativeInteger->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsUnsignedLong->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsUnsignedInt->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsUnsignedShort->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsUnsignedByte->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsPositiveInteger->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsGYearMonth->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsGYear->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsGMonthDay->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsGDay->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsGMonth->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsBoolean->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsBase64Binary->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsHexBinary->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsAnyURI->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsQName->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsString->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsNormalizedString->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsToken->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsLanguage->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsNMTOKEN->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsName->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsNCName->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsID->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsIDREF->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsENTITY->name(m_namePool));
+ m_builtinTypeNames.insert(BuiltinTypes::xsNOTATION->name(m_namePool));
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp b/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp
new file mode 100644
index 0000000..0f711d8
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp
@@ -0,0 +1,603 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemaparsercontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdSchemaParserContext::XsdSchemaParserContext(const NamePool::Ptr &namePool, const XsdSchemaContext::Ptr &context)
+ : m_namePool(namePool)
+ , m_schema(new XsdSchema(m_namePool))
+ , m_checker(new XsdSchemaChecker(context, this))
+ , m_resolver(new XsdSchemaResolver(context, this))
+ , m_elementDescriptions(setupElementDescriptions())
+{
+}
+
+NamePool::Ptr XsdSchemaParserContext::namePool() const
+{
+ return m_namePool;
+}
+
+XsdSchemaResolver::Ptr XsdSchemaParserContext::resolver() const
+{
+ return m_resolver;
+}
+
+XsdSchemaChecker::Ptr XsdSchemaParserContext::checker() const
+{
+ return m_checker;
+}
+
+XsdSchema::Ptr XsdSchemaParserContext::schema() const
+{
+ return m_schema;
+}
+
+ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash XsdSchemaParserContext::elementDescriptions() const
+{
+ return m_elementDescriptions;
+}
+
+QXmlName XsdSchemaParserContext::createAnonymousName(const QString &targetNamespace) const
+{
+ m_anonymousNameCounter.ref();
+
+ const QString name = QString::fromLatin1("__AnonymousClass_%1").arg((int)m_anonymousNameCounter);
+
+ return m_namePool->allocateQName(targetNamespace, name);
+}
+
+ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash XsdSchemaParserContext::setupElementDescriptions()
+{
+ enum
+ {
+ ReservedForElements = 60
+ };
+
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash elementDescriptions;
+ elementDescriptions.reserve(ReservedForElements);
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Schema];
+ description.optionalAttributes.reserve(10);
+ //description.tagToken = XsdSchemaToken::Schema;
+ description.optionalAttributes.insert(XsdSchemaToken::AttributeFormDefault);
+ description.optionalAttributes.insert(XsdSchemaToken::BlockDefault);
+ description.optionalAttributes.insert(XsdSchemaToken::DefaultAttributes);
+ description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace);
+ description.optionalAttributes.insert(XsdSchemaToken::ElementFormDefault);
+ description.optionalAttributes.insert(XsdSchemaToken::FinalDefault);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::TargetNamespace);
+ description.optionalAttributes.insert(XsdSchemaToken::Version);
+ description.optionalAttributes.insert(XsdSchemaToken::XmlLanguage);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Include];
+ //description.tagToken = XsdSchemaToken::Include;
+ description.requiredAttributes.insert(XsdSchemaToken::SchemaLocation);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Import];
+ //description.tagToken = XsdSchemaToken::Import;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::Namespace);
+ description.optionalAttributes.insert(XsdSchemaToken::SchemaLocation);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Redefine];
+ //description.tagToken = XsdSchemaToken::Redefine;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::SchemaLocation);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Override];
+ //description.tagToken = XsdSchemaToken::Override;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::SchemaLocation);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Annotation];
+ //description.tagToken = XsdSchemaToken::Annotation;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::AppInfo];
+ //description.tagToken = XsdSchemaToken::Appinfo;
+ description.optionalAttributes.insert(XsdSchemaToken::Source);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Documentation];
+ //description.tagToken = XsdSchemaToken::Documentation;
+ description.optionalAttributes.insert(XsdSchemaToken::Source);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::GlobalSimpleType];
+ //description.tagToken = XsdSchemaToken::SimpleType;
+ description.optionalAttributes.insert(XsdSchemaToken::Final);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalSimpleType];
+ //description.tagToken = XsdSchemaToken::SimpleType;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::SimpleRestriction];
+ //description.tagToken = XsdSchemaToken::Restriction;
+ description.optionalAttributes.insert(XsdSchemaToken::Base);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::List];
+ //description.tagToken = XsdSchemaToken::List;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::ItemType);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Union];
+ //description.tagToken = XsdSchemaToken::Union;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::MemberTypes);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MinExclusiveFacet];
+ //description.tagToken = XsdSchemaToken::MinExclusive;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MinInclusiveFacet];
+ //description.tagToken = XsdSchemaToken::MinInclusive;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MaxExclusiveFacet];
+ //description.tagToken = XsdSchemaToken::MaxExclusive;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MaxInclusiveFacet];
+ //description.tagToken = XsdSchemaToken::MaxInclusive;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::TotalDigitsFacet];
+ //description.tagToken = XsdSchemaToken::TotalDigits;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::FractionDigitsFacet];
+ //description.tagToken = XsdSchemaToken::FractionDigits;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LengthFacet];
+ //description.tagToken = XsdSchemaToken::Length;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MinLengthFacet];
+ //description.tagToken = XsdSchemaToken::MinLength;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MaxLengthFacet];
+ //description.tagToken = XsdSchemaToken::MaxLength;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::EnumerationFacet];
+ //description.tagToken = XsdSchemaToken::Enumeration;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::WhiteSpaceFacet];
+ //description.tagToken = XsdSchemaToken::WhiteSpace;
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::PatternFacet];
+ //description.tagToken = XsdSchemaToken::Pattern;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Value);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::GlobalComplexType];
+ description.optionalAttributes.reserve(7);
+ //description.tagToken = XsdSchemaToken::ComplexType;
+ description.optionalAttributes.insert(XsdSchemaToken::Abstract);
+ description.optionalAttributes.insert(XsdSchemaToken::Block);
+ description.optionalAttributes.insert(XsdSchemaToken::DefaultAttributesApply);
+ description.optionalAttributes.insert(XsdSchemaToken::Final);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::Mixed);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalComplexType];
+ //description.tagToken = XsdSchemaToken::ComplexType;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::Mixed);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::SimpleContent];
+ //description.tagToken = XsdSchemaToken::SimpleContent;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::SimpleContentRestriction];
+ //description.tagToken = XsdSchemaToken::Restriction;
+ description.requiredAttributes.insert(XsdSchemaToken::Base);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::SimpleContentExtension];
+ //description.tagToken = XsdSchemaToken::Extension;
+ description.requiredAttributes.insert(XsdSchemaToken::Base);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ComplexContent];
+ //description.tagToken = XsdSchemaToken::ComplexContent;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::Mixed);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ComplexContentRestriction];
+ //description.tagToken = XsdSchemaToken::Restriction;
+ description.requiredAttributes.insert(XsdSchemaToken::Base);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ComplexContentExtension];
+ //description.tagToken = XsdSchemaToken::Extension;
+ description.requiredAttributes.insert(XsdSchemaToken::Base);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::NamedGroup];
+ //description.tagToken = XsdSchemaToken::Group;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ReferredGroup];
+ description.optionalAttributes.reserve(4);
+ //description.tagToken = XsdSchemaToken::Group;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs);
+ description.optionalAttributes.insert(XsdSchemaToken::MinOccurs);
+ description.requiredAttributes.insert(XsdSchemaToken::Ref);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::All];
+ //description.tagToken = XsdSchemaToken::All;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalAll];
+ //description.tagToken = XsdSchemaToken::All;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs);
+ description.optionalAttributes.insert(XsdSchemaToken::MinOccurs);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Choice];
+ //description.tagToken = XsdSchemaToken::Choice;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalChoice];
+ //description.tagToken = XsdSchemaToken::Choice;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs);
+ description.optionalAttributes.insert(XsdSchemaToken::MinOccurs);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Sequence];
+ //description.tagToken = XsdSchemaToken::Sequence;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalSequence];
+ //description.tagToken = XsdSchemaToken::Sequence;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs);
+ description.optionalAttributes.insert(XsdSchemaToken::MinOccurs);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::GlobalAttribute];
+ description.optionalAttributes.reserve(5);
+ //description.tagToken = XsdSchemaToken::Attribute;
+ description.optionalAttributes.insert(XsdSchemaToken::Default);
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ description.optionalAttributes.insert(XsdSchemaToken::Type);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalAttribute];
+ description.optionalAttributes.reserve(8);
+ //description.tagToken = XsdSchemaToken::Attribute;
+ description.optionalAttributes.insert(XsdSchemaToken::Default);
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Form);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::Name);
+ description.optionalAttributes.insert(XsdSchemaToken::Ref);
+ description.optionalAttributes.insert(XsdSchemaToken::Type);
+ description.optionalAttributes.insert(XsdSchemaToken::Use);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::NamedAttributeGroup];
+ //description.tagToken = XsdSchemaToken::AttributeGroup;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ReferredAttributeGroup];
+ //description.tagToken = XsdSchemaToken::AttributeGroup;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Ref);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalElement];
+ description.optionalAttributes.reserve(11);
+ //description.tagToken = XsdSchemaToken::Element;
+ description.optionalAttributes.insert(XsdSchemaToken::Block);
+ description.optionalAttributes.insert(XsdSchemaToken::Default);
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Form);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::MinOccurs);
+ description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs);
+ description.optionalAttributes.insert(XsdSchemaToken::Name);
+ description.optionalAttributes.insert(XsdSchemaToken::Nillable);
+ description.optionalAttributes.insert(XsdSchemaToken::Ref);
+ description.optionalAttributes.insert(XsdSchemaToken::Type);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::GlobalElement];
+ description.optionalAttributes.reserve(10);
+ //description.tagToken = XsdSchemaToken::Element;
+ description.optionalAttributes.insert(XsdSchemaToken::Abstract);
+ description.optionalAttributes.insert(XsdSchemaToken::Block);
+ description.optionalAttributes.insert(XsdSchemaToken::Default);
+ description.optionalAttributes.insert(XsdSchemaToken::Final);
+ description.optionalAttributes.insert(XsdSchemaToken::Fixed);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ description.optionalAttributes.insert(XsdSchemaToken::Nillable);
+ description.optionalAttributes.insert(XsdSchemaToken::SubstitutionGroup);
+ description.optionalAttributes.insert(XsdSchemaToken::Type);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Unique];
+ //description.tagToken = XsdSchemaToken::Unique;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Key];
+ //description.tagToken = XsdSchemaToken::Key;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::KeyRef];
+ //description.tagToken = XsdSchemaToken::Keyref;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ description.requiredAttributes.insert(XsdSchemaToken::Refer);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Selector];
+ //description.tagToken = XsdSchemaToken::Selector;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Xpath);
+ description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Field];
+ //description.tagToken = XsdSchemaToken::Field;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Xpath);
+ description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Notation];
+ description.optionalAttributes.reserve(4);
+ //description.tagToken = XsdSchemaToken::Notation;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Name);
+ description.optionalAttributes.insert(XsdSchemaToken::Public);
+ description.optionalAttributes.insert(XsdSchemaToken::System);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Any];
+ description.optionalAttributes.reserve(7);
+ //description.tagToken = XsdSchemaToken::Any;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs);
+ description.optionalAttributes.insert(XsdSchemaToken::MinOccurs);
+ description.optionalAttributes.insert(XsdSchemaToken::Namespace);
+ description.optionalAttributes.insert(XsdSchemaToken::NotNamespace);
+ description.optionalAttributes.insert(XsdSchemaToken::NotQName);
+ description.optionalAttributes.insert(XsdSchemaToken::ProcessContents);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::AnyAttribute];
+ description.optionalAttributes.reserve(5);
+ //description.tagToken = XsdSchemaToken::AnyAttribute;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::Namespace);
+ description.optionalAttributes.insert(XsdSchemaToken::NotNamespace);
+ description.optionalAttributes.insert(XsdSchemaToken::NotQName);
+ description.optionalAttributes.insert(XsdSchemaToken::ProcessContents);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Alternative];
+ //description.tagToken = XsdSchemaToken::Alternative;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::Test);
+ description.optionalAttributes.insert(XsdSchemaToken::Type);
+ description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::OpenContent];
+ //description.tagToken = XsdSchemaToken::OpenContent;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::Mode);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::DefaultOpenContent];
+ //description.tagToken = XsdSchemaToken::DefaultOpenContent;
+ description.optionalAttributes.insert(XsdSchemaToken::AppliesToEmpty);
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.optionalAttributes.insert(XsdSchemaToken::Mode);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Assert];
+ //description.tagToken = XsdSchemaToken::Assert;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Test);
+ description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace);
+ }
+
+ {
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Assertion];
+ //description.tagToken = XsdSchemaToken::Assertion;
+ description.optionalAttributes.insert(XsdSchemaToken::Id);
+ description.requiredAttributes.insert(XsdSchemaToken::Test);
+ description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace);
+ }
+
+ Q_ASSERT_X(elementDescriptions.count() == ReservedForElements, Q_FUNC_INFO,
+ qPrintable(QString::fromLatin1("Expected is %1, actual is %2.").arg(ReservedForElements).arg(elementDescriptions.count())));
+
+ return elementDescriptions;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h b/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h
new file mode 100644
index 0000000..572d5e3
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h
@@ -0,0 +1,231 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchemaParserContext_H
+#define Patternist_XsdSchemaParserContext_H
+
+#include "qmaintainingreader_p.h" // for definition of ElementDescription
+#include "qxsdschematoken_p.h"
+#include "qxsdschema_p.h"
+#include "qxsdschemachecker_p.h"
+#include "qxsdschemacontext_p.h"
+#include "qxsdschemaresolver_p.h"
+
+#include <QtCore/QSharedData>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A namespace class that contains identifiers for the different
+ * scopes a tag from the xml schema spec can appear in.
+ */
+ class XsdTagScope
+ {
+ public:
+ enum Type
+ {
+ Schema,
+ Include,
+ Import,
+ Redefine,
+ Annotation,
+ AppInfo,
+ Documentation,
+ GlobalSimpleType,
+ LocalSimpleType,
+ SimpleRestriction,
+ List,
+ Union,
+ MinExclusiveFacet,
+ MinInclusiveFacet,
+ MaxExclusiveFacet,
+ MaxInclusiveFacet,
+ TotalDigitsFacet,
+ FractionDigitsFacet,
+ LengthFacet,
+ MinLengthFacet,
+ MaxLengthFacet,
+ EnumerationFacet,
+ WhiteSpaceFacet,
+ PatternFacet,
+ GlobalComplexType,
+ LocalComplexType,
+ SimpleContent,
+ SimpleContentRestriction,
+ SimpleContentExtension,
+ ComplexContent,
+ ComplexContentRestriction,
+ ComplexContentExtension,
+ NamedGroup,
+ ReferredGroup,
+ All,
+ LocalAll,
+ Choice,
+ LocalChoice,
+ Sequence,
+ LocalSequence,
+ GlobalAttribute,
+ LocalAttribute,
+ NamedAttributeGroup,
+ ReferredAttributeGroup,
+ GlobalElement,
+ LocalElement,
+ Unique,
+ Key,
+ KeyRef,
+ Selector,
+ Field,
+ Notation,
+ Any,
+ AnyAttribute,
+ Alternative,
+ Assert,
+ Assertion,
+ OpenContent,
+ DefaultOpenContent,
+ Override
+ };
+ };
+
+ /**
+ * A hash that keeps the mapping between the single components that can appear
+ * in a schema document (e.g. elements, attributes, type definitions) and their
+ * source locations inside the document.
+ */
+ typedef QHash<NamedSchemaComponent::Ptr, QSourceLocation> ComponentLocationHash;
+
+ /**
+ * @short A context for schema parsing.
+ *
+ * This class provides a context for all components that are
+ * nedded for parsing and compiling the XML schema.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSchemaParserContext : public QSharedData
+ {
+ public:
+ /**
+ * A smart pointer wrapping XsdSchemaParserContext instances.
+ */
+ typedef QExplicitlySharedDataPointer<XsdSchemaParserContext> Ptr;
+
+ /**
+ * Creates a new schema parser context object.
+ *
+ * @param namePool The name pool where all names of the schema will be stored in.
+ * @param context The schema context to use for error reporting etc.
+ */
+ XsdSchemaParserContext(const NamePool::Ptr &namePool, const XsdSchemaContext::Ptr &context);
+
+ /**
+ * Returns the name pool of the schema parser context.
+ */
+ NamePool::Ptr namePool() const;
+
+ /**
+ * Returns the schema resolver of the schema context.
+ */
+ XsdSchemaResolver::Ptr resolver() const;
+
+ /**
+ * Returns the schema resolver of the schema context.
+ */
+ XsdSchemaChecker::Ptr checker() const;
+
+ /**
+ * Returns the schema object of the schema context.
+ */
+ XsdSchema::Ptr schema() const;
+
+ /**
+ * Returns the element descriptions for the schema parser.
+ *
+ * The element descriptions are a fast lookup table for
+ * verifying whether certain attributes are allowed for
+ * a given element type.
+ */
+ ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash elementDescriptions() const;
+
+ /**
+ * Returns an unique name that is used by the schema parser
+ * for anonymous types.
+ *
+ * @param targetNamespace The namespace of the name.
+ */
+ QXmlName createAnonymousName(const QString &targetNamespace) const;
+
+ private:
+ /**
+ * Fills the element description hash with the required and prohibited
+ * attributes.
+ */
+ static ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash setupElementDescriptions();
+
+ NamePool::Ptr m_namePool;
+ XsdSchema::Ptr m_schema;
+ XsdSchemaChecker::Ptr m_checker;
+ XsdSchemaResolver::Ptr m_resolver;
+ const ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash m_elementDescriptions;
+ mutable QAtomicInt m_anonymousNameCounter;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschemaresolver.cpp b/src/xmlpatterns/schema/qxsdschemaresolver.cpp
new file mode 100644
index 0000000..9290b6e
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemaresolver.cpp
@@ -0,0 +1,1736 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschemaresolver_p.h"
+
+#include "qderivedinteger_p.h"
+#include "qderivedstring_p.h"
+#include "qqnamevalue_p.h"
+#include "qxsdattributereference_p.h"
+#include "qxsdparticlechecker_p.h"
+#include "qxsdreference_p.h"
+#include "qxsdschemacontext_p.h"
+#include "qxsdschemahelper_p.h"
+#include "qxsdschemaparsercontext_p.h"
+#include "qxsdschematypesfactory_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdSchemaResolver::XsdSchemaResolver(const QExplicitlySharedDataPointer<XsdSchemaContext> &context, const XsdSchemaParserContext *parserContext)
+ : m_context(context)
+ , m_checker(parserContext->checker())
+ , m_namePool(parserContext->namePool())
+ , m_schema(parserContext->schema())
+{
+ m_keyReferences.reserve(20);
+ m_simpleRestrictionBases.reserve(20);
+ m_simpleListTypes.reserve(20);
+ m_simpleUnionTypes.reserve(20);
+ m_elementTypes.reserve(20);
+ m_complexBaseTypes.reserve(20);
+ m_attributeTypes.reserve(20);
+ m_alternativeTypes.reserve(20);
+ m_alternativeTypeElements.reserve(20);
+ m_substitutionGroupAffiliations.reserve(20);
+
+ m_predefinedSchemaTypes = m_context->schemaTypeFactory()->types().values();
+}
+
+XsdSchemaResolver::~XsdSchemaResolver()
+{
+}
+
+void XsdSchemaResolver::resolve()
+{
+ m_checker->addComponentLocationHash(m_componentLocationHash);
+
+ // resolve the base types for all types
+ resolveSimpleRestrictionBaseTypes();
+ resolveComplexBaseTypes();
+
+ // do the basic checks which depend on having a base type available
+ m_checker->basicCheck();
+
+ // resolve further types that only map a type name to a type object
+ resolveSimpleListType();
+ resolveSimpleUnionTypes();
+ resolveElementTypes();
+ resolveAttributeTypes();
+ resolveAlternativeTypes();
+
+ // resolve objects that do not need information about inheritance
+ resolveKeyReferences();
+ resolveSubstitutionGroupAffiliations();
+
+ // resolve objects that do need information about inheritance
+ resolveSimpleRestrictions();
+ resolveSimpleContentComplexTypes();
+
+ // resolve objects which replace place holders
+ resolveTermReferences();
+ resolveAttributeTermReferences();
+
+ // resolve additional objects that do need information about inheritance
+ resolveAttributeInheritance();
+ resolveComplexContentComplexTypes();
+ resolveSubstitutionGroups();
+
+ resolveEnumerationFacetValues();
+
+ checkRedefinedGroups();
+ checkRedefinedAttributeGroups();
+
+ // check the constraining facets before we resolve them
+ m_checker->checkConstrainingFacets();
+
+ // add it again, as we may have added new components in the meantime
+ m_checker->addComponentLocationHash(m_componentLocationHash);
+
+ m_checker->check();
+}
+
+void XsdSchemaResolver::addKeyReference(const XsdElement::Ptr &element, const XsdIdentityConstraint::Ptr &keyRef, const QXmlName &reference, const QSourceLocation &location)
+{
+ KeyReference item;
+ item.element = element;
+ item.keyRef = keyRef;
+ item.reference = reference;
+ item.location = location;
+
+ m_keyReferences.append(item);
+}
+
+void XsdSchemaResolver::addSimpleRestrictionBase(const XsdSimpleType::Ptr &simpleType, const QXmlName &baseName, const QSourceLocation &location)
+{
+ SimpleRestrictionBase item;
+ item.simpleType = simpleType;
+ item.baseName = baseName;
+ item.location = location;
+
+ m_simpleRestrictionBases.append(item);
+}
+
+void XsdSchemaResolver::removeSimpleRestrictionBase(const XsdSimpleType::Ptr &type)
+{
+ for (int i = 0; i < m_simpleRestrictionBases.count(); ++i) {
+ if (m_simpleRestrictionBases.at(i).simpleType == type) {
+ m_simpleRestrictionBases.remove(i);
+ break;
+ }
+ }
+}
+
+void XsdSchemaResolver::addSimpleListType(const XsdSimpleType::Ptr &simpleType, const QXmlName &typeName, const QSourceLocation &location)
+{
+ SimpleListType item;
+ item.simpleType = simpleType;
+ item.typeName = typeName;
+ item.location = location;
+
+ m_simpleListTypes.append(item);
+}
+
+void XsdSchemaResolver::addSimpleUnionTypes(const XsdSimpleType::Ptr &simpleType, const QList<QXmlName> &typeNames, const QSourceLocation &location)
+{
+ SimpleUnionType item;
+ item.simpleType = simpleType;
+ item.typeNames = typeNames;
+ item.location = location;
+
+ m_simpleUnionTypes.append(item);
+}
+
+void XsdSchemaResolver::addElementType(const XsdElement::Ptr &element, const QXmlName &typeName, const QSourceLocation &location)
+{
+ ElementType item;
+ item.element = element;
+ item.typeName = typeName;
+ item.location = location;
+
+ m_elementTypes.append(item);
+}
+
+void XsdSchemaResolver::addComplexBaseType(const XsdComplexType::Ptr &complexType, const QXmlName &baseName, const QSourceLocation &location, const XsdFacet::Hash &facets)
+{
+ ComplexBaseType item;
+ item.complexType = complexType;
+ item.baseName = baseName;
+ item.location = location;
+ item.facets = facets;
+
+ m_complexBaseTypes.append(item);
+}
+
+void XsdSchemaResolver::removeComplexBaseType(const XsdComplexType::Ptr &type)
+{
+ for (int i = 0; i < m_complexBaseTypes.count(); ++i) {
+ if (m_complexBaseTypes.at(i).complexType == type) {
+ m_complexBaseTypes.remove(i);
+ break;
+ }
+ }
+}
+
+void XsdSchemaResolver::addComplexContentType(const XsdComplexType::Ptr &complexType, const XsdParticle::Ptr &content, bool mixed)
+{
+ ComplexContentType item;
+ item.complexType = complexType;
+ item.explicitContent = content;
+ item.effectiveMixed = mixed;
+ m_complexContentTypes.append(item);
+}
+
+void XsdSchemaResolver::addAttributeType(const XsdAttribute::Ptr &attribute, const QXmlName &typeName, const QSourceLocation &location)
+{
+ AttributeType item;
+ item.attribute = attribute;
+ item.typeName = typeName;
+ item.location = location;
+
+ m_attributeTypes.append(item);
+}
+
+void XsdSchemaResolver::addAlternativeType(const XsdAlternative::Ptr &alternative, const QXmlName &typeName, const QSourceLocation &location)
+{
+ AlternativeType item;
+ item.alternative = alternative;
+ item.typeName = typeName;
+ item.location = location;
+
+ m_alternativeTypes.append(item);
+}
+
+void XsdSchemaResolver::addAlternativeType(const XsdAlternative::Ptr &alternative, const XsdElement::Ptr &element)
+{
+ AlternativeTypeElement item;
+ item.alternative = alternative;
+ item.element = element;
+
+ m_alternativeTypeElements.append(item);
+}
+
+void XsdSchemaResolver::addSubstitutionGroupAffiliation(const XsdElement::Ptr &element, const QList<QXmlName> &elementNames, const QSourceLocation &location)
+{
+ SubstitutionGroupAffiliation item;
+ item.element = element;
+ item.elementNames = elementNames;
+ item.location = location;
+
+ m_substitutionGroupAffiliations.append(item);
+}
+
+void XsdSchemaResolver::addSubstitutionGroupType(const XsdElement::Ptr &element)
+{
+ m_substitutionGroupTypes.append(element);
+}
+
+void XsdSchemaResolver::addComponentLocationHash(const ComponentLocationHash &hash)
+{
+ m_componentLocationHash.unite(hash);
+}
+
+void XsdSchemaResolver::addEnumerationFacetValue(const AtomicValue::Ptr &facetValue, const NamespaceSupport &namespaceSupport)
+{
+ m_enumerationFacetValues.insert(facetValue, namespaceSupport);
+}
+
+void XsdSchemaResolver::addRedefinedGroups(const XsdModelGroup::Ptr &redefinedGroup, const XsdModelGroup::Ptr &group)
+{
+ RedefinedGroups item;
+ item.redefinedGroup = redefinedGroup;
+ item.group = group;
+
+ m_redefinedGroups.append(item);
+}
+
+void XsdSchemaResolver::addRedefinedAttributeGroups(const XsdAttributeGroup::Ptr &redefinedGroup, const XsdAttributeGroup::Ptr &group)
+{
+ RedefinedAttributeGroups item;
+ item.redefinedGroup = redefinedGroup;
+ item.group = group;
+
+ m_redefinedAttributeGroups.append(item);
+}
+
+void XsdSchemaResolver::addAllGroupCheck(const XsdReference::Ptr &reference)
+{
+ m_allGroups.insert(reference);
+}
+
+void XsdSchemaResolver::copyDataTo(const XsdSchemaResolver::Ptr &other) const
+{
+ other->m_keyReferences << m_keyReferences;
+ other->m_simpleRestrictionBases << m_simpleRestrictionBases;
+ other->m_simpleListTypes << m_simpleListTypes;
+ other->m_simpleUnionTypes << m_simpleUnionTypes;
+ other->m_elementTypes << m_elementTypes;
+ other->m_complexBaseTypes << m_complexBaseTypes;
+ other->m_complexContentTypes << m_complexContentTypes;
+ other->m_attributeTypes << m_attributeTypes;
+ other->m_alternativeTypes << m_alternativeTypes;
+ other->m_alternativeTypeElements << m_alternativeTypeElements;
+ other->m_substitutionGroupAffiliations << m_substitutionGroupAffiliations;
+ other->m_substitutionGroupTypes << m_substitutionGroupTypes;
+}
+
+QXmlName XsdSchemaResolver::baseTypeNameOfType(const SchemaType::Ptr &type) const
+{
+ for (int i = 0; i < m_simpleRestrictionBases.count(); ++i) {
+ if (m_simpleRestrictionBases.at(i).simpleType == type)
+ return m_simpleRestrictionBases.at(i).baseName;
+ }
+
+ for (int i = 0; i < m_complexBaseTypes.count(); ++i) {
+ if (m_complexBaseTypes.at(i).complexType == type)
+ return m_complexBaseTypes.at(i).baseName;
+ }
+
+ return QXmlName();
+}
+
+QXmlName XsdSchemaResolver::typeNameOfAttribute(const XsdAttribute::Ptr &attribute) const
+{
+ for (int i = 0; i < m_attributeTypes.count(); ++i) {
+ if (m_attributeTypes.at(i).attribute == attribute)
+ return m_attributeTypes.at(i).typeName;
+ }
+
+ return QXmlName();
+}
+
+void XsdSchemaResolver::setDefaultOpenContent(const XsdComplexType::OpenContent::Ptr &openContent, bool appliesToEmpty)
+{
+ m_defaultOpenContent = openContent;
+ m_defaultOpenContentAppliesToEmpty = appliesToEmpty;
+}
+
+void XsdSchemaResolver::resolveKeyReferences()
+{
+ for (int i = 0; i < m_keyReferences.count(); ++i) {
+ const KeyReference ref = m_keyReferences.at(i);
+
+ const XsdIdentityConstraint::Ptr constraint = m_schema->identityConstraint(ref.reference);
+ if (!constraint) {
+ m_context->error(QtXmlPatterns::tr("%1 references unknown %2 or %3 element %4")
+ .arg(formatKeyword(ref.keyRef->displayName(m_namePool)))
+ .arg(formatElement("key"))
+ .arg(formatElement("unique"))
+ .arg(formatKeyword(m_namePool, ref.reference)),
+ XsdSchemaContext::XSDError, ref.location);
+ return;
+ }
+
+ if (constraint->category() != XsdIdentityConstraint::Key && constraint->category() != XsdIdentityConstraint::Unique) { // only key and unique can be referenced
+ m_context->error(QtXmlPatterns::tr("%1 references identity constraint %2 that is no %3 or %4 element")
+ .arg(formatKeyword(ref.keyRef->displayName(m_namePool)))
+ .arg(formatKeyword(m_namePool, ref.reference))
+ .arg(formatElement("key"))
+ .arg(formatElement("unique")),
+ XsdSchemaContext::XSDError, ref.location);
+ return;
+ }
+
+ if (constraint->fields().count() != ref.keyRef->fields().count()) {
+ m_context->error(QtXmlPatterns::tr("%1 has a different number of fields from the identity constraint %2 that it references")
+ .arg(formatKeyword(ref.keyRef->displayName(m_namePool)))
+ .arg(formatKeyword(m_namePool, ref.reference)),
+ XsdSchemaContext::XSDError, ref.location);
+ return;
+ }
+
+ ref.keyRef->setReferencedKey(constraint);
+ }
+}
+
+void XsdSchemaResolver::resolveSimpleRestrictionBaseTypes()
+{
+ // iterate over all simple types that are derived by restriction
+ for (int i = 0; i < m_simpleRestrictionBases.count(); ++i) {
+ const SimpleRestrictionBase item = m_simpleRestrictionBases.at(i);
+
+ // find the base type
+ SchemaType::Ptr type = m_schema->type(item.baseName);
+ if (!type) {
+ // maybe it's a basic type...
+ type = m_context->schemaTypeFactory()->createSchemaType(item.baseName);
+ if (!type) {
+ m_context->error(QtXmlPatterns::tr("base type %1 of %2 element cannot be resolved")
+ .arg(formatType(m_namePool, item.baseName))
+ .arg(formatElement("restriction")),
+ XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+ }
+
+ item.simpleType->setWxsSuperType(type);
+ }
+}
+
+void XsdSchemaResolver::resolveSimpleRestrictions()
+{
+ XsdSimpleType::List simpleTypes;
+
+ // first collect the global simple types
+ const SchemaType::List types = m_schema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ if (types.at(i)->isSimpleType() && (types.at(i)->derivationMethod() == SchemaType::DerivationRestriction))
+ simpleTypes.append(types.at(i));
+ }
+
+ // then collect all anonymous simple types
+ const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
+ for (int i = 0; i < anonymousTypes.count(); ++i) {
+ if (anonymousTypes.at(i)->isSimpleType() && (anonymousTypes.at(i)->derivationMethod() == SchemaType::DerivationRestriction))
+ simpleTypes.append(anonymousTypes.at(i));
+ }
+
+ QSet<XsdSimpleType::Ptr> visitedTypes;
+ for (int i = 0; i < simpleTypes.count(); ++i) {
+ resolveSimpleRestrictions(simpleTypes.at(i), visitedTypes);
+ }
+}
+
+void XsdSchemaResolver::resolveSimpleRestrictions(const XsdSimpleType::Ptr &simpleType, QSet<XsdSimpleType::Ptr> &visitedTypes)
+{
+ if (visitedTypes.contains(simpleType))
+ return;
+ else
+ visitedTypes.insert(simpleType);
+
+ if (simpleType->derivationMethod() != XsdSimpleType::DerivationRestriction)
+ return;
+
+ // as xs:NMTOKENS, xs:ENTITIES and xs:IDREFS are provided by our XsdSchemaTypesFactory, they are
+ // setup correctly already and shouldn't be handled here
+ if (m_predefinedSchemaTypes.contains(simpleType))
+ return;
+
+ const SchemaType::Ptr baseType = simpleType->wxsSuperType();
+ Q_ASSERT(baseType);
+
+ if (baseType->isDefinedBySchema())
+ resolveSimpleRestrictions(XsdSimpleType::Ptr(baseType), visitedTypes);
+
+ simpleType->setCategory(baseType->category());
+
+ if (simpleType->category() == XsdSimpleType::SimpleTypeAtomic) {
+ QSet<AnySimpleType::Ptr> visitedPrimitiveTypes;
+ const AnySimpleType::Ptr primitiveType = findPrimitiveType(baseType, visitedPrimitiveTypes);
+ simpleType->setPrimitiveType(primitiveType);
+ } else if (simpleType->category() == XsdSimpleType::SimpleTypeList) {
+ const XsdSimpleType::Ptr simpleBaseType = baseType;
+ simpleType->setItemType(simpleBaseType->itemType());
+ } else if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) {
+ const XsdSimpleType::Ptr simpleBaseType = baseType;
+ simpleType->setMemberTypes(simpleBaseType->memberTypes());
+ }
+}
+
+void XsdSchemaResolver::resolveSimpleListType()
+{
+ // iterate over all simple types where the item type shall be resolved
+ for (int i = 0; i < m_simpleListTypes.count(); ++i) {
+ const SimpleListType item = m_simpleListTypes.at(i);
+
+ // try to resolve the name
+ SchemaType::Ptr type = m_schema->type(item.typeName);
+ if (!type) {
+ // maybe it's a basic type...
+ type = m_context->schemaTypeFactory()->createSchemaType(item.typeName);
+ if (!type) {
+ m_context->error(QtXmlPatterns::tr("item type %1 of %2 element cannot be resolved")
+ .arg(formatType(m_namePool, item.typeName))
+ .arg(formatElement("list")),
+ XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+ }
+
+ item.simpleType->setItemType(type);
+ }
+}
+
+void XsdSchemaResolver::resolveSimpleUnionTypes()
+{
+ // iterate over all simple types where the union member types shall be resolved
+ for (int i = 0; i < m_simpleUnionTypes.count(); ++i) {
+ const SimpleUnionType item = m_simpleUnionTypes.at(i);
+
+ AnySimpleType::List memberTypes;
+
+ // iterate over all union member type names
+ const QList<QXmlName> typeNames = item.typeNames;
+ for (int j = 0; j < typeNames.count(); ++j) {
+ const QXmlName typeName = typeNames.at(j);
+
+ // try to resolve the name
+ SchemaType::Ptr type = m_schema->type(typeName);
+ if (!type) {
+ // maybe it's a basic type...
+ type = m_context->schemaTypeFactory()->createSchemaType(typeName);
+ if (!type) {
+ m_context->error(QtXmlPatterns::tr("member type %1 of %2 element cannot be resolved")
+ .arg(formatType(m_namePool, typeName))
+ .arg(formatElement("union")),
+ XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+ }
+
+ memberTypes.append(type);
+ }
+
+ // append the types that have been defined as <simpleType> children
+ memberTypes << item.simpleType->memberTypes();
+
+ item.simpleType->setMemberTypes(memberTypes);
+ }
+}
+
+void XsdSchemaResolver::resolveElementTypes()
+{
+ for (int i = 0; i < m_elementTypes.count(); ++i) {
+ const ElementType item = m_elementTypes.at(i);
+
+ SchemaType::Ptr type = m_schema->type(item.typeName);
+ if (!type) {
+ // maybe it's a basic type...
+ type = m_context->schemaTypeFactory()->createSchemaType(item.typeName);
+ if (!type) {
+ m_context->error(QtXmlPatterns::tr("type %1 of %2 element cannot be resolved")
+ .arg(formatType(m_namePool, item.typeName))
+ .arg(formatElement("element")),
+ XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+ }
+
+ item.element->setType(type);
+ }
+}
+
+void XsdSchemaResolver::resolveComplexBaseTypes()
+{
+ for (int i = 0; i < m_complexBaseTypes.count(); ++i) {
+ const ComplexBaseType item = m_complexBaseTypes.at(i);
+
+ SchemaType::Ptr type = m_schema->type(item.baseName);
+ if (!type) {
+ // maybe it's a basic type...
+ type = m_context->schemaTypeFactory()->createSchemaType(item.baseName);
+ if (!type) {
+ m_context->error(QtXmlPatterns::tr("base type %1 of complex type cannot be resolved").arg(formatType(m_namePool, item.baseName)), XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+ }
+
+ if (item.complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
+ if (type->isComplexType() && type->isDefinedBySchema()) {
+ const XsdComplexType::Ptr baseType = type;
+ if (baseType->contentType()->variety() != XsdComplexType::ContentType::Simple) {
+ m_context->error(QtXmlPatterns::tr("%1 cannot have complex base type that has a %2")
+ .arg(formatElement("simpleContent"))
+ .arg(formatElement("complexContent")),
+ XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+ }
+ }
+
+ item.complexType->setWxsSuperType(type);
+ }
+}
+
+void XsdSchemaResolver::resolveSimpleContentComplexTypes()
+{
+ XsdComplexType::List complexTypes;
+
+ // first collect the global complex types
+ const SchemaType::List types = m_schema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema())
+ complexTypes.append(types.at(i));
+ }
+
+ // then collect all anonymous simple types
+ const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
+ for (int i = 0; i < anonymousTypes.count(); ++i) {
+ if (anonymousTypes.at(i)->isComplexType() && anonymousTypes.at(i)->isDefinedBySchema())
+ complexTypes.append(anonymousTypes.at(i));
+ }
+
+ QSet<XsdComplexType::Ptr> visitedTypes;
+ for (int i = 0; i < complexTypes.count(); ++i) {
+ if (XsdComplexType::Ptr(complexTypes.at(i))->contentType()->variety() == XsdComplexType::ContentType::Simple)
+ resolveSimpleContentComplexTypes(complexTypes.at(i), visitedTypes);
+ }
+}
+
+void XsdSchemaResolver::resolveSimpleContentComplexTypes(const XsdComplexType::Ptr &complexType, QSet<XsdComplexType::Ptr> &visitedTypes)
+{
+ if (visitedTypes.contains(complexType))
+ return;
+ else
+ visitedTypes.insert(complexType);
+
+ const SchemaType::Ptr baseType = complexType->wxsSuperType();
+
+ // at this point simple types have been resolved already, so we care about
+ // complex types here only
+
+ // http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.ctsc
+ // 1
+ if (baseType->isComplexType() && baseType->isDefinedBySchema()) {
+ const XsdComplexType::Ptr complexBaseType = baseType;
+
+ resolveSimpleContentComplexTypes(complexBaseType, visitedTypes);
+
+ if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
+ if (complexType->derivationMethod() == XsdComplexType::DerivationRestriction) {
+ if (complexType->contentType()->simpleType()) {
+ // 1.1 contains the content of the <simpleType> already
+ } else {
+ // 1.2
+ const XsdSimpleType::Ptr anonType(new XsdSimpleType());
+ anonType->setCategory(complexBaseType->contentType()->simpleType()->category());
+ anonType->setDerivationMethod(XsdSimpleType::DerivationRestriction);
+ anonType->setWxsSuperType(complexBaseType->contentType()->simpleType());
+ anonType->setFacets(complexTypeFacets(complexType));
+
+ QSet<AnySimpleType::Ptr> visitedPrimitiveTypes;
+ const AnySimpleType::Ptr primitiveType = findPrimitiveType(anonType->wxsSuperType(), visitedPrimitiveTypes);
+ anonType->setPrimitiveType(primitiveType);
+
+ complexType->contentType()->setSimpleType(anonType);
+
+ m_schema->addAnonymousType(anonType);
+ m_componentLocationHash.insert(anonType, m_componentLocationHash.value(complexType));
+ }
+ } else if (complexBaseType->derivationMethod() == XsdComplexType::DerivationExtension) { // 3
+ complexType->contentType()->setSimpleType(complexBaseType->contentType()->simpleType());
+ }
+ } else if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed &&
+ complexType->derivationMethod() == XsdComplexType::DerivationRestriction &&
+ XsdSchemaHelper::isParticleEmptiable(complexBaseType->contentType()->particle())) { // 2
+ // simple type was already set in parser
+
+ const XsdSimpleType::Ptr anonType(new XsdSimpleType());
+ anonType->setCategory(complexType->contentType()->simpleType()->category());
+ anonType->setDerivationMethod(XsdSimpleType::DerivationRestriction);
+ anonType->setWxsSuperType(complexType->contentType()->simpleType());
+ anonType->setFacets(complexTypeFacets(complexType));
+
+ QSet<AnySimpleType::Ptr> visitedPrimitiveTypes;
+ const AnySimpleType::Ptr primitiveType = findPrimitiveType(anonType->wxsSuperType(), visitedPrimitiveTypes);
+ anonType->setPrimitiveType(primitiveType);
+
+ complexType->contentType()->setSimpleType(anonType);
+
+ m_schema->addAnonymousType(anonType);
+ m_componentLocationHash.insert(anonType, m_componentLocationHash.value(complexType));
+ } else {
+ complexType->contentType()->setSimpleType(BuiltinTypes::xsAnySimpleType);
+ }
+ } else if (baseType->isSimpleType()) { // 4
+ complexType->contentType()->setSimpleType(baseType);
+ } else { // 5
+ complexType->contentType()->setSimpleType(BuiltinTypes::xsAnySimpleType);
+ }
+}
+
+void XsdSchemaResolver::resolveComplexContentComplexTypes()
+{
+ XsdComplexType::List complexTypes;
+
+ // first collect the global complex types
+ const SchemaType::List types = m_schema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema())
+ complexTypes.append(types.at(i));
+ }
+
+ // then collect all anonymous simple types
+ const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
+ for (int i = 0; i < anonymousTypes.count(); ++i) {
+ if (anonymousTypes.at(i)->isComplexType() && anonymousTypes.at(i)->isDefinedBySchema())
+ complexTypes.append(anonymousTypes.at(i));
+ }
+
+ QSet<XsdComplexType::Ptr> visitedTypes;
+ for (int i = 0; i < complexTypes.count(); ++i) {
+ if (XsdComplexType::Ptr(complexTypes.at(i))->contentType()->variety() != XsdComplexType::ContentType::Simple)
+ resolveComplexContentComplexTypes(complexTypes.at(i), visitedTypes);
+ }
+}
+
+void XsdSchemaResolver::resolveComplexContentComplexTypes(const XsdComplexType::Ptr &complexType, QSet<XsdComplexType::Ptr> &visitedTypes)
+{
+ if (visitedTypes.contains(complexType))
+ return;
+ else
+ visitedTypes.insert(complexType);
+
+ ComplexContentType item;
+ bool foundCorrespondingItem = false;
+ for (int i = 0; i < m_complexContentTypes.count(); ++i) {
+ if (m_complexContentTypes.at(i).complexType == complexType) {
+ item = m_complexContentTypes.at(i);
+ foundCorrespondingItem = true;
+ break;
+ }
+ }
+
+ if (!foundCorrespondingItem)
+ return;
+
+ const SchemaType::Ptr baseType = complexType->wxsSuperType();
+
+ // at this point simple types have been resolved already, so we care about
+ // complex types here only
+ if (baseType->isComplexType() && baseType->isDefinedBySchema())
+ resolveComplexContentComplexTypes(XsdComplexType::Ptr(baseType), visitedTypes);
+
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.ctcc.common
+
+ // 3
+ XsdParticle::Ptr effectiveContent;
+ if (!item.explicitContent) { // 3.1
+ if (item.effectiveMixed == true) { // 3.1.1
+ const XsdParticle::Ptr particle(new XsdParticle());
+ particle->setMinimumOccurs(1);
+ particle->setMaximumOccurs(1);
+ particle->setMaximumOccursUnbounded(false);
+
+ const XsdModelGroup::Ptr sequence(new XsdModelGroup());
+ sequence->setCompositor(XsdModelGroup::SequenceCompositor);
+ particle->setTerm(sequence);
+
+ effectiveContent = particle;
+ } else { // 3.1.2
+ effectiveContent = XsdParticle::Ptr();
+ }
+ } else { // 3.2
+ effectiveContent = item.explicitContent;
+ }
+
+ // 4
+ XsdComplexType::ContentType::Ptr explicitContentType(new XsdComplexType::ContentType());
+ if (item.complexType->derivationMethod() == XsdComplexType::DerivationRestriction) { // 4.1
+ if (!effectiveContent) { // 4.1.1
+ explicitContentType->setVariety(XsdComplexType::ContentType::Empty);
+ } else { // 4.1.2
+ if (item.effectiveMixed == true)
+ explicitContentType->setVariety(XsdComplexType::ContentType::Mixed);
+ else
+ explicitContentType->setVariety(XsdComplexType::ContentType::ElementOnly);
+
+ explicitContentType->setParticle(effectiveContent);
+ }
+ } else if (item.complexType->derivationMethod() == XsdComplexType::DerivationExtension) { // 4.2
+ const SchemaType::Ptr baseType = item.complexType->wxsSuperType();
+ if (baseType->isSimpleType() || (baseType->isComplexType() && baseType->isDefinedBySchema() && (XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::Empty ||
+ XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::Simple))) { // 4.2.1
+ if (!effectiveContent) {
+ explicitContentType->setVariety(XsdComplexType::ContentType::Empty);
+ } else {
+ if (item.effectiveMixed == true)
+ explicitContentType->setVariety(XsdComplexType::ContentType::Mixed);
+ else
+ explicitContentType->setVariety(XsdComplexType::ContentType::ElementOnly);
+
+ explicitContentType->setParticle(effectiveContent);
+ }
+ } else if (baseType->isComplexType() && baseType->isDefinedBySchema() && (XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::ElementOnly ||
+ XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::Mixed) && !effectiveContent) { // 4.2.2
+ const XsdComplexType::Ptr complexBaseType(baseType);
+
+ explicitContentType = complexBaseType->contentType();
+ } else { // 4.2.3
+ explicitContentType->setVariety(item.effectiveMixed ? XsdComplexType::ContentType::Mixed : XsdComplexType::ContentType::ElementOnly);
+
+ XsdParticle::Ptr baseParticle;
+ if (baseType == BuiltinTypes::xsAnyType) {
+ // we need a workaround here, since the xsAnyType is no real (aka XsdComplexType) complex type...
+
+ baseParticle = XsdParticle::Ptr(new XsdParticle());
+ baseParticle->setMinimumOccurs(1);
+ baseParticle->setMaximumOccurs(1);
+ baseParticle->setMaximumOccursUnbounded(false);
+
+ const XsdModelGroup::Ptr group(new XsdModelGroup());
+ group->setCompositor(XsdModelGroup::SequenceCompositor);
+
+ const XsdParticle::Ptr particle(new XsdParticle());
+ particle->setMinimumOccurs(0);
+ particle->setMaximumOccursUnbounded(true);
+
+ const XsdWildcard::Ptr wildcard(new XsdWildcard());
+ wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any);
+ wildcard->setProcessContents(XsdWildcard::Lax);
+
+ particle->setTerm(wildcard);
+ XsdParticle::List particles;
+ particles.append(particle);
+ group->setParticles(particles);
+ baseParticle->setTerm(group);
+ } else {
+ const XsdComplexType::Ptr complexBaseType(baseType);
+ baseParticle = complexBaseType->contentType()->particle();
+ }
+ if (baseParticle && baseParticle->term()->isModelGroup() && (XsdModelGroup::Ptr(baseParticle->term())->compositor() == XsdModelGroup::AllCompositor) &&
+ (!item.explicitContent)) { // 4.2.3.1
+
+ explicitContentType->setParticle(baseParticle);
+ } else if (baseParticle && baseParticle->term()->isModelGroup() && (XsdModelGroup::Ptr(baseParticle->term())->compositor() == XsdModelGroup::AllCompositor) &&
+ (effectiveContent->term()->isModelGroup() && (XsdModelGroup::Ptr(effectiveContent->term())->compositor() == XsdModelGroup::AllCompositor))) { // 4.2.3.2
+ const XsdParticle::Ptr particle(new XsdParticle());
+ particle->setMinimumOccurs(effectiveContent->minimumOccurs());
+ particle->setMaximumOccurs(1);
+ particle->setMaximumOccursUnbounded(false);
+
+ const XsdModelGroup::Ptr group(new XsdModelGroup());
+ group->setCompositor(XsdModelGroup::AllCompositor);
+ XsdParticle::List particles = XsdModelGroup::Ptr(baseParticle->term())->particles();
+ particles << XsdModelGroup::Ptr(effectiveContent->term())->particles();
+ group->setParticles(particles);
+ particle->setTerm(group);
+
+ explicitContentType->setParticle(particle);
+ } else { // 4.2.3.3
+ const XsdParticle::Ptr particle(new XsdParticle());
+ particle->setMinimumOccurs(1);
+ particle->setMaximumOccurs(1);
+ particle->setMaximumOccursUnbounded(false);
+
+ const XsdModelGroup::Ptr group(new XsdModelGroup());
+ group->setCompositor(XsdModelGroup::SequenceCompositor);
+
+ if (effectiveContent && effectiveContent->term()->isModelGroup() && XsdModelGroup::Ptr(effectiveContent->term())->compositor() == XsdModelGroup::AllCompositor) {
+ m_context->error(QtXmlPatterns::tr("content model of complex type %1 contains %2 element so it cannot be derived by extension from a non-empty type")
+ .arg(formatType(m_namePool, complexType)).arg(formatKeyword("all")), XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+
+ if (baseParticle && baseParticle->term()->isModelGroup() && XsdModelGroup::Ptr(baseParticle->term())->compositor() == XsdModelGroup::AllCompositor) {
+ m_context->error(QtXmlPatterns::tr("complex type %1 cannot be derived by extension from %2 as the latter contains %3 element in its content model")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, baseType))
+ .arg(formatKeyword("all")), XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+
+ XsdParticle::List particles;
+ if (baseParticle)
+ particles << baseParticle;
+ if (effectiveContent)
+ particles << effectiveContent;
+ group->setParticles(particles);
+ particle->setTerm(group);
+
+ explicitContentType->setParticle(particle);
+ }
+
+ if (baseType->isDefinedBySchema()) { // xs:anyType has no open content
+ const XsdComplexType::Ptr complexBaseType(baseType);
+ explicitContentType->setOpenContent(complexBaseType->contentType()->openContent());
+ }
+ }
+ }
+
+ // 5
+ XsdComplexType::OpenContent::Ptr wildcardElement;
+ if (item.complexType->contentType()->openContent()) { // 5.1
+ wildcardElement = item.complexType->contentType()->openContent();
+ } else {
+ if (m_defaultOpenContent) { // 5.2
+ if ((explicitContentType->variety() != XsdComplexType::ContentType::Empty) || // 5.2.1
+ (explicitContentType->variety() == XsdComplexType::ContentType::Empty && m_defaultOpenContentAppliesToEmpty)) { // 5.2.2
+ wildcardElement = m_defaultOpenContent;
+ }
+ }
+ }
+
+ // 6
+ if (!wildcardElement) { // 6.1
+ item.complexType->setContentType(explicitContentType);
+ } else {
+ if (wildcardElement->mode() == XsdComplexType::OpenContent::None) { // 6.2
+ const XsdComplexType::ContentType::Ptr contentType(new XsdComplexType::ContentType());
+ contentType->setVariety(explicitContentType->variety());
+ contentType->setParticle(explicitContentType->particle());
+
+ item.complexType->setContentType(contentType);
+ } else { // 6.3
+ const XsdComplexType::ContentType::Ptr contentType(new XsdComplexType::ContentType());
+
+ if (explicitContentType->variety() == XsdComplexType::ContentType::Empty)
+ contentType->setVariety(XsdComplexType::ContentType::ElementOnly);
+ else
+ contentType->setVariety(explicitContentType->variety());
+
+ if (explicitContentType->variety() == XsdComplexType::ContentType::Empty) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ particle->setMinimumOccurs(1);
+ particle->setMaximumOccurs(1);
+ const XsdModelGroup::Ptr sequence(new XsdModelGroup());
+ sequence->setCompositor(XsdModelGroup::SequenceCompositor);
+ particle->setTerm(sequence);
+ contentType->setParticle(particle);
+ } else {
+ contentType->setParticle(explicitContentType->particle());
+ }
+
+ const XsdComplexType::OpenContent::Ptr openContent(new XsdComplexType::OpenContent());
+ if (wildcardElement)
+ openContent->setMode(wildcardElement->mode());
+ else
+ openContent->setMode(XsdComplexType::OpenContent::Interleave);
+
+ if (wildcardElement)
+ openContent->setWildcard(wildcardElement->wildcard());
+
+ item.complexType->setContentType(contentType);
+ }
+ }
+}
+
+void XsdSchemaResolver::resolveAttributeTypes()
+{
+ for (int i = 0; i < m_attributeTypes.count(); ++i) {
+ const AttributeType item = m_attributeTypes.at(i);
+
+ SchemaType::Ptr type = m_schema->type(item.typeName);
+ if (!type) {
+ // maybe it's a basic type...
+ type = m_context->schemaTypeFactory()->createSchemaType(item.typeName);
+ if (!type) {
+ m_context->error(QtXmlPatterns::tr("type %1 of %2 element cannot be resolved")
+ .arg(formatType(m_namePool, item.typeName))
+ .arg(formatElement("attribute")),
+ XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+ }
+
+ if (!type->isSimpleType() && type->category() != SchemaType::None) {
+ m_context->error(QtXmlPatterns::tr("type of %1 element must be a simple type, %2 is not")
+ .arg(formatElement("attribute"))
+ .arg(formatType(m_namePool, item.typeName)),
+ XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+
+ item.attribute->setType(type);
+ }
+}
+
+void XsdSchemaResolver::resolveAlternativeTypes()
+{
+ for (int i = 0; i < m_alternativeTypes.count(); ++i) {
+ const AlternativeType item = m_alternativeTypes.at(i);
+
+ SchemaType::Ptr type = m_schema->type(item.typeName);
+ if (!type) {
+ // maybe it's a basic type...
+ type = m_context->schemaTypeFactory()->createSchemaType(item.typeName);
+ if (!type) {
+ m_context->error(QtXmlPatterns::tr("type %1 of %2 element cannot be resolved")
+ .arg(formatType(m_namePool, item.typeName))
+ .arg(formatElement("alternative")),
+ XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+ }
+
+ item.alternative->setType(type);
+ }
+
+ for (int i = 0; i < m_alternativeTypeElements.count(); ++i) {
+ const AlternativeTypeElement item = m_alternativeTypeElements.at(i);
+ item.alternative->setType(item.element->type());
+ }
+}
+
+bool hasCircularSubstitutionGroup(const XsdElement::Ptr &current, const XsdElement::Ptr &head, const NamePool::Ptr &namePool)
+{
+ if (current == head)
+ return true;
+ else {
+ const XsdElement::List elements = current->substitutionGroupAffiliations();
+ for (int i = 0; i < elements.count(); ++i) {
+ if (hasCircularSubstitutionGroup(elements.at(i), head, namePool))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void XsdSchemaResolver::resolveSubstitutionGroupAffiliations()
+{
+ for (int i = 0; i < m_substitutionGroupAffiliations.count(); ++i) {
+ const SubstitutionGroupAffiliation item = m_substitutionGroupAffiliations.at(i);
+
+ XsdElement::List affiliations;
+ for (int j = 0; j < item.elementNames.count(); ++j) {
+ const XsdElement::Ptr element = m_schema->element(item.elementNames.at(j));
+ if (!element) {
+ m_context->error(QtXmlPatterns::tr("substitution group %1 of %2 element cannot be resolved")
+ .arg(formatKeyword(m_namePool, item.elementNames.at(j)))
+ .arg(formatElement("element")),
+ XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#e-props-correct 5)
+ if (hasCircularSubstitutionGroup(element, item.element, m_namePool)) {
+ m_context->error(QtXmlPatterns::tr("substitution group %1 has circular definition").arg(formatKeyword(m_namePool, item.elementNames.at(j))), XsdSchemaContext::XSDError, item.location);
+ return;
+ }
+
+ affiliations.append(element);
+ }
+
+ item.element->setSubstitutionGroupAffiliations(affiliations);
+ }
+
+ for (int i = 0; i < m_substitutionGroupTypes.count(); ++i) {
+ const XsdElement::Ptr element = m_substitutionGroupTypes.at(i);
+ element->setType(element->substitutionGroupAffiliations().first()->type());
+ }
+}
+
+bool isSubstGroupHeadOf(const XsdElement::Ptr &head, const XsdElement::Ptr &element, const NamePool::Ptr &namePool)
+{
+ if (head->name(namePool) == element->name(namePool))
+ return true;
+
+ const XsdElement::List affiliations = element->substitutionGroupAffiliations();
+ for (int i = 0; i < affiliations.count(); ++i) {
+ if (isSubstGroupHeadOf(head, affiliations.at(i), namePool))
+ return true;
+ }
+
+ return false;
+}
+
+void XsdSchemaResolver::resolveSubstitutionGroups()
+{
+ const XsdElement::List elements = m_schema->elements();
+ for (int i = 0; i < elements.count(); ++i) {
+ const XsdElement::Ptr element = elements.at(i);
+
+ // the element is always itself in the substitution group
+ element->addSubstitutionGroup(element);
+
+ for (int j = 0; j < elements.count(); ++j) {
+ if (i == j)
+ continue;
+
+ if (isSubstGroupHeadOf(element, elements.at(j), m_namePool))
+ element->addSubstitutionGroup(elements.at(j));
+ }
+ }
+}
+
+void XsdSchemaResolver::resolveTermReferences()
+{
+ // first the global complex types
+ const SchemaType::List types = m_schema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType = types.at(i);
+ if (complexType->contentType()->variety() != XsdComplexType::ContentType::ElementOnly && complexType->contentType()->variety() != XsdComplexType::ContentType::Mixed)
+ continue;
+
+ resolveTermReference(complexType->contentType()->particle(), QSet<QXmlName>());
+ }
+
+ // then all anonymous complex types
+ const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
+ for (int i = 0; i < anonymousTypes.count(); ++i) {
+ if (!(anonymousTypes.at(i)->isComplexType()) || !anonymousTypes.at(i)->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType = anonymousTypes.at(i);
+ if (complexType->contentType()->variety() != XsdComplexType::ContentType::ElementOnly && complexType->contentType()->variety() != XsdComplexType::ContentType::Mixed)
+ continue;
+
+ resolveTermReference(complexType->contentType()->particle(), QSet<QXmlName>());
+ }
+
+ const XsdModelGroup::List groups = m_schema->elementGroups();
+ for (int i = 0; i < groups.count(); ++i) {
+ const XsdParticle::Ptr particle(new XsdParticle());
+ particle->setTerm(groups.at(i));
+ resolveTermReference(particle, QSet<QXmlName>());
+ }
+}
+
+void XsdSchemaResolver::resolveTermReference(const XsdParticle::Ptr &particle, QSet<QXmlName> visitedGroups)
+{
+ if (!particle)
+ return;
+
+ const XsdTerm::Ptr term = particle->term();
+
+ // if it is a model group, we iterate over it recursive...
+ if (term->isModelGroup()) {
+ const XsdModelGroup::Ptr modelGroup = term;
+ const XsdParticle::List particles = modelGroup->particles();
+
+ for (int i = 0; i < particles.count(); ++i) {
+ resolveTermReference(particles.at(i), visitedGroups);
+ }
+
+ // check for unique names of elements inside all compositor
+ if (modelGroup->compositor() != XsdModelGroup::ChoiceCompositor) {
+ for (int i = 0; i < particles.count(); ++i) {
+ const XsdParticle::Ptr particle = particles.at(i);
+ const XsdTerm::Ptr term = particle->term();
+
+ if (!(term->isElement()))
+ continue;
+
+ for (int j = 0; j < particles.count(); ++j) {
+ const XsdParticle::Ptr otherParticle = particles.at(j);
+ const XsdTerm::Ptr otherTerm = otherParticle->term();
+
+ if (otherTerm->isElement() && i != j) {
+ const XsdElement::Ptr element = term;
+ const XsdElement::Ptr otherElement = otherTerm;
+
+ if (element->name(m_namePool) == otherElement->name(m_namePool)) {
+ if (modelGroup->compositor() == XsdModelGroup::AllCompositor) {
+ m_context->error(QtXmlPatterns::tr("duplicated element names %1 in %2 element")
+ .arg(formatKeyword(element->displayName(m_namePool)))
+ .arg(formatElement("all")),
+ XsdSchemaContext::XSDError, sourceLocation(modelGroup));
+ return;
+ } else if (modelGroup->compositor() == XsdModelGroup::SequenceCompositor) {
+ if (element->type() != otherElement->type()) { // not same variety
+ m_context->error(QtXmlPatterns::tr("duplicated element names %1 in %2 element")
+ .arg(formatKeyword(element->displayName(m_namePool)))
+ .arg(formatElement("sequence")),
+ XsdSchemaContext::XSDError, sourceLocation(modelGroup));
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return;
+ }
+
+ // ...otherwise we have reached the end of recursion...
+ if (!term->isReference())
+ return;
+
+ // ...or we have reached a reference term that must be resolved
+ const XsdReference::Ptr reference = term;
+ switch (reference->type()) {
+ case XsdReference::Element:
+ {
+ const XsdElement::Ptr element = m_schema->element(reference->referenceName());
+ if (element) {
+ particle->setTerm(element);
+ } else {
+ m_context->error(QtXmlPatterns::tr("reference %1 of %2 element cannot be resolved")
+ .arg(formatKeyword(m_namePool, reference->referenceName()))
+ .arg(formatElement("element")),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ return;
+ }
+ }
+ break;
+ case XsdReference::ModelGroup:
+ {
+ const XsdModelGroup::Ptr modelGroup = m_schema->elementGroup(reference->referenceName());
+ if (modelGroup) {
+ if (visitedGroups.contains(modelGroup->name(m_namePool))) {
+ m_context->error(QtXmlPatterns::tr("circular group reference for %1").arg(formatKeyword(modelGroup->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ } else {
+ visitedGroups.insert(modelGroup->name(m_namePool));
+ }
+
+ particle->setTerm(modelGroup);
+
+ // start recursive iteration here as well to get all references resolved
+ const XsdParticle::List particles = modelGroup->particles();
+ for (int i = 0; i < particles.count(); ++i) {
+ resolveTermReference(particles.at(i), visitedGroups);
+ }
+
+ if (modelGroup->compositor() == XsdModelGroup::AllCompositor) {
+ if (m_allGroups.contains(reference)) {
+ m_context->error(QtXmlPatterns::tr("%1 element is not allowed in this scope").arg(formatElement("all")),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ return;
+ }
+ if (particle->maximumOccursUnbounded() || particle->maximumOccurs() != 1) {
+ m_context->error(QtXmlPatterns::tr("%1 element cannot have %2 attribute with value other than %3")
+ .arg(formatElement("all"))
+ .arg(formatAttribute("maxOccurs"))
+ .arg(formatData("1")),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ return;
+ }
+ if (particle->minimumOccurs() != 0 && particle->minimumOccurs() != 1) {
+ m_context->error(QtXmlPatterns::tr("%1 element cannot have %2 attribute with value other than %3 or %4")
+ .arg(formatElement("all"))
+ .arg(formatAttribute("minOccurs"))
+ .arg(formatData("0"))
+ .arg(formatData("1")),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ return;
+ }
+ }
+ } else {
+ m_context->error(QtXmlPatterns::tr("reference %1 of %2 element cannot be resolved")
+ .arg(formatKeyword(m_namePool, reference->referenceName()))
+ .arg(formatElement("group")),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ return;
+ }
+ }
+ break;
+ }
+}
+
+void XsdSchemaResolver::resolveAttributeTermReferences()
+{
+ // first all global attribute groups
+ const XsdAttributeGroup::List attributeGroups = m_schema->attributeGroups();
+ for (int i = 0; i < attributeGroups.count(); ++i) {
+ XsdWildcard::Ptr wildcard = attributeGroups.at(i)->wildcard();
+ const XsdAttributeUse::List uses = resolveAttributeTermReferences(attributeGroups.at(i)->attributeUses(), wildcard, QSet<QXmlName>());
+ attributeGroups.at(i)->setAttributeUses(uses);
+ attributeGroups.at(i)->setWildcard(wildcard);
+ }
+
+ // then the global complex types
+ const SchemaType::List types = m_schema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType = types.at(i);
+ const XsdAttributeUse::List attributeUses = complexType->attributeUses();
+
+ XsdWildcard::Ptr wildcard = complexType->attributeWildcard();
+ const XsdAttributeUse::List uses = resolveAttributeTermReferences(attributeUses, wildcard, QSet<QXmlName>());
+ complexType->setAttributeUses(uses);
+ complexType->setAttributeWildcard(wildcard);
+ }
+
+ // and afterwards all anonymous complex types
+ const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
+ for (int i = 0; i < anonymousTypes.count(); ++i) {
+ if (!(anonymousTypes.at(i)->isComplexType()) || !anonymousTypes.at(i)->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType = anonymousTypes.at(i);
+ const XsdAttributeUse::List attributeUses = complexType->attributeUses();
+
+ XsdWildcard::Ptr wildcard = complexType->attributeWildcard();
+ const XsdAttributeUse::List uses = resolveAttributeTermReferences(attributeUses, wildcard, QSet<QXmlName>());
+ complexType->setAttributeUses(uses);
+ complexType->setAttributeWildcard(wildcard);
+ }
+}
+
+XsdAttributeUse::List XsdSchemaResolver::resolveAttributeTermReferences(const XsdAttributeUse::List &attributeUses, XsdWildcard::Ptr &wildcard, QSet<QXmlName> visitedAttributeGroups)
+{
+ XsdAttributeUse::List resolvedAttributeUses;
+
+ for (int i = 0; i < attributeUses.count(); ++i) {
+ const XsdAttributeUse::Ptr attributeUse = attributeUses.at(i);
+ if (attributeUse->isAttributeUse()) {
+ // it is a real attribute use, so no need to resolve it
+ resolvedAttributeUses.append(attributeUse);
+ } else if (attributeUse->isReference()) {
+ // it is just a reference, so resolve it to the real attribute use
+
+ const XsdAttributeReference::Ptr reference = attributeUse;
+ if (reference->type() == XsdAttributeReference::AttributeUse) {
+
+ // lookup the real attribute
+ const XsdAttribute::Ptr attribute = m_schema->attribute(reference->referenceName());
+ if (!attribute) {
+ m_context->error(QtXmlPatterns::tr("reference %1 of %2 element cannot be resolved")
+ .arg(formatKeyword(m_namePool, reference->referenceName()))
+ .arg(formatElement("attribute")),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ return XsdAttributeUse::List();
+ }
+
+ // if both, reference and definition have a fixed or default value set, then they must be equal
+ if (attribute->valueConstraint() && attributeUse->valueConstraint()) {
+ if (attribute->valueConstraint()->value() != attributeUse->valueConstraint()->value()) {
+ m_context->error(QtXmlPatterns::tr("%1 or %2 attribute of reference %3 does not match with the attribute declaration %4")
+ .arg(formatAttribute("fixed"))
+ .arg(formatAttribute("default"))
+ .arg(formatKeyword(m_namePool, reference->referenceName()))
+ .arg(formatKeyword(attribute->displayName(m_namePool))),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ return XsdAttributeUse::List();
+ }
+ }
+
+ attributeUse->setAttribute(attribute);
+ if (!attributeUse->valueConstraint() && attribute->valueConstraint())
+ attributeUse->setValueConstraint(XsdAttributeUse::ValueConstraint::fromAttributeValueConstraint(attribute->valueConstraint()));
+
+ resolvedAttributeUses.append(attributeUse);
+ } else if (reference->type() == XsdAttributeReference::AttributeGroup) {
+ const XsdAttributeGroup::Ptr attributeGroup = m_schema->attributeGroup(reference->referenceName());
+ if (!attributeGroup) {
+ m_context->error(QtXmlPatterns::tr("reference %1 of %2 element cannot be resolved")
+ .arg(formatKeyword(m_namePool, reference->referenceName()))
+ .arg(formatElement("attributeGroup")),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ return XsdAttributeUse::List();
+ }
+ if (visitedAttributeGroups.contains(attributeGroup->name(m_namePool))) {
+ m_context->error(QtXmlPatterns::tr("attribute group %1 has circular reference").arg(formatKeyword(m_namePool, reference->referenceName())),
+ XsdSchemaContext::XSDError, reference->sourceLocation());
+ return XsdAttributeUse::List();
+ } else {
+ visitedAttributeGroups.insert(attributeGroup->name(m_namePool));
+ }
+
+ // resolve attribute wildcards as defined in http://www.w3.org/TR/xmlschema11-1/#declare-attributeGroup-wildcard
+ XsdWildcard::Ptr childWildcard;
+ resolvedAttributeUses << resolveAttributeTermReferences(attributeGroup->attributeUses(), childWildcard, visitedAttributeGroups);
+ if (!childWildcard) {
+ if (attributeGroup->wildcard()) {
+ if (wildcard) {
+ const XsdWildcard::ProcessContents contents = wildcard->processContents();
+ wildcard = XsdSchemaHelper::wildcardIntersection(wildcard, attributeGroup->wildcard());
+ wildcard->setProcessContents(contents);
+ } else {
+ wildcard = attributeGroup->wildcard();
+ }
+ }
+ } else {
+ XsdWildcard::Ptr newWildcard;
+ if (attributeGroup->wildcard()) {
+ const XsdWildcard::ProcessContents contents = attributeGroup->wildcard()->processContents();
+ newWildcard = XsdSchemaHelper::wildcardIntersection(attributeGroup->wildcard(), childWildcard);
+ newWildcard->setProcessContents(contents);
+ } else {
+ newWildcard = childWildcard;
+ }
+
+ if (wildcard) {
+ const XsdWildcard::ProcessContents contents = wildcard->processContents();
+ wildcard = XsdSchemaHelper::wildcardIntersection(wildcard, newWildcard);
+ wildcard->setProcessContents(contents);
+ } else {
+ wildcard = newWildcard;
+ }
+ }
+ }
+ }
+ }
+
+ return resolvedAttributeUses;
+}
+
+void XsdSchemaResolver::resolveAttributeInheritance()
+{
+ // collect the global and anonymous complex types
+ SchemaType::List types = m_schema->types();
+ types << m_schema->anonymousTypes();
+
+ QSet<XsdComplexType::Ptr> visitedTypes;
+ for (int i = 0; i < types.count(); ++i) {
+ if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema())
+ continue;
+
+ const XsdComplexType::Ptr complexType = types.at(i);
+
+ resolveAttributeInheritance(complexType, visitedTypes);
+ }
+}
+
+bool isValidWildcardRestriction(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &baseWildcard)
+{
+ if (wildcard->namespaceConstraint()->variety() == baseWildcard->namespaceConstraint()->variety()) {
+ if (!XsdSchemaHelper::checkWildcardProcessContents(baseWildcard, wildcard))
+ return false;
+ }
+
+ if (wildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Any &&
+ baseWildcard->namespaceConstraint()->variety() != XsdWildcard::NamespaceConstraint::Any ) {
+ return false;
+ }
+ if (baseWildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Not &&
+ wildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Enumeration) {
+ if (!baseWildcard->namespaceConstraint()->namespaces().intersect(wildcard->namespaceConstraint()->namespaces()).isEmpty())
+ return false;
+ }
+ if (baseWildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Enumeration &&
+ wildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Enumeration) {
+ if (!wildcard->namespaceConstraint()->namespaces().subtract(baseWildcard->namespaceConstraint()->namespaces()).isEmpty())
+ return false;
+ }
+
+ return true;
+}
+
+/*
+ * Since we inherit the attributes from our base class we have to walk up in the
+ * inheritance hierarchy first and resolve the attribute inheritance top-down.
+ */
+void XsdSchemaResolver::resolveAttributeInheritance(const XsdComplexType::Ptr &complexType, QSet<XsdComplexType::Ptr> &visitedTypes)
+{
+ if (visitedTypes.contains(complexType))
+ return;
+ else
+ visitedTypes.insert(complexType);
+
+ const SchemaType::Ptr baseType = complexType->wxsSuperType();
+ Q_ASSERT(baseType);
+
+ if (!(baseType->isComplexType()) || !baseType->isDefinedBySchema())
+ return;
+
+ const XsdComplexType::Ptr complexBaseType = baseType;
+
+ resolveAttributeInheritance(complexBaseType, visitedTypes);
+
+ // @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.attuses
+
+ // 1 and 2 (the attribute groups have been resolved here already)
+ const XsdAttributeUse::List uses = complexBaseType->attributeUses();
+
+ if (complexType->derivationMethod() == XsdComplexType::DerivationRestriction) { // 3.2
+ const XsdAttributeUse::List currentUses = complexType->attributeUses();
+
+ // 3.2.1 and 3.2.2 As we also keep the prohibited attributes as objects, the algorithm below
+ // handles both the same way
+
+ // add only these attribute uses of the base type that match one of the following criteria:
+ // 1: there is no attribute use with the same name in type
+ // 2: there is no attribute with the same name marked as prohibited in type
+ for (int j = 0; j < uses.count(); ++j) {
+ const XsdAttributeUse::Ptr use = uses.at(j);
+ bool found = false;
+ for (int k = 0; k < currentUses.count(); ++k) {
+ if (use->attribute()->name(m_namePool) == currentUses.at(k)->attribute()->name(m_namePool)) {
+ found = true;
+
+ // check if prohibited usage is violated
+ if ((use->useType() == XsdAttributeUse::ProhibitedUse) && (currentUses.at(k)->useType() != XsdAttributeUse::ProhibitedUse)) {
+ m_context->error(QtXmlPatterns::tr("%1 attribute in %2 must have %3 use like in base type %4")
+ .arg(formatAttribute(use->attribute()->displayName(m_namePool)))
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatData("prohibited"))
+ .arg(formatType(m_namePool, complexBaseType)),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+
+ break;
+ }
+ }
+
+ if (!found && uses.at(j)->useType() != XsdAttributeUse::ProhibitedUse) {
+ complexType->addAttributeUse(uses.at(j));
+ }
+ }
+ } else if (complexType->derivationMethod() == XsdComplexType::DerivationExtension) { // 3.1
+ QHash<QXmlName, XsdAttributeUse::Ptr> availableUses;
+
+ // fill hash with attribute uses of current type for faster lookup
+ {
+ const XsdAttributeUse::List attributeUses = complexType->attributeUses();
+
+ for (int i = 0; i < attributeUses.count(); ++i) {
+ availableUses.insert(attributeUses.at(i)->attribute()->name(m_namePool), attributeUses.at(i));
+ }
+ }
+
+ // just add the attribute uses of the base type
+ for (int i = 0; i < uses.count(); ++i) {
+ const XsdAttributeUse::Ptr currentAttributeUse = uses.at(i);
+
+ // if the base type defines the attribute as prohibited but we override it in current type, then don't copy the prohibited attribute use
+ if ((currentAttributeUse->useType() == XsdAttributeUse::ProhibitedUse) && availableUses.contains(currentAttributeUse->attribute()->name(m_namePool)))
+ continue;
+
+ complexType->addAttributeUse(uses.at(i));
+ }
+ }
+
+ // handle attribute wildcards: @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.anyatt
+
+ // 1
+ const XsdWildcard::Ptr completeWildcard(complexType->attributeWildcard());
+
+ if (complexType->derivationMethod() == XsdComplexType::DerivationRestriction) {
+ if (complexType->wxsSuperType()->isComplexType() && complexType->wxsSuperType()->isDefinedBySchema()) {
+ const XsdComplexType::Ptr complexBaseType(complexType->wxsSuperType());
+ if (complexType->attributeWildcard()) {
+ if (complexBaseType->attributeWildcard()) {
+ if (!isValidWildcardRestriction(complexType->attributeWildcard(), complexBaseType->attributeWildcard())) {
+ m_context->error(QtXmlPatterns::tr("attribute wildcard of %1 is not a valid restriction of attribute wildcard of base type %2")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, complexBaseType)),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+ } else {
+ m_context->error(QtXmlPatterns::tr("%1 has attribute wildcard but its base type %2 has not")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, complexBaseType)),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+ }
+ }
+ complexType->setAttributeWildcard(completeWildcard); // 2.1
+ } else if (complexType->derivationMethod() == XsdComplexType::DerivationExtension) {
+ XsdWildcard::Ptr baseWildcard; // 2.2.1
+ if (complexType->wxsSuperType()->isComplexType() && complexType->wxsSuperType()->isDefinedBySchema())
+ baseWildcard = XsdComplexType::Ptr(complexType->wxsSuperType())->attributeWildcard(); // 2.2.1.1
+ else
+ baseWildcard = XsdWildcard::Ptr(); // 2.2.1.2
+
+ if (!baseWildcard) {
+ complexType->setAttributeWildcard(completeWildcard); // 2.2.2.1
+ } else if (!completeWildcard) {
+ complexType->setAttributeWildcard(baseWildcard); // 2.2.2.2
+ } else {
+ XsdWildcard::Ptr unionWildcard = XsdSchemaHelper::wildcardUnion(completeWildcard, baseWildcard);
+ if (unionWildcard) {
+ unionWildcard->setProcessContents(completeWildcard->processContents());
+ complexType->setAttributeWildcard(unionWildcard); // 2.2.2.3
+ } else {
+ m_context->error(QtXmlPatterns::tr("union of attribute wildcard of type %1 and attribute wildcard of its base type %2 is not expressible")
+ .arg(formatType(m_namePool, complexType))
+ .arg(formatType(m_namePool, complexBaseType)),
+ XsdSchemaContext::XSDError, sourceLocation(complexType));
+ return;
+ }
+ }
+ }
+}
+
+void XsdSchemaResolver::resolveEnumerationFacetValues()
+{
+ XsdSimpleType::List simpleTypes;
+
+ // first collect the global simple types
+ const SchemaType::List types = m_schema->types();
+ for (int i = 0; i < types.count(); ++i) {
+ if (types.at(i)->isSimpleType())
+ simpleTypes.append(types.at(i));
+ }
+
+ // then collect all anonymous simple types
+ const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
+ for (int i = 0; i < anonymousTypes.count(); ++i) {
+ if (anonymousTypes.at(i)->isSimpleType())
+ simpleTypes.append(anonymousTypes.at(i));
+ }
+ // process all simple types
+ for (int i = 0; i < simpleTypes.count(); ++i) {
+ const XsdSimpleType::Ptr simpleType = simpleTypes.at(i);
+
+ // we resolve the enumeration values only for xs:QName and xs:NOTATION based types
+ if (BuiltinTypes::xsQName->wxsTypeMatches(simpleType) ||
+ BuiltinTypes::xsNOTATION->wxsTypeMatches(simpleType)) {
+ const XsdFacet::Hash facets = simpleType->facets();
+ if (facets.contains(XsdFacet::Enumeration)) {
+ AtomicValue::List newValues;
+
+ const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration);
+ const AtomicValue::List values = facet->multiValue();
+ for (int j = 0; j < values.count(); ++j) {
+ const AtomicValue::Ptr value = values.at(j);
+
+ Q_ASSERT(m_enumerationFacetValues.contains(value));
+ const NamespaceSupport support( m_enumerationFacetValues.value(value) );
+
+ const QString qualifiedName = value->as<DerivedString<TypeString> >()->stringValue();
+ if (!XPathHelper::isQName(qualifiedName)) {
+ m_context->error(QtXmlPatterns::tr("enumeration facet contains invalid content: {%1} is not a value of type %2")
+ .arg(formatData(qualifiedName))
+ .arg(formatType(m_namePool, BuiltinTypes::xsQName)),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+
+ QXmlName qNameValue;
+ bool result = support.processName(qualifiedName, NamespaceSupport::ElementName, qNameValue);
+ if (!result) {
+ m_context->error(QtXmlPatterns::tr("namespace prefix of qualified name %1 is not defined").arg(formatData(qualifiedName)),
+ XsdSchemaContext::XSDError, sourceLocation(simpleType));
+ return;
+ }
+
+ newValues.append(QNameValue::fromValue(m_namePool, qNameValue));
+ }
+ facet->setMultiValue(newValues);
+ }
+ }
+ }
+}
+
+QSourceLocation XsdSchemaResolver::sourceLocation(const NamedSchemaComponent::Ptr component) const
+{
+ if (m_componentLocationHash.contains(component)) {
+ return m_componentLocationHash.value(component);
+ } else {
+ QSourceLocation location;
+ location.setLine(1);
+ location.setColumn(1);
+ location.setUri(QString::fromLatin1("dummyUri"));
+
+ return location;
+ }
+}
+
+XsdFacet::Hash XsdSchemaResolver::complexTypeFacets(const XsdComplexType::Ptr &complexType) const
+{
+ for (int i = 0; i < m_complexBaseTypes.count(); ++i) {
+ if (m_complexBaseTypes.at(i).complexType == complexType)
+ return m_complexBaseTypes.at(i).facets;
+ }
+
+ return XsdFacet::Hash();
+}
+
+void XsdSchemaResolver::checkRedefinedGroups()
+{
+ for (int i = 0; i < m_redefinedGroups.count(); ++i) {
+ const RedefinedGroups item = m_redefinedGroups.at(i);
+
+ // create dummy particles...
+ const XsdParticle::Ptr redefinedParticle(new XsdParticle());
+ redefinedParticle->setTerm(item.redefinedGroup);
+ const XsdParticle::Ptr particle(new XsdParticle());
+ particle->setTerm(item.group);
+
+ // so that we can pass them to XsdParticleChecker::subsumes()
+ QString errorMsg;
+ if (!XsdParticleChecker::subsumes(particle, redefinedParticle, m_context, errorMsg)) {
+ m_context->error(QtXmlPatterns::tr("%1 element %2 is not a valid restriction of the %3 element it redefines: %4")
+ .arg(formatElement("group"))
+ .arg(formatData(item.redefinedGroup->displayName(m_namePool)))
+ .arg(formatElement("group"))
+ .arg(errorMsg),
+ XsdSchemaContext::XSDError, sourceLocation(item.redefinedGroup));
+ return;
+ }
+ }
+}
+
+void XsdSchemaResolver::checkRedefinedAttributeGroups()
+{
+ for (int i = 0; i < m_redefinedAttributeGroups.count(); ++i) {
+ const RedefinedAttributeGroups item = m_redefinedAttributeGroups.at(i);
+
+ QString errorMsg;
+ if (!XsdSchemaHelper::isValidAttributeGroupRestriction(item.redefinedGroup, item.group, m_context, errorMsg)) {
+ m_context->error(QtXmlPatterns::tr("%1 element %2 is not a valid restriction of the %3 element it redefines: %4")
+ .arg(formatElement("attributeGroup"))
+ .arg(formatData(item.redefinedGroup->displayName(m_namePool)))
+ .arg(formatElement("attributeGroup"))
+ .arg(errorMsg),
+ XsdSchemaContext::XSDError, sourceLocation(item.redefinedGroup));
+ return;
+ }
+ }
+}
+
+AnySimpleType::Ptr XsdSchemaResolver::findPrimitiveType(const AnySimpleType::Ptr &type, QSet<AnySimpleType::Ptr> &visitedTypes)
+{
+ if (visitedTypes.contains(type)) {
+ // found invalid circular reference...
+ return AnySimpleType::Ptr();
+ } else {
+ visitedTypes.insert(type);
+ }
+
+ const QXmlName typeName = type->name(m_namePool);
+ if (typeName == BuiltinTypes::xsString->name(m_namePool) ||
+ typeName == BuiltinTypes::xsBoolean->name(m_namePool) ||
+ typeName == BuiltinTypes::xsFloat->name(m_namePool) ||
+ typeName == BuiltinTypes::xsDouble->name(m_namePool) ||
+ typeName == BuiltinTypes::xsDecimal->name(m_namePool) ||
+ typeName == BuiltinTypes::xsDuration->name(m_namePool) ||
+ typeName == BuiltinTypes::xsDateTime->name(m_namePool) ||
+ typeName == BuiltinTypes::xsTime->name(m_namePool) ||
+ typeName == BuiltinTypes::xsDate->name(m_namePool) ||
+ typeName == BuiltinTypes::xsGYearMonth->name(m_namePool) ||
+ typeName == BuiltinTypes::xsGYear->name(m_namePool) ||
+ typeName == BuiltinTypes::xsGMonthDay->name(m_namePool) ||
+ typeName == BuiltinTypes::xsGDay->name(m_namePool) ||
+ typeName == BuiltinTypes::xsGMonth->name(m_namePool) ||
+ typeName == BuiltinTypes::xsHexBinary->name(m_namePool) ||
+ typeName == BuiltinTypes::xsBase64Binary->name(m_namePool) ||
+ typeName == BuiltinTypes::xsAnyURI->name(m_namePool) ||
+ typeName == BuiltinTypes::xsQName->name(m_namePool) ||
+ typeName == BuiltinTypes::xsNOTATION->name(m_namePool) ||
+ typeName == BuiltinTypes::xsAnySimpleType->name(m_namePool))
+ return type;
+ else {
+ if (type->wxsSuperType())
+ return findPrimitiveType(type->wxsSuperType(), visitedTypes);
+ else {
+ return AnySimpleType::Ptr();
+ }
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschemaresolver_p.h b/src/xmlpatterns/schema/qxsdschemaresolver_p.h
new file mode 100644
index 0000000..60901b5
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschemaresolver_p.h
@@ -0,0 +1,578 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchemaResolver_H
+#define Patternist_XsdSchemaResolver_H
+
+#include "qnamespacesupport_p.h"
+#include "qschematype_p.h"
+#include "qschematypefactory_p.h"
+#include "qxsdalternative_p.h"
+#include "qxsdattribute_p.h"
+#include "qxsdattributegroup_p.h"
+#include "qxsdelement_p.h"
+#include "qxsdmodelgroup_p.h"
+#include "qxsdnotation_p.h"
+#include "qxsdreference_p.h"
+#include "qxsdschema_p.h"
+#include "qxsdschemachecker_p.h"
+#include "qxsdsimpletype_p.h"
+
+#include <QtCore/QExplicitlySharedDataPointer>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class XsdSchemaContext;
+ class XsdSchemaParserContext;
+
+ /**
+ * @short Encapsulates the resolving of type/element references in a schema after parsing has finished.
+ *
+ * This class collects task for resolving types or element references. After the parsing has finished,
+ * one can start the resolve process by calling resolve().
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSchemaResolver : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdSchemaResolver> Ptr;
+
+ /**
+ * Creates a new schema resolver.
+ *
+ * @param context The schema context used for error reporting etc..
+ * @param parserContext The schema parser context where all objects to resolve belong to.
+ */
+ XsdSchemaResolver(const QExplicitlySharedDataPointer<XsdSchemaContext> &context, const XsdSchemaParserContext *parserContext);
+
+ /**
+ * Destroys the schema resolver.
+ */
+ ~XsdSchemaResolver();
+
+ /**
+ * Starts the resolve process.
+ */
+ void resolve();
+
+ /**
+ * Adds a resolve task for key references.
+ *
+ * The resolver will try to set the referencedKey property of @p keyRef to the <em>key</em> or <em>unique</em> object
+ * of @p element that has the given @p name.
+ */
+ void addKeyReference(const XsdElement::Ptr &element, const XsdIdentityConstraint::Ptr &keyRef, const QXmlName &name, const QSourceLocation &location);
+
+ /**
+ * Adds a resolve task for the base type of restriction of a simple type.
+ *
+ * The resolver will set the base type of @p simpleType to the type named by @p baseName.
+ */
+ void addSimpleRestrictionBase(const XsdSimpleType::Ptr &simpleType, const QXmlName &baseName, const QSourceLocation &location);
+
+ /**
+ * Removes the resolve task for the base type of restriction of the simple @p type.
+ */
+ void removeSimpleRestrictionBase(const XsdSimpleType::Ptr &type);
+
+ /**
+ * Adds a resolve task for the list type of a simple type.
+ *
+ * The resolver will set the itemType property of @p simpleType to the type named by @p typeName.
+ */
+ void addSimpleListType(const XsdSimpleType::Ptr &simpleType, const QXmlName &typeName, const QSourceLocation &location);
+
+ /**
+ * Adds a resolve task for the member types of a simple type.
+ *
+ * The resolver will set the memberTypes property of @p simpleType to the types named by @p typeNames.
+ */
+ void addSimpleUnionTypes(const XsdSimpleType::Ptr &simpleType, const QList<QXmlName> &typeNames, const QSourceLocation &location);
+
+ /**
+ * Adds a resolve task for the type of an element.
+ *
+ * The resolver will set the type of the @p element to the type named by @p typeName.
+ */
+ void addElementType(const XsdElement::Ptr &element, const QXmlName &typeName, const QSourceLocation &location);
+
+ /**
+ * Adds a resolve task for the base type of a complex type.
+ *
+ * The resolver will set the base type of @p complexType to the type named by @p baseName.
+ */
+ void addComplexBaseType(const XsdComplexType::Ptr &complexType, const QXmlName &baseName, const QSourceLocation &location, const XsdFacet::Hash &facets = XsdFacet::Hash());
+
+ /**
+ * Removes the resolve task for the base type of the complex @p type.
+ */
+ void removeComplexBaseType(const XsdComplexType::Ptr &type);
+
+ /**
+ * Adds a resolve task for the content type of a complex type.
+ *
+ * The resolver will set the content type properties for @p complexType based on the
+ * given explicit @p content and effective @p mixed value.
+ */
+ void addComplexContentType(const XsdComplexType::Ptr &complexType, const XsdParticle::Ptr &content, bool mixed);
+
+ /**
+ * Adds a resolve task for the type of an attribute.
+ *
+ * The resolver will set the type of the @p attribute to the type named by @p typeName.
+ */
+ void addAttributeType(const XsdAttribute::Ptr &attribute, const QXmlName &typeName, const QSourceLocation &location);
+
+ /**
+ * Adds a resolve task for the type of an alternative.
+ *
+ * The resolver will set the type of the @p alternative to the type named by @p typeName.
+ */
+ void addAlternativeType(const XsdAlternative::Ptr &alternative, const QXmlName &typeName, const QSourceLocation &location);
+
+ /**
+ * Adds a resolve task for the type of an alternative.
+ *
+ * The resolver will set the type of the @p alternative to the type of the @p element after
+ * the type of the @p element has been resolved.
+ */
+ void addAlternativeType(const XsdAlternative::Ptr &alternative, const XsdElement::Ptr &element);
+
+ /**
+ * Adds a resolve task for the substituion group affiliations of an element.
+ *
+ * The resolver will set the substitution group affiliations of the @p element to the
+ * top-level element named by @p elementNames.
+ */
+ void addSubstitutionGroupAffiliation(const XsdElement::Ptr &element, const QList<QXmlName> &elementName, const QSourceLocation &location);
+
+ /**
+ * Adds a resolve task for an element that has no type specified, only a substitution group
+ * affiliation.
+ *
+ * The resolver will set the type of the substitution group affiliation as type for the element.
+ */
+ void addSubstitutionGroupType(const XsdElement::Ptr &element);
+
+ /**
+ * Adds the component location hash, so the resolver is able to report meaning full
+ * error messages.
+ */
+ void addComponentLocationHash(const QHash<NamedSchemaComponent::Ptr, QSourceLocation> &hash);
+
+ /**
+ * Add a resolve task for enumeration facet values.
+ *
+ * In case the enumeration is of type QName or NOTATION, we have to resolve the QName later,
+ * so we store the namespace bindings together with the facet value here and resolve it as soon as
+ * we have all type information available.
+ */
+ void addEnumerationFacetValue(const AtomicValue::Ptr &facetValue, const NamespaceSupport &namespaceSupport);
+
+ /**
+ * Add a check job for redefined groups.
+ *
+ * When an element group is redefined, we have to check whether the redefined group is a valid
+ * restriction of the group it redefines. As we need all type information for that, we keep them
+ * here for later checking.
+ */
+ void addRedefinedGroups(const XsdModelGroup::Ptr &redefinedGroup, const XsdModelGroup::Ptr &group);
+
+ /**
+ * Add a check job for redefined attribute groups.
+ *
+ * When an attribute group is redefined, we have to check whether the redefined group is a valid
+ * restriction of the group it redefines. As we need all type information for that, we keep them
+ * here for later checking.
+ */
+ void addRedefinedAttributeGroups(const XsdAttributeGroup::Ptr &redefinedGroup, const XsdAttributeGroup::Ptr &group);
+
+ /**
+ * Adds a check for nested <em>all</em> groups.
+ */
+ void addAllGroupCheck(const XsdReference::Ptr &reference);
+
+ /**
+ * Copies the data to resolve to an @p other resolver.
+ *
+ * @note That functionality is only used by the redefine algorithm in the XsdSchemaParser.
+ */
+ void copyDataTo(const XsdSchemaResolver::Ptr &other) const;
+
+ /**
+ * Returns the to resolve base type name for the given @p type.
+ *
+ * @note That functionality is only used by the redefine algorithm in the XsdSchemaParser.
+ */
+ QXmlName baseTypeNameOfType(const SchemaType::Ptr &type) const;
+
+ /**
+ * Returns the to resolve type name for the given @p attribute.
+ *
+ * @note That functionality is only used by the redefine algorithm in the XsdSchemaParser.
+ */
+ QXmlName typeNameOfAttribute(const XsdAttribute::Ptr &attribute) const;
+
+ /**
+ * Sets the defaultOpenContent object from the schema parser.
+ */
+ void setDefaultOpenContent(const XsdComplexType::OpenContent::Ptr &openContent, bool appliesToEmpty);
+
+ private:
+ /**
+ * Resolves key references.
+ */
+ void resolveKeyReferences();
+
+ /**
+ * Resolves the base types of simple types derived by restriction.
+ */
+ void resolveSimpleRestrictionBaseTypes();
+
+ /**
+ * Resolves the other properties except the base type
+ * of all simple restrictions.
+ */
+ void resolveSimpleRestrictions();
+
+ /**
+ * Resolves the other properties except the base type
+ * of the given simple restriction.
+ *
+ * @param simpleType The restricted type to resolve.
+ * @param visitedTypes A set of already resolved types, used for termination of recursion.
+ */
+ void resolveSimpleRestrictions(const XsdSimpleType::Ptr &simpleType, QSet<XsdSimpleType::Ptr> &visitedTypes);
+
+ /**
+ * Resolves the item type property of simple types derived by list.
+ */
+ void resolveSimpleListType();
+
+ /**
+ * Resolves the member types property of simple types derived by union.
+ */
+ void resolveSimpleUnionTypes();
+
+ /**
+ * Resolves element types.
+ */
+ void resolveElementTypes();
+
+ /**
+ * Resolves base type of complex types.
+ */
+ void resolveComplexBaseTypes();
+
+ /**
+ * Resolves the simple content model of a complex type
+ * depending on its base type.
+ */
+ void resolveSimpleContentComplexTypes();
+
+ /**
+ * Resolves the complex content model of a complex type
+ * depending on its base type.
+ */
+ void resolveComplexContentComplexTypes();
+
+ /**
+ * Resolves the simple content model of a complex type
+ * depending on its base type.
+ *
+ * @param complexType The complex type to resolve.
+ * @param visitedTypes A set of already resolved types, used for termination of recursion.
+ */
+ void resolveSimpleContentComplexTypes(const XsdComplexType::Ptr &complexType, QSet<XsdComplexType::Ptr> &visitedTypes);
+
+ /**
+ * Resolves the complex content model of a complex type
+ * depending on its base type.
+ *
+ * @param complexType The complex type to resolve.
+ * @param visitedTypes A set of already resolved types, used for termination of recursion.
+ */
+ void resolveComplexContentComplexTypes(const XsdComplexType::Ptr &complexType, QSet<XsdComplexType::Ptr> &visitedTypes);
+
+ /**
+ * Resolves attribute types.
+ */
+ void resolveAttributeTypes();
+
+ /**
+ * Resolves alternative types.
+ */
+ void resolveAlternativeTypes();
+
+ /**
+ * Resolves substitution group affiliations.
+ */
+ void resolveSubstitutionGroupAffiliations();
+
+ /**
+ * Resolves substitution groups.
+ */
+ void resolveSubstitutionGroups();
+
+ /**
+ * Resolves all XsdReferences in the schema by their corresponding XsdElement or XsdModelGroup terms.
+ */
+ void resolveTermReferences();
+
+ /**
+ * Resolves all XsdReferences in the @p particle recursive by their corresponding XsdElement or XsdModelGroup terms.
+ */
+ void resolveTermReference(const XsdParticle::Ptr &particle, QSet<QXmlName> visitedGroups);
+
+ /**
+ * Resolves all XsdAttributeReferences in the schema by their corresponding XsdAttributeUse objects.
+ */
+ void resolveAttributeTermReferences();
+
+ /**
+ * Resolves all XsdAttributeReferences in the list of @p attributeUses by their corresponding XsdAttributeUse objects.
+ */
+ XsdAttributeUse::List resolveAttributeTermReferences(const XsdAttributeUse::List &attributeUses, XsdWildcard::Ptr &wildcard, QSet<QXmlName> visitedAttributeGroups);
+
+ /**
+ * Resolves the attribute inheritance of complex types.
+ *
+ * @note This method must be called after all base types have been resolved.
+ */
+ void resolveAttributeInheritance();
+
+ /**
+ * Resolves the attribute inheritance of the given complex types.
+ *
+ * @param complexType The complex type to resolve.
+ * @param visitedTypes A set of already resolved types, used for termination of recursion.
+ *
+ * @note This method must be called after all base types have been resolved.
+ */
+ void resolveAttributeInheritance(const XsdComplexType::Ptr &complexType, QSet<XsdComplexType::Ptr> &visitedTypes);
+
+ /**
+ * Resolves the enumeration facet values for QName and NOTATION based facets.
+ */
+ void resolveEnumerationFacetValues();
+
+ /**
+ * Returns the source location of the given schema @p component or a dummy
+ * source location if the component is not found in the component location hash.
+ */
+ QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr component) const;
+
+ /**
+ * Returns the facets that are marked for the given complex @p type with a simple
+ * type restriction.
+ */
+ XsdFacet::Hash complexTypeFacets(const XsdComplexType::Ptr &complexType) const;
+
+ /**
+ * Finds the primitive type for the given simple @p type.
+ *
+ * The type is found by walking up the inheritance tree, until one of the builtin
+ * primitive type definitions is reached.
+ */
+ AnySimpleType::Ptr findPrimitiveType(const AnySimpleType::Ptr &type, QSet<AnySimpleType::Ptr> &visitedTypes);
+
+ /**
+ * Checks the redefined groups.
+ */
+ void checkRedefinedGroups();
+
+ /**
+ * Checks the redefined attribute groups.
+ */
+ void checkRedefinedAttributeGroups();
+
+ class KeyReference
+ {
+ public:
+ XsdElement::Ptr element;
+ XsdIdentityConstraint::Ptr keyRef;
+ QXmlName reference;
+ QSourceLocation location;
+ };
+
+ class SimpleRestrictionBase
+ {
+ public:
+ XsdSimpleType::Ptr simpleType;
+ QXmlName baseName;
+ QSourceLocation location;
+ };
+
+ class SimpleListType
+ {
+ public:
+ XsdSimpleType::Ptr simpleType;
+ QXmlName typeName;
+ QSourceLocation location;
+ };
+
+ class SimpleUnionType
+ {
+ public:
+ XsdSimpleType::Ptr simpleType;
+ QList<QXmlName> typeNames;
+ QSourceLocation location;
+ };
+
+ class ElementType
+ {
+ public:
+ XsdElement::Ptr element;
+ QXmlName typeName;
+ QSourceLocation location;
+ };
+
+ class ComplexBaseType
+ {
+ public:
+ XsdComplexType::Ptr complexType;
+ QXmlName baseName;
+ QSourceLocation location;
+ XsdFacet::Hash facets;
+ };
+
+ class ComplexContentType
+ {
+ public:
+ XsdComplexType::Ptr complexType;
+ XsdParticle::Ptr explicitContent;
+ bool effectiveMixed;
+ };
+
+ class AttributeType
+ {
+ public:
+ XsdAttribute::Ptr attribute;
+ QXmlName typeName;
+ QSourceLocation location;
+ };
+
+ class AlternativeType
+ {
+ public:
+ XsdAlternative::Ptr alternative;
+ QXmlName typeName;
+ QSourceLocation location;
+ };
+
+ class AlternativeTypeElement
+ {
+ public:
+ XsdAlternative::Ptr alternative;
+ XsdElement::Ptr element;
+ };
+
+ class SubstitutionGroupAffiliation
+ {
+ public:
+ XsdElement::Ptr element;
+ QList<QXmlName> elementNames;
+ QSourceLocation location;
+ };
+
+ class RedefinedGroups
+ {
+ public:
+ XsdModelGroup::Ptr redefinedGroup;
+ XsdModelGroup::Ptr group;
+ };
+
+ class RedefinedAttributeGroups
+ {
+ public:
+ XsdAttributeGroup::Ptr redefinedGroup;
+ XsdAttributeGroup::Ptr group;
+ };
+
+ QVector<KeyReference> m_keyReferences;
+ QVector<SimpleRestrictionBase> m_simpleRestrictionBases;
+ QVector<SimpleListType> m_simpleListTypes;
+ QVector<SimpleUnionType> m_simpleUnionTypes;
+ QVector<ElementType> m_elementTypes;
+ QVector<ComplexBaseType> m_complexBaseTypes;
+ QVector<ComplexContentType> m_complexContentTypes;
+ QVector<AttributeType> m_attributeTypes;
+ QVector<AlternativeType> m_alternativeTypes;
+ QVector<AlternativeTypeElement> m_alternativeTypeElements;
+ QVector<SubstitutionGroupAffiliation> m_substitutionGroupAffiliations;
+ QVector<XsdElement::Ptr> m_substitutionGroupTypes;
+ QVector<RedefinedGroups> m_redefinedGroups;
+ QVector<RedefinedAttributeGroups> m_redefinedAttributeGroups;
+ QHash<AtomicValue::Ptr, NamespaceSupport> m_enumerationFacetValues;
+ QSet<XsdReference::Ptr> m_allGroups;
+
+ QExplicitlySharedDataPointer<XsdSchemaContext> m_context;
+ QExplicitlySharedDataPointer<XsdSchemaChecker> m_checker;
+ NamePool::Ptr m_namePool;
+ XsdSchema::Ptr m_schema;
+ QHash<NamedSchemaComponent::Ptr, QSourceLocation> m_componentLocationHash;
+ XsdComplexType::OpenContent::Ptr m_defaultOpenContent;
+ bool m_defaultOpenContentAppliesToEmpty;
+ SchemaType::List m_predefinedSchemaTypes;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschematoken.cpp b/src/xmlpatterns/schema/qxsdschematoken.cpp
new file mode 100644
index 0000000..b462731
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschematoken.cpp
@@ -0,0 +1,2981 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* NOTE: This file is AUTO GENERATED by qautomaton2cpp.xsl. */
+
+#include "qxsdschematoken_p.h"
+
+QT_BEGIN_NAMESPACE
+
+XsdSchemaToken::NodeName XsdSchemaToken::classifier2(const QChar *data)
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 105, 100
+ };
+ if(memcmp(&data[0], &string, sizeof(QChar) * 2) == 0)
+
+
+ return Id;
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier3(const QChar *data)
+
+ {
+ if (data[0] == 97)
+
+
+ {
+ if (data[1] == 108)
+
+
+ {
+
+ if(data[2] == 108)
+
+
+ return All;
+
+ }
+
+ else if (data[1] == 110)
+
+
+ {
+
+ if(data[2] == 121)
+
+
+ return Any;
+
+ }
+
+
+ }
+
+ else if (data[0] == 107)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 121
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0)
+
+
+ return Key;
+
+ }
+
+ else if (data[0] == 114)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 102
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0)
+
+
+ return Ref;
+
+ }
+
+ else if (data[0] == 117)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 115, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0)
+
+
+ return Use;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier4(const QChar *data)
+
+ {
+ if (data[0] == 98)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 97, 115, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0)
+
+
+ return Base;
+
+ }
+
+ else if (data[0] == 102)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 111, 114, 109
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0)
+
+
+ return Form;
+
+ }
+
+ else if (data[0] == 108)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 105, 115, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0)
+
+
+ return List;
+
+ }
+
+ else if (data[0] == 109)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 111, 100, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0)
+
+
+ return Mode;
+
+ }
+
+ else if (data[0] == 110)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 97, 109, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0)
+
+
+ return Name;
+
+ }
+
+ else if (data[0] == 116)
+
+
+ {
+ if (data[1] == 101)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 115, 116
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 2) == 0)
+
+
+ return Test;
+
+ }
+
+ else if (data[1] == 121)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 112, 101
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 2) == 0)
+
+
+ return Type;
+
+ }
+
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier5(const QChar *data)
+
+ {
+ if (data[0] == 98)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 108, 111, 99, 107
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Block;
+
+ }
+
+ else if (data[0] == 102)
+
+
+ {
+ if (data[1] == 105)
+
+
+ {
+ if (data[2] == 101)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 108, 100
+ };
+ if(memcmp(&data[3], &string, sizeof(QChar) * 2) == 0)
+
+
+ return Field;
+
+ }
+
+ else if (data[2] == 110)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 97, 108
+ };
+ if(memcmp(&data[3], &string, sizeof(QChar) * 2) == 0)
+
+
+ return Final;
+
+ }
+
+ else if (data[2] == 120)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 100
+ };
+ if(memcmp(&data[3], &string, sizeof(QChar) * 2) == 0)
+
+
+ return Fixed;
+
+ }
+
+
+ }
+
+
+ }
+
+ else if (data[0] == 103)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 114, 111, 117, 112
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Group;
+
+ }
+
+ else if (data[0] == 109)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 105, 120, 101, 100
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Mixed;
+
+ }
+
+ else if (data[0] == 114)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 102, 101, 114
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Refer;
+
+ }
+
+ else if (data[0] == 117)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 110, 105, 111, 110
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Union;
+
+ }
+
+ else if (data[0] == 118)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 97, 108, 117, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Value;
+
+ }
+
+ else if (data[0] == 120)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 112, 97, 116, 104
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Xpath;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier6(const QChar *data)
+
+ {
+ if (data[0] == 97)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 115, 115, 101, 114, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0)
+
+
+ return Assert;
+
+ }
+
+ else if (data[0] == 99)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 104, 111, 105, 99, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0)
+
+
+ return Choice;
+
+ }
+
+ else if (data[0] == 105)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 109, 112, 111, 114, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0)
+
+
+ return Import;
+
+ }
+
+ else if (data[0] == 107)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 121, 114, 101, 102
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0)
+
+
+ return Keyref;
+
+ }
+
+ else if (data[0] == 108)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 110, 103, 116, 104
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0)
+
+
+ return Length;
+
+ }
+
+ else if (data[0] == 112)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 117, 98, 108, 105, 99
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0)
+
+
+ return Public;
+
+ }
+
+ else if (data[0] == 115)
+
+
+ {
+ if (data[1] == 99)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 104, 101, 109, 97
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Schema;
+
+ }
+
+ else if (data[1] == 111)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 117, 114, 99, 101
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Source;
+
+ }
+
+ else if (data[1] == 121)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 115, 116, 101, 109
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 4) == 0)
+
+
+ return System;
+
+ }
+
+
+ }
+
+ else if (data[0] == 117)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 110, 105, 113, 117, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0)
+
+
+ return Unique;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier7(const QChar *data)
+
+ {
+ if (data[0] == 97)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 112, 112, 105, 110, 102, 111
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0)
+
+
+ return Appinfo;
+
+ }
+
+ else if (data[0] == 100)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 102, 97, 117, 108, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0)
+
+
+ return Default;
+
+ }
+
+ else if (data[0] == 101)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 108, 101, 109, 101, 110, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0)
+
+
+ return Element;
+
+ }
+
+ else if (data[0] == 105)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 110, 99, 108, 117, 100, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0)
+
+
+ return Include;
+
+ }
+
+ else if (data[0] == 112)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 97, 116, 116, 101, 114, 110
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0)
+
+
+ return Pattern;
+
+ }
+
+ else if (data[0] == 114)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 112, 108, 97, 99, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0)
+
+
+ return Replace;
+
+ }
+
+ else if (data[0] == 118)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 114, 115, 105, 111, 110
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0)
+
+
+ return Version;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier8(const QChar *data)
+
+ {
+ if (data[0] == 97)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 98, 115, 116, 114, 97, 99, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0)
+
+
+ return Abstract;
+
+ }
+
+ else if (data[0] == 99)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 111, 108, 108, 97, 112, 115, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0)
+
+
+ return Collapse;
+
+ }
+
+ else if (data[0] == 105)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 116, 101, 109, 84, 121, 112, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0)
+
+
+ return ItemType;
+
+ }
+
+ else if (data[0] == 110)
+
+
+ {
+ if (data[1] == 105)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 108, 108, 97, 98, 108, 101
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 6) == 0)
+
+
+ return Nillable;
+
+ }
+
+ else if (data[1] == 111)
+
+
+ {
+ if (data[2] == 116)
+
+
+ {
+ if (data[3] == 97)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 116, 105, 111, 110
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 4) == 0)
+
+
+ return Notation;
+
+ }
+
+ else if (data[3] == 81)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 78, 97, 109, 101
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 4) == 0)
+
+
+ return NotQName;
+
+ }
+
+
+ }
+
+
+ }
+
+
+ }
+
+ else if (data[0] == 111)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 118, 101, 114, 114, 105, 100, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0)
+
+
+ return Override;
+
+ }
+
+ else if (data[0] == 112)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 114, 101, 115, 101, 114, 118, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0)
+
+
+ return Preserve;
+
+ }
+
+ else if (data[0] == 114)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 100, 101, 102, 105, 110, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0)
+
+
+ return Redefine;
+
+ }
+
+ else if (data[0] == 115)
+
+
+ {
+ if (data[1] == 101)
+
+
+ {
+ if (data[2] == 108)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 99, 116, 111, 114
+ };
+ if(memcmp(&data[3], &string, sizeof(QChar) * 5) == 0)
+
+
+ return Selector;
+
+ }
+
+ else if (data[2] == 113)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 117, 101, 110, 99, 101
+ };
+ if(memcmp(&data[3], &string, sizeof(QChar) * 5) == 0)
+
+
+ return Sequence;
+
+ }
+
+
+ }
+
+
+ }
+
+ else if (data[0] == 120)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 109, 108, 58, 108, 97, 110, 103
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0)
+
+
+ return XmlLanguage;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier9(const QChar *data)
+
+ {
+ if (data[0] == 97)
+
+
+ {
+ if (data[1] == 115)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 115, 101, 114, 116, 105, 111, 110
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 7) == 0)
+
+
+ return Assertion;
+
+ }
+
+ else if (data[1] == 116)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 116, 114, 105, 98, 117, 116, 101
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 7) == 0)
+
+
+ return Attribute;
+
+ }
+
+
+ }
+
+ else if (data[0] == 101)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 120, 116, 101, 110, 115, 105, 111, 110
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 8) == 0)
+
+
+ return Extension;
+
+ }
+
+ else if (data[0] == 109)
+
+
+ {
+ if (data[1] == 97)
+
+
+ {
+ if (data[2] == 120)
+
+
+ {
+ if (data[3] == 76)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 110, 103, 116, 104
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 5) == 0)
+
+
+ return MaxLength;
+
+ }
+
+ else if (data[3] == 79)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 99, 99, 117, 114, 115
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 5) == 0)
+
+
+ return MaxOccurs;
+
+ }
+
+
+ }
+
+
+ }
+
+ else if (data[1] == 105)
+
+
+ {
+ if (data[2] == 110)
+
+
+ {
+ if (data[3] == 76)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 110, 103, 116, 104
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 5) == 0)
+
+
+ return MinLength;
+
+ }
+
+ else if (data[3] == 79)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 99, 99, 117, 114, 115
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 5) == 0)
+
+
+ return MinOccurs;
+
+ }
+
+
+ }
+
+
+ }
+
+
+ }
+
+ else if (data[0] == 110)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 97, 109, 101, 115, 112, 97, 99, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 8) == 0)
+
+
+ return Namespace;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier10(const QChar *data)
+
+ {
+ if (data[0] == 97)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 110, 110, 111, 116, 97, 116, 105, 111, 110
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 9) == 0)
+
+
+ return Annotation;
+
+ }
+
+ else if (data[0] == 115)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 105, 109, 112, 108, 101, 84, 121, 112, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 9) == 0)
+
+
+ return SimpleType;
+
+ }
+
+ else if (data[0] == 119)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 104, 105, 116, 101, 83, 112, 97, 99, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 9) == 0)
+
+
+ return WhiteSpace;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier11(const QChar *data)
+
+ {
+ if (data[0] == 97)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 108, 116, 101, 114, 110, 97, 116, 105, 118, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0)
+
+
+ return Alternative;
+
+ }
+
+ else if (data[0] == 99)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 111, 109, 112, 108, 101, 120, 84, 121, 112, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0)
+
+
+ return ComplexType;
+
+ }
+
+ else if (data[0] == 101)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 110, 117, 109, 101, 114, 97, 116, 105, 111, 110
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0)
+
+
+ return Enumeration;
+
+ }
+
+ else if (data[0] == 109)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 109, 98, 101, 114, 84, 121, 112, 101, 115
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0)
+
+
+ return MemberTypes;
+
+ }
+
+ else if (data[0] == 111)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 112, 101, 110, 67, 111, 110, 116, 101, 110, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0)
+
+
+ return OpenContent;
+
+ }
+
+ else if (data[0] == 114)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 115, 116, 114, 105, 99, 116, 105, 111, 110
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0)
+
+
+ return Restriction;
+
+ }
+
+ else if (data[0] == 116)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 111, 116, 97, 108, 68, 105, 103, 105, 116, 115
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0)
+
+
+ return TotalDigits;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier12(const QChar *data)
+
+ {
+ if (data[0] == 97)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 110, 121, 65, 116, 116, 114, 105, 98, 117, 116, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 11) == 0)
+
+
+ return AnyAttribute;
+
+ }
+
+ else if (data[0] == 98)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 108, 111, 99, 107, 68, 101, 102, 97, 117, 108, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 11) == 0)
+
+
+ return BlockDefault;
+
+ }
+
+ else if (data[0] == 102)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 105, 110, 97, 108, 68, 101, 102, 97, 117, 108, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 11) == 0)
+
+
+ return FinalDefault;
+
+ }
+
+ else if (data[0] == 109)
+
+
+ {
+ if (data[1] == 97)
+
+
+ {
+ if (data[2] == 120)
+
+
+ {
+ if (data[3] == 69)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 120, 99, 108, 117, 115, 105, 118, 101
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 8) == 0)
+
+
+ return MaxExclusive;
+
+ }
+
+ else if (data[3] == 73)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 110, 99, 108, 117, 115, 105, 118, 101
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 8) == 0)
+
+
+ return MaxInclusive;
+
+ }
+
+
+ }
+
+
+ }
+
+ else if (data[1] == 105)
+
+
+ {
+ if (data[2] == 110)
+
+
+ {
+ if (data[3] == 69)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 120, 99, 108, 117, 115, 105, 118, 101
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 8) == 0)
+
+
+ return MinExclusive;
+
+ }
+
+ else if (data[3] == 73)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 110, 99, 108, 117, 115, 105, 118, 101
+ };
+ if(memcmp(&data[4], &string, sizeof(QChar) * 8) == 0)
+
+
+ return MinInclusive;
+
+ }
+
+
+ }
+
+
+ }
+
+
+ }
+
+ else if (data[0] == 110)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 111, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 11) == 0)
+
+
+ return NotNamespace;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier13(const QChar *data)
+
+ {
+ if (data[0] == 100)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 111, 99, 117, 109, 101, 110, 116, 97, 116, 105, 111, 110
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 12) == 0)
+
+
+ return Documentation;
+
+ }
+
+ else if (data[0] == 115)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 105, 109, 112, 108, 101, 67, 111, 110, 116, 101, 110, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 12) == 0)
+
+
+ return SimpleContent;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier14(const QChar *data)
+
+ {
+ if (data[0] == 97)
+
+
+ {
+ if (data[1] == 112)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 112, 108, 105, 101, 115, 84, 111, 69, 109, 112, 116, 121
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 12) == 0)
+
+
+ return AppliesToEmpty;
+
+ }
+
+ else if (data[1] == 116)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 116, 114, 105, 98, 117, 116, 101, 71, 114, 111, 117, 112
+ };
+ if(memcmp(&data[2], &string, sizeof(QChar) * 12) == 0)
+
+
+ return AttributeGroup;
+
+ }
+
+
+ }
+
+ else if (data[0] == 99)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 111, 109, 112, 108, 101, 120, 67, 111, 110, 116, 101, 110, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0)
+
+
+ return ComplexContent;
+
+ }
+
+ else if (data[0] == 102)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 114, 97, 99, 116, 105, 111, 110, 68, 105, 103, 105, 116, 115
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0)
+
+
+ return FractionDigits;
+
+ }
+
+ else if (data[0] == 115)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 99, 104, 101, 109, 97, 76, 111, 99, 97, 116, 105, 111, 110
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0)
+
+
+ return SchemaLocation;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier15(const QChar *data)
+
+ {
+ if (data[0] == 112)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 114, 111, 99, 101, 115, 115, 67, 111, 110, 116, 101, 110, 116, 115
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 14) == 0)
+
+
+ return ProcessContents;
+
+ }
+
+ else if (data[0] == 116)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 97, 114, 103, 101, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 14) == 0)
+
+
+ return TargetNamespace;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier17(const QChar *data)
+
+ {
+ if (data[0] == 100)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 102, 97, 117, 108, 116, 65, 116, 116, 114, 105, 98, 117, 116, 101, 115
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 16) == 0)
+
+
+ return DefaultAttributes;
+
+ }
+
+ else if (data[0] == 115)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 117, 98, 115, 116, 105, 116, 117, 116, 105, 111, 110, 71, 114, 111, 117, 112
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 16) == 0)
+
+
+ return SubstitutionGroup;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier18(const QChar *data)
+
+ {
+ if (data[0] == 100)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 101, 102, 97, 117, 108, 116, 79, 112, 101, 110, 67, 111, 110, 116, 101, 110, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 17) == 0)
+
+
+ return DefaultOpenContent;
+
+ }
+
+ else if (data[0] == 101)
+
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 108, 101, 109, 101, 110, 116, 70, 111, 114, 109, 68, 101, 102, 97, 117, 108, 116
+ };
+ if(memcmp(&data[1], &string, sizeof(QChar) * 17) == 0)
+
+
+ return ElementFormDefault;
+
+ }
+
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier20(const QChar *data)
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 97, 116, 116, 114, 105, 98, 117, 116, 101, 70, 111, 114, 109, 68, 101, 102, 97, 117, 108, 116
+ };
+ if(memcmp(&data[0], &string, sizeof(QChar) * 20) == 0)
+
+
+ return AttributeFormDefault;
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier21(const QChar *data)
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 120, 112, 97, 116, 104, 68, 101, 102, 97, 117, 108, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101
+ };
+ if(memcmp(&data[0], &string, sizeof(QChar) * 21) == 0)
+
+
+ return XPathDefaultNamespace;
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier22(const QChar *data)
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 100, 101, 102, 97, 117, 108, 116, 65, 116, 116, 114, 105, 98, 117, 116, 101, 115, 65, 112, 112, 108, 121
+ };
+ if(memcmp(&data[0], &string, sizeof(QChar) * 22) == 0)
+
+
+ return DefaultAttributesApply;
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::classifier32(const QChar *data)
+
+ {
+
+ static const unsigned short string[] =
+ {
+ 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 49, 47, 88, 77, 76, 83, 99, 104, 101, 109, 97
+ };
+ if(memcmp(&data[0], &string, sizeof(QChar) * 32) == 0)
+
+
+ return XML_NS_SCHEMA_URI;
+
+
+ return NoKeyword;
+ }
+ XsdSchemaToken::NodeName XsdSchemaToken::toToken(const QChar *data, int length)
+ {
+ switch(length)
+ {
+
+ case 2:
+ return classifier2(data);
+
+
+ case 3:
+ return classifier3(data);
+
+
+ case 4:
+ return classifier4(data);
+
+
+ case 5:
+ return classifier5(data);
+
+
+ case 6:
+ return classifier6(data);
+
+
+ case 7:
+ return classifier7(data);
+
+
+ case 8:
+ return classifier8(data);
+
+
+ case 9:
+ return classifier9(data);
+
+
+ case 10:
+ return classifier10(data);
+
+
+ case 11:
+ return classifier11(data);
+
+
+ case 12:
+ return classifier12(data);
+
+
+ case 13:
+ return classifier13(data);
+
+
+ case 14:
+ return classifier14(data);
+
+
+ case 15:
+ return classifier15(data);
+
+
+ case 17:
+ return classifier17(data);
+
+
+ case 18:
+ return classifier18(data);
+
+
+ case 20:
+ return classifier20(data);
+
+
+ case 21:
+ return classifier21(data);
+
+
+ case 22:
+ return classifier22(data);
+
+
+ case 32:
+ return classifier32(data);
+
+
+ default:
+ return NoKeyword;
+ }
+ }
+
+
+ QString XsdSchemaToken::toString(NodeName token)
+ {
+ const unsigned short *data = 0;
+ int length = 0;
+
+ switch(token)
+ {
+
+ case Abstract:
+ {
+ static const unsigned short staticallyStoredAbstract[] =
+ {
+ 97, 98, 115, 116, 114, 97, 99, 116, 0
+ };
+ data = staticallyStoredAbstract;
+ length = 8;
+ break;
+ }
+
+ case All:
+ {
+ static const unsigned short staticallyStoredAll[] =
+ {
+ 97, 108, 108, 0
+ };
+ data = staticallyStoredAll;
+ length = 3;
+ break;
+ }
+
+ case Alternative:
+ {
+ static const unsigned short staticallyStoredAlternative[] =
+ {
+ 97, 108, 116, 101, 114, 110, 97, 116, 105, 118, 101, 0
+ };
+ data = staticallyStoredAlternative;
+ length = 11;
+ break;
+ }
+
+ case Annotation:
+ {
+ static const unsigned short staticallyStoredAnnotation[] =
+ {
+ 97, 110, 110, 111, 116, 97, 116, 105, 111, 110, 0
+ };
+ data = staticallyStoredAnnotation;
+ length = 10;
+ break;
+ }
+
+ case Any:
+ {
+ static const unsigned short staticallyStoredAny[] =
+ {
+ 97, 110, 121, 0
+ };
+ data = staticallyStoredAny;
+ length = 3;
+ break;
+ }
+
+ case AnyAttribute:
+ {
+ static const unsigned short staticallyStoredAnyAttribute[] =
+ {
+ 97, 110, 121, 65, 116, 116, 114, 105, 98, 117, 116, 101, 0
+ };
+ data = staticallyStoredAnyAttribute;
+ length = 12;
+ break;
+ }
+
+ case Appinfo:
+ {
+ static const unsigned short staticallyStoredAppinfo[] =
+ {
+ 97, 112, 112, 105, 110, 102, 111, 0
+ };
+ data = staticallyStoredAppinfo;
+ length = 7;
+ break;
+ }
+
+ case AppliesToEmpty:
+ {
+ static const unsigned short staticallyStoredAppliesToEmpty[] =
+ {
+ 97, 112, 112, 108, 105, 101, 115, 84, 111, 69, 109, 112, 116, 121, 0
+ };
+ data = staticallyStoredAppliesToEmpty;
+ length = 14;
+ break;
+ }
+
+ case Assert:
+ {
+ static const unsigned short staticallyStoredAssert[] =
+ {
+ 97, 115, 115, 101, 114, 116, 0
+ };
+ data = staticallyStoredAssert;
+ length = 6;
+ break;
+ }
+
+ case Assertion:
+ {
+ static const unsigned short staticallyStoredAssertion[] =
+ {
+ 97, 115, 115, 101, 114, 116, 105, 111, 110, 0
+ };
+ data = staticallyStoredAssertion;
+ length = 9;
+ break;
+ }
+
+ case Attribute:
+ {
+ static const unsigned short staticallyStoredAttribute[] =
+ {
+ 97, 116, 116, 114, 105, 98, 117, 116, 101, 0
+ };
+ data = staticallyStoredAttribute;
+ length = 9;
+ break;
+ }
+
+ case AttributeFormDefault:
+ {
+ static const unsigned short staticallyStoredAttributeFormDefault[] =
+ {
+ 97, 116, 116, 114, 105, 98, 117, 116, 101, 70, 111, 114, 109, 68, 101, 102, 97, 117, 108, 116, 0
+ };
+ data = staticallyStoredAttributeFormDefault;
+ length = 20;
+ break;
+ }
+
+ case AttributeGroup:
+ {
+ static const unsigned short staticallyStoredAttributeGroup[] =
+ {
+ 97, 116, 116, 114, 105, 98, 117, 116, 101, 71, 114, 111, 117, 112, 0
+ };
+ data = staticallyStoredAttributeGroup;
+ length = 14;
+ break;
+ }
+
+ case Base:
+ {
+ static const unsigned short staticallyStoredBase[] =
+ {
+ 98, 97, 115, 101, 0
+ };
+ data = staticallyStoredBase;
+ length = 4;
+ break;
+ }
+
+ case Block:
+ {
+ static const unsigned short staticallyStoredBlock[] =
+ {
+ 98, 108, 111, 99, 107, 0
+ };
+ data = staticallyStoredBlock;
+ length = 5;
+ break;
+ }
+
+ case BlockDefault:
+ {
+ static const unsigned short staticallyStoredBlockDefault[] =
+ {
+ 98, 108, 111, 99, 107, 68, 101, 102, 97, 117, 108, 116, 0
+ };
+ data = staticallyStoredBlockDefault;
+ length = 12;
+ break;
+ }
+
+ case Choice:
+ {
+ static const unsigned short staticallyStoredChoice[] =
+ {
+ 99, 104, 111, 105, 99, 101, 0
+ };
+ data = staticallyStoredChoice;
+ length = 6;
+ break;
+ }
+
+ case Collapse:
+ {
+ static const unsigned short staticallyStoredCollapse[] =
+ {
+ 99, 111, 108, 108, 97, 112, 115, 101, 0
+ };
+ data = staticallyStoredCollapse;
+ length = 8;
+ break;
+ }
+
+ case ComplexContent:
+ {
+ static const unsigned short staticallyStoredComplexContent[] =
+ {
+ 99, 111, 109, 112, 108, 101, 120, 67, 111, 110, 116, 101, 110, 116, 0
+ };
+ data = staticallyStoredComplexContent;
+ length = 14;
+ break;
+ }
+
+ case ComplexType:
+ {
+ static const unsigned short staticallyStoredComplexType[] =
+ {
+ 99, 111, 109, 112, 108, 101, 120, 84, 121, 112, 101, 0
+ };
+ data = staticallyStoredComplexType;
+ length = 11;
+ break;
+ }
+
+ case Default:
+ {
+ static const unsigned short staticallyStoredDefault[] =
+ {
+ 100, 101, 102, 97, 117, 108, 116, 0
+ };
+ data = staticallyStoredDefault;
+ length = 7;
+ break;
+ }
+
+ case DefaultAttributes:
+ {
+ static const unsigned short staticallyStoredDefaultAttributes[] =
+ {
+ 100, 101, 102, 97, 117, 108, 116, 65, 116, 116, 114, 105, 98, 117, 116, 101, 115, 0
+ };
+ data = staticallyStoredDefaultAttributes;
+ length = 17;
+ break;
+ }
+
+ case DefaultAttributesApply:
+ {
+ static const unsigned short staticallyStoredDefaultAttributesApply[] =
+ {
+ 100, 101, 102, 97, 117, 108, 116, 65, 116, 116, 114, 105, 98, 117, 116, 101, 115, 65, 112, 112, 108, 121, 0
+ };
+ data = staticallyStoredDefaultAttributesApply;
+ length = 22;
+ break;
+ }
+
+ case DefaultOpenContent:
+ {
+ static const unsigned short staticallyStoredDefaultOpenContent[] =
+ {
+ 100, 101, 102, 97, 117, 108, 116, 79, 112, 101, 110, 67, 111, 110, 116, 101, 110, 116, 0
+ };
+ data = staticallyStoredDefaultOpenContent;
+ length = 18;
+ break;
+ }
+
+ case Documentation:
+ {
+ static const unsigned short staticallyStoredDocumentation[] =
+ {
+ 100, 111, 99, 117, 109, 101, 110, 116, 97, 116, 105, 111, 110, 0
+ };
+ data = staticallyStoredDocumentation;
+ length = 13;
+ break;
+ }
+
+ case Element:
+ {
+ static const unsigned short staticallyStoredElement[] =
+ {
+ 101, 108, 101, 109, 101, 110, 116, 0
+ };
+ data = staticallyStoredElement;
+ length = 7;
+ break;
+ }
+
+ case ElementFormDefault:
+ {
+ static const unsigned short staticallyStoredElementFormDefault[] =
+ {
+ 101, 108, 101, 109, 101, 110, 116, 70, 111, 114, 109, 68, 101, 102, 97, 117, 108, 116, 0
+ };
+ data = staticallyStoredElementFormDefault;
+ length = 18;
+ break;
+ }
+
+ case Enumeration:
+ {
+ static const unsigned short staticallyStoredEnumeration[] =
+ {
+ 101, 110, 117, 109, 101, 114, 97, 116, 105, 111, 110, 0
+ };
+ data = staticallyStoredEnumeration;
+ length = 11;
+ break;
+ }
+
+ case Extension:
+ {
+ static const unsigned short staticallyStoredExtension[] =
+ {
+ 101, 120, 116, 101, 110, 115, 105, 111, 110, 0
+ };
+ data = staticallyStoredExtension;
+ length = 9;
+ break;
+ }
+
+ case Field:
+ {
+ static const unsigned short staticallyStoredField[] =
+ {
+ 102, 105, 101, 108, 100, 0
+ };
+ data = staticallyStoredField;
+ length = 5;
+ break;
+ }
+
+ case Final:
+ {
+ static const unsigned short staticallyStoredFinal[] =
+ {
+ 102, 105, 110, 97, 108, 0
+ };
+ data = staticallyStoredFinal;
+ length = 5;
+ break;
+ }
+
+ case FinalDefault:
+ {
+ static const unsigned short staticallyStoredFinalDefault[] =
+ {
+ 102, 105, 110, 97, 108, 68, 101, 102, 97, 117, 108, 116, 0
+ };
+ data = staticallyStoredFinalDefault;
+ length = 12;
+ break;
+ }
+
+ case Fixed:
+ {
+ static const unsigned short staticallyStoredFixed[] =
+ {
+ 102, 105, 120, 101, 100, 0
+ };
+ data = staticallyStoredFixed;
+ length = 5;
+ break;
+ }
+
+ case Form:
+ {
+ static const unsigned short staticallyStoredForm[] =
+ {
+ 102, 111, 114, 109, 0
+ };
+ data = staticallyStoredForm;
+ length = 4;
+ break;
+ }
+
+ case FractionDigits:
+ {
+ static const unsigned short staticallyStoredFractionDigits[] =
+ {
+ 102, 114, 97, 99, 116, 105, 111, 110, 68, 105, 103, 105, 116, 115, 0
+ };
+ data = staticallyStoredFractionDigits;
+ length = 14;
+ break;
+ }
+
+ case Group:
+ {
+ static const unsigned short staticallyStoredGroup[] =
+ {
+ 103, 114, 111, 117, 112, 0
+ };
+ data = staticallyStoredGroup;
+ length = 5;
+ break;
+ }
+
+ case Id:
+ {
+ static const unsigned short staticallyStoredId[] =
+ {
+ 105, 100, 0
+ };
+ data = staticallyStoredId;
+ length = 2;
+ break;
+ }
+
+ case Import:
+ {
+ static const unsigned short staticallyStoredImport[] =
+ {
+ 105, 109, 112, 111, 114, 116, 0
+ };
+ data = staticallyStoredImport;
+ length = 6;
+ break;
+ }
+
+ case Include:
+ {
+ static const unsigned short staticallyStoredInclude[] =
+ {
+ 105, 110, 99, 108, 117, 100, 101, 0
+ };
+ data = staticallyStoredInclude;
+ length = 7;
+ break;
+ }
+
+ case ItemType:
+ {
+ static const unsigned short staticallyStoredItemType[] =
+ {
+ 105, 116, 101, 109, 84, 121, 112, 101, 0
+ };
+ data = staticallyStoredItemType;
+ length = 8;
+ break;
+ }
+
+ case Key:
+ {
+ static const unsigned short staticallyStoredKey[] =
+ {
+ 107, 101, 121, 0
+ };
+ data = staticallyStoredKey;
+ length = 3;
+ break;
+ }
+
+ case Keyref:
+ {
+ static const unsigned short staticallyStoredKeyref[] =
+ {
+ 107, 101, 121, 114, 101, 102, 0
+ };
+ data = staticallyStoredKeyref;
+ length = 6;
+ break;
+ }
+
+ case Length:
+ {
+ static const unsigned short staticallyStoredLength[] =
+ {
+ 108, 101, 110, 103, 116, 104, 0
+ };
+ data = staticallyStoredLength;
+ length = 6;
+ break;
+ }
+
+ case List:
+ {
+ static const unsigned short staticallyStoredList[] =
+ {
+ 108, 105, 115, 116, 0
+ };
+ data = staticallyStoredList;
+ length = 4;
+ break;
+ }
+
+ case MaxExclusive:
+ {
+ static const unsigned short staticallyStoredMaxExclusive[] =
+ {
+ 109, 97, 120, 69, 120, 99, 108, 117, 115, 105, 118, 101, 0
+ };
+ data = staticallyStoredMaxExclusive;
+ length = 12;
+ break;
+ }
+
+ case MaxInclusive:
+ {
+ static const unsigned short staticallyStoredMaxInclusive[] =
+ {
+ 109, 97, 120, 73, 110, 99, 108, 117, 115, 105, 118, 101, 0
+ };
+ data = staticallyStoredMaxInclusive;
+ length = 12;
+ break;
+ }
+
+ case MaxLength:
+ {
+ static const unsigned short staticallyStoredMaxLength[] =
+ {
+ 109, 97, 120, 76, 101, 110, 103, 116, 104, 0
+ };
+ data = staticallyStoredMaxLength;
+ length = 9;
+ break;
+ }
+
+ case MaxOccurs:
+ {
+ static const unsigned short staticallyStoredMaxOccurs[] =
+ {
+ 109, 97, 120, 79, 99, 99, 117, 114, 115, 0
+ };
+ data = staticallyStoredMaxOccurs;
+ length = 9;
+ break;
+ }
+
+ case MemberTypes:
+ {
+ static const unsigned short staticallyStoredMemberTypes[] =
+ {
+ 109, 101, 109, 98, 101, 114, 84, 121, 112, 101, 115, 0
+ };
+ data = staticallyStoredMemberTypes;
+ length = 11;
+ break;
+ }
+
+ case MinExclusive:
+ {
+ static const unsigned short staticallyStoredMinExclusive[] =
+ {
+ 109, 105, 110, 69, 120, 99, 108, 117, 115, 105, 118, 101, 0
+ };
+ data = staticallyStoredMinExclusive;
+ length = 12;
+ break;
+ }
+
+ case MinInclusive:
+ {
+ static const unsigned short staticallyStoredMinInclusive[] =
+ {
+ 109, 105, 110, 73, 110, 99, 108, 117, 115, 105, 118, 101, 0
+ };
+ data = staticallyStoredMinInclusive;
+ length = 12;
+ break;
+ }
+
+ case MinLength:
+ {
+ static const unsigned short staticallyStoredMinLength[] =
+ {
+ 109, 105, 110, 76, 101, 110, 103, 116, 104, 0
+ };
+ data = staticallyStoredMinLength;
+ length = 9;
+ break;
+ }
+
+ case MinOccurs:
+ {
+ static const unsigned short staticallyStoredMinOccurs[] =
+ {
+ 109, 105, 110, 79, 99, 99, 117, 114, 115, 0
+ };
+ data = staticallyStoredMinOccurs;
+ length = 9;
+ break;
+ }
+
+ case Mixed:
+ {
+ static const unsigned short staticallyStoredMixed[] =
+ {
+ 109, 105, 120, 101, 100, 0
+ };
+ data = staticallyStoredMixed;
+ length = 5;
+ break;
+ }
+
+ case Mode:
+ {
+ static const unsigned short staticallyStoredMode[] =
+ {
+ 109, 111, 100, 101, 0
+ };
+ data = staticallyStoredMode;
+ length = 4;
+ break;
+ }
+
+ case Name:
+ {
+ static const unsigned short staticallyStoredName[] =
+ {
+ 110, 97, 109, 101, 0
+ };
+ data = staticallyStoredName;
+ length = 4;
+ break;
+ }
+
+ case Namespace:
+ {
+ static const unsigned short staticallyStoredNamespace[] =
+ {
+ 110, 97, 109, 101, 115, 112, 97, 99, 101, 0
+ };
+ data = staticallyStoredNamespace;
+ length = 9;
+ break;
+ }
+
+ case Nillable:
+ {
+ static const unsigned short staticallyStoredNillable[] =
+ {
+ 110, 105, 108, 108, 97, 98, 108, 101, 0
+ };
+ data = staticallyStoredNillable;
+ length = 8;
+ break;
+ }
+
+ case NotNamespace:
+ {
+ static const unsigned short staticallyStoredNotNamespace[] =
+ {
+ 110, 111, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101, 0
+ };
+ data = staticallyStoredNotNamespace;
+ length = 12;
+ break;
+ }
+
+ case NotQName:
+ {
+ static const unsigned short staticallyStoredNotQName[] =
+ {
+ 110, 111, 116, 81, 78, 97, 109, 101, 0
+ };
+ data = staticallyStoredNotQName;
+ length = 8;
+ break;
+ }
+
+ case Notation:
+ {
+ static const unsigned short staticallyStoredNotation[] =
+ {
+ 110, 111, 116, 97, 116, 105, 111, 110, 0
+ };
+ data = staticallyStoredNotation;
+ length = 8;
+ break;
+ }
+
+ case OpenContent:
+ {
+ static const unsigned short staticallyStoredOpenContent[] =
+ {
+ 111, 112, 101, 110, 67, 111, 110, 116, 101, 110, 116, 0
+ };
+ data = staticallyStoredOpenContent;
+ length = 11;
+ break;
+ }
+
+ case Override:
+ {
+ static const unsigned short staticallyStoredOverride[] =
+ {
+ 111, 118, 101, 114, 114, 105, 100, 101, 0
+ };
+ data = staticallyStoredOverride;
+ length = 8;
+ break;
+ }
+
+ case Pattern:
+ {
+ static const unsigned short staticallyStoredPattern[] =
+ {
+ 112, 97, 116, 116, 101, 114, 110, 0
+ };
+ data = staticallyStoredPattern;
+ length = 7;
+ break;
+ }
+
+ case Preserve:
+ {
+ static const unsigned short staticallyStoredPreserve[] =
+ {
+ 112, 114, 101, 115, 101, 114, 118, 101, 0
+ };
+ data = staticallyStoredPreserve;
+ length = 8;
+ break;
+ }
+
+ case ProcessContents:
+ {
+ static const unsigned short staticallyStoredProcessContents[] =
+ {
+ 112, 114, 111, 99, 101, 115, 115, 67, 111, 110, 116, 101, 110, 116, 115, 0
+ };
+ data = staticallyStoredProcessContents;
+ length = 15;
+ break;
+ }
+
+ case Public:
+ {
+ static const unsigned short staticallyStoredPublic[] =
+ {
+ 112, 117, 98, 108, 105, 99, 0
+ };
+ data = staticallyStoredPublic;
+ length = 6;
+ break;
+ }
+
+ case Redefine:
+ {
+ static const unsigned short staticallyStoredRedefine[] =
+ {
+ 114, 101, 100, 101, 102, 105, 110, 101, 0
+ };
+ data = staticallyStoredRedefine;
+ length = 8;
+ break;
+ }
+
+ case Ref:
+ {
+ static const unsigned short staticallyStoredRef[] =
+ {
+ 114, 101, 102, 0
+ };
+ data = staticallyStoredRef;
+ length = 3;
+ break;
+ }
+
+ case Refer:
+ {
+ static const unsigned short staticallyStoredRefer[] =
+ {
+ 114, 101, 102, 101, 114, 0
+ };
+ data = staticallyStoredRefer;
+ length = 5;
+ break;
+ }
+
+ case Replace:
+ {
+ static const unsigned short staticallyStoredReplace[] =
+ {
+ 114, 101, 112, 108, 97, 99, 101, 0
+ };
+ data = staticallyStoredReplace;
+ length = 7;
+ break;
+ }
+
+ case Restriction:
+ {
+ static const unsigned short staticallyStoredRestriction[] =
+ {
+ 114, 101, 115, 116, 114, 105, 99, 116, 105, 111, 110, 0
+ };
+ data = staticallyStoredRestriction;
+ length = 11;
+ break;
+ }
+
+ case Schema:
+ {
+ static const unsigned short staticallyStoredSchema[] =
+ {
+ 115, 99, 104, 101, 109, 97, 0
+ };
+ data = staticallyStoredSchema;
+ length = 6;
+ break;
+ }
+
+ case SchemaLocation:
+ {
+ static const unsigned short staticallyStoredSchemaLocation[] =
+ {
+ 115, 99, 104, 101, 109, 97, 76, 111, 99, 97, 116, 105, 111, 110, 0
+ };
+ data = staticallyStoredSchemaLocation;
+ length = 14;
+ break;
+ }
+
+ case Selector:
+ {
+ static const unsigned short staticallyStoredSelector[] =
+ {
+ 115, 101, 108, 101, 99, 116, 111, 114, 0
+ };
+ data = staticallyStoredSelector;
+ length = 8;
+ break;
+ }
+
+ case Sequence:
+ {
+ static const unsigned short staticallyStoredSequence[] =
+ {
+ 115, 101, 113, 117, 101, 110, 99, 101, 0
+ };
+ data = staticallyStoredSequence;
+ length = 8;
+ break;
+ }
+
+ case SimpleContent:
+ {
+ static const unsigned short staticallyStoredSimpleContent[] =
+ {
+ 115, 105, 109, 112, 108, 101, 67, 111, 110, 116, 101, 110, 116, 0
+ };
+ data = staticallyStoredSimpleContent;
+ length = 13;
+ break;
+ }
+
+ case SimpleType:
+ {
+ static const unsigned short staticallyStoredSimpleType[] =
+ {
+ 115, 105, 109, 112, 108, 101, 84, 121, 112, 101, 0
+ };
+ data = staticallyStoredSimpleType;
+ length = 10;
+ break;
+ }
+
+ case Source:
+ {
+ static const unsigned short staticallyStoredSource[] =
+ {
+ 115, 111, 117, 114, 99, 101, 0
+ };
+ data = staticallyStoredSource;
+ length = 6;
+ break;
+ }
+
+ case SubstitutionGroup:
+ {
+ static const unsigned short staticallyStoredSubstitutionGroup[] =
+ {
+ 115, 117, 98, 115, 116, 105, 116, 117, 116, 105, 111, 110, 71, 114, 111, 117, 112, 0
+ };
+ data = staticallyStoredSubstitutionGroup;
+ length = 17;
+ break;
+ }
+
+ case System:
+ {
+ static const unsigned short staticallyStoredSystem[] =
+ {
+ 115, 121, 115, 116, 101, 109, 0
+ };
+ data = staticallyStoredSystem;
+ length = 6;
+ break;
+ }
+
+ case TargetNamespace:
+ {
+ static const unsigned short staticallyStoredTargetNamespace[] =
+ {
+ 116, 97, 114, 103, 101, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101, 0
+ };
+ data = staticallyStoredTargetNamespace;
+ length = 15;
+ break;
+ }
+
+ case Test:
+ {
+ static const unsigned short staticallyStoredTest[] =
+ {
+ 116, 101, 115, 116, 0
+ };
+ data = staticallyStoredTest;
+ length = 4;
+ break;
+ }
+
+ case TotalDigits:
+ {
+ static const unsigned short staticallyStoredTotalDigits[] =
+ {
+ 116, 111, 116, 97, 108, 68, 105, 103, 105, 116, 115, 0
+ };
+ data = staticallyStoredTotalDigits;
+ length = 11;
+ break;
+ }
+
+ case Type:
+ {
+ static const unsigned short staticallyStoredType[] =
+ {
+ 116, 121, 112, 101, 0
+ };
+ data = staticallyStoredType;
+ length = 4;
+ break;
+ }
+
+ case Union:
+ {
+ static const unsigned short staticallyStoredUnion[] =
+ {
+ 117, 110, 105, 111, 110, 0
+ };
+ data = staticallyStoredUnion;
+ length = 5;
+ break;
+ }
+
+ case Unique:
+ {
+ static const unsigned short staticallyStoredUnique[] =
+ {
+ 117, 110, 105, 113, 117, 101, 0
+ };
+ data = staticallyStoredUnique;
+ length = 6;
+ break;
+ }
+
+ case Use:
+ {
+ static const unsigned short staticallyStoredUse[] =
+ {
+ 117, 115, 101, 0
+ };
+ data = staticallyStoredUse;
+ length = 3;
+ break;
+ }
+
+ case Value:
+ {
+ static const unsigned short staticallyStoredValue[] =
+ {
+ 118, 97, 108, 117, 101, 0
+ };
+ data = staticallyStoredValue;
+ length = 5;
+ break;
+ }
+
+ case Version:
+ {
+ static const unsigned short staticallyStoredVersion[] =
+ {
+ 118, 101, 114, 115, 105, 111, 110, 0
+ };
+ data = staticallyStoredVersion;
+ length = 7;
+ break;
+ }
+
+ case WhiteSpace:
+ {
+ static const unsigned short staticallyStoredWhiteSpace[] =
+ {
+ 119, 104, 105, 116, 101, 83, 112, 97, 99, 101, 0
+ };
+ data = staticallyStoredWhiteSpace;
+ length = 10;
+ break;
+ }
+
+ case XML_NS_SCHEMA_URI:
+ {
+ static const unsigned short staticallyStoredXML_NS_SCHEMA_URI[] =
+ {
+ 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 49, 47, 88, 77, 76, 83, 99, 104, 101, 109, 97, 0
+ };
+ data = staticallyStoredXML_NS_SCHEMA_URI;
+ length = 32;
+ break;
+ }
+
+ case XPathDefaultNamespace:
+ {
+ static const unsigned short staticallyStoredXPathDefaultNamespace[] =
+ {
+ 120, 112, 97, 116, 104, 68, 101, 102, 97, 117, 108, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101, 0
+ };
+ data = staticallyStoredXPathDefaultNamespace;
+ length = 21;
+ break;
+ }
+
+ case XmlLanguage:
+ {
+ static const unsigned short staticallyStoredXmlLanguage[] =
+ {
+ 120, 109, 108, 58, 108, 97, 110, 103, 0
+ };
+ data = staticallyStoredXmlLanguage;
+ length = 8;
+ break;
+ }
+
+ case Xpath:
+ {
+ static const unsigned short staticallyStoredXpath[] =
+ {
+ 120, 112, 97, 116, 104, 0
+ };
+ data = staticallyStoredXpath;
+ length = 5;
+ break;
+ }
+
+ default:
+ /* It's either the default token, or an undefined enum
+ * value. We silence a compiler warning, and return the
+ * empty string. */
+ ;
+ }
+
+ union
+ {
+ const unsigned short *data;
+ const QChar *asQChar;
+ } converter;
+ converter.data = data;
+
+ return QString::fromRawData(converter.asQChar, length);
+ }
+
+QT_END_NAMESPACE
+
diff --git a/src/xmlpatterns/schema/qxsdschematoken_p.h b/src/xmlpatterns/schema/qxsdschematoken_p.h
new file mode 100644
index 0000000..f54f633
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschematoken_p.h
@@ -0,0 +1,209 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+/* NOTE: This file is AUTO GENERATED by qautomaton2cpp.xsl. */
+
+#ifndef QPatternist_XsdSchemaToken_h
+#define QPatternist_XsdSchemaToken_h
+
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+class XsdSchemaToken
+ {
+ public:
+ enum NodeName
+
+ {
+ NoKeyword,
+Abstract,
+All,
+Alternative,
+Annotation,
+Any,
+AnyAttribute,
+Appinfo,
+AppliesToEmpty,
+Assert,
+Assertion,
+Attribute,
+AttributeFormDefault,
+AttributeGroup,
+Base,
+Block,
+BlockDefault,
+Choice,
+Collapse,
+ComplexContent,
+ComplexType,
+Default,
+DefaultAttributes,
+DefaultAttributesApply,
+DefaultOpenContent,
+Documentation,
+Element,
+ElementFormDefault,
+Enumeration,
+Extension,
+Field,
+Final,
+FinalDefault,
+Fixed,
+Form,
+FractionDigits,
+Group,
+Id,
+Import,
+Include,
+ItemType,
+Key,
+Keyref,
+Length,
+List,
+MaxExclusive,
+MaxInclusive,
+MaxLength,
+MaxOccurs,
+MemberTypes,
+MinExclusive,
+MinInclusive,
+MinLength,
+MinOccurs,
+Mixed,
+Mode,
+Name,
+Namespace,
+Nillable,
+NotNamespace,
+NotQName,
+Notation,
+OpenContent,
+Override,
+Pattern,
+Preserve,
+ProcessContents,
+Public,
+Redefine,
+Ref,
+Refer,
+Replace,
+Restriction,
+Schema,
+SchemaLocation,
+Selector,
+Sequence,
+SimpleContent,
+SimpleType,
+Source,
+SubstitutionGroup,
+System,
+TargetNamespace,
+Test,
+TotalDigits,
+Type,
+Union,
+Unique,
+Use,
+Value,
+Version,
+WhiteSpace,
+XML_NS_SCHEMA_URI,
+XPathDefaultNamespace,
+XmlLanguage,
+Xpath
+ };
+
+ static inline NodeName toToken(const QString &value);
+static inline NodeName toToken(const QStringRef &value);
+static NodeName toToken(const QChar *data, int length);
+static QString toString(NodeName token);
+
+
+ private:
+ static inline NodeName classifier2(const QChar *data);
+static inline NodeName classifier3(const QChar *data);
+static inline NodeName classifier4(const QChar *data);
+static inline NodeName classifier5(const QChar *data);
+static inline NodeName classifier6(const QChar *data);
+static inline NodeName classifier7(const QChar *data);
+static inline NodeName classifier8(const QChar *data);
+static inline NodeName classifier9(const QChar *data);
+static inline NodeName classifier10(const QChar *data);
+static inline NodeName classifier11(const QChar *data);
+static inline NodeName classifier12(const QChar *data);
+static inline NodeName classifier13(const QChar *data);
+static inline NodeName classifier14(const QChar *data);
+static inline NodeName classifier15(const QChar *data);
+static inline NodeName classifier17(const QChar *data);
+static inline NodeName classifier18(const QChar *data);
+static inline NodeName classifier20(const QChar *data);
+static inline NodeName classifier21(const QChar *data);
+static inline NodeName classifier22(const QChar *data);
+static inline NodeName classifier32(const QChar *data);
+
+ };
+
+ inline XsdSchemaToken::NodeName XsdSchemaToken::toToken(const QString &value)
+ {
+ return toToken(value.constData(), value.length());
+ }
+
+ inline XsdSchemaToken::NodeName XsdSchemaToken::toToken(const QStringRef &value)
+ {
+ return toToken(value.constData(), value.length());
+ }
+
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdschematypesfactory.cpp b/src/xmlpatterns/schema/qxsdschematypesfactory.cpp
new file mode 100644
index 0000000..430433f
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschematypesfactory.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdschematypesfactory_p.h"
+
+#include "qbasictypesfactory_p.h"
+#include "qbuiltintypes_p.h"
+#include "qderivedinteger_p.h"
+#include "qderivedstring_p.h"
+#include "qcommonnamespaces_p.h"
+#include "qxsdschematoken_p.h"
+#include "qxsdsimpletype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+XsdSchemaTypesFactory::XsdSchemaTypesFactory(const NamePool::Ptr &namePool)
+ : m_namePool(namePool)
+{
+ m_types.reserve(3);
+
+ const XsdFacet::Ptr whiteSpaceFacet(new XsdFacet());
+ whiteSpaceFacet->setType(XsdFacet::WhiteSpace);
+ whiteSpaceFacet->setFixed(true);
+ whiteSpaceFacet->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse)));
+
+ const XsdFacet::Ptr minLengthFacet(new XsdFacet());
+ minLengthFacet->setType(XsdFacet::MinimumLength);
+ minLengthFacet->setValue(DerivedInteger<TypeNonNegativeInteger>::fromLexical(namePool, QLatin1String("1")));
+
+ XsdFacet::Hash facets;
+ facets.insert(whiteSpaceFacet->type(), whiteSpaceFacet);
+ facets.insert(minLengthFacet->type(), minLengthFacet);
+
+ {
+ const QXmlName typeName = m_namePool->allocateQName(CommonNamespaces::WXS, QLatin1String("NMTOKENS"));
+ const XsdSimpleType::Ptr type(new XsdSimpleType());
+ type->setName(typeName);
+ type->setWxsSuperType(BuiltinTypes::xsAnySimpleType);
+ type->setCategory(XsdSimpleType::SimpleTypeList);
+ type->setItemType(BuiltinTypes::xsNMTOKEN);
+ type->setDerivationMethod(XsdSimpleType::DerivationRestriction);
+ type->setFacets(facets);
+ m_types.insert(typeName, type);
+ }
+ {
+ const QXmlName typeName = m_namePool->allocateQName(CommonNamespaces::WXS, QLatin1String("IDREFS"));
+ const XsdSimpleType::Ptr type(new XsdSimpleType());
+ type->setName(typeName);
+ type->setWxsSuperType(BuiltinTypes::xsAnySimpleType);
+ type->setCategory(XsdSimpleType::SimpleTypeList);
+ type->setItemType(BuiltinTypes::xsIDREF);
+ type->setDerivationMethod(XsdSimpleType::DerivationRestriction);
+ type->setFacets(facets);
+ m_types.insert(typeName, type);
+ }
+ {
+ const QXmlName typeName = m_namePool->allocateQName(CommonNamespaces::WXS, QLatin1String("ENTITIES"));
+ const XsdSimpleType::Ptr type(new XsdSimpleType());
+ type->setName(typeName);
+ type->setWxsSuperType(BuiltinTypes::xsAnySimpleType);
+ type->setCategory(XsdSimpleType::SimpleTypeList);
+ type->setItemType(BuiltinTypes::xsENTITY);
+ type->setDerivationMethod(XsdSimpleType::DerivationRestriction);
+ type->setFacets(facets);
+ m_types.insert(typeName, type);
+ }
+}
+
+SchemaType::Ptr XsdSchemaTypesFactory::createSchemaType(const QXmlName name) const
+{
+ if (m_types.contains(name)) {
+ return m_types.value(name);
+ } else {
+ if (!m_basicTypesFactory)
+ m_basicTypesFactory = BasicTypesFactory::self(m_namePool);
+
+ return m_basicTypesFactory->createSchemaType(name);
+ }
+}
+
+SchemaType::Hash XsdSchemaTypesFactory::types() const
+{
+ return m_types;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdschematypesfactory_p.h b/src/xmlpatterns/schema/qxsdschematypesfactory_p.h
new file mode 100644
index 0000000..ed082ac
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdschematypesfactory_p.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSchemaTypesFactory_H
+#define Patternist_XsdSchemaTypesFactory_H
+
+#include <QtCore/QHash>
+#include "qschematypefactory_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Factory for creating schema types for the types defined in XSD.
+ *
+ * @ingroup Patternist_types
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSchemaTypesFactory : public SchemaTypeFactory
+ {
+ public:
+ /**
+ * Creates a new schema type factory.
+ *
+ * @param namePool The name pool all type names belong to.
+ */
+ XsdSchemaTypesFactory(const NamePool::Ptr &namePool);
+
+ /**
+ * Creates a primitive type for @p name. If @p name is not supported,
+ * @c null is returned.
+ *
+ * @note This does not handle user defined types, only builtin types.
+ */
+ virtual SchemaType::Ptr createSchemaType(const QXmlName) const;
+
+ /**
+ * Returns a hash of all available types.
+ */
+ virtual SchemaType::Hash types() const;
+
+ private:
+ /**
+ * A dictonary of all predefined schema types.
+ */
+ SchemaType::Hash m_types;
+
+ NamePool::Ptr m_namePool;
+ mutable SchemaTypeFactory::Ptr m_basicTypesFactory;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdsimpletype.cpp b/src/xmlpatterns/schema/qxsdsimpletype.cpp
new file mode 100644
index 0000000..8b367ba
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdsimpletype.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "qxsdsimpletype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+QString XsdSimpleType::displayName(const NamePool::Ptr &np) const
+{
+ return np->displayName(name(np));
+}
+
+void XsdSimpleType::setWxsSuperType(const SchemaType::Ptr &type)
+{
+ m_superType = type;
+}
+
+SchemaType::Ptr XsdSimpleType::wxsSuperType() const
+{
+ return m_superType;
+}
+
+void XsdSimpleType::setContext(const NamedSchemaComponent::Ptr &component)
+{
+ m_context = component;
+}
+
+NamedSchemaComponent::Ptr XsdSimpleType::context() const
+{
+ return m_context;
+}
+
+void XsdSimpleType::setPrimitiveType(const AnySimpleType::Ptr &type)
+{
+ m_primitiveType = type;
+}
+
+AnySimpleType::Ptr XsdSimpleType::primitiveType() const
+{
+ return m_primitiveType;
+}
+
+void XsdSimpleType::setItemType(const AnySimpleType::Ptr &type)
+{
+ m_itemType = type;
+}
+
+AnySimpleType::Ptr XsdSimpleType::itemType() const
+{
+ return m_itemType;
+}
+
+void XsdSimpleType::setMemberTypes(const AnySimpleType::List &types)
+{
+ m_memberTypes = types;
+}
+
+AnySimpleType::List XsdSimpleType::memberTypes() const
+{
+ return m_memberTypes;
+}
+
+void XsdSimpleType::setFacets(const XsdFacet::Hash &facets)
+{
+ m_facets = facets;
+}
+
+XsdFacet::Hash XsdSimpleType::facets() const
+{
+ return m_facets;
+}
+
+void XsdSimpleType::setCategory(TypeCategory category)
+{
+ m_typeCategory = category;
+}
+
+XsdSimpleType::TypeCategory XsdSimpleType::category() const
+{
+ return m_typeCategory;
+}
+
+void XsdSimpleType::setDerivationMethod(DerivationMethod method)
+{
+ m_derivationMethod = method;
+}
+
+XsdSimpleType::DerivationMethod XsdSimpleType::derivationMethod() const
+{
+ return m_derivationMethod;
+}
+
+bool XsdSimpleType::isDefinedBySchema() const
+{
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdsimpletype_p.h b/src/xmlpatterns/schema/qxsdsimpletype_p.h
new file mode 100644
index 0000000..12053f0
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdsimpletype_p.h
@@ -0,0 +1,219 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdSimpleType_H
+#define Patternist_XsdSimpleType_H
+
+#include "qanysimpletype_p.h"
+#include "qxsdfacet_p.h"
+#include "qxsduserschematype_p.h"
+
+#include <QtCore/QSet>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a XSD simpleType object.
+ *
+ * This class represents the <em>simpleType</em> object of a XML schema as described
+ * <a href="http://www.w3.org/TR/xmlschema-2/#rf-defn">here</a>.
+ *
+ * It contains information from either a top-level simple type declaration (as child of a <em>schema</em> object)
+ * or a local simple type declaration (as descendant of an <em>element</em> or <em>complexType</em> object).
+ *
+ * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSSimpleType">XML Schema API reference</a>
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ class XsdSimpleType : public XsdUserSchemaType<AnySimpleType>
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<XsdSimpleType> Ptr;
+
+ /**
+ * Returns the display name of the simple type.
+ *
+ * @param namePool The name pool the type name is stored in.
+ */
+ virtual QString displayName(const NamePool::Ptr &namePool) const;
+
+ /**
+ * Sets the base @p type of the simple type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-basetype">Base Type Definition</a>
+ */
+ void setWxsSuperType(const SchemaType::Ptr &type);
+
+ /**
+ * Returns the base type of the simple type or an empty pointer if no base type is
+ * set.
+ */
+ virtual SchemaType::Ptr wxsSuperType() const;
+
+ /**
+ * Sets the context @p component of the simple type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema11-1/#std-context">Context Definition</a>
+ */
+ void setContext(const NamedSchemaComponent::Ptr &component);
+
+ /**
+ * Returns the context component of the simple type.
+ */
+ NamedSchemaComponent::Ptr context() const;
+
+ /**
+ * Sets the primitive @p type of the simple type.
+ *
+ * The primitive type is only specified if the category is SimpleTypeAtomic.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-primitive">Primitive Type Definition</a>
+ */
+ void setPrimitiveType(const AnySimpleType::Ptr &type);
+
+ /**
+ * Returns the primitive type of the simple type or an empty pointer if the category is
+ * not SimpleTypeAtomic.
+ */
+ AnySimpleType::Ptr primitiveType() const;
+
+ /**
+ * Sets the list item @p type of the simple type.
+ *
+ * The list item type is only specified if the category is SimpleTypeList.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-itemType">Item Type Definition</a>
+ */
+ void setItemType(const AnySimpleType::Ptr &type);
+
+ /**
+ * Returns the list item type of the simple type or an empty pointer if the category is
+ * not SimpleTypeList.
+ */
+ AnySimpleType::Ptr itemType() const;
+
+ /**
+ * Sets the member @p types of the simple type.
+ *
+ * The member types are only specified if the category is SimpleTypeUnion.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-memberTypes">Member Types Definition</a>
+ */
+ void setMemberTypes(const AnySimpleType::List &types);
+
+ /**
+ * Returns the list member types of the simple type or an empty list if the category is
+ * not SimpleTypeUnion.
+ */
+ AnySimpleType::List memberTypes() const;
+
+ /**
+ * Sets the @p facets of the simple type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-facets">Facets Definition</a>
+ */
+ void setFacets(const XsdFacet::Hash &facets);
+
+ /**
+ * Returns the facets of the simple type.
+ */
+ XsdFacet::Hash facets() const;
+
+ /**
+ * Sets the @p category (variety) of the simple type.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-variety">Variety Definition</a>
+ */
+ void setCategory(TypeCategory category);
+
+ /**
+ * Returns the category (variety) of the simple type.
+ */
+ virtual TypeCategory category() const;
+
+ /**
+ * Sets the derivation @p method of the simple type.
+ *
+ * @see DerivationMethod
+ */
+ void setDerivationMethod(DerivationMethod method);
+
+ /**
+ * Returns the derivation method of the simple type.
+ */
+ virtual DerivationMethod derivationMethod() const;
+
+ /**
+ * Always returns @c true.
+ */
+ virtual bool isDefinedBySchema() const;
+
+ private:
+ SchemaType::Ptr m_superType;
+ NamedSchemaComponent::Ptr m_context;
+ AnySimpleType::Ptr m_primitiveType;
+ AnySimpleType::Ptr m_itemType;
+ AnySimpleType::List m_memberTypes;
+ XsdFacet::Hash m_facets;
+ TypeCategory m_typeCategory;
+ DerivationMethod m_derivationMethod;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdstatemachine.cpp b/src/xmlpatterns/schema/qxsdstatemachine.cpp
new file mode 100644
index 0000000..3a59042
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdstatemachine.cpp
@@ -0,0 +1,477 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ * NOTE: This file is included by qxsdstatemachine_p.h
+ * if you need some includes, put them in qxsdstatemachine_p.h (outside of the namespace)
+ */
+
+template <typename TransitionType>
+XsdStateMachine<TransitionType>::XsdStateMachine()
+ : m_counter(50)
+{
+}
+
+template <typename TransitionType>
+XsdStateMachine<TransitionType>::XsdStateMachine(const NamePool::Ptr &namePool)
+ : m_namePool(namePool)
+ , m_counter(50)
+{
+}
+
+template <typename TransitionType>
+typename XsdStateMachine<TransitionType>::StateId XsdStateMachine<TransitionType>::addState(StateType type)
+{
+#ifndef QT_NO_DEBUG
+ // make sure we don't have two start states
+ if (type == StartState) {
+ QHashIterator<StateId, StateType> it(m_states);
+ while (it.hasNext()) {
+ it.next();
+ Q_ASSERT(it.value() != StartState && it.value() != StartEndState);
+ }
+ }
+#endif // QT_NO_DEBUG
+
+ // reserve new state id
+ const StateId id = ++m_counter;
+ m_states.insert(id, type);
+
+ // if it is a start state, we make it to our current state
+ if (type == StartState || type == StartEndState)
+ m_currentState = id;
+
+ return id;
+}
+
+template <typename TransitionType>
+void XsdStateMachine<TransitionType>::addTransition(StateId start, TransitionType transition, StateId end)
+{
+ QHash<TransitionType, QVector<StateId> > &hash = m_transitions[start];
+ QVector<StateId> &states = hash[transition];
+ if (!states.contains(end))
+ states.append(end);
+}
+
+template <typename TransitionType>
+void XsdStateMachine<TransitionType>::addEpsilonTransition(StateId start, StateId end)
+{
+ QVector<StateId> &states = m_epsilonTransitions[start];
+ states.append(end);
+}
+
+template <typename TransitionType>
+void XsdStateMachine<TransitionType>::reset()
+{
+ // reset the machine to the start state
+ QHashIterator<StateId, StateType> it(m_states);
+ while (it.hasNext()) {
+ it.next();
+ if (it.value() == StartState || it.value() == StartEndState) {
+ m_currentState = it.key();
+ return;
+ }
+ }
+
+ Q_ASSERT(false);
+}
+
+template <typename TransitionType>
+void XsdStateMachine<TransitionType>::clear()
+{
+ m_states.clear();
+ m_transitions.clear();
+ m_epsilonTransitions.clear();
+ m_currentState = -1;
+ m_counter = 50;
+}
+
+template <typename TransitionType>
+bool XsdStateMachine<TransitionType>::proceed(TransitionType transition)
+{
+ // check that we are not in an invalid state
+ if (!m_transitions.contains(m_currentState)) {
+ return false;
+ }
+
+ // fetch the transition entry for the current state
+ const QHash<TransitionType, QVector<StateId> > &entry = m_transitions[m_currentState];
+ if (entry.contains(transition)) { // is there an transition for the given input?
+ m_currentState = entry.value(transition).first();
+ m_lastTransition = transition;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+template <typename TransitionType>
+QList<TransitionType> XsdStateMachine<TransitionType>::possibleTransitions() const
+{
+ // check that we are not in an invalid state
+ if (!m_transitions.contains(m_currentState)) {
+ return QList<TransitionType>();
+ }
+
+ // fetch the transition entry for the current state
+ const QHash<TransitionType, QVector<StateId> > &entry = m_transitions[m_currentState];
+
+ return entry.keys();
+}
+
+template <typename TransitionType>
+template <typename InputType>
+bool XsdStateMachine<TransitionType>::proceed(InputType input)
+{
+ // check that we are not in an invalid state
+ if (!m_transitions.contains(m_currentState)) {
+ return false;
+ }
+
+ // fetch the transition entry for the current state
+ const QHash<TransitionType, QVector<StateId> > &entry = m_transitions[m_currentState];
+ QHashIterator<TransitionType, QVector<StateId> > it(entry);
+ while (it.hasNext()) {
+ it.next();
+ if (inputEqualsTransition(input, it.key())) {
+ m_currentState = it.value().first();
+ m_lastTransition = it.key();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+template <typename TransitionType>
+template <typename InputType>
+bool XsdStateMachine<TransitionType>::inputEqualsTransition(InputType input, TransitionType transition) const
+{
+ return false;
+}
+
+template <typename TransitionType>
+bool XsdStateMachine<TransitionType>::inEndState() const
+{
+ // check if current state is an end state
+ return (m_states.value(m_currentState) == StartEndState || m_states.value(m_currentState) == EndState);
+}
+
+template <typename TransitionType>
+TransitionType XsdStateMachine<TransitionType>::lastTransition() const
+{
+ return m_lastTransition;
+}
+
+template <typename TransitionType>
+typename XsdStateMachine<TransitionType>::StateId XsdStateMachine<TransitionType>::startState() const
+{
+ QHashIterator<StateId, StateType> it(m_states);
+ while (it.hasNext()) {
+ it.next();
+ if (it.value() == StartState || it.value() == StartEndState)
+ return it.key();
+ }
+
+ Q_ASSERT(false); // should never be reached
+ return -1;
+}
+
+template <typename TransitionType>
+QString XsdStateMachine<TransitionType>::transitionTypeToString(TransitionType type) const
+{
+ Q_UNUSED(type)
+
+ return QString();
+}
+
+template <typename TransitionType>
+bool XsdStateMachine<TransitionType>::outputGraph(QIODevice *device, const QString &graphName) const
+{
+ if (!device->isOpen()) {
+ qWarning("device must be open for writing");
+ return false;
+ }
+
+ QByteArray graph;
+ QTextStream s(&graph);
+
+ QHashIterator<StateId, QHash<TransitionType, QVector<StateId> > > it(m_transitions);
+ QHashIterator<StateId, StateType> it3(m_states);
+
+ s << "digraph " << graphName << " {\n";
+ s << " mindist = 2.0\n";
+
+ // draw edges
+ while (it.hasNext()) {
+ it.next();
+
+ QHashIterator<TransitionType, QVector<StateId> > it2(it.value());
+ while (it2.hasNext()) {
+ it2.next();
+ for (int i = 0; i < it2.value().count(); ++i)
+ s << " " << it.key() << " -> " << it2.value().at(i) << " [label=\"" << transitionTypeToString(it2.key()) << "\"]\n";
+ }
+ }
+
+ QHashIterator<StateId, QVector<StateId> > it4(m_epsilonTransitions);
+ while (it4.hasNext()) {
+ it4.next();
+
+ const QVector<StateId> states = it4.value();
+ for (int i = 0; i < states.count(); ++i)
+ s << " " << it4.key() << " -> " << states.at(i) << " [label=\"&#949;\"]\n";
+ }
+
+ // draw node infos
+ while (it3.hasNext()) {
+ it3.next();
+
+ QString style;
+ if (it3.value() == StartState) {
+ style = QLatin1String("shape=circle, style=filled, color=blue");
+ } else if (it3.value() == StartEndState) {
+ style = QLatin1String("shape=doublecircle, style=filled, color=blue");
+ } else if (it3.value() == InternalState) {
+ style = QLatin1String("shape=circle, style=filled, color=red");
+ } else if (it3.value() == EndState) {
+ style = QLatin1String("shape=doublecircle, style=filled, color=green");
+ }
+
+ s << " " << it3.key() << " [" << style << "]\n";
+ }
+
+ s << "}\n";
+
+ s.flush();
+
+ if (device->write(graph) == -1)
+ return false;
+
+ return true;
+}
+
+
+template <typename TransitionType>
+typename XsdStateMachine<TransitionType>::StateId XsdStateMachine<TransitionType>::dfaStateForNfaState(QSet<StateId> nfaState,
+ QList< QPair<QSet<StateId>, StateId> > &stateTable,
+ XsdStateMachine<TransitionType> &dfa) const
+{
+ // check whether we have the given state in our lookup table
+ // already, in that case simply return it
+ for (int i = 0; i < stateTable.count(); ++i) {
+ if (stateTable.at(i).first == nfaState)
+ return stateTable.at(i).second;
+ }
+
+ // check if the NFA state set contains a Start or End
+ // state, in that case our new DFA state will be a
+ // Start or End state as well
+ StateType type = InternalState;
+ QSetIterator<StateId> it(nfaState);
+ bool hasStartState = false;
+ bool hasEndState = false;
+ while (it.hasNext()) {
+ const StateId state = it.next();
+ if (m_states.value(state) == EndState) {
+ hasEndState = true;
+ } else if (m_states.value(state) == StartState) {
+ hasStartState = true;
+ }
+ }
+ if (hasStartState) {
+ if (hasEndState)
+ type = StartEndState;
+ else
+ type = StartState;
+ } else if (hasEndState) {
+ type = EndState;
+ }
+
+ // create the new DFA state
+ const StateId dfaState = dfa.addState(type);
+
+ // add the new DFA state to the lookup table
+ stateTable.append(qMakePair<QSet<StateId>, StateId>(nfaState, dfaState));
+
+ return dfaState;
+}
+
+
+template <typename TransitionType>
+QSet<typename XsdStateMachine<TransitionType>::StateId> XsdStateMachine<TransitionType>::epsilonClosure(const QSet<StateId> &input) const
+{
+ // every state can reach itself by epsilon transition, so include the input states
+ // in the result as well
+ QSet<StateId> result = input;
+
+ // add the input states to the list of to be processed states
+ QList<StateId> workStates = input.toList();
+ while (!workStates.isEmpty()) { // while there are states to be processed left...
+
+ // dequeue one state from list
+ const StateId state = workStates.takeFirst();
+
+ // get the list of states that can be reached by the epsilon transition
+ // from the current 'state'
+ const QVector<StateId> targetStates = m_epsilonTransitions.value(state);
+ for (int i = 0; i < targetStates.count(); ++i) {
+ // if we have this target state not in our result set yet...
+ if (!result.contains(targetStates.at(i))) {
+ // ... add it to the result set
+ result.insert(targetStates.at(i));
+
+ // add the target state to the list of to be processed states as well,
+ // as we want to have the epsilon transitions not only for the first
+ // level of following states
+ workStates.append(targetStates.at(i));
+ }
+ }
+ }
+
+ return result;
+}
+
+template <typename TransitionType>
+QSet<typename XsdStateMachine<TransitionType>::StateId> XsdStateMachine<TransitionType>::move(const QSet<StateId> &states, TransitionType input) const
+{
+ QSet<StateId> result;
+
+ QSetIterator<StateId> it(states);
+ while (it.hasNext()) { // iterate over all given states
+ const StateId state = it.next();
+
+ // get the transition table for the current state
+ const QHash<TransitionType, QVector<StateId> > transitions = m_transitions.value(state);
+
+ // get the target states for the given input
+ const QVector<StateId> targetStates = transitions.value(input);
+
+ // add all target states to the result
+ for (int i = 0; i < targetStates.size(); ++i)
+ result.insert(targetStates.at(i));
+ }
+
+ return result;
+}
+
+template <typename TransitionType>
+XsdStateMachine<TransitionType> XsdStateMachine<TransitionType>::toDFA() const
+{
+ XsdStateMachine<TransitionType> dfa(m_namePool);
+ dfa.m_counter = 100;
+ QList< QPair< QSet<StateId>, StateId> > table;
+ QList< QSet<StateId> > isMarked;
+
+ // search the start state as the algorithm starts with it...
+ StateId startState = -1;
+ QHashIterator<StateId, StateType> stateTypeIt(m_states);
+ while (stateTypeIt.hasNext()) {
+ stateTypeIt.next();
+ if (stateTypeIt.value() == StartState) {
+ startState = stateTypeIt.key();
+ break;
+ }
+ }
+ Q_ASSERT(startState != -1);
+
+ // our list of state set that still have to be processed
+ QList< QSet<StateId> > workStates;
+
+ // add the start state to the list of to processed state sets
+ workStates.append(epsilonClosure(QSet<StateId>() << startState));
+
+ while (!workStates.isEmpty()) { // as long as there are state sets to process left
+
+ // enqueue set of states
+ const QSet<StateId> states = workStates.takeFirst();
+
+ if (isMarked.contains(states)) // we processed this state set already
+ continue;
+
+ // mark as processed
+ isMarked.append(states);
+
+ // select a list of all inputs that are possible for
+ // the 'states' set
+ QList<TransitionType> input;
+
+ {
+ QSetIterator<StateId> it(states);
+ while (it.hasNext()) {
+ input << m_transitions.value(it.next()).keys();
+ }
+ }
+
+ // get the state in DFA that corresponds to the 'states' set in the NFA
+ const StateId dfaBegin = dfaStateForNfaState(states, table, dfa);
+
+ for (int i = 0; i < input.count(); ++i) { // for each possible input
+ // retrieve the states that can be reached from the 'states' set by the
+ // given input or by epsilon transition
+ const QSet<StateId> followStates = epsilonClosure(move(states, input.at(i)));
+
+ // get the state in DFA that corresponds to the 'followStates' set in the NFA
+ const StateId dfaEnd = dfaStateForNfaState(followStates, table, dfa);
+
+ // adds a new transition to the DFA that corresponds to the transitions between
+ // 'states' and 'followStates' in the NFA
+ dfa.addTransition(dfaBegin, input.at(i), dfaEnd);
+
+ // add the 'followStates' to the list of to be processed state sets
+ workStates.append(followStates);
+ }
+ }
+
+ return dfa;
+}
+
+template <typename TransitionType>
+QHash<typename XsdStateMachine<TransitionType>::StateId, typename XsdStateMachine<TransitionType>::StateType> XsdStateMachine<TransitionType>::states() const
+{
+ return m_states;
+}
+
+template <typename TransitionType>
+QHash<typename XsdStateMachine<TransitionType>::StateId, QHash<TransitionType, QVector<typename XsdStateMachine<TransitionType>::StateId> > > XsdStateMachine<TransitionType>::transitions() const
+{
+ return m_transitions;
+}
diff --git a/src/xmlpatterns/schema/qxsdstatemachine_p.h b/src/xmlpatterns/schema/qxsdstatemachine_p.h
new file mode 100644
index 0000000..68bc801
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdstatemachine_p.h
@@ -0,0 +1,245 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XsdStateMachine_H
+#define Patternist_XsdStateMachine_H
+
+#include "qnamepool_p.h"
+
+#include <QtCore/QHash>
+#include <QtCore/QSet>
+#include <QtCore/QTextStream>
+
+class QIODevice;
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A state machine used for evaluation.
+ *
+ * @ingroup Patternist_schema
+ * @author Tobias Koenig <tobias.koenig@trolltech.com>
+ */
+ template <typename TransitionType>
+ class XsdStateMachine
+ {
+ public:
+ typedef qint32 StateId;
+
+ /**
+ * Describes the type of state.
+ */
+ enum StateType
+ {
+ StartState, ///< The state the machine will start with.
+ StartEndState, ///< The state the machine will start with, can be end state as well.
+ InternalState, ///< Any state that is not start or end state.
+ EndState ///< Any state where the machine is allowed to stop.
+ };
+
+ /**
+ * Creates a new state machine object.
+ */
+ XsdStateMachine();
+
+ /**
+ * Creates a new state machine object.
+ *
+ * The name pool to use for accessing object names.
+ */
+ XsdStateMachine(const NamePool::Ptr &namePool);
+
+ /**
+ * Adds a new state of the given @p type to the state machine.
+ *
+ * @return The id of the new state.
+ */
+ StateId addState(StateType type);
+
+ /**
+ * Adds a new @p transition to the state machine.
+ *
+ * @param start The start state.
+ * @param transition The transition to come from the start to the end state.
+ * @param end The end state.
+ */
+ void addTransition(StateId start, TransitionType transition, StateId end);
+
+ /**
+ * Adds a new epsilon @p transition to the state machine.
+ *
+ * @param start The start state.
+ * @param end The end state.
+ */
+ void addEpsilonTransition(StateId start, StateId end);
+
+ /**
+ * Resets the machine to the start state.
+ */
+ void reset();
+
+ /**
+ * Removes all states and transitions from the state machine.
+ */
+ void clear();
+
+ /**
+ * Continues execution of the machine with the given input @p transition.
+ *
+ * @return @c true if the transition was successfull, @c false otherwise.
+ */
+ bool proceed(TransitionType transition);
+
+ /**
+ * Returns the list of transitions that are reachable from the current
+ * state.
+ */
+ QList<TransitionType> possibleTransitions() const;
+
+ /**
+ * Continues execution of the machine with the given @p input.
+ *
+ * @note To use this method, inputEqualsTransition must be implemented
+ * to find the right transition to use.
+ *
+ * @return @c true if the transition was successfull, @c false otherwise.
+ */
+ template <typename InputType>
+ bool proceed(InputType input);
+
+ /**
+ * Returns whether the given @p input matches the given @p transition.
+ */
+ template <typename InputType>
+ bool inputEqualsTransition(InputType input, TransitionType transition) const;
+
+ /**
+ * Returns whether the machine is in an allowed end state.
+ */
+ bool inEndState() const;
+
+ /**
+ * Returns the last transition that was taken.
+ */
+ TransitionType lastTransition() const;
+
+ /**
+ * Returns the start state of the machine.
+ */
+ StateId startState() const;
+
+ /**
+ * This method should be redefined by template specialization for every
+ * concret TransitionType.
+ */
+ QString transitionTypeToString(TransitionType type) const;
+
+ /**
+ * Outputs the state machine in DOT format to the given
+ * output @p device.
+ */
+ bool outputGraph(QIODevice *device, const QString &graphName) const;
+
+ /**
+ * Returns a DFA that is equal to the NFA of the state machine.
+ */
+ XsdStateMachine<TransitionType> toDFA() const;
+
+ /**
+ * Returns the information of all states of the state machine.
+ */
+ QHash<StateId, StateType> states() const;
+
+ /**
+ * Returns the information of all transitions of the state machine.
+ */
+ QHash<StateId, QHash<TransitionType, QVector<StateId> > > transitions() const;
+
+ private:
+ /**
+ * Returns the DFA state for the given @p nfaStat from the given @p stateTable.
+ * If there is no corresponding DFA state yet, a new one is created.
+ */
+ StateId dfaStateForNfaState(QSet<StateId> nfaState, QList< QPair< QSet<StateId>, StateId> > &stateTable, XsdStateMachine<TransitionType> &dfa) const;
+
+ /**
+ * Returns the set of all states that can be reached from the set of @p input states
+ * by the epsilon transition.
+ */
+ QSet<StateId> epsilonClosure(const QSet<StateId> &input) const;
+
+ /**
+ * Returns the set of all states that can be reached from the set of given @p states
+ * by the given @p input.
+ */
+ QSet<StateId> move(const QSet<StateId> &states, TransitionType input) const;
+
+ NamePool::Ptr m_namePool;
+ QHash<StateId, StateType> m_states;
+ QHash<StateId, QHash<TransitionType, QVector<StateId> > > m_transitions;
+ QHash<StateId, QVector<StateId> > m_epsilonTransitions;
+ StateId m_currentState;
+ qint32 m_counter;
+ TransitionType m_lastTransition;
+ };
+
+ #include "qxsdstatemachine.cpp"
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp
new file mode 100644
index 0000000..ae7fefe
--- /dev/null
+++ b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxsdstatemachinebuilder_p.h"
+
+#include "qxsdelement_p.h"
+#include "qxsdmodelgroup_p.h"
+#include "qxsdschemahelper_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+/*
+ * This methods takes a list of objects and returns a list of list
+ * of all combinations the objects can be ordered.
+ *
+ * e.g. input = [ 1, 2, 3 ]
+ * output = [
+ * [ 1, 2, 3 ],
+ * [ 1, 3, 2 ],
+ * [ 2, 1, 3 ],
+ * [ 2, 3, 1 ],
+ * [ 3, 1, 2 ],
+ * [ 3, 2, 1 ]
+ * ]
+ *
+ * The method is used to create all possible combinations for the particles
+ * in an <all> model group.
+ */
+template <typename T>
+QList< QList<T> > allCombinations(const QList<T> &input)
+{
+ if (input.count() == 1)
+ return (QList< QList<T> >() << input);
+
+ QList< QList<T> > result;
+ for (int i = 0; i < input.count(); ++i) {
+ QList<T> subList = input;
+ T value = subList.takeAt(i);
+
+ QList< QList<T> > subLists = allCombinations(subList);
+ for (int j = 0; j < subLists.count(); ++j) {
+ subLists[j].prepend(value);
+ }
+ result << subLists;
+ }
+
+ return result;
+}
+
+XsdStateMachineBuilder::XsdStateMachineBuilder(XsdStateMachine<XsdTerm::Ptr> *machine, const NamePool::Ptr &namePool, Mode mode)
+ : m_stateMachine(machine), m_namePool(namePool), m_mode(mode)
+{
+}
+
+XsdStateMachine<XsdTerm::Ptr>::StateId XsdStateMachineBuilder::reset()
+{
+ Q_ASSERT(m_stateMachine);
+
+ m_stateMachine->clear();
+
+ return m_stateMachine->addState(XsdStateMachine<XsdTerm::Ptr>::EndState);
+}
+
+XsdStateMachine<XsdTerm::Ptr>::StateId XsdStateMachineBuilder::addStartState(XsdStateMachine<XsdTerm::Ptr>::StateId state)
+{
+ const XsdStateMachine<XsdTerm::Ptr>::StateId startState = m_stateMachine->addState(XsdStateMachine<XsdTerm::Ptr>::StartState);
+ m_stateMachine->addEpsilonTransition(startState, state);
+
+ return startState;
+}
+
+/*
+ * Create the FSA according to Algorithm Tp(S) from http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html
+ */
+XsdStateMachine<XsdTerm::Ptr>::StateId XsdStateMachineBuilder::buildParticle(const XsdParticle::Ptr &particle, XsdStateMachine<XsdTerm::Ptr>::StateId endState)
+{
+ XsdStateMachine<XsdTerm::Ptr>::StateId currentStartState = endState;
+ XsdStateMachine<XsdTerm::Ptr>::StateId currentEndState = endState;
+
+ // 2
+ if (particle->maximumOccursUnbounded()) {
+ const XsdStateMachine<XsdTerm::Ptr>::StateId t = m_stateMachine->addState(XsdStateMachine<XsdTerm::Ptr>::InternalState);
+ const XsdStateMachine<XsdTerm::Ptr>::StateId n = buildTerm(particle->term(), t);
+
+ m_stateMachine->addEpsilonTransition(t, n);
+ m_stateMachine->addEpsilonTransition(n, endState);
+
+ currentEndState = t;
+ currentStartState = t;
+ } else { // 3
+ int count = (particle->maximumOccurs() - particle->minimumOccurs());
+ if (count > 100)
+ count = 100;
+
+ for (int i = 0; i < count; ++i) {
+ currentStartState = buildTerm(particle->term(), currentEndState);
+ m_stateMachine->addEpsilonTransition(currentStartState, endState);
+ currentEndState = currentStartState;
+ }
+ }
+
+ int minOccurs = particle->minimumOccurs();
+ if (minOccurs > 100)
+ minOccurs = 100;
+
+ for (int i = 0; i < minOccurs; ++i) {
+ currentStartState = buildTerm(particle->term(), currentEndState);
+ currentEndState = currentStartState;
+ }
+
+ return currentStartState;
+}
+
+/*
+ * Create the FSA according to Algorithm Tt(S) from http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html
+ */
+XsdStateMachine<XsdTerm::Ptr>::StateId XsdStateMachineBuilder::buildTerm(const XsdTerm::Ptr &term, XsdStateMachine<XsdTerm::Ptr>::StateId endState)
+{
+ if (term->isWildcard()) { // 1
+ const XsdStateMachine<XsdTerm::Ptr>::StateId b = m_stateMachine->addState(XsdStateMachine<XsdTerm::Ptr>::InternalState);
+ m_stateMachine->addTransition(b, term, endState);
+ return b;
+ } else if (term->isElement()) { // 2
+ const XsdStateMachine<XsdTerm::Ptr>::StateId b = m_stateMachine->addState(XsdStateMachine<XsdTerm::Ptr>::InternalState);
+ m_stateMachine->addTransition(b, term, endState);
+
+ const XsdElement::Ptr element(term);
+ if (m_mode == CheckingMode) {
+ const XsdElement::List substGroups = element->substitutionGroups();
+ for (int i = 0; i < substGroups.count(); ++i)
+ m_stateMachine->addTransition(b, substGroups.at(i), endState);
+ } else if (m_mode == ValidatingMode) {
+ const XsdElement::List substGroups = element->substitutionGroups();
+ for (int i = 0; i < substGroups.count(); ++i) {
+ if (XsdSchemaHelper::substitutionGroupOkTransitive(element, substGroups.at(i), m_namePool))
+ m_stateMachine->addTransition(b, substGroups.at(i), endState);
+ }
+ }
+
+ return b;
+ } else if (term->isModelGroup()) {
+ const XsdModelGroup::Ptr group(term);
+
+ if (group->compositor() == XsdModelGroup::ChoiceCompositor) { // 3
+ const XsdStateMachine<XsdTerm::Ptr>::StateId b = m_stateMachine->addState(XsdStateMachine<XsdTerm::Ptr>::InternalState);
+
+ for (int i = 0; i < group->particles().count(); ++i) {
+ const XsdParticle::Ptr particle(group->particles().at(i));
+ if (particle->maximumOccurs() != 0) {
+ const XsdStateMachine<XsdTerm::Ptr>::StateId state = buildParticle(particle, endState);
+ m_stateMachine->addEpsilonTransition(b, state);
+ }
+ }
+
+ return b;
+ } else if (group->compositor() == XsdModelGroup::SequenceCompositor) { // 4
+ XsdStateMachine<XsdTerm::Ptr>::StateId currentStartState = endState;
+ XsdStateMachine<XsdTerm::Ptr>::StateId currentEndState = endState;
+
+ for (int i = (group->particles().count() - 1); i >= 0; --i) { // iterate reverse
+ const XsdParticle::Ptr particle(group->particles().at(i));
+ if (particle->maximumOccurs() != 0) {
+ currentStartState = buildParticle(particle, currentEndState);
+ currentEndState = currentStartState;
+ }
+ }
+
+ return currentStartState;
+ } else if (group->compositor() == XsdModelGroup::AllCompositor) {
+ const XsdStateMachine<XsdTerm::Ptr>::StateId newStartState = m_stateMachine->addState(XsdStateMachine<XsdTerm::Ptr>::InternalState);
+
+ const QList<XsdParticle::List> list = allCombinations(group->particles());
+
+ for (int i = 0; i < list.count(); ++i) {
+ XsdStateMachine<XsdTerm::Ptr>::StateId currentStartState = endState;
+ XsdStateMachine<XsdTerm::Ptr>::StateId currentEndState = endState;
+
+ const XsdParticle::List particles = list.at(i);
+ for (int j = (particles.count() - 1); j >= 0; --j) { // iterate reverse
+ const XsdParticle::Ptr particle(particles.at(j));
+ if (particle->maximumOccurs() != 0) {
+ currentStartState = buildParticle(particle, currentEndState);
+ currentEndState = currentStartState;
+ }
+ }
+ m_stateMachine->addEpsilonTransition(newStartState, currentStartState);
+ }
+
+ if (list.isEmpty())
+ return endState;
+ else
+ return newStartState;
+ }
+ }
+
+ Q_ASSERT(false);
+ return 0;
+}
+
+static void internalParticleLookupMap(const XsdParticle::Ptr &particle, QHash<XsdTerm::Ptr, XsdParticle::Ptr> &hash)
+{
+ hash.insert(particle->term(), particle);
+
+ if (particle->term()->isModelGroup()) {
+ const XsdModelGroup::Ptr group(particle->term());
+ const XsdParticle::List particles = group->particles();
+ for (int i = 0; i < particles.count(); ++i)
+ internalParticleLookupMap(particles.at(i), hash);
+ }
+}
+
+QHash<XsdTerm::Ptr, XsdParticle::Ptr> XsdStateMachineBuilder::particleLookupMap(const XsdParticle::Ptr &particle)
+{
+ QHash<XsdTerm::Ptr, XsdParticle::Ptr> result;
+ internalParticleLookupMap(particle, result);
+
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h b/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h
new file mode 100644