Auto merge of #17092 - heycam:document-colors, r=xidorn

style: Add support for disabled document colors.

Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1355716.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17092)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-30 06:10:42 -05:00 committed by GitHub
commit 43862ba045
15 changed files with 103 additions and 13 deletions

View file

@ -6,9 +6,10 @@
use app_units::Au;
use context::QuirksMode;
use cssparser::{CssStringWriter, Parser, Token};
use cssparser::{CssStringWriter, Parser, RGBA, Token};
use euclid::Size2D;
use font_metrics::get_metrics_provider_for_product;
use gecko::values::convert_nscolor_to_rgba;
use gecko_bindings::bindings;
use gecko_bindings::structs::{nsCSSKeyword, nsCSSProps_KTableEntry, nsCSSValue, nsCSSUnit, nsStringBuffer};
use gecko_bindings::structs::{nsMediaExpression_Range, nsMediaFeature};
@ -134,6 +135,16 @@ impl Device {
Au((*self.pres_context).mVisibleArea.height))
})
}
/// Returns whether document colors are enabled.
pub fn use_document_colors(&self) -> bool {
unsafe { (*self.pres_context).mUseDocumentColors() != 0 }
}
/// Returns the default background color.
pub fn default_background_color(&self) -> RGBA {
convert_nscolor_to_rgba(unsafe { (*self.pres_context).mBackgroundColor })
}
}
/// A expression for gecko contains a reference to the media feature, the value