Changeset 225430 in webkit
- Timestamp:
- Dec 1, 2017 4:20:57 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 18 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r225427 r225430 1 2017-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 1 16 2017-12-01 Youenn Fablet <youenn@apple.com> 2 17 -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r225363 r225430 83 83 9BC70F05176C379D00101DEC /* AtomicStringTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC70F04176C379D00101DEC /* AtomicStringTable.cpp */; }; 84 84 A3B725EC987446AD93F1A440 /* RandomDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8F597CA2A57417FBAB92FD6 /* RandomDevice.cpp */; }; 85 A3CABA081FD095110007A4DE /* DateComponents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3CABA061FD095110007A4DE /* DateComponents.cpp */; }; 85 86 A3E4DD931F3A803400DED0B4 /* TextStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3E4DD911F3A803400DED0B4 /* TextStream.cpp */; }; 86 87 A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F2182433A900A82E69 /* StringMac.mm */; }; … … 388 389 A30D412D1F0DE13F00B71954 /* SoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoftLinking.h; sourceTree = "<group>"; }; 389 390 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>"; }; 390 393 A3E4DD911F3A803400DED0B4 /* TextStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextStream.cpp; sourceTree = "<group>"; }; 391 394 A3E4DD921F3A803400DED0B4 /* TextStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextStream.h; sourceTree = "<group>"; }; … … 810 813 A8A47277151A825A004123FF /* DataLog.cpp */, 811 814 A8A47278151A825A004123FF /* DataLog.h */, 815 A3CABA061FD095110007A4DE /* DateComponents.cpp */, 816 A3CABA071FD095110007A4DE /* DateComponents.h */, 812 817 A8A47279151A825A004123FF /* DateMath.cpp */, 813 818 A8A4727A151A825A004123FF /* DateMath.h */, … … 1387 1392 A8A4739C151A825B004123FF /* CurrentTime.cpp in Sources */, 1388 1393 A8A4739E151A825B004123FF /* DataLog.cpp in Sources */, 1394 A3CABA081FD095110007A4DE /* DateComponents.cpp in Sources */, 1389 1395 A8A473A0151A825B004123FF /* DateMath.cpp in Sources */, 1390 1396 A8A473A2151A825B004123FF /* DecimalNumber.cpp in Sources */, -
trunk/Source/WTF/wtf/CMakeLists.txt
r225363 r225430 224 224 CurrentTime.cpp 225 225 DataLog.cpp 226 DateComponents.cpp 226 227 DateMath.cpp 227 228 DecimalNumber.cpp -
trunk/Source/WTF/wtf/DateComponents.cpp
r225429 r225430 38 38 #include <wtf/text/WTFString.h> 39 39 40 namespace W ebCore{40 namespace WTF { 41 41 42 42 // HTML5 specification defines minimum week of year is one. … … 51 51 52 52 static 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 }64 53 65 54 // 'month' is 0-based. … … 196 185 day = 1; 197 186 ++month; 198 if (month >= 12) { // month is 0-origin. 187 // month is 0-origin. 188 if (month >= 12) { 199 189 month = 0; 200 190 ++year; … … 726 716 } 727 717 728 } // namespace W ebCore718 } // namespace WTF -
trunk/Source/WTF/wtf/DateComponents.h
r225429 r225430 29 29 */ 30 30 31 #ifndef DateComponents_h 32 #define DateComponents_h 31 #pragma once 33 32 34 33 #include <limits> … … 36 35 #include <wtf/Forward.h> 37 36 38 namespace W ebCore{37 namespace WTF { 39 38 40 39 // A DateComponents instance represents one of the following date and time combinations: … … 87 86 // Returns an ISO 8601 representation for this instance. 88 87 // 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; 90 89 91 90 // parse*() and setMillisecondsSince*() functions are initializers for an … … 103 102 104 103 // 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); 106 105 // 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); 108 107 // 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); 110 109 // 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); 112 111 // 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); 114 113 // 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); 116 115 117 116 // The following setMillisecondsSinceEpochFor*() functions take … … 122 121 123 122 // For Date type. Updates m_year, m_month and m_monthDay. 124 bool setMillisecondsSinceEpochForDate(double ms);123 WTF_EXPORT_PRIVATE bool setMillisecondsSinceEpochForDate(double); 125 124 // 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); 127 126 // 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); 129 128 // For Month type. Updates m_year and m_month. 130 bool setMillisecondsSinceEpochForMonth(double ms);129 WTF_EXPORT_PRIVATE bool setMillisecondsSinceEpochForMonth(double); 131 130 // For Week type. Updates m_year and m_week. 132 bool setMillisecondsSinceEpochForWeek(double ms);131 WTF_EXPORT_PRIVATE bool setMillisecondsSinceEpochForWeek(double); 133 132 134 133 // 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); 136 135 137 136 // Another initializer for Month type. Updates m_year and m_month. 138 bool setMonthsSinceEpoch(double months);137 WTF_EXPORT_PRIVATE bool setMonthsSinceEpoch(double); 139 138 140 139 // Returns the number of milliseconds from 1970-01-01 00:00:00 UTC. 141 140 // For a DateComponents initialized with parseDateTimeLocal(), 142 141 // millisecondsSinceEpoch() returns a value for UTC timezone. 143 double millisecondsSinceEpoch() const;142 WTF_EXPORT_PRIVATE double millisecondsSinceEpoch() const; 144 143 // Returns the number of months from 1970-01. 145 144 // Do not call this for types other than Month. 146 double monthsSinceEpoch() const;145 WTF_EXPORT_PRIVATE double monthsSinceEpoch() const; 147 146 static inline double invalidMilliseconds() { return std::numeric_limits<double>::quiet_NaN(); } 148 147 … … 180 179 double millisecondsSinceEpochForTime() const; 181 180 // Helpers for setMillisecondsSinceEpochFor*(). 182 bool setMillisecondsSinceEpochForDateInternal(double ms);183 void setMillisecondsSinceMidnightInternal(double ms);181 bool setMillisecondsSinceEpochForDateInternal(double); 182 void setMillisecondsSinceMidnightInternal(double); 184 183 // Helper for toString(). 185 184 String toStringForTime(SecondFormat) const; … … 209 208 210 209 211 } // namespace W ebCore212 213 #endif // DateComponents_h 210 } // namespace WTF 211 212 using WTF::DateComponents; -
trunk/Source/WebCore/ChangeLog
r225429 r225430 1 2017-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 1 28 2017-12-01 Daniel Bates <dabates@apple.com> 2 29 -
trunk/Source/WebCore/Sources.txt
r225428 r225430 1387 1387 platform/ContextMenuItem.cpp 1388 1388 platform/Cursor.cpp 1389 platform/DateComponents.cpp1390 1389 platform/Decimal.cpp 1391 1390 platform/DragData.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r225428 r225430 2835 2835 A554B5F31E38393A001D4E03 /* PerformanceUserTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = A554B5F11E383936001D4E03 /* PerformanceUserTiming.h */; }; 2836 2836 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, ); }; };2838 2837 A578F4351DE00EEB003DFC6A /* PromiseRejectionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A578F4331DE00ED6003DFC6A /* PromiseRejectionEvent.h */; }; 2839 2838 A578F43C1DE01423003DFC6A /* JSPromiseRejectionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A578F43A1DE013FB003DFC6A /* JSPromiseRejectionEvent.h */; }; … … 10715 10714 A55639CF1C6EFD5900806D8E /* WorkerConsoleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerConsoleClient.cpp; sourceTree = "<group>"; }; 10716 10715 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>"; };10719 10716 A578F4321DE00ED6003DFC6A /* PromiseRejectionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PromiseRejectionEvent.cpp; sourceTree = "<group>"; }; 10720 10717 A578F4331DE00ED6003DFC6A /* PromiseRejectionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PromiseRejectionEvent.h; sourceTree = "<group>"; }; … … 23459 23456 E11AF15011B9A1A300805103 /* Cursor.cpp */, 23460 23457 F587868402DE3B8601EA4122 /* Cursor.h */, 23461 A5732B08136A161D005C8D7C /* DateComponents.cpp */,23462 A5732B09136A161D005C8D7C /* DateComponents.h */,23463 23458 37C738F11EDBDE87003F2B0B /* DateTimeChooser.h */, 23464 23459 37C738F21EDBDE87003F2B0B /* DateTimeChooserClient.h */, … … 26559 26554 E4A007831B820EC8002C5A6E /* DataURLDecoder.h in Headers */, 26560 26555 E4A007831B820EC8002C5A6E /* DataURLDecoder.h in Headers */, 26561 A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */,26562 26556 F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */, 26563 26557 37C738F31EDBDE8A003F2B0B /* DateTimeChooser.h in Headers */, -
trunk/Source/WebCore/dom/Document.cpp
r225251 r225430 54 54 #include "DOMImplementation.h" 55 55 #include "DOMWindow.h" 56 #include "DateComponents.h"57 56 #include "DebugPageOverlays.h" 58 57 #include "DocumentLoader.h" -
trunk/Source/WebCore/html/BaseDateAndTimeInputType.h
r208096 r225430 34 34 #if ENABLE(DATE_AND_TIME_INPUT_TYPES) 35 35 36 #include "DateComponents.h"37 36 #include "InputType.h" 37 #include <wtf/DateComponents.h> 38 38 39 39 namespace WebCore { -
trunk/Source/WebCore/html/DateTimeInputType.h
r208179 r225430 40 40 class DateTimeInputType final : public BaseChooserOnlyDateAndTimeInputType { 41 41 public: 42 explicit DateTimeInputType(HTMLInputElement& element) : BaseDateTimeInputType(element) { } 42 explicit DateTimeInputType(HTMLInputElement& element) 43 : BaseChooserOnlyDateAndTimeInputType(element) { } 43 44 44 45 private: -
trunk/Source/WebCore/html/HTMLInputElement.h
r225223 r225430 31 31 32 32 #if PLATFORM(IOS) 33 #include "DateComponents.h"33 #include <wtf/DateComponents.h> 34 34 #endif 35 35 -
trunk/Source/WebCore/html/InputType.cpp
r225037 r225430 35 35 #include "ColorInputType.h" 36 36 #include "DOMFormData.h" 37 #include "DateComponents.h"38 37 #include "DateInputType.h" 39 38 #include "DateTimeInputType.h" … … 76 75 #include <limits> 77 76 #include <wtf/Assertions.h> 77 #include <wtf/DateComponents.h> 78 78 #include <wtf/HashMap.h> 79 79 #include <wtf/text/StringHash.h> -
trunk/Source/WebCore/html/InputType.h
r225223 r225430 36 36 #include "RenderPtr.h" 37 37 #include "StepRange.h" 38 #include <wtf/DateComponents.h> 38 39 #include <wtf/FastMalloc.h> 39 40 #include <wtf/Forward.h> 40 41 #include <wtf/RefPtr.h> 41 42 42 #if PLATFORM(IOS)43 #include "DateComponents.h"44 #endif45 46 43 namespace WebCore { 47 44 … … 49 46 class Chrome; 50 47 class DOMFormData; 51 class DateComponents;52 48 class DragData; 53 49 class Event; -
trunk/Source/WebCore/platform/text/PlatformLocale.h
r221768 r225430 24 24 */ 25 25 26 #ifndef PlatformLocale_h 27 #define PlatformLocale_h 26 #pragma once 28 27 29 #include "DateComponents.h"28 #include <wtf/DateComponents.h> 30 29 #include <wtf/Language.h> 31 30 #include <wtf/text/WTFString.h> … … 156 155 157 156 } 158 #endif -
trunk/Source/WebCore/platform/text/ios/LocalizedDateCache.h
r223728 r225430 29 29 #if PLATFORM(IOS) 30 30 31 #include "DateComponents.h"32 31 #include "FontCascade.h" 32 #include <wtf/DateComponents.h> 33 33 #include <wtf/HashMap.h> 34 34 #include <wtf/RetainPtr.h> -
trunk/Source/WebCore/platform/text/mac/LocaleMac.h
r197563 r225430 29 29 */ 30 30 31 #ifndef LocaleMac_h 32 #define LocaleMac_h 31 #pragma once 33 32 34 33 #include "PlatformLocale.h" … … 42 41 OBJC_CLASS NSLocale; 43 42 43 namespace WTF { 44 class DateComponents; 45 } 46 44 47 namespace WebCore { 45 46 class DateComponents;47 48 48 49 class LocaleMac : public Locale { … … 99 100 100 101 } // namespace WebCore 101 #endif -
trunk/Source/WebCore/platform/text/win/LocaleWin.cpp
r223728 r225430 32 32 #include "LocaleWin.h" 33 33 34 #include "DateComponents.h"35 34 #include "DateTimeFormat.h" 36 35 #include "LocalizedStrings.h" -
trunk/Source/WebCore/platform/text/win/LocaleWin.h
r197563 r225430 29 29 */ 30 30 31 #ifndef LocaleWin_h 32 #define LocaleWin_h 31 #pragma once 33 32 34 33 #include "PlatformLocale.h" … … 40 39 namespace WebCore { 41 40 42 class DateComponents;43 41 struct DateFormatToken; 44 42 … … 89 87 90 88 } // namespace WebCore 91 #endif -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r225036 r225430 33 33 #import "CSSToLengthConversionData.h" 34 34 #import "CSSValueKeywords.h" 35 #import "DateComponents.h"36 35 #import "Document.h" 37 36 #import "File.h" … … 71 70 #import <pal/spi/cocoa/CoreTextSPI.h> 72 71 #import <pal/spi/ios/UIKitSPI.h> 72 #import <wtf/DateComponents.h> 73 73 #import <wtf/NeverDestroyed.h> 74 74 #import <wtf/RefPtr.h>
Note: See TracChangeset
for help on using the changeset viewer.