diff --git a/build/config/linux/pkg-config.py b/build/config/linux/pkg-config.py index d63b2d6..32068ad 100755 --- a/build/config/linux/pkg-config.py +++ b/build/config/linux/pkg-config.py
@@ -63,7 +63,7 @@ return libdir -def GetPkgConfigPrefixToStrip(args): +def GetPkgConfigPrefixToStrip(options, args): """Returns the prefix from pkg-config where packages are installed. This returned prefix is the one that should be stripped from the beginning of @@ -76,8 +76,8 @@ # instead of relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr). # To support this correctly, it's necessary to extract the prefix to strip # from pkg-config's |prefix| variable. - prefix = subprocess.check_output(["pkg-config", "--variable=prefix"] + args, - env=os.environ) + prefix = subprocess.check_output([options.pkg_config, + "--variable=prefix"] + args, env=os.environ) if prefix[-4] == '/usr': return prefix[4:] return prefix @@ -135,7 +135,7 @@ libdir = SetConfigPath(options) if options.debug: sys.stderr.write('PKG_CONFIG_LIBDIR=%s\n' % libdir) - prefix = GetPkgConfigPrefixToStrip(args) + prefix = GetPkgConfigPrefixToStrip(options, args) else: prefix = ''
diff --git a/build/config/linux/pkg_config.gni b/build/config/linux/pkg_config.gni index 23cec37..7358f8e 100644 --- a/build/config/linux/pkg_config.gni +++ b/build/config/linux/pkg_config.gni
@@ -51,21 +51,23 @@ # Define the args we pass to the pkg-config script for other build files that # need to invoke it manually. +pkg_config_args = [] + if (sysroot != "") { # Pass the sysroot if we're using one (it requires the CPU arch also). - pkg_config_args = [ + pkg_config_args += [ "-s", rebase_path(sysroot), "-a", current_cpu, ] -} else if (pkg_config != "") { - pkg_config_args = [ +} + +if (pkg_config != "") { + pkg_config_args += [ "-p", pkg_config, ] -} else { - pkg_config_args = [] } # Only use the custom libdir when building with the target sysroot.
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.cc index b85f373..796ff07 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.cc
@@ -10,6 +10,15 @@ namespace blink { +bool operator==(const NGBaselineRequest& lhs, const NGBaselineRequest& rhs) { + return lhs.algorithm_type == rhs.algorithm_type && + lhs.baseline_type == rhs.baseline_type; +} + +bool operator!=(const NGBaselineRequest& lhs, const NGBaselineRequest& rhs) { + return !(lhs == rhs); +} + bool NGBaseline::ShouldPropagateBaselines(const NGLayoutInputNode node) { if (node.IsInline()) return true;
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.h index 226dca1..d8561567 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.h
@@ -29,10 +29,12 @@ FontBaseline baseline_type; }; +bool operator==(const NGBaselineRequest&, const NGBaselineRequest&); +bool operator!=(const NGBaselineRequest&, const NGBaselineRequest&); + // Represents a computed baseline position. struct NGBaseline { - NGBaselineAlgorithmType algorithm_type; - FontBaseline baseline_type; + NGBaselineRequest request; LayoutUnit offset; // @return if the node needs to propagate baseline requests/results.
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc index 6ad8ccc..714c7e5 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -396,21 +396,18 @@ return content_size; } -// Add a baseline from a child line box. +// Add a baseline from a child line box fragment. // @return false if the specified child is not a line box. bool NGInlineLayoutAlgorithm::AddBaseline(const NGBaselineRequest& request, - unsigned child_index) { - const NGPhysicalFragment* child = - container_builder_.Children()[child_index].Get(); + const NGPhysicalFragment* child, + LayoutUnit child_offset) { if (!child->IsLineBox()) return false; const NGPhysicalLineBoxFragment* line_box = ToNGPhysicalLineBoxFragment(child); LayoutUnit offset = line_box->BaselinePosition(request.baseline_type); - container_builder_.AddBaseline( - request.algorithm_type, request.baseline_type, - offset + container_builder_.Offsets()[child_index].block_offset); + container_builder_.AddBaseline(request, offset + child_offset); return true; } @@ -426,13 +423,15 @@ case NGBaselineAlgorithmType::kAtomicInline: case NGBaselineAlgorithmType::kAtomicInlineForFirstLine: for (unsigned i = container_builder_.Children().size(); i--;) { - if (AddBaseline(request, i)) + if (AddBaseline(request, container_builder_.Children()[i].Get(), + container_builder_.Offsets()[i].block_offset)) break; } break; case NGBaselineAlgorithmType::kFirstLine: for (unsigned i = 0; i < container_builder_.Children().size(); i++) { - if (AddBaseline(request, i)) + if (AddBaseline(request, container_builder_.Children()[i].Get(), + container_builder_.Offsets()[i].block_offset)) break; } break;
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h index 3417275..2904aa8c 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h
@@ -68,7 +68,9 @@ LayoutUnit ComputeContentSize(const NGLineInfo&, LayoutUnit line_bottom); void PropagateBaselinesFromChildren(); - bool AddBaseline(const NGBaselineRequest&, unsigned); + bool AddBaseline(const NGBaselineRequest&, + const NGPhysicalFragment*, + LayoutUnit child_offset); NGInlineLayoutStateStack box_states_; LayoutUnit content_size_;
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc index 19f8663..e50e1ac6 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
@@ -366,12 +366,12 @@ // would synthesize box-baseline. if (NGBaseline::ShouldPropagateBaselines(layout_box)) { constraint_space_builder.AddBaselineRequest( - line_info.UseFirstLineStyle() - ? NGBaselineAlgorithmType::kAtomicInlineForFirstLine - : NGBaselineAlgorithmType::kAtomicInline, - IsHorizontalWritingMode(constraint_space_->WritingMode()) - ? FontBaseline::kAlphabeticBaseline - : FontBaseline::kIdeographicBaseline); + {line_info.UseFirstLineStyle() + ? NGBaselineAlgorithmType::kAtomicInlineForFirstLine + : NGBaselineAlgorithmType::kAtomicInline, + IsHorizontalWritingMode(constraint_space_->WritingMode()) + ? FontBaseline::kAlphabeticBaseline + : FontBaseline::kIdeographicBaseline}); } RefPtr<NGConstraintSpace> constraint_space = constraint_space_builder.SetIsNewFormattingContext(true)
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc index 9967122..20e2094 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -871,10 +871,11 @@ FromPlatformWritingMode(child_style.GetWritingMode())); } +// Add a baseline from a child box fragment. +// @return false if the specified child is not a box or is OOF. bool NGBlockLayoutAlgorithm::AddBaseline(const NGBaselineRequest& request, - unsigned child_index) { - const NGPhysicalFragment* child = - container_builder_.Children()[child_index].Get(); + const NGPhysicalFragment* child, + LayoutUnit child_offset) { if (!child->IsBox()) return false; LayoutObject* layout_object = child->GetLayoutObject(); @@ -883,10 +884,7 @@ const NGPhysicalBoxFragment* box = ToNGPhysicalBoxFragment(child); if (const NGBaseline* baseline = box->Baseline(request)) { - container_builder_.AddBaseline( - request.algorithm_type, request.baseline_type, - baseline->offset + - container_builder_.Offsets()[child_index].block_offset); + container_builder_.AddBaseline(request, baseline->offset + child_offset); return true; } return false; @@ -905,13 +903,15 @@ case NGBaselineAlgorithmType::kAtomicInline: case NGBaselineAlgorithmType::kAtomicInlineForFirstLine: for (unsigned i = container_builder_.Children().size(); i--;) { - if (AddBaseline(request, i)) + if (AddBaseline(request, container_builder_.Children()[i].Get(), + container_builder_.Offsets()[i].block_offset)) break; } break; case NGBaselineAlgorithmType::kFirstLine: for (unsigned i = 0; i < container_builder_.Children().size(); i++) { - if (AddBaseline(request, i)) + if (AddBaseline(request, container_builder_.Children()[i].Get(), + container_builder_.Offsets()[i].block_offset)) break; } break;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h index a08c6d0..55a1a63 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
@@ -148,7 +148,9 @@ void FinalizeForFragmentation(); void PropagateBaselinesFromChildren(); - bool AddBaseline(const NGBaselineRequest&, unsigned); + bool AddBaseline(const NGBaselineRequest&, + const NGPhysicalFragment*, + LayoutUnit child_offset); // Calculates logical offset for the current fragment using either // {@code content_size_} when the fragment doesn't know it's offset
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc index b93e9372..22c960c 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -392,10 +392,8 @@ break; case NGBaselineAlgorithmType::kFirstLine: { int position = box_->FirstLineBoxBaseline(); - if (position != -1) { - builder->AddBaseline(request.algorithm_type, request.baseline_type, - LayoutUnit(position)); - } + if (position != -1) + builder->AddBaseline(request, LayoutUnit(position)); break; } } @@ -425,7 +423,7 @@ if (box_->IsAtomicInlineLevel()) position -= box_->MarginOver(); - builder->AddBaseline(request.algorithm_type, request.baseline_type, position); + builder->AddBaseline(request, position); } void NGBlockNode::UseOldOutOfFlowPositioning() {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc index 49bad41..6066704e 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc
@@ -153,14 +153,17 @@ void NGConstraintSpaceBuilder::AddBaselineRequests( const Vector<NGBaselineRequest>& requests) { + DCHECK(baseline_requests_.IsEmpty()); baseline_requests_.AppendVector(requests); } NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::AddBaselineRequest( - NGBaselineAlgorithmType algorithm_type, - FontBaseline baseline_type) { - baseline_requests_.push_back( - NGBaselineRequest{algorithm_type, baseline_type}); + const NGBaselineRequest& request) { + for (const auto& existing : baseline_requests_) { + if (existing == request) + return *this; + } + baseline_requests_.push_back(request); return *this; }
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h index 9577646..aa6e73b 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h
@@ -61,8 +61,7 @@ const WTF::Optional<LayoutUnit>& clearance_offset); void AddBaselineRequests(const Vector<NGBaselineRequest>&); - NGConstraintSpaceBuilder& AddBaselineRequest(NGBaselineAlgorithmType, - FontBaseline); + NGConstraintSpaceBuilder& AddBaselineRequest(const NGBaselineRequest&); // Creates a new constraint space. This may be called multiple times, for // example the constraint space will be different for a child which:
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc index d5622b2..b49b66d 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
@@ -187,10 +187,13 @@ return *this; } -void NGFragmentBuilder::AddBaseline(NGBaselineAlgorithmType algorithm_type, - FontBaseline baseline_type, +void NGFragmentBuilder::AddBaseline(NGBaselineRequest request, LayoutUnit offset) { - baselines_.push_back(NGBaseline{algorithm_type, baseline_type, offset}); +#if DCHECK_IS_ON() + for (const auto& baseline : baselines_) + DCHECK(baseline.request != request); +#endif + baselines_.push_back(NGBaseline{request, offset}); } RefPtr<NGLayoutResult> NGFragmentBuilder::ToBoxFragment() {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h index 2eafa4f5..7efdca0 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h
@@ -106,6 +106,8 @@ RefPtr<NGLayoutResult> Abort(NGLayoutResult::NGLayoutResultStatus); + // A vector of child offsets. Initially set by AddChild(). + const Vector<NGLogicalOffset>& Offsets() const { return offsets_; } Vector<NGLogicalOffset>& MutableOffsets() { return offsets_; } void SwapUnpositionedFloats( @@ -121,8 +123,6 @@ return children_; } - const Vector<NGLogicalOffset>& Offsets() const { return offsets_; } - bool DidBreak() const { return did_break_; } NGFragmentBuilder& SetBorderEdges(NGBorderEdges border_edges) { @@ -130,7 +130,15 @@ return *this; } - void AddBaseline(NGBaselineAlgorithmType, FontBaseline, LayoutUnit); + // Layout algorithms should call this function for each baseline request in + // the constraint space. + // + // If a request should use a synthesized baseline from the box rectangle, + // algorithms can omit the call. + // + // This function should be called at most once for a given algorithm/baseline + // type pair. + void AddBaseline(NGBaselineRequest, LayoutUnit); private: // An out-of-flow positioned-candidate is a temporary data structure used
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc index 5f5aa39..adcc485 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc
@@ -31,8 +31,7 @@ const NGBaseline* NGPhysicalBoxFragment::Baseline( const NGBaselineRequest& request) const { for (const auto& baseline : baselines_) { - if (baseline.algorithm_type == request.algorithm_type && - baseline.baseline_type == request.baseline_type) + if (baseline.request == request) return &baseline; } return nullptr;