Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.17 KB | None | 0 0
  1. // Copyright (c) 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4.  
  5. #ifndef ComputedStyleBase_h
  6. #define ComputedStyleBase_h
  7.  
  8. #include "core/style/ComputedStyleConstants.h"
  9. #include "core/CoreExport.h"
  10. #include "core/style/DataRef.h"
  11. #include "core/css/StyleColor.h"
  12. #include "core/style/BorderData.h"
  13. #include "core/style/FillLayer.h"
  14. #include "platform/Length.h"
  15. #include "platform/text/TextDirection.h"
  16. #include "platform/text/UnicodeBidi.h"
  17. #include "platform/text/WritingMode.h"
  18.  
  19.  
  20. namespace blink {
  21.  
  22. // The generated portion of ComputedStyle. For more info, see the header comment
  23. // in ComputedStyle.h.
  24. class CORE_EXPORT ComputedStyleBase {
  25. public:
  26. inline bool IndependentInheritedEqual(const ComputedStyleBase& o) const {
  27. return (
  28. pointer_events_ == o.pointer_events_ &&
  29. text_align_ == o.text_align_ &&
  30. white_space_ == o.white_space_ &&
  31. text_transform_ == o.text_transform_ &&
  32. visibility_ == o.visibility_ &&
  33. border_collapse_ == o.border_collapse_ &&
  34. box_direction_ == o.box_direction_ &&
  35. caption_side_ == o.caption_side_ &&
  36. empty_cells_ == o.empty_cells_ &&
  37. list_style_position_ == o.list_style_position_ &&
  38. print_color_adjust_ == o.print_color_adjust_ &&
  39. rtl_ordering_ == o.rtl_ordering_ &&
  40. true
  41. );
  42. }
  43.  
  44. inline bool NonIndependentInheritedEqual(const ComputedStyleBase& o) const {
  45. return (
  46. cursor_ == o.cursor_ &&
  47. list_style_type_ == o.list_style_type_ &&
  48. inside_link_ == o.inside_link_ &&
  49. writing_mode_ == o.writing_mode_ &&
  50. direction_ == o.direction_ &&
  51. has_simple_underline_ == o.has_simple_underline_ &&
  52. true
  53. );
  54. }
  55.  
  56. inline bool InheritedEqual(const ComputedStyleBase& o) const {
  57. return IndependentInheritedEqual(o) && NonIndependentInheritedEqual(o);
  58. }
  59.  
  60. inline bool NonInheritedEqual(const ComputedStyleBase& o) const {
  61. return (
  62. background_data_ == o.background_data_ &&
  63. surround_data_ == o.surround_data_ &&
  64. display_ == o.display_ &&
  65. original_display_ == o.original_display_ &&
  66. break_after_ == o.break_after_ &&
  67. break_before_ == o.break_before_ &&
  68. vertical_align_ == o.vertical_align_ &&
  69. overflow_x_ == o.overflow_x_ &&
  70. overflow_y_ == o.overflow_y_ &&
  71. position_ == o.position_ &&
  72. unicode_bidi_ == o.unicode_bidi_ &&
  73. break_inside_ == o.break_inside_ &&
  74. clear_ == o.clear_ &&
  75. floating_ == o.floating_ &&
  76. overflow_anchor_ == o.overflow_anchor_ &&
  77. transform_box_ == o.transform_box_ &&
  78. table_layout_ == o.table_layout_ &&
  79. true
  80. );
  81. }
  82.  
  83. enum IsAtShadowBoundary {
  84. kAtShadowBoundary,
  85. kNotAtShadowBoundary,
  86. };
  87. void InheritFrom(const ComputedStyleBase& inheritParent,
  88. IsAtShadowBoundary isAtShadowBoundary = kNotAtShadowBoundary);
  89.  
  90. void CopyNonInheritedFromCached(const ComputedStyleBase& other);
  91.  
  92. // Copies the values of any independent inherited properties from the parent
  93. // style that are marked as inherited by this style.
  94. void PropagateIndependentInheritedProperties(
  95. const ComputedStyleBase& parentStyle);
  96.  
  97. // Fields.
  98. // TODO(sashab): Remove initialFoo() static methods and update callers to
  99. // use resetFoo(), which can be more efficient.
  100.  
  101. // Background
  102. // Getters and setters not generated
  103.  
  104. // BackgroundColor
  105. // Getters and setters not generated
  106.  
  107. // padding-bottom
  108. inline static Length InitialPaddingBottom() {
  109. return Length(kFixed);
  110. }
  111. const Length& PaddingBottom() const {
  112. return surround_data_->padding_bottom_;
  113. }
  114. void SetPaddingBottom(const Length& v) {
  115. surround_data_.Access()->padding_bottom_ = v;
  116. }
  117. void SetPaddingBottom(Length&& v) {
  118. surround_data_.Access()->padding_bottom_ = std::move(v);
  119. }
  120. inline void ResetPaddingBottom() {
  121. surround_data_.Access()->padding_bottom_ = Length(kFixed);
  122. }
  123.  
  124. // margin-right
  125. inline static Length InitialMarginRight() {
  126. return Length(kFixed);
  127. }
  128. const Length& MarginRight() const {
  129. return surround_data_->margin_right_;
  130. }
  131. void SetMarginRight(const Length& v) {
  132. surround_data_.Access()->margin_right_ = v;
  133. }
  134. void SetMarginRight(Length&& v) {
  135. surround_data_.Access()->margin_right_ = std::move(v);
  136. }
  137. inline void ResetMarginRight() {
  138. surround_data_.Access()->margin_right_ = Length(kFixed);
  139. }
  140.  
  141. // padding-right
  142. inline static Length InitialPaddingRight() {
  143. return Length(kFixed);
  144. }
  145. const Length& PaddingRight() const {
  146. return surround_data_->padding_right_;
  147. }
  148. void SetPaddingRight(const Length& v) {
  149. surround_data_.Access()->padding_right_ = v;
  150. }
  151. void SetPaddingRight(Length&& v) {
  152. surround_data_.Access()->padding_right_ = std::move(v);
  153. }
  154. inline void ResetPaddingRight() {
  155. surround_data_.Access()->padding_right_ = Length(kFixed);
  156. }
  157.  
  158. // bottom
  159. inline static Length InitialBottom() {
  160. return Length();
  161. }
  162. const Length& Bottom() const {
  163. return surround_data_->bottom_;
  164. }
  165. void SetBottom(const Length& v) {
  166. surround_data_.Access()->bottom_ = v;
  167. }
  168. void SetBottom(Length&& v) {
  169. surround_data_.Access()->bottom_ = std::move(v);
  170. }
  171. inline void ResetBottom() {
  172. surround_data_.Access()->bottom_ = Length();
  173. }
  174.  
  175. // top
  176. inline static Length InitialTop() {
  177. return Length();
  178. }
  179. const Length& Top() const {
  180. return surround_data_->top_;
  181. }
  182. void SetTop(const Length& v) {
  183. surround_data_.Access()->top_ = v;
  184. }
  185. void SetTop(Length&& v) {
  186. surround_data_.Access()->top_ = std::move(v);
  187. }
  188. inline void ResetTop() {
  189. surround_data_.Access()->top_ = Length();
  190. }
  191.  
  192. // margin-top
  193. inline static Length InitialMarginTop() {
  194. return Length(kFixed);
  195. }
  196. const Length& MarginTop() const {
  197. return surround_data_->margin_top_;
  198. }
  199. void SetMarginTop(const Length& v) {
  200. surround_data_.Access()->margin_top_ = v;
  201. }
  202. void SetMarginTop(Length&& v) {
  203. surround_data_.Access()->margin_top_ = std::move(v);
  204. }
  205. inline void ResetMarginTop() {
  206. surround_data_.Access()->margin_top_ = Length(kFixed);
  207. }
  208.  
  209. // padding-left
  210. inline static Length InitialPaddingLeft() {
  211. return Length(kFixed);
  212. }
  213. const Length& PaddingLeft() const {
  214. return surround_data_->padding_left_;
  215. }
  216. void SetPaddingLeft(const Length& v) {
  217. surround_data_.Access()->padding_left_ = v;
  218. }
  219. void SetPaddingLeft(Length&& v) {
  220. surround_data_.Access()->padding_left_ = std::move(v);
  221. }
  222. inline void ResetPaddingLeft() {
  223. surround_data_.Access()->padding_left_ = Length(kFixed);
  224. }
  225.  
  226. // left
  227. inline static Length InitialLeft() {
  228. return Length();
  229. }
  230. const Length& Left() const {
  231. return surround_data_->left_;
  232. }
  233. void SetLeft(const Length& v) {
  234. surround_data_.Access()->left_ = v;
  235. }
  236. void SetLeft(Length&& v) {
  237. surround_data_.Access()->left_ = std::move(v);
  238. }
  239. inline void ResetLeft() {
  240. surround_data_.Access()->left_ = Length();
  241. }
  242.  
  243. // margin-bottom
  244. inline static Length InitialMarginBottom() {
  245. return Length(kFixed);
  246. }
  247. const Length& MarginBottom() const {
  248. return surround_data_->margin_bottom_;
  249. }
  250. void SetMarginBottom(const Length& v) {
  251. surround_data_.Access()->margin_bottom_ = v;
  252. }
  253. void SetMarginBottom(Length&& v) {
  254. surround_data_.Access()->margin_bottom_ = std::move(v);
  255. }
  256. inline void ResetMarginBottom() {
  257. surround_data_.Access()->margin_bottom_ = Length(kFixed);
  258. }
  259.  
  260. // right
  261. inline static Length InitialRight() {
  262. return Length();
  263. }
  264. const Length& Right() const {
  265. return surround_data_->right_;
  266. }
  267. void SetRight(const Length& v) {
  268. surround_data_.Access()->right_ = v;
  269. }
  270. void SetRight(Length&& v) {
  271. surround_data_.Access()->right_ = std::move(v);
  272. }
  273. inline void ResetRight() {
  274. surround_data_.Access()->right_ = Length();
  275. }
  276.  
  277. // margin-left
  278. inline static Length InitialMarginLeft() {
  279. return Length(kFixed);
  280. }
  281. const Length& MarginLeft() const {
  282. return surround_data_->margin_left_;
  283. }
  284. void SetMarginLeft(const Length& v) {
  285. surround_data_.Access()->margin_left_ = v;
  286. }
  287. void SetMarginLeft(Length&& v) {
  288. surround_data_.Access()->margin_left_ = std::move(v);
  289. }
  290. inline void ResetMarginLeft() {
  291. surround_data_.Access()->margin_left_ = Length(kFixed);
  292. }
  293.  
  294. // padding-top
  295. inline static Length InitialPaddingTop() {
  296. return Length(kFixed);
  297. }
  298. const Length& PaddingTop() const {
  299. return surround_data_->padding_top_;
  300. }
  301. void SetPaddingTop(const Length& v) {
  302. surround_data_.Access()->padding_top_ = v;
  303. }
  304. void SetPaddingTop(Length&& v) {
  305. surround_data_.Access()->padding_top_ = std::move(v);
  306. }
  307. inline void ResetPaddingTop() {
  308. surround_data_.Access()->padding_top_ = Length(kFixed);
  309. }
  310.  
  311. // border
  312. // Getters and setters not generated
  313.  
  314. // PseudoBits
  315. // Getters and setters not generated
  316.  
  317. // cursor
  318. inline static ECursor InitialCursor() {
  319. return ECursor::kAuto;
  320. }
  321. ECursor Cursor() const {
  322. return static_cast<ECursor>(cursor_);
  323. }
  324. void SetCursor(ECursor v) {
  325. cursor_ = static_cast<unsigned>(v);
  326. }
  327. inline void ResetCursor() {
  328. cursor_ = static_cast<unsigned>(ECursor::kAuto);
  329. }
  330.  
  331. // list-style-type
  332. inline static EListStyleType InitialListStyleType() {
  333. return EListStyleType::kDisc;
  334. }
  335. EListStyleType ListStyleType() const {
  336. return static_cast<EListStyleType>(list_style_type_);
  337. }
  338. void SetListStyleType(EListStyleType v) {
  339. list_style_type_ = static_cast<unsigned>(v);
  340. }
  341. inline void ResetListStyleType() {
  342. list_style_type_ = static_cast<unsigned>(EListStyleType::kDisc);
  343. }
  344.  
  345. // StyleType
  346. // Getters and setters not generated
  347.  
  348. // display
  349. inline static EDisplay InitialDisplay() {
  350. return EDisplay::kInline;
  351. }
  352. EDisplay Display() const {
  353. return static_cast<EDisplay>(display_);
  354. }
  355. void SetDisplay(EDisplay v) {
  356. display_ = static_cast<unsigned>(v);
  357. }
  358. inline void ResetDisplay() {
  359. display_ = static_cast<unsigned>(EDisplay::kInline);
  360. }
  361.  
  362. // AffectedByActive
  363. bool AffectedByActive() const {
  364. return static_cast<bool>(affected_by_active_);
  365. }
  366. void SetAffectedByActive() {
  367. affected_by_active_ = static_cast<unsigned>(true);
  368. }
  369.  
  370. // OriginalDisplay
  371. inline static EDisplay InitialOriginalDisplay() {
  372. return EDisplay::kInline;
  373. }
  374. EDisplay OriginalDisplay() const {
  375. return static_cast<EDisplay>(original_display_);
  376. }
  377. void SetOriginalDisplay(EDisplay v) {
  378. original_display_ = static_cast<unsigned>(v);
  379. }
  380. inline void ResetOriginalDisplay() {
  381. original_display_ = static_cast<unsigned>(EDisplay::kInline);
  382. }
  383.  
  384. // break-after
  385. inline static EBreakBetween InitialBreakAfter() {
  386. return EBreakBetween::kAuto;
  387. }
  388. EBreakBetween BreakAfter() const {
  389. return static_cast<EBreakBetween>(break_after_);
  390. }
  391. void SetBreakAfter(EBreakBetween v) {
  392. break_after_ = static_cast<unsigned>(v);
  393. }
  394. inline void ResetBreakAfter() {
  395. break_after_ = static_cast<unsigned>(EBreakBetween::kAuto);
  396. }
  397.  
  398. // break-before
  399. inline static EBreakBetween InitialBreakBefore() {
  400. return EBreakBetween::kAuto;
  401. }
  402. EBreakBetween BreakBefore() const {
  403. return static_cast<EBreakBetween>(break_before_);
  404. }
  405. void SetBreakBefore(EBreakBetween v) {
  406. break_before_ = static_cast<unsigned>(v);
  407. }
  408. inline void ResetBreakBefore() {
  409. break_before_ = static_cast<unsigned>(EBreakBetween::kAuto);
  410. }
  411.  
  412. // pointer-events
  413. inline static EPointerEvents InitialPointerEvents() {
  414. return EPointerEvents::kAuto;
  415. }
  416. EPointerEvents PointerEvents() const {
  417. return static_cast<EPointerEvents>(pointer_events_);
  418. }
  419. void SetPointerEvents(EPointerEvents v) {
  420. pointer_events_ = static_cast<unsigned>(v);
  421. }
  422. inline void ResetPointerEvents() {
  423. pointer_events_ = static_cast<unsigned>(EPointerEvents::kAuto);
  424. }
  425.  
  426. // text-align
  427. inline static ETextAlign InitialTextAlign() {
  428. return ETextAlign::kStart;
  429. }
  430. ETextAlign GetTextAlign() const {
  431. return static_cast<ETextAlign>(text_align_);
  432. }
  433. void SetTextAlign(ETextAlign v) {
  434. text_align_ = static_cast<unsigned>(v);
  435. }
  436. inline void ResetTextAlign() {
  437. text_align_ = static_cast<unsigned>(ETextAlign::kStart);
  438. }
  439.  
  440. // VerticalAlign
  441. // Getters and setters not generated
  442.  
  443. // overflow-x
  444. inline static EOverflow InitialOverflowX() {
  445. return EOverflow::kVisible;
  446. }
  447. EOverflow OverflowX() const {
  448. return static_cast<EOverflow>(overflow_x_);
  449. }
  450. void SetOverflowX(EOverflow v) {
  451. overflow_x_ = static_cast<unsigned>(v);
  452. }
  453. inline void ResetOverflowX() {
  454. overflow_x_ = static_cast<unsigned>(EOverflow::kVisible);
  455. }
  456.  
  457. // overflow-y
  458. inline static EOverflow InitialOverflowY() {
  459. return EOverflow::kVisible;
  460. }
  461. EOverflow OverflowY() const {
  462. return static_cast<EOverflow>(overflow_y_);
  463. }
  464. void SetOverflowY(EOverflow v) {
  465. overflow_y_ = static_cast<unsigned>(v);
  466. }
  467. inline void ResetOverflowY() {
  468. overflow_y_ = static_cast<unsigned>(EOverflow::kVisible);
  469. }
  470.  
  471. // AffectedByDrag
  472. bool AffectedByDrag() const {
  473. return static_cast<bool>(affected_by_drag_);
  474. }
  475. void SetAffectedByDrag() {
  476. affected_by_drag_ = static_cast<unsigned>(true);
  477. }
  478.  
  479. // position
  480. inline static EPosition InitialPosition() {
  481. return EPosition::kStatic;
  482. }
  483. EPosition GetPosition() const {
  484. return static_cast<EPosition>(position_);
  485. }
  486. void SetPosition(EPosition v) {
  487. position_ = static_cast<unsigned>(v);
  488. }
  489. inline void ResetPosition() {
  490. position_ = static_cast<unsigned>(EPosition::kStatic);
  491. }
  492.  
  493. // unicode-bidi
  494. inline static UnicodeBidi InitialUnicodeBidi() {
  495. return UnicodeBidi::kNormal;
  496. }
  497. UnicodeBidi GetUnicodeBidi() const {
  498. return static_cast<UnicodeBidi>(unicode_bidi_);
  499. }
  500. void SetUnicodeBidi(UnicodeBidi v) {
  501. unicode_bidi_ = static_cast<unsigned>(v);
  502. }
  503. inline void ResetUnicodeBidi() {
  504. unicode_bidi_ = static_cast<unsigned>(UnicodeBidi::kNormal);
  505. }
  506.  
  507. // white-space
  508. inline static EWhiteSpace InitialWhiteSpace() {
  509. return EWhiteSpace::kNormal;
  510. }
  511. EWhiteSpace WhiteSpace() const {
  512. return static_cast<EWhiteSpace>(white_space_);
  513. }
  514. void SetWhiteSpace(EWhiteSpace v) {
  515. white_space_ = static_cast<unsigned>(v);
  516. }
  517. inline void ResetWhiteSpace() {
  518. white_space_ = static_cast<unsigned>(EWhiteSpace::kNormal);
  519. }
  520.  
  521. // break-inside
  522. inline static EBreakInside InitialBreakInside() {
  523. return EBreakInside::kAuto;
  524. }
  525. EBreakInside BreakInside() const {
  526. return static_cast<EBreakInside>(break_inside_);
  527. }
  528. void SetBreakInside(EBreakInside v) {
  529. break_inside_ = static_cast<unsigned>(v);
  530. }
  531. inline void ResetBreakInside() {
  532. break_inside_ = static_cast<unsigned>(EBreakInside::kAuto);
  533. }
  534.  
  535. // clear
  536. inline static EClear InitialClear() {
  537. return EClear::kNone;
  538. }
  539. EClear Clear() const {
  540. return static_cast<EClear>(clear_);
  541. }
  542. void SetClear(EClear v) {
  543. clear_ = static_cast<unsigned>(v);
  544. }
  545. inline void ResetClear() {
  546. clear_ = static_cast<unsigned>(EClear::kNone);
  547. }
  548.  
  549. // float
  550. inline static EFloat InitialFloating() {
  551. return EFloat::kNone;
  552. }
  553. EFloat Floating() const {
  554. return static_cast<EFloat>(floating_);
  555. }
  556. void SetFloating(EFloat v) {
  557. floating_ = static_cast<unsigned>(v);
  558. }
  559. inline void ResetFloating() {
  560. floating_ = static_cast<unsigned>(EFloat::kNone);
  561. }
  562.  
  563. // InsideLink
  564. inline static EInsideLink InitialInsideLink() {
  565. return EInsideLink::kNotInsideLink;
  566. }
  567. EInsideLink InsideLink() const {
  568. return static_cast<EInsideLink>(inside_link_);
  569. }
  570. void SetInsideLink(EInsideLink v) {
  571. inside_link_ = static_cast<unsigned>(v);
  572. }
  573. inline void ResetInsideLink() {
  574. inside_link_ = static_cast<unsigned>(EInsideLink::kNotInsideLink);
  575. }
  576.  
  577. // overflow-anchor
  578. inline static EOverflowAnchor InitialOverflowAnchor() {
  579. return EOverflowAnchor::kAuto;
  580. }
  581. EOverflowAnchor OverflowAnchor() const {
  582. return static_cast<EOverflowAnchor>(overflow_anchor_);
  583. }
  584. void SetOverflowAnchor(EOverflowAnchor v) {
  585. overflow_anchor_ = static_cast<unsigned>(v);
  586. }
  587. inline void ResetOverflowAnchor() {
  588. overflow_anchor_ = static_cast<unsigned>(EOverflowAnchor::kAuto);
  589. }
  590.  
  591. // text-transform
  592. inline static ETextTransform InitialTextTransform() {
  593. return ETextTransform::kNone;
  594. }
  595. ETextTransform TextTransform() const {
  596. return static_cast<ETextTransform>(text_transform_);
  597. }
  598. void SetTextTransform(ETextTransform v) {
  599. text_transform_ = static_cast<unsigned>(v);
  600. }
  601. inline void ResetTextTransform() {
  602. text_transform_ = static_cast<unsigned>(ETextTransform::kNone);
  603. }
  604.  
  605. // transform-box
  606. inline static ETransformBox InitialTransformBox() {
  607. return ETransformBox::kBorderBox;
  608. }
  609. ETransformBox TransformBox() const {
  610. return static_cast<ETransformBox>(transform_box_);
  611. }
  612. void SetTransformBox(ETransformBox v) {
  613. transform_box_ = static_cast<unsigned>(v);
  614. }
  615. inline void ResetTransformBox() {
  616. transform_box_ = static_cast<unsigned>(ETransformBox::kBorderBox);
  617. }
  618.  
  619. // visibility
  620. inline static EVisibility InitialVisibility() {
  621. return EVisibility::kVisible;
  622. }
  623. EVisibility Visibility() const {
  624. return static_cast<EVisibility>(visibility_);
  625. }
  626. void SetVisibility(EVisibility v) {
  627. visibility_ = static_cast<unsigned>(v);
  628. }
  629. inline void ResetVisibility() {
  630. visibility_ = static_cast<unsigned>(EVisibility::kVisible);
  631. }
  632.  
  633. // writing-mode
  634. inline static WritingMode InitialWritingMode() {
  635. return WritingMode::kHorizontalTb;
  636. }
  637. WritingMode GetWritingMode() const {
  638. return static_cast<WritingMode>(writing_mode_);
  639. }
  640. void SetWritingMode(WritingMode v) {
  641. writing_mode_ = static_cast<unsigned>(v);
  642. }
  643. inline void ResetWritingMode() {
  644. writing_mode_ = static_cast<unsigned>(WritingMode::kHorizontalTb);
  645. }
  646.  
  647. // AffectedByFocus
  648. bool AffectedByFocus() const {
  649. return static_cast<bool>(affected_by_focus_);
  650. }
  651. void SetAffectedByFocus() {
  652. affected_by_focus_ = static_cast<unsigned>(true);
  653. }
  654.  
  655. // AffectedByFocusWithin
  656. bool AffectedByFocusWithin() const {
  657. return static_cast<bool>(affected_by_focus_within_);
  658. }
  659. void SetAffectedByFocusWithin() {
  660. affected_by_focus_within_ = static_cast<unsigned>(true);
  661. }
  662.  
  663. // AffectedByHover
  664. bool AffectedByHover() const {
  665. return static_cast<bool>(affected_by_hover_);
  666. }
  667. void SetAffectedByHover() {
  668. affected_by_hover_ = static_cast<unsigned>(true);
  669. }
  670.  
  671. // border-collapse
  672. inline static EBorderCollapse InitialBorderCollapse() {
  673. return EBorderCollapse::kSeparate;
  674. }
  675. EBorderCollapse BorderCollapse() const {
  676. return static_cast<EBorderCollapse>(border_collapse_);
  677. }
  678. void SetBorderCollapse(EBorderCollapse v) {
  679. border_collapse_ = static_cast<unsigned>(v);
  680. }
  681. inline void ResetBorderCollapse() {
  682. border_collapse_ = static_cast<unsigned>(EBorderCollapse::kSeparate);
  683. }
  684.  
  685. // border-collapse
  686. inline static bool InitialBorderCollapseIsInherited() {
  687. return true;
  688. }
  689. bool BorderCollapseIsInherited() const {
  690. return static_cast<bool>(border_collapse_is_inherited_);
  691. }
  692. void SetBorderCollapseIsInherited(bool v) {
  693. border_collapse_is_inherited_ = static_cast<unsigned>(v);
  694. }
  695. inline void ResetBorderCollapseIsInherited() {
  696. border_collapse_is_inherited_ = static_cast<unsigned>(true);
  697. }
  698.  
  699. // -webkit-box-direction
  700. inline static EBoxDirection InitialBoxDirection() {
  701. return EBoxDirection::kNormal;
  702. }
  703. EBoxDirection BoxDirection() const {
  704. return static_cast<EBoxDirection>(box_direction_);
  705. }
  706. void SetBoxDirection(EBoxDirection v) {
  707. box_direction_ = static_cast<unsigned>(v);
  708. }
  709. inline void ResetBoxDirection() {
  710. box_direction_ = static_cast<unsigned>(EBoxDirection::kNormal);
  711. }
  712.  
  713. // -webkit-box-direction
  714. inline static bool InitialBoxDirectionIsInherited() {
  715. return true;
  716. }
  717. bool BoxDirectionIsInherited() const {
  718. return static_cast<bool>(box_direction_is_inherited_);
  719. }
  720. void SetBoxDirectionIsInherited(bool v) {
  721. box_direction_is_inherited_ = static_cast<unsigned>(v);
  722. }
  723. inline void ResetBoxDirectionIsInherited() {
  724. box_direction_is_inherited_ = static_cast<unsigned>(true);
  725. }
  726.  
  727. // caption-side
  728. inline static ECaptionSide InitialCaptionSide() {
  729. return ECaptionSide::kTop;
  730. }
  731. ECaptionSide CaptionSide() const {
  732. return static_cast<ECaptionSide>(caption_side_);
  733. }
  734. void SetCaptionSide(ECaptionSide v) {
  735. caption_side_ = static_cast<unsigned>(v);
  736. }
  737. inline void ResetCaptionSide() {
  738. caption_side_ = static_cast<unsigned>(ECaptionSide::kTop);
  739. }
  740.  
  741. // caption-side
  742. inline static bool InitialCaptionSideIsInherited() {
  743. return true;
  744. }
  745. bool CaptionSideIsInherited() const {
  746. return static_cast<bool>(caption_side_is_inherited_);
  747. }
  748. void SetCaptionSideIsInherited(bool v) {
  749. caption_side_is_inherited_ = static_cast<unsigned>(v);
  750. }
  751. inline void ResetCaptionSideIsInherited() {
  752. caption_side_is_inherited_ = static_cast<unsigned>(true);
  753. }
  754.  
  755. // direction
  756. inline static TextDirection InitialDirection() {
  757. return TextDirection::kLtr;
  758. }
  759. TextDirection Direction() const {
  760. return static_cast<TextDirection>(direction_);
  761. }
  762. void SetDirection(TextDirection v) {
  763. direction_ = static_cast<unsigned>(v);
  764. }
  765. inline void ResetDirection() {
  766. direction_ = static_cast<unsigned>(TextDirection::kLtr);
  767. }
  768.  
  769. // empty-cells
  770. inline static EEmptyCells InitialEmptyCells() {
  771. return EEmptyCells::kShow;
  772. }
  773. EEmptyCells EmptyCells() const {
  774. return static_cast<EEmptyCells>(empty_cells_);
  775. }
  776. void SetEmptyCells(EEmptyCells v) {
  777. empty_cells_ = static_cast<unsigned>(v);
  778. }
  779. inline void ResetEmptyCells() {
  780. empty_cells_ = static_cast<unsigned>(EEmptyCells::kShow);
  781. }
  782.  
  783. // empty-cells
  784. inline static bool InitialEmptyCellsIsInherited() {
  785. return true;
  786. }
  787. bool EmptyCellsIsInherited() const {
  788. return static_cast<bool>(empty_cells_is_inherited_);
  789. }
  790. void SetEmptyCellsIsInherited(bool v) {
  791. empty_cells_is_inherited_ = static_cast<unsigned>(v);
  792. }
  793. inline void ResetEmptyCellsIsInherited() {
  794. empty_cells_is_inherited_ = static_cast<unsigned>(true);
  795. }
  796.  
  797. // EmptyState
  798. // Getters and setters not generated
  799.  
  800. // HasExplicitlyInheritedProperties
  801. bool HasExplicitlyInheritedProperties() const {
  802. return static_cast<bool>(has_explicitly_inherited_properties_);
  803. }
  804. void SetHasExplicitlyInheritedProperties() {
  805. has_explicitly_inherited_properties_ = static_cast<unsigned>(true);
  806. }
  807.  
  808. // HasRemUnits
  809. bool HasRemUnits() const {
  810. return static_cast<bool>(has_rem_units_);
  811. }
  812. void SetHasRemUnits() {
  813. has_rem_units_ = static_cast<unsigned>(true);
  814. }
  815.  
  816. // HasSimpleUnderline
  817. // Getters and setters not generated
  818.  
  819. // HasVariableReferenceFromNonInheritedProperty
  820. bool HasVariableReferenceFromNonInheritedProperty() const {
  821. return static_cast<bool>(has_variable_reference_from_non_inherited_property_);
  822. }
  823. void SetHasVariableReferenceFromNonInheritedProperty() {
  824. has_variable_reference_from_non_inherited_property_ = static_cast<unsigned>(true);
  825. }
  826.  
  827. // HasViewportUnits
  828. inline static bool InitialHasViewportUnits() {
  829. return false;
  830. }
  831. bool HasViewportUnits() const {
  832. return static_cast<bool>(has_viewport_units_);
  833. }
  834. void SetHasViewportUnits(bool v) {
  835. has_viewport_units_ = static_cast<unsigned>(v);
  836. }
  837. inline void ResetHasViewportUnits() {
  838. has_viewport_units_ = static_cast<unsigned>(false);
  839. }
  840.  
  841. // IsLink
  842. bool IsLink() const {
  843. return static_cast<bool>(is_link_);
  844. }
  845. void SetIsLink() {
  846. is_link_ = static_cast<unsigned>(true);
  847. }
  848.  
  849. // list-style-position
  850. inline static EListStylePosition InitialListStylePosition() {
  851. return EListStylePosition::kOutside;
  852. }
  853. EListStylePosition ListStylePosition() const {
  854. return static_cast<EListStylePosition>(list_style_position_);
  855. }
  856. void SetListStylePosition(EListStylePosition v) {
  857. list_style_position_ = static_cast<unsigned>(v);
  858. }
  859. inline void ResetListStylePosition() {
  860. list_style_position_ = static_cast<unsigned>(EListStylePosition::kOutside);
  861. }
  862.  
  863. // list-style-position
  864. inline static bool InitialListStylePositionIsInherited() {
  865. return true;
  866. }
  867. bool ListStylePositionIsInherited() const {
  868. return static_cast<bool>(list_style_position_is_inherited_);
  869. }
  870. void SetListStylePositionIsInherited(bool v) {
  871. list_style_position_is_inherited_ = static_cast<unsigned>(v);
  872. }
  873. inline void ResetListStylePositionIsInherited() {
  874. list_style_position_is_inherited_ = static_cast<unsigned>(true);
  875. }
  876.  
  877. // pointer-events
  878. inline static bool InitialPointerEventsIsInherited() {
  879. return true;
  880. }
  881. bool PointerEventsIsInherited() const {
  882. return static_cast<bool>(pointer_events_is_inherited_);
  883. }
  884. void SetPointerEventsIsInherited(bool v) {
  885. pointer_events_is_inherited_ = static_cast<unsigned>(v);
  886. }
  887. inline void ResetPointerEventsIsInherited() {
  888. pointer_events_is_inherited_ = static_cast<unsigned>(true);
  889. }
  890.  
  891. // -webkit-print-color-adjust
  892. inline static EPrintColorAdjust InitialPrintColorAdjust() {
  893. return EPrintColorAdjust::kEconomy;
  894. }
  895. EPrintColorAdjust PrintColorAdjust() const {
  896. return static_cast<EPrintColorAdjust>(print_color_adjust_);
  897. }
  898. void SetPrintColorAdjust(EPrintColorAdjust v) {
  899. print_color_adjust_ = static_cast<unsigned>(v);
  900. }
  901. inline void ResetPrintColorAdjust() {
  902. print_color_adjust_ = static_cast<unsigned>(EPrintColorAdjust::kEconomy);
  903. }
  904.  
  905. // -webkit-print-color-adjust
  906. inline static bool InitialPrintColorAdjustIsInherited() {
  907. return true;
  908. }
  909. bool PrintColorAdjustIsInherited() const {
  910. return static_cast<bool>(print_color_adjust_is_inherited_);
  911. }
  912. void SetPrintColorAdjustIsInherited(bool v) {
  913. print_color_adjust_is_inherited_ = static_cast<unsigned>(v);
  914. }
  915. inline void ResetPrintColorAdjustIsInherited() {
  916. print_color_adjust_is_inherited_ = static_cast<unsigned>(true);
  917. }
  918.  
  919. // -webkit-rtl-ordering
  920. inline static EOrder InitialRtlOrdering() {
  921. return EOrder::kLogical;
  922. }
  923. EOrder RtlOrdering() const {
  924. return static_cast<EOrder>(rtl_ordering_);
  925. }
  926. void SetRtlOrdering(EOrder v) {
  927. rtl_ordering_ = static_cast<unsigned>(v);
  928. }
  929. inline void ResetRtlOrdering() {
  930. rtl_ordering_ = static_cast<unsigned>(EOrder::kLogical);
  931. }
  932.  
  933. // -webkit-rtl-ordering
  934. inline static bool InitialRtlOrderingIsInherited() {
  935. return true;
  936. }
  937. bool RtlOrderingIsInherited() const {
  938. return static_cast<bool>(rtl_ordering_is_inherited_);
  939. }
  940. void SetRtlOrderingIsInherited(bool v) {
  941. rtl_ordering_is_inherited_ = static_cast<unsigned>(v);
  942. }
  943. inline void ResetRtlOrderingIsInherited() {
  944. rtl_ordering_is_inherited_ = static_cast<unsigned>(true);
  945. }
  946.  
  947. // table-layout
  948. inline static ETableLayout InitialTableLayout() {
  949. return ETableLayout::kAuto;
  950. }
  951. ETableLayout TableLayout() const {
  952. return static_cast<ETableLayout>(table_layout_);
  953. }
  954. void SetTableLayout(ETableLayout v) {
  955. table_layout_ = static_cast<unsigned>(v);
  956. }
  957. inline void ResetTableLayout() {
  958. table_layout_ = static_cast<unsigned>(ETableLayout::kAuto);
  959. }
  960.  
  961. // text-align
  962. inline static bool InitialTextAlignIsInherited() {
  963. return true;
  964. }
  965. bool TextAlignIsInherited() const {
  966. return static_cast<bool>(text_align_is_inherited_);
  967. }
  968. void SetTextAlignIsInherited(bool v) {
  969. text_align_is_inherited_ = static_cast<unsigned>(v);
  970. }
  971. inline void ResetTextAlignIsInherited() {
  972. text_align_is_inherited_ = static_cast<unsigned>(true);
  973. }
  974.  
  975. // text-transform
  976. inline static bool InitialTextTransformIsInherited() {
  977. return true;
  978. }
  979. bool TextTransformIsInherited() const {
  980. return static_cast<bool>(text_transform_is_inherited_);
  981. }
  982. void SetTextTransformIsInherited(bool v) {
  983. text_transform_is_inherited_ = static_cast<unsigned>(v);
  984. }
  985. inline void ResetTextTransformIsInherited() {
  986. text_transform_is_inherited_ = static_cast<unsigned>(true);
  987. }
  988.  
  989. // Unique
  990. bool Unique() const {
  991. return static_cast<bool>(unique_);
  992. }
  993. void SetUnique() {
  994. unique_ = static_cast<unsigned>(true);
  995. }
  996.  
  997. // visibility
  998. inline static bool InitialVisibilityIsInherited() {
  999. return true;
  1000. }
  1001. bool VisibilityIsInherited() const {
  1002. return static_cast<bool>(visibility_is_inherited_);
  1003. }
  1004. void SetVisibilityIsInherited(bool v) {
  1005. visibility_is_inherited_ = static_cast<unsigned>(v);
  1006. }
  1007. inline void ResetVisibilityIsInherited() {
  1008. visibility_is_inherited_ = static_cast<unsigned>(true);
  1009. }
  1010.  
  1011. // white-space
  1012. inline static bool InitialWhiteSpaceIsInherited() {
  1013. return true;
  1014. }
  1015. bool WhiteSpaceIsInherited() const {
  1016. return static_cast<bool>(white_space_is_inherited_);
  1017. }
  1018. void SetWhiteSpaceIsInherited(bool v) {
  1019. white_space_is_inherited_ = static_cast<unsigned>(v);
  1020. }
  1021. inline void ResetWhiteSpaceIsInherited() {
  1022. white_space_is_inherited_ = static_cast<unsigned>(true);
  1023. }
  1024.  
  1025. private:
  1026. class StyleBackgroundData : public RefCountedCopyable<StyleBackgroundData> {
  1027. public:
  1028. static PassRefPtr<StyleBackgroundData> Create() {
  1029. return AdoptRef(new StyleBackgroundData);
  1030. }
  1031. PassRefPtr<StyleBackgroundData> Copy() const {
  1032. return AdoptRef(new StyleBackgroundData(*this));
  1033. }
  1034.  
  1035. bool operator==(const StyleBackgroundData& other) const {
  1036. return (
  1037. background_ == other.background_ &&
  1038. background_color_ == other.background_color_
  1039. );
  1040. }
  1041. bool operator!=(const StyleBackgroundData& other) const { return !(*this == other); }
  1042.  
  1043. FillLayer background_;
  1044. StyleColor background_color_;
  1045.  
  1046. private:
  1047. StyleBackgroundData() :
  1048. background_(FillLayer(kBackgroundFillLayer, true)),
  1049. background_color_(Color::kTransparent)
  1050. {}
  1051.  
  1052. StyleBackgroundData(const StyleBackgroundData&) = default;
  1053. };
  1054.  
  1055. class StyleSurroundData : public RefCountedCopyable<StyleSurroundData> {
  1056. public:
  1057. static PassRefPtr<StyleSurroundData> Create() {
  1058. return AdoptRef(new StyleSurroundData);
  1059. }
  1060. PassRefPtr<StyleSurroundData> Copy() const {
  1061. return AdoptRef(new StyleSurroundData(*this));
  1062. }
  1063.  
  1064. bool operator==(const StyleSurroundData& other) const {
  1065. return (
  1066. padding_bottom_ == other.padding_bottom_ &&
  1067. margin_right_ == other.margin_right_ &&
  1068. padding_right_ == other.padding_right_ &&
  1069. bottom_ == other.bottom_ &&
  1070. top_ == other.top_ &&
  1071. margin_top_ == other.margin_top_ &&
  1072. padding_left_ == other.padding_left_ &&
  1073. left_ == other.left_ &&
  1074. margin_bottom_ == other.margin_bottom_ &&
  1075. right_ == other.right_ &&
  1076. margin_left_ == other.margin_left_ &&
  1077. padding_top_ == other.padding_top_ &&
  1078. border_ == other.border_
  1079. );
  1080. }
  1081. bool operator!=(const StyleSurroundData& other) const { return !(*this == other); }
  1082.  
  1083. Length padding_bottom_;
  1084. Length margin_right_;
  1085. Length padding_right_;
  1086. Length bottom_;
  1087. Length top_;
  1088. Length margin_top_;
  1089. Length padding_left_;
  1090. Length left_;
  1091. Length margin_bottom_;
  1092. Length right_;
  1093. Length margin_left_;
  1094. Length padding_top_;
  1095. BorderData border_;
  1096.  
  1097. private:
  1098. StyleSurroundData() :
  1099. padding_bottom_(Length(kFixed)),
  1100. margin_right_(Length(kFixed)),
  1101. padding_right_(Length(kFixed)),
  1102. bottom_(Length()),
  1103. top_(Length()),
  1104. margin_top_(Length(kFixed)),
  1105. padding_left_(Length(kFixed)),
  1106. left_(Length()),
  1107. margin_bottom_(Length(kFixed)),
  1108. right_(Length()),
  1109. margin_left_(Length(kFixed)),
  1110. padding_top_(Length(kFixed)),
  1111. border_(BorderData())
  1112. {}
  1113.  
  1114. StyleSurroundData(const StyleSurroundData&) = default;
  1115. };
  1116.  
  1117.  
  1118. protected:
  1119. // Constructor and destructor are protected so that only the parent class ComputedStyle
  1120. // can instantiate this class.
  1121. ALWAYS_INLINE ComputedStyleBase() :
  1122. pseudo_bits_(static_cast<unsigned>(kPseudoIdNone)),
  1123. cursor_(static_cast<unsigned>(ECursor::kAuto)),
  1124. list_style_type_(static_cast<unsigned>(EListStyleType::kDisc)),
  1125. style_type_(static_cast<unsigned>(0)),
  1126. display_(static_cast<unsigned>(EDisplay::kInline)),
  1127. affected_by_active_(static_cast<unsigned>(false)),
  1128. original_display_(static_cast<unsigned>(EDisplay::kInline)),
  1129. break_after_(static_cast<unsigned>(EBreakBetween::kAuto)),
  1130. break_before_(static_cast<unsigned>(EBreakBetween::kAuto)),
  1131. pointer_events_(static_cast<unsigned>(EPointerEvents::kAuto)),
  1132. text_align_(static_cast<unsigned>(ETextAlign::kStart)),
  1133. vertical_align_(static_cast<unsigned>(EVerticalAlign::kBaseline)),
  1134. overflow_x_(static_cast<unsigned>(EOverflow::kVisible)),
  1135. overflow_y_(static_cast<unsigned>(EOverflow::kVisible)),
  1136. affected_by_drag_(static_cast<unsigned>(false)),
  1137. position_(static_cast<unsigned>(EPosition::kStatic)),
  1138. unicode_bidi_(static_cast<unsigned>(UnicodeBidi::kNormal)),
  1139. white_space_(static_cast<unsigned>(EWhiteSpace::kNormal)),
  1140. break_inside_(static_cast<unsigned>(EBreakInside::kAuto)),
  1141. clear_(static_cast<unsigned>(EClear::kNone)),
  1142. floating_(static_cast<unsigned>(EFloat::kNone)),
  1143. inside_link_(static_cast<unsigned>(EInsideLink::kNotInsideLink)),
  1144. overflow_anchor_(static_cast<unsigned>(EOverflowAnchor::kAuto)),
  1145. text_transform_(static_cast<unsigned>(ETextTransform::kNone)),
  1146. transform_box_(static_cast<unsigned>(ETransformBox::kBorderBox)),
  1147. visibility_(static_cast<unsigned>(EVisibility::kVisible)),
  1148. writing_mode_(static_cast<unsigned>(WritingMode::kHorizontalTb)),
  1149. affected_by_focus_(static_cast<unsigned>(false)),
  1150. affected_by_focus_within_(static_cast<unsigned>(false)),
  1151. affected_by_hover_(static_cast<unsigned>(false)),
  1152. border_collapse_(static_cast<unsigned>(EBorderCollapse::kSeparate)),
  1153. border_collapse_is_inherited_(static_cast<unsigned>(true)),
  1154. box_direction_(static_cast<unsigned>(EBoxDirection::kNormal)),
  1155. box_direction_is_inherited_(static_cast<unsigned>(true)),
  1156. caption_side_(static_cast<unsigned>(ECaptionSide::kTop)),
  1157. caption_side_is_inherited_(static_cast<unsigned>(true)),
  1158. direction_(static_cast<unsigned>(TextDirection::kLtr)),
  1159. empty_cells_(static_cast<unsigned>(EEmptyCells::kShow)),
  1160. empty_cells_is_inherited_(static_cast<unsigned>(true)),
  1161. empty_state_(static_cast<unsigned>(false)),
  1162. has_explicitly_inherited_properties_(static_cast<unsigned>(false)),
  1163. has_rem_units_(static_cast<unsigned>(false)),
  1164. has_simple_underline_(static_cast<unsigned>(false)),
  1165. has_variable_reference_from_non_inherited_property_(static_cast<unsigned>(false)),
  1166. has_viewport_units_(static_cast<unsigned>(false)),
  1167. is_link_(static_cast<unsigned>(false)),
  1168. list_style_position_(static_cast<unsigned>(EListStylePosition::kOutside)),
  1169. list_style_position_is_inherited_(static_cast<unsigned>(true)),
  1170. pointer_events_is_inherited_(static_cast<unsigned>(true)),
  1171. print_color_adjust_(static_cast<unsigned>(EPrintColorAdjust::kEconomy)),
  1172. print_color_adjust_is_inherited_(static_cast<unsigned>(true)),
  1173. rtl_ordering_(static_cast<unsigned>(EOrder::kLogical)),
  1174. rtl_ordering_is_inherited_(static_cast<unsigned>(true)),
  1175. table_layout_(static_cast<unsigned>(ETableLayout::kAuto)),
  1176. text_align_is_inherited_(static_cast<unsigned>(true)),
  1177. text_transform_is_inherited_(static_cast<unsigned>(true)),
  1178. unique_(static_cast<unsigned>(false)),
  1179. visibility_is_inherited_(static_cast<unsigned>(true)),
  1180. white_space_is_inherited_(static_cast<unsigned>(true))
  1181. {
  1182. background_data_.Init();
  1183. surround_data_.Init();
  1184. }
  1185.  
  1186. // PseudoBits
  1187. PseudoId PseudoBitsInternal() const {
  1188. return static_cast<PseudoId>(pseudo_bits_);
  1189. }
  1190. void SetPseudoBitsInternal(PseudoId v) {
  1191. pseudo_bits_ = static_cast<unsigned>(v);
  1192. }
  1193.  
  1194. // StyleType
  1195. PseudoId StyleTypeInternal() const {
  1196. return static_cast<PseudoId>(style_type_);
  1197. }
  1198. void SetStyleTypeInternal(PseudoId v) {
  1199. style_type_ = static_cast<unsigned>(v);
  1200. }
  1201.  
  1202. // AffectedByActive
  1203. void SetAffectedByActiveInternal(bool v) {
  1204. affected_by_active_ = static_cast<unsigned>(v);
  1205. }
  1206.  
  1207. // VerticalAlign
  1208. EVerticalAlign VerticalAlignInternal() const {
  1209. return static_cast<EVerticalAlign>(vertical_align_);
  1210. }
  1211. void SetVerticalAlignInternal(EVerticalAlign v) {
  1212. vertical_align_ = static_cast<unsigned>(v);
  1213. }
  1214.  
  1215. // AffectedByDrag
  1216. void SetAffectedByDragInternal(bool v) {
  1217. affected_by_drag_ = static_cast<unsigned>(v);
  1218. }
  1219.  
  1220. // AffectedByFocus
  1221. void SetAffectedByFocusInternal(bool v) {
  1222. affected_by_focus_ = static_cast<unsigned>(v);
  1223. }
  1224.  
  1225. // AffectedByFocusWithin
  1226. void SetAffectedByFocusWithinInternal(bool v) {
  1227. affected_by_focus_within_ = static_cast<unsigned>(v);
  1228. }
  1229.  
  1230. // AffectedByHover
  1231. void SetAffectedByHoverInternal(bool v) {
  1232. affected_by_hover_ = static_cast<unsigned>(v);
  1233. }
  1234.  
  1235. // EmptyState
  1236. bool EmptyStateInternal() const {
  1237. return static_cast<bool>(empty_state_);
  1238. }
  1239. void SetEmptyStateInternal(bool v) {
  1240. empty_state_ = static_cast<unsigned>(v);
  1241. }
  1242.  
  1243. // HasExplicitlyInheritedProperties
  1244. void SetHasExplicitlyInheritedPropertiesInternal(bool v) {
  1245. has_explicitly_inherited_properties_ = static_cast<unsigned>(v);
  1246. }
  1247.  
  1248. // HasRemUnits
  1249. void SetHasRemUnitsInternal(bool v) {
  1250. has_rem_units_ = static_cast<unsigned>(v);
  1251. }
  1252.  
  1253. // HasSimpleUnderline
  1254. bool HasSimpleUnderlineInternal() const {
  1255. return static_cast<bool>(has_simple_underline_);
  1256. }
  1257. void SetHasSimpleUnderlineInternal(bool v) {
  1258. has_simple_underline_ = static_cast<unsigned>(v);
  1259. }
  1260.  
  1261. // HasVariableReferenceFromNonInheritedProperty
  1262. void SetHasVariableReferenceFromNonInheritedPropertyInternal(bool v) {
  1263. has_variable_reference_from_non_inherited_property_ = static_cast<unsigned>(v);
  1264. }
  1265.  
  1266. // IsLink
  1267. void SetIsLinkInternal(bool v) {
  1268. is_link_ = static_cast<unsigned>(v);
  1269. }
  1270.  
  1271. // Unique
  1272. void SetUniqueInternal(bool v) {
  1273. unique_ = static_cast<unsigned>(v);
  1274. }
  1275.  
  1276.  
  1277. ~ComputedStyleBase() = default;
  1278.  
  1279. // Storage.
  1280. DataRef<StyleBackgroundData> background_data_;
  1281. DataRef<StyleSurroundData> surround_data_;
  1282.  
  1283. private:
  1284. unsigned pseudo_bits_ : 8; // PseudoId
  1285. unsigned cursor_ : 6; // ECursor
  1286. unsigned list_style_type_ : 6; // EListStyleType
  1287. unsigned style_type_ : 6; // PseudoId
  1288. unsigned display_ : 5; // EDisplay
  1289. unsigned affected_by_active_ : 1; // bool
  1290. unsigned original_display_ : 5; // EDisplay
  1291. unsigned break_after_ : 4; // EBreakBetween
  1292. unsigned break_before_ : 4; // EBreakBetween
  1293. unsigned pointer_events_ : 4; // EPointerEvents
  1294. unsigned text_align_ : 4; // ETextAlign
  1295. unsigned vertical_align_ : 4; // EVerticalAlign
  1296. unsigned overflow_x_ : 3; // EOverflow
  1297. unsigned overflow_y_ : 3; // EOverflow
  1298. unsigned affected_by_drag_ : 1; // bool
  1299. unsigned position_ : 3; // EPosition
  1300. unsigned unicode_bidi_ : 3; // UnicodeBidi
  1301. unsigned white_space_ : 3; // EWhiteSpace
  1302. unsigned break_inside_ : 2; // EBreakInside
  1303. unsigned clear_ : 2; // EClear
  1304. unsigned floating_ : 2; // EFloat
  1305. unsigned inside_link_ : 2; // EInsideLink
  1306. unsigned overflow_anchor_ : 2; // EOverflowAnchor
  1307. unsigned text_transform_ : 2; // ETextTransform
  1308. unsigned transform_box_ : 2; // ETransformBox
  1309. unsigned visibility_ : 2; // EVisibility
  1310. unsigned writing_mode_ : 2; // WritingMode
  1311. unsigned affected_by_focus_ : 1; // bool
  1312. unsigned affected_by_focus_within_ : 1; // bool
  1313. unsigned affected_by_hover_ : 1; // bool
  1314. unsigned border_collapse_ : 1; // EBorderCollapse
  1315. unsigned border_collapse_is_inherited_ : 1; // bool
  1316. unsigned box_direction_ : 1; // EBoxDirection
  1317. unsigned box_direction_is_inherited_ : 1; // bool
  1318. unsigned caption_side_ : 1; // ECaptionSide
  1319. unsigned caption_side_is_inherited_ : 1; // bool
  1320. unsigned direction_ : 1; // TextDirection
  1321. unsigned empty_cells_ : 1; // EEmptyCells
  1322. unsigned empty_cells_is_inherited_ : 1; // bool
  1323. unsigned empty_state_ : 1; // bool
  1324. unsigned has_explicitly_inherited_properties_ : 1; // bool
  1325. unsigned has_rem_units_ : 1; // bool
  1326. unsigned has_simple_underline_ : 1; // bool
  1327. unsigned has_variable_reference_from_non_inherited_property_ : 1; // bool
  1328. unsigned has_viewport_units_ : 1; // bool
  1329. unsigned is_link_ : 1; // bool
  1330. unsigned list_style_position_ : 1; // EListStylePosition
  1331. unsigned list_style_position_is_inherited_ : 1; // bool
  1332. unsigned pointer_events_is_inherited_ : 1; // bool
  1333. unsigned print_color_adjust_ : 1; // EPrintColorAdjust
  1334. unsigned print_color_adjust_is_inherited_ : 1; // bool
  1335. unsigned rtl_ordering_ : 1; // EOrder
  1336. unsigned rtl_ordering_is_inherited_ : 1; // bool
  1337. unsigned table_layout_ : 1; // ETableLayout
  1338. unsigned text_align_is_inherited_ : 1; // bool
  1339. unsigned text_transform_is_inherited_ : 1; // bool
  1340. unsigned unique_ : 1; // bool
  1341. unsigned visibility_is_inherited_ : 1; // bool
  1342. unsigned white_space_is_inherited_ : 1; // bool
  1343. };
  1344.  
  1345. } // namespace blink
  1346.  
  1347. #endif // ComputedStyleBase_h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement