0

[cleanup] Wrap comment variable names with backticks in //pdf/

The Chromium C++ Dos and Don'ts [1] was changed to encourage wrapping
variable names in comments with backticks (`) instead of pipes (|).

Update all comments in the //pdf/ directory so a consistent style is
used.

The update was performed automagically with the following command:

grep -rl '|' --include \*.h --include \*.cc pdf/ | \
  xargs perl -i -pe 's/(?<=\W)\||\|(?=\W)/`/g if /^\s*\/\//;'

The above command assumes that the comments of interest only start with
"//" and are not wrapped in "/*...*/".

[1] 463a912f0a/styleguide/c++/c++-dos-and-donts.md (comment-style)

Change-Id: Iefcdb3136345ab3eaa14d751b5004373129739cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2848376
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Auto-Submit: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#875851}
This commit is contained in:
Daniel Hosseinian
2021-04-23 21:18:35 +00:00
committed by Chromium LUCI CQ
parent c758a87ce4
commit e257d96e08
37 changed files with 297 additions and 297 deletions

@ -17,8 +17,8 @@ struct AccessibilityPageInfo;
struct AccessibilityPageObjects;
struct AccessibilityTextRunInfo;
// Retrieve |page_info|, |text_runs|, |chars|, and |page_objects| from
// |engine| for the page at 0-indexed |page_index|. Returns true on success with
// Retrieve `page_info`, `text_runs`, `chars`, and `page_objects` from
// `engine` for the page at 0-indexed `page_index`. Returns true on success with
// all out parameters filled, or false on failure with all out parameters
// untouched.
bool GetAccessibilityInfo(PDFEngine* engine,

@ -297,13 +297,13 @@ struct AccessibilityButtonInfo {
// Represents count of controls in the control group. A group of interactive
// form annotations is collectively called a form control group. Here, an
// interactive form annotation, should be either a radio button or a
// checkbox. Value of |control_count| is >= 1.
// checkbox. Value of `control_count` is >= 1.
uint32_t control_count = 0;
// Represents index of the control in the control group. A group of
// interactive form annotations is collectively called a form control group.
// Here, an interactive form annotation, should be either a radio button or
// a checkbox. Value of |control_index| should always be less than
// |control_count|.
// a checkbox. Value of `control_index` should always be less than
// `control_count`.
uint32_t control_index = 0;
// Index of this button in the collection of buttons in the page.
uint32_t index_in_page = 0;

@ -25,7 +25,7 @@ namespace chrome_pdf {
//
// All layout units are pixels.
//
// The |Options| class controls the behavior of the layout, such as the default
// The `Options` class controls the behavior of the layout, such as the default
// orientation of pages.
class DocumentLayout final {
public:
@ -127,7 +127,7 @@ class DocumentLayout final {
return page_layouts_[page_index].inner_rect;
}
// Computes the layout for a given list of |page_sizes| based on |options_|.
// Computes the layout for a given list of `page_sizes` based on `options_`.
void ComputeLayout(const std::vector<gfx::Size>& page_sizes);
private:
@ -144,15 +144,15 @@ class DocumentLayout final {
void ComputeOneUpLayout(const std::vector<gfx::Size>& page_sizes);
void ComputeTwoUpOddLayout(const std::vector<gfx::Size>& page_sizes);
// Copies |source_rect| to |destination_rect|, setting |dirty_| to true if
// |destination_rect| is modified as a result.
// Copies `source_rect` to `destination_rect`, setting `dirty_` to true if
// `destination_rect` is modified as a result.
void CopyRectIfModified(const gfx::Rect& source_rect,
gfx::Rect& destination_rect);
Options options_;
// Indicates if the layout has changed in an externally-observable way,
// usually as a result of calling |ComputeLayout()| with different inputs.
// usually as a result of calling `ComputeLayout()` with different inputs.
//
// Some operations that may trigger layout changes:
// * Changing page sizes

@ -32,7 +32,7 @@ namespace {
// Experimentally chosen value.
constexpr int kChunkCloseDistance = 10;
// Return true if the HTTP response of |loader| is a successful one and loading
// Return true if the HTTP response of `loader` is a successful one and loading
// should continue. 4xx error indicate subsequent requests will fail too.
// e.g. resource has been removed from the server while loading it. 301
// indicates a redirect was returned which won't be successful because we
@ -379,7 +379,7 @@ uint32_t DocumentLoaderImpl::EndOfCurrentChunk() const {
void DocumentLoaderImpl::ReadComplete() {
if (GetDocumentSize() != 0) {
// If there is remaining data in |chunk_|, then save whatever can be saved.
// If there is remaining data in `chunk_`, then save whatever can be saved.
// e.g. In the underrun case.
if (chunk_.data_size != 0)
SaveChunkData();

@ -83,7 +83,7 @@ PageInsetSizes GetPageInsetsForTwoUpView(
int horizontal_separator) {
DCHECK_LT(page_index, num_of_pages);
// Don't change |two_up_insets| if the page is on the left side and is the
// Don't change `two_up_insets` if the page is on the left side and is the
// last page. In this case, the shadows on both sides should be the same size.
PageInsetSizes two_up_insets = single_view_insets;
if (page_index % 2 == 1)

@ -41,38 +41,38 @@ struct IndexedPage {
gfx::Rect rect;
};
// Given a right page's |bottom_gap|, reduce it to only the part of |bottom_gap|
// that is directly below the right page by translating |bottom_gap| to |page_x|
// Given a right page's `bottom_gap`, reduce it to only the part of `bottom_gap`
// that is directly below the right page by translating `bottom_gap` to `page_x`
// and halving its width. This avoids over-drawing empty space on the already
// drawn left page and the empty space to the right of the page.
void AdjustBottomGapForRightSidePage(int page_x, gfx::Rect* bottom_gap);
// Given |doc_width|, horizontally center |rect| within the document.
// |doc_width| must be greater than or equal to |rect|.
// Given `doc_width`, horizontally center `rect` within the document.
// `doc_width` must be greater than or equal to `rect`.
void CenterRectHorizontally(int doc_width, gfx::Rect* rect);
// Given |rect_size|, sets the width of |doc_size| to the max of |rect_size|'s
// width and |doc_size|'s width. Also adds the height of |rect_size| to
// |doc_size|'s height.
// Given `rect_size`, sets the width of `doc_size` to the max of `rect_size`'s
// width and `doc_size`'s width. Also adds the height of `rect_size` to
// `doc_size`'s height.
void ExpandDocumentSize(const gfx::Size& rect_size, gfx::Size* doc_size);
// Given |page_rect_bottom| and |bottom_rect| in the same coordinate space,
// return a gfx::Rect object representing the portion of |bottom_rect| that is
// below |page_rect_bottom|. Returns an empty rectangle if |page_rect_bottom|
// is greater than or equal to |bottom_rect.bottom()|.
// Given `page_rect_bottom` and `bottom_rect` in the same coordinate space,
// return a gfx::Rect object representing the portion of `bottom_rect` that is
// below `page_rect_bottom`. Returns an empty rectangle if `page_rect_bottom`
// is greater than or equal to `bottom_rect.bottom()`.
gfx::Rect GetBottomGapBetweenRects(int page_rect_bottom,
const gfx::Rect& bottom_rect);
// Given |visible_pages| and |visible_screen| in the same coordinates, return
// the index of the page in |visible_pages| which has the largest proportion of
// its area intersecting with |visible_screen|. If there is a tie, return the
// page with the lower index. Returns -1 if |visible_pages| is empty. Returns
// first page in |visible_pages| if no page intersects with |visible_screen|.
// Given `visible_pages` and `visible_screen` in the same coordinates, return
// the index of the page in `visible_pages` which has the largest proportion of
// its area intersecting with `visible_screen`. If there is a tie, return the
// page with the lower index. Returns -1 if `visible_pages` is empty. Returns
// first page in `visible_pages` if no page intersects with `visible_screen`.
int GetMostVisiblePage(const std::vector<IndexedPage>& visible_pages,
const gfx::Rect& visible_screen);
// Given |page_index|, and |num_of_pages|, return the configuration of
// |single_view_insets| and |horizontal_separator| for the current page in
// Given `page_index`, and `num_of_pages`, return the configuration of
// `single_view_insets` and `horizontal_separator` for the current page in
// two-up view.
PageInsetSizes GetPageInsetsForTwoUpView(
size_t page_index,
@ -80,23 +80,23 @@ PageInsetSizes GetPageInsetsForTwoUpView(
const PageInsetSizes& single_view_insets,
int horizontal_separator);
// Given |rect_size| and |document_size| create a horizontally centered
// Given `rect_size` and `document_size` create a horizontally centered
// gfx::Rect placed at the bottom of the current document.
gfx::Rect GetRectForSingleView(const gfx::Size& rect_size,
const gfx::Size& document_size);
// Given |rect| in document coordinates, a |position| in screen coordinates,
// and a |zoom| factor, returns the rectangle in screen coordinates (i.e.
// 0,0 is top left corner of plugin area). An empty |rect| will always
// result in an empty output rect. For |zoom|, a value of 1 means 100%.
// |zoom| is never less than or equal to 0.
// Given `rect` in document coordinates, a `position` in screen coordinates,
// and a `zoom` factor, returns the rectangle in screen coordinates (i.e.
// 0,0 is top left corner of plugin area). An empty `rect` will always
// result in an empty output rect. For `zoom`, a value of 1 means 100%.
// `zoom` is never less than or equal to 0.
gfx::Rect GetScreenRect(const gfx::Rect& rect,
const gfx::Point& position,
double zoom);
// Given |page_y|, |page_height|, |inset_sizes|, |doc_width|, and
// |bottom_separator| all in the same coordinate space, return the page and its
// surrounding border areas and |bottom_separator|. This includes the sides if
// Given `page_y`, `page_height`, `inset_sizes`, `doc_width`, and
// `bottom_separator` all in the same coordinate space, return the page and its
// surrounding border areas and `bottom_separator`. This includes the sides if
// the page is narrower than the document.
gfx::Rect GetSurroundingRect(int page_y,
int page_height,
@ -104,38 +104,38 @@ gfx::Rect GetSurroundingRect(int page_y,
int doc_width,
int bottom_separator);
// Given |page_rect| in document coordinates, |inset_sizes|, and
// |bottom_separator|, return a gfx::Rect object representing the gap on the
// Given `page_rect` in document coordinates, `inset_sizes`, and
// `bottom_separator`, return a gfx::Rect object representing the gap on the
// left side of the page created by insetting the page. I.e. the difference,
// on the left side, between the initial |page_rect| and the |page_rect| inset
// with |inset_sizes| (current value of |page_rect|).
// The x coordinate of |page_rect| must be greater than or equal to
// |inset_sizes.left|.
// on the left side, between the initial `page_rect` and the `page_rect` inset
// with `inset_sizes` (current value of `page_rect`).
// The x coordinate of `page_rect` must be greater than or equal to
// `inset_sizes.left`.
gfx::Rect GetLeftFillRect(const gfx::Rect& page_rect,
const PageInsetSizes& inset_sizes,
int bottom_separator);
// Same as GetLeftFillRect(), but for the right side of |page_rect| and also
// depends on the |doc_width|. Additionally, |doc_width| must be greater than or
// equal to the sum of |page_rect.right| and |inset_sizes.right|.
// Same as GetLeftFillRect(), but for the right side of `page_rect` and also
// depends on the `doc_width`. Additionally, `doc_width` must be greater than or
// equal to the sum of `page_rect.right` and `inset_sizes.right`.
gfx::Rect GetRightFillRect(const gfx::Rect& page_rect,
const PageInsetSizes& inset_sizes,
int doc_width,
int bottom_separator);
// Same as GetLeftFillRect(), but for the bottom side of |page_rect|.
// Same as GetLeftFillRect(), but for the bottom side of `page_rect`.
gfx::Rect GetBottomFillRect(const gfx::Rect& page_rect,
const PageInsetSizes& inset_sizes,
int bottom_separator);
// Given |rect_size|, create a gfx::Rect where the top-right corner lies at
// |position|. The width of |rect_size| must be less than or equal to the x
// value for |position|.
// Given `rect_size`, create a gfx::Rect where the top-right corner lies at
// `position`. The width of `rect_size` must be less than or equal to the x
// value for `position`.
gfx::Rect GetLeftRectForTwoUpView(const gfx::Size& rect_size,
const gfx::Point& position);
// Given |rect_size|, create a gfx::Rect where the top-left corner lies at
// |position|.
// Given `rect_size`, create a gfx::Rect where the top-left corner lies at
// `position`.
gfx::Rect GetRightRectForTwoUpView(const gfx::Size& rect_size,
const gfx::Point& position);

@ -90,7 +90,7 @@ TEST(CoordinateTest, GetBottomGapBetweenRects) {
EXPECT_EQ(gfx::Rect(150, -100, 400, 150),
GetBottomGapBetweenRects(-100, {150, 0, 400, 50}));
// Test case where |page_rect_bottom| >= |dirty_rect.bottom()|.
// Test case where `page_rect_bottom` >= `dirty_rect.bottom()`.
EXPECT_EQ(gfx::Rect(0, 0, 0, 0),
GetBottomGapBetweenRects(1400, {0, 10, 300, 500}));
}

@ -110,7 +110,7 @@ constexpr base::TimeDelta kFindResultCooldown =
// Same value as printing::COMPLETE_PREVIEW_DOCUMENT_INDEX.
constexpr int kCompletePDFIndex = -1;
// A different negative value to differentiate itself from |kCompletePDFIndex|.
// A different negative value to differentiate itself from `kCompletePDFIndex`.
constexpr int kInvalidPDFIndex = -2;
constexpr char kPPPPdfInterface[] = PPP_PDF_INTERFACE_1;
@ -319,7 +319,7 @@ const PPP_Pdf ppp_private = {
};
int ExtractPrintPreviewPageIndex(base::StringPiece src_url) {
// Sample |src_url| format: chrome://print/id/page_index/print.pdf
// Sample `src_url` format: chrome://print/id/page_index/print.pdf
// The page_index is zero-based, but can be negative with special meanings.
std::vector<base::StringPiece> url_substr =
base::SplitStringPiece(src_url.substr(strlen(kChromePrint)), "/",
@ -555,7 +555,7 @@ bool OutOfProcessInstance::Init(uint32_t argc,
InitializeEngine(script_option);
// If we're in print preview mode we don't need to load the document yet.
// A |kJSResetPrintPreviewModeType| message will be sent to the plugin letting
// A `kJSResetPrintPreviewModeType` message will be sent to the plugin letting
// it know the url to load. By not loading here we avoid loading the same
// document twice.
if (IsPrintPreview())
@ -1018,9 +1018,9 @@ void OutOfProcessInstance::HandleResetPrintPreviewModeMessage(
}
// The page count is zero if the print preview source is a PDF. In which
// case, the page index for |url| should be at |kCompletePDFIndex|.
// case, the page index for `url` should be at `kCompletePDFIndex`.
// When the page count is not zero, then the source is not PDF. In which
// case, the page index for |url| should be non-negative.
// case, the page index for `url` should be non-negative.
bool is_previewing_pdf = IsPreviewingPDF(print_preview_page_count);
int page_index = ExtractPrintPreviewPageIndex(url);
if ((is_previewing_pdf && page_index != kCompletePDFIndex) ||

@ -178,14 +178,14 @@ class OutOfProcessInstance : public PdfViewPluginBase,
kEdited = 2,
};
// Reduces the document to 1 page and appends |print_preview_page_count_| - 1
// Reduces the document to 1 page and appends `print_preview_page_count_` - 1
// blank pages to the document for print preview.
void AppendBlankPrintPreviewPages();
// Process the preview page data information. |src_url| specifies the preview
// page data location. The |src_url| is in the format:
// Process the preview page data information. `src_url` specifies the preview
// page data location. The `src_url` is in the format:
// chrome://print/id/page_number/print.pdf
// |dest_page_index| specifies the blank page index that needs to be replaced
// `dest_page_index` specifies the blank page index that needs to be replaced
// with the new page data.
void ProcessPreviewPageInfo(const std::string& src_url, int dest_page_index);
// Load the next available preview page into the blank page.
@ -223,11 +223,11 @@ class OutOfProcessInstance : public PdfViewPluginBase,
PrintSettings print_settings_;
// The PreviewModeClient used for print preview. Will be passed to
// |preview_engine_|.
// `preview_engine_`.
std::unique_ptr<PreviewModeClient> preview_client_;
// This engine is used to render the individual preview page data. This is
// used only in print preview mode. This will use |PreviewModeClient|
// used only in print preview mode. This will use `PreviewModeClient`
// interface which has very limited access to the pp::Instance.
std::unique_ptr<PDFiumEngine> preview_engine_;
@ -252,10 +252,10 @@ class OutOfProcessInstance : public PdfViewPluginBase,
int print_preview_page_count_ = -1;
// Number of pages loaded in print preview mode for non-PDF source. Always
// less than or equal to |print_preview_page_count_|.
// less than or equal to `print_preview_page_count_`.
int print_preview_loaded_page_count_ = -1;
// Used to manage loaded print preview page information. A |PreviewPageInfo|
// Used to manage loaded print preview page information. A `PreviewPageInfo`
// consists of data source URL string and the page index in the destination
// document.
// The URL string embeds a page number that can be found with
@ -270,7 +270,7 @@ class OutOfProcessInstance : public PdfViewPluginBase,
std::unique_ptr<pp::TextInput_Dev> text_input_;
// Whether an update to the number of find results found was sent less than
// |kFindResultCooldownMs| milliseconds ago.
// `kFindResultCooldownMs` milliseconds ago.
bool recently_sent_find_update_ = false;
// The tickmarks.

@ -31,7 +31,7 @@ PageOrientation RotateClockwise(PageOrientation orientation) {
}
PageOrientation RotateCounterclockwise(PageOrientation orientation) {
// Adding |kLast| is equivalent to rotating one step counterclockwise.
// Adding `kLast` is equivalent to rotating one step counterclockwise.
return AddOrientations(orientation, PageOrientation::kLast);
}

@ -90,8 +90,8 @@ class PaintAggregator {
InternalPaintUpdate();
~InternalPaintUpdate();
// Computes the rect damaged by scrolling within |scroll_rect| by
// |scroll_delta|. This rect must be repainted. It is not included in
// Computes the rect damaged by scrolling within `scroll_rect` by
// `scroll_delta`. This rect must be repainted. It is not included in
// paint_rects.
gfx::Rect GetScrollDamage() const;
@ -113,8 +113,8 @@ class PaintAggregator {
const gfx::Vector2d& amount) const;
void InvalidateScrollRect();
// Internal method used by InvalidateRect. If |check_scroll| is true, then the
// method checks if there's a pending scroll and if so also invalidates |rect|
// Internal method used by InvalidateRect. If `check_scroll` is true, then the
// method checks if there's a pending scroll and if so also invalidates `rect`
// in the new scroll position.
void InvalidateRectInternal(const gfx::Rect& rect, bool check_scroll);

@ -185,7 +185,7 @@ void PaintManager::DoPaint() {
// have an unpainted device bound. The needs_binding flag tells us whether to
// do this later.
//
// Note that |has_pending_resize_| will always be set on the first DoPaint().
// Note that `has_pending_resize_` will always be set on the first DoPaint().
DCHECK(graphics_ || has_pending_resize_);
if (has_pending_resize_) {
plugin_size_ = pending_size_;

@ -42,7 +42,7 @@ class PaintManager {
class Client {
public:
// Creates a new, unbound `Graphics` for the paint manager, with the given
// |size| and always-opaque rendering.
// `size` and always-opaque rendering.
virtual std::unique_ptr<Graphics> CreatePaintGraphics(
const gfx::Size& size) = 0;
@ -134,8 +134,8 @@ class PaintManager {
float GetEffectiveDeviceScale() const;
// Set the transform for the graphics layer.
// If |schedule_flush| is true, it ensures a flush will be scheduled for
// this change. If |schedule_flush| is false, then the change will not take
// If `schedule_flush` is true, it ensures a flush will be scheduled for
// this change. If `schedule_flush` is false, then the change will not take
// effect until another change causes a flush.
void SetTransform(float scale,
const gfx::Point& origin,

@ -33,7 +33,7 @@ namespace chrome_pdf {
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Create a flattened PDF document from an existing PDF document.
// |input_buffer| is the buffer that contains the entire PDF document to be
// `input_buffer` is the buffer that contains the entire PDF document to be
// flattened.
std::vector<uint8_t> CreateFlattenedPdf(base::span<const uint8_t> input_buffer);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
@ -46,36 +46,36 @@ enum PrintingMode {
kTextOnly = 1,
kPostScript2 = 2,
kPostScript3 = 3,
// Values 4 and 5 are similar to |kPostScript2| and |kPostScript3|, but are
// Values 4 and 5 are similar to `kPostScript2` and `kPostScript3`, but are
// not intended for use in sandboxed environments like Chromium's.
kEmfWithReducedRasterization = 6,
};
// |pdf_buffer| is the buffer that contains the entire PDF document to be
// `pdf_buffer` is the buffer that contains the entire PDF document to be
// rendered.
// |page_number| is the 0-based index of the page to be rendered.
// |dc| is the device context to render into.
// |dpi_x| and |dpi_y| is the resolution.
// |bounds_origin_x|, |bounds_origin_y|, |bounds_width| and |bounds_height|
// `page_number` is the 0-based index of the page to be rendered.
// `dc` is the device context to render into.
// `dpi_x` and `dpi_y` is the resolution.
// `bounds_origin_x`, `bounds_origin_y`, `bounds_width` and `bounds_height`
// specify a bounds rectangle within the DC in which to render the PDF
// page.
// |fit_to_bounds| specifies whether the output should be shrunk to fit the
// `fit_to_bounds` specifies whether the output should be shrunk to fit the
// supplied bounds if the page size is larger than the bounds in any
// dimension. If this is false, parts of the PDF page that lie outside
// the bounds will be clipped.
// |stretch_to_bounds| specifies whether the output should be stretched to fit
// `stretch_to_bounds` specifies whether the output should be stretched to fit
// the supplied bounds if the page size is smaller than the bounds in any
// dimension.
// If both |fit_to_bounds| and |stretch_to_bounds| are true, then
// |fit_to_bounds| is honored first.
// |keep_aspect_ratio| If any scaling is to be done is true, this flag
// If both `fit_to_bounds` and `stretch_to_bounds` are true, then
// `fit_to_bounds` is honored first.
// `keep_aspect_ratio` If any scaling is to be done is true, this flag
// specifies whether the original aspect ratio of the page should be
// preserved while scaling.
// |center_in_bounds| specifies whether the final image (after any scaling is
// `center_in_bounds` specifies whether the final image (after any scaling is
// done) should be centered within the given bounds.
// |autorotate| specifies whether the final image should be rotated to match
// `autorotate` specifies whether the final image should be rotated to match
// the output bound.
// |use_color| specifies color or grayscale.
// `use_color` specifies color or grayscale.
// Returns false if the document or the page number are not valid.
bool RenderPDFPageToDC(base::span<const uint8_t> pdf_buffer,
int page_number,
@ -101,7 +101,7 @@ void SetPDFUseGDIPrinting(bool enable);
void SetPDFUsePrintMode(int mode);
#endif // defined(OS_WIN)
// |page_count| and |max_page_width| are optional and can be NULL.
// `page_count` and `max_page_width` are optional and can be NULL.
// Returns false if the document is not valid.
bool GetPDFDocInfo(base::span<const uint8_t> pdf_buffer,
int* page_count,
@ -118,9 +118,9 @@ base::Value GetPDFStructTreeForPage(base::span<const uint8_t> pdf_buffer,
int page_index);
// Gets the dimensions of a specific page in a document.
// |pdf_buffer| is the buffer that contains the entire PDF document to be
// `pdf_buffer` is the buffer that contains the entire PDF document to be
// rendered.
// |page_number| is the page number that the function will get the dimensions
// `page_number` is the page number that the function will get the dimensions
// of.
// Returns the size of the page in points, or nullopt if the document or the
// page number are not valid.
@ -148,13 +148,13 @@ struct RenderOptions {
};
// Renders PDF page into 4-byte per pixel BGRA color bitmap.
// |pdf_buffer| is the buffer that contains the entire PDF document to be
// `pdf_buffer` is the buffer that contains the entire PDF document to be
// rendered.
// |page_number| is the 0-based index of the page to be rendered.
// |bitmap_buffer| is the output buffer for bitmap.
// |bitmap_size| is the size of the output bitmap.
// |dpi| is the 2D resolution.
// |options| is the options to render with.
// `page_number` is the 0-based index of the page to be rendered.
// `bitmap_buffer` is the output buffer for bitmap.
// `bitmap_size` is the size of the output bitmap.
// `dpi` is the 2D resolution.
// `options` is the options to render with.
// Returns false if the document or the page number are not valid.
bool RenderPDFPageToBitmap(base::span<const uint8_t> pdf_buffer,
int page_number,
@ -164,22 +164,22 @@ bool RenderPDFPageToBitmap(base::span<const uint8_t> pdf_buffer,
const RenderOptions& options);
// Convert multiple PDF pages into a N-up PDF.
// |input_buffers| is the vector of buffers with each buffer contains a PDF.
// `input_buffers` is the vector of buffers with each buffer contains a PDF.
// If any of the PDFs contains multiple pages, only the first page of the
// document is used.
// |pages_per_sheet| is the number of pages to put on one sheet.
// |page_size| is the output page size, measured in PDF "user space" units.
// |printable_area| is the output page printable area, measured in PDF
// "user space" units. Should be smaller than |page_size|.
// `pages_per_sheet` is the number of pages to put on one sheet.
// `page_size` is the output page size, measured in PDF "user space" units.
// `printable_area` is the output page printable area, measured in PDF
// "user space" units. Should be smaller than `page_size`.
//
// |page_size| is the print media size. The page size of the output N-up PDF is
// determined by the |pages_per_sheet|, the orientation of the PDF pages
// contained in the |input_buffers|, and the media page size |page_size|. For
// example, when |page_size| = 512x792, |pages_per_sheet| = 2, and the
// orientation of |input_buffers| = portrait, the output N-up PDF will be
// `page_size` is the print media size. The page size of the output N-up PDF is
// determined by the `pages_per_sheet`, the orientation of the PDF pages
// contained in the `input_buffers`, and the media page size `page_size`. For
// example, when `page_size` = 512x792, `pages_per_sheet` = 2, and the
// orientation of `input_buffers` = portrait, the output N-up PDF will be
// 792x512.
// See printing::NupParameters for more details on how the output page
// orientation is determined, to understand why |page_size| may be swapped in
// orientation is determined, to understand why `page_size` may be swapped in
// some cases.
std::vector<uint8_t> ConvertPdfPagesToNupPdf(
std::vector<base::span<const uint8_t>> input_buffers,
@ -188,12 +188,12 @@ std::vector<uint8_t> ConvertPdfPagesToNupPdf(
const gfx::Rect& printable_area);
// Convert a PDF document to a N-up PDF document.
// |input_buffer| is the buffer that contains the entire PDF document to be
// `input_buffer` is the buffer that contains the entire PDF document to be
// converted to a N-up PDF document.
// |pages_per_sheet| is the number of pages to put on one sheet.
// |page_size| is the output page size, measured in PDF "user space" units.
// |printable_area| is the output page printable area, measured in PDF
// "user space" units. Should be smaller than |page_size|.
// `pages_per_sheet` is the number of pages to put on one sheet.
// `page_size` is the output page size, measured in PDF "user space" units.
// `printable_area` is the output page printable area, measured in PDF
// "user space" units. Should be smaller than `page_size`.
//
// Refer to the description of ConvertPdfPagesToNupPdf to understand how the
// output page size will be calculated.

@ -76,7 +76,7 @@ struct DocumentMetadata;
using SendThumbnailCallback = base::OnceCallback<void(Thumbnail)>;
// Do one time initialization of the SDK.
// If |enable_v8| is false, then the PDFEngine will not be able to run
// If `enable_v8` is false, then the PDFEngine will not be able to run
// JavaScript.
void InitializeSDK(bool enable_v8);
// Tells the SDK that we're shutting down.
@ -107,8 +107,8 @@ class PDFEngine {
// Number of parameters for the view.
unsigned long num_params;
// Parameters for the view. Their meaning depends on the |view| and their
// number is defined by |num_params| but is at most |kMaxViewParams|. Note:
// Parameters for the view. Their meaning depends on the `view` and their
// number is defined by `num_params` but is at most `kMaxViewParams`. Note:
// If a parameter stands for the x/y coordinates, it should be transformed
// into the corresponding in-screen coordinates before it's sent to the
// viewport.
@ -147,15 +147,15 @@ class PDFEngine {
// Scroll by a given delta relative to the current position.
virtual void ScrollBy(const gfx::Vector2d& delta) {}
// Scroll to zero-based |page|.
// Scroll to zero-based `page`.
virtual void ScrollToPage(int page) {}
// Navigate to the given url.
virtual void NavigateTo(const std::string& url,
WindowOpenDisposition disposition) {}
// Navigate to the given destination. Zero-based |page| index. |x|, |y| and
// |zoom| are optional and can be nullptr.
// Navigate to the given destination. Zero-based `page` index. `x`, `y` and
// `zoom` are optional and can be nullptr.
virtual void NavigateToDestination(int page,
const float* x,
const float* y,
@ -359,13 +359,13 @@ class PDFEngine {
// Gets the list of DocumentAttachmentInfo from the document.
virtual const std::vector<DocumentAttachmentInfo>&
GetDocumentAttachmentInfoList() const = 0;
// Gets the content of an attachment by the attachment's |index|. |index|
// must be in the range of [0, attachment_count-1), where |attachment_count|
// Gets the content of an attachment by the attachment's `index`. `index`
// must be in the range of [0, attachment_count-1), where `attachment_count`
// is the number of attachments embedded in the document.
// The caller of this method is responsible for checking whether the
// attachment is readable, attachment size is not 0 byte, and the return
// value's size matches the corresponding DocumentAttachmentInfo's
// |size_bytes|.
// `size_bytes`.
virtual std::vector<uint8_t> GetAttachmentData(size_t index) = 0;
// Gets metadata about the document.
virtual const DocumentMetadata& GetDocumentMetadata() const = 0;
@ -397,26 +397,26 @@ class PDFEngine {
// Given a start char index, find the longest continuous run of text that's
// in a single direction and with the same text style. Return a filled out
// AccessibilityTextRunInfo on success or base::nullopt on failure. e.g. When
// |start_char_index| is out of bounds.
// `start_char_index` is out of bounds.
virtual base::Optional<AccessibilityTextRunInfo> GetTextRunInfo(
int page_index,
int start_char_index) = 0;
// For all the links on page |page_index|, get their urls, underlying text
// For all the links on page `page_index`, get their urls, underlying text
// ranges and bounding boxes.
virtual std::vector<AccessibilityLinkInfo> GetLinkInfo(
int page_index,
const std::vector<AccessibilityTextRunInfo>& text_runs) = 0;
// For all the images in page |page_index|, get their alt texts and bounding
// For all the images in page `page_index`, get their alt texts and bounding
// boxes.
virtual std::vector<AccessibilityImageInfo> GetImageInfo(
int page_index,
uint32_t text_run_count) = 0;
// For all the highlights in page |page_index|, get their underlying text
// For all the highlights in page `page_index`, get their underlying text
// ranges and bounding boxes.
virtual std::vector<AccessibilityHighlightInfo> GetHighlightInfo(
int page_index,
const std::vector<AccessibilityTextRunInfo>& text_runs) = 0;
// For all the text fields in page |page_index|, get their properties like
// For all the text fields in page `page_index`, get their properties like
// name, value, bounding boxes etc.
virtual std::vector<AccessibilityTextFieldInfo> GetTextFieldInfo(
int page_index,
@ -441,11 +441,11 @@ class PDFEngine {
// a dictionary Value of the same structure.
virtual base::Value GetBookmarks() = 0;
// Append blank pages to make a 1-page document to a |num_pages| document.
// Append blank pages to make a 1-page document to a `num_pages` document.
// Always retain the first page data.
virtual void AppendBlankPages(size_t num_pages) = 0;
// Append the first page of the document loaded with the |engine| to this
// document at page |index|.
// Append the first page of the document loaded with the `engine` to this
// document at page `index`.
virtual void AppendPage(PDFEngine* engine, int index) = 0;
virtual std::vector<uint8_t> GetSaveData() = 0;
@ -472,7 +472,7 @@ class PDFEngine {
virtual bool ReadLoadedBytes(uint32_t length, void* buffer) = 0;
// Requests for a thumbnail to be sent using a callback when the page is ready
// to be rendered. |send_callback| is run with the thumbnail data when ready.
// to be rendered. `send_callback` is run with the thumbnail data when ready.
virtual void RequestThumbnail(int page_index,
float device_pixel_ratio,
SendThumbnailCallback send_callback) = 0;

@ -76,8 +76,8 @@ PdfRectangle CalculateClipBoxBoundary(const PdfRectangle& media_box,
const PdfRectangle& crop_box) {
PdfRectangle clip_box;
// Clip |media_box| to the size of |crop_box|, but ignore |crop_box| if it is
// bigger than |media_box|.
// Clip `media_box` to the size of `crop_box`, but ignore `crop_box` if it is
// bigger than `media_box`.
clip_box.left = std::max(crop_box.left, media_box.left);
clip_box.bottom = std::max(crop_box.bottom, media_box.bottom);
clip_box.right = std::min(crop_box.right, media_box.right);

@ -22,12 +22,12 @@ struct PdfRectangle {
float top;
};
// Calculate the scale factor between |content_rect| and a page of |src_size|.
// Calculate the scale factor between `content_rect` and a page of `src_size`.
//
// |content_rect| specifies the printable area of the destination page, with
// `content_rect` specifies the printable area of the destination page, with
// origin at left-bottom. Values are in points.
// |src_size| specifies the source page size in points.
// |rotated| True if source page is rotated 90 degree or 270 degree.
// `src_size` specifies the source page size in points.
// `rotated` True if source page is rotated 90 degree or 270 degree.
float CalculateScaleFactor(const gfx::Rect& content_rect,
const gfx::SizeF& src_size,
bool rotated);
@ -40,7 +40,7 @@ void SetDefaultClipBox(bool rotated, PdfRectangle* clip_box);
// Set the media box and/or crop box as needed. If both boxes are there, then
// nothing needs to be done. If one box is missing, then fill it with the value
// from the other box. If both boxes are missing, then they both get the default
// value from SetDefaultClipBox(), based on |rotated|.
// value from SetDefaultClipBox(), based on `rotated`.
void CalculateMediaBoxAndCropBox(bool rotated,
bool has_media_box,
bool has_crop_box,
@ -51,20 +51,20 @@ void CalculateMediaBoxAndCropBox(bool rotated,
// source page and scale factor.
// Returns the computed source clip box values.
//
// |media_box| The PDF's media box.
// |crop_box| The PDF's crop box.
// `media_box` The PDF's media box.
// `crop_box` The PDF's crop box.
PdfRectangle CalculateClipBoxBoundary(const PdfRectangle& media_box,
const PdfRectangle& crop_box);
// Scale |rect| by |scale_factor|.
// Scale `rect` by `scale_factor`.
void ScalePdfRectangle(float scale_factor, PdfRectangle* rect);
// Calculate the clip box translation offset for a page that does need to be
// scaled. All parameters are in points.
//
// |content_rect| specifies the printable area of the destination page, with
// `content_rect` specifies the printable area of the destination page, with
// origin at left-bottom.
// |source_clip_box| specifies the source clip box positions, relative to
// `source_clip_box` specifies the source clip box positions, relative to
// origin at left-bottom.
// Returns the final translation offsets for the source clip box, relative to
// origin at left-bottom.
@ -74,11 +74,11 @@ gfx::PointF CalculateScaledClipBoxOffset(const gfx::Rect& content_rect,
// Calculate the clip box offset for a page that does not need to be scaled.
// All parameters are in points.
//
// |rotation| specifies the source page rotation values which are N / 90
// `rotation` specifies the source page rotation values which are N / 90
// degrees.
// |page_width| specifies the screen destination page width.
// |page_height| specifies the screen destination page height.
// |source_clip_box| specifies the source clip box positions, relative to origin
// `page_width` specifies the screen destination page width.
// `page_height` specifies the screen destination page height.
// `source_clip_box` specifies the source clip box positions, relative to origin
// at left-bottom.
// Returns the final translation offsets for the source clip box, relative to
// origin at left-bottom.

@ -195,13 +195,13 @@ TEST(PdfTransformTest, CalculateScaledClipBoxOffset) {
PdfRectangle clip_box;
gfx::PointF offset;
// |rect| and |clip_box| are the same size.
// `rect` and `clip_box` are the same size.
InitializeBoxToDefaultPortraitValues(&clip_box);
offset = CalculateScaledClipBoxOffset(rect, clip_box);
EXPECT_FLOAT_EQ(0, offset.x());
EXPECT_FLOAT_EQ(0, offset.y());
// |rect| is larger than |clip_box|.
// `rect` is larger than `clip_box`.
clip_box.top /= 2;
clip_box.right /= 4;
offset = CalculateScaledClipBoxOffset(rect, clip_box);
@ -215,7 +215,7 @@ TEST(PdfTransformTest, CalculateNonScaledClipBoxOffset) {
PdfRectangle clip_box;
gfx::PointF offset;
// |rect|, page size and |clip_box| are the same.
// `rect`, page size and `clip_box` are the same.
InitializeBoxToDefaultPortraitValues(&clip_box);
offset =
CalculateNonScaledClipBoxOffset(0, page_width, page_height, clip_box);
@ -234,7 +234,7 @@ TEST(PdfTransformTest, CalculateNonScaledClipBoxOffset) {
EXPECT_FLOAT_EQ(180, offset.x());
EXPECT_FLOAT_EQ(-180, offset.y());
// Smaller |clip_box|.
// Smaller `clip_box`.
clip_box.top /= 4;
clip_box.right /= 2;
offset =

@ -387,7 +387,7 @@ class PdfViewPluginBase : public PDFEngine::Client,
std::vector<BackgroundPart> background_parts_;
// Deferred invalidates while |in_paint_| is true.
// Deferred invalidates while `in_paint_` is true.
std::vector<gfx::Rect> deferred_invalidates_;
// Remaining area, in pixels, to render the pdf in after accounting for

@ -24,11 +24,11 @@ namespace internal {
template <class StringType>
class PDFiumAPIStringBufferAdapter {
public:
// |str| is the string to write into.
// |expected_size| is the number of characters the PDFium API will write,
// `str` is the string to write into.
// `expected_size` is the number of characters the PDFium API will write,
// including the null-terminator. It should be at least 1.
// |check_expected_size| whether to check the actual number of characters
// written into |str| against |expected_size| when calling Close().
// `check_expected_size` whether to check the actual number of characters
// written into `str` against `expected_size` when calling Close().
PDFiumAPIStringBufferAdapter(StringType* str,
size_t expected_size,
bool check_expected_size);
@ -37,12 +37,12 @@ class PDFiumAPIStringBufferAdapter {
delete;
~PDFiumAPIStringBufferAdapter();
// Returns a pointer to |str_|'s buffer. The buffer's size is large enough to
// hold |expected_size_| + 1 characters, so the PDFium API that uses the
// Returns a pointer to `str_`'s buffer. The buffer's size is large enough to
// hold `expected_size_` + 1 characters, so the PDFium API that uses the
// pointer has space to write a null-terminator.
void* GetData();
// Resizes |str_| to |actual_size| - 1 characters, thereby removing the extra
// Resizes `str_` to `actual_size` - 1 characters, thereby removing the extra
// null-terminator. This must be called prior to the adapter's destruction.
// The pointer returned by GetData() should be considered invalid.
void Close(size_t actual_size);
@ -68,23 +68,23 @@ class PDFiumAPIStringBufferAdapter {
// for std::strings, PDFiumAPIStringBufferAdapter is equivalent.
class PDFiumAPIStringBufferSizeInBytesAdapter {
public:
// |str| is the string to write into.
// |expected_size| is the number of bytes the PDFium API will write,
// `str` is the string to write into.
// `expected_size` is the number of bytes the PDFium API will write,
// including the null-terminator. It should be at least the size of a
// character in bytes.
// |check_expected_size| whether to check the actual number of bytes
// written into |str| against |expected_size| when calling Close().
// `check_expected_size` whether to check the actual number of bytes
// written into `str` against `expected_size` when calling Close().
PDFiumAPIStringBufferSizeInBytesAdapter(std::u16string* str,
size_t expected_size,
bool check_expected_size);
~PDFiumAPIStringBufferSizeInBytesAdapter();
// Returns a pointer to |str_|'s buffer. The buffer's size is large enough to
// hold |expected_size_| + sizeof(char16_t) bytes, so the PDFium API that
// Returns a pointer to `str_`'s buffer. The buffer's size is large enough to
// hold `expected_size_` + sizeof(char16_t) bytes, so the PDFium API that
// uses the pointer has space to write a null-terminator.
void* GetData();
// Resizes |str_| to |actual_size| - sizeof(char16_t) bytes, thereby
// Resizes `str_` to `actual_size` - sizeof(char16_t) bytes, thereby
// removing the extra null-terminator. This must be called prior to the
// adapter's destruction. The pointer returned by GetData() should be
// considered invalid.

@ -57,11 +57,11 @@ class PDFiumDocument {
ScopedFPDFAvail fpdf_availability_;
// The PDFium wrapper object for the document. Must come after
// |fpdf_availability_| to prevent outliving it.
// `fpdf_availability_` to prevent outliving it.
ScopedFPDFDocument doc_handle_;
// The PDFium wrapper for form data. Used even if there are no form controls
// on the page. Must come after |doc_handle_| to prevent outliving it.
// on the page. Must come after `doc_handle_` to prevent outliving it.
ScopedFPDFFormHandle form_handle_;
// Current form availability status.

@ -216,7 +216,7 @@ void FormatStringForOS(std::u16string* text) {
#endif
}
// Returns true if |cur| is a character to break on.
// Returns true if `cur` is a character to break on.
// For double clicks, look for work breaks.
// For triple clicks, look for line breaks.
// The actual algorithm used in Blink is much more complicated, so do a simple
@ -271,7 +271,7 @@ void TearDownV8() {
}
#endif // defined(PDF_ENABLE_V8)
// Returns true if the given |area| and |form_type| combination from
// Returns true if the given `area` and `form_type` combination from
// PDFiumEngine::GetCharIndex() indicates it is a form text area.
bool IsFormTextArea(PDFiumPage::Area area, int form_type) {
if (form_type == FPDF_FORMFIELD_UNKNOWN)
@ -632,8 +632,8 @@ void PDFiumEngine::Paint(const gfx::Rect& rect,
// Compute the leftover dirty region. The first page may have blank space
// above it, in which case we also need to subtract that space from the
// dirty region.
// If two-up view is enabled, we don't need to recompute |leftover| since
// subtracting |leftover| with a two-up view page won't result in a
// If two-up view is enabled, we don't need to recompute `leftover` since
// subtracting `leftover` with a two-up view page won't result in a
// rectangle.
if (layout_.options().page_spread() == DocumentLayout::PageSpread::kOneUp) {
if (i == 0) {
@ -781,7 +781,7 @@ void PDFiumEngine::OnPendingRequestComplete() {
return;
}
// LoadDocument() will result in |pending_pages_| being reset so there's no
// LoadDocument() will result in `pending_pages_` being reset so there's no
// need to run the code below in that case.
bool update_pages = false;
std::vector<int> still_pending;
@ -844,7 +844,7 @@ void PDFiumEngine::FinishLoadingDocument() {
client_->Invalidate(GetPageScreenRect(i));
}
// Transition |document_loaded_| to true after finishing any calls to
// Transition `document_loaded_` to true after finishing any calls to
// FPDFAvail_IsPageAvail(), since we no longer need to defer calls to this
// function from LoadPageInfo(). Note that LoadBody() calls LoadPageInfo()
// indirectly, so we cannot make this transition earlier.
@ -1504,7 +1504,7 @@ bool PDFiumEngine::OnMouseMove(const blink::WebMouseEvent& event) {
PDFiumPage::Area area =
GetCharIndex(point, &page_index, &char_index, &form_type, &target);
// Clear |mouse_down_state_| if mouse moves away from where the mouse down
// Clear `mouse_down_state_` if mouse moves away from where the mouse down
// happened.
if (!mouse_down_state_.Matches(area, target))
mouse_down_state_.Reset();
@ -1613,7 +1613,7 @@ void PDFiumEngine::OnMouseEnter(const blink::WebMouseEvent& event) {
bool PDFiumEngine::ExtendSelection(int page_index, int char_index) {
// Check if the user has decreased their selection area and we need to remove
// pages from |selection_|.
// pages from `selection_`.
for (size_t i = 0; i < selection_.size(); ++i) {
if (selection_[i].page_index() == page_index) {
// There should be no other pages after this.
@ -1640,8 +1640,8 @@ bool PDFiumEngine::ExtendSelection(int page_index, int char_index) {
// Selecting into the next page.
// Save the current last selection for use below.
// Warning: Do not use references / pointers into |selection_|, as the code
// below can modify |selection_| and invalidate those references / pointers.
// Warning: Do not use references / pointers into `selection_`, as the code
// below can modify `selection_` and invalidate those references / pointers.
const size_t last_selection_index = selection_.size() - 1;
// First make sure that there are no gaps in selection, i.e. if mousedown on
@ -1907,7 +1907,7 @@ void PDFiumEngine::SearchUsingICU(const std::u16string& term,
std::u16string adjusted_page_text;
adjusted_page_text.reserve(page_text.size());
// Values in |removed_indices| are in the adjusted text index space and
// Values in `removed_indices` are in the adjusted text index space and
// indicate a character was removed from the page text before the given
// index. If multiple characters are removed in a row then there will be
// multiple entries with the same value.
@ -1977,7 +1977,7 @@ void PDFiumEngine::SearchUsingICU(const std::u16string& term,
pages_[current_page]->GetTextPage(),
temp_start + page_text_result_length);
// If |term| occurs at the end of a page, then |end| will be -1 due to the
// If `term` occurs at the end of a page, then `end` will be -1 due to the
// index being out of bounds. Compensate for this case so the range
// character count calculation below works out.
if (temp_start + page_text_result_length == original_text_length) {
@ -2059,7 +2059,7 @@ bool PDFiumEngine::SelectFindResult(bool forward) {
size_t current_find_index_value = current_find_index_.value();
base::debug::Alias(&current_find_index_value);
// Use zoom of 1.0 since |visible_rect| is without zoom.
// Use zoom of 1.0 since `visible_rect` is without zoom.
const std::vector<gfx::Rect>& rects =
find_results_[current_find_index_.value()].GetScreenRects(
gfx::Point(), 1.0, layout_.options().default_page_orientation());
@ -2316,7 +2316,7 @@ std::string PDFiumEngine::GetLinkAtPosition(const gfx::Point& point) {
}
bool PDFiumEngine::HasPermission(DocumentPermission permission) const {
// No |permissions_| means no restrictions.
// No `permissions_` means no restrictions.
if (!permissions_)
return true;
return permissions_->HasPermission(permission);
@ -2663,7 +2663,7 @@ base::Optional<gfx::Size> PDFiumEngine::GetUniformPageSizePoints() {
return base::nullopt;
}
// Convert |page_size| back to points.
// Convert `page_size` back to points.
return gfx::Size(
ConvertUnit(page_size.width(), kPixelsPerInch, kPointsPerInch),
ConvertUnit(page_size.height(), kPixelsPerInch, kPointsPerInch));
@ -2737,7 +2737,7 @@ bool PDFiumEngine::TryLoadingDoc(const std::string& password,
*needs_password = false;
if (doc()) {
// This is probably not necessary, because it should have already been
// called below in the |doc_| initialization path. However, the previous
// called below in the `doc_` initialization path. However, the previous
// call may have failed, so call it again for good measure.
FX_DOWNLOADHINTS& download_hints = document_->download_hints();
FPDFAvail_IsDocAvail(fpdf_availability(), &download_hints);
@ -2819,7 +2819,7 @@ void PDFiumEngine::RefreshCurrentDocumentLayout() {
DCHECK_EQ(pages_.size(), layout_.page_count());
for (size_t i = 0; i < layout_.page_count(); ++i) {
// TODO(kmoon): This should be the only place that sets |PDFiumPage::rect_|.
// TODO(kmoon): This should be the only place that sets `PDFiumPage::rect_`.
pages_[i]->set_rect(layout_.page_bounds_rect(i));
}
@ -2860,9 +2860,9 @@ std::vector<gfx::Size> PDFiumEngine::LoadPageSizes(
const bool doc_complete = doc_loader_->IsDocumentComplete();
const bool is_linear = IsLinearized();
for (size_t i = 0; i < new_page_count; ++i) {
// Get page availability. If |document_loaded_| == true and the page is not
// Get page availability. If `document_loaded_` == true and the page is not
// new, then the page has been constructed already. Get page availability
// flag from already existing PDFiumPage object. If |document_loaded_| ==
// flag from already existing PDFiumPage object. If `document_loaded_` ==
// false or the page is new, then the page may not be fully loaded yet.
bool page_available;
if (document_loaded_ && i < pages_.size()) {
@ -2884,8 +2884,8 @@ std::vector<gfx::Size> PDFiumEngine::LoadPageSizes(
page_sizes.push_back(size);
}
// Add new pages. If |document_loaded_| == false, do not mark page as
// available even if |doc_complete| is true because FPDFAvail_IsPageAvail()
// Add new pages. If `document_loaded_` == false, do not mark page as
// available even if `doc_complete` is true because FPDFAvail_IsPageAvail()
// still has to be called for this page, which will be done in
// FinishLoadingDocument().
for (size_t i = pages_.size(); i < new_page_count; ++i) {
@ -3624,7 +3624,7 @@ void PDFiumEngine::DeviceToPage(int page_index,
}
int PDFiumEngine::GetVisiblePageIndex(FPDF_PAGE page) {
// Copy |visible_pages_| since it can change as a result of loading the page
// Copy `visible_pages_` since it can change as a result of loading the page
// in GetPage(). See https://crbug.com/822091.
std::vector<int> visible_pages_copy(visible_pages_);
for (int page_index : visible_pages_copy) {
@ -3800,7 +3800,7 @@ void PDFiumEngine::EnteredEditMode() {
void PDFiumEngine::SetInFormTextArea(bool in_form_text_area) {
// If focus was previously in form text area, clear form text selection.
// Clearing needs to be done before changing focus to ensure the correct
// observer is notified of the change in selection. When |in_form_text_area_|
// observer is notified of the change in selection. When `in_form_text_area_`
// is true, this is the Renderer. After it flips, the MimeHandler is notified.
if (in_form_text_area_) {
client_->SetSelectedText("");
@ -3809,7 +3809,7 @@ void PDFiumEngine::SetInFormTextArea(bool in_form_text_area) {
client_->FormTextFieldFocusChange(in_form_text_area);
in_form_text_area_ = in_form_text_area;
// Clear |editable_form_text_area_| when focus no longer in form text area.
// Clear `editable_form_text_area_` when focus no longer in form text area.
if (!in_form_text_area_)
editable_form_text_area_ = false;
}
@ -4013,7 +4013,7 @@ void PDFiumEngine::GetSelection(uint32_t* selection_start_page_index,
// If the selection is all within one page, the end index is the
// start index plus the char count. But if the selection spans
// multiple pages, the selection starts at the beginning of the
// last page in |selection_| and goes to the char count.
// last page in `selection_` and goes to the char count.
if (len == 1) {
*selection_end_char_index =
selection_[0].char_index() + selection_[0].char_count();
@ -4198,11 +4198,11 @@ bool PDFiumEngine::HandleTabBackward(int modifiers) {
UpdateFocusItemType(FocusElementType::kPage);
} else {
// No focusable annotation found in pages. Possible scenarios:
// Case 1: |focus_item_type_| is None. Since no object in any page can take
// Case 1: `focus_item_type_` is None. Since no object in any page can take
// the focus, the document should take focus.
// Case 2: |focus_item_type_| is Page. Since there aren't any objects that
// Case 2: `focus_item_type_` is Page. Since there aren't any objects that
// could take focus, the document should take focus.
// Case 3: |focus_item_type_| is Document. Move focus_item_type_ to None.
// Case 3: `focus_item_type_` is Document. Move focus_item_type_ to None.
switch (focus_item_type_) {
case FocusElementType::kPage:
case FocusElementType::kNone:

@ -69,7 +69,7 @@ class PDFiumEngine : public PDFEngine,
// Exposed for testing.
enum class FocusElementType { kNone, kDocument, kPage };
// NOTE: |script_option| is ignored when PDF_ENABLE_V8 is not defined.
// NOTE: `script_option` is ignored when PDF_ENABLE_V8 is not defined.
PDFiumEngine(PDFEngine::Client* client,
PDFiumFormFiller::ScriptOption script_option);
PDFiumEngine(const PDFiumEngine&) = delete;
@ -218,7 +218,7 @@ class PDFiumEngine : public PDFEngine,
// coordinates.
std::vector<gfx::Rect> GetVisibleSelections() const;
// Invalidates |selection|, but with |selection| slightly expanded to
// Invalidates `selection`, but with `selection` slightly expanded to
// compensate for any rounding errors.
void Invalidate(const gfx::Rect& selection);
@ -261,8 +261,8 @@ class PDFiumEngine : public PDFEngine,
// Try loading the document. Returns true if the document is successfully
// loaded or is already loaded otherwise it will return false. If there is a
// password, then |password| is non-empty. If the document could not be loaded
// and needs a password, |needs_password| will be set to true.
// password, then `password` is non-empty. If the document could not be loaded
// and needs a password, `needs_password` will be set to true.
bool TryLoadingDoc(const std::string& password, bool* needs_password);
// Asks the user for the document password and then continue loading the
@ -273,13 +273,13 @@ class PDFiumEngine : public PDFEngine,
void OnGetPasswordComplete(const std::string& password);
// Continues loading the document when the password has been retrieved, or if
// there is no password. If there is no password, then |password| is empty.
// there is no password. If there is no password, then `password` is empty.
void ContinueLoadingDocument(const std::string& password);
// Finishes loading the document. Recalculate the document size if there were
// pages that were not previously available.
// Also notifies the client that the document has been loaded.
// This should only be called after |doc_| has been loaded and the document is
// This should only be called after `doc_` has been loaded and the document is
// fully downloaded.
// If this has been run once, it will not notify the client again.
void FinishLoadingDocument();
@ -291,10 +291,10 @@ class PDFiumEngine : public PDFEngine,
void RefreshCurrentDocumentLayout();
// Proposes the next document layout using the current pages and
// |desired_layout_options_|.
// `desired_layout_options_`.
void ProposeNextDocumentLayout();
// Updates |layout| using the current page sizes.
// Updates `layout` using the current page sizes.
void UpdateDocumentLayout(DocumentLayout* layout);
// Loads information about the pages in the document, calculating and
@ -342,23 +342,23 @@ class PDFiumEngine : public PDFEngine,
// Helper function for getting the inset sizes for the current layout. If
// two-up view is enabled, the configuration of inset sizes depends on
// the position of the page, specified by |page_index| and |num_of_pages|.
// the position of the page, specified by `page_index` and `num_of_pages`.
draw_utils::PageInsetSizes GetInsetSizes(
const DocumentLayout::Options& layout_options,
size_t page_index,
size_t num_of_pages) const;
// If two-up view is disabled, enlarges |page_size| with inset sizes for
// If two-up view is disabled, enlarges `page_size` with inset sizes for
// single-view. If two-up view is enabled, calls GetInsetSizes() with
// |page_index| and |num_of_pages|, and uses the returned inset sizes to
// enlarge |page_size|.
// `page_index` and `num_of_pages`, and uses the returned inset sizes to
// enlarge `page_size`.
void EnlargePage(const DocumentLayout::Options& layout_options,
size_t page_index,
size_t num_of_pages,
gfx::Size* page_size) const;
// Similar to EnlargePage(), but insets a |rect|. Also multiplies the inset
// sizes by |multiplier|, using the ceiling of the result.
// Similar to EnlargePage(), but insets a `rect`. Also multiplies the inset
// sizes by `multiplier`, using the ceiling of the result.
void InsetPage(const DocumentLayout::Options& layout_options,
size_t page_index,
size_t num_of_pages,
@ -366,7 +366,7 @@ class PDFiumEngine : public PDFEngine,
gfx::Rect& rect) const;
// If two-up view is enabled, returns the index of the page beside
// |page_index| page. Returns base::nullopt if there is no adjacent page or
// `page_index` page. Returns base::nullopt if there is no adjacent page or
// if two-up view is disabled.
base::Optional<size_t> GetAdjacentPageIndexForTwoUpView(
size_t page_index,
@ -381,7 +381,7 @@ class PDFiumEngine : public PDFEngine,
// Called to continue searching so we don't block the main thread.
void ContinueFind(int32_t result);
// Inserts a find result into |find_results_|, which is sorted.
// Inserts a find result into `find_results_`, which is sorted.
void AddFindResult(const PDFiumRange& result);
// Search a page using PDFium's methods. Doesn't work with unicode. This
@ -428,11 +428,11 @@ class PDFiumEngine : public PDFEngine,
pp::Buffer_Dev ConvertPdfToBufferDev(const std::vector<uint8_t>& pdf_data);
// Checks if |page| has selected text in a form element. If so, sets that as
// Checks if `page` has selected text in a form element. If so, sets that as
// the plugin's text selection.
void SetFormSelectedText(FPDF_FORMHANDLE form_handle, FPDF_PAGE page);
// Given |point|, returns which page and character location it's closest to,
// Given `point`, returns which page and character location it's closest to,
// as well as extra information about objects at that point.
PDFiumPage::Area GetCharIndex(const gfx::Point& point,
int* page_index,
@ -502,13 +502,13 @@ class PDFiumEngine : public PDFEngine,
// Returns the currently visible rectangle in document coordinates.
gfx::Rect GetVisibleRect() const;
// Given |rect| in document coordinates, returns the rectangle in screen
// Given `rect` in document coordinates, returns the rectangle in screen
// coordinates. (i.e. 0,0 is top left corner of plugin area)
gfx::Rect GetScreenRect(const gfx::Rect& rect) const;
// Given an image |buffer| with |stride|, highlights |rect|.
// |highlighted_rects| contains the already highlighted rectangles and will be
// updated to include |rect| if |rect| has not already been highlighted.
// Given an image `buffer` with `stride`, highlights `rect`.
// `highlighted_rects` contains the already highlighted rectangles and will be
// updated to include `rect` if `rect` has not already been highlighted.
void Highlight(void* buffer,
int stride,
const gfx::Rect& rect,
@ -518,7 +518,7 @@ class PDFiumEngine : public PDFEngine,
std::vector<gfx::Rect>& highlighted_rects) const;
// Helper function to convert a device to page coordinates. If the page is
// not yet loaded, |page_x| and |page_y| will be set to 0.
// not yet loaded, `page_x` and `page_y` will be set to 0.
void DeviceToPage(int page_index,
const gfx::Point& device_point,
double* page_x,
@ -557,7 +557,7 @@ class PDFiumEngine : public PDFEngine,
// Sets whether or not left mouse button is currently being held down.
void SetMouseLeftButtonDown(bool is_mouse_left_button_down);
// Given an annotation which is a form of |form_type| which is known to be a
// Given an annotation which is a form of `form_type` which is known to be a
// form text area, check if it is an editable form text area.
bool IsAnnotationAnEditableFormTextArea(FPDF_ANNOTATION annot,
int form_type) const;
@ -580,7 +580,7 @@ class PDFiumEngine : public PDFEngine,
const AccessibilityScrollAlignment& horizontal_scroll_alignment,
const AccessibilityScrollAlignment& vertical_scroll_alignment);
// Scrolls top left of a rect in page |target_rect| to |global_point|.
// Scrolls top left of a rect in page `target_rect` to `global_point`.
// Global point is point relative to viewport in screen.
void ScrollToGlobalPoint(const gfx::Rect& target_rect,
const gfx::Point& global_point);
@ -589,7 +589,7 @@ class PDFiumEngine : public PDFEngine,
void EnteredEditMode();
// Navigates to a link destination depending on the type of destination.
// Returns false if |area| is not a link.
// Returns false if `area` is not a link.
bool NavigateToLinkDestination(PDFiumPage::Area area,
const PDFiumPage::LinkTarget& target,
WindowOpenDisposition disposition);
@ -598,27 +598,27 @@ class PDFiumEngine : public PDFEngine,
static FPDF_BOOL Pause_NeedToPauseNow(IFSDK_PAUSE* param);
// Used for text selection. Given the start and end of selection, sets the
// text range in |selection_|.
// text range in `selection_`.
void SetSelection(const PageCharacterIndex& selection_start_index,
const PageCharacterIndex& selection_end_index);
// Scroll the current focused annotation into view if not already in view.
void ScrollFocusedAnnotationIntoView();
// Given |annot|, scroll the |annot| into view if not already in view.
// Given `annot`, scroll the `annot` into view if not already in view.
void ScrollAnnotationIntoView(FPDF_ANNOTATION annot, int page_index);
void OnFocusedAnnotationUpdated(FPDF_ANNOTATION annot, int page_index);
// Read the attachments' information inside the PDF document, and set
// |doc_attachment_info_list_|. To be called after the document is loaded.
// `doc_attachment_info_list_`. To be called after the document is loaded.
void LoadDocumentAttachmentInfoList();
// Fetches and populates the fields of |doc_metadata_|. To be called after the
// Fetches and populates the fields of `doc_metadata_`. To be called after the
// document is loaded.
void LoadDocumentMetadata();
// Retrieves the value of |field| in the document information dictionary.
// Retrieves the value of `field` in the document information dictionary.
// Trims whitespace characters from the retrieved value.
std::string GetTrimmedMetadataByField(FPDF_BYTESTRING field) const;
@ -634,8 +634,8 @@ class PDFiumEngine : public PDFEngine,
bool HandleTabForward(int modifiers);
bool HandleTabBackward(int modifiers);
// Updates the currently focused object stored in |focus_item_type_|. Notifies
// |client_| about document focus change, if any.
// Updates the currently focused object stored in `focus_item_type_`. Notifies
// `client_` about document focus change, if any.
void UpdateFocusItemType(FocusElementType focus_item_type);
void UpdateLinkUnderCursor(const std::string& target_url);
@ -850,7 +850,7 @@ class PDFiumEngine : public PDFEngine,
// Weak pointers from this factory are used to bind the ContinueFind()
// function. This allows those weak pointers to be invalidated during
// StopFind(), and keeps the invalidation separated from |weak_factory_|.
// StopFind(), and keeps the invalidation separated from `weak_factory_`.
base::WeakPtrFactory<PDFiumEngine> find_weak_factory_{this};
};

@ -142,7 +142,7 @@ void* MapFont(FPDF_SYSFONTINFO*,
} else {
std::string encoding;
if (base::DetectEncoding(face, &encoding)) {
// ConvertToUtf8AndNormalize() clears |face_utf8| on failure.
// ConvertToUtf8AndNormalize() clears `face_utf8` on failure.
base::ConvertToUtf8AndNormalize(face, encoding, &face_utf8);
}
}

@ -17,7 +17,7 @@ namespace chrome_pdf {
void InitializeLinuxFontMapper();
// Keeps track of the most recently used plugin instance. This is a no-op of
// |last_instance| is null.
// `last_instance` is null.
void SetLastInstance(pp::Instance* last_instance);
} // namespace chrome_pdf

@ -642,7 +642,7 @@ void PDFiumFormFiller::Form_Mail(IPDF_JSPLATFORM* param,
FPDF_WIDESTRING cc,
FPDF_WIDESTRING bcc,
FPDF_WIDESTRING message) {
// Note: |mail_data| and |length| are ignored. We don't handle attachments;
// Note: `mail_data` and `length` are ignored. We don't handle attachments;
// there is no way with mailto.
std::string to_str = WideStringToString(to);
std::string cc_str = WideStringToString(cc);

@ -22,7 +22,7 @@ class PDFiumFormFiller : public FPDF_FORMFILLINFO, public IPDF_JSPLATFORM {
enum class ScriptOption { kNoJavaScript, kJavaScript, kJavaScriptAndXFA };
static PDFiumFormFiller::ScriptOption DefaultScriptOption();
// NOTE: |script_option| is ignored when PDF_ENABLE_V8 is not defined.
// NOTE: `script_option` is ignored when PDF_ENABLE_V8 is not defined.
PDFiumFormFiller(PDFiumEngine* engine, ScriptOption script_option);
PDFiumFormFiller(const PDFiumFormFiller&) = delete;
PDFiumFormFiller& operator=(const PDFiumFormFiller&) = delete;

@ -78,7 +78,7 @@ gfx::RectF FloatPageRectToPixelRect(FPDF_PAGE page, const gfx::RectF& input) {
if (max_y < min_y)
std::swap(min_y, max_y);
// Make sure small but non-zero dimensions for |input| does not get rounded
// Make sure small but non-zero dimensions for `input` does not get rounded
// down to 0.
int width = max_x - min_x;
int height = max_y - min_y;
@ -198,9 +198,9 @@ bool FloatEquals(float f1, float f2) {
template <typename T, typename U>
uint32_t CountOverlaps(const std::vector<T>& first_set,
const std::vector<U>& second_set) {
// This method assumes vectors passed are sorted by |start_char_index|.
// This method assumes vectors passed are sorted by `start_char_index`.
uint32_t overlaps = 0;
// Count overlaps between |first_set| and |second_set|.
// Count overlaps between `first_set` and `second_set`.
for (const auto& first_set_object : first_set) {
gfx::Range first_range(
first_set_object.start_char_index,
@ -212,10 +212,10 @@ uint32_t CountOverlaps(const std::vector<T>& first_set,
if (first_range.Intersects(second_range)) {
overlaps++;
} else if (first_range.start() < second_range.start()) {
// Both range vectors are sorted by |start_char_index|. In case they
// don't overlap, and the |second_range| starts after the |first_range|,
// then all successive |second_set_object| will not overlap with
// |first_range|.
// Both range vectors are sorted by `start_char_index`. In case they
// don't overlap, and the `second_range` starts after the `first_range`,
// then all successive `second_set_object` will not overlap with
// `first_range`.
break;
}
}
@ -226,7 +226,7 @@ uint32_t CountOverlaps(const std::vector<T>& first_set,
// Count overlaps within text annotations.
template <typename T>
uint32_t CountInternalTextOverlaps(const std::vector<T>& text_objects) {
// This method assumes text_objects is sorted by |start_char_index|.
// This method assumes text_objects is sorted by `start_char_index`.
uint32_t overlaps = 0;
for (size_t i = 0; i < text_objects.size(); ++i) {
gfx::Range range1(
@ -241,10 +241,10 @@ uint32_t CountInternalTextOverlaps(const std::vector<T>& text_objects) {
if (range1.Intersects(range2)) {
overlaps++;
} else {
// The input is sorted by |start_char_index|. In case |range1| and
// |range2| do not overlap, and |range2| starts after |range1|, then
// The input is sorted by `start_char_index`. In case `range1` and
// `range2` do not overlap, and `range2` starts after `range1`, then
// successive ranges in the inner loop will also not overlap with
// |range1|.
// `range1`.
break;
}
}
@ -448,7 +448,7 @@ base::Optional<AccessibilityTextRunInfo> PDFiumPage::GetTextRunInfo(
FPDF_PAGE page = GetPage();
FPDF_TEXTPAGE text_page = GetTextPage();
int chars_count = FPDFText_CountChars(text_page);
// Check to make sure |start_char_index| is within bounds.
// Check to make sure `start_char_index` is within bounds.
if (start_char_index < 0 || start_char_index >= chars_count)
return base::nullopt;
@ -457,7 +457,7 @@ base::Optional<AccessibilityTextRunInfo> PDFiumPage::GetTextRunInfo(
// Check to see if GetFirstNonUnicodeWhiteSpaceCharIndex() iterated through
// all the characters.
if (actual_start_char_index >= chars_count) {
// If so, |info.len| needs to take the number of characters
// If so, `info.len` needs to take the number of characters
// iterated into account.
DCHECK_GT(actual_start_char_index, start_char_index);
AccessibilityTextRunInfo info;
@ -466,7 +466,7 @@ base::Optional<AccessibilityTextRunInfo> PDFiumPage::GetTextRunInfo(
}
// If the first character in a text run is a space, we need to start
// |text_run_bounds| from the space character instead of the first
// `text_run_bounds` from the space character instead of the first
// non-space unicode character.
gfx::RectF text_run_bounds =
actual_start_char_index > start_char_index
@ -1084,7 +1084,7 @@ void PDFiumPage::PopulateAnnotationLinks() {
int quad_point_count = FPDFLink_CountQuadPoints(link_annot);
// Calculate the bounds of link using the quad points data.
// If quad points for link is not present then use
// |link_rect| to calculate the bounds instead.
// `link_rect` to calculate the bounds instead.
if (quad_point_count > 0) {
for (int i = 0; i < quad_point_count; ++i) {
FS_QUADPOINTSF point;
@ -1143,7 +1143,7 @@ void PDFiumPage::CalculateImages() {
if (FPDFImageObj_GetImageMetadata(page_object, page, &image_metadata)) {
int marked_content_id = image_metadata.marked_content_id;
if (marked_content_id >= 0) {
// If |marked_content_id| is already present, ignore the one being
// If `marked_content_id` is already present, ignore the one being
// inserted.
marked_content_id_image_map.insert(
{marked_content_id, images_.size()});
@ -1513,7 +1513,7 @@ void PDFiumPage::RequestThumbnail(float device_pixel_ratio,
}
// It is safe to use base::Unretained(this) because the callback is only used
// by |this|.
// by `this`.
thumbnail_callback_ = base::BindOnce(
&PDFiumPage::GenerateAndSendThumbnail, base::Unretained(this),
device_pixel_ratio, std::move(send_callback));
@ -1537,8 +1537,8 @@ Thumbnail PDFiumPage::GenerateThumbnail(float device_pixel_ratio) {
sk_bitmap.width(), sk_bitmap.height(),
/*color=*/0xFFFFFFFF);
// The combination of the |FPDF_REVERSE_BYTE_ORDER| rendering flag and the
// |FPDFBitmap_BGRA| format when initializing |fpdf_bitmap| results in an RGBA
// The combination of the `FPDF_REVERSE_BYTE_ORDER` rendering flag and the
// `FPDFBitmap_BGRA` format when initializing `fpdf_bitmap` results in an RGBA
// rendering, which is the format required by HTML <canvas>.
FPDF_RenderPageBitmap(fpdf_bitmap.get(), GetPage(), /*start_x=*/0,
/*start_y=*/0, sk_bitmap.width(), sk_bitmap.height(),

@ -108,9 +108,9 @@ class PDFiumPage {
base::Optional<float> zoom;
};
// Given a |link_index|, returns the type of underlying area and the link
// target. |target| must be valid. Returns NONSELECTABLE_AREA if
// |link_index| is invalid.
// Given a `link_index`, returns the type of underlying area and the link
// target. `target` must be valid. Returns NONSELECTABLE_AREA if
// `link_index` is invalid.
Area GetLinkTargetAtIndex(int link_index, LinkTarget* target);
// Returns link type and fills target associated with a link. Returns
@ -158,7 +158,7 @@ class PDFiumPage {
// Gets the number of characters in the page.
int GetCharCount();
// Returns true if the given |char_index| lies within the character range
// Returns true if the given `char_index` lies within the character range
// of the page.
bool IsCharIndexInBounds(int char_index);
@ -182,7 +182,7 @@ class PDFiumPage {
void RequestThumbnail(float device_pixel_ratio,
SendThumbnailCallback send_callback);
// Generates a page thumbnail accommodating a specific |device_pixel_ratio|.
// Generates a page thumbnail accommodating a specific `device_pixel_ratio`.
Thumbnail GenerateThumbnail(float device_pixel_ratio);
int index() const { return index_; }
@ -331,7 +331,7 @@ class PDFiumPage {
// Represents index of the control in the control group. A group of
// interactive form annotations is collectively called a form control
// group. Here an interactive form annotation should be either a radio
// button or a checkbox. Value of |control_index| is -1 for push button.
// button or a checkbox. Value of `control_index` is -1 for push button.
int control_index = -1;
};
@ -348,13 +348,13 @@ class PDFiumPage {
void CalculateImages();
// Populate annotations like highlight and text field on the page.
void PopulateAnnotations();
// Populate |highlights_| with |annot|.
// Populate `highlights_` with `annot`.
void PopulateHighlight(FPDF_ANNOTATION annot);
// Populate |text_fields_| with |annot|.
// Populate `text_fields_` with `annot`.
void PopulateTextField(FPDF_ANNOTATION annot);
// Populate |choice_fields_| with |annot|.
// Populate `choice_fields_` with `annot`.
void PopulateChoiceField(FPDF_ANNOTATION annot);
// Populate |buttons_| with |annot|.
// Populate `buttons_` with `annot`.
void PopulateButton(FPDF_ANNOTATION annot);
// Populate form fields like text field, choice field and button on the page.
void PopulateFormField(FPDF_ANNOTATION annot);
@ -370,23 +370,23 @@ class PDFiumPage {
// Set text run style information based on a character of the text run.
void CalculateTextRunStyleInfo(int char_index,
AccessibilityTextStyleInfo& style_info);
// Returns a boolean indicating if the character at index |char_index| has the
// Returns a boolean indicating if the character at index `char_index` has the
// same text style as the text run.
bool AreTextStyleEqual(int char_index,
const AccessibilityTextStyleInfo& style);
// Key : Marked content id for the image element as specified in the
// struct tree.
// Value : Index of image in the |images_| vector.
// Value : Index of image in the `images_` vector.
using MarkedContentIdToImageMap = std::map<int, size_t>;
// Traverses the entire struct tree of the page recursively and extracts the
// alt text from struct tree elements corresponding to the marked content IDs
// present in |marked_content_id_image_map|.
// present in `marked_content_id_image_map`.
void PopulateImageAltText(
const MarkedContentIdToImageMap& marked_content_id_image_map);
// Traverses a struct element and its sub-tree recursively and extracts the
// alt text from struct elements corresponding to the marked content IDs
// present in |marked_content_id_image_map|. Uses |visited_elements| to guard
// present in `marked_content_id_image_map`. Uses `visited_elements` to guard
// against malformed struct trees.
void PopulateImageAltTextForStructElement(
const MarkedContentIdToImageMap& marked_content_id_image_map,
@ -397,7 +397,7 @@ class PDFiumPage {
const std::vector<Highlight>& highlights);
bool PopulateFormFieldProperties(FPDF_ANNOTATION annot,
FormField* form_field);
// Generates and sends the thumbnail using |send_callback|.
// Generates and sends the thumbnail using `send_callback`.
void GenerateAndSendThumbnail(float device_pixel_ratio,
SendThumbnailCallback send_callback);

@ -48,7 +48,7 @@ bool PDFiumPermissions::HasPermission(
}
} else {
// Security handler revision 3+ have different rules for interpreting the
// bits in |permission_bits_|.
// bits in `permission_bits_`.
switch (permission) {
case PDFEngine::PERMISSION_COPY:
return (permission_bits_ & kPDFPermissionCopyMask) != 0;

@ -39,7 +39,7 @@ namespace chrome_pdf {
namespace {
// UI should have done parameter sanity check, when execution
// reaches here, |pages_per_sheet| should be a positive integer.
// reaches here, `pages_per_sheet` should be a positive integer.
bool ShouldDoNup(int pages_per_sheet) {
return pages_per_sheet > 1;
}
@ -52,10 +52,10 @@ int GetDocumentPageCount(FPDF_DOCUMENT doc) {
// Set the destination page size and content area in points based on source
// page rotation and orientation.
//
// |rotated| True if source page is rotated 90 degree or 270 degree.
// |is_src_page_landscape| is true if the source page orientation is landscape.
// |page_size| has the actual destination page size in points.
// |content_rect| has the actual destination page printable area values in
// `rotated` True if source page is rotated 90 degree or 270 degree.
// `is_src_page_landscape` is true if the source page orientation is landscape.
// `page_size` has the actual destination page size in points.
// `content_rect` has the actual destination page printable area values in
// points.
void SetPageSizeAndContentRect(bool rotated,
bool is_src_page_landscape,
@ -72,7 +72,7 @@ void SetPageSizeAndContentRect(bool rotated,
}
}
// Transform |page| contents to fit in the selected printer paper size.
// Transform `page` contents to fit in the selected printer paper size.
void TransformPDFPageForPrinting(FPDF_PAGE page,
float scale_factor,
PP_PrintScalingOption_Dev scaling_option,
@ -186,7 +186,7 @@ void FitContentsToPrintableAreaIfRequired(
}
// Takes the same parameters as PDFiumPrint::CreateNupPdf().
// On success, returns the N-up version of |doc|. On failure, returns nullptr.
// On success, returns the N-up version of `doc`. On failure, returns nullptr.
ScopedFPDFDocument CreateNupPdfDocument(ScopedFPDFDocument doc,
size_t pages_per_sheet,
const gfx::Size& page_size,

@ -33,8 +33,8 @@ class PDFiumPrint {
~PDFiumPrint();
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Flattens the |doc|.
// On success, returns the flattened version of |doc| as a vector.
// Flattens the `doc`.
// On success, returns the flattened version of `doc` as a vector.
// On failure, returns an empty vector.
static std::vector<uint8_t> CreateFlattenedPdf(ScopedFPDFDocument doc);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
@ -43,9 +43,9 @@ class PDFiumPrint {
const PP_PrintPageNumberRange_Dev* page_ranges,
uint32_t page_range_count);
// Performs N-up PDF generation for |doc| based on |pages_per_sheet|,
// |page_size|, and |printable_area|.
// On success, returns the N-up version of |doc| as a vector.
// Performs N-up PDF generation for `doc` based on `pages_per_sheet`,
// `page_size`, and `printable_area`.
// On success, returns the N-up version of `doc` as a vector.
// On failure, returns an empty vector.
static std::vector<uint8_t> CreateNupPdf(ScopedFPDFDocument doc,
size_t pages_per_sheet,

@ -50,8 +50,8 @@ class PDFiumTestBase : public testing::Test {
void SetUp() override;
void TearDown() override;
// Initializes a PDFiumEngine for use in testing with |client|. Loads a PDF
// named |pdf_name|. See TestDocumentLoader for more info about |pdf_name|.
// Initializes a PDFiumEngine for use in testing with `client`. Loads a PDF
// named `pdf_name`. See TestDocumentLoader for more info about `pdf_name`.
std::unique_ptr<PDFiumEngine> InitializeEngine(
TestClient* client,
const base::FilePath::CharType* pdf_name);

@ -41,11 +41,11 @@ class Graphics {
// `true` if the callback is still pending.
virtual bool Flush(ResultCallback callback) = 0;
// Paints the |src_rect| region of |image| to the graphics device. The image
// Paints the `src_rect` region of `image` to the graphics device. The image
// must be compatible with the concrete `Graphics` implementation.
virtual void PaintImage(const Image& image, const gfx::Rect& src_rect) = 0;
// Shifts the |clip| region of the graphics device by |amount|.
// Shifts the `clip` region of the graphics device by `amount`.
virtual void Scroll(const gfx::Rect& clip, const gfx::Vector2d& amount) = 0;
// Sets the output scale factor. Must be greater than 0.

@ -19,12 +19,12 @@ namespace chrome_pdf {
// Loads test PDFs from pdf/test/data.
class TestDocumentLoader : public DocumentLoader {
public:
// |pdf_name| is the base name for a PDF file.
// `pdf_name` is the base name for a PDF file.
TestDocumentLoader(Client* client,
const base::FilePath::StringType& pdf_name);
~TestDocumentLoader() override;
// Simulates loading up to |max_bytes| more data, returning `true` if there is
// Simulates loading up to `max_bytes` more data, returning `true` if there is
// more data to load (that is, IsDocumentComplete() returns `false`).
bool SimulateLoadData(uint32_t max_bytes);

@ -59,8 +59,8 @@ gfx::Size LimitAspectRatio(gfx::Size page_size) {
return page_size;
}
// Calculate the size of a thumbnail image in device pixels using |page_size| in
// any units and |device_pixel_ratio|.
// Calculate the size of a thumbnail image in device pixels using `page_size` in
// any units and `device_pixel_ratio`.
gfx::Size CalculateBestFitSize(const gfx::Size& page_size,
float device_pixel_ratio) {
gfx::Size safe_page_size = LimitAspectRatio(page_size);

@ -38,8 +38,8 @@ class URLLoaderWrapper {
// Returns if the response contains multi parts.
virtual bool IsMultipart() const = 0;
// If true, |start| contains the start of the byte range.
// If false, response contains full document and |start| will be undefined.
// If true, `start` contains the start of the byte range.
// If false, response contains full document and `start` will be undefined.
virtual bool GetByteRangeStart(int* start) const = 0;
// Close connection.