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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_fragment_base.cc

Issue 2282213002: [LayoutNG] Introduce NGPhysicalFragment and make NGFragment a 'view' (Closed)
Patch Set: address comments. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_fragment_base.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_base.cc b/third_party/WebKit/Source/core/layout/ng/ng_fragment_base.cc
index f462405271dd3c5fe3fac4c2188923caaef6845f..0193580f4274530889d7a892239262b452502d32 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_fragment_base.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_base.cc
@@ -3,37 +3,46 @@
// found in the LICENSE file.
#include "core/layout/ng/ng_fragment_base.h"
-#include "core/layout/ng/ng_fragment.h"
-#include "core/layout/ng/ng_text_fragment.h"
+
+#include "core/layout/ng/ng_physical_fragment_base.h"
namespace blink {
-NGFragmentBase::NGFragmentBase(NGLogicalSize size,
- NGLogicalSize overflow,
- NGWritingMode writing_mode,
- NGDirection direction,
- NGFragmentType type)
- : size_(size),
- overflow_(overflow),
- type_(type),
- writing_mode_(writing_mode),
- direction_(direction),
- has_been_placed_(false) {}
-
-void NGFragmentBase::SetOffset(LayoutUnit inline_offset,
- LayoutUnit block_offset) {
- // setOffset should only be called once.
- DCHECK(!has_been_placed_);
- offset_.inline_offset = inline_offset;
- offset_.block_offset = block_offset;
- has_been_placed_ = true;
+LayoutUnit NGFragmentBase::InlineSize() const {
+ return writing_mode_ == HorizontalTopBottom ? physical_fragment_->Width()
+ : physical_fragment_->Height();
+}
+
+LayoutUnit NGFragmentBase::BlockSize() const {
+ return writing_mode_ == HorizontalTopBottom ? physical_fragment_->Height()
+ : physical_fragment_->Width();
+}
+
+LayoutUnit NGFragmentBase::InlineOverflow() const {
+ return writing_mode_ == HorizontalTopBottom
+ ? physical_fragment_->WidthOverflow()
+ : physical_fragment_->HeightOverflow();
+}
+
+LayoutUnit NGFragmentBase::BlockOverflow() const {
+ return writing_mode_ == HorizontalTopBottom
+ ? physical_fragment_->HeightOverflow()
+ : physical_fragment_->WidthOverflow();
+}
+
+LayoutUnit NGFragmentBase::InlineOffset() const {
+ return writing_mode_ == HorizontalTopBottom ? physical_fragment_->LeftOffset()
+ : physical_fragment_->TopOffset();
+}
+
+LayoutUnit NGFragmentBase::BlockOffset() const {
+ return writing_mode_ == HorizontalTopBottom
+ ? physical_fragment_->TopOffset()
+ : physical_fragment_->LeftOffset();
}
DEFINE_TRACE(NGFragmentBase) {
- if (Type() == FragmentText)
- static_cast<NGTextFragment*>(this)->traceAfterDispatch(visitor);
- else
- static_cast<NGFragment*>(this)->traceAfterDispatch(visitor);
+ visitor->trace(physical_fragment_);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698