Changeset 225430 in webkit


Ignore:
Timestamp:
Dec 1, 2017 4:20:57 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Move DateComponents into WTF
https://bugs.webkit.org/show_bug.cgi?id=180211

Patch by Christopher Reid <chris.reid@sony.com> on 2017-12-01
Reviewed by Myles C. Maxfield.

Source/WebCore:

No new tests no change in behavior.

Moved DateComponents from platform into WTF.

  • Sources.txt: Removed DateComponents
  • WebCore.xcodeproj/project.pbxproj: Removed DateComponents
  • dom/Document.cpp:
  • html/BaseDateAndTimeInputType.h:
  • html/DateTimeInputType.h: Fixed a call to the wrong parent constructor
  • html/HTMLInputElement.h:
  • html/InputType.cpp:
  • html/InputType.h:
  • platform/text/PlatformLocale.cpp:
  • platform/text/PlatformLocale.h:
  • platform/text/ios/LocalizedDateCache.h:
  • platform/text/mac/LocaleMac.h:
  • platform/text/win/LocaleWin.cpp:
  • platform/text/win/LocaleWin.h:
  • rendering/RenderThemeIOS.mm:

Source/WTF:

Moved DateComponents from WebCore/platform into WTF.
Removed isLeapYear from DateComponents as DateMath already has that function.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/CMakeLists.txt:
  • wtf/DateComponents.cpp: Renamed from Source\WebCore\platform\DateComponents.cpp.
  • wtf/DateComponents.h: Renamed from Source\WebCore\platform\DateComponents.h.
