style: Add support for disabled document colors.

This commit is contained in:
Cameron McCormack 2017-05-30 14:33:33 +08:00
parent 9e89b0a229
commit c768169149
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