summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/logical_values.cc
blob: dc275ba19c4a8041ebe220b65308fa4bd6e4f293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/layout/logical_values.h"

namespace blink {

EClear ResolvedClear(EClear value, TextDirection direction) {
  switch (value) {
    case EClear::kInlineStart:
    case EClear::kInlineEnd: {
      return IsLtr(direction) == (value == EClear::kInlineStart)
                 ? EClear::kLeft
                 : EClear::kRight;
    }
    default:
      return value;
  }
}

EFloat ResolvedFloating(EFloat value, TextDirection direction) {
  switch (value) {
    case EFloat::kInlineStart:
    case EFloat::kInlineEnd: {
      return IsLtr(direction) == (value == EFloat::kInlineStart)
                 ? EFloat::kLeft
                 : EFloat::kRight;
    }
    default:
      return value;
  }
}

EResize ResolvedResize(EResize value, WritingMode writing_mode) {
  switch (value) {
    case EResize::kBlock:
    case EResize::kInline: {
      return IsHorizontalWritingMode(writing_mode) == (value == EResize::kBlock)
                 ? EResize::kVertical
                 : EResize::kHorizontal;
    }
    default:
      return value;
  }
}

}  // namespace blink