bool WebSharedWorkerImpl::isStarted() { // Should not ever be called from the worker thread (this API is only called on WebSharedWorkerProxy on the renderer thread). ASSERT_NOT_REACHED(); return workerThread(); }
// FIXME : This mapping should be autogenerated. This function should // be moved to a separate file and a script run at build time // to detect new values in CSSPropertyID and add them to the // end of this function. This file would be checked in. // https://code.google.com/p/chromium/issues/detail?id=234940 int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id) { CSSPropertyID cssPropertyID = static_cast<CSSPropertyID>(id); switch (cssPropertyID) { // Begin at 2, because 1 is reserved for totalPagesMeasuredCSSSampleId. case CSSPropertyColor: return 2; case CSSPropertyDirection: return 3; case CSSPropertyDisplay: return 4; case CSSPropertyFont: return 5; case CSSPropertyFontFamily: return 6; case CSSPropertyFontSize: return 7; case CSSPropertyFontStyle: return 8; case CSSPropertyFontVariant: return 9; case CSSPropertyFontWeight: return 10; case CSSPropertyTextRendering: return 11; case CSSPropertyAliasWebkitFontFeatureSettings: return 12; case CSSPropertyFontKerning: return 13; case CSSPropertyWebkitFontSmoothing: return 14; case CSSPropertyFontVariantLigatures: return 15; case CSSPropertyWebkitLocale: return 16; case CSSPropertyWebkitTextOrientation: return 17; case CSSPropertyWebkitWritingMode: return 18; case CSSPropertyZoom: return 19; case CSSPropertyLineHeight: return 20; case CSSPropertyBackground: return 21; case CSSPropertyBackgroundAttachment: return 22; case CSSPropertyBackgroundClip: return 23; case CSSPropertyBackgroundColor: return 24; case CSSPropertyBackgroundImage: return 25; case CSSPropertyBackgroundOrigin: return 26; case CSSPropertyBackgroundPosition: return 27; case CSSPropertyBackgroundPositionX: return 28; case CSSPropertyBackgroundPositionY: return 29; case CSSPropertyBackgroundRepeat: return 30; case CSSPropertyBackgroundRepeatX: return 31; case CSSPropertyBackgroundRepeatY: return 32; case CSSPropertyBackgroundSize: return 33; case CSSPropertyBorder: return 34; case CSSPropertyBorderBottom: return 35; case CSSPropertyBorderBottomColor: return 36; case CSSPropertyBorderBottomLeftRadius: return 37; case CSSPropertyBorderBottomRightRadius: return 38; case CSSPropertyBorderBottomStyle: return 39; case CSSPropertyBorderBottomWidth: return 40; case CSSPropertyBorderCollapse: return 41; case CSSPropertyBorderColor: return 42; case CSSPropertyBorderImage: return 43; case CSSPropertyBorderImageOutset: return 44; case CSSPropertyBorderImageRepeat: return 45; case CSSPropertyBorderImageSlice: return 46; case CSSPropertyBorderImageSource: return 47; case CSSPropertyBorderImageWidth: return 48; case CSSPropertyBorderLeft: return 49; case CSSPropertyBorderLeftColor: return 50; case CSSPropertyBorderLeftStyle: return 51; case CSSPropertyBorderLeftWidth: return 52; case CSSPropertyBorderRadius: return 53; case CSSPropertyBorderRight: return 54; case CSSPropertyBorderRightColor: return 55; case CSSPropertyBorderRightStyle: return 56; case CSSPropertyBorderRightWidth: return 57; case CSSPropertyBorderSpacing: return 58; case CSSPropertyBorderStyle: return 59; case CSSPropertyBorderTop: return 60; case CSSPropertyBorderTopColor: return 61; case CSSPropertyBorderTopLeftRadius: return 62; case CSSPropertyBorderTopRightRadius: return 63; case CSSPropertyBorderTopStyle: return 64; case CSSPropertyBorderTopWidth: return 65; case CSSPropertyBorderWidth: return 66; case CSSPropertyBottom: return 67; case CSSPropertyBoxShadow: return 68; case CSSPropertyBoxSizing: return 69; case CSSPropertyCaptionSide: return 70; case CSSPropertyClear: return 71; case CSSPropertyClip: return 72; case CSSPropertyWebkitClipPath: return 73; case CSSPropertyContent: return 74; case CSSPropertyCounterIncrement: return 75; case CSSPropertyCounterReset: return 76; case CSSPropertyCursor: return 77; case CSSPropertyEmptyCells: return 78; case CSSPropertyFloat: return 79; case CSSPropertyFontStretch: return 80; case CSSPropertyHeight: return 81; case CSSPropertyImageRendering: return 82; case CSSPropertyLeft: return 83; case CSSPropertyLetterSpacing: return 84; case CSSPropertyListStyle: return 85; case CSSPropertyListStyleImage: return 86; case CSSPropertyListStylePosition: return 87; case CSSPropertyListStyleType: return 88; case CSSPropertyMargin: return 89; case CSSPropertyMarginBottom: return 90; case CSSPropertyMarginLeft: return 91; case CSSPropertyMarginRight: return 92; case CSSPropertyMarginTop: return 93; case CSSPropertyMaxHeight: return 94; case CSSPropertyMaxWidth: return 95; case CSSPropertyMinHeight: return 96; case CSSPropertyMinWidth: return 97; case CSSPropertyOpacity: return 98; case CSSPropertyOrphans: return 99; case CSSPropertyOutline: return 100; case CSSPropertyOutlineColor: return 101; case CSSPropertyOutlineOffset: return 102; case CSSPropertyOutlineStyle: return 103; case CSSPropertyOutlineWidth: return 104; case CSSPropertyOverflow: return 105; case CSSPropertyOverflowWrap: return 106; case CSSPropertyOverflowX: return 107; case CSSPropertyOverflowY: return 108; case CSSPropertyPadding: return 109; case CSSPropertyPaddingBottom: return 110; case CSSPropertyPaddingLeft: return 111; case CSSPropertyPaddingRight: return 112; case CSSPropertyPaddingTop: return 113; case CSSPropertyPage: return 114; case CSSPropertyPageBreakAfter: return 115; case CSSPropertyPageBreakBefore: return 116; case CSSPropertyPageBreakInside: return 117; case CSSPropertyPointerEvents: return 118; case CSSPropertyPosition: return 119; case CSSPropertyQuotes: return 120; case CSSPropertyResize: return 121; case CSSPropertyRight: return 122; case CSSPropertySize: return 123; case CSSPropertySrc: return 124; case CSSPropertySpeak: return 125; case CSSPropertyTableLayout: return 126; case CSSPropertyTabSize: return 127; case CSSPropertyTextAlign: return 128; case CSSPropertyTextDecoration: return 129; case CSSPropertyTextIndent: return 130; /* Removed CSSPropertyTextLineThrough* - 131-135 */ case CSSPropertyTextOverflow: return 136; /* Removed CSSPropertyTextOverline* - 137-141 */ case CSSPropertyTextShadow: return 142; case CSSPropertyTextTransform: return 143; /* Removed CSSPropertyTextUnderline* - 144-148 */ case CSSPropertyTop: return 149; case CSSPropertyTransition: return 150; case CSSPropertyTransitionDelay: return 151; case CSSPropertyTransitionDuration: return 152; case CSSPropertyTransitionProperty: return 153; case CSSPropertyTransitionTimingFunction: return 154; case CSSPropertyUnicodeBidi: return 155; case CSSPropertyUnicodeRange: return 156; case CSSPropertyVerticalAlign: return 157; case CSSPropertyVisibility: return 158; case CSSPropertyWhiteSpace: return 159; case CSSPropertyWidows: return 160; case CSSPropertyWidth: return 161; case CSSPropertyWordBreak: return 162; case CSSPropertyWordSpacing: return 163; case CSSPropertyWordWrap: return 164; case CSSPropertyZIndex: return 165; case CSSPropertyAliasWebkitAnimation: return 166; case CSSPropertyAliasWebkitAnimationDelay: return 167; case CSSPropertyAliasWebkitAnimationDirection: return 168; case CSSPropertyAliasWebkitAnimationDuration: return 169; case CSSPropertyAliasWebkitAnimationFillMode: return 170; case CSSPropertyAliasWebkitAnimationIterationCount: return 171; case CSSPropertyAliasWebkitAnimationName: return 172; case CSSPropertyAliasWebkitAnimationPlayState: return 173; case CSSPropertyAliasWebkitAnimationTimingFunction: return 174; case CSSPropertyWebkitAppearance: return 175; // CSSPropertyWebkitAspectRatio was 176 case CSSPropertyAliasWebkitBackfaceVisibility: return 177; case CSSPropertyWebkitBackgroundClip: return 178; case CSSPropertyWebkitBackgroundComposite: return 179; case CSSPropertyWebkitBackgroundOrigin: return 180; case CSSPropertyAliasWebkitBackgroundSize: return 181; case CSSPropertyWebkitBorderAfter: return 182; case CSSPropertyWebkitBorderAfterColor: return 183; case CSSPropertyWebkitBorderAfterStyle: return 184; case CSSPropertyWebkitBorderAfterWidth: return 185; case CSSPropertyWebkitBorderBefore: return 186; case CSSPropertyWebkitBorderBeforeColor: return 187; case CSSPropertyWebkitBorderBeforeStyle: return 188; case CSSPropertyWebkitBorderBeforeWidth: return 189; case CSSPropertyWebkitBorderEnd: return 190; case CSSPropertyWebkitBorderEndColor: return 191; case CSSPropertyWebkitBorderEndStyle: return 192; case CSSPropertyWebkitBorderEndWidth: return 193; // CSSPropertyWebkitBorderFit was 194 case CSSPropertyWebkitBorderHorizontalSpacing: return 195; case CSSPropertyWebkitBorderImage: return 196; case CSSPropertyAliasWebkitBorderRadius: return 197; case CSSPropertyWebkitBorderStart: return 198; case CSSPropertyWebkitBorderStartColor: return 199; case CSSPropertyWebkitBorderStartStyle: return 200; case CSSPropertyWebkitBorderStartWidth: return 201; case CSSPropertyWebkitBorderVerticalSpacing: return 202; case CSSPropertyWebkitBoxAlign: return 203; case CSSPropertyWebkitBoxDirection: return 204; case CSSPropertyWebkitBoxFlex: return 205; case CSSPropertyWebkitBoxFlexGroup: return 206; case CSSPropertyWebkitBoxLines: return 207; case CSSPropertyWebkitBoxOrdinalGroup: return 208; case CSSPropertyWebkitBoxOrient: return 209; case CSSPropertyWebkitBoxPack: return 210; case CSSPropertyWebkitBoxReflect: return 211; case CSSPropertyAliasWebkitBoxShadow: return 212; // CSSPropertyWebkitColumnAxis was 214 case CSSPropertyWebkitColumnBreakAfter: return 215; case CSSPropertyWebkitColumnBreakBefore: return 216; case CSSPropertyWebkitColumnBreakInside: return 217; case CSSPropertyWebkitColumnCount: return 218; case CSSPropertyWebkitColumnGap: return 219; // CSSPropertyWebkitColumnProgression was 220 case CSSPropertyWebkitColumnRule: return 221; case CSSPropertyWebkitColumnRuleColor: return 222; case CSSPropertyWebkitColumnRuleStyle: return 223; case CSSPropertyWebkitColumnRuleWidth: return 224; case CSSPropertyWebkitColumnSpan: return 225; case CSSPropertyWebkitColumnWidth: return 226; case CSSPropertyWebkitColumns: return 227; // 228 was CSSPropertyWebkitBoxDecorationBreak (duplicated due to #ifdef). // 229 was CSSPropertyWebkitFilter (duplicated due to #ifdef). case CSSPropertyAlignContent: return 230; case CSSPropertyAlignItems: return 231; case CSSPropertyAlignSelf: return 232; case CSSPropertyFlex: return 233; case CSSPropertyFlexBasis: return 234; case CSSPropertyFlexDirection: return 235; case CSSPropertyFlexFlow: return 236; case CSSPropertyFlexGrow: return 237; case CSSPropertyFlexShrink: return 238; case CSSPropertyFlexWrap: return 239; case CSSPropertyJustifyContent: return 240; case CSSPropertyWebkitFontSizeDelta: return 241; case CSSPropertyGridTemplateColumns: return 242; case CSSPropertyGridTemplateRows: return 243; case CSSPropertyGridColumnStart: return 244; case CSSPropertyGridColumnEnd: return 245; case CSSPropertyGridRowStart: return 246; case CSSPropertyGridRowEnd: return 247; case CSSPropertyGridColumn: return 248; case CSSPropertyGridRow: return 249; case CSSPropertyGridAutoFlow: return 250; case CSSPropertyWebkitHighlight: return 251; case CSSPropertyWebkitHyphenateCharacter: return 252; // case CSSPropertyWebkitLineBoxContain: return 257; // case CSSPropertyWebkitLineAlign: return 258; case CSSPropertyWebkitLineBreak: return 259; case CSSPropertyWebkitLineClamp: return 260; // case CSSPropertyWebkitLineGrid: return 261; // case CSSPropertyWebkitLineSnap: return 262; case CSSPropertyWebkitLogicalWidth: return 263; case CSSPropertyWebkitLogicalHeight: return 264; case CSSPropertyWebkitMarginAfterCollapse: return 265; case CSSPropertyWebkitMarginBeforeCollapse: return 266; case CSSPropertyWebkitMarginBottomCollapse: return 267; case CSSPropertyWebkitMarginTopCollapse: return 268; case CSSPropertyWebkitMarginCollapse: return 269; case CSSPropertyWebkitMarginAfter: return 270; case CSSPropertyWebkitMarginBefore: return 271; case CSSPropertyWebkitMarginEnd: return 272; case CSSPropertyWebkitMarginStart: return 273; // CSSPropertyWebkitMarquee was 274. // CSSPropertyInternalMarquee* were 275-279. case CSSPropertyWebkitMask: return 280; case CSSPropertyWebkitMaskBoxImage: return 281; case CSSPropertyWebkitMaskBoxImageOutset: return 282; case CSSPropertyWebkitMaskBoxImageRepeat: return 283; case CSSPropertyWebkitMaskBoxImageSlice: return 284; case CSSPropertyWebkitMaskBoxImageSource: return 285; case CSSPropertyWebkitMaskBoxImageWidth: return 286; case CSSPropertyWebkitMaskClip: return 287; case CSSPropertyWebkitMaskComposite: return 288; case CSSPropertyWebkitMaskImage: return 289; case CSSPropertyWebkitMaskOrigin: return 290; case CSSPropertyWebkitMaskPosition: return 291; case CSSPropertyWebkitMaskPositionX: return 292; case CSSPropertyWebkitMaskPositionY: return 293; case CSSPropertyWebkitMaskRepeat: return 294; case CSSPropertyWebkitMaskRepeatX: return 295; case CSSPropertyWebkitMaskRepeatY: return 296; case CSSPropertyWebkitMaskSize: return 297; case CSSPropertyWebkitMaxLogicalWidth: return 298; case CSSPropertyWebkitMaxLogicalHeight: return 299; case CSSPropertyWebkitMinLogicalWidth: return 300; case CSSPropertyWebkitMinLogicalHeight: return 301; // WebkitNbspMode has been deleted, was return 302; case CSSPropertyOrder: return 303; case CSSPropertyWebkitPaddingAfter: return 304; case CSSPropertyWebkitPaddingBefore: return 305; case CSSPropertyWebkitPaddingEnd: return 306; case CSSPropertyWebkitPaddingStart: return 307; case CSSPropertyAliasWebkitPerspective: return 308; case CSSPropertyAliasWebkitPerspectiveOrigin: return 309; case CSSPropertyWebkitPerspectiveOriginX: return 310; case CSSPropertyWebkitPerspectiveOriginY: return 311; case CSSPropertyWebkitPrintColorAdjust: return 312; case CSSPropertyWebkitRtlOrdering: return 313; case CSSPropertyWebkitRubyPosition: return 314; case CSSPropertyWebkitTextCombine: return 315; case CSSPropertyWebkitTextDecorationsInEffect: return 316; case CSSPropertyWebkitTextEmphasis: return 317; case CSSPropertyWebkitTextEmphasisColor: return 318; case CSSPropertyWebkitTextEmphasisPosition: return 319; case CSSPropertyWebkitTextEmphasisStyle: return 320; case CSSPropertyWebkitTextFillColor: return 321; case CSSPropertyWebkitTextSecurity: return 322; case CSSPropertyWebkitTextStroke: return 323; case CSSPropertyWebkitTextStrokeColor: return 324; case CSSPropertyWebkitTextStrokeWidth: return 325; case CSSPropertyAliasWebkitTransform: return 326; case CSSPropertyAliasWebkitTransformOrigin: return 327; case CSSPropertyWebkitTransformOriginX: return 328; case CSSPropertyWebkitTransformOriginY: return 329; case CSSPropertyWebkitTransformOriginZ: return 330; case CSSPropertyAliasWebkitTransformStyle: return 331; case CSSPropertyAliasWebkitTransition: return 332; case CSSPropertyAliasWebkitTransitionDelay: return 333; case CSSPropertyAliasWebkitTransitionDuration: return 334; case CSSPropertyAliasWebkitTransitionProperty: return 335; case CSSPropertyAliasWebkitTransitionTimingFunction: return 336; case CSSPropertyWebkitUserDrag: return 337; case CSSPropertyWebkitUserModify: return 338; case CSSPropertyWebkitUserSelect: return 339; // case CSSPropertyWebkitFlowInto: return 340; // case CSSPropertyWebkitFlowFrom: return 341; // case CSSPropertyWebkitRegionFragment: return 342; // case CSSPropertyWebkitRegionBreakAfter: return 343; // case CSSPropertyWebkitRegionBreakBefore: return 344; // case CSSPropertyWebkitRegionBreakInside: return 345; // case CSSPropertyShapeInside: return 346; case CSSPropertyShapeOutside: return 347; case CSSPropertyShapeMargin: return 348; // case CSSPropertyShapePadding: return 349; // case CSSPropertyWebkitWrapFlow: return 350; // case CSSPropertyWebkitWrapThrough: return 351; // CSSPropertyWebkitWrap was 352. // 353 was CSSPropertyWebkitTapHighlightColor (duplicated due to #ifdef). // 354 was CSSPropertyWebkitAppRegion (duplicated due to #ifdef). case CSSPropertyClipPath: return 355; case CSSPropertyClipRule: return 356; case CSSPropertyMask: return 357; // CSSPropertyEnableBackground has been removed, was return 358; case CSSPropertyFilter: return 359; case CSSPropertyFloodColor: return 360; case CSSPropertyFloodOpacity: return 361; case CSSPropertyLightingColor: return 362; case CSSPropertyStopColor: return 363; case CSSPropertyStopOpacity: return 364; case CSSPropertyColorInterpolation: return 365; case CSSPropertyColorInterpolationFilters: return 366; // case CSSPropertyColorProfile: return 367; case CSSPropertyColorRendering: return 368; case CSSPropertyFill: return 369; case CSSPropertyFillOpacity: return 370; case CSSPropertyFillRule: return 371; case CSSPropertyMarker: return 372; case CSSPropertyMarkerEnd: return 373; case CSSPropertyMarkerMid: return 374; case CSSPropertyMarkerStart: return 375; case CSSPropertyMaskType: return 376; case CSSPropertyShapeRendering: return 377; case CSSPropertyStroke: return 378; case CSSPropertyStrokeDasharray: return 379; case CSSPropertyStrokeDashoffset: return 380; case CSSPropertyStrokeLinecap: return 381; case CSSPropertyStrokeLinejoin: return 382; case CSSPropertyStrokeMiterlimit: return 383; case CSSPropertyStrokeOpacity: return 384; case CSSPropertyStrokeWidth: return 385; case CSSPropertyAlignmentBaseline: return 386; case CSSPropertyBaselineShift: return 387; case CSSPropertyDominantBaseline: return 388; // CSSPropertyGlyphOrientationHorizontal has been removed, was return 389; // CSSPropertyGlyphOrientationVertical has been removed, was return 390; // CSSPropertyKerning has been removed, was return 391; case CSSPropertyTextAnchor: return 392; case CSSPropertyVectorEffect: return 393; case CSSPropertyWritingMode: return 394; // CSSPropertyWebkitSvgShadow has been removed, was return 395; // CSSPropertyWebkitCursorVisibility has been removed, was return 396; // CSSPropertyImageOrientation has been removed, was return 397; // CSSPropertyImageResolution has been removed, was return 398; #if defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING case CSSPropertyWebkitBlendMode: return 399; case CSSPropertyWebkitBackgroundBlendMode: return 400; #endif case CSSPropertyTextDecorationLine: return 401; case CSSPropertyTextDecorationStyle: return 402; case CSSPropertyTextDecorationColor: return 403; case CSSPropertyTextAlignLast: return 404; case CSSPropertyTextUnderlinePosition: return 405; case CSSPropertyMaxZoom: return 406; case CSSPropertyMinZoom: return 407; case CSSPropertyOrientation: return 408; case CSSPropertyUserZoom: return 409; // CSSPropertyWebkitDashboardRegion was 410. // CSSPropertyWebkitOverflowScrolling was 411. case CSSPropertyWebkitAppRegion: return 412; case CSSPropertyWebkitFilter: return 413; case CSSPropertyWebkitBoxDecorationBreak: return 414; case CSSPropertyWebkitTapHighlightColor: return 415; case CSSPropertyBufferedRendering: return 416; case CSSPropertyGridAutoRows: return 417; case CSSPropertyGridAutoColumns: return 418; case CSSPropertyBackgroundBlendMode: return 419; case CSSPropertyMixBlendMode: return 420; case CSSPropertyTouchAction: return 421; case CSSPropertyGridArea: return 422; case CSSPropertyGridTemplateAreas: return 423; case CSSPropertyAnimation: return 424; case CSSPropertyAnimationDelay: return 425; case CSSPropertyAnimationDirection: return 426; case CSSPropertyAnimationDuration: return 427; case CSSPropertyAnimationFillMode: return 428; case CSSPropertyAnimationIterationCount: return 429; case CSSPropertyAnimationName: return 430; case CSSPropertyAnimationPlayState: return 431; case CSSPropertyAnimationTimingFunction: return 432; case CSSPropertyObjectFit: return 433; case CSSPropertyPaintOrder: return 434; case CSSPropertyMaskSourceType: return 435; case CSSPropertyIsolation: return 436; case CSSPropertyObjectPosition: return 437; // case CSSPropertyInternalCallback: return 438; case CSSPropertyShapeImageThreshold: return 439; case CSSPropertyColumnFill: return 440; case CSSPropertyTextJustify: return 441; // CSSPropertyTouchActionDelay was 442 case CSSPropertyJustifySelf: return 443; case CSSPropertyScrollBehavior: return 444; case CSSPropertyWillChange: return 445; case CSSPropertyTransform: return 446; case CSSPropertyTransformOrigin: return 447; case CSSPropertyTransformStyle: return 448; case CSSPropertyPerspective: return 449; case CSSPropertyPerspectiveOrigin: return 450; case CSSPropertyBackfaceVisibility: return 451; case CSSPropertyGridTemplate: return 452; case CSSPropertyGrid: return 453; case CSSPropertyAll: return 454; case CSSPropertyJustifyItems: return 455; case CSSPropertyMotionPath: return 457; case CSSPropertyMotionOffset: return 458; case CSSPropertyMotionRotation: return 459; case CSSPropertyMotion: return 460; case CSSPropertyX: return 461; case CSSPropertyY: return 462; case CSSPropertyRx: return 463; case CSSPropertyRy: return 464; case CSSPropertyFontSizeAdjust: return 465; case CSSPropertyCx: return 466; case CSSPropertyCy: return 467; case CSSPropertyR: return 468; case CSSPropertyAliasEpubCaptionSide: return 469; case CSSPropertyAliasEpubTextCombine: return 470; case CSSPropertyAliasEpubTextEmphasis: return 471; case CSSPropertyAliasEpubTextEmphasisColor: return 472; case CSSPropertyAliasEpubTextEmphasisStyle: return 473; case CSSPropertyAliasEpubTextOrientation: return 474; case CSSPropertyAliasEpubTextTransform: return 475; case CSSPropertyAliasEpubWordBreak: return 476; case CSSPropertyAliasEpubWritingMode: return 477; case CSSPropertyAliasWebkitAlignContent: return 478; case CSSPropertyAliasWebkitAlignItems: return 479; case CSSPropertyAliasWebkitAlignSelf: return 480; case CSSPropertyAliasWebkitBorderBottomLeftRadius: return 481; case CSSPropertyAliasWebkitBorderBottomRightRadius: return 482; case CSSPropertyAliasWebkitBorderTopLeftRadius: return 483; case CSSPropertyAliasWebkitBorderTopRightRadius: return 484; case CSSPropertyAliasWebkitBoxSizing: return 485; case CSSPropertyAliasWebkitFlex: return 486; case CSSPropertyAliasWebkitFlexBasis: return 487; case CSSPropertyAliasWebkitFlexDirection: return 488; case CSSPropertyAliasWebkitFlexFlow: return 489; case CSSPropertyAliasWebkitFlexGrow: return 490; case CSSPropertyAliasWebkitFlexShrink: return 491; case CSSPropertyAliasWebkitFlexWrap: return 492; case CSSPropertyAliasWebkitJustifyContent: return 493; case CSSPropertyAliasWebkitOpacity: return 494; case CSSPropertyAliasWebkitOrder: return 495; case CSSPropertyAliasWebkitShapeImageThreshold: return 496; case CSSPropertyAliasWebkitShapeMargin: return 497; case CSSPropertyAliasWebkitShapeOutside: return 498; case CSSPropertyScrollSnapType: return 499; case CSSPropertyScrollSnapPointsX: return 500; case CSSPropertyScrollSnapPointsY: return 501; case CSSPropertyScrollSnapCoordinate: return 502; case CSSPropertyScrollSnapDestination: return 503; case CSSPropertyTranslate: return 504; case CSSPropertyRotate: return 505; case CSSPropertyScale: return 506; case CSSPropertyImageOrientation: return 507; case CSSPropertyBackdropFilter: return 508; case CSSPropertyTextCombineUpright: return 509; case CSSPropertyTextOrientation: return 510; case CSSPropertyGridColumnGap: return 511; case CSSPropertyGridRowGap: return 512; case CSSPropertyGridGap: return 513; case CSSPropertyFontFeatureSettings: return 514; case CSSPropertyVariable: return 515; case CSSPropertyFontDisplay: return 516; case CSSPropertyContain: return 517; case CSSPropertyD: return 518; // 1. Add new features above this line (don't change the assigned numbers of the existing // items). // 2. Update maximumCSSSampleId() with the new maximum value. // 3. Run the update_use_counter_css.py script in // chromium/src/tools/metrics/histograms to update the UMA histogram names. case CSSPropertyInvalid: ASSERT_NOT_REACHED(); return 0; } ASSERT_NOT_REACHED(); return 0; }
void tls_thread_init(os_local_state_t *os_tls, byte *segment) { /* We have four different ways to obtain TLS, each with its own limitations: * * 1) Piggyback on the threading system (like we do on Windows): here that would * be pthreads, which uses a segment since at least RH9, and uses gdt-based * segments for NPTL. The advantage is we won't run out of ldt or gdt entries * (except when the app itself would). The disadvantage is we're stealing * application slots and we rely on user mode interfaces. * * 2) Steal an ldt entry via SYS_modify_ldt. This suffers from the 8K ldt entry * limit and requires that we update manually on a new thread. For 64-bit * we're limited here to a 32-bit base. (Strangely, the kernel's * include/asm-x86_64/ldt.h implies that the base is ignored: but it doesn't * seem to be.) * * 3) Steal a gdt entry via SYS_set_thread_area. There is a 3rd unused entry * (after pthreads and wine) we could use. The kernel swaps for us, and with * CLONE_TLS the kernel will set up the entry for a new thread for us. Xref * PR 192231 and PR 285898. This system call is disabled on 64-bit 2.6 * kernels (though the man page for arch_prctl implies it isn't for 2.5 * kernels?!?) * * 4) Use SYS_arch_prctl. This is only implemented on 64-bit kernels, and can * only be used to set the gdt entries that fs and gs select for. Faster to * use <4GB base (obtain with mmap MAP_32BIT) since can use gdt; else have to * use wrmsr. The man pages say "ARCH_SET_GS is disabled in some kernels". */ uint selector; int index = -1; int res; #ifdef X64 /* First choice is gdt, which means arch_prctl. Since this may fail * on some kernels, we require -heap_in_lower_4GB so we can fall back * on modify_ldt. */ byte *cur_gs; res = dynamorio_syscall(SYS_arch_prctl, 2, ARCH_GET_GS, &cur_gs); if (res >= 0) { LOG(GLOBAL, LOG_THREADS, 1, "os_tls_init: cur gs base is "PFX"\n", cur_gs); /* If we're a non-initial thread, gs will be set to the parent thread's value */ if (cur_gs == NULL || is_dynamo_address(cur_gs) || /* By resolving i#107, we can handle gs conflicts between app and dr. */ INTERNAL_OPTION(mangle_app_seg)) { res = dynamorio_syscall(SYS_arch_prctl, 2, ARCH_SET_GS, segment); if (res >= 0) { os_tls->tls_type = TLS_TYPE_ARCH_PRCTL; LOG(GLOBAL, LOG_THREADS, 1, "os_tls_init: arch_prctl successful for base "PFX"\n", segment); /* Kernel should have written %gs for us if using GDT */ if (!dynamo_initialized && read_thread_register(SEG_TLS) == 0) { LOG(GLOBAL, LOG_THREADS, 1, "os_tls_init: using MSR\n"); tls_using_msr = true; } if (IF_CLIENT_INTERFACE_ELSE(INTERNAL_OPTION(private_loader), false)) { res = dynamorio_syscall(SYS_arch_prctl, 2, ARCH_SET_FS, os_tls->os_seg_info.dr_fs_base); /* Assuming set fs must be successful if set gs succeeded. */ ASSERT(res >= 0); } } else { /* we've found a kernel where ARCH_SET_GS is disabled */ ASSERT_CURIOSITY(false && "arch_prctl failed on set but not get"); LOG(GLOBAL, LOG_THREADS, 1, "os_tls_init: arch_prctl failed: error %d\n", res); } } else { /* FIXME PR 205276: we don't currently handle it: fall back on ldt, but * we'll have the same conflict w/ the selector... */ ASSERT_BUG_NUM(205276, cur_gs == NULL); } } #endif if (os_tls->tls_type == TLS_TYPE_NONE) { /* Second choice is set_thread_area */ /* PR 285898: if we added CLONE_SETTLS to all clone calls (and emulated vfork * with clone) we could avoid having to set tls up for each thread (as well * as solve race PR 207903), at least for kernel 2.5.32+. For now we stick * w/ manual setup. */ our_modify_ldt_t desc; /* Pick which GDT slots we'll use for DR TLS and for library TLS if * using the private loader. */ choose_gdt_slots(os_tls); if (tls_gdt_index > -1) { /* Now that we know which GDT slot to use, install the per-thread base * into it. */ /* Base here must be 32-bit */ IF_X64(ASSERT(DYNAMO_OPTION(heap_in_lower_4GB) && segment <= (byte*)UINT_MAX)); initialize_ldt_struct(&desc, segment, PAGE_SIZE, tls_gdt_index); res = dynamorio_syscall(SYS_set_thread_area, 1, &desc); LOG(GLOBAL, LOG_THREADS, 3, "%s: set_thread_area %d => %d res, %d index\n", __FUNCTION__, tls_gdt_index, res, desc.entry_number); ASSERT(res < 0 || desc.entry_number == tls_gdt_index); } else { res = -1; /* fall back on LDT */ } if (res >= 0) { LOG(GLOBAL, LOG_THREADS, 1, "os_tls_init: set_thread_area successful for base "PFX" @index %d\n", segment, tls_gdt_index); os_tls->tls_type = TLS_TYPE_GDT; index = tls_gdt_index; selector = GDT_SELECTOR(index); WRITE_DR_SEG(selector); /* macro needs lvalue! */ } else { IF_VMX86(ASSERT_NOT_REACHED()); /* since no modify_ldt */ LOG(GLOBAL, LOG_THREADS, 1, "os_tls_init: set_thread_area failed: error %d\n", res); } #ifdef CLIENT_INTERFACE /* Install the library TLS base. */ if (INTERNAL_OPTION(private_loader) && res >= 0) { app_pc base = IF_X64_ELSE(os_tls->os_seg_info.dr_fs_base, os_tls->os_seg_info.dr_gs_base); /* lib_tls_gdt_index is picked in choose_gdt_slots. */ ASSERT(lib_tls_gdt_index >= gdt_entry_tls_min); initialize_ldt_struct(&desc, base, GDT_NO_SIZE_LIMIT, lib_tls_gdt_index); res = dynamorio_syscall(SYS_set_thread_area, 1, &desc); LOG(GLOBAL, LOG_THREADS, 3, "%s: set_thread_area %d => %d res, %d index\n", __FUNCTION__, lib_tls_gdt_index, res, desc.entry_number); if (res >= 0) { /* i558 update lib seg reg to enforce the segment changes */ selector = GDT_SELECTOR(lib_tls_gdt_index); LOG(GLOBAL, LOG_THREADS, 2, "%s: setting %s to selector 0x%x\n", __FUNCTION__, reg_names[LIB_SEG_TLS], selector); WRITE_LIB_SEG(selector); } } #endif } if (os_tls->tls_type == TLS_TYPE_NONE) { /* Third choice: modify_ldt, which should be available on kernel 2.3.99+ */ /* Base here must be 32-bit */ IF_X64(ASSERT(DYNAMO_OPTION(heap_in_lower_4GB) && segment <= (byte*)UINT_MAX)); /* we have the thread_initexit_lock so no race here */ index = find_unused_ldt_index(); selector = LDT_SELECTOR(index); ASSERT(index != -1); create_ldt_entry((void *)segment, PAGE_SIZE, index); os_tls->tls_type = TLS_TYPE_LDT; WRITE_DR_SEG(selector); /* macro needs lvalue! */ LOG(GLOBAL, LOG_THREADS, 1, "os_tls_init: modify_ldt successful for base "PFX" w/ index %d\n", segment, index); } os_tls->ldt_index = index; }
static void unreachable() { ASSERT_NOT_REACHED(); exit(1); }
bool decode(ArgumentDecoder* decoder, RetainPtr<CFTypeRef>& result) { CFType type; if (!decoder->decodeEnum(type)) return false; switch (type) { case CFArray: { RetainPtr<CFArrayRef> array; if (!decode(decoder, array)) return false; result.adoptCF(array.leakRef()); return true; } case CFBoolean: { RetainPtr<CFBooleanRef> boolean; if (!decode(decoder, boolean)) return false; result.adoptCF(boolean.leakRef()); return true; } case CFData: { RetainPtr<CFDataRef> data; if (!decode(decoder, data)) return false; result.adoptCF(data.leakRef()); return true; } case CFDate: { RetainPtr<CFDateRef> date; if (!decode(decoder, date)) return false; result.adoptCF(date.leakRef()); return true; } case CFDictionary: { RetainPtr<CFDictionaryRef> dictionary; if (!decode(decoder, dictionary)) return false; result.adoptCF(dictionary.leakRef()); return true; } case CFNull: result.adoptCF(kCFNull); return true; case CFNumber: { RetainPtr<CFNumberRef> number; if (!decode(decoder, number)) return false; result.adoptCF(number.leakRef()); return true; } case CFString: { RetainPtr<CFStringRef> string; if (!decode(decoder, string)) return false; result.adoptCF(string.leakRef()); return true; } case CFURL: { RetainPtr<CFURLRef> url; if (!decode(decoder, url)) return false; result.adoptCF(url.leakRef()); return true; } #if PLATFORM(MAC) case SecCertificate: { RetainPtr<SecCertificateRef> certificate; if (!decode(decoder, certificate)) return false; result.adoptCF(certificate.leakRef()); return true; } case SecKeychainItem: { RetainPtr<SecKeychainItemRef> keychainItem; if (!decode(decoder, keychainItem)) return false; result.adoptCF(keychainItem.leakRef()); return true; } #endif case Null: result = tokenNullTypeRef(); return true; case Unknown: ASSERT_NOT_REACHED(); return false; } return false; }
bool CSSValue::equals(const CSSValue& other) const { if (m_isTextClone) { ASSERT(isCSSOMSafe()); return static_cast<const TextCloneCSSValue*>(this)->cssText() == other.cssText(); } if (m_classType == other.m_classType) { switch (m_classType) { case AspectRatioClass: return compareCSSValues<CSSAspectRatioValue>(*this, other); case BorderImageSliceClass: return compareCSSValues<CSSBorderImageSliceValue>(*this, other); case CanvasClass: return compareCSSValues<CSSCanvasValue>(*this, other); case CursorImageClass: return compareCSSValues<CSSCursorImageValue>(*this, other); #if ENABLE(CSS_FILTERS) case FilterImageClass: return compareCSSValues<CSSFilterImageValue>(*this, other); #endif case FontClass: return compareCSSValues<CSSFontValue>(*this, other); case FontFaceSrcClass: return compareCSSValues<CSSFontFaceSrcValue>(*this, other); case FontFeatureClass: return compareCSSValues<CSSFontFeatureValue>(*this, other); case FunctionClass: return compareCSSValues<CSSFunctionValue>(*this, other); case LinearGradientClass: return compareCSSValues<CSSLinearGradientValue>(*this, other); case RadialGradientClass: return compareCSSValues<CSSRadialGradientValue>(*this, other); case CrossfadeClass: return compareCSSValues<CSSCrossfadeValue>(*this, other); case ImageClass: return compareCSSValues<CSSImageValue>(*this, other); case InheritedClass: return compareCSSValues<CSSInheritedValue>(*this, other); case InitialClass: return compareCSSValues<CSSInitialValue>(*this, other); case GridTemplateClass: return compareCSSValues<CSSGridTemplateValue>(*this, other); case PrimitiveClass: return compareCSSValues<CSSPrimitiveValue>(*this, other); case ReflectClass: return compareCSSValues<CSSReflectValue>(*this, other); case ShadowClass: return compareCSSValues<CSSShadowValue>(*this, other); case CubicBezierTimingFunctionClass: return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, other); case StepsTimingFunctionClass: return compareCSSValues<CSSStepsTimingFunctionValue>(*this, other); case UnicodeRangeClass: return compareCSSValues<CSSUnicodeRangeValue>(*this, other); case ValueListClass: return compareCSSValues<CSSValueList>(*this, other); case WebKitCSSTransformClass: return compareCSSValues<WebKitCSSTransformValue>(*this, other); case LineBoxContainClass: return compareCSSValues<CSSLineBoxContainValue>(*this, other); case CalculationClass: return compareCSSValues<CSSCalcValue>(*this, other); #if ENABLE(CSS_IMAGE_SET) case ImageSetClass: return compareCSSValues<CSSImageSetValue>(*this, other); #endif #if ENABLE(CSS_FILTERS) case WebKitCSSFilterClass: return compareCSSValues<WebKitCSSFilterValue>(*this, other); #if ENABLE(CSS_SHADERS) case WebKitCSSArrayFunctionValueClass: return compareCSSValues<WebKitCSSArrayFunctionValue>(*this, other); case WebKitCSSMatFunctionValueClass: return compareCSSValues<WebKitCSSMatFunctionValue>(*this, other); case WebKitCSSMixFunctionValueClass: return compareCSSValues<WebKitCSSMixFunctionValue>(*this, other); case WebKitCSSShaderClass: return compareCSSValues<WebKitCSSShaderValue>(*this, other); #endif #endif #if ENABLE(SVG) case SVGColorClass: return compareCSSValues<SVGColor>(*this, other); case SVGPaintClass: return compareCSSValues<SVGPaint>(*this, other); case WebKitCSSSVGDocumentClass: return compareCSSValues<WebKitCSSSVGDocumentValue>(*this, other); #endif default: ASSERT_NOT_REACHED(); return false; } } else if (m_classType == ValueListClass && other.m_classType != ValueListClass) return toCSSValueList(this)->equals(other); else if (m_classType != ValueListClass && other.m_classType == ValueListClass) return static_cast<const CSSValueList&>(other).equals(*this); return false; }
void DOMWindowExtensionNoCache::willDisconnectDOMWindowExtensionFromGlobalObject(WKBundleDOMWindowExtensionRef extension) { // No items should be going into a 0-capacity page cache. ASSERT_NOT_REACHED(); }
bool parseManifest(const URL& manifestURL, const char* data, int length, Manifest& manifest) { ASSERT(manifest.explicitURLs.isEmpty()); ASSERT(manifest.onlineWhitelistedURLs.isEmpty()); ASSERT(manifest.fallbackURLs.isEmpty()); manifest.allowAllNetworkRequests = false; Mode mode = Explicit; String s = TextResourceDecoder::create("text/cache-manifest", "UTF-8")->decodeAndFlush(data, length); // Look for the magic signature: "^\xFEFF?CACHE MANIFEST[ \t]?" (the BOM is removed by TextResourceDecoder). // Example: "CACHE MANIFEST #comment" is a valid signature. // Example: "CACHE MANIFEST;V2" is not. if (!s.startsWith("CACHE MANIFEST")) return false; StringView manifestAfterSignature = StringView(s).substring(14); // "CACHE MANIFEST" is 14 characters. auto upconvertedCharacters = manifestAfterSignature.upconvertedCharacters(); const UChar* p = upconvertedCharacters; const UChar* end = p + manifestAfterSignature.length(); if (p < end && *p != ' ' && *p != '\t' && *p != '\n' && *p != '\r') return false; // Skip to the end of the line. while (p < end && *p != '\r' && *p != '\n') p++; while (1) { // Skip whitespace while (p < end && (*p == '\n' || *p == '\r' || *p == ' ' || *p == '\t')) p++; if (p == end) break; const UChar* lineStart = p; // Find the end of the line while (p < end && *p != '\r' && *p != '\n') p++; // Check if we have a comment if (*lineStart == '#') continue; // Get rid of trailing whitespace const UChar* tmp = p - 1; while (tmp > lineStart && (*tmp == ' ' || *tmp == '\t')) tmp--; String line(lineStart, tmp - lineStart + 1); if (line == "CACHE:") mode = Explicit; else if (line == "FALLBACK:") mode = Fallback; else if (line == "NETWORK:") mode = OnlineWhitelist; else if (line.endsWith(':')) mode = Unknown; else if (mode == Unknown) continue; else if (mode == Explicit || mode == OnlineWhitelist) { auto upconvertedLineCharacters = StringView(line).upconvertedCharacters(); const UChar* p = upconvertedLineCharacters; const UChar* lineEnd = p + line.length(); // Look for whitespace separating the URL from subsequent ignored tokens. while (p < lineEnd && *p != '\t' && *p != ' ') p++; if (mode == OnlineWhitelist && p - upconvertedLineCharacters == 1 && line[0] == '*') { // Wildcard was found. manifest.allowAllNetworkRequests = true; continue; } URL url(manifestURL, line.substring(0, p - upconvertedLineCharacters)); if (!url.isValid()) continue; if (url.hasFragmentIdentifier()) url.removeFragmentIdentifier(); if (!equalIgnoringASCIICase(url.protocol(), manifestURL.protocol())) continue; if (mode == Explicit && manifestURL.protocolIs("https") && !protocolHostAndPortAreEqual(manifestURL, url)) continue; if (mode == Explicit) manifest.explicitURLs.add(url.string()); else manifest.onlineWhitelistedURLs.append(url); } else if (mode == Fallback) { auto upconvertedLineCharacters = StringView(line).upconvertedCharacters(); const UChar* p = upconvertedLineCharacters; const UChar* lineEnd = p + line.length(); // Look for whitespace separating the two URLs while (p < lineEnd && *p != '\t' && *p != ' ') p++; if (p == lineEnd) { // There was no whitespace separating the URLs. continue; } URL namespaceURL(manifestURL, line.substring(0, p - upconvertedLineCharacters)); if (!namespaceURL.isValid()) continue; if (namespaceURL.hasFragmentIdentifier()) namespaceURL.removeFragmentIdentifier(); if (!protocolHostAndPortAreEqual(manifestURL, namespaceURL)) continue; // Skip whitespace separating fallback namespace from URL. while (p < lineEnd && (*p == '\t' || *p == ' ')) p++; // Look for whitespace separating the URL from subsequent ignored tokens. const UChar* fallbackStart = p; while (p < lineEnd && *p != '\t' && *p != ' ') p++; URL fallbackURL(manifestURL, String(fallbackStart, p - fallbackStart)); if (!fallbackURL.isValid()) continue; if (fallbackURL.hasFragmentIdentifier()) fallbackURL.removeFragmentIdentifier(); if (!protocolHostAndPortAreEqual(manifestURL, fallbackURL)) continue; manifest.fallbackURLs.append(std::make_pair(namespaceURL, fallbackURL)); } else ASSERT_NOT_REACHED(); } return true; }
// This state function is used as a stub function to plug unimplemented states // in the state dispatch table. They are unimplemented because they should // never be reached in the course of correct execution. SQLTransactionState SQLTransaction::unreachableState() { ASSERT_NOT_REACHED(); return SQLTransactionState::End; }
// FIXME: Generate this function. PassRefPtrWillBeRawPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle& style) { ASSERT(CSSAnimations::isAnimatableProperty(property)); switch (property) { case CSSPropertyBackgroundColor: return createFromColor(property, style); case CSSPropertyBackgroundImage: return createFromFillLayers<CSSPropertyBackgroundImage>(style.backgroundLayers(), style); case CSSPropertyBackgroundPositionX: return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgroundLayers(), style); case CSSPropertyBackgroundPositionY: return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgroundLayers(), style); case CSSPropertyBackgroundSize: case CSSPropertyWebkitBackgroundSize: return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundLayers(), style); case CSSPropertyBaselineShift: return AnimatableSVGLength::create(style.baselineShiftValue()); case CSSPropertyBorderBottomColor: return createFromColor(property, style); case CSSPropertyBorderBottomLeftRadius: return createFromLengthSize(style.borderBottomLeftRadius(), style); case CSSPropertyBorderBottomRightRadius: return createFromLengthSize(style.borderBottomRightRadius(), style); case CSSPropertyBorderBottomWidth: return createFromDouble(style.borderBottomWidth()); case CSSPropertyBorderImageOutset: return createFromBorderImageLengthBox(style.borderImageOutset(), style); case CSSPropertyBorderImageSlice: return createFromLengthBox(style.borderImageSlices(), style); case CSSPropertyBorderImageSource: return createFromStyleImage(style.borderImageSource()); case CSSPropertyBorderImageWidth: return createFromBorderImageLengthBox(style.borderImageWidth(), style); case CSSPropertyBorderLeftColor: return createFromColor(property, style); case CSSPropertyBorderLeftWidth: return createFromDouble(style.borderLeftWidth()); case CSSPropertyBorderRightColor: return createFromColor(property, style); case CSSPropertyBorderRightWidth: return createFromDouble(style.borderRightWidth()); case CSSPropertyBorderTopColor: return createFromColor(property, style); case CSSPropertyBorderTopLeftRadius: return createFromLengthSize(style.borderTopLeftRadius(), style); case CSSPropertyBorderTopRightRadius: return createFromLengthSize(style.borderTopRightRadius(), style); case CSSPropertyBorderTopWidth: return createFromDouble(style.borderTopWidth()); case CSSPropertyBottom: return createFromLength(style.bottom(), style); case CSSPropertyBoxShadow: case CSSPropertyWebkitBoxShadow: return AnimatableShadow::create(style.boxShadow()); case CSSPropertyClip: if (style.hasClip()) return createFromLengthBox(style.clip(), style); return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueAuto)); case CSSPropertyColor: return createFromColor(property, style); case CSSPropertyFillOpacity: return createFromDouble(style.fillOpacity()); case CSSPropertyFill: return AnimatableSVGPaint::create(style.svgStyle()->fillPaintType(), style.svgStyle()->fillPaintColor(), style.svgStyle()->fillPaintUri()); case CSSPropertyFlexGrow: return createFromDouble(style.flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero); case CSSPropertyFlexShrink: return createFromDouble(style.flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero); case CSSPropertyFlexBasis: return createFromLength(style.flexBasis(), style); case CSSPropertyFloodColor: return createFromColor(property, style); case CSSPropertyFloodOpacity: return createFromDouble(style.floodOpacity()); case CSSPropertyFontSize: // Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size // if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same). // FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to // enable text zoom rather than Text Autosizing? See http://crbug.com/227545. return createFromDouble(style.specifiedFontSize()); case CSSPropertyFontWeight: return createFromFontWeight(style.fontWeight()); case CSSPropertyHeight: return createFromLength(style.height(), style); case CSSPropertyLightingColor: return createFromColor(property, style); case CSSPropertyListStyleImage: return createFromStyleImage(style.listStyleImage()); case CSSPropertyLeft: return createFromLength(style.left(), style); case CSSPropertyLetterSpacing: return createFromDouble(style.letterSpacing()); case CSSPropertyLineHeight: return createFromLineHeight(style.specifiedLineHeight(), style); case CSSPropertyMarginBottom: return createFromLength(style.marginBottom(), style); case CSSPropertyMarginLeft: return createFromLength(style.marginLeft(), style); case CSSPropertyMarginRight: return createFromLength(style.marginRight(), style); case CSSPropertyMarginTop: return createFromLength(style.marginTop(), style); case CSSPropertyMaxHeight: return createFromLength(style.maxHeight(), style); case CSSPropertyMaxWidth: return createFromLength(style.maxWidth(), style); case CSSPropertyMinHeight: return createFromLength(style.minHeight(), style); case CSSPropertyMinWidth: return createFromLength(style.minWidth(), style); case CSSPropertyObjectPosition: return createFromLengthPoint(style.objectPosition(), style); case CSSPropertyOpacity: return createFromDouble(style.opacity()); case CSSPropertyOrphans: return createFromDouble(style.orphans()); case CSSPropertyOutlineColor: return createFromColor(property, style); case CSSPropertyOutlineOffset: return createFromDouble(style.outlineOffset()); case CSSPropertyOutlineWidth: return createFromDouble(style.outlineWidth()); case CSSPropertyPaddingBottom: return createFromLength(style.paddingBottom(), style); case CSSPropertyPaddingLeft: return createFromLength(style.paddingLeft(), style); case CSSPropertyPaddingRight: return createFromLength(style.paddingRight(), style); case CSSPropertyPaddingTop: return createFromLength(style.paddingTop(), style); case CSSPropertyRight: return createFromLength(style.right(), style); case CSSPropertyStrokeWidth: return AnimatableSVGLength::create(style.strokeWidth()); case CSSPropertyStopColor: return createFromColor(property, style); case CSSPropertyStopOpacity: return createFromDouble(style.stopOpacity()); case CSSPropertyStrokeDasharray: return AnimatableStrokeDasharrayList::create(style.strokeDashArray()); case CSSPropertyStrokeDashoffset: return AnimatableSVGLength::create(style.strokeDashOffset()); case CSSPropertyStrokeMiterlimit: return createFromDouble(style.strokeMiterLimit()); case CSSPropertyStrokeOpacity: return createFromDouble(style.strokeOpacity()); case CSSPropertyStroke: return AnimatableSVGPaint::create(style.svgStyle()->strokePaintType(), style.svgStyle()->strokePaintColor(), style.svgStyle()->strokePaintUri()); case CSSPropertyTextDecorationColor: return AnimatableColor::create(style.textDecorationColor().resolve(style.color()), style.visitedLinkTextDecorationColor().resolve(style.visitedLinkColor())); case CSSPropertyTextIndent: return createFromLength(style.textIndent(), style); case CSSPropertyTextShadow: return AnimatableShadow::create(style.textShadow()); case CSSPropertyTop: return createFromLength(style.top(), style); case CSSPropertyWebkitBorderHorizontalSpacing: return createFromDouble(style.horizontalBorderSpacing()); case CSSPropertyWebkitBorderVerticalSpacing: return createFromDouble(style.verticalBorderSpacing()); case CSSPropertyWebkitClipPath: if (ClipPathOperation* operation = style.clipPath()) return AnimatableClipPathOperation::create(operation); return AnimatableUnknown::create(CSSValueNone); case CSSPropertyWebkitColumnCount: return createFromDouble(style.columnCount()); case CSSPropertyWebkitColumnGap: return createFromDouble(style.columnGap()); case CSSPropertyWebkitColumnRuleColor: return createFromColor(property, style); case CSSPropertyWebkitColumnRuleWidth: return createFromDouble(style.columnRuleWidth()); case CSSPropertyWebkitColumnWidth: return createFromDouble(style.columnWidth()); case CSSPropertyWebkitFilter: return AnimatableFilterOperations::create(style.filter()); case CSSPropertyWebkitMaskBoxImageOutset: return createFromBorderImageLengthBox(style.maskBoxImageOutset(), style); case CSSPropertyWebkitMaskBoxImageSlice: return createFromLengthBoxAndBool(style.maskBoxImageSlices(), style.maskBoxImageSlicesFill(), style); case CSSPropertyWebkitMaskBoxImageSource: return createFromStyleImage(style.maskBoxImageSource()); case CSSPropertyWebkitMaskBoxImageWidth: return createFromBorderImageLengthBox(style.maskBoxImageWidth(), style); case CSSPropertyWebkitMaskImage: return createFromFillLayers<CSSPropertyWebkitMaskImage>(style.maskLayers(), style); case CSSPropertyWebkitMaskPositionX: return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style.maskLayers(), style); case CSSPropertyWebkitMaskPositionY: return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style.maskLayers(), style); case CSSPropertyWebkitMaskSize: return createFromFillLayers<CSSPropertyWebkitMaskSize>(style.maskLayers(), style); case CSSPropertyPerspective: return createFromDouble(style.perspective()); case CSSPropertyPerspectiveOrigin: ASSERT(RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled()); return AnimatableLengthPoint::create( createFromLength(style.perspectiveOriginX(), style), createFromLength(style.perspectiveOriginY(), style)); case CSSPropertyWebkitPerspectiveOriginX: ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled()); return createFromLength(style.perspectiveOriginX(), style); case CSSPropertyWebkitPerspectiveOriginY: ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled()); return createFromLength(style.perspectiveOriginY(), style); case CSSPropertyShapeOutside: return createFromShapeValue(style.shapeOutside()); case CSSPropertyShapeMargin: return createFromLength(style.shapeMargin(), style); case CSSPropertyShapeImageThreshold: return createFromDouble(style.shapeImageThreshold()); case CSSPropertyWebkitTextStrokeColor: return createFromColor(property, style); case CSSPropertyTransform: return AnimatableTransform::create(style.transform()); case CSSPropertyTransformOrigin: ASSERT(RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled()); return AnimatableLengthPoint3D::create( createFromLength(style.transformOriginX(), style), createFromLength(style.transformOriginY(), style), createFromDouble(style.transformOriginZ())); case CSSPropertyWebkitTransformOriginX: ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled()); return createFromLength(style.transformOriginX(), style); case CSSPropertyWebkitTransformOriginY: ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled()); return createFromLength(style.transformOriginY(), style); case CSSPropertyWebkitTransformOriginZ: ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled()); return createFromDouble(style.transformOriginZ()); case CSSPropertyWidows: return createFromDouble(style.widows()); case CSSPropertyWidth: return createFromLength(style.width(), style); case CSSPropertyWordSpacing: return createFromDouble(style.wordSpacing()); case CSSPropertyVisibility: return AnimatableVisibility::create(style.visibility()); case CSSPropertyZIndex: return createFromDouble(style.zIndex()); case CSSPropertyZoom: return createFromDouble(style.zoom()); default: ASSERT_NOT_REACHED(); // This return value is to avoid a release crash if possible. return AnimatableUnknown::create(nullptr); } }
// It is the caller's responsibility to make sure that nobody is trying to create, delete, open, or close databases in this origin while the deletion is // taking place. bool DatabaseTracker::deleteOrigin(SecurityOrigin* origin) { Vector<String> databaseNames; { MutexLocker lockDatabase(m_databaseGuard); openTrackerDatabase(DontCreateIfDoesNotExist); if (!m_database.isOpen()) return false; if (!databaseNamesForOriginNoLock(origin, databaseNames)) { LOG_ERROR("Unable to retrieve list of database names for origin %s", origin->databaseIdentifier().ascii().data()); return false; } if (!canDeleteOrigin(origin)) { LOG_ERROR("Tried to delete an origin (%s) while either creating database in it or already deleting it", origin->databaseIdentifier().ascii().data()); ASSERT_NOT_REACHED(); return false; } recordDeletingOrigin(origin); } // We drop the lock here because holding locks during a call to deleteDatabaseFile will deadlock. for (unsigned i = 0; i < databaseNames.size(); ++i) { if (!deleteDatabaseFile(origin, databaseNames[i])) { // Even if the file can't be deleted, we want to try and delete the rest, don't return early here. LOG_ERROR("Unable to delete file for database %s in origin %s", databaseNames[i].ascii().data(), origin->databaseIdentifier().ascii().data()); } } { MutexLocker lockDatabase(m_databaseGuard); deleteOriginLockFor(origin); doneDeletingOrigin(origin); SQLiteStatement statement(m_database, "DELETE FROM Databases WHERE origin=?"); if (statement.prepare() != SQLResultOk) { LOG_ERROR("Unable to prepare deletion of databases from origin %s from tracker", origin->databaseIdentifier().ascii().data()); return false; } statement.bindText(1, origin->databaseIdentifier()); if (!statement.executeCommand()) { LOG_ERROR("Unable to execute deletion of databases from origin %s from tracker", origin->databaseIdentifier().ascii().data()); return false; } SQLiteStatement originStatement(m_database, "DELETE FROM Origins WHERE origin=?"); if (originStatement.prepare() != SQLResultOk) { LOG_ERROR("Unable to prepare deletion of origin %s from tracker", origin->databaseIdentifier().ascii().data()); return false; } originStatement.bindText(1, origin->databaseIdentifier()); if (!originStatement.executeCommand()) { LOG_ERROR("Unable to execute deletion of databases from origin %s from tracker", origin->databaseIdentifier().ascii().data()); return false; } SQLiteFileSystem::deleteEmptyDatabaseDirectory(originPath(origin)); RefPtr<SecurityOrigin> originPossiblyLastReference = origin; bool isEmpty = true; openTrackerDatabase(DontCreateIfDoesNotExist); if (m_database.isOpen()) { SQLiteStatement statement(m_database, "SELECT origin FROM Origins"); if (statement.prepare() != SQLResultOk) LOG_ERROR("Failed to prepare statement."); else if (statement.step() == SQLResultRow) isEmpty = false; } // If we removed the last origin, do some additional deletion. if (isEmpty) { if (m_database.isOpen()) m_database.close(); SQLiteFileSystem::deleteDatabaseFile(trackerDatabasePath()); SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_databaseDirectoryPath); } if (m_client) { m_client->dispatchDidModifyOrigin(origin); for (unsigned i = 0; i < databaseNames.size(); ++i) m_client->dispatchDidModifyDatabase(origin, databaseNames[i]); } } return true; }
void MediaPlayerPrivateAVFoundation::dispatchNotification() { ASSERT(isMainThread()); Notification notification = Notification(); { MutexLocker lock(m_queueMutex); if (m_queuedNotifications.isEmpty()) return; if (!m_delayCallbacks) { // Only dispatch one notification callback per invocation because they can cause recursion. notification = m_queuedNotifications.first(); m_queuedNotifications.remove(0); } if (!m_queuedNotifications.isEmpty() && !m_mainThreadCallPending) callOnMainThread(mainThreadCallback, this); if (!notification.isValid()) return; } LOG(Media, "MediaPlayerPrivateAVFoundation::dispatchNotification(%p) - dispatching %s", this, notificationName(notification)); switch (notification.type()) { case Notification::ItemDidPlayToEndTime: didEnd(); break; case Notification::ItemTracksChanged: tracksChanged(); updateStates(); break; case Notification::ItemStatusChanged: updateStates(); break; case Notification::ItemSeekableTimeRangesChanged: seekableTimeRangesChanged(); updateStates(); break; case Notification::ItemLoadedTimeRangesChanged: loadedTimeRangesChanged(); updateStates(); break; case Notification::ItemPresentationSizeChanged: sizeChanged(); updateStates(); break; case Notification::ItemIsPlaybackLikelyToKeepUpChanged: updateStates(); break; case Notification::ItemIsPlaybackBufferEmptyChanged: updateStates(); break; case Notification::ItemIsPlaybackBufferFullChanged: updateStates(); break; case Notification::PlayerRateChanged: updateStates(); rateChanged(); break; case Notification::PlayerTimeChanged: timeChanged(notification.time()); break; case Notification::SeekCompleted: seekCompleted(notification.finished()); break; case Notification::AssetMetadataLoaded: metadataLoaded(); updateStates(); break; case Notification::AssetPlayabilityKnown: updateStates(); playabilityKnown(); break; case Notification::DurationChanged: invalidateCachedDuration(); break; case Notification::ContentsNeedsDisplay: contentsNeedsDisplay(); break; case Notification::InbandTracksNeedConfiguration: m_inbandTrackConfigurationPending = false; configureInbandTracks(); break; case Notification::FunctionType: notification.function()(); break; case Notification::TargetIsWirelessChanged: #if ENABLE(IOS_AIRPLAY) playbackTargetIsWirelessChanged(); #endif break; case Notification::None: ASSERT_NOT_REACHED(); break; } }
void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, const ResourceResponse& r) { KURL url = request().url(); const String& mimeType = r.mimeType(); switch (contentPolicy) { case PolicyUse: { // Prevent remote web archives from loading because they can claim to be from any domain and thus avoid cross-domain security checks (4120255). bool isRemoteWebArchive = equalIgnoringCase("application/x-webarchive", mimeType) && !m_substituteData.isValid() && !url.isLocalFile(); if (!frameLoader()->canShowMIMEType(mimeType) || isRemoteWebArchive) { frameLoader()->policyChecker()->cannotShowMIMEType(r); // Check reachedTerminalState since the load may have already been cancelled inside of _handleUnimplementablePolicyWithErrorCode::. if (!reachedTerminalState()) stopLoadingForPolicyChange(); return; } break; } case PolicyDownload: // m_handle can be null, e.g. when loading a substitute resource from application cache. if (!m_handle) { receivedError(cannotShowURLError()); return; } frameLoader()->client()->download(m_handle.get(), request(), m_handle.get()->request(), r); // It might have gone missing if (frameLoader()) receivedError(interruptionForPolicyChangeError()); return; case PolicyIgnore: stopLoadingForPolicyChange(); return; default: ASSERT_NOT_REACHED(); } RefPtr<MainResourceLoader> protect(this); if (r.isHTTP()) { int status = r.httpStatusCode(); if (status < 200 || status >= 300) { bool hostedByObject = frameLoader()->isHostedByObjectElement(); frameLoader()->handleFallbackContent(); // object elements are no longer rendered after we fallback, so don't // keep trying to process data from their load if (hostedByObject) cancel(); } } // we may have cancelled this load as part of switching to fallback content if (!reachedTerminalState()) ResourceLoader::didReceiveResponse(r); if (frameLoader() && !frameLoader()->isStopping()) { if (m_substituteData.isValid()) { if (m_substituteData.content()->size()) didReceiveData(m_substituteData.content()->data(), m_substituteData.content()->size(), m_substituteData.content()->size(), true); if (frameLoader() && !frameLoader()->isStopping()) didFinishLoading(); } else if (shouldLoadAsEmptyDocument(url) || frameLoader()->representationExistsForURLScheme(url.protocol())) didFinishLoading(); } }
WebMouseEvent WebInputEventFactory::mouseEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { WebMouseEvent result; //(WebInputEvent::Uninitialized()); switch (message) { case WM_MOUSEMOVE: result.type = WebInputEvent::MouseMove; if (wparam & MK_LBUTTON) result.button = WebMouseEvent::ButtonLeft; else if (wparam & MK_MBUTTON) result.button = WebMouseEvent::ButtonMiddle; else if (wparam & MK_RBUTTON) result.button = WebMouseEvent::ButtonRight; else result.button = WebMouseEvent::ButtonNone; break; case WM_MOUSELEAVE: result.type = WebInputEvent::MouseLeave; result.button = WebMouseEvent::ButtonNone; // set the current mouse position (relative to the client area of the // current window) since none is specified for this event lparam = GetRelativeCursorPos(hwnd); break; case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: result.type = WebInputEvent::MouseDown; result.button = WebMouseEvent::ButtonLeft; break; case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: result.type = WebInputEvent::MouseDown; result.button = WebMouseEvent::ButtonMiddle; break; case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: result.type = WebInputEvent::MouseDown; result.button = WebMouseEvent::ButtonRight; break; case WM_LBUTTONUP: result.type = WebInputEvent::MouseUp; result.button = WebMouseEvent::ButtonLeft; break; case WM_MBUTTONUP: result.type = WebInputEvent::MouseUp; result.button = WebMouseEvent::ButtonMiddle; break; case WM_RBUTTONUP: result.type = WebInputEvent::MouseUp; result.button = WebMouseEvent::ButtonRight; break; default: ASSERT_NOT_REACHED(); } // TODO(pkasting): http://b/1117926 Are we guaranteed that the message that // GetMessageTime() refers to is the same one that we're passed in? Perhaps // one of the construction parameters should be the time passed by the // caller, who would know for sure. result.timeStampSeconds = GetMessageTime() / 1000.0; // set position fields: result.x = static_cast<short>(LOWORD(lparam)); result.y = static_cast<short>(HIWORD(lparam)); result.windowX = result.x; result.windowY = result.y; POINT globalPoint = { result.x, result.y }; ClientToScreen(hwnd, &globalPoint); result.globalX = globalPoint.x; result.globalY = globalPoint.y; // calculate number of clicks: // This differs slightly from the WebKit code in WebKit/win/WebView.cpp // where their original code looks buggy. static int lastClickPositionX; static int lastClickPositionY; static WebMouseEvent::Button lastClickButton = WebMouseEvent::ButtonLeft; double currentTime = result.timeStampSeconds; bool cancelPreviousClick = (abs(lastClickPositionX - result.x) > (GetSystemMetrics(SM_CXDOUBLECLK) / 2)) || (abs(lastClickPositionY - result.y) > (GetSystemMetrics(SM_CYDOUBLECLK) / 2)) || ((currentTime - gLastClickTime) * 1000.0 > GetDoubleClickTime()); if (result.type == WebInputEvent::MouseDown) { if (!cancelPreviousClick && (result.button == lastClickButton)) ++gLastClickCount; else { gLastClickCount = 1; lastClickPositionX = result.x; lastClickPositionY = result.y; } gLastClickTime = currentTime; lastClickButton = result.button; } else if (result.type == WebInputEvent::MouseMove || result.type == WebInputEvent::MouseLeave) { if (cancelPreviousClick) { gLastClickCount = 0; lastClickPositionX = 0; lastClickPositionY = 0; gLastClickTime = 0; } } result.clickCount = gLastClickCount; // set modifiers: if (wparam & MK_CONTROL) result.modifiers |= WebInputEvent::ControlKey; if (wparam & MK_SHIFT) result.modifiers |= WebInputEvent::ShiftKey; if (GetKeyState(VK_MENU) & 0x8000) result.modifiers |= WebInputEvent::AltKey; if (wparam & MK_LBUTTON) result.modifiers |= WebInputEvent::LeftButtonDown; if (wparam & MK_MBUTTON) result.modifiers |= WebInputEvent::MiddleButtonDown; if (wparam & MK_RBUTTON) result.modifiers |= WebInputEvent::RightButtonDown; return result; }
void Connection::readEventHandler() { if (m_connectionPipe == INVALID_HANDLE_VALUE) return; while (true) { // Check if we got some data. DWORD numberOfBytesRead = 0; if (!::GetOverlappedResult(m_connectionPipe, &m_readState, &numberOfBytesRead, FALSE)) { DWORD error = ::GetLastError(); switch (error) { case ERROR_BROKEN_PIPE: connectionDidClose(); return; case ERROR_MORE_DATA: { // Read the rest of the message out of the pipe. DWORD bytesToRead = 0; if (!::PeekNamedPipe(m_connectionPipe, 0, 0, 0, 0, &bytesToRead)) { DWORD error = ::GetLastError(); if (error == ERROR_BROKEN_PIPE) { connectionDidClose(); return; } ASSERT_NOT_REACHED(); return; } // ::GetOverlappedResult told us there's more data. ::PeekNamedPipe shouldn't // contradict it! ASSERT(bytesToRead); if (!bytesToRead) break; m_readBuffer.grow(m_readBuffer.size() + bytesToRead); if (!::ReadFile(m_connectionPipe, m_readBuffer.data() + numberOfBytesRead, bytesToRead, 0, &m_readState)) { DWORD error = ::GetLastError(); ASSERT_NOT_REACHED(); return; } continue; } // FIXME: We should figure out why we're getting this error. case ERROR_IO_INCOMPLETE: return; default: ASSERT_NOT_REACHED(); } } if (!m_readBuffer.isEmpty()) { // We have a message, let's dispatch it. // The messageID is encoded at the end of the buffer. // Note that we assume here that the message is the same size as m_readBuffer. We can // assume this because we always size m_readBuffer to exactly match the size of the message, // either when receiving ERROR_MORE_DATA from ::GetOverlappedResult above or when // ::PeekNamedPipe tells us the size below. We never set m_readBuffer to a size larger // than the message. ASSERT(m_readBuffer.size() >= sizeof(MessageID)); size_t realBufferSize = m_readBuffer.size() - sizeof(MessageID); unsigned messageID = *reinterpret_cast<unsigned*>(m_readBuffer.data() + realBufferSize); processIncomingMessage(MessageID::fromInt(messageID), adoptPtr(new ArgumentDecoder(m_readBuffer.data(), realBufferSize))); } // Find out the size of the next message in the pipe (if there is one) so that we can read // it all in one operation. (This is just an optimization to avoid an extra pass through the // loop (if we chose a buffer size that was too small) or allocating extra memory (if we // chose a buffer size that was too large).) DWORD bytesToRead = 0; if (!::PeekNamedPipe(m_connectionPipe, 0, 0, 0, 0, &bytesToRead)) { DWORD error = ::GetLastError(); if (error == ERROR_BROKEN_PIPE) { connectionDidClose(); return; } ASSERT_NOT_REACHED(); } if (!bytesToRead) { // There's no message waiting in the pipe. Schedule a read of the first byte of the // next message. We'll find out the message's actual size when it arrives. (If we // change this to read more than a single byte for performance reasons, we'll have to // deal with m_readBuffer potentially being larger than the message we read after // calling ::GetOverlappedResult above.) bytesToRead = 1; } m_readBuffer.resize(bytesToRead); // Either read the next available message (which should occur synchronously), or start an // asynchronous read of the next message that becomes available. BOOL result = ::ReadFile(m_connectionPipe, m_readBuffer.data(), m_readBuffer.size(), 0, &m_readState); if (result) { // There was already a message waiting in the pipe, and we read it synchronously. // Process it. continue; } DWORD error = ::GetLastError(); if (error == ERROR_IO_PENDING) { // There are no messages in the pipe currently. readEventHandler will be called again once there is a message. return; } if (error == ERROR_MORE_DATA) { // Either a message is available when we didn't think one was, or the message is larger // than ::PeekNamedPipe told us. The former seems far more likely. Probably the message // became available between our calls to ::PeekNamedPipe and ::ReadFile above. Go back // to the top of the loop to use ::GetOverlappedResult to retrieve the available data. continue; } // FIXME: We need to handle other errors here. ASSERT_NOT_REACHED(); } }
unsigned FontFace::traitsMask() const { unsigned traitsMask = 0; if (m_style) { if (!m_style->isPrimitiveValue()) return 0; switch (toCSSPrimitiveValue(m_style.get())->getValueID()) { case CSSValueNormal: traitsMask |= FontStyleNormalMask; break; case CSSValueItalic: case CSSValueOblique: traitsMask |= FontStyleItalicMask; break; default: break; } } else { traitsMask |= FontStyleNormalMask; } if (m_weight) { if (!m_weight->isPrimitiveValue()) return 0; switch (toCSSPrimitiveValue(m_weight.get())->getValueID()) { case CSSValueBold: case CSSValue700: traitsMask |= FontWeight700Mask; break; case CSSValueNormal: case CSSValue400: traitsMask |= FontWeight400Mask; break; case CSSValue900: traitsMask |= FontWeight900Mask; break; case CSSValue800: traitsMask |= FontWeight800Mask; break; case CSSValue600: traitsMask |= FontWeight600Mask; break; case CSSValue500: traitsMask |= FontWeight500Mask; break; case CSSValue300: traitsMask |= FontWeight300Mask; break; case CSSValue200: traitsMask |= FontWeight200Mask; break; case CSSValueLighter: case CSSValue100: traitsMask |= FontWeight100Mask; break; default: ASSERT_NOT_REACHED(); break; } } else { traitsMask |= FontWeight400Mask; } if (RefPtr<CSSValue> fontVariant = m_variant) { // font-variant descriptor can be a value list. if (fontVariant->isPrimitiveValue()) { RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); list->append(fontVariant); fontVariant = list; } else if (!fontVariant->isValueList()) { return 0; } CSSValueList* variantList = toCSSValueList(fontVariant.get()); unsigned numVariants = variantList->length(); if (!numVariants) return 0; for (unsigned i = 0; i < numVariants; ++i) { switch (toCSSPrimitiveValue(variantList->itemWithoutBoundsCheck(i))->getValueID()) { case CSSValueNormal: traitsMask |= FontVariantNormalMask; break; case CSSValueSmallCaps: traitsMask |= FontVariantSmallCapsMask; break; default: break; } } } else { traitsMask |= FontVariantNormalMask; } return traitsMask; }
bool RenderSVGImage::nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int, HitTestAction) { ASSERT_NOT_REACHED(); return false; }
// Update the existing display items by removing invalidated entries, updating // repainted ones, and appending new items. // - For cached drawing display item, copy the corresponding cached DrawingDisplayItem; // - For cached subsequence display item, copy the cached display items between the // corresponding SubsequenceDisplayItem and EndSubsequenceDisplayItem (incl.); // - Otherwise, copy the new display item. // // The algorithm is O(|m_currentDisplayItemList| + |m_newDisplayItemList|). // Coefficients are related to the ratio of out-of-order CachedDisplayItems // and the average number of (Drawing|Subsequence)DisplayItems per client. // void PaintController::commitNewDisplayItemsInternal() { TRACE_EVENT2("blink,benchmark", "PaintController::commitNewDisplayItems", "current_display_list_size", (int)m_currentPaintArtifact.displayItemList().size(), "num_non_cached_new_items", (int)m_newDisplayItemList.size() - m_numCachedNewItems); m_numCachedNewItems = 0; if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) m_clientsCheckedPaintInvalidation.clear(); // These data structures are used during painting only. ASSERT(m_scopeStack.isEmpty()); m_scopeStack.clear(); m_nextScope = 1; ASSERT(!skippingCache()); #if ENABLE(ASSERT) m_newDisplayItemIndicesByClient.clear(); m_clientsWithPaintOffsetInvalidations.clear(); m_invalidations.clear(); #endif if (m_currentPaintArtifact.isEmpty()) { #if ENABLE(ASSERT) for (const auto& item : m_newDisplayItemList) ASSERT(!item.isCached()); #endif m_currentPaintArtifact = PaintArtifact(std::move(m_newDisplayItemList), m_newPaintChunks.releasePaintChunks()); m_newDisplayItemList = DisplayItemList(kInitialDisplayItemListCapacityBytes); m_validlyCachedClientsDirty = true; return; } updateValidlyCachedClientsIfNeeded(); // Stores indices to valid DrawingDisplayItems in m_currentDisplayItems that have not been matched // by CachedDisplayItems during synchronized matching. The indexed items will be matched // by later out-of-order CachedDisplayItems in m_newDisplayItemList. This ensures that when // out-of-order CachedDisplayItems occur, we only traverse at most once over m_currentDisplayItems // looking for potential matches. Thus we can ensure that the algorithm runs in linear time. OutOfOrderIndexContext outOfOrderIndexContext(m_currentPaintArtifact.displayItemList().begin()); // TODO(jbroman): Consider revisiting this heuristic. DisplayItemList updatedList(std::max(m_currentPaintArtifact.displayItemList().usedCapacityInBytes(), m_newDisplayItemList.usedCapacityInBytes())); Vector<PaintChunk> updatedPaintChunks; DisplayItemList::iterator currentIt = m_currentPaintArtifact.displayItemList().begin(); DisplayItemList::iterator currentEnd = m_currentPaintArtifact.displayItemList().end(); for (DisplayItemList::iterator newIt = m_newDisplayItemList.begin(); newIt != m_newDisplayItemList.end(); ++newIt) { const DisplayItem& newDisplayItem = *newIt; const DisplayItem::Id newDisplayItemId = newDisplayItem.nonCachedId(); bool newDisplayItemHasCachedType = newDisplayItem.type() != newDisplayItemId.type; bool isSynchronized = currentIt != currentEnd && newDisplayItemId.matches(*currentIt); if (newDisplayItemHasCachedType) { ASSERT(newDisplayItem.isCached()); ASSERT(clientCacheIsValid(newDisplayItem.client()) || (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && !paintOffsetWasInvalidated(newDisplayItem.client()))); if (!isSynchronized) { currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrderIndexContext); if (currentIt == currentEnd) { #ifndef NDEBUG showDebugData(); WTFLogAlways("%s not found in m_currentDisplayItemList\n", newDisplayItem.asDebugString().utf8().data()); #endif ASSERT_NOT_REACHED(); // We did not find the cached display item. This should be impossible, but may occur if there is a bug // in the system, such as under-invalidation, incorrect cache checking or duplicate display ids. // In this case, attempt to recover rather than crashing or bailing on display of the rest of the display list. continue; } } #if ENABLE(ASSERT) if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { DisplayItemList::iterator temp = currentIt; checkUnderInvalidation(newIt, temp); } #endif if (newDisplayItem.isCachedDrawing()) { updatedList.appendByMoving(*currentIt); ++currentIt; } else { ASSERT(newDisplayItem.type() == DisplayItem::CachedSubsequence); copyCachedSubsequence(currentIt, updatedList); ASSERT(updatedList.last().type() == DisplayItem::EndSubsequence); } } else { ASSERT(!newDisplayItem.isDrawing() || newDisplayItem.skippedCache() || !clientCacheIsValid(newDisplayItem.client()) || (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintOffsetWasInvalidated(newDisplayItem.client()))); updatedList.appendByMoving(*newIt); if (isSynchronized) ++currentIt; } // Items before currentIt should have been copied so we don't need to index them. if (currentIt - outOfOrderIndexContext.nextItemToIndex > 0) outOfOrderIndexContext.nextItemToIndex = currentIt; } #if ENABLE(ASSERT) if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) checkNoRemainingCachedDisplayItems(); #endif // ENABLE(ASSERT) // TODO(jbroman): When subsequence caching applies to SPv2, we'll need to // merge the paint chunks as well. m_currentPaintArtifact = PaintArtifact(std::move(updatedList), m_newPaintChunks.releasePaintChunks()); m_newDisplayItemList = DisplayItemList(kInitialDisplayItemListCapacityBytes); m_validlyCachedClientsDirty = true; }
void CSSValue::destroy() { if (m_isTextClone) { ASSERT(isCSSOMSafe()); delete static_cast<TextCloneCSSValue*>(this); return; } ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); switch (classType()) { case AspectRatioClass: delete toCSSAspectRatioValue(this); return; case BorderImageSliceClass: delete toCSSBorderImageSliceValue(this); return; case CanvasClass: delete toCSSCanvasValue(this); return; case CursorImageClass: delete toCSSCursorImageValue(this); return; case FontClass: delete toCSSFontValue(this); return; case FontFaceSrcClass: delete toCSSFontFaceSrcValue(this); return; case FontFeatureClass: delete toCSSFontFeatureValue(this); return; case FunctionClass: delete toCSSFunctionValue(this); return; case LinearGradientClass: delete toCSSLinearGradientValue(this); return; case RadialGradientClass: delete toCSSRadialGradientValue(this); return; case CrossfadeClass: delete toCSSCrossfadeValue(this); return; case ImageClass: delete toCSSImageValue(this); return; case InheritedClass: delete toCSSInheritedValue(this); return; case InitialClass: delete toCSSInitialValue(this); return; case GridTemplateClass: delete toCSSGridTemplateValue(this); return; case PrimitiveClass: delete toCSSPrimitiveValue(this); return; case ReflectClass: delete toCSSReflectValue(this); return; case ShadowClass: delete toCSSShadowValue(this); return; case CubicBezierTimingFunctionClass: delete toCSSCubicBezierTimingFunctionValue(this); return; case StepsTimingFunctionClass: delete toCSSStepsTimingFunctionValue(this); return; case UnicodeRangeClass: delete toCSSUnicodeRangeValue(this); return; case ValueListClass: delete toCSSValueList(this); return; case WebKitCSSTransformClass: delete toWebKitCSSTransformValue(this); return; case LineBoxContainClass: delete toCSSLineBoxContainValue(this); return; case CalculationClass: delete toCSSCalcValue(this); return; #if ENABLE(CSS_IMAGE_SET) case ImageSetClass: delete toCSSImageSetValue(this); return; #endif #if ENABLE(CSS_FILTERS) case FilterImageClass: delete toCSSFilterImageValue(this); return; case WebKitCSSFilterClass: delete toWebKitCSSFilterValue(this); return; #if ENABLE(CSS_SHADERS) case WebKitCSSArrayFunctionValueClass: delete toWebKitCSSArrayFunctionValue(this); return; case WebKitCSSMatFunctionValueClass: delete toWebKitCSSMatFunctionValue(this); return; case WebKitCSSMixFunctionValueClass: delete toWebKitCSSMixFunctionValue(this); return; case WebKitCSSShaderClass: delete toWebKitCSSShaderValue(this); return; #endif #endif #if ENABLE(SVG) case SVGColorClass: delete toSVGColor(this); return; case SVGPaintClass: delete toSVGPaint(this); return; case WebKitCSSSVGDocumentClass: delete toWebKitCSSSVGDocumentValue(this); return; #endif } ASSERT_NOT_REACHED(); }
void CCSingleThreadProxy::setNeedsAnimate() { // CCThread-only feature ASSERT_NOT_REACHED(); }
void DOMWindowExtensionNoCache::didReconnectDOMWindowExtensionToGlobalObject(WKBundleDOMWindowExtensionRef) { // No items should be coming out of a 0-capacity page cache. ASSERT_NOT_REACHED(); }
LayoutListMarker::ListStyleCategory LayoutListMarker::listStyleCategory() const { switch (style()->listStyleType()) { case NoneListStyle: return ListStyleCategory::None; case Disc: case Circle: case Square: return ListStyleCategory::Symbol; case ArabicIndic: case Armenian: case Bengali: case Cambodian: case CJKIdeographic: case CjkEarthlyBranch: case CjkHeavenlyStem: case DecimalLeadingZero: case DecimalListStyle: case Devanagari: case EthiopicHalehame: case EthiopicHalehameAm: case EthiopicHalehameTiEr: case EthiopicHalehameTiEt: case Georgian: case Gujarati: case Gurmukhi: case Hangul: case HangulConsonant: case Hebrew: case Hiragana: case HiraganaIroha: case Kannada: case Katakana: case KatakanaIroha: case Khmer: case KoreanHangulFormal: case KoreanHanjaFormal: case KoreanHanjaInformal: case Lao: case LowerAlpha: case LowerArmenian: case LowerGreek: case LowerLatin: case LowerRoman: case Malayalam: case Mongolian: case Myanmar: case Oriya: case Persian: case SimpChineseFormal: case SimpChineseInformal: case Telugu: case Thai: case Tibetan: case TradChineseFormal: case TradChineseInformal: case UpperAlpha: case UpperArmenian: case UpperLatin: case UpperRoman: case Urdu: return ListStyleCategory::Language; default: ASSERT_NOT_REACHED(); return ListStyleCategory::Language; } }
void SVGImage::setContainerSize(const IntSize&) { // SVGImageCache already intercepted this call, as it stores & caches the desired container sizes & zoom levels. ASSERT_NOT_REACHED(); }
bool TransformBuilder::createTransformOperations(CSSValue* inValue, const CSSToLengthConversionData& conversionData, TransformOperations& outOperations) { if (!inValue || !inValue->isValueList()) { outOperations.clear(); return false; } TransformOperations operations; for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) { CSSValue* currValue = i.value(); if (!currValue->isTransformValue()) continue; CSSTransformValue* transformValue = toCSSTransformValue(i.value()); if (!transformValue->length()) continue; bool haveNonPrimitiveValue = false; for (unsigned j = 0; j < transformValue->length(); ++j) { if (!transformValue->item(j)->isPrimitiveValue()) { haveNonPrimitiveValue = true; break; } } if (haveNonPrimitiveValue) continue; CSSPrimitiveValue* firstValue = toCSSPrimitiveValue(transformValue->item(0)); switch (transformValue->operationType()) { case CSSTransformValue::ScaleTransformOperation: case CSSTransformValue::ScaleXTransformOperation: case CSSTransformValue::ScaleYTransformOperation: { double sx = 1.0; double sy = 1.0; if (transformValue->operationType() == CSSTransformValue::ScaleYTransformOperation) sy = firstValue->getDoubleValue(); else { sx = firstValue->getDoubleValue(); if (transformValue->operationType() != CSSTransformValue::ScaleXTransformOperation) { if (transformValue->length() > 1) { CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->item(1)); sy = secondValue->getDoubleValue(); } else sy = sx; } } operations.operations().append(ScaleTransformOperation::create(sx, sy, 1.0, getTransformOperationType(transformValue->operationType()))); break; } case CSSTransformValue::ScaleZTransformOperation: case CSSTransformValue::Scale3DTransformOperation: { double sx = 1.0; double sy = 1.0; double sz = 1.0; if (transformValue->operationType() == CSSTransformValue::ScaleZTransformOperation) sz = firstValue->getDoubleValue(); else if (transformValue->operationType() == CSSTransformValue::ScaleYTransformOperation) sy = firstValue->getDoubleValue(); else { sx = firstValue->getDoubleValue(); if (transformValue->operationType() != CSSTransformValue::ScaleXTransformOperation) { if (transformValue->length() > 2) { CSSPrimitiveValue* thirdValue = toCSSPrimitiveValue(transformValue->item(2)); sz = thirdValue->getDoubleValue(); } if (transformValue->length() > 1) { CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->item(1)); sy = secondValue->getDoubleValue(); } else sy = sx; } } operations.operations().append(ScaleTransformOperation::create(sx, sy, sz, getTransformOperationType(transformValue->operationType()))); break; } case CSSTransformValue::TranslateTransformOperation: case CSSTransformValue::TranslateXTransformOperation: case CSSTransformValue::TranslateYTransformOperation: { Length tx = Length(0, Fixed); Length ty = Length(0, Fixed); if (transformValue->operationType() == CSSTransformValue::TranslateYTransformOperation) ty = convertToFloatLength(firstValue, conversionData); else { tx = convertToFloatLength(firstValue, conversionData); if (transformValue->operationType() != CSSTransformValue::TranslateXTransformOperation) { if (transformValue->length() > 1) { CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->item(1)); ty = convertToFloatLength(secondValue, conversionData); } } } operations.operations().append(TranslateTransformOperation::create(tx, ty, 0, getTransformOperationType(transformValue->operationType()))); break; } case CSSTransformValue::TranslateZTransformOperation: case CSSTransformValue::Translate3DTransformOperation: { Length tx = Length(0, Fixed); Length ty = Length(0, Fixed); double tz = 0; if (transformValue->operationType() == CSSTransformValue::TranslateZTransformOperation) tz = firstValue->computeLength<double>(conversionData); else if (transformValue->operationType() == CSSTransformValue::TranslateYTransformOperation) ty = convertToFloatLength(firstValue, conversionData); else { tx = convertToFloatLength(firstValue, conversionData); if (transformValue->operationType() != CSSTransformValue::TranslateXTransformOperation) { if (transformValue->length() > 2) { CSSPrimitiveValue* thirdValue = toCSSPrimitiveValue(transformValue->item(2)); tz = thirdValue->computeLength<double>(conversionData); } if (transformValue->length() > 1) { CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->item(1)); ty = convertToFloatLength(secondValue, conversionData); } } } operations.operations().append(TranslateTransformOperation::create(tx, ty, tz, getTransformOperationType(transformValue->operationType()))); break; } case CSSTransformValue::RotateTransformOperation: { double angle = firstValue->computeDegrees(); operations.operations().append(RotateTransformOperation::create(0, 0, 1, angle, getTransformOperationType(transformValue->operationType()))); break; } case CSSTransformValue::RotateXTransformOperation: case CSSTransformValue::RotateYTransformOperation: case CSSTransformValue::RotateZTransformOperation: { double x = 0; double y = 0; double z = 0; double angle = firstValue->computeDegrees(); if (transformValue->operationType() == CSSTransformValue::RotateXTransformOperation) x = 1; else if (transformValue->operationType() == CSSTransformValue::RotateYTransformOperation) y = 1; else z = 1; operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(transformValue->operationType()))); break; } case CSSTransformValue::Rotate3DTransformOperation: { if (transformValue->length() < 4) break; CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->item(1)); CSSPrimitiveValue* thirdValue = toCSSPrimitiveValue(transformValue->item(2)); CSSPrimitiveValue* fourthValue = toCSSPrimitiveValue(transformValue->item(3)); double x = firstValue->getDoubleValue(); double y = secondValue->getDoubleValue(); double z = thirdValue->getDoubleValue(); double angle = fourthValue->computeDegrees(); operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(transformValue->operationType()))); break; } case CSSTransformValue::SkewTransformOperation: case CSSTransformValue::SkewXTransformOperation: case CSSTransformValue::SkewYTransformOperation: { double angleX = 0; double angleY = 0; double angle = firstValue->computeDegrees(); if (transformValue->operationType() == CSSTransformValue::SkewYTransformOperation) angleY = angle; else { angleX = angle; if (transformValue->operationType() == CSSTransformValue::SkewTransformOperation) { if (transformValue->length() > 1) { CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->item(1)); angleY = secondValue->computeDegrees(); } } } operations.operations().append(SkewTransformOperation::create(angleX, angleY, getTransformOperationType(transformValue->operationType()))); break; } case CSSTransformValue::MatrixTransformOperation: { if (transformValue->length() < 6) break; double a = firstValue->getDoubleValue(); double b = toCSSPrimitiveValue(transformValue->item(1))->getDoubleValue(); double c = toCSSPrimitiveValue(transformValue->item(2))->getDoubleValue(); double d = toCSSPrimitiveValue(transformValue->item(3))->getDoubleValue(); double e = toCSSPrimitiveValue(transformValue->item(4))->getDoubleValue(); double f = toCSSPrimitiveValue(transformValue->item(5))->getDoubleValue(); operations.operations().append(MatrixTransformOperation::create(a, b, c, d, e, f)); break; } case CSSTransformValue::Matrix3DTransformOperation: { if (transformValue->length() < 16) break; TransformationMatrix matrix(toCSSPrimitiveValue(transformValue->item(0))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(1))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(2))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(3))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(4))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(5))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(6))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(7))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(8))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(9))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(10))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(11))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(12))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(13))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(14))->getDoubleValue(), toCSSPrimitiveValue(transformValue->item(15))->getDoubleValue()); operations.operations().append(Matrix3DTransformOperation::create(matrix)); break; } case CSSTransformValue::PerspectiveTransformOperation: { double p; if (firstValue->isLength()) p = firstValue->computeLength<double>(conversionData); else { // This is a quirk that should go away when 3d transforms are finalized. double val = firstValue->getDoubleValue(); if (val < 0) return false; p = clampToPositiveInteger(val); } operations.operations().append(PerspectiveTransformOperation::create(p)); break; } case CSSTransformValue::UnknownTransformOperation: ASSERT_NOT_REACHED(); break; } } outOperations = operations; return true; }
void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild) { // Insert :before and :after content before/after the RenderRubyRun(s) if (child->isBeforeContent()) { if (child->isInline()) { // Add generated inline content normally RenderBlock::addChild(child, firstChild()); } else { // Wrap non-inline content with an anonymous inline-block. RenderBlock* beforeBlock = rubyBeforeBlock(this); if (!beforeBlock) { beforeBlock = createAnonymousRubyInlineBlock(*this); RenderBlock::addChild(beforeBlock, firstChild()); } beforeBlock->addChild(child); } return; } if (child->isAfterContent()) { if (child->isInline()) { // Add generated inline content normally RenderBlock::addChild(child); } else { // Wrap non-inline content with an anonymous inline-block. RenderBlock* afterBlock = rubyAfterBlock(this); if (!afterBlock) { afterBlock = createAnonymousRubyInlineBlock(*this); RenderBlock::addChild(afterBlock); } afterBlock->addChild(child); } return; } // If the child is a ruby run, just add it normally. if (child->isRubyRun()) { RenderBlock::addChild(child, beforeChild); return; } if (beforeChild && !isAfterContent(beforeChild)) { // insert child into run ASSERT(!beforeChild->isRubyRun()); RenderElement* run = beforeChild->parent(); while (run && !run->isRubyRun()) run = run->parent(); if (run) { run->addChild(child, beforeChild); return; } ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! // Emergency fallback: fall through and just append. } // If the new child would be appended, try to add the child to the previous run // if possible, or create a new run otherwise. // (The RenderRubyRun object will handle the details) RenderRubyRun* lastRun = lastRubyRun(this); if (!lastRun || lastRun->hasRubyText()) { lastRun = RenderRubyRun::staticCreateRubyRun(this); RenderBlock::addChild(lastRun, beforeChild); } lastRun->addChild(child); }
PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription& fontDescription) { // If the font hasn't loaded or an error occurred, then we've got nothing. if (!isValid()) return 0; if (isLocal()) { // We're local. Just return a SimpleFontData from the normal cache. // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter. RefPtr<SimpleFontData> fontData = FontCache::fontCache()->getFontData(fontDescription, m_string, true); m_histograms.recordLocalFont(fontData); return fontData; } // See if we have a mapping in our FontData cache. AtomicString emptyFontFamily = ""; FontCacheKey key = fontDescription.cacheKey(emptyFontFamily); RefPtr<SimpleFontData>& fontData = m_fontDataTable.add(key.hash(), 0).storedValue->value; if (fontData) return fontData; // No release, because fontData is a reference to a RefPtr that is held in the m_fontDataTable. // If we are still loading, then we let the system pick a font. if (isLoaded()) { if (m_font) { #if ENABLE(SVG_FONTS) if (m_hasExternalSVGFont) { // For SVG fonts parse the external SVG document, and extract the <font> element. if (!m_font->ensureSVGFontData()) return 0; if (!m_externalSVGFontElement) { String fragmentIdentifier; size_t start = m_string.find('#'); if (start != kNotFound) fragmentIdentifier = m_string.string().substring(start + 1); m_externalSVGFontElement = m_font->getSVGFontById(fragmentIdentifier); } if (!m_externalSVGFontElement) return 0; SVGFontFaceElement* fontFaceElement = 0; // Select first <font-face> child for (Node* fontChild = m_externalSVGFontElement->firstChild(); fontChild; fontChild = fontChild->nextSibling()) { if (fontChild->hasTagName(SVGNames::font_faceTag)) { fontFaceElement = toSVGFontFaceElement(fontChild); break; } } if (fontFaceElement) { if (!m_svgFontFaceElement) { // We're created using a CSS @font-face rule, that means we're not associated with a SVGFontFaceElement. // Use the imported <font-face> tag as referencing font-face element for these cases. m_svgFontFaceElement = fontFaceElement; } fontData = SimpleFontData::create( SVGFontData::create(fontFaceElement), fontDescription.effectiveFontSize(), fontDescription.isSyntheticBold(), fontDescription.isSyntheticItalic()); } } else #endif { // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef. if (!m_font->ensureCustomFontData()) return 0; fontData = SimpleFontData::create( m_font->platformDataFromCustomData(fontDescription.effectiveFontSize(), fontDescription.isSyntheticBold(), fontDescription.isSyntheticItalic(), fontDescription.orientation(), fontDescription.widthVariant()), CustomFontData::create(false)); } } else { #if ENABLE(SVG_FONTS) // In-Document SVG Fonts if (m_svgFontFaceElement) { fontData = SimpleFontData::create( SVGFontData::create(m_svgFontFaceElement.get()), fontDescription.effectiveFontSize(), fontDescription.isSyntheticBold(), fontDescription.isSyntheticItalic()); } #endif } } else { // This temporary font is not retained and should not be returned. FontCachePurgePreventer fontCachePurgePreventer; SimpleFontData* temporaryFont = FontCache::fontCache()->getNonRetainedLastResortFallbackFont(fontDescription); if (!temporaryFont) { ASSERT_NOT_REACHED(); return 0; } RefPtr<CSSCustomFontData> cssFontData = CSSCustomFontData::create(true); cssFontData->setCSSFontFaceSource(this); fontData = SimpleFontData::create(temporaryFont->platformData(), cssFontData); } return fontData; // No release, because fontData is a reference to a RefPtr that is held in the m_fontDataTable. }
FilterOperations FilterOperationResolver::createFilterOperations(StyleResolverState& state, const CSSValue& inValue) { FilterOperations operations; if (inValue.isPrimitiveValue()) { ASSERT(toCSSPrimitiveValue(inValue).getValueID() == CSSValueNone); return operations; } const CSSToLengthConversionData& conversionData = state.cssToLengthConversionData(); for (auto& currValue : toCSSValueList(inValue)) { CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get()); FilterOperation::OperationType operationType = filterOperationForType(filterValue->functionType()); countFilterUse(operationType, state.document()); ASSERT(filterValue->length() <= 1); if (operationType == FilterOperation::REFERENCE) { CSSSVGDocumentValue* svgDocumentValue = toCSSSVGDocumentValue(filterValue->item(0)); KURL url = state.document().completeURL(svgDocumentValue->url()); RefPtrWillBeRawPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(svgDocumentValue->url(), AtomicString(url.fragmentIdentifier())); if (SVGURIReference::isExternalURIReference(svgDocumentValue->url(), state.document())) { if (!svgDocumentValue->loadRequested()) state.elementStyleResources().addPendingSVGDocument(operation.get(), svgDocumentValue); else if (svgDocumentValue->cachedSVGDocument()) ReferenceFilterBuilder::setDocumentResourceReference(operation.get(), adoptPtr(new DocumentResourceReference(svgDocumentValue->cachedSVGDocument()))); } operations.operations().append(operation); continue; } CSSPrimitiveValue* firstValue = filterValue->length() && filterValue->item(0)->isPrimitiveValue() ? toCSSPrimitiveValue(filterValue->item(0)) : nullptr; switch (filterValue->functionType()) { case CSSValueGrayscale: case CSSValueSepia: case CSSValueSaturate: { double amount = 1; if (filterValue->length() == 1) { amount = firstValue->getDoubleValue(); if (firstValue->isPercentage()) amount /= 100; } operations.operations().append(BasicColorMatrixFilterOperation::create(amount, operationType)); break; } case CSSValueHueRotate: { double angle = 0; if (filterValue->length() == 1) angle = firstValue->computeDegrees(); operations.operations().append(BasicColorMatrixFilterOperation::create(angle, operationType)); break; } case CSSValueInvert: case CSSValueBrightness: case CSSValueContrast: case CSSValueOpacity: { double amount = (filterValue->functionType() == CSSValueBrightness) ? 0 : 1; if (filterValue->length() == 1) { amount = firstValue->getDoubleValue(); if (firstValue->isPercentage()) amount /= 100; } operations.operations().append(BasicComponentTransferFilterOperation::create(amount, operationType)); break; } case CSSValueBlur: { Length stdDeviation = Length(0, Fixed); if (filterValue->length() >= 1) stdDeviation = firstValue->convertToLength(conversionData); operations.operations().append(BlurFilterOperation::create(stdDeviation)); break; } case CSSValueDropShadow: { CSSShadowValue* item = toCSSShadowValue(filterValue->item(0)); IntPoint location(item->x->computeLength<int>(conversionData), item->y->computeLength<int>(conversionData)); int blur = item->blur ? item->blur->computeLength<int>(conversionData) : 0; Color shadowColor = Color::black; if (item->color) shadowColor = state.document().textLinkColors().colorFromCSSValue(*item->color, state.style()->color()); operations.operations().append(DropShadowFilterOperation::create(location, blur, shadowColor)); break; } default: ASSERT_NOT_REACHED(); break; } } return operations; }
void ApplicationCacheGroup::checkIfLoadIsComplete() { if (m_manifestHandle || !m_pendingEntries.isEmpty() || m_downloadingPendingMasterResourceLoadersCount) return; // We're done, all resources have finished downloading (successfully or not). bool isUpgradeAttempt = m_newestCache; switch (m_completionType) { case None: ASSERT_NOT_REACHED(); return; case NoUpdate: ASSERT(isUpgradeAttempt); ASSERT(!m_cacheBeingUpdated); // The storage could have been manually emptied by the user. if (!m_storageID) m_storage->storeNewestCache(this); postListenerTask(ApplicationCacheHost::NOUPDATE_EVENT, m_associatedDocumentLoaders); break; case Failure: ASSERT(!m_cacheBeingUpdated); postListenerTask(ApplicationCacheHost::ERROR_EVENT, m_associatedDocumentLoaders); if (m_caches.isEmpty()) { ASSERT(m_associatedDocumentLoaders.isEmpty()); delete this; return; } break; case Completed: { // FIXME: Fetch the resource from manifest URL again, and check whether it is identical to the one used for update (in case the application was upgraded server-side in the meanwhile). (<rdar://problem/6467625>) ASSERT(m_cacheBeingUpdated); if (m_manifestResource) m_cacheBeingUpdated->setManifestResource(m_manifestResource.release()); else { // We can get here as a result of retrying the Complete step, following // a failure of the cache storage to save the newest cache due to hitting // the maximum size. In such a case, m_manifestResource may be 0, as // the manifest was already set on the newest cache object. ASSERT(m_cacheBeingUpdated->manifestResource()); ASSERT(m_storage->isMaximumSizeReached()); ASSERT(m_calledReachedMaxAppCacheSize); } RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? RefPtr<ApplicationCache>() : m_newestCache; // If we exceeded the origin quota while downloading we can request a quota // increase now, before we attempt to store the cache. int64_t totalSpaceNeeded; if (!m_storage->checkOriginQuota(this, oldNewestCache.get(), m_cacheBeingUpdated.get(), totalSpaceNeeded)) didReachOriginQuota(totalSpaceNeeded); ApplicationCacheStorage::FailureReason failureReason; setNewestCache(m_cacheBeingUpdated.release()); if (m_storage->storeNewestCache(this, oldNewestCache.get(), failureReason)) { // New cache stored, now remove the old cache. if (oldNewestCache) m_storage->remove(oldNewestCache.get()); // Fire the final progress event. ASSERT(m_progressDone == m_progressTotal); postListenerTask(ApplicationCacheHost::PROGRESS_EVENT, m_progressTotal, m_progressDone, m_associatedDocumentLoaders); // Fire the success event. postListenerTask(isUpgradeAttempt ? ApplicationCacheHost::UPDATEREADY_EVENT : ApplicationCacheHost::CACHED_EVENT, m_associatedDocumentLoaders); // It is clear that the origin quota was not reached, so clear the flag if it was set. m_originQuotaExceededPreviously = false; } else { if (failureReason == ApplicationCacheStorage::OriginQuotaReached) { // We ran out of space for this origin. Fall down to the normal error handling // after recording this state. m_originQuotaExceededPreviously = true; m_frame->document()->addConsoleMessage(MessageSource::AppCache, MessageLevel::Error, ASCIILiteral("Application Cache update failed, because size quota was exceeded.")); } if (failureReason == ApplicationCacheStorage::TotalQuotaReached && !m_calledReachedMaxAppCacheSize) { // FIXME: Should this be handled more like Origin Quotas? Does this fail properly? // We ran out of space. All the changes in the cache storage have // been rolled back. We roll back to the previous state in here, // as well, call the chrome client asynchronously and retry to // save the new cache. // Save a reference to the new cache. m_cacheBeingUpdated = m_newestCache.release(); if (oldNewestCache) { // Reinstate the oldNewestCache. setNewestCache(oldNewestCache.release()); } scheduleReachedMaxAppCacheSizeCallback(); return; } // Run the "cache failure steps" // Fire the error events to all pending master entries, as well any other cache hosts // currently associated with a cache in this group. postListenerTask(ApplicationCacheHost::ERROR_EVENT, m_associatedDocumentLoaders); // Disassociate the pending master entries from the failed new cache. Note that // all other loaders in the m_associatedDocumentLoaders are still associated with // some other cache in this group. They are not associated with the failed new cache. // Need to copy loaders, because the cache group may be destroyed at the end of iteration. Vector<DocumentLoader*> loaders; copyToVector(m_pendingMasterResourceLoaders, loaders); for (auto& loader : loaders) disassociateDocumentLoader(loader); // This can delete this group. // Reinstate the oldNewestCache, if there was one. if (oldNewestCache) { // This will discard the failed new cache. setNewestCache(oldNewestCache.release()); } else { // We must have been deleted by the last call to disassociateDocumentLoader(). return; } } break; } } // Empty cache group's list of pending master entries. m_pendingMasterResourceLoaders.clear(); m_completionType = None; setUpdateStatus(Idle); m_frame = nullptr; m_availableSpaceInQuota = ApplicationCacheStorage::unknownQuota(); m_calledReachedMaxAppCacheSize = false; }
static CGPathRef createPathForGlyph(HDC hdc, Glyph glyph) { CGMutablePathRef path = CGPathCreateMutable(); static const MAT2 identity = { 0, 1, 0, 0, 0, 0, 0, 1 }; GLYPHMETRICS glyphMetrics; // GGO_NATIVE matches the outline perfectly when Windows font smoothing is off. // GGO_NATIVE | GGO_UNHINTED does not match perfectly either when Windows font smoothing is on or off. DWORD outlineLength = GetGlyphOutline(hdc, glyph, GGO_GLYPH_INDEX | GGO_NATIVE, &glyphMetrics, 0, 0, &identity); ASSERT(outlineLength >= 0); if (outlineLength < 0) return path; Vector<UInt8> outline(outlineLength); GetGlyphOutline(hdc, glyph, GGO_GLYPH_INDEX | GGO_NATIVE, &glyphMetrics, outlineLength, outline.data(), &identity); unsigned offset = 0; while (offset < outlineLength) { LPTTPOLYGONHEADER subpath = reinterpret_cast<LPTTPOLYGONHEADER>(outline.data() + offset); ASSERT(subpath->dwType == TT_POLYGON_TYPE); if (subpath->dwType != TT_POLYGON_TYPE) return path; CGPathMoveToPoint(path, 0, toCGFloat(subpath->pfxStart.x), toCGFloat(subpath->pfxStart.y)); unsigned subpathOffset = sizeof(*subpath); while (subpathOffset < subpath->cb) { LPTTPOLYCURVE segment = reinterpret_cast<LPTTPOLYCURVE>(reinterpret_cast<UInt8*>(subpath) + subpathOffset); switch (segment->wType) { case TT_PRIM_LINE: for (unsigned i = 0; i < segment->cpfx; i++) CGPathAddLineToPoint(path, 0, toCGFloat(segment->apfx[i].x), toCGFloat(segment->apfx[i].y)); break; case TT_PRIM_QSPLINE: for (unsigned i = 0; i < segment->cpfx; i++) { CGFloat x = toCGFloat(segment->apfx[i].x); CGFloat y = toCGFloat(segment->apfx[i].y); CGFloat cpx; CGFloat cpy; if (i == segment->cpfx - 2) { cpx = toCGFloat(segment->apfx[i + 1].x); cpy = toCGFloat(segment->apfx[i + 1].y); i++; } else { cpx = (toCGFloat(segment->apfx[i].x) + toCGFloat(segment->apfx[i + 1].x)) / 2; cpy = (toCGFloat(segment->apfx[i].y) + toCGFloat(segment->apfx[i + 1].y)) / 2; } CGPathAddQuadCurveToPoint(path, 0, x, y, cpx, cpy); } break; case TT_PRIM_CSPLINE: for (unsigned i = 0; i < segment->cpfx; i += 3) { CGFloat cp1x = toCGFloat(segment->apfx[i].x); CGFloat cp1y = toCGFloat(segment->apfx[i].y); CGFloat cp2x = toCGFloat(segment->apfx[i + 1].x); CGFloat cp2y = toCGFloat(segment->apfx[i + 1].y); CGFloat x = toCGFloat(segment->apfx[i + 2].x); CGFloat y = toCGFloat(segment->apfx[i + 2].y); CGPathAddCurveToPoint(path, 0, cp1x, cp1y, cp2x, cp2y, x, y); } break; default: ASSERT_NOT_REACHED(); return path; } subpathOffset += sizeof(*segment) + (segment->cpfx - 1) * sizeof(segment->apfx[0]); } CGPathCloseSubpath(path); offset += subpath->cb; } return path; }
SVGFilterEffect* SVGFEMergeElement::filterEffect(SVGResourceFilter* filter) const { ASSERT_NOT_REACHED(); return 0; }