Location:
trunk/Source
Files:
18 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r225427 r225430  
     12017-12-01  Christopher Reid  <chris.reid@sony.com>
     2
     3        Move DateComponents into WTF
     4        https://bugs.webkit.org/show_bug.cgi?id=180211
     5
     6        Reviewed by Myles C. Maxfield.
     7
     8        Moved DateComponents from WebCore/platform into WTF.
     9        Removed isLeapYear from DateComponents as DateMath already has that function.
     10
     11        * WTF.xcodeproj/project.pbxproj:
     12        * wtf/CMakeLists.txt:
     13        * wtf/DateComponents.cpp: Renamed from Source\WebCore\platform\DateComponents.cpp.
     14        * wtf/DateComponents.h: Renamed from Source\WebCore\platform\DateComponents.h.
     15
    1162017-12-01  Youenn Fablet  <youenn@apple.com>
    217
  • trunk/Source/WTF/WTF.xcodeproj/project.pbxproj

    r225363 r225430  
    8383                9BC70F05176C379D00101DEC /* AtomicStringTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC70F04176C379D00101DEC /* AtomicStringTable.cpp */; };
    8484                A3B725EC987446AD93F1A440 /* RandomDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8F597CA2A57417FBAB92FD6 /* RandomDevice.cpp */; };
     85                A3CABA081FD095110007A4DE /* DateComponents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3CABA061FD095110007A4DE /* DateComponents.cpp */; };
    8586                A3E4DD931F3A803400DED0B4 /* TextStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3E4DD911F3A803400DED0B4 /* TextStream.cpp */; };
    8687                A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F2182433A900A82E69 /* StringMac.mm */; };
     
    388389                A30D412D1F0DE13F00B71954 /* SoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoftLinking.h; sourceTree = "<group>"; };
    389390                A3AB6E6A1F3E1AD6009C14B1 /* ValueToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueToString.h; sourceTree = "<group>"; };
     391                A3CABA061FD095110007A4DE /* DateComponents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateComponents.cpp; sourceTree = "<group>"; };
     392                A3CABA071FD095110007A4DE /* DateComponents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateComponents.h; sourceTree = "<group>"; };
    390393                A3E4DD911F3A803400DED0B4 /* TextStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextStream.cpp; sourceTree = "<group>"; };
    391394                A3E4DD921F3A803400DED0B4 /* TextStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextStream.h; sourceTree = "<group>"; };
     
    810813                                A8A47277151A825A004123FF /* DataLog.cpp */,
    811814                                A8A47278151A825A004123FF /* DataLog.h */,
     815                                A3CABA061FD095110007A4DE /* DateComponents.cpp */,
     816                                A3CABA071FD095110007A4DE /* DateComponents.h */,
    812817                                A8A47279151A825A004123FF /* DateMath.cpp */,
    813818                                A8A4727A151A825A004123FF /* DateMath.h */,
     
    13871392                                A8A4739C151A825B004123FF /* CurrentTime.cpp in Sources */,
    13881393                                A8A4739E151A825B004123FF /* DataLog.cpp in Sources */,
     1394                                A3CABA081FD095110007A4DE /* DateComponents.cpp in Sources */,
    13891395                                A8A473A0151A825B004123FF /* DateMath.cpp in Sources */,
    13901396                                A8A473A2151A825B004123FF /* DecimalNumber.cpp in Sources */,
  • trunk/Source/WTF/wtf/CMakeLists.txt

    r225363 r225430  
    224224    CurrentTime.cpp
    225225    DataLog.cpp
     226    DateComponents.cpp
    226227    DateMath.cpp
    227228    DecimalNumber.cpp
  • trunk/Source/WTF/wtf/DateComponents.cpp

    r225429 r225430  
    3838#include <wtf/text/WTFString.h>
    3939
    40 namespace WebCore {
     40namespace WTF {
    4141
    4242// HTML5 specification defines minimum week of year is one.
     
    5151
    5252static const int daysInMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    53 
    54 static bool isLeapYear(int year)
    55 {
    56     if (year % 4)
    57         return false;
    58     if (!(year % 400))
    59         return true;
    60     if (!(year % 100))
    61         return false;
    62     return true;
    63 }
    6453
    6554// 'month' is 0-based.
     
    196185                day = 1;
    197186                ++month;
    198                 if (month >= 12) { // month is 0-origin.
     187                // month is 0-origin.
     188                if (month >= 12) {
    199189                    month = 0;
    200190                    ++year;
     
    726716}
    727717
    728 } // namespace WebCore
     718} // namespace WTF
  • trunk/Source/WTF/wtf/DateComponents.h

    r225429 r225430  
    2929 */
    3030
    31 #ifndef DateComponents_h
    32 #define DateComponents_h
     31#pragma once
    3332
    3433#include <limits>
     
    3635#include <wtf/Forward.h>
    3736
    38 namespace WebCore {
     37namespace WTF {
    3938
    4039// A DateComponents instance represents one of the following date and time combinations:
     
    8786    // Returns an ISO 8601 representation for this instance.
    8887    // The format argument is valid for DateTime, DateTimeLocal, and Time types.
    89     String toString(SecondFormat format = None) const;
     88    WTF_EXPORT_PRIVATE String toString(SecondFormat = None) const;
    9089
    9190    // parse*() and setMillisecondsSince*() functions are initializers for an
     
    103102
    104103    // Sets year and month.
    105     bool parseMonth(const UChar* src, unsigned length, unsigned start, unsigned& end);
     104    WTF_EXPORT_PRIVATE bool parseMonth(const UChar* src, unsigned length, unsigned start, unsigned& end);
    106105    // Sets year, month and monthDay.
    107     bool parseDate(const UChar* src, unsigned length, unsigned start, unsigned& end);
     106    WTF_EXPORT_PRIVATE bool parseDate(const UChar* src, unsigned length, unsigned start, unsigned& end);
    108107    // Sets year and week.
    109     bool parseWeek(const UChar* src, unsigned length, unsigned start, unsigned& end);
     108    WTF_EXPORT_PRIVATE bool parseWeek(const UChar* src, unsigned length, unsigned start, unsigned& end);
    110109    // Sets hour, minute, second and millisecond.
    111     bool parseTime(const UChar* src, unsigned length, unsigned start, unsigned& end);
     110    WTF_EXPORT_PRIVATE bool parseTime(const UChar* src, unsigned length, unsigned start, unsigned& end);
    112111    // Sets year, month, monthDay, hour, minute, second and millisecond.
    113     bool parseDateTimeLocal(const UChar* src, unsigned length, unsigned start, unsigned& end);
     112    WTF_EXPORT_PRIVATE bool parseDateTimeLocal(const UChar* src, unsigned length, unsigned start, unsigned& end);
    114113    // Sets year, month, monthDay, hour, minute, second and millisecond, and adjusts timezone.
    115     bool parseDateTime(const UChar* src, unsigned length, unsigned start, unsigned& end);
     114    WTF_EXPORT_PRIVATE bool parseDateTime(const UChar* src, unsigned length, unsigned start, unsigned& end);
    116115
    117116    // The following setMillisecondsSinceEpochFor*() functions take
     
    122121
    123122    // For Date type. Updates m_year, m_month and m_monthDay.
    124     bool setMillisecondsSinceEpochForDate(double ms);
     123    WTF_EXPORT_PRIVATE bool setMillisecondsSinceEpochForDate(double);
    125124    // For DateTime type. Updates m_year, m_month, m_monthDay, m_hour, m_minute, m_second and m_millisecond.
    126     bool setMillisecondsSinceEpochForDateTime(double ms);
     125    WTF_EXPORT_PRIVATE bool setMillisecondsSinceEpochForDateTime(double);
    127126    // For DateTimeLocal type. Updates m_year, m_month, m_monthDay, m_hour, m_minute, m_second and m_millisecond.
    128     bool setMillisecondsSinceEpochForDateTimeLocal(double ms);
     127    WTF_EXPORT_PRIVATE bool setMillisecondsSinceEpochForDateTimeLocal(double);
    129128    // For Month type. Updates m_year and m_month.
    130     bool setMillisecondsSinceEpochForMonth(double ms);
     129    WTF_EXPORT_PRIVATE bool setMillisecondsSinceEpochForMonth(double);
    131130    // For Week type. Updates m_year and m_week.
    132     bool setMillisecondsSinceEpochForWeek(double ms);
     131    WTF_EXPORT_PRIVATE bool setMillisecondsSinceEpochForWeek(double);
    133132
    134133    // For Time type. Updates m_hour, m_minute, m_second and m_millisecond.
    135     bool setMillisecondsSinceMidnight(double ms);
     134    WTF_EXPORT_PRIVATE bool setMillisecondsSinceMidnight(double);
    136135
    137136    // Another initializer for Month type. Updates m_year and m_month.
    138     bool setMonthsSinceEpoch(double months);
     137    WTF_EXPORT_PRIVATE bool setMonthsSinceEpoch(double);
    139138
    140139    // Returns the number of milliseconds from 1970-01-01 00:00:00 UTC.
    141140    // For a DateComponents initialized with parseDateTimeLocal(),
    142141    // millisecondsSinceEpoch() returns a value for UTC timezone.
    143     double millisecondsSinceEpoch() const;
     142    WTF_EXPORT_PRIVATE double millisecondsSinceEpoch() const;
    144143    // Returns the number of months from 1970-01.
    145144    // Do not call this for types other than Month.
    146     double monthsSinceEpoch() const;
     145    WTF_EXPORT_PRIVATE double monthsSinceEpoch() const;
    147146    static inline double invalidMilliseconds() { return std::numeric_limits<double>::quiet_NaN(); }
    148147
     
    180179    double millisecondsSinceEpochForTime() const;
    181180    // Helpers for setMillisecondsSinceEpochFor*().
    182     bool setMillisecondsSinceEpochForDateInternal(double ms);
    183     void setMillisecondsSinceMidnightInternal(double ms);
     181    bool setMillisecondsSinceEpochForDateInternal(double);
     182    void setMillisecondsSinceMidnightInternal(double);
    184183    // Helper for toString().
    185184    String toStringForTime(SecondFormat) const;
     
    209208
    210209
    211 } // namespace WebCore
    212 
    213 #endif // DateComponents_h
     210} // namespace WTF
     211
     212using WTF::DateComponents;
  • trunk/Source/WebCore/ChangeLog

    r225429 r225430  
     12017-12-01  Christopher Reid  <chris.reid@sony.com>
     2
     3        Move DateComponents into WTF
     4        https://bugs.webkit.org/show_bug.cgi?id=180211
     5
     6        Reviewed by Myles C. Maxfield.
     7
     8        No new tests no change in behavior.
     9
     10        Moved DateComponents from platform into WTF.
     11
     12        * Sources.txt: Removed DateComponents
     13        * WebCore.xcodeproj/project.pbxproj: Removed DateComponents
     14        * dom/Document.cpp:
     15        * html/BaseDateAndTimeInputType.h:
     16        * html/DateTimeInputType.h: Fixed a call to the wrong parent constructor
     17        * html/HTMLInputElement.h:
     18        * html/InputType.cpp:
     19        * html/InputType.h:
     20        * platform/text/PlatformLocale.cpp:
     21        * platform/text/PlatformLocale.h:
     22        * platform/text/ios/LocalizedDateCache.h:
     23        * platform/text/mac/LocaleMac.h:
     24        * platform/text/win/LocaleWin.cpp:
     25        * platform/text/win/LocaleWin.h:
     26        * rendering/RenderThemeIOS.mm:
     27
    1282017-12-01  Daniel Bates  <dabates@apple.com>
    229
  • trunk/Source/WebCore/Sources.txt

    r225428 r225430  
    13871387platform/ContextMenuItem.cpp
    13881388platform/Cursor.cpp
    1389 platform/DateComponents.cpp
    13901389platform/Decimal.cpp
    13911390platform/DragData.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r225428 r225430  
    28352835                A554B5F31E38393A001D4E03 /* PerformanceUserTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = A554B5F11E383936001D4E03 /* PerformanceUserTiming.h */; };
    28362836                A55639D11C6F09E300806D8E /* WorkerConsoleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A55639D01C6EFD5900806D8E /* WorkerConsoleClient.h */; };
    2837                 A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = A5732B09136A161D005C8D7C /* DateComponents.h */; settings = {ATTRIBUTES = (Private, ); }; };
    28382837                A578F4351DE00EEB003DFC6A /* PromiseRejectionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A578F4331DE00ED6003DFC6A /* PromiseRejectionEvent.h */; };
    28392838                A578F43C1DE01423003DFC6A /* JSPromiseRejectionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A578F43A1DE013FB003DFC6A /* JSPromiseRejectionEvent.h */; };
     
    1071510714                A55639CF1C6EFD5900806D8E /* WorkerConsoleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerConsoleClient.cpp; sourceTree = "<group>"; };
    1071610715                A55639D01C6EFD5900806D8E /* WorkerConsoleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerConsoleClient.h; sourceTree = "<group>"; };
    10717                 A5732B08136A161D005C8D7C /* DateComponents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateComponents.cpp; sourceTree = "<group>"; };
    10718                 A5732B09136A161D005C8D7C /* DateComponents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateComponents.h; sourceTree = "<group>"; };
    1071910716                A578F4321DE00ED6003DFC6A /* PromiseRejectionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PromiseRejectionEvent.cpp; sourceTree = "<group>"; };
    1072010717                A578F4331DE00ED6003DFC6A /* PromiseRejectionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PromiseRejectionEvent.h; sourceTree = "<group>"; };
     
    2345923456                                E11AF15011B9A1A300805103 /* Cursor.cpp */,
    2346023457                                F587868402DE3B8601EA4122 /* Cursor.h */,
    23461                                 A5732B08136A161D005C8D7C /* DateComponents.cpp */,
    23462                                 A5732B09136A161D005C8D7C /* DateComponents.h */,
    2346323458                                37C738F11EDBDE87003F2B0B /* DateTimeChooser.h */,
    2346423459                                37C738F21EDBDE87003F2B0B /* DateTimeChooserClient.h */,
     
    2655926554                                E4A007831B820EC8002C5A6E /* DataURLDecoder.h in Headers */,
    2656026555                                E4A007831B820EC8002C5A6E /* DataURLDecoder.h in Headers */,
    26561                                 A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */,
    2656226556                                F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */,
    2656326557                                37C738F31EDBDE8A003F2B0B /* DateTimeChooser.h in Headers */,
  • trunk/Source/WebCore/dom/Document.cpp

    r225251 r225430  
    5454#include "DOMImplementation.h"
    5555#include "DOMWindow.h"
    56 #include "DateComponents.h"
    5756#include "DebugPageOverlays.h"
    5857#include "DocumentLoader.h"
  • trunk/Source/WebCore/html/BaseDateAndTimeInputType.h

    r208096 r225430  
    3434#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
    3535
    36 #include "DateComponents.h"
    3736#include "InputType.h"
     37#include <wtf/DateComponents.h>
    3838
    3939namespace WebCore {
  • trunk/Source/WebCore/html/DateTimeInputType.h

    r208179 r225430  
    4040class DateTimeInputType final : public BaseChooserOnlyDateAndTimeInputType {
    4141public:
    42     explicit DateTimeInputType(HTMLInputElement& element) : BaseDateTimeInputType(element) { }
     42    explicit DateTimeInputType(HTMLInputElement& element)
     43        : BaseChooserOnlyDateAndTimeInputType(element) { }
    4344
    4445private:
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r225223 r225430  
    3131
    3232#if PLATFORM(IOS)
    33 #include "DateComponents.h"
     33#include <wtf/DateComponents.h>
    3434#endif
    3535
  • trunk/Source/WebCore/html/InputType.cpp

    r225037 r225430  
    3535#include "ColorInputType.h"
    3636#include "DOMFormData.h"
    37 #include "DateComponents.h"
    3837#include "DateInputType.h"
    3938#include "DateTimeInputType.h"
     
    7675#include <limits>
    7776#include <wtf/Assertions.h>
     77#include <wtf/DateComponents.h>
    7878#include <wtf/HashMap.h>
    7979#include <wtf/text/StringHash.h>
  • trunk/Source/WebCore/html/InputType.h

    r225223 r225430  
    3636#include "RenderPtr.h"
    3737#include "StepRange.h"
     38#include <wtf/DateComponents.h>
    3839#include <wtf/FastMalloc.h>
    3940#include <wtf/Forward.h>
    4041#include <wtf/RefPtr.h>
    4142
    42 #if PLATFORM(IOS)
    43 #include "DateComponents.h"
    44 #endif
    45 
    4643namespace WebCore {
    4744
     
    4946class Chrome;
    5047class DOMFormData;
    51 class DateComponents;
    5248class DragData;
    5349class Event;
  • trunk/Source/WebCore/platform/text/PlatformLocale.h

    r221768 r225430  
    2424 */
    2525
    26 #ifndef PlatformLocale_h
    27 #define PlatformLocale_h
     26#pragma once
    2827
    29 #include "DateComponents.h"
     28#include <wtf/DateComponents.h>
    3029#include <wtf/Language.h>
    3130#include <wtf/text/WTFString.h>
     
    156155
    157156}
    158 #endif
  • trunk/Source/WebCore/platform/text/ios/LocalizedDateCache.h

    r223728 r225430  
    2929#if PLATFORM(IOS)
    3030
    31 #include "DateComponents.h"
    3231#include "FontCascade.h"
     32#include <wtf/DateComponents.h>
    3333#include <wtf/HashMap.h>
    3434#include <wtf/RetainPtr.h>
  • trunk/Source/WebCore/platform/text/mac/LocaleMac.h

    r197563 r225430  
    2929 */
    3030
    31 #ifndef LocaleMac_h
    32 #define LocaleMac_h
     31#pragma once
    3332
    3433#include "PlatformLocale.h"
     
    4241OBJC_CLASS NSLocale;
    4342
     43namespace WTF {
     44class DateComponents;
     45}
     46
    4447namespace WebCore {
    45 
    46 class DateComponents;
    4748
    4849class LocaleMac : public Locale {
     
    99100
    100101} // namespace WebCore
    101 #endif
  • trunk/Source/WebCore/platform/text/win/LocaleWin.cpp

    r223728 r225430  
    3232#include "LocaleWin.h"
    3333
    34 #include "DateComponents.h"
    3534#include "DateTimeFormat.h"
    3635#include "LocalizedStrings.h"
  • trunk/Source/WebCore/platform/text/win/LocaleWin.h

    r197563 r225430  
    2929 */
    3030
    31 #ifndef LocaleWin_h
    32 #define LocaleWin_h
     31#pragma once
    3332
    3433#include "PlatformLocale.h"
     
    4039namespace WebCore {
    4140
    42 class DateComponents;
    4341struct DateFormatToken;
    4442
     
    8987
    9088} // namespace WebCore
    91 #endif
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r225036 r225430  
    3333#import "CSSToLengthConversionData.h"
    3434#import "CSSValueKeywords.h"
    35 #import "DateComponents.h"
    3635#import "Document.h"
    3736#import "File.h"
     
    7170#import <pal/spi/cocoa/CoreTextSPI.h>
    7271#import <pal/spi/ios/UIKitSPI.h>
     72#import <wtf/DateComponents.h>
    7373#import <wtf/NeverDestroyed.h>
    7474#import <wtf/RefPtr.h>
Note: See TracChangeset for help on using the changeset viewer.