OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // FIXME: When we stop resolving currentColor at style time, these can be | 178 // FIXME: When we stop resolving currentColor at style time, these can be |
179 // removed. | 179 // removed. |
180 friend class CSSToStyleMap; | 180 friend class CSSToStyleMap; |
181 friend class FilterOperationResolver; | 181 friend class FilterOperationResolver; |
182 friend class StyleBuilderConverter; | 182 friend class StyleBuilderConverter; |
183 friend class StyleResolverState; | 183 friend class StyleResolverState; |
184 friend class StyleResolver; | 184 friend class StyleResolver; |
185 | 185 |
186 protected: | 186 protected: |
187 // non-inherited attributes | 187 // non-inherited attributes |
188 DataRef<StyleBoxData> box_; | 188 DataRef<StyleBoxData> box_data_; |
189 DataRef<StyleVisualData> visual_; | 189 DataRef<StyleVisualData> visual_data_; |
190 DataRef<StyleBackgroundData> background_; | 190 DataRef<StyleBackgroundData> background_data_; |
191 DataRef<StyleSurroundData> surround_; | 191 DataRef<StyleSurroundData> surround_data_; |
192 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_; | 192 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_; |
193 | 193 |
194 // inherited attributes | 194 // inherited attributes |
195 DataRef<StyleRareInheritedData> rare_inherited_data_; | 195 DataRef<StyleRareInheritedData> rare_inherited_data_; |
196 DataRef<StyleInheritedData> style_inherited_data_; | 196 DataRef<StyleInheritedData> style_inherited_data_; |
197 | 197 |
198 // list of associated pseudo styles | 198 // list of associated pseudo styles |
199 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_; | 199 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_; |
200 | 200 |
201 DataRef<SVGComputedStyle> svg_style_; | 201 DataRef<SVGComputedStyle> svg_style_; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 rare_non_inherited_data_->backface_visibility_); | 412 rare_non_inherited_data_->backface_visibility_); |
413 } | 413 } |
414 void SetBackfaceVisibility(EBackfaceVisibility b) { | 414 void SetBackfaceVisibility(EBackfaceVisibility b) { |
415 SET_VAR(rare_non_inherited_data_, backface_visibility_, b); | 415 SET_VAR(rare_non_inherited_data_, backface_visibility_, b); |
416 } | 416 } |
417 | 417 |
418 // Background properties. | 418 // Background properties. |
419 // background-color | 419 // background-color |
420 static Color InitialBackgroundColor() { return Color::kTransparent; } | 420 static Color InitialBackgroundColor() { return Color::kTransparent; } |
421 void SetBackgroundColor(const StyleColor& v) { | 421 void SetBackgroundColor(const StyleColor& v) { |
422 SET_VAR(background_, color_, v); | 422 SET_VAR(background_data_, color_, v); |
423 } | 423 } |
424 | 424 |
425 // background-image | 425 // background-image |
426 bool HasBackgroundImage() const { | 426 bool HasBackgroundImage() const { |
427 return background_->Background().HasImage(); | 427 return background_data_->Background().HasImage(); |
428 } | 428 } |
429 bool HasFixedBackgroundImage() const { | 429 bool HasFixedBackgroundImage() const { |
430 return background_->Background().HasFixedImage(); | 430 return background_data_->Background().HasFixedImage(); |
431 } | 431 } |
432 bool HasEntirelyFixedBackground() const; | 432 bool HasEntirelyFixedBackground() const; |
433 | 433 |
434 // background-clip | 434 // background-clip |
435 EFillBox BackgroundClip() const { | 435 EFillBox BackgroundClip() const { |
436 return static_cast<EFillBox>(background_->Background().Clip()); | 436 return static_cast<EFillBox>(background_data_->Background().Clip()); |
437 } | 437 } |
438 | 438 |
439 // Border properties. | 439 // Border properties. |
440 // -webkit-border-image | 440 // -webkit-border-image |
441 static NinePieceImage InitialNinePieceImage() { return NinePieceImage(); } | 441 static NinePieceImage InitialNinePieceImage() { return NinePieceImage(); } |
442 const NinePieceImage& BorderImage() const { | 442 const NinePieceImage& BorderImage() const { |
443 return surround_->border_.GetImage(); | 443 return surround_data_->border_.GetImage(); |
444 } | 444 } |
445 void SetBorderImage(const NinePieceImage& b) { | 445 void SetBorderImage(const NinePieceImage& b) { |
446 SET_VAR(surround_, border_.image_, b); | 446 SET_VAR(surround_data_, border_.image_, b); |
447 } | 447 } |
448 | 448 |
449 // border-image-slice | 449 // border-image-slice |
450 const LengthBox& BorderImageSlices() const { | 450 const LengthBox& BorderImageSlices() const { |
451 return surround_->border_.GetImage().ImageSlices(); | 451 return surround_data_->border_.GetImage().ImageSlices(); |
452 } | 452 } |
453 void SetBorderImageSlices(const LengthBox&); | 453 void SetBorderImageSlices(const LengthBox&); |
454 | 454 |
455 // border-image-source | 455 // border-image-source |
456 static StyleImage* InitialBorderImageSource() { return 0; } | 456 static StyleImage* InitialBorderImageSource() { return 0; } |
457 StyleImage* BorderImageSource() const { | 457 StyleImage* BorderImageSource() const { |
458 return surround_->border_.GetImage().GetImage(); | 458 return surround_data_->border_.GetImage().GetImage(); |
459 } | 459 } |
460 void SetBorderImageSource(StyleImage*); | 460 void SetBorderImageSource(StyleImage*); |
461 | 461 |
462 // border-image-width | 462 // border-image-width |
463 const BorderImageLengthBox& BorderImageWidth() const { | 463 const BorderImageLengthBox& BorderImageWidth() const { |
464 return surround_->border_.GetImage().BorderSlices(); | 464 return surround_data_->border_.GetImage().BorderSlices(); |
465 } | 465 } |
466 void SetBorderImageWidth(const BorderImageLengthBox&); | 466 void SetBorderImageWidth(const BorderImageLengthBox&); |
467 | 467 |
468 // border-image-outset | 468 // border-image-outset |
469 const BorderImageLengthBox& BorderImageOutset() const { | 469 const BorderImageLengthBox& BorderImageOutset() const { |
470 return surround_->border_.GetImage().Outset(); | 470 return surround_data_->border_.GetImage().Outset(); |
471 } | 471 } |
472 void SetBorderImageOutset(const BorderImageLengthBox&); | 472 void SetBorderImageOutset(const BorderImageLengthBox&); |
473 | 473 |
474 // Border width properties. | 474 // Border width properties. |
475 static float InitialBorderWidth() { return 3; } | 475 static float InitialBorderWidth() { return 3; } |
476 | 476 |
477 // border-top-width | 477 // border-top-width |
478 float BorderTopWidth() const { return surround_->border_.BorderTopWidth(); } | 478 float BorderTopWidth() const { |
| 479 return surround_data_->border_.BorderTopWidth(); |
| 480 } |
479 void SetBorderTopWidth(float v) { | 481 void SetBorderTopWidth(float v) { |
480 SET_BORDER_WIDTH(surround_, border_.top_, v); | 482 SET_BORDER_WIDTH(surround_data_, border_.top_, v); |
481 } | 483 } |
482 | 484 |
483 // border-bottom-width | 485 // border-bottom-width |
484 float BorderBottomWidth() const { | 486 float BorderBottomWidth() const { |
485 return surround_->border_.BorderBottomWidth(); | 487 return surround_data_->border_.BorderBottomWidth(); |
486 } | 488 } |
487 void SetBorderBottomWidth(float v) { | 489 void SetBorderBottomWidth(float v) { |
488 SET_BORDER_WIDTH(surround_, border_.bottom_, v); | 490 SET_BORDER_WIDTH(surround_data_, border_.bottom_, v); |
489 } | 491 } |
490 | 492 |
491 // border-left-width | 493 // border-left-width |
492 float BorderLeftWidth() const { return surround_->border_.BorderLeftWidth(); } | 494 float BorderLeftWidth() const { |
| 495 return surround_data_->border_.BorderLeftWidth(); |
| 496 } |
493 void SetBorderLeftWidth(float v) { | 497 void SetBorderLeftWidth(float v) { |
494 SET_BORDER_WIDTH(surround_, border_.left_, v); | 498 SET_BORDER_WIDTH(surround_data_, border_.left_, v); |
495 } | 499 } |
496 | 500 |
497 // border-right-width | 501 // border-right-width |
498 float BorderRightWidth() const { | 502 float BorderRightWidth() const { |
499 return surround_->border_.BorderRightWidth(); | 503 return surround_data_->border_.BorderRightWidth(); |
500 } | 504 } |
501 void SetBorderRightWidth(float v) { | 505 void SetBorderRightWidth(float v) { |
502 SET_BORDER_WIDTH(surround_, border_.right_, v); | 506 SET_BORDER_WIDTH(surround_data_, border_.right_, v); |
503 } | 507 } |
504 | 508 |
505 // Border style properties. | 509 // Border style properties. |
506 static EBorderStyle InitialBorderStyle() { return kBorderStyleNone; } | 510 static EBorderStyle InitialBorderStyle() { return kBorderStyleNone; } |
507 | 511 |
508 // border-top-style | 512 // border-top-style |
509 EBorderStyle BorderTopStyle() const { | 513 EBorderStyle BorderTopStyle() const { |
510 return surround_->border_.Top().Style(); | 514 return surround_data_->border_.Top().Style(); |
511 } | 515 } |
512 void SetBorderTopStyle(EBorderStyle v) { | 516 void SetBorderTopStyle(EBorderStyle v) { |
513 SET_VAR(surround_, border_.top_.style_, v); | 517 SET_VAR(surround_data_, border_.top_.style_, v); |
514 } | 518 } |
515 | 519 |
516 // border-right-style | 520 // border-right-style |
517 EBorderStyle BorderRightStyle() const { | 521 EBorderStyle BorderRightStyle() const { |
518 return surround_->border_.Right().Style(); | 522 return surround_data_->border_.Right().Style(); |
519 } | 523 } |
520 void SetBorderRightStyle(EBorderStyle v) { | 524 void SetBorderRightStyle(EBorderStyle v) { |
521 SET_VAR(surround_, border_.right_.style_, v); | 525 SET_VAR(surround_data_, border_.right_.style_, v); |
522 } | 526 } |
523 | 527 |
524 // border-left-style | 528 // border-left-style |
525 EBorderStyle BorderLeftStyle() const { | 529 EBorderStyle BorderLeftStyle() const { |
526 return surround_->border_.Left().Style(); | 530 return surround_data_->border_.Left().Style(); |
527 } | 531 } |
528 void SetBorderLeftStyle(EBorderStyle v) { | 532 void SetBorderLeftStyle(EBorderStyle v) { |
529 SET_VAR(surround_, border_.left_.style_, v); | 533 SET_VAR(surround_data_, border_.left_.style_, v); |
530 } | 534 } |
531 | 535 |
532 // border-bottom-style | 536 // border-bottom-style |
533 EBorderStyle BorderBottomStyle() const { | 537 EBorderStyle BorderBottomStyle() const { |
534 return surround_->border_.Bottom().Style(); | 538 return surround_data_->border_.Bottom().Style(); |
535 } | 539 } |
536 void SetBorderBottomStyle(EBorderStyle v) { | 540 void SetBorderBottomStyle(EBorderStyle v) { |
537 SET_VAR(surround_, border_.bottom_.style_, v); | 541 SET_VAR(surround_data_, border_.bottom_.style_, v); |
538 } | 542 } |
539 | 543 |
540 // Border color properties. | 544 // Border color properties. |
541 // border-left-color | 545 // border-left-color |
542 void SetBorderLeftColor(const StyleColor& v) { | 546 void SetBorderLeftColor(const StyleColor& v) { |
543 SET_BORDERVALUE_COLOR(surround_, border_.left_, v); | 547 SET_BORDERVALUE_COLOR(surround_data_, border_.left_, v); |
544 } | 548 } |
545 | 549 |
546 // border-right-color | 550 // border-right-color |
547 void SetBorderRightColor(const StyleColor& v) { | 551 void SetBorderRightColor(const StyleColor& v) { |
548 SET_BORDERVALUE_COLOR(surround_, border_.right_, v); | 552 SET_BORDERVALUE_COLOR(surround_data_, border_.right_, v); |
549 } | 553 } |
550 | 554 |
551 // border-top-color | 555 // border-top-color |
552 void SetBorderTopColor(const StyleColor& v) { | 556 void SetBorderTopColor(const StyleColor& v) { |
553 SET_BORDERVALUE_COLOR(surround_, border_.top_, v); | 557 SET_BORDERVALUE_COLOR(surround_data_, border_.top_, v); |
554 } | 558 } |
555 | 559 |
556 // border-bottom-color | 560 // border-bottom-color |
557 void SetBorderBottomColor(const StyleColor& v) { | 561 void SetBorderBottomColor(const StyleColor& v) { |
558 SET_BORDERVALUE_COLOR(surround_, border_.bottom_, v); | 562 SET_BORDERVALUE_COLOR(surround_data_, border_.bottom_, v); |
559 } | 563 } |
560 | 564 |
561 // Border radius properties. | 565 // Border radius properties. |
562 static LengthSize InitialBorderRadius() { | 566 static LengthSize InitialBorderRadius() { |
563 return LengthSize(Length(0, kFixed), Length(0, kFixed)); | 567 return LengthSize(Length(0, kFixed), Length(0, kFixed)); |
564 } | 568 } |
565 | 569 |
566 // border-top-left-radius (aka -webkit-border-top-left-radius) | 570 // border-top-left-radius (aka -webkit-border-top-left-radius) |
567 const LengthSize& BorderTopLeftRadius() const { | 571 const LengthSize& BorderTopLeftRadius() const { |
568 return surround_->border_.TopLeft(); | 572 return surround_data_->border_.TopLeft(); |
569 } | 573 } |
570 void SetBorderTopLeftRadius(const LengthSize& s) { | 574 void SetBorderTopLeftRadius(const LengthSize& s) { |
571 SET_VAR(surround_, border_.top_left_, s); | 575 SET_VAR(surround_data_, border_.top_left_, s); |
572 } | 576 } |
573 | 577 |
574 // border-top-right-radius (aka -webkit-border-top-right-radius) | 578 // border-top-right-radius (aka -webkit-border-top-right-radius) |
575 const LengthSize& BorderTopRightRadius() const { | 579 const LengthSize& BorderTopRightRadius() const { |
576 return surround_->border_.TopRight(); | 580 return surround_data_->border_.TopRight(); |
577 } | 581 } |
578 void SetBorderTopRightRadius(const LengthSize& s) { | 582 void SetBorderTopRightRadius(const LengthSize& s) { |
579 SET_VAR(surround_, border_.top_right_, s); | 583 SET_VAR(surround_data_, border_.top_right_, s); |
580 } | 584 } |
581 | 585 |
582 // border-bottom-left-radius (aka -webkit-border-bottom-left-radius) | 586 // border-bottom-left-radius (aka -webkit-border-bottom-left-radius) |
583 const LengthSize& BorderBottomLeftRadius() const { | 587 const LengthSize& BorderBottomLeftRadius() const { |
584 return surround_->border_.BottomLeft(); | 588 return surround_data_->border_.BottomLeft(); |
585 } | 589 } |
586 void SetBorderBottomLeftRadius(const LengthSize& s) { | 590 void SetBorderBottomLeftRadius(const LengthSize& s) { |
587 SET_VAR(surround_, border_.bottom_left_, s); | 591 SET_VAR(surround_data_, border_.bottom_left_, s); |
588 } | 592 } |
589 | 593 |
590 // border-bottom-right-radius (aka -webkit-border-bottom-right-radius) | 594 // border-bottom-right-radius (aka -webkit-border-bottom-right-radius) |
591 const LengthSize& BorderBottomRightRadius() const { | 595 const LengthSize& BorderBottomRightRadius() const { |
592 return surround_->border_.BottomRight(); | 596 return surround_data_->border_.BottomRight(); |
593 } | 597 } |
594 void SetBorderBottomRightRadius(const LengthSize& s) { | 598 void SetBorderBottomRightRadius(const LengthSize& s) { |
595 SET_VAR(surround_, border_.bottom_right_, s); | 599 SET_VAR(surround_data_, border_.bottom_right_, s); |
596 } | 600 } |
597 | 601 |
598 // Offset properties. | 602 // Offset properties. |
599 // left | 603 // left |
600 static Length InitialLeft() { return Length(); } | 604 static Length InitialLeft() { return Length(); } |
601 const Length& Left() const { return surround_->left_; } | 605 const Length& Left() const { return surround_data_->left_; } |
602 void SetLeft(const Length& v) { SET_VAR(surround_, left_, v); } | 606 void SetLeft(const Length& v) { SET_VAR(surround_data_, left_, v); } |
603 | 607 |
604 // right | 608 // right |
605 static Length InitialRight() { return Length(); } | 609 static Length InitialRight() { return Length(); } |
606 const Length& Right() const { return surround_->right_; } | 610 const Length& Right() const { return surround_data_->right_; } |
607 void SetRight(const Length& v) { SET_VAR(surround_, right_, v); } | 611 void SetRight(const Length& v) { SET_VAR(surround_data_, right_, v); } |
608 | 612 |
609 // top | 613 // top |
610 static Length InitialTop() { return Length(); } | 614 static Length InitialTop() { return Length(); } |
611 const Length& Top() const { return surround_->top_; } | 615 const Length& Top() const { return surround_data_->top_; } |
612 void SetTop(const Length& v) { SET_VAR(surround_, top_, v); } | 616 void SetTop(const Length& v) { SET_VAR(surround_data_, top_, v); } |
613 | 617 |
614 // bottom | 618 // bottom |
615 static Length InitialBottom() { return Length(); } | 619 static Length InitialBottom() { return Length(); } |
616 const Length& Bottom() const { return surround_->bottom_; } | 620 const Length& Bottom() const { return surround_data_->bottom_; } |
617 void SetBottom(const Length& v) { SET_VAR(surround_, bottom_, v); } | 621 void SetBottom(const Length& v) { SET_VAR(surround_data_, bottom_, v); } |
618 | 622 |
619 // box-shadow (aka -webkit-box-shadow) | 623 // box-shadow (aka -webkit-box-shadow) |
620 static ShadowList* InitialBoxShadow() { return 0; } | 624 static ShadowList* InitialBoxShadow() { return 0; } |
621 ShadowList* BoxShadow() const { | 625 ShadowList* BoxShadow() const { |
622 return rare_non_inherited_data_->box_shadow_.Get(); | 626 return rare_non_inherited_data_->box_shadow_.Get(); |
623 } | 627 } |
624 void SetBoxShadow(PassRefPtr<ShadowList>); | 628 void SetBoxShadow(PassRefPtr<ShadowList>); |
625 | 629 |
626 // box-sizing (aka -webkit-box-sizing) | 630 // box-sizing (aka -webkit-box-sizing) |
627 static EBoxSizing InitialBoxSizing() { return EBoxSizing::kContentBox; } | 631 static EBoxSizing InitialBoxSizing() { return EBoxSizing::kContentBox; } |
628 EBoxSizing BoxSizing() const { return box_->BoxSizing(); } | 632 EBoxSizing BoxSizing() const { return box_data_->BoxSizing(); } |
629 void SetBoxSizing(EBoxSizing s) { | 633 void SetBoxSizing(EBoxSizing s) { |
630 SET_VAR(box_, box_sizing_, static_cast<unsigned>(s)); | 634 SET_VAR(box_data_, box_sizing_, static_cast<unsigned>(s)); |
631 } | 635 } |
632 | 636 |
633 // clip | 637 // clip |
634 static LengthBox InitialClip() { return LengthBox(); } | 638 static LengthBox InitialClip() { return LengthBox(); } |
635 const LengthBox& Clip() const { return visual_->clip; } | 639 const LengthBox& Clip() const { return visual_data_->clip; } |
636 void SetClip(const LengthBox& box) { | 640 void SetClip(const LengthBox& box) { |
637 SET_VAR(visual_, has_auto_clip, false); | 641 SET_VAR(visual_data_, has_auto_clip, false); |
638 SET_VAR(visual_, clip, box); | 642 SET_VAR(visual_data_, clip, box); |
639 } | 643 } |
640 bool HasAutoClip() const { return visual_->has_auto_clip; } | 644 bool HasAutoClip() const { return visual_data_->has_auto_clip; } |
641 void SetHasAutoClip() { | 645 void SetHasAutoClip() { |
642 SET_VAR(visual_, has_auto_clip, true); | 646 SET_VAR(visual_data_, has_auto_clip, true); |
643 SET_VAR(visual_, clip, ComputedStyle::InitialClip()); | 647 SET_VAR(visual_data_, clip, ComputedStyle::InitialClip()); |
644 } | 648 } |
645 | 649 |
646 // Column properties. | 650 // Column properties. |
647 // column-count (aka -webkit-column-count) | 651 // column-count (aka -webkit-column-count) |
648 static unsigned short InitialColumnCount() { return 1; } | 652 static unsigned short InitialColumnCount() { return 1; } |
649 unsigned short ColumnCount() const { | 653 unsigned short ColumnCount() const { |
650 return rare_non_inherited_data_->multi_col_->count_; | 654 return rare_non_inherited_data_->multi_col_->count_; |
651 } | 655 } |
652 void SetColumnCount(unsigned short c) { | 656 void SetColumnCount(unsigned short c) { |
653 SET_NESTED_VAR(rare_non_inherited_data_, multi_col_, auto_count_, false); | 657 SET_NESTED_VAR(rare_non_inherited_data_, multi_col_, auto_count_, false); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 void SetBoxAlign(EBoxAlignment a) { | 834 void SetBoxAlign(EBoxAlignment a) { |
831 SET_NESTED_VAR(rare_non_inherited_data_, deprecated_flexible_box_, align, | 835 SET_NESTED_VAR(rare_non_inherited_data_, deprecated_flexible_box_, align, |
832 a); | 836 a); |
833 } | 837 } |
834 | 838 |
835 // -webkit-box-decoration-break | 839 // -webkit-box-decoration-break |
836 static EBoxDecorationBreak InitialBoxDecorationBreak() { | 840 static EBoxDecorationBreak InitialBoxDecorationBreak() { |
837 return kBoxDecorationBreakSlice; | 841 return kBoxDecorationBreakSlice; |
838 } | 842 } |
839 EBoxDecorationBreak BoxDecorationBreak() const { | 843 EBoxDecorationBreak BoxDecorationBreak() const { |
840 return box_->BoxDecorationBreak(); | 844 return box_data_->BoxDecorationBreak(); |
841 } | 845 } |
842 void SetBoxDecorationBreak(EBoxDecorationBreak b) { | 846 void SetBoxDecorationBreak(EBoxDecorationBreak b) { |
843 SET_VAR(box_, box_decoration_break_, b); | 847 SET_VAR(box_data_, box_decoration_break_, b); |
844 } | 848 } |
845 | 849 |
846 // -webkit-box-lines | 850 // -webkit-box-lines |
847 static EBoxLines InitialBoxLines() { return SINGLE; } | 851 static EBoxLines InitialBoxLines() { return SINGLE; } |
848 EBoxLines BoxLines() const { | 852 EBoxLines BoxLines() const { |
849 return static_cast<EBoxLines>( | 853 return static_cast<EBoxLines>( |
850 rare_non_inherited_data_->deprecated_flexible_box_->lines); | 854 rare_non_inherited_data_->deprecated_flexible_box_->lines); |
851 } | 855 } |
852 void SetBoxLines(EBoxLines lines) { | 856 void SetBoxLines(EBoxLines lines) { |
853 SET_NESTED_VAR(rare_non_inherited_data_, deprecated_flexible_box_, lines, | 857 SET_NESTED_VAR(rare_non_inherited_data_, deprecated_flexible_box_, lines, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 SET_NESTED_VAR(rare_non_inherited_data_, grid_, grid_template_rows_, | 1034 SET_NESTED_VAR(rare_non_inherited_data_, grid_, grid_template_rows_, |
1031 lengths); | 1035 lengths); |
1032 } | 1036 } |
1033 | 1037 |
1034 // Width/height properties. | 1038 // Width/height properties. |
1035 static Length InitialSize() { return Length(); } | 1039 static Length InitialSize() { return Length(); } |
1036 static Length InitialMaxSize() { return Length(kMaxSizeNone); } | 1040 static Length InitialMaxSize() { return Length(kMaxSizeNone); } |
1037 static Length InitialMinSize() { return Length(); } | 1041 static Length InitialMinSize() { return Length(); } |
1038 | 1042 |
1039 // width | 1043 // width |
1040 const Length& Width() const { return box_->Width(); } | 1044 const Length& Width() const { return box_data_->Width(); } |
1041 void SetWidth(const Length& v) { SET_VAR(box_, width_, v); } | 1045 void SetWidth(const Length& v) { SET_VAR(box_data_, width_, v); } |
1042 | 1046 |
1043 // height | 1047 // height |
1044 const Length& Height() const { return box_->Height(); } | 1048 const Length& Height() const { return box_data_->Height(); } |
1045 void SetHeight(const Length& v) { SET_VAR(box_, height_, v); } | 1049 void SetHeight(const Length& v) { SET_VAR(box_data_, height_, v); } |
1046 | 1050 |
1047 // max-width | 1051 // max-width |
1048 const Length& MaxWidth() const { return box_->MaxWidth(); } | 1052 const Length& MaxWidth() const { return box_data_->MaxWidth(); } |
1049 void SetMaxWidth(const Length& v) { SET_VAR(box_, max_width_, v); } | 1053 void SetMaxWidth(const Length& v) { SET_VAR(box_data_, max_width_, v); } |
1050 | 1054 |
1051 // max-height | 1055 // max-height |
1052 const Length& MaxHeight() const { return box_->MaxHeight(); } | 1056 const Length& MaxHeight() const { return box_data_->MaxHeight(); } |
1053 void SetMaxHeight(const Length& v) { SET_VAR(box_, max_height_, v); } | 1057 void SetMaxHeight(const Length& v) { SET_VAR(box_data_, max_height_, v); } |
1054 | 1058 |
1055 // min-width | 1059 // min-width |
1056 const Length& MinWidth() const { return box_->MinWidth(); } | 1060 const Length& MinWidth() const { return box_data_->MinWidth(); } |
1057 void SetMinWidth(const Length& v) { SET_VAR(box_, min_width_, v); } | 1061 void SetMinWidth(const Length& v) { SET_VAR(box_data_, min_width_, v); } |
1058 | 1062 |
1059 // min-height | 1063 // min-height |
1060 const Length& MinHeight() const { return box_->MinHeight(); } | 1064 const Length& MinHeight() const { return box_data_->MinHeight(); } |
1061 void SetMinHeight(const Length& v) { SET_VAR(box_, min_height_, v); } | 1065 void SetMinHeight(const Length& v) { SET_VAR(box_data_, min_height_, v); } |
1062 | 1066 |
1063 // image-orientation | 1067 // image-orientation |
1064 static RespectImageOrientationEnum InitialRespectImageOrientation() { | 1068 static RespectImageOrientationEnum InitialRespectImageOrientation() { |
1065 return kDoNotRespectImageOrientation; | 1069 return kDoNotRespectImageOrientation; |
1066 } | 1070 } |
1067 RespectImageOrientationEnum RespectImageOrientation() const { | 1071 RespectImageOrientationEnum RespectImageOrientation() const { |
1068 return static_cast<RespectImageOrientationEnum>( | 1072 return static_cast<RespectImageOrientationEnum>( |
1069 rare_inherited_data_->respect_image_orientation_); | 1073 rare_inherited_data_->respect_image_orientation_); |
1070 } | 1074 } |
1071 void SetRespectImageOrientation(RespectImageOrientationEnum v) { | 1075 void SetRespectImageOrientation(RespectImageOrientationEnum v) { |
(...skipping 15 matching lines...) Expand all Loading... |
1087 return static_cast<EIsolation>(rare_non_inherited_data_->isolation_); | 1091 return static_cast<EIsolation>(rare_non_inherited_data_->isolation_); |
1088 } | 1092 } |
1089 void SetIsolation(EIsolation v) { | 1093 void SetIsolation(EIsolation v) { |
1090 rare_non_inherited_data_.Access()->isolation_ = v; | 1094 rare_non_inherited_data_.Access()->isolation_ = v; |
1091 } | 1095 } |
1092 | 1096 |
1093 // Margin properties. | 1097 // Margin properties. |
1094 | 1098 |
1095 // margin-top | 1099 // margin-top |
1096 static Length InitialMarginTop() { return Length(kFixed); } | 1100 static Length InitialMarginTop() { return Length(kFixed); } |
1097 const Length& MarginTop() const { return surround_->margin_top_; } | 1101 const Length& MarginTop() const { return surround_data_->margin_top_; } |
1098 void SetMarginTop(const Length& v) { SET_VAR(surround_, margin_top_, v); } | 1102 void SetMarginTop(const Length& v) { |
| 1103 SET_VAR(surround_data_, margin_top_, v); |
| 1104 } |
1099 | 1105 |
1100 // margin-bottom | 1106 // margin-bottom |
1101 static Length InitialMarginBottom() { return Length(kFixed); } | 1107 static Length InitialMarginBottom() { return Length(kFixed); } |
1102 const Length& MarginBottom() const { return surround_->margin_bottom_; } | 1108 const Length& MarginBottom() const { return surround_data_->margin_bottom_; } |
1103 void SetMarginBottom(const Length& v) { | 1109 void SetMarginBottom(const Length& v) { |
1104 SET_VAR(surround_, margin_bottom_, v); | 1110 SET_VAR(surround_data_, margin_bottom_, v); |
1105 } | 1111 } |
1106 | 1112 |
1107 // margin-left | 1113 // margin-left |
1108 static Length InitialMarginLeft() { return Length(kFixed); } | 1114 static Length InitialMarginLeft() { return Length(kFixed); } |
1109 const Length& MarginLeft() const { return surround_->margin_left_; } | 1115 const Length& MarginLeft() const { return surround_data_->margin_left_; } |
1110 void SetMarginLeft(const Length& v) { SET_VAR(surround_, margin_left_, v); } | 1116 void SetMarginLeft(const Length& v) { |
| 1117 SET_VAR(surround_data_, margin_left_, v); |
| 1118 } |
1111 | 1119 |
1112 // margin-right | 1120 // margin-right |
1113 static Length InitialMarginRight() { return Length(kFixed); } | 1121 static Length InitialMarginRight() { return Length(kFixed); } |
1114 const Length& MarginRight() const { return surround_->margin_right_; } | 1122 const Length& MarginRight() const { return surround_data_->margin_right_; } |
1115 void SetMarginRight(const Length& v) { SET_VAR(surround_, margin_right_, v); } | 1123 void SetMarginRight(const Length& v) { |
| 1124 SET_VAR(surround_data_, margin_right_, v); |
| 1125 } |
1116 | 1126 |
1117 // -webkit-margin-before-collapse (aka -webkit-margin-top-collapse) | 1127 // -webkit-margin-before-collapse (aka -webkit-margin-top-collapse) |
1118 static EMarginCollapse InitialMarginBeforeCollapse() { | 1128 static EMarginCollapse InitialMarginBeforeCollapse() { |
1119 return kMarginCollapseCollapse; | 1129 return kMarginCollapseCollapse; |
1120 } | 1130 } |
1121 EMarginCollapse MarginAfterCollapse() const { | 1131 EMarginCollapse MarginAfterCollapse() const { |
1122 return static_cast<EMarginCollapse>( | 1132 return static_cast<EMarginCollapse>( |
1123 rare_non_inherited_data_->margin_after_collapse); | 1133 rare_non_inherited_data_->margin_after_collapse); |
1124 } | 1134 } |
1125 void SetMarginBeforeCollapse(EMarginCollapse c) { | 1135 void SetMarginBeforeCollapse(EMarginCollapse c) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 return rare_non_inherited_data_->outline_.Offset(); | 1299 return rare_non_inherited_data_->outline_.Offset(); |
1290 } | 1300 } |
1291 void SetOutlineOffset(int v) { | 1301 void SetOutlineOffset(int v) { |
1292 SET_VAR(rare_non_inherited_data_, outline_.offset_, v); | 1302 SET_VAR(rare_non_inherited_data_, outline_.offset_, v); |
1293 } | 1303 } |
1294 | 1304 |
1295 // Padding properties. | 1305 // Padding properties. |
1296 | 1306 |
1297 // padding-bottom | 1307 // padding-bottom |
1298 static Length InitialPaddingBottom() { return Length(kFixed); } | 1308 static Length InitialPaddingBottom() { return Length(kFixed); } |
1299 const Length& PaddingBottom() const { return surround_->padding_bottom_; } | 1309 const Length& PaddingBottom() const { |
| 1310 return surround_data_->padding_bottom_; |
| 1311 } |
1300 void SetPaddingBottom(const Length& v) { | 1312 void SetPaddingBottom(const Length& v) { |
1301 SET_VAR(surround_, padding_bottom_, v); | 1313 SET_VAR(surround_data_, padding_bottom_, v); |
1302 } | 1314 } |
1303 | 1315 |
1304 // padding-left | 1316 // padding-left |
1305 static Length InitialPaddingLeft() { return Length(kFixed); } | 1317 static Length InitialPaddingLeft() { return Length(kFixed); } |
1306 const Length& PaddingLeft() const { return surround_->padding_left_; } | 1318 const Length& PaddingLeft() const { return surround_data_->padding_left_; } |
1307 void SetPaddingLeft(const Length& v) { SET_VAR(surround_, padding_left_, v); } | 1319 void SetPaddingLeft(const Length& v) { |
| 1320 SET_VAR(surround_data_, padding_left_, v); |
| 1321 } |
1308 | 1322 |
1309 // padding-right | 1323 // padding-right |
1310 static Length InitialPaddingRight() { return Length(kFixed); } | 1324 static Length InitialPaddingRight() { return Length(kFixed); } |
1311 const Length& PaddingRight() const { return surround_->padding_right_; } | 1325 const Length& PaddingRight() const { return surround_data_->padding_right_; } |
1312 void SetPaddingRight(const Length& v) { | 1326 void SetPaddingRight(const Length& v) { |
1313 SET_VAR(surround_, padding_right_, v); | 1327 SET_VAR(surround_data_, padding_right_, v); |
1314 } | 1328 } |
1315 | 1329 |
1316 // padding-top | 1330 // padding-top |
1317 static Length InitialPaddingTop() { return Length(kFixed); } | 1331 static Length InitialPaddingTop() { return Length(kFixed); } |
1318 const Length& PaddingTop() const { return surround_->padding_top_; } | 1332 const Length& PaddingTop() const { return surround_data_->padding_top_; } |
1319 void SetPaddingTop(const Length& v) { SET_VAR(surround_, padding_top_, v); } | 1333 void SetPaddingTop(const Length& v) { |
| 1334 SET_VAR(surround_data_, padding_top_, v); |
| 1335 } |
1320 | 1336 |
1321 // perspective (aka -webkit-perspective) | 1337 // perspective (aka -webkit-perspective) |
1322 static float InitialPerspective() { return 0; } | 1338 static float InitialPerspective() { return 0; } |
1323 float Perspective() const { return rare_non_inherited_data_->perspective_; } | 1339 float Perspective() const { return rare_non_inherited_data_->perspective_; } |
1324 void SetPerspective(float p) { | 1340 void SetPerspective(float p) { |
1325 SET_VAR(rare_non_inherited_data_, perspective_, p); | 1341 SET_VAR(rare_non_inherited_data_, perspective_, p); |
1326 } | 1342 } |
1327 | 1343 |
1328 // perspective-origin (aka -webkit-perspective-origin) | 1344 // perspective-origin (aka -webkit-perspective-origin) |
1329 static LengthPoint InitialPerspectiveOrigin() { | 1345 static LengthPoint InitialPerspectiveOrigin() { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 SET_VAR(rare_non_inherited_data_, page_size_, s); | 1575 SET_VAR(rare_non_inherited_data_, page_size_, s); |
1560 } | 1576 } |
1561 void SetPageSizeType(PageSizeType t) { | 1577 void SetPageSizeType(PageSizeType t) { |
1562 SET_VAR(rare_non_inherited_data_, page_size_type_, t); | 1578 SET_VAR(rare_non_inherited_data_, page_size_type_, t); |
1563 } | 1579 } |
1564 | 1580 |
1565 // Text decoration properties. | 1581 // Text decoration properties. |
1566 // text-decoration-line | 1582 // text-decoration-line |
1567 static TextDecoration InitialTextDecoration() { return kTextDecorationNone; } | 1583 static TextDecoration InitialTextDecoration() { return kTextDecorationNone; } |
1568 TextDecoration GetTextDecoration() const { | 1584 TextDecoration GetTextDecoration() const { |
1569 return static_cast<TextDecoration>(visual_->text_decoration); | 1585 return static_cast<TextDecoration>(visual_data_->text_decoration); |
1570 } | 1586 } |
1571 void SetTextDecoration(TextDecoration v) { | 1587 void SetTextDecoration(TextDecoration v) { |
1572 SET_VAR(visual_, text_decoration, v); | 1588 SET_VAR(visual_data_, text_decoration, v); |
1573 } | 1589 } |
1574 | 1590 |
1575 // text-decoration-color | 1591 // text-decoration-color |
1576 void SetTextDecorationColor(const StyleColor& c) { | 1592 void SetTextDecorationColor(const StyleColor& c) { |
1577 SET_VAR(rare_non_inherited_data_, text_decoration_color_, c); | 1593 SET_VAR(rare_non_inherited_data_, text_decoration_color_, c); |
1578 } | 1594 } |
1579 | 1595 |
1580 // text-decoration-style | 1596 // text-decoration-style |
1581 static TextDecorationStyle InitialTextDecorationStyle() { | 1597 static TextDecorationStyle InitialTextDecorationStyle() { |
1582 return kTextDecorationStyleSolid; | 1598 return kTextDecorationStyleSolid; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 } | 1645 } |
1630 void SetTouchAction(TouchAction t) { | 1646 void SetTouchAction(TouchAction t) { |
1631 SET_VAR(rare_non_inherited_data_, touch_action_, t); | 1647 SET_VAR(rare_non_inherited_data_, touch_action_, t); |
1632 } | 1648 } |
1633 | 1649 |
1634 // vertical-align | 1650 // vertical-align |
1635 static EVerticalAlign InitialVerticalAlign() { | 1651 static EVerticalAlign InitialVerticalAlign() { |
1636 return EVerticalAlign::kBaseline; | 1652 return EVerticalAlign::kBaseline; |
1637 } | 1653 } |
1638 EVerticalAlign VerticalAlign() const { return VerticalAlignInternal(); } | 1654 EVerticalAlign VerticalAlign() const { return VerticalAlignInternal(); } |
1639 const Length& GetVerticalAlignLength() const { return box_->VerticalAlign(); } | 1655 const Length& GetVerticalAlignLength() const { |
| 1656 return box_data_->VerticalAlign(); |
| 1657 } |
1640 void SetVerticalAlign(EVerticalAlign v) { SetVerticalAlignInternal(v); } | 1658 void SetVerticalAlign(EVerticalAlign v) { SetVerticalAlignInternal(v); } |
1641 void SetVerticalAlignLength(const Length& length) { | 1659 void SetVerticalAlignLength(const Length& length) { |
1642 SetVerticalAlignInternal(EVerticalAlign::kLength); | 1660 SetVerticalAlignInternal(EVerticalAlign::kLength); |
1643 SET_VAR(box_, vertical_align_, length); | 1661 SET_VAR(box_data_, vertical_align_, length); |
1644 } | 1662 } |
1645 | 1663 |
1646 // will-change | 1664 // will-change |
1647 const Vector<CSSPropertyID>& WillChangeProperties() const { | 1665 const Vector<CSSPropertyID>& WillChangeProperties() const { |
1648 return rare_non_inherited_data_->will_change_->properties_; | 1666 return rare_non_inherited_data_->will_change_->properties_; |
1649 } | 1667 } |
1650 bool WillChangeContents() const { | 1668 bool WillChangeContents() const { |
1651 return rare_non_inherited_data_->will_change_->contents_; | 1669 return rare_non_inherited_data_->will_change_->contents_; |
1652 } | 1670 } |
1653 bool WillChangeScrollPosition() const { | 1671 bool WillChangeScrollPosition() const { |
(...skipping 10 matching lines...) Expand all Loading... |
1664 SET_NESTED_VAR(rare_non_inherited_data_, will_change_, contents_, b); | 1682 SET_NESTED_VAR(rare_non_inherited_data_, will_change_, contents_, b); |
1665 } | 1683 } |
1666 void SetWillChangeScrollPosition(bool b) { | 1684 void SetWillChangeScrollPosition(bool b) { |
1667 SET_NESTED_VAR(rare_non_inherited_data_, will_change_, scroll_position_, b); | 1685 SET_NESTED_VAR(rare_non_inherited_data_, will_change_, scroll_position_, b); |
1668 } | 1686 } |
1669 void SetSubtreeWillChangeContents(bool b) { | 1687 void SetSubtreeWillChangeContents(bool b) { |
1670 SET_VAR(rare_inherited_data_, subtree_will_change_contents_, b); | 1688 SET_VAR(rare_inherited_data_, subtree_will_change_contents_, b); |
1671 } | 1689 } |
1672 | 1690 |
1673 // z-index | 1691 // z-index |
1674 int ZIndex() const { return box_->ZIndex(); } | 1692 int ZIndex() const { return box_data_->ZIndex(); } |
1675 bool HasAutoZIndex() const { return box_->HasAutoZIndex(); } | 1693 bool HasAutoZIndex() const { return box_data_->HasAutoZIndex(); } |
1676 void SetZIndex(int v) { | 1694 void SetZIndex(int v) { |
1677 SET_VAR(box_, has_auto_z_index_, false); | 1695 SET_VAR(box_data_, has_auto_z_index_, false); |
1678 SET_VAR(box_, z_index_, v); | 1696 SET_VAR(box_data_, z_index_, v); |
1679 } | 1697 } |
1680 void SetHasAutoZIndex() { | 1698 void SetHasAutoZIndex() { |
1681 SET_VAR(box_, has_auto_z_index_, true); | 1699 SET_VAR(box_data_, has_auto_z_index_, true); |
1682 SET_VAR(box_, z_index_, 0); | 1700 SET_VAR(box_data_, z_index_, 0); |
1683 } | 1701 } |
1684 | 1702 |
1685 // zoom | 1703 // zoom |
1686 static float InitialZoom() { return 1.0f; } | 1704 static float InitialZoom() { return 1.0f; } |
1687 float Zoom() const { return visual_->zoom_; } | 1705 float Zoom() const { return visual_data_->zoom_; } |
1688 float EffectiveZoom() const { return rare_inherited_data_->effective_zoom_; } | 1706 float EffectiveZoom() const { return rare_inherited_data_->effective_zoom_; } |
1689 bool SetZoom(float); | 1707 bool SetZoom(float); |
1690 bool SetEffectiveZoom(float); | 1708 bool SetEffectiveZoom(float); |
1691 | 1709 |
1692 // -webkit-app-region | 1710 // -webkit-app-region |
1693 DraggableRegionMode GetDraggableRegionMode() const { | 1711 DraggableRegionMode GetDraggableRegionMode() const { |
1694 return rare_non_inherited_data_->draggable_region_mode_; | 1712 return rare_non_inherited_data_->draggable_region_mode_; |
1695 } | 1713 } |
1696 void SetDraggableRegionMode(DraggableRegionMode v) { | 1714 void SetDraggableRegionMode(DraggableRegionMode v) { |
1697 SET_VAR(rare_non_inherited_data_, draggable_region_mode_, v); | 1715 SET_VAR(rare_non_inherited_data_, draggable_region_mode_, v); |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2793 | 2811 |
2794 // Width/height utility functions. | 2812 // Width/height utility functions. |
2795 const Length& LogicalWidth() const { | 2813 const Length& LogicalWidth() const { |
2796 return IsHorizontalWritingMode() ? Width() : Height(); | 2814 return IsHorizontalWritingMode() ? Width() : Height(); |
2797 } | 2815 } |
2798 const Length& LogicalHeight() const { | 2816 const Length& LogicalHeight() const { |
2799 return IsHorizontalWritingMode() ? Height() : Width(); | 2817 return IsHorizontalWritingMode() ? Height() : Width(); |
2800 } | 2818 } |
2801 void SetLogicalWidth(const Length& v) { | 2819 void SetLogicalWidth(const Length& v) { |
2802 if (IsHorizontalWritingMode()) { | 2820 if (IsHorizontalWritingMode()) { |
2803 SET_VAR(box_, width_, v); | 2821 SET_VAR(box_data_, width_, v); |
2804 } else { | 2822 } else { |
2805 SET_VAR(box_, height_, v); | 2823 SET_VAR(box_data_, height_, v); |
2806 } | 2824 } |
2807 } | 2825 } |
2808 | 2826 |
2809 void SetLogicalHeight(const Length& v) { | 2827 void SetLogicalHeight(const Length& v) { |
2810 if (IsHorizontalWritingMode()) { | 2828 if (IsHorizontalWritingMode()) { |
2811 SET_VAR(box_, height_, v); | 2829 SET_VAR(box_data_, height_, v); |
2812 } else { | 2830 } else { |
2813 SET_VAR(box_, width_, v); | 2831 SET_VAR(box_data_, width_, v); |
2814 } | 2832 } |
2815 } | 2833 } |
2816 const Length& LogicalMaxWidth() const { | 2834 const Length& LogicalMaxWidth() const { |
2817 return IsHorizontalWritingMode() ? MaxWidth() : MaxHeight(); | 2835 return IsHorizontalWritingMode() ? MaxWidth() : MaxHeight(); |
2818 } | 2836 } |
2819 const Length& LogicalMaxHeight() const { | 2837 const Length& LogicalMaxHeight() const { |
2820 return IsHorizontalWritingMode() ? MaxHeight() : MaxWidth(); | 2838 return IsHorizontalWritingMode() ? MaxHeight() : MaxWidth(); |
2821 } | 2839 } |
2822 const Length& LogicalMinWidth() const { | 2840 const Length& LogicalMinWidth() const { |
2823 return IsHorizontalWritingMode() ? MinWidth() : MinHeight(); | 2841 return IsHorizontalWritingMode() ? MinWidth() : MinHeight(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2891 return LengthBox::Over(GetWritingMode(), PaddingTop(), PaddingRight()); | 2909 return LengthBox::Over(GetWritingMode(), PaddingTop(), PaddingRight()); |
2892 } | 2910 } |
2893 const Length& PaddingUnder() const { | 2911 const Length& PaddingUnder() const { |
2894 return LengthBox::Under(GetWritingMode(), PaddingBottom(), PaddingLeft()); | 2912 return LengthBox::Under(GetWritingMode(), PaddingBottom(), PaddingLeft()); |
2895 } | 2913 } |
2896 bool HasPadding() const { | 2914 bool HasPadding() const { |
2897 return !PaddingLeft().IsZero() || !PaddingRight().IsZero() || | 2915 return !PaddingLeft().IsZero() || !PaddingRight().IsZero() || |
2898 !PaddingTop().IsZero() || !PaddingBottom().IsZero(); | 2916 !PaddingTop().IsZero() || !PaddingBottom().IsZero(); |
2899 } | 2917 } |
2900 void ResetPadding() { | 2918 void ResetPadding() { |
2901 SET_VAR(surround_, padding_top_, kFixed); | 2919 SET_VAR(surround_data_, padding_top_, kFixed); |
2902 SET_VAR(surround_, padding_bottom_, kFixed); | 2920 SET_VAR(surround_data_, padding_bottom_, kFixed); |
2903 SET_VAR(surround_, padding_left_, kFixed); | 2921 SET_VAR(surround_data_, padding_left_, kFixed); |
2904 SET_VAR(surround_, padding_right_, kFixed); | 2922 SET_VAR(surround_data_, padding_right_, kFixed); |
2905 } | 2923 } |
2906 void SetPadding(const LengthBox& b) { | 2924 void SetPadding(const LengthBox& b) { |
2907 SET_VAR(surround_, padding_top_, b.top_); | 2925 SET_VAR(surround_data_, padding_top_, b.top_); |
2908 SET_VAR(surround_, padding_bottom_, b.bottom_); | 2926 SET_VAR(surround_data_, padding_bottom_, b.bottom_); |
2909 SET_VAR(surround_, padding_left_, b.left_); | 2927 SET_VAR(surround_data_, padding_left_, b.left_); |
2910 SET_VAR(surround_, padding_right_, b.right_); | 2928 SET_VAR(surround_data_, padding_right_, b.right_); |
2911 } | 2929 } |
2912 bool PaddingEqual(const ComputedStyle& other) const { | 2930 bool PaddingEqual(const ComputedStyle& other) const { |
2913 return PaddingTop() == other.PaddingTop() && | 2931 return PaddingTop() == other.PaddingTop() && |
2914 PaddingLeft() == other.PaddingLeft() && | 2932 PaddingLeft() == other.PaddingLeft() && |
2915 PaddingRight() == other.PaddingRight() && | 2933 PaddingRight() == other.PaddingRight() && |
2916 PaddingBottom() == other.PaddingBottom(); | 2934 PaddingBottom() == other.PaddingBottom(); |
2917 } | 2935 } |
2918 bool PaddingEqual(const LengthBox& other) const { | 2936 bool PaddingEqual(const LengthBox& other) const { |
2919 return PaddingTop() == other.Top() && PaddingLeft() == other.Left() && | 2937 return PaddingTop() == other.Top() && PaddingLeft() == other.Left() && |
2920 PaddingRight() == other.Right() && PaddingBottom() == other.Bottom(); | 2938 PaddingRight() == other.Right() && PaddingBottom() == other.Bottom(); |
2921 } | 2939 } |
2922 | 2940 |
2923 // Border utility functions | 2941 // Border utility functions |
2924 LayoutRectOutsets ImageOutsets(const NinePieceImage&) const; | 2942 LayoutRectOutsets ImageOutsets(const NinePieceImage&) const; |
2925 bool HasBorderImageOutsets() const { | 2943 bool HasBorderImageOutsets() const { |
2926 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); | 2944 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); |
2927 } | 2945 } |
2928 LayoutRectOutsets BorderImageOutsets() const { | 2946 LayoutRectOutsets BorderImageOutsets() const { |
2929 return ImageOutsets(BorderImage()); | 2947 return ImageOutsets(BorderImage()); |
2930 } | 2948 } |
2931 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } | 2949 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } |
2932 | 2950 |
2933 void SetBorderImageSlicesFill(bool); | 2951 void SetBorderImageSlicesFill(bool); |
2934 const BorderData& Border() const { return surround_->border_; } | 2952 const BorderData& Border() const { return surround_data_->border_; } |
2935 const BorderValue& BorderLeft() const { return surround_->border_.Left(); } | 2953 const BorderValue& BorderLeft() const { |
2936 const BorderValue& BorderRight() const { return surround_->border_.Right(); } | 2954 return surround_data_->border_.Left(); |
2937 const BorderValue& BorderTop() const { return surround_->border_.Top(); } | 2955 } |
| 2956 const BorderValue& BorderRight() const { |
| 2957 return surround_data_->border_.Right(); |
| 2958 } |
| 2959 const BorderValue& BorderTop() const { return surround_data_->border_.Top(); } |
2938 const BorderValue& BorderBottom() const { | 2960 const BorderValue& BorderBottom() const { |
2939 return surround_->border_.Bottom(); | 2961 return surround_data_->border_.Bottom(); |
2940 } | 2962 } |
2941 const BorderValue& BorderBefore() const; | 2963 const BorderValue& BorderBefore() const; |
2942 const BorderValue& BorderAfter() const; | 2964 const BorderValue& BorderAfter() const; |
2943 const BorderValue& BorderStart() const; | 2965 const BorderValue& BorderStart() const; |
2944 const BorderValue& BorderEnd() const; | 2966 const BorderValue& BorderEnd() const; |
2945 float BorderAfterWidth() const; | 2967 float BorderAfterWidth() const; |
2946 float BorderBeforeWidth() const; | 2968 float BorderBeforeWidth() const; |
2947 float BorderEndWidth() const; | 2969 float BorderEndWidth() const; |
2948 float BorderStartWidth() const; | 2970 float BorderStartWidth() const; |
2949 float BorderOverWidth() const; | 2971 float BorderOverWidth() const; |
2950 float BorderUnderWidth() const; | 2972 float BorderUnderWidth() const; |
2951 | 2973 |
2952 bool HasBorderFill() const { return Border().HasBorderFill(); } | 2974 bool HasBorderFill() const { return Border().HasBorderFill(); } |
2953 bool HasBorder() const { return Border().HasBorder(); } | 2975 bool HasBorder() const { return Border().HasBorder(); } |
2954 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); } | 2976 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); } |
2955 bool HasBorderRadius() const { return Border().HasBorderRadius(); } | 2977 bool HasBorderRadius() const { return Border().HasBorderRadius(); } |
2956 | 2978 |
2957 void ResetBorder() { | 2979 void ResetBorder() { |
2958 ResetBorderImage(); | 2980 ResetBorderImage(); |
2959 ResetBorderTop(); | 2981 ResetBorderTop(); |
2960 ResetBorderRight(); | 2982 ResetBorderRight(); |
2961 ResetBorderBottom(); | 2983 ResetBorderBottom(); |
2962 ResetBorderLeft(); | 2984 ResetBorderLeft(); |
2963 ResetBorderTopLeftRadius(); | 2985 ResetBorderTopLeftRadius(); |
2964 ResetBorderTopRightRadius(); | 2986 ResetBorderTopRightRadius(); |
2965 ResetBorderBottomLeftRadius(); | 2987 ResetBorderBottomLeftRadius(); |
2966 ResetBorderBottomRightRadius(); | 2988 ResetBorderBottomRightRadius(); |
2967 } | 2989 } |
2968 void ResetBorderTop() { SET_VAR(surround_, border_.top_, BorderValue()); } | 2990 void ResetBorderTop() { |
2969 void ResetBorderRight() { SET_VAR(surround_, border_.right_, BorderValue()); } | 2991 SET_VAR(surround_data_, border_.top_, BorderValue()); |
| 2992 } |
| 2993 void ResetBorderRight() { |
| 2994 SET_VAR(surround_data_, border_.right_, BorderValue()); |
| 2995 } |
2970 void ResetBorderBottom() { | 2996 void ResetBorderBottom() { |
2971 SET_VAR(surround_, border_.bottom_, BorderValue()); | 2997 SET_VAR(surround_data_, border_.bottom_, BorderValue()); |
2972 } | 2998 } |
2973 void ResetBorderLeft() { SET_VAR(surround_, border_.left_, BorderValue()); } | 2999 void ResetBorderLeft() { |
| 3000 SET_VAR(surround_data_, border_.left_, BorderValue()); |
| 3001 } |
2974 void ResetBorderImage() { | 3002 void ResetBorderImage() { |
2975 SET_VAR(surround_, border_.image_, NinePieceImage()); | 3003 SET_VAR(surround_data_, border_.image_, NinePieceImage()); |
2976 } | 3004 } |
2977 void ResetBorderTopLeftRadius() { | 3005 void ResetBorderTopLeftRadius() { |
2978 SET_VAR(surround_, border_.top_left_, InitialBorderRadius()); | 3006 SET_VAR(surround_data_, border_.top_left_, InitialBorderRadius()); |
2979 } | 3007 } |
2980 void ResetBorderTopRightRadius() { | 3008 void ResetBorderTopRightRadius() { |
2981 SET_VAR(surround_, border_.top_right_, InitialBorderRadius()); | 3009 SET_VAR(surround_data_, border_.top_right_, InitialBorderRadius()); |
2982 } | 3010 } |
2983 void ResetBorderBottomLeftRadius() { | 3011 void ResetBorderBottomLeftRadius() { |
2984 SET_VAR(surround_, border_.bottom_left_, InitialBorderRadius()); | 3012 SET_VAR(surround_data_, border_.bottom_left_, InitialBorderRadius()); |
2985 } | 3013 } |
2986 void ResetBorderBottomRightRadius() { | 3014 void ResetBorderBottomRightRadius() { |
2987 SET_VAR(surround_, border_.bottom_right_, InitialBorderRadius()); | 3015 SET_VAR(surround_data_, border_.bottom_right_, InitialBorderRadius()); |
2988 } | 3016 } |
2989 | 3017 |
2990 void SetBorderRadius(const LengthSize& s) { | 3018 void SetBorderRadius(const LengthSize& s) { |
2991 SetBorderTopLeftRadius(s); | 3019 SetBorderTopLeftRadius(s); |
2992 SetBorderTopRightRadius(s); | 3020 SetBorderTopRightRadius(s); |
2993 SetBorderBottomLeftRadius(s); | 3021 SetBorderBottomLeftRadius(s); |
2994 SetBorderBottomRightRadius(s); | 3022 SetBorderBottomRightRadius(s); |
2995 } | 3023 } |
2996 void SetBorderRadius(const IntSize& s) { | 3024 void SetBorderRadius(const IntSize& s) { |
2997 SetBorderRadius( | 3025 SetBorderRadius( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3053 bool HasInFlowPosition() const { | 3081 bool HasInFlowPosition() const { |
3054 return GetPosition() == EPosition::kRelative || | 3082 return GetPosition() == EPosition::kRelative || |
3055 GetPosition() == EPosition::kSticky; | 3083 GetPosition() == EPosition::kSticky; |
3056 } | 3084 } |
3057 bool HasViewportConstrainedPosition() const { | 3085 bool HasViewportConstrainedPosition() const { |
3058 return GetPosition() == EPosition::kFixed || | 3086 return GetPosition() == EPosition::kFixed || |
3059 GetPosition() == EPosition::kSticky; | 3087 GetPosition() == EPosition::kSticky; |
3060 } | 3088 } |
3061 | 3089 |
3062 // Clip utility functions. | 3090 // Clip utility functions. |
3063 const Length& ClipLeft() const { return visual_->clip.Left(); } | 3091 const Length& ClipLeft() const { return visual_data_->clip.Left(); } |
3064 const Length& ClipRight() const { return visual_->clip.Right(); } | 3092 const Length& ClipRight() const { return visual_data_->clip.Right(); } |
3065 const Length& ClipTop() const { return visual_->clip.Top(); } | 3093 const Length& ClipTop() const { return visual_data_->clip.Top(); } |
3066 const Length& ClipBottom() const { return visual_->clip.Bottom(); } | 3094 const Length& ClipBottom() const { return visual_data_->clip.Bottom(); } |
3067 | 3095 |
3068 // Offset utility functions. | 3096 // Offset utility functions. |
3069 // Accessors for positioned object edges that take into account writing mode. | 3097 // Accessors for positioned object edges that take into account writing mode. |
3070 const Length& LogicalLeft() const { | 3098 const Length& LogicalLeft() const { |
3071 return LengthBox::LogicalLeft(GetWritingMode(), Left(), Top()); | 3099 return LengthBox::LogicalLeft(GetWritingMode(), Left(), Top()); |
3072 } | 3100 } |
3073 const Length& LogicalRight() const { | 3101 const Length& LogicalRight() const { |
3074 return LengthBox::LogicalRight(GetWritingMode(), Right(), Bottom()); | 3102 return LengthBox::LogicalRight(GetWritingMode(), Right(), Bottom()); |
3075 } | 3103 } |
3076 const Length& LogicalTop() const { | 3104 const Length& LogicalTop() const { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3236 enum ApplyTransformOrigin { | 3264 enum ApplyTransformOrigin { |
3237 kIncludeTransformOrigin, | 3265 kIncludeTransformOrigin, |
3238 kExcludeTransformOrigin | 3266 kExcludeTransformOrigin |
3239 }; | 3267 }; |
3240 enum ApplyMotionPath { kIncludeMotionPath, kExcludeMotionPath }; | 3268 enum ApplyMotionPath { kIncludeMotionPath, kExcludeMotionPath }; |
3241 enum ApplyIndependentTransformProperties { | 3269 enum ApplyIndependentTransformProperties { |
3242 kIncludeIndependentTransformProperties, | 3270 kIncludeIndependentTransformProperties, |
3243 kExcludeIndependentTransformProperties | 3271 kExcludeIndependentTransformProperties |
3244 }; | 3272 }; |
3245 void ApplyTransform(TransformationMatrix&, | 3273 void ApplyTransform(TransformationMatrix&, |
3246 const LayoutSize& border_box_size, | 3274 const LayoutSize& border_box_data_size, |
3247 ApplyTransformOrigin, | 3275 ApplyTransformOrigin, |
3248 ApplyMotionPath, | 3276 ApplyMotionPath, |
3249 ApplyIndependentTransformProperties) const; | 3277 ApplyIndependentTransformProperties) const; |
3250 void ApplyTransform(TransformationMatrix&, | 3278 void ApplyTransform(TransformationMatrix&, |
3251 const FloatRect& bounding_box, | 3279 const FloatRect& bounding_box, |
3252 ApplyTransformOrigin, | 3280 ApplyTransformOrigin, |
3253 ApplyMotionPath, | 3281 ApplyMotionPath, |
3254 ApplyIndependentTransformProperties) const; | 3282 ApplyIndependentTransformProperties) const; |
3255 | 3283 |
3256 // Returns |true| if any property that renders using filter operations is | 3284 // Returns |true| if any property that renders using filter operations is |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3406 // "Box decoration background" includes all box decorations and backgrounds | 3434 // "Box decoration background" includes all box decorations and backgrounds |
3407 // that are painted as the background of the object. It includes borders, | 3435 // that are painted as the background of the object. It includes borders, |
3408 // box-shadows, background-color and background-image, etc. | 3436 // box-shadows, background-color and background-image, etc. |
3409 bool HasBoxDecorationBackground() const { | 3437 bool HasBoxDecorationBackground() const { |
3410 return HasBackground() || HasBorderDecoration() || HasAppearance() || | 3438 return HasBackground() || HasBorderDecoration() || HasAppearance() || |
3411 BoxShadow(); | 3439 BoxShadow(); |
3412 } | 3440 } |
3413 | 3441 |
3414 // Background utility functions. | 3442 // Background utility functions. |
3415 FillLayer& AccessBackgroundLayers() { | 3443 FillLayer& AccessBackgroundLayers() { |
3416 return background_.Access()->background_; | 3444 return background_data_.Access()->background_; |
3417 } | 3445 } |
3418 const FillLayer& BackgroundLayers() const { | 3446 const FillLayer& BackgroundLayers() const { |
3419 return background_->Background(); | 3447 return background_data_->Background(); |
3420 } | 3448 } |
3421 void AdjustBackgroundLayers() { | 3449 void AdjustBackgroundLayers() { |
3422 if (BackgroundLayers().Next()) { | 3450 if (BackgroundLayers().Next()) { |
3423 AccessBackgroundLayers().CullEmptyLayers(); | 3451 AccessBackgroundLayers().CullEmptyLayers(); |
3424 AccessBackgroundLayers().FillUnsetProperties(); | 3452 AccessBackgroundLayers().FillUnsetProperties(); |
3425 } | 3453 } |
3426 } | 3454 } |
3427 bool HasBackgroundRelatedColorReferencingCurrentColor() const { | 3455 bool HasBackgroundRelatedColorReferencingCurrentColor() const { |
3428 if (BackgroundColor().IsCurrentColor() || | 3456 if (BackgroundColor().IsCurrentColor() || |
3429 VisitedLinkBackgroundColor().IsCurrentColor()) | 3457 VisitedLinkBackgroundColor().IsCurrentColor()) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3533 display == EDisplay::kTableRow || | 3561 display == EDisplay::kTableRow || |
3534 display == EDisplay::kTableColumnGroup || | 3562 display == EDisplay::kTableColumnGroup || |
3535 display == EDisplay::kTableColumn || | 3563 display == EDisplay::kTableColumn || |
3536 display == EDisplay::kTableCell || | 3564 display == EDisplay::kTableCell || |
3537 display == EDisplay::kTableCaption; | 3565 display == EDisplay::kTableCaption; |
3538 } | 3566 } |
3539 | 3567 |
3540 // Color accessors are all private to make sure callers use | 3568 // Color accessors are all private to make sure callers use |
3541 // VisitedDependentColor instead to access them. | 3569 // VisitedDependentColor instead to access them. |
3542 StyleColor BorderLeftColor() const { | 3570 StyleColor BorderLeftColor() const { |
3543 return surround_->border_.Left().GetColor(); | 3571 return surround_data_->border_.Left().GetColor(); |
3544 } | 3572 } |
3545 StyleColor BorderRightColor() const { | 3573 StyleColor BorderRightColor() const { |
3546 return surround_->border_.Right().GetColor(); | 3574 return surround_data_->border_.Right().GetColor(); |
3547 } | 3575 } |
3548 StyleColor BorderTopColor() const { | 3576 StyleColor BorderTopColor() const { |
3549 return surround_->border_.Top().GetColor(); | 3577 return surround_data_->border_.Top().GetColor(); |
3550 } | 3578 } |
3551 StyleColor BorderBottomColor() const { | 3579 StyleColor BorderBottomColor() const { |
3552 return surround_->border_.Bottom().GetColor(); | 3580 return surround_data_->border_.Bottom().GetColor(); |
3553 } | 3581 } |
3554 StyleColor BackgroundColor() const { return background_->GetColor(); } | 3582 StyleColor BackgroundColor() const { return background_data_->GetColor(); } |
3555 StyleAutoColor CaretColor() const { | 3583 StyleAutoColor CaretColor() const { |
3556 return rare_inherited_data_->CaretColor(); | 3584 return rare_inherited_data_->CaretColor(); |
3557 } | 3585 } |
3558 Color GetColor() const; | 3586 Color GetColor() const; |
3559 StyleColor ColumnRuleColor() const { | 3587 StyleColor ColumnRuleColor() const { |
3560 return rare_non_inherited_data_->multi_col_->rule_.GetColor(); | 3588 return rare_non_inherited_data_->multi_col_->rule_.GetColor(); |
3561 } | 3589 } |
3562 StyleColor OutlineColor() const { | 3590 StyleColor OutlineColor() const { |
3563 return rare_non_inherited_data_->outline_.GetColor(); | 3591 return rare_non_inherited_data_->outline_.GetColor(); |
3564 } | 3592 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3681 float zoom_factor) { | 3709 float zoom_factor) { |
3682 return scroll_offset / zoom_factor; | 3710 return scroll_offset / zoom_factor; |
3683 } | 3711 } |
3684 | 3712 |
3685 inline float AdjustScrollForAbsoluteZoom(float scroll_offset, | 3713 inline float AdjustScrollForAbsoluteZoom(float scroll_offset, |
3686 const ComputedStyle& style) { | 3714 const ComputedStyle& style) { |
3687 return AdjustScrollForAbsoluteZoom(scroll_offset, style.EffectiveZoom()); | 3715 return AdjustScrollForAbsoluteZoom(scroll_offset, style.EffectiveZoom()); |
3688 } | 3716 } |
3689 | 3717 |
3690 inline bool ComputedStyle::SetZoom(float f) { | 3718 inline bool ComputedStyle::SetZoom(float f) { |
3691 if (compareEqual(visual_->zoom_, f)) | 3719 if (compareEqual(visual_data_->zoom_, f)) |
3692 return false; | 3720 return false; |
3693 visual_.Access()->zoom_ = f; | 3721 visual_data_.Access()->zoom_ = f; |
3694 SetEffectiveZoom(EffectiveZoom() * Zoom()); | 3722 SetEffectiveZoom(EffectiveZoom() * Zoom()); |
3695 return true; | 3723 return true; |
3696 } | 3724 } |
3697 | 3725 |
3698 inline bool ComputedStyle::SetEffectiveZoom(float f) { | 3726 inline bool ComputedStyle::SetEffectiveZoom(float f) { |
3699 // Clamp the effective zoom value to a smaller (but hopeful still large | 3727 // Clamp the effective zoom value to a smaller (but hopeful still large |
3700 // enough) range, to avoid overflow in derived computations. | 3728 // enough) range, to avoid overflow in derived computations. |
3701 float clamped_effective_zoom = clampTo<float>(f, 1e-6, 1e6); | 3729 float clamped_effective_zoom = clampTo<float>(f, 1e-6, 1e6); |
3702 if (compareEqual(rare_inherited_data_->effective_zoom_, | 3730 if (compareEqual(rare_inherited_data_->effective_zoom_, |
3703 clamped_effective_zoom)) | 3731 clamped_effective_zoom)) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3741 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); | 3769 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); |
3742 } | 3770 } |
3743 | 3771 |
3744 inline bool ComputedStyle::HasPseudoElementStyle() const { | 3772 inline bool ComputedStyle::HasPseudoElementStyle() const { |
3745 return PseudoBitsInternal() & kElementPseudoIdMask; | 3773 return PseudoBitsInternal() & kElementPseudoIdMask; |
3746 } | 3774 } |
3747 | 3775 |
3748 } // namespace blink | 3776 } // namespace blink |
3749 | 3777 |
3750 #endif // ComputedStyle_h | 3778 #endif // ComputedStyle_h |
OLD | NEW |