1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "printing/page_range.h"
15 void PageRange::Normalize(PageRanges& ranges) {
16 std::sort(ranges.begin(), ranges.end());
17 PageRanges::iterator dst = ranges.begin();
18 for (PageRanges::iterator src = ranges.begin() + 1; src < ranges.end();
20 if (dst->to + 1 < src->from) {
24 dst->to = std::max(dst->to, src->to);
26 if (dst < ranges.end())
28 ranges.resize(dst - ranges.begin());
31 } // namespace printing