Skip to content

Commit

Permalink
#431: M1377257 M1372602
Browse files Browse the repository at this point in the history
  • Loading branch information
classilla committed Aug 31, 2017
1 parent 1c7323d commit 8524974
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 8 deletions.
1 change: 1 addition & 0 deletions gfx/cairo/cairo/src/cairo-rename.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
#define cairo_scaled_font_get_font_face _moz_cairo_scaled_font_get_font_face
#define cairo_scaled_font_get_font_matrix _moz_cairo_scaled_font_get_font_matrix
#define cairo_scaled_font_get_font_options _moz_cairo_scaled_font_get_font_options
#define cairo_scaled_font_get_hint_metrics _moz_cairo_scaled_font_get_hint_metrics
#define cairo_scaled_font_get_reference_count _moz_cairo_scaled_font_get_reference_count
#define cairo_scaled_font_get_scale_matrix _moz_cairo_scaled_font_get_scale_matrix
#define cairo_scaled_font_get_type _moz_cairo_scaled_font_get_type
Expand Down
20 changes: 20 additions & 0 deletions gfx/cairo/cairo/src/cairo-scaled-font.c
Original file line number Diff line number Diff line change
Expand Up @@ -2986,3 +2986,23 @@ cairo_scaled_font_get_font_options (cairo_scaled_font_t *scaled_font,
_cairo_font_options_init_copy (options, &scaled_font->options);
}
slim_hidden_def (cairo_scaled_font_get_font_options);

/**
* cairo_scaled_font_get_hint_metrics:
* @scaled_font: a #cairo_scaled_font_t
*
* Mozilla extension since the required malloc/free to use
* cairo_scaled_font_get_font_options() above is too slow.
**/
cairo_public cairo_hint_metrics_t
cairo_scaled_font_get_hint_metrics (cairo_scaled_font_t *scaled_font)
{
cairo_font_options_t options;
if (scaled_font->status) {
_cairo_font_options_init_default (&options);
} else {
_cairo_font_options_init_copy (&options, &scaled_font->options);
}
return options.hint_metrics;
}
slim_hidden_def (cairo_scaled_font_get_hint_metrics);
3 changes: 3 additions & 0 deletions gfx/cairo/cairo/src/cairo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,9 @@ cairo_public void
cairo_scaled_font_get_font_options (cairo_scaled_font_t *scaled_font,
cairo_font_options_t *options);

/* mozilla extension, see https://bugzilla.mozilla.org/show_bug.cgi?id=1377257 */
cairo_public cairo_hint_metrics_t
cairo_scaled_font_get_hint_metrics (cairo_scaled_font_t *scaled_font);

/* Toy fonts */

Expand Down
1 change: 1 addition & 0 deletions gfx/cairo/cairo/src/cairoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,7 @@ slim_hidden_proto (cairo_scaled_font_get_ctm);
slim_hidden_proto (cairo_scaled_font_get_font_face);
slim_hidden_proto (cairo_scaled_font_get_font_matrix);
slim_hidden_proto (cairo_scaled_font_get_font_options);
slim_hidden_proto (cairo_scaled_font_get_hint_metrics);
slim_hidden_proto (cairo_scaled_font_glyph_extents);
slim_hidden_proto_no_warn (cairo_scaled_font_reference);
slim_hidden_proto (cairo_scaled_font_status);
Expand Down
5 changes: 1 addition & 4 deletions gfx/thebes/gfxContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1326,11 +1326,8 @@ gfxContext::GetRoundOffsetsToPixels(bool *aRoundX, bool *aRoundY)
}

// Sometimes hint metrics gets set for us, most notably for printing.
cairo_font_options_t *font_options = cairo_font_options_create();
cairo_scaled_font_get_font_options(scaled_font, font_options);
cairo_hint_metrics_t hint_metrics =
cairo_font_options_get_hint_metrics(font_options);
cairo_font_options_destroy(font_options);
cairo_scaled_font_get_hint_metrics(scaled_font);

switch (hint_metrics) {
case CAIRO_HINT_METRICS_OFF:
Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsChildView.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ class nsChildView : public nsBaseWidget
NSView<mozView>* GetEditorView();
#endif

nsCocoaWindow* GetXULWindowWidget();
nsCocoaWindow* GetXULWindowWidget() const;

NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) override;

Expand Down
6 changes: 3 additions & 3 deletions widget/cocoa/nsChildView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ virtual void BindAndDrawQuad(ShaderProgramOGL *aProg,
}

nsCocoaWindow*
nsChildView::GetXULWindowWidget()
nsChildView::GetXULWindowWidget() const
{
id windowDelegate = [[mView window] delegate];
if (windowDelegate && [windowDelegate isKindOfClass:[WindowDelegate class]]) {
Expand Down Expand Up @@ -1033,8 +1033,8 @@ static void PrintViewHierarchy(NSView *view)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;

if (!mVisible) {
return mVisible;
if (MOZ_UNLIKELY(!mVisible || !GetXULWindowWidget()->IsVisible())) {
return false;
}

// mVisible does not accurately reflect the state of a hidden tabbed view
Expand Down

0 comments on commit 8524974

Please sign in to comment.