Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: Source/core/layout/line/FloatToLayoutUnit.h

Issue 1043643002: Switch line layout to LayoutUnit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More TestExpectations tweaks Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/line/EllipsisBox.cpp ('k') | Source/core/layout/line/InlineBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 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
6 // The classes in this file are transitional types intended to facilitate
7 // moving the LineBox types from float-based units to LayoutUnits. At first,
8 // these types will be backed by floats, and then swapped to LayoutUnit
9 // implementations, and eventually removed when LayoutUnits in this code
10 // are stabilized. See
11 // https://docs.google.com/a/chromium.org/document/d/1fro9Drq78rYBwr6K9CPK-y0TDS VxlBuXl6A54XnKAyE/edit
12 // for details.
13
14 #ifndef FloatToLayoutUnit_h
15 #define FloatToLayoutUnit_h
16
17 #include "platform/LayoutUnit.h"
18 #include "platform/geometry/FloatPoint.h"
19 #include "platform/geometry/FloatRect.h"
20 #include "platform/geometry/FloatSize.h"
21 #include "platform/geometry/LayoutPoint.h"
22 #include "platform/geometry/LayoutRect.h"
23 #include "platform/geometry/LayoutSize.h"
24
25 namespace blink {
26
27 class IntPoint;
28
29 class FloatLineLayoutUnit {
30 public:
31 FloatLineLayoutUnit() : m_value(0) { }
32 FloatLineLayoutUnit(float f) : m_value(f) { }
33
34 FloatLineLayoutUnit(const LayoutUnit &layoutUnit) : m_value(layoutUnit.toFlo at()) { }
35
36 operator float() const { return toFloat(); }
37 operator LayoutUnit() const { return toLayoutUnit(); }
38
39 float rawValue() const
40 {
41 return m_value;
42 }
43
44 float toFloat() const
45 {
46 return m_value;
47 }
48
49 LayoutUnit toLayoutUnit() const
50 {
51 return LayoutUnit(m_value);
52 }
53
54 int round() const
55 {
56 return lroundf(m_value);
57 }
58
59 private:
60 float m_value;
61 };
62
63 inline FloatLineLayoutUnit operator-(const FloatLineLayoutUnit& a)
64 {
65 FloatLineLayoutUnit returnVal(-a.rawValue());
66 return returnVal;
67 }
68
69 inline bool operator<=(const FloatLineLayoutUnit& a, const FloatLineLayoutUnit& b)
70 {
71 return a.rawValue() <= b.rawValue();
72 }
73
74 inline bool operator<=(const FloatLineLayoutUnit& a, float b)
75 {
76 return a.toFloat() <= b;
77 }
78
79 inline bool operator<=(const FloatLineLayoutUnit& a, int b)
80 {
81 return a <= FloatLineLayoutUnit(b);
82 }
83
84 inline bool operator<=(const FloatLineLayoutUnit& a, const LayoutUnit& b)
85 {
86 return a <= FloatLineLayoutUnit(b);
87 }
88
89 inline bool operator<=(float a, const FloatLineLayoutUnit& b)
90 {
91 return a <= b.toFloat();
92 }
93
94 inline bool operator<=(int a, const FloatLineLayoutUnit& b)
95 {
96 return FloatLineLayoutUnit(a) <= b;
97 }
98
99 inline bool operator<=(const LayoutUnit& a, const FloatLineLayoutUnit& b)
100 {
101 return FloatLineLayoutUnit(a) <= b;
102 }
103
104 inline bool operator>=(const FloatLineLayoutUnit& a, const FloatLineLayoutUnit& b)
105 {
106 return a.rawValue() >= b.rawValue();
107 }
108
109 inline bool operator>=(const FloatLineLayoutUnit& a, float b)
110 {
111 return a.toFloat() >= b;
112 }
113
114 inline bool operator>=(const FloatLineLayoutUnit& a, int b)
115 {
116 return a >= FloatLineLayoutUnit(b);
117 }
118
119 inline bool operator>=(const FloatLineLayoutUnit& a, const LayoutUnit& b)
120 {
121 return a >= FloatLineLayoutUnit(b);
122 }
123
124 inline bool operator>=(float a, const FloatLineLayoutUnit& b)
125 {
126 return a >= b.toFloat();
127 }
128
129 inline bool operator>=(int a, const FloatLineLayoutUnit& b)
130 {
131 return FloatLineLayoutUnit(a) >= b;
132 }
133
134 inline bool operator>=(const LayoutUnit& a, const FloatLineLayoutUnit& b)
135 {
136 return FloatLineLayoutUnit(a) >= b;
137 }
138
139 inline bool operator<(const FloatLineLayoutUnit& a, const FloatLineLayoutUnit& b )
140 {
141 return a.rawValue() < b.rawValue();
142 }
143
144 inline bool operator<(const FloatLineLayoutUnit& a, float b)
145 {
146 return a.toFloat() < b;
147 }
148
149 inline bool operator<(const FloatLineLayoutUnit& a, int b)
150 {
151 return a < FloatLineLayoutUnit(b);
152 }
153
154 inline bool operator<(const FloatLineLayoutUnit& a, const LayoutUnit& b)
155 {
156 return a < FloatLineLayoutUnit(b);
157 }
158
159 inline bool operator<(float a, const FloatLineLayoutUnit& b)
160 {
161 return a < b.toFloat();
162 }
163
164 inline bool operator<(int a, const FloatLineLayoutUnit& b)
165 {
166 return FloatLineLayoutUnit(a) < b;
167 }
168
169 inline bool operator<(const LayoutUnit& a, const FloatLineLayoutUnit& b)
170 {
171 return FloatLineLayoutUnit(a) < b;
172 }
173
174 inline bool operator>(const FloatLineLayoutUnit& a, const FloatLineLayoutUnit& b )
175 {
176 return a.rawValue() > b.rawValue();
177 }
178
179 inline bool operator>(const FloatLineLayoutUnit& a, float b)
180 {
181 return a.toFloat() > b;
182 }
183
184 inline bool operator>(const FloatLineLayoutUnit& a, int b)
185 {
186 return a > FloatLineLayoutUnit(b);
187 }
188
189 inline bool operator>(const FloatLineLayoutUnit& a, const LayoutUnit& b)
190 {
191 return a > FloatLineLayoutUnit(b);
192 }
193
194 inline bool operator>(float a, const FloatLineLayoutUnit& b)
195 {
196 return a > b.toFloat();
197 }
198
199 inline bool operator>(int a, const FloatLineLayoutUnit& b)
200 {
201 return FloatLineLayoutUnit(a) > b;
202 }
203
204 inline bool operator>(const LayoutUnit& a, const FloatLineLayoutUnit& b)
205 {
206 return FloatLineLayoutUnit(a) > b;
207 }
208
209 inline bool operator!=(const FloatLineLayoutUnit& a, const FloatLineLayoutUnit& b)
210 {
211 return a.rawValue() != b.rawValue();
212 }
213
214 inline bool operator!=(const FloatLineLayoutUnit& a, float b)
215 {
216 return a.toFloat() != b;
217 }
218
219 inline bool operator!=(const FloatLineLayoutUnit& a, int b)
220 {
221 return a != FloatLineLayoutUnit(b);
222 }
223
224 inline bool operator!=(const FloatLineLayoutUnit& a, const LayoutUnit& b)
225 {
226 return a != FloatLineLayoutUnit(b);
227 }
228
229 inline bool operator!=(float a, const FloatLineLayoutUnit& b)
230 {
231 return a != b.toFloat();
232 }
233
234 inline bool operator!=(int a, const FloatLineLayoutUnit& b)
235 {
236 return FloatLineLayoutUnit(a) != b;
237 }
238
239 inline bool operator!=(const LayoutUnit& a, const FloatLineLayoutUnit& b)
240 {
241 return FloatLineLayoutUnit(a) != b;
242 }
243
244 inline bool operator==(const FloatLineLayoutUnit& a, const FloatLineLayoutUnit& b)
245 {
246 return a.rawValue() == b.rawValue();
247 }
248
249 inline bool operator==(const FloatLineLayoutUnit& a, float b)
250 {
251 return a.toFloat() == b;
252 }
253
254 inline bool operator==(const FloatLineLayoutUnit& a, int b)
255 {
256 return a == FloatLineLayoutUnit(b);
257 }
258
259 inline bool operator==(const FloatLineLayoutUnit& a, const LayoutUnit& b)
260 {
261 return a == FloatLineLayoutUnit(b);
262 }
263
264 inline bool operator==(float a, const FloatLineLayoutUnit& b)
265 {
266 return a == b.toFloat();
267 }
268
269 inline bool operator==(int a, const FloatLineLayoutUnit& b)
270 {
271 return FloatLineLayoutUnit(a) == b;
272 }
273
274 inline bool operator==(const LayoutUnit& a, const FloatLineLayoutUnit& b)
275 {
276 return FloatLineLayoutUnit(a) == b;
277 }
278
279 inline FloatLineLayoutUnit operator*(const FloatLineLayoutUnit& a, const FloatLi neLayoutUnit& b)
280 {
281 return FloatLineLayoutUnit(a.rawValue() * b.rawValue());
282 }
283
284 inline float operator*(const FloatLineLayoutUnit& a, float b)
285 {
286 return a.toFloat() * b;
287 }
288
289 inline FloatLineLayoutUnit operator*(const FloatLineLayoutUnit& a, int b)
290 {
291 return a * FloatLineLayoutUnit(b);
292 }
293
294 inline FloatLineLayoutUnit operator*(const FloatLineLayoutUnit& a, const LayoutU nit& b)
295 {
296 return a * FloatLineLayoutUnit(b);
297 }
298
299 inline float operator*(float a, const FloatLineLayoutUnit& b)
300 {
301 return a * b.toFloat();
302 }
303
304 inline FloatLineLayoutUnit operator*(int a, const FloatLineLayoutUnit& b)
305 {
306 return FloatLineLayoutUnit(a) * b;
307 }
308
309 inline FloatLineLayoutUnit operator*(const LayoutUnit& a, const FloatLineLayoutU nit& b)
310 {
311 return FloatLineLayoutUnit(a) * b;
312 }
313
314 inline FloatLineLayoutUnit operator/(const FloatLineLayoutUnit& a, const FloatLi neLayoutUnit& b)
315 {
316 return FloatLineLayoutUnit(a.rawValue() / b.rawValue());
317 }
318
319 inline float operator/(const FloatLineLayoutUnit& a, float b)
320 {
321 return a.toFloat() / b;
322 }
323
324 inline FloatLineLayoutUnit operator/(const FloatLineLayoutUnit& a, int b)
325 {
326 return a / FloatLineLayoutUnit(b);
327 }
328
329 inline FloatLineLayoutUnit operator/(const FloatLineLayoutUnit& a, const LayoutU nit& b)
330 {
331 return a / FloatLineLayoutUnit(b);
332 }
333
334 inline float operator/(float a, const FloatLineLayoutUnit& b)
335 {
336 return a / b.toFloat();
337 }
338
339 inline FloatLineLayoutUnit operator/(int a, const FloatLineLayoutUnit& b)
340 {
341 return FloatLineLayoutUnit(a) / b;
342 }
343
344 inline FloatLineLayoutUnit operator/(const LayoutUnit& a, const FloatLineLayoutU nit& b)
345 {
346 return FloatLineLayoutUnit(a) / b;
347 }
348
349 inline FloatLineLayoutUnit operator+(const FloatLineLayoutUnit& a, const FloatLi neLayoutUnit& b)
350 {
351 return FloatLineLayoutUnit(a.rawValue() + b.rawValue());
352 }
353
354 inline float operator+(const FloatLineLayoutUnit& a, float b)
355 {
356 return a.toFloat() + b;
357 }
358
359 inline FloatLineLayoutUnit operator+(const FloatLineLayoutUnit& a, int b)
360 {
361 return a + FloatLineLayoutUnit(b);
362 }
363
364 inline FloatLineLayoutUnit operator+(const FloatLineLayoutUnit& a, const LayoutU nit& b)
365 {
366 return a + FloatLineLayoutUnit(b);
367 }
368
369 inline float operator+(float a, const FloatLineLayoutUnit& b)
370 {
371 return a + b.toFloat();
372 }
373
374 inline FloatLineLayoutUnit operator+(int a, const FloatLineLayoutUnit& b)
375 {
376 return FloatLineLayoutUnit(a) + b;
377 }
378
379 inline FloatLineLayoutUnit operator+(const LayoutUnit& a, const FloatLineLayoutU nit& b)
380 {
381 return FloatLineLayoutUnit(a) + b;
382 }
383
384 inline FloatLineLayoutUnit operator-(const FloatLineLayoutUnit& a, const FloatLi neLayoutUnit& b)
385 {
386 return FloatLineLayoutUnit(a.rawValue() - b.rawValue());
387 }
388
389 inline float operator-(const FloatLineLayoutUnit& a, float b)
390 {
391 return a.toFloat() - b;
392 }
393
394 inline FloatLineLayoutUnit operator-(const FloatLineLayoutUnit& a, int b)
395 {
396 return a - FloatLineLayoutUnit(b);
397 }
398
399 inline FloatLineLayoutUnit operator-(const FloatLineLayoutUnit& a, const LayoutU nit& b)
400 {
401 return a - FloatLineLayoutUnit(b);
402 }
403
404 inline float operator-(float a, const FloatLineLayoutUnit& b)
405 {
406 return a - b.toFloat();
407 }
408
409 inline FloatLineLayoutUnit operator-(int a, const FloatLineLayoutUnit& b)
410 {
411 return FloatLineLayoutUnit(a) - b;
412 }
413
414 inline FloatLineLayoutUnit operator-(const LayoutUnit& a, const FloatLineLayoutU nit& b)
415 {
416 return FloatLineLayoutUnit(a) - b;
417 }
418
419 inline FloatLineLayoutUnit& operator*=(FloatLineLayoutUnit& a, const FloatLineLa youtUnit& b)
420 {
421 a = a * b;
422 return a;
423 }
424
425 inline FloatLineLayoutUnit& operator*=(FloatLineLayoutUnit& a, float b)
426 {
427 a = a * b;
428 return a;
429 }
430
431 inline FloatLineLayoutUnit& operator*=(FloatLineLayoutUnit& a, int b)
432 {
433 a = a * b;
434 return a;
435 }
436
437 inline FloatLineLayoutUnit& operator*=(FloatLineLayoutUnit& a, const LayoutUnit& b)
438 {
439 a = a * b;
440 return a;
441 }
442
443 inline float& operator*=(float& a, const FloatLineLayoutUnit& b)
444 {
445 a = a * b;
446 return a;
447 }
448
449 inline int& operator*=(int& a, const FloatLineLayoutUnit& b)
450 {
451 a = a * b;
452 return a;
453 }
454
455 inline LayoutUnit& operator*=(LayoutUnit& a, const FloatLineLayoutUnit& b)
456 {
457 a = a * b;
458 return a;
459 }
460
461 inline FloatLineLayoutUnit& operator/=(FloatLineLayoutUnit& a, const FloatLineLa youtUnit& b)
462 {
463 a = a / b;
464 return a;
465 }
466
467 inline FloatLineLayoutUnit& operator/=(FloatLineLayoutUnit& a, float b)
468 {
469 a = a / b;
470 return a;
471 }
472
473 inline FloatLineLayoutUnit& operator/=(FloatLineLayoutUnit& a, int b)
474 {
475 a = a / b;
476 return a;
477 }
478
479 inline FloatLineLayoutUnit& operator/=(FloatLineLayoutUnit& a, const LayoutUnit& b)
480 {
481 a = a / b;
482 return a;
483 }
484
485 inline float& operator/=(float& a, const FloatLineLayoutUnit& b)
486 {
487 a = a / b;
488 return a;
489 }
490
491 inline int& operator/=(int& a, const FloatLineLayoutUnit& b)
492 {
493 a = a / b;
494 return a;
495 }
496
497 inline LayoutUnit& operator/=(LayoutUnit& a, const FloatLineLayoutUnit& b)
498 {
499 a = a / b;
500 return a;
501 }
502
503 inline FloatLineLayoutUnit& operator+=(FloatLineLayoutUnit& a, const FloatLineLa youtUnit& b)
504 {
505 a = a + b;
506 return a;
507 }
508
509 inline FloatLineLayoutUnit& operator+=(FloatLineLayoutUnit& a, float b)
510 {
511 a = a + b;
512 return a;
513 }
514
515 inline FloatLineLayoutUnit& operator+=(FloatLineLayoutUnit& a, int b)
516 {
517 a = a + b;
518 return a;
519 }
520
521 inline FloatLineLayoutUnit& operator+=(FloatLineLayoutUnit& a, const LayoutUnit& b)
522 {
523 a = a + b;
524 return a;
525 }
526
527 inline float& operator+=(float& a, const FloatLineLayoutUnit& b)
528 {
529 a = a + b;
530 return a;
531 }
532
533 inline int& operator+=(int& a, const FloatLineLayoutUnit& b)
534 {
535 a = a + b;
536 return a;
537 }
538
539 inline LayoutUnit& operator+=(LayoutUnit& a, const FloatLineLayoutUnit& b)
540 {
541 a = a + b;
542 return a;
543 }
544
545 inline FloatLineLayoutUnit& operator-=(FloatLineLayoutUnit& a, const FloatLineLa youtUnit& b)
546 {
547 a = a - b;
548 return a;
549 }
550
551 inline FloatLineLayoutUnit& operator-=(FloatLineLayoutUnit& a, float b)
552 {
553 a = a - b;
554 return a;
555 }
556
557 inline FloatLineLayoutUnit& operator-=(FloatLineLayoutUnit& a, int b)
558 {
559 a = a - b;
560 return a;
561 }
562
563 inline FloatLineLayoutUnit& operator-=(FloatLineLayoutUnit& a, const LayoutUnit& b)
564 {
565 a = a - b;
566 return a;
567 }
568
569 inline float& operator-=(float& a, const FloatLineLayoutUnit& b)
570 {
571 a = a - b;
572 return a;
573 }
574
575 inline int& operator-=(int& a, const FloatLineLayoutUnit& b)
576 {
577 a = a - b;
578 return a;
579 }
580
581 inline LayoutUnit& operator-=(LayoutUnit& a, const FloatLineLayoutUnit& b)
582 {
583 a = a - b;
584 return a;
585 }
586
587 class LayoutUnitLineLayoutUnit {
588 public:
589 LayoutUnitLineLayoutUnit() { }
590 LayoutUnitLineLayoutUnit(LayoutUnit f) : m_value(f) { }
591
592 float toFloat() const
593 {
594 return m_value.toFloat();
595 }
596
597 LayoutUnit toLayoutUnit() const
598 {
599 return m_value;
600 }
601
602 private:
603 LayoutUnit m_value;
604 };
605
606 class FloatPointLineLayoutPoint {
607 public:
608 FloatPointLineLayoutPoint() { }
609 explicit FloatPointLineLayoutPoint(const FloatPoint& floatPoint) : m_value(f loatPoint) { }
610 FloatPointLineLayoutPoint(FloatLineLayoutUnit x, FloatLineLayoutUnit y) : m_ value(x.toFloat(), y.toFloat()) { }
611 FloatPointLineLayoutPoint(const IntPoint& intPoint) : m_value(intPoint) { }
612 FloatPointLineLayoutPoint(const LayoutPoint& layoutPoint) : m_value(layoutPo int) { }
613
614 operator LayoutPoint() const { return toLayoutPoint(); }
615
616 FloatPoint toFloatPoint() const
617 {
618 return m_value;
619 }
620
621 LayoutPoint toLayoutPoint() const
622 {
623 return LayoutPoint(m_value);
624 }
625
626 LayoutPoint roundedLayoutPoint() const
627 {
628 return ::blink::roundedLayoutPoint(m_value);
629 }
630
631 LayoutPoint flooredLayoutPoint() const
632 {
633 return ::blink::flooredLayoutPoint(m_value);
634 }
635
636 FloatLineLayoutUnit x() const { return FloatLineLayoutUnit(m_value.x()); }
637 FloatLineLayoutUnit y() const { return FloatLineLayoutUnit(m_value.y()); }
638
639 void setX(FloatLineLayoutUnit x) { m_value.setX(x.toFloat()); }
640 void setY(FloatLineLayoutUnit y) { m_value.setY(y.toFloat()); }
641 void set(FloatLineLayoutUnit x, FloatLineLayoutUnit y) { m_value.set(x.toFlo at(), y.toFloat()); }
642
643 void move(FloatLineLayoutUnit dx, FloatLineLayoutUnit dy) { m_value.move(dx. toFloat(), dy.toFloat()); }
644 void moveBy(const LayoutPoint& layoutPoint) { m_value.moveBy(layoutPoint); }
645
646 void scale(float sx, float sy) { m_value.scale(sx, sy); }
647
648 private:
649 FloatPoint m_value;
650 };
651
652 class FloatSizeLineLayoutSize {
653 public:
654 FloatSizeLineLayoutSize() { }
655 explicit FloatSizeLineLayoutSize(const FloatSize& floatSize) : m_value(float Size) { }
656 FloatSizeLineLayoutSize(FloatLineLayoutUnit width, FloatLineLayoutUnit heigh t) : m_value(width.toFloat(), height.toFloat()) { }
657 explicit FloatSizeLineLayoutSize(const IntSize& size) : m_value(size) { }
658 FloatSizeLineLayoutSize(const LayoutSize& size) : m_value(size) { }
659
660 operator LayoutSize() const { return toLayoutSize(); }
661
662 FloatSize toFloatSize() const
663 {
664 return m_value;
665 }
666
667 LayoutSize toLayoutSize() const
668 {
669 return LayoutSize(m_value);
670 }
671
672 FloatLineLayoutUnit width() const { return FloatLineLayoutUnit(m_value.width ()); }
673 FloatLineLayoutUnit height() const { return FloatLineLayoutUnit(m_value.heig ht()); }
674
675 void setWidth(FloatLineLayoutUnit width) { m_value.setWidth(width.toFloat()) ; }
676 void setHeight(FloatLineLayoutUnit height) { m_value.setHeight(height.toFloa t()); }
677
678 private:
679 FloatSize m_value;
680 };
681
682 class FloatRectLineLayoutRect {
683 public:
684 FloatRectLineLayoutRect() { }
685 FloatRectLineLayoutRect(const FloatRect& floatRect) : m_value(floatRect) { }
686 FloatRectLineLayoutRect(const FloatPointLineLayoutPoint& location, const Flo atSizeLineLayoutSize& size)
687 : m_value(location.toFloatPoint(), size.toFloatSize()) { }
688 FloatRectLineLayoutRect(FloatLineLayoutUnit x, FloatLineLayoutUnit y, FloatL ineLayoutUnit width, FloatLineLayoutUnit height)
689 : m_value(x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat()) { }
690 explicit FloatRectLineLayoutRect(const IntRect& rect) : m_value(rect) { }
691 FloatRectLineLayoutRect(const LayoutRect& rect) : m_value(rect) { }
692
693 operator LayoutRect() const { return toLayoutRect(); }
694
695 FloatRect rawValue() const
696 {
697 return m_value;
698 }
699
700
701 FloatRect toFloatRect() const
702 {
703 return m_value;
704 }
705
706 LayoutRect toLayoutRect() const
707 {
708 return LayoutRect(m_value);
709 }
710
711 LayoutRect enclosingLayoutRect() const
712 {
713 return ::blink::enclosingLayoutRect(m_value);
714 }
715
716 FloatPointLineLayoutPoint location() const { return FloatPointLineLayoutPoin t(m_value.location()); }
717 FloatSizeLineLayoutSize size() const { return FloatSizeLineLayoutSize(m_valu e.size()); }
718
719 void setLocation(const FloatPointLineLayoutPoint& location) { m_value.setLoc ation(location.toFloatPoint()); }
720 void setSize(const FloatSizeLineLayoutSize& size) { m_value.setSize(size.toF loatSize()); }
721
722 FloatLineLayoutUnit x() const { return FloatLineLayoutUnit(m_value.x()); }
723 FloatLineLayoutUnit y() const { return FloatLineLayoutUnit(m_value.y()); }
724 FloatLineLayoutUnit maxX() const { return FloatLineLayoutUnit(m_value.maxX() ); }
725 FloatLineLayoutUnit maxY() const { return FloatLineLayoutUnit(m_value.maxY() ); }
726 FloatLineLayoutUnit width() const { return FloatLineLayoutUnit(m_value.width ()); }
727 FloatLineLayoutUnit height() const { return FloatLineLayoutUnit(m_value.heig ht()); }
728
729 void setX(FloatLineLayoutUnit x) { m_value.setX(x.toFloat()); }
730 void setY(FloatLineLayoutUnit y) { m_value.setY(y.toFloat()); }
731 void setWidth(FloatLineLayoutUnit width) { m_value.setWidth(width.toFloat()) ; }
732 void setHeight(FloatLineLayoutUnit height) { m_value.setHeight(height.toFloa t()); }
733
734 void unite(const FloatRectLineLayoutRect& rect) { m_value.unite(rect.toFloat Rect()); }
735
736 void scale(float s) { m_value.scale(s); }
737 void scale(float sx, float sy) { m_value.scale(sx, sy); }
738
739 bool intersects(const FloatRectLineLayoutRect& rect) const { return m_value. intersects(rect.toFloatRect()); }
740
741 private:
742 FloatRect m_value;
743 };
744
745 #if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
746 using LineLayoutUnit = LayoutUnitLineLayoutUnit;
747 using LineLayoutPoint = LayoutPointLineLayoutPoint;
748 using LineLayoutRect = LayoutRectLineLayoutRect;
749 using LineLayoutSize = LayoutSizeLineLayoutSize;
750 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
751 using LineLayoutUnit = FloatLineLayoutUnit;
752 using LineLayoutPoint = FloatPointLineLayoutPoint;
753 using LineLayoutRect = FloatRectLineLayoutRect;
754 using LineLayoutSize = FloatSizeLineLayoutSize;
755 #endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
756
757 using FloatWillBeLayoutUnit = LineLayoutUnit;
758 using FloatPointWillBeLayoutPoint = LineLayoutPoint;
759 using FloatRectWillBeLayoutRect = LineLayoutRect;
760 using FloatSizeWillBeLayoutSize = LineLayoutSize;
761
762 } // namespace blink
763
764 #endif // FloatToLayoutUnit_h
OLDNEW
« no previous file with comments | « Source/core/layout/line/EllipsisBox.cpp ('k') | Source/core/layout/line/InlineBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